Skip to content

Conversation

keenborder786
Copy link
Contributor

@github-actions github-actions bot added core Related to the package `langchain-core` fix labels Oct 15, 2025
Copy link

codspeed-hq bot commented Oct 15, 2025

CodSpeed Performance Report

Merging #33498 will not alter performance

Comparing keenborder786:fix/on_llm_new_token (313b3d0) with master (d9e659c)

⚠️ 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

✅ 13 untouched
⏩ 21 skipped1

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.

@keenborder786
Copy link
Contributor Author

@eyurtsev

Comment on lines +536 to +538
run_manager.on_llm_new_token(
json.dumps(chunk.message.content), chunk=chunk
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to json.dumps the content or just call chunk.message.text as the original issue proposed?

my bias is to do chunk.message.text, which will represent tokens of text content. it will miss tokens from reasoning, tool calls, and other content, but I don't think on_llm_new_token was designed to support these well. so my thought is to go with well-defined behavior for now.

@ccurme ccurme self-assigned this Oct 20, 2025
@eyurtsev
Copy link
Collaborator

This requires very careful design review. It's possible that the type is wrong and the callback handler actually needs to support all content not just text. We need to check how things are wired

@keenborder786
Copy link
Contributor Author

@eyurtsev right now it only supports text, do you mean we need to update on_llm_new_token itself to support all type of objects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the package `langchain-core` fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants