LibreChat/packages/api
Danny Avila cdd4c09076
🧠 fix: Apply the Configured Reasoning Effort to Summarization (#15232)
A summarizer that reuses the main agent's client options silently inherits
the agent's reasoning effort: `summarization.parameters.reasoning_effort` is
a scalar, and every OpenAI-compatible LangChain client reads only `reasoning`
from constructor fields — `reasoning_effort` is a call-time option, so it is
dropped outright. A hidden summary configured for `low` runs at whatever the
agent resolved, and the yaml schema (scalars only) gives users no way to
express the nested shape themselves.

Translate the scalar the way the main flow's `getOpenAIConfig` does, into the
top-level `reasoning` object the client honors. Top-level rather than nested,
because the SDK spreads `parameters` onto the agent's client options: a
`modelKwargs` fragment would replace the agent's `modelKwargs` wholesale,
while `reasoning` merges over an inherited `modelKwargs.reasoning` in
`ChatOpenRouter` and is re-emitted as `reasoning_effort` by Chat Completions.

OpenRouter's adaptive Anthropic models keep the main flow's mapping, where
effort is expressed as `verbosity` rather than `reasoning.effort`.

Also prefer the provider `getOpenAIConfig` detects over the one
`getProviderConfig` reports, so a cross-endpoint summarizer pointed at an
OpenRouter endpoint whose config name isn't `openrouter` builds the same
client the main agent flow builds for it.

Supersedes #15088; thanks to @flamerged for the diagnosis and the OpenRouter
repro.
2026-08-25 23:54:36 -04:00
..
src 🧠 fix: Apply the Configured Reasoning Effort to Summarization (#15232) 2026-08-25 23:54:36 -04:00
types
.gitignore
babel.config.cjs
jest.config.mjs
jest.setup.cjs
package.json 📦 chore: bump @librechat/agents to v3.7.2 2026-08-25 18:35:21 -04:00
tsconfig-paths-bootstrap.mjs
tsconfig.build.json
tsconfig.json
tsconfig.spec.json
tsdown.config.mjs