Add support for configurable embedding model (#1627)
Co-authored-by: Dev Khant <devkhant24@gmail.com>
This commit is contained in:
@@ -9,13 +9,14 @@ class EmbedderConfig(BaseModel):
|
||||
default="openai",
|
||||
)
|
||||
config: Optional[dict] = Field(
|
||||
description="Configuration for the specific embedding model", default=None
|
||||
description="Configuration for the specific embedding model",
|
||||
default={}
|
||||
)
|
||||
|
||||
@field_validator("config")
|
||||
def validate_config(cls, v, values):
|
||||
provider = values.data.get("provider")
|
||||
if provider in ["openai", "ollama"]:
|
||||
if provider in ["openai", "ollama", "huggingface", "azure_openai"]:
|
||||
return v
|
||||
else:
|
||||
raise ValueError(f"Unsupported embedding provider: {provider}")
|
||||
|
||||
Reference in New Issue
Block a user