Update crew.py

Added OpenAiEmbeddingFunction as an allowed type to be in line with the documentation and to accept custom OAI-like embedder
This commit is contained in:
Marco
2025-01-13 13:41:40 +01:00
committed by GitHub
parent 3de81cedd6
commit 33c92e1861

View File

@@ -19,6 +19,8 @@ from pydantic import (
)
from pydantic_core import PydanticCustomError
from chromadb.utils.embedding_functions.openai_embedding_function import OpenAIEmbeddingFunction
from crewai.agent import Agent
from crewai.agents.agent_builder.base_agent import BaseAgent
from crewai.agents.cache import CacheHandler
@@ -136,7 +138,7 @@ class Crew(BaseModel):
default=None,
description="An instance of the UserMemory to be used by the Crew to store/fetch memories of a specific user.",
)
embedder: Optional[dict] = Field(
embedder: Optional[Union[dict, OpenAIEmbeddingFunction]] = Field(
default=None,
description="Configuration for the embedder to be used for the crew.",
)