Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
Add model field to LLM failed events (#4267)
Vini Brasil06d953bf46c6
diff --git a/lib/crewai/src/crewai/events/types/llm_events.py b/lib/crewai/src/crewai/events/types/llm_events.pyindex e05c28f0b..c91009ed2 100644--- a/lib/crewai/src/crewai/events/types/llm_events.py+++ b/lib/crewai/src/crewai/events/types/llm_events.py@@ -9,6 +9,7 @@ from crewai.events.base_events import BaseEventclass LLMEventBase(BaseEvent):from_task: Any | None = Nonefrom_agent: Any | None = None+ model: str | None = Nonedef __init__(self, **data: Any) -> None:if data.get("from_task"):@@ -42,7 +43,6 @@ class LLMCallStartedEvent(LLMEventBase):"""type: str = "llm_call_started"- model: str | None = Nonemessages: str | list[dict[str, Any]] | None = Nonetools: list[dict[str, Any]] | None = Nonecallbacks: list[Any] | None = None@@ -56,7 +56,6 @@ class LLMCallCompletedEvent(LLMEventBase):messages: str | list[dict[str, Any]] | None = Noneresponse: Anycall_type: LLMCallType- model: str | None = Noneclass LLMCallFailedEvent(LLMEventBase):diff --git a/lib/crewai/src/crewai/llms/base_llm.py b/lib/crewai/src/crewai/llms/base_llm.pyindex c09c26453..00a75ab30 100644--- a/lib/crewai/src/crewai/llms/base_llm.py+++ b/lib/crewai/src/crewai/llms/base_llm.py@@ -345,6 +345,7 @@ class BaseLLM(ABC):error=error,from_task=from_task,from_agent=from_agent,+ model=self.model,),)