Skip to content

Commit 478d8e1

Browse files
fix: update EmbedderConfig type definition
1 parent aeadc8d commit 478d8e1

File tree

13 files changed

+48
-28
lines changed

13 files changed

+48
-28
lines changed

src/crewai/agent.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ class Agent(BaseAgent):
174174
)
175175

176176
@model_validator(mode="before")
177-
@classmethod
178-
def validate_from_repository(cls, v):
177+
def validate_from_repository(cls, v): # noqa: N805
179178
if v is not None and (from_repository := v.get("from_repository")):
180179
return load_agent_from_repository(from_repository) | v
181180
return v
@@ -686,7 +685,7 @@ def _inject_date_to_task(self, task):
686685
if not is_valid:
687686
raise ValueError(f"Invalid date format: {self.date_format}")
688687

689-
current_date: str = datetime.now().strftime(self.date_format)
688+
current_date = datetime.now().strftime(self.date_format)
690689
task.description += f"\n\nCurrent Date: {current_date}"
691690
except Exception as e:
692691
if hasattr(self, "_logger"):

src/crewai/rag/embeddings/providers/aws/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Any, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class BedrockProviderConfig(TypedDict, total=False):
79
"""Configuration for Bedrock provider."""
@@ -10,8 +12,8 @@ class BedrockProviderConfig(TypedDict, total=False):
1012
session: Any
1113

1214

13-
class BedrockProviderSpec(TypedDict):
15+
class BedrockProviderSpec(TypedDict, total=False):
1416
"""Bedrock provider specification."""
1517

16-
provider: Literal["amazon-bedrock"]
18+
provider: Required[Literal["amazon-bedrock"]]
1719
config: BedrockProviderConfig

src/crewai/rag/embeddings/providers/cohere/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class CohereProviderConfig(TypedDict, total=False):
79
"""Configuration for Cohere provider."""
@@ -10,8 +12,8 @@ class CohereProviderConfig(TypedDict, total=False):
1012
model_name: Annotated[str, "large"]
1113

1214

13-
class CohereProviderSpec(TypedDict):
15+
class CohereProviderSpec(TypedDict, total=False):
1416
"""Cohere provider specification."""
1517

16-
provider: Literal["cohere"]
18+
provider: Required[Literal["cohere"]]
1719
config: CohereProviderConfig

src/crewai/rag/embeddings/providers/custom/types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Literal, TypedDict
44

55
from chromadb.api.types import EmbeddingFunction
6+
from typing_extensions import Required
67

78

89
class CustomProviderConfig(TypedDict, total=False):
@@ -11,8 +12,8 @@ class CustomProviderConfig(TypedDict, total=False):
1112
embedding_callable: type[EmbeddingFunction]
1213

1314

14-
class CustomProviderSpec(TypedDict):
15+
class CustomProviderSpec(TypedDict, total=False):
1516
"""Custom provider specification."""
1617

17-
provider: Literal["custom"]
18+
provider: Required[Literal["custom"]]
1819
config: CustomProviderConfig

src/crewai/rag/embeddings/providers/google/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class GenerativeAiProviderConfig(TypedDict, total=False):
79
"""Configuration for Google Generative AI provider."""
@@ -27,8 +29,8 @@ class VertexAIProviderConfig(TypedDict, total=False):
2729
region: Annotated[str, "us-central1"]
2830

2931

30-
class VertexAIProviderSpec(TypedDict):
32+
class VertexAIProviderSpec(TypedDict, total=False):
3133
"""Vertex AI provider specification."""
3234

33-
provider: Literal["google-vertex"]
35+
provider: Required[Literal["google-vertex"]]
3436
config: VertexAIProviderConfig

src/crewai/rag/embeddings/providers/huggingface/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
from typing import Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class HuggingFaceProviderConfig(TypedDict, total=False):
79
"""Configuration for HuggingFace provider."""
810

911
url: str
1012

1113

12-
class HuggingFaceProviderSpec(TypedDict):
14+
class HuggingFaceProviderSpec(TypedDict, total=False):
1315
"""HuggingFace provider specification."""
1416

15-
provider: Literal["huggingface"]
17+
provider: Required[Literal["huggingface"]]
1618
config: HuggingFaceProviderConfig

src/crewai/rag/embeddings/providers/ibm/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Any, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class WatsonProviderConfig(TypedDict, total=False):
79
"""Configuration for Watson provider."""
@@ -35,8 +37,8 @@ class WatsonProviderConfig(TypedDict, total=False):
3537
proxies: dict
3638

3739

38-
class WatsonProviderSpec(TypedDict):
40+
class WatsonProviderSpec(TypedDict, total=False):
3941
"""Watson provider specification."""
4042

41-
provider: Literal["watson"]
43+
provider: Required[Literal["watson"]]
4244
config: WatsonProviderConfig

src/crewai/rag/embeddings/providers/instructor/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class InstructorProviderConfig(TypedDict, total=False):
79
"""Configuration for Instructor provider."""
@@ -11,8 +13,8 @@ class InstructorProviderConfig(TypedDict, total=False):
1113
instruction: str
1214

1315

14-
class InstructorProviderSpec(TypedDict):
16+
class InstructorProviderSpec(TypedDict, total=False):
1517
"""Instructor provider specification."""
1618

17-
provider: Literal["instructor"]
19+
provider: Required[Literal["instructor"]]
1820
config: InstructorProviderConfig

src/crewai/rag/embeddings/providers/jina/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class JinaProviderConfig(TypedDict, total=False):
79
"""Configuration for Jina provider."""
@@ -10,8 +12,8 @@ class JinaProviderConfig(TypedDict, total=False):
1012
model_name: Annotated[str, "jina-embeddings-v2-base-en"]
1113

1214

13-
class JinaProviderSpec(TypedDict):
15+
class JinaProviderSpec(TypedDict, total=False):
1416
"""Jina provider specification."""
1517

16-
provider: Literal["jina"]
18+
provider: Required[Literal["jina"]]
1719
config: JinaProviderConfig

src/crewai/rag/embeddings/providers/microsoft/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import Annotated, Any, Literal, TypedDict
44

5+
from typing_extensions import Required
6+
57

68
class AzureProviderConfig(TypedDict, total=False):
79
"""Configuration for Azure provider."""
@@ -17,8 +19,8 @@ class AzureProviderConfig(TypedDict, total=False):
1719
organization_id: str
1820

1921

20-
class AzureProviderSpec(TypedDict):
22+
class AzureProviderSpec(TypedDict, total=False):
2123
"""Azure provider specification."""
2224

23-
provider: Literal["azure"]
25+
provider: Required[Literal["azure"]]
2426
config: AzureProviderConfig

0 commit comments

Comments
 (0)