-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
The api does not define all config keys. This doesn't allow api to return all keys that could be set. For reference llms/config, vectordbs/config, and embedders/config.
Possible Solutions
- The naive approach is to define all keys in each config class.
- Define different sub classes and instantiate based on the service and properties defined.
Example:
Before:
class EmbedderConfig(BaseModel):
model: str = Field(..., description="Embedder model name")
api_key: Optional[str] = Field(None, description="API key or 'env:API_KEY' to use environment variable")
ollama_base_url: Optional[str] = Field(None, description="Base URL for Ollama server (e.g., http://host.docker.internal:11434)")
After:
class EmbedderConfig(BaseModel):
model: str = Field(..., description="Embedder model name")
api_key: Optional[str] = Field(None, description="API key or 'env:API_KEY' to use environment variable")
embedding_dims: Optional[int] = Field(None, description="Embedding dimensions for the model")
http_client_proxies: Optional[str] = Field(None, description="For any, set the http client proxies")
class OllamaEmbedderConfig(EmbedderConfig):
ollama_base_url: Optional[str] = Field(None, description="Base URL for Ollama server (e.g., http://host.docker.internal:11434)")
class AzureEmbedderConfig(EmbedderConfig):
azure_kwargs: Optional[str] = Field(None, description="Key-Value arguments for the AzureOpenAI embedding model")
- Can make a factory method to create classes based on properties
Metadata
Metadata
Assignees
Labels
No labels