Skip to content

fix(langchain_ibm): Support either reasoning_content or reasoning in ChatWatsonx.invoke response - #346

Merged
Karol Zmorski (KarolZm) merged 2 commits into
mainfrom
dev-fix-support-reasoning-response
Sep 24, 2026
Merged

Karol Zmorski (KarolZm) merged 2 commits into
mainfrom
dev-fix-support-reasoning-response

Conversation

@KarolZm

Copy link
Copy Markdown
Collaborator

📝 Description

Related Issue:

💡 Summary of Changes

  • Added support for reasoning since either reasoning_content or reasoning may be included in the chat response when include_reasoning=True passed in parameters.
  • Updated tests with reasoning.
  • Updated tests for WatsonxToolkit and WatsonxTool because of API changes.

Example:

AIMessage(content='Hello! 👋 How can I assist you today?', additional_kwargs={'reasoning': 'We need to respond: "Hello!" maybe additional friendly greeting. Should be succinct.'}, response_metadata={'token_usage': {'completion_tokens': 38, 'prompt_tokens': 70, 'total_tokens': 108}, 'model_name': 'openai/gpt-oss-120b', 'system_fingerprint': '', 'finish_reason': 'stop'}, id='chatcmpl-4236eb085c28e2748b3add9d66a1cf7e', tool_calls=[], invalid_tool_calls=[], usage_metadata={'input_tokens': 70, 'output_tokens': 38, 'total_tokens': 108})

✅ PR Checklist

  • PR Title Format: {TYPE}({SCOPE}): {DESCRIPTION}

    • Examples:
      • feat(langchain-ibm): add multi-tenant support
      • fix(langchain-db2): resolve flag parsing error
      • docs(langchain-ibm): update API usage examples
    • Allowed {TYPE} values:
      feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert, release
    • Allowed {SCOPE} values (optional):
      langchain-ibm, langchain-db2
  • PR Description: The Description section clearly lists what was changed, why, and how it was tested.

  • Formatting, Linting & Tests
    Run the following commands from the root of the modified package(s):

    make format
    make lint
    make test

    ⚠️ PRs will only be considered if all checks pass in CI.
    See the contribution guidelines for more details.


🧪 Testing (optional)


🗒️ Notes (optional)

Thank you again for helping improve LangChain-IBM! 🚀
Your contribution makes the project better for everyone.

@Rafal-Chrzanowski-IBM Rafal-Chrzanowski-IBM left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@KarolZm
Karol Zmorski (KarolZm) merged commit c5e43ee into main Sep 24, 2026
20 checks passed
@KarolZm
Karol Zmorski (KarolZm) deleted the dev-fix-support-reasoning-response branch September 24, 2026 08:52
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.

4 participants