-
Notifications
You must be signed in to change notification settings - Fork 20.2k
fix(core)!: flatten generations for LangChainTracer
#34415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #34415 will improve performances by 14.91%Comparing
|
| Mode | Benchmark | BASE |
HEAD |
Change | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_import_time[PydanticOutputParser] |
597.5 ms | 520 ms | +14.91% |
| ⚡ | WallTime | test_import_time[RunnableLambda] |
545.1 ms | 481.7 ms | +13.17% |
| ⚡ | WallTime | test_import_time[Runnable] |
538.9 ms | 486.6 ms | +10.77% |
| ⚡ | WallTime | test_import_time[CallbackManager] |
513.1 ms | 453 ms | +13.27% |
| ⚡ | WallTime | test_import_time[tool] |
574.3 ms | 509.6 ms | +12.7% |
Footnotes
-
21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
01f2bef to
4fa21f7
Compare
4fa21f7 to
02ced19
Compare
|
Punting to v2 |
LangChainTracer
LangChainTracerLangChainTracer
…4414) Adds `usage_metadata` (token counts, etc.) to the run metadata in `LangChainTracer`. When an LLM run ends, usage metadata is extracted from all generations and aggregated using the existing `add_usage` helper, then stored in `run.extra["metadata"]["usage_metadata"]`. The original data in outputs remains unchanged. Also, see #34415 --------- Co-authored-by: Mason Daugherty <[email protected]> Co-authored-by: Mason Daugherty <[email protected]>
(breaking - do not merge)
ref langchain-ai/langchainjs#9688
usage_metadatafrom generations, storing it inrun.extra["metadata"]Example
Before (nested structure):
After (flattened):
Flattening only occurs for single-generation outputs; multiple generations/batches retain the original nested structure.