mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-16 04:18:35 +00:00
Fix trailing whitespace to satisfy ruff lint
Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -289,22 +289,22 @@ class Crew(FlowTrackable, BaseModel):
|
||||
cls, v: dict[str, Any] | None
|
||||
) -> dict[str, Any] | None:
|
||||
"""Normalize embedder config to support both flat and nested formats.
|
||||
|
||||
|
||||
Args:
|
||||
v: The embedder config to be normalized.
|
||||
|
||||
|
||||
Returns:
|
||||
The normalized embedder config with nested structure.
|
||||
"""
|
||||
if v is None or not isinstance(v, dict):
|
||||
return v
|
||||
|
||||
|
||||
if "provider" in v and "config" not in v:
|
||||
provider = v["provider"]
|
||||
config_fields = {k: val for k, val in v.items() if k != "provider"}
|
||||
if config_fields:
|
||||
return {"provider": provider, "config": config_fields}
|
||||
|
||||
|
||||
return v
|
||||
|
||||
@field_validator("config", mode="before")
|
||||
|
||||
@@ -230,7 +230,7 @@ def build_embedder_from_dict(spec):
|
||||
Args:
|
||||
spec: A dictionary with 'provider' and optionally 'config' keys.
|
||||
Supports two formats:
|
||||
|
||||
|
||||
Nested format (recommended):
|
||||
{
|
||||
"provider": "openai",
|
||||
@@ -239,7 +239,7 @@ def build_embedder_from_dict(spec):
|
||||
"model_name": "text-embedding-3-small"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Flat format (for backward compatibility):
|
||||
{
|
||||
"provider": "openai",
|
||||
|
||||
Reference in New Issue
Block a user