repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | from abc import ABC |
| #2 | from typing import Dict, Optional, Union |
| #3 | |
| #4 | import httpx |
| #5 | |
| #6 | |
| #7 | class BaseLlmConfig(ABC): |
| #8 | """ |
| #9 | Base configuration for LLMs with only common parameters. |
| #10 | Provider-specific configurations should be handled by separate config classes. |
| #11 | |
| #12 | This class contains only the parameters that are common across all LLM providers. |
| #13 | For provider-specific parameters, use the appropriate provider config class. |
| #14 | """ |
| #15 | |
| #16 | def __init__( |
| #17 | self, |
| #18 | model: Optional[Union[str, Dict]] = None, |
| #19 | temperature: float = 0.1, |
| #20 | api_key: Optional[str] = None, |
| #21 | max_tokens: int = 2000, |
| #22 | top_p: float = 0.1, |
| #23 | top_k: int = 1, |
| #24 | enable_vision: bool = False, |
| #25 | vision_details: Optional[str] = "auto", |
| #26 | http_client_proxies: Optional[Union[Dict, str]] = None, |
| #27 | ): |
| #28 | """ |
| #29 | Initialize a base configuration class instance for the LLM. |
| #30 | |
| #31 | Args: |
| #32 | model: The model identifier to use (e.g., "gpt-4.1-nano-2025-04-14", "claude-3-5-sonnet-20240620") |
| #33 | Defaults to None (will be set by provider-specific configs) |
| #34 | temperature: Controls the randomness of the model's output. |
| #35 | Higher values (closer to 1) make output more random, lower values make it more deterministic. |
| #36 | Range: 0.0 to 2.0. Defaults to 0.1 |
| #37 | api_key: API key for the LLM provider. If None, will try to get from environment variables. |
| #38 | Defaults to None |
| #39 | max_tokens: Maximum number of tokens to generate in the response. |
| #40 | Range: 1 to 4096 (varies by model). Defaults to 2000 |
| #41 | top_p: Nucleus sampling parameter. Controls diversity via nucleus sampling. |
| #42 | Higher values (closer to 1) make word selection more diverse. |
| #43 | Range: 0.0 to 1.0. Defaults to 0.1 |
| #44 | top_k: Top-k sampling parameter. Limits the number of tokens considered for each step. |
| #45 | Higher values make word selection more diverse. |
| #46 | Range: 1 to 40. Defaults to 1 |
| #47 | enable_vision: Whether to enable vision capabilities for the model. |
| #48 | Only applicable to vision-enabled models. Defaults to False |
| #49 | vision_details: Level of detail for vision processing. |
| #50 | Options: "low", "high", "auto". Defaults to "auto" |
| #51 | http_client_proxies: Proxy settings for HTTP client. |
| #52 | Can be a dict or string. Defaults to None |
| #53 | """ |
| #54 | self.model = model |
| #55 | self.temperature = temperature |
| #56 | self.api_key = api_key |
| #57 | self.max_tokens = max_tokens |
| #58 | self.top_p = top_p |
| #59 | self.top_k = top_k |
| #60 | self.enable_vision = enable_vision |
| #61 | self.vision_details = vision_details |
| #62 | self.http_client = httpx.Client(proxies=http_client_proxies) if http_client_proxies else None |
| #63 |