Add model field to LLM failed events (#4267)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled

Move the `model` field from `LLMCallStartedEvent` and
`LLMCallCompletedEvent` to the base `LLMEventBase` class.
This commit is contained in:
Vini Brasil
2026-01-22 16:19:18 +01:00
committed by GitHub
parent f997b73577
commit 06d953bf46
2 changed files with 2 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ from crewai.events.base_events import BaseEvent
class LLMEventBase(BaseEvent):
from_task: Any | None = None
from_agent: Any | None = None
model: str | None = None
def __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 = None
messages: str | list[dict[str, Any]] | None = None
tools: list[dict[str, Any]] | None = None
callbacks: list[Any] | None = None
@@ -56,7 +56,6 @@ class LLMCallCompletedEvent(LLMEventBase):
messages: str | list[dict[str, Any]] | None = None
response: Any
call_type: LLMCallType
model: str | None = None
class LLMCallFailedEvent(LLMEventBase):

View File

@@ -345,6 +345,7 @@ class BaseLLM(ABC):
error=error,
from_task=from_task,
from_agent=from_agent,
model=self.model,
),
)