-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Add LLM call events for improved observability #2214
Conversation
lorenzejay
commented
Feb 24, 2025
- 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
- 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
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #2214: Add LLM Call EventsOverviewThe PR implements new LLM call events for improved observability in the crewAI system. It introduces event tracking for the LLM calls' lifecycle, including start, completion, and failure states. This is a significant enhancement that will facilitate better debugging and operational insights. Code Quality Findings1. Type Hinting
2. Redundant Casting
3. Documentation
Historical Context and Learnings
Implications for Related Files
Specific Improvement Suggestions
ConclusionThis implementation is solid, significantly improving observability through structured event handling. The suggested improvements will enhance type safety, documentation, error handling, and overall code quality. The PR is recommended for merge after addressing the minor suggestions above, particularly the type hints and documentation additions. Looking forward to seeing these changes incorporated! |
- 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
Remove unnecessary LLMCallType conversion when emitting LLMCallCompletedEvent
Improve docstrings for LLM call events to more accurately describe their purpose and lifecycle
Enhance error handling by emitting a specific event when tool execution fails during LLM calls