Skip to content

feat: add reasoning_effort support to ChatGroq #10133

Description

@YJack0000

Summary

The Python langchain-groq package supports reasoning_effort as a first-class constructor parameter and passes it to the Groq API via _default_params. The JS/TS @langchain/groq package does not — there is no way to set reasoning_effort through the constructor or call options.

Current behavior (JS @langchain/groq)

ChatGroq has reasoningFormat (maps to reasoning_format) but no reasoningEffort field. The invocationParams() method constructs the request body explicitly and does not forward arbitrary kwargs, so there's no workaround via extra fields.

// This does NOT work — reasoningEffort is silently ignored
const model = new ChatGroq({
  model: 'openai/gpt-oss-120b',
  reasoningEffort: 'low', // ← not a recognized field
});

Expected behavior

ChatGroq should accept reasoningEffort (or reasoning_effort) as a constructor param and include it in the API request body, matching the Python implementation:

# Python langchain-groq — this works
model = ChatGroq(
    model="openai/gpt-oss-120b",
    reasoning_effort="low",
)

Proposed changes

  1. Add reasoningEffort field to ChatGroqInput interface
  2. Add class field with type from groq-sdk
  3. Store it on the class instance (in constructor)
  4. Include it in invocationParams() output
  5. Add to CREATE_PARAMS_BASE_CALL_KEYS for call options support
  6. Add to lc_serialized_keys for serialization

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions