Commits
Click on a commit to change the comparison rangefeat(core): add StreamEventName Literal type for type-safe event handling
Add StreamEventName Literal type to langchain_core/runnables/schema.py
for type-safe event handling in astream_events.
Changes:
- Add StreamEventName Literal type with 26 event names
- Add StreamEventPhase Literal type for event phases
- Add get_event_name() helper function with centralized mapping
- Update BaseStreamEvent.event field to use StreamEventName
- Update event_stream.py to use get_event_name() helper
- Add comprehensive tests for new types and helper
Supported run_types: llm, chat_model, tool, chain, retriever, prompt, parser
Benefits:
- IDE autocompletion for event names
- Static type checking catches typos at development time
- Runtime validation via get_event_name() helper
- Fully backward compatible (Literal is str subtype)2 days ago
by donggyun112 Merge branch 'master' into feature/stream-event-name-literal-type2 days ago
by donggyun112 Merge branch 'master' into feature/stream-event-name-literal-type16 hours ago
by donggyun112