Skip to content

Conversation

@cbornet
Copy link
Collaborator

@cbornet cbornet commented Dec 30, 2025

No description provided.

@cbornet cbornet requested a review from eyurtsev as a code owner December 30, 2025 19:13
@github-actions github-actions bot added core `langchain-core` package issues & PRs infra PRs made that include chores, devops, repo meta changes labels Dec 30, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 30, 2025

CodSpeed Performance Report

Merging #34545 will improve performance by 26.72%

Comparing cbornet:fix-core-any-generics (405f1e4) with master (5517ef3)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

⚡ 10 improvements
✅ 3 untouched
⏩ 21 skipped1

Benchmarks breakdown

Mode Benchmark BASE HEAD Efficiency
WallTime test_import_time[tool] 666.8 ms 526.2 ms +26.72%
WallTime test_import_time[Document] 217.7 ms 189 ms +15.16%
WallTime test_import_time[InMemoryVectorStore] 790.7 ms 630.6 ms +25.39%
WallTime test_import_time[CallbackManager] 588.6 ms 473.5 ms +24.29%
WallTime test_import_time[RunnableLambda] 625.8 ms 513.9 ms +21.79%
WallTime test_import_time[BaseChatModel] 661.8 ms 536.6 ms +23.34%
WallTime test_import_time[HumanMessage] 312.3 ms 263.8 ms +18.39%
WallTime test_import_time[Runnable] 636.1 ms 503.3 ms +26.4%
WallTime test_import_time[ChatPromptTemplate] 741.8 ms 607.9 ms +22.04%
WallTime test_import_time[LangChainTracer] 563.9 ms 461.4 ms +22.22%

Footnotes

  1. 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.

@cbornet cbornet force-pushed the fix-core-any-generics branch 2 times, most recently from ce083cc to 67cf257 Compare December 31, 2025 01:41
@github-actions github-actions bot added the text-splitters Related to the package `text-splitters` label Dec 31, 2025
@cbornet cbornet force-pushed the fix-core-any-generics branch 4 times, most recently from 609f765 to f1338b5 Compare December 31, 2025 10:58
cls: type[Self],
template: str
| list[str | _TextTemplateParam | _ImageTemplateParam | dict[str, Any]],
| Sequence[str | _TextTemplateParam | _ImageTemplateParam | dict[str, Any]],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to invariant Sequence to allow passing list[dict[str, Any]]

async for chunk in map_output:
yield chunk
first_chunk = await first_map_chunk_task
if first_chunk is not None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing revealed an issue: if map_output is exhausted, we shouldn't yield None

return None


def _get_filtered_args(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private and not used anymore

for depth, value in self.current_header_stack:
header_key = self.splittable_headers.get("#" * depth)
self.current_chunk.metadata[header_key] = value
if header_key is not None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing revealed an issue: if self.splittable_headers doesn't have the "#" * depth key, we shouldn't add a None key to chunk metadata.

@cbornet cbornet force-pushed the fix-core-any-generics branch from f1338b5 to 405f1e4 Compare December 31, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs infra PRs made that include chores, devops, repo meta changes text-splitters Related to the package `text-splitters`

1 participant