Skip to content

Conversation

@pawel-twardziak
Copy link
Contributor

What has been done:

  • Store Ollama model "thinking" responses in additional_kwargs.reasoning_content instead of mixing with main content
  • Preserve additional_kwargs when constructing non-chunk messages from streams
  • Add unit test verifying thinking content is properly separated
  • Add integration tests ensuring reasoning_content is populated when think=true and absent when think=false
  • Fixes issue where thinking tags or content were appearing in the main response content

Fixes #9089

@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2025

⚠️ No Changeset found

Latest commit: c61c8a8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@langchain/google-common" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@langchain/google-gauth" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@langchain/google-webauth" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@langchain/google-vertexai" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@langchain/google-vertexai-web" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@langchain/google-genai" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "examples" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@vercel
Copy link

vercel bot commented Oct 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Updated (UTC)
langchainjs-docs Ignored Ignored Oct 14, 2025 4:37pm

@pawel-twardziak
Copy link
Contributor Author

I need to update my branch with main since main has changed in the area of my work

@djholt
Copy link

djholt commented Oct 28, 2025

Is this ready/able to be merged?

@pawel-twardziak
Copy link
Contributor Author

@djholt not yet - I need to align it to the v1 code

@brianneisler
Copy link

@pawel-twardziak how can i help you get this across the finish line?

@pawel-twardziak
Copy link
Contributor Author

@brianneisler You already did it :) Your need motivates me to update this PR! :) Hold my beer bro...

What has been done:

- Store Ollama model "thinking" responses in additional_kwargs.reasoning_content instead of mixing with main content
- Preserve additional_kwargs when constructing non-chunk messages from streams
- Add unit test verifying thinking content is properly separated
- Add tests ensuring reasoning_content is populated when think=true and absent when think=false
- Fixes issue where thinking tags or content were appearing in the main response content

Fixes langchain-ai#9089
@pawel-twardziak pawel-twardziak force-pushed the ollama_model_no_reasoning_content branch from 289a522 to c61c8a8 Compare November 6, 2025 22:49
@pawel-twardziak
Copy link
Contributor Author

pawel-twardziak commented Nov 6, 2025

@djholt @brianneisler updated
CC @hntrl @sydney-runkle

@ItzCrazyKns
Copy link

Hey Langchain team, any updates on when this can be merged?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatOllama: AIMessageChunk missing reasoning_content in additional_kwargs (concatenated into content instead)

5 participants