Skip to content

Conversation

Pouyanpi
Copy link
Collaborator

Description

Replaces custom reasoning trace extraction with LangChain's built-in additional_kwargs approach, removing ~1,500 lines of code.

Breaking Changes

  • reasoning_config (including start_token, end_token, remove_reasoning_traces) removed from model configuration
  • apply_to_reasoning_traces removed from output rails configuration

Migration

Remove reasoning_config sections from config files. Reasoning traces are now automatically extracted by LangChain for supported models (e.g., DeepSeek-R1).

  • TODO:
  • deprecate reasoning_config from config gracefully

Changes

  • Removed: ReasoningModelConfig, ParsedTaskOutput, token extraction logic
  • Added: Automatic extraction from response.additional_kwargs['reasoning_content']
  • Deleted: 4 test files (~1,085 lines)

@Pouyanpi Pouyanpi marked this pull request as draft September 30, 2025 15:28
…al_kwargs

BREAKING CHANGE: Remove reasoning_config and apply_to_reasoning_traces
config options
  - Remove ReasoningModelConfig, ParsedTaskOutput, and related
extraction logic
  - Replace with automatic extraction from
response.additional_kwargs['reasoning_content']
  - Remove 1,085 lines of test code and related infrastructure
  - Simplify parse_task_output() to return str directly
  - Update DeepSeek-R1 and Nemotron example configs

Reasoning traces are now automatically extracted by LangChain and stored
in additional_kwargs, eliminating the need for token-based parsing and
complex configuration options.
@Pouyanpi Pouyanpi force-pushed the refactor/reasoning-traces-langchain-integration branch from c4d3366 to 8aee801 Compare September 30, 2025 15:47
@Pouyanpi Pouyanpi changed the title refactor!: replace reasoning trace extraction with LangChain addition… refactor!: drop reasoning trace extraction logic Sep 30, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
nemoguardrails/actions/llm/utils.py 50.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Pouyanpi Pouyanpi self-assigned this Sep 30, 2025
@Pouyanpi Pouyanpi added this to the v0.18.0 milestone Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants