langchain-ai
langchain
BlogDocsChangelog

feat(core): add `StreamEventName` `Literal` type for type-safe event handling

#34676
Comparing
donggyun112:feature/stream-event-name-literal-type
(
2179bc9
) with
master
(
2ef2388
)
CodSpeed Performance Gauge
-3%
Untouched
13
Skipped
21

Benchmarks

Skipped (21)

Passed

test_import_time[RunnableLambda]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-1%
507.7 ms514.4 ms
test_async_callbacks_in_sync
libs/core/tests/benchmarks/test_async_callbacks.py
CodSpeed Performance Gauge
-2%
23.8 ms24.2 ms
test_import_time[LangChainTracer]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-2%
450.1 ms461.5 ms
test_import_time[Document]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
189.2 ms194.2 ms
test_import_time[InMemoryRateLimiter]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
174.2 ms178.9 ms
test_import_time[CallbackManager]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
473 ms486.5 ms
test_import_time[Runnable]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
504.6 ms519.6 ms
test_import_time[HumanMessage]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
263.8 ms271.9 ms
test_import_time[ChatPromptTemplate]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-3%
639.3 ms659.3 ms
test_import_time[tool]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
530.2 ms549.5 ms
test_import_time[PydanticOutputParser]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
544 ms564.2 ms
test_import_time[BaseChatModel]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
549.2 ms572.3 ms
test_import_time[InMemoryVectorStore]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
-4%
607.5 ms633.2 ms

Commits

Click on a commit to change the comparison range
Base
master
2ef2388
-3.49%
feat(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)
9af7620
2 days ago
by donggyun112
+3.04%
Merge branch 'master' into feature/stream-event-name-literal-type
bdc61b7
2 days ago
by donggyun112
-2.44%
Merge branch 'master' into feature/stream-event-name-literal-type
2179bc9
16 hours ago
by donggyun112
© 2026 CodSpeed Technology
Home Terms Privacy Docs