mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
* feat: Add LLM call events for improved observability - Introduce new LLM call events: LLMCallStartedEvent, LLMCallCompletedEvent, and LLMCallFailedEvent - Emit events for LLM calls and tool calls to provide better tracking and debugging - Add event handling in the LLM class to track call lifecycle - Update event bus to support new LLM-related events - Add test cases to validate LLM event emissions * feat: Add event handling for LLM call lifecycle events - Implement event listeners for LLM call events in EventListener - Add logging for LLM call start, completion, and failure events - Import and register new LLM-specific event types * less log * refactor: Update LLM event response type to support Any * refactor: Simplify LLM call completed event emission Remove unnecessary LLMCallType conversion when emitting LLMCallCompletedEvent * refactor: Update LLM event docstrings for clarity Improve docstrings for LLM call events to more accurately describe their purpose and lifecycle * feat: Add LLMCallFailedEvent emission for tool execution errors Enhance error handling by emitting a specific event when tool execution fails during LLM calls
33 lines
700 B
Python
33 lines
700 B
Python
from typing import Optional
|
|
|
|
from crewai.tasks.task_output import TaskOutput
|
|
from crewai.utilities.events.base_events import CrewEvent
|
|
|
|
|
|
class TaskStartedEvent(CrewEvent):
|
|
"""Event emitted when a task starts"""
|
|
|
|
type: str = "task_started"
|
|
context: Optional[str]
|
|
|
|
|
|
class TaskCompletedEvent(CrewEvent):
|
|
"""Event emitted when a task completes"""
|
|
|
|
output: TaskOutput
|
|
type: str = "task_completed"
|
|
|
|
|
|
class TaskFailedEvent(CrewEvent):
|
|
"""Event emitted when a task fails"""
|
|
|
|
error: str
|
|
type: str = "task_failed"
|
|
|
|
|
|
class TaskEvaluationEvent(CrewEvent):
|
|
"""Event emitted when a task evaluation is completed"""
|
|
|
|
type: str = "task_evaluation"
|
|
evaluation_type: str
|