💭 fix: Preserve Custom Endpoint Reasoning Params#13447
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR fixes reasoning parameter passthrough for OpenAI-compatible custom endpoints, ensuring the selected reasoning effort/shape is preserved through LangChain/OpenAI client configuration (not dropped due to model-name gating), while adding an endpoint-level configuration knob to choose the reasoning parameter format (including a Vercel AI Gateway default).
Changes:
- Added
ReasoningParameterFormatplus config/schema/type support forcustomParams.reasoningFormat. - Updated OpenAI LLM config building to route custom-endpoint reasoning via
modelKwargs(and supportreasoning_object/disabled), defaulting Vercel gateways to thereasoningobject shape. - Expanded unit tests across API + data-provider to validate default behavior, overrides, disabled passthrough, and schema validation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/data-provider/src/types.ts | Extends TConfig.customParams to include reasoningFormat. |
| packages/data-provider/src/schemas.ts | Introduces ReasoningParameterFormat enum + Zod enum schema. |
| packages/data-provider/src/config.ts | Validates customParams.reasoningFormat in endpointSchema. |
| packages/data-provider/specs/config-schemas.spec.ts | Adds schema acceptance/rejection tests for reasoningFormat. |
| packages/api/src/endpoints/openai/llm.ts | Implements applyReasoningConfig() and routes custom reasoning via modelKwargs with configurable format. |
| packages/api/src/endpoints/openai/llm.spec.ts | Adds coverage for custom reasoning passthrough/object/disabled modes. |
| packages/api/src/endpoints/openai/config.ts | Adds Vercel default + explicit override plumbing for reasoningFormat. |
| packages/api/src/endpoints/openai/config.spec.ts | Updates/extends reasoning tests (custom endpoints, Vercel defaults/overrides). |
| packages/api/src/endpoints/openai/config.backward-compat.spec.ts | Updates backward-compat expectations for Cloudflare/custom reasoning passthrough. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75f3bd9bf6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
GitNexus: 🚀 deployedThe |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6007a01ee3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
GitNexus: 🚀 deployedThe |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 517ae0ba82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
GitNexus: 🚀 deployedThe |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
GitNexus: 🚀 deployedThe |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ca0d552 to
e3fbd6e
Compare
GitNexus: 🚀 deployedThe |
e3fbd6e to
ebaf01b
Compare
GitNexus: 🚀 deployedThe |
|
@codex review |
c1d5cf6 to
8ead5c4
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
GitNexus: 🚀 deployedThe |
8ead5c4 to
4f1f27e
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
GitNexus: 🚀 deployedThe |
* fix: Preserve custom endpoint reasoning params * fix: Address custom reasoning review cases * fix: Format configured reasoning defaults * fix: Honor dropped reasoning params * fix: Configure custom reasoning response key
Summary
I fixed custom OpenAI-compatible endpoint reasoning so LibreChat no longer loses the selected reasoning effort before the request reaches provider gateways.
customParams.reasoningFormatfor custom endpoints withreasoning_effort,reasoning_object, anddisabledmodes.modelKwargsso LangChain forwards it for provider-prefixed and proxy-defined model IDs.reasoning: { effort }, while keeping plain custom endpoints on the OpenAI-compatiblereasoning_effortformat.Fixes #13442.
Change Type
Testing
npx jest src/endpoints/openai/llm.spec.ts src/endpoints/openai/config.spec.ts src/endpoints/openai/config.backward-compat.spec.ts --runInBandfrompackages/api.npx jest specs/config-schemas.spec.ts --runInBandfrompackages/data-provider.npm run buildfrompackages/data-provider.npm run buildfrompackages/api.git diff --check.ChatOpenAIrequest body with a fake fetch: Vercel sendsreasoning: { effort: "low" }, plain custom sendsreasoning_effort: "low", and disabled sends no reasoning param.openai/gpt-5-mini, streaming off, andreasoning_effort: low; the response returnedoutput_token_details.reasoning: 64.Test Configuration:
openai/gpt-5-miniChecklist