Skip to content

feat(components): add modelKwargs parameter to OpenAI & Custom OpenAI nodes#6486

Open
v1nayG wants to merge 2 commits into
FlowiseAI:mainfrom
v1nayG:main
Open

feat(components): add modelKwargs parameter to OpenAI & Custom OpenAI nodes#6486
v1nayG wants to merge 2 commits into
FlowiseAI:mainfrom
v1nayG:main

Conversation

@v1nayG
Copy link
Copy Markdown

@v1nayG v1nayG commented Jun 6, 2026

Description

This PR adds support for custom request parameters (modelKwargs) to both the standard OpenAI and OpenAI Custom Model chat nodes.

Why is this needed?

Users employing OpenAI-compatible local/custom backends (such as vLLM, LM Studio, Ollama, etc.) often need to pass custom body parameters (like repetition_penalty, guided_json, parallel_tool_calls, or logit_bias) that are not standard, first-class fields on the Flowise model card.

Adding the Model Kwargs JSON input under "Additional Parameters" provides a clean, flexible way to supply these custom configurations directly to the model's constructor without cluttering the main node UI.

Verification

  • Built the packages successfully.
  • Code style has been verified and formatted by the built-in pre-commit pretty-quick and eslint scripts.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new modelKwargs input parameter of type JSON to both the ChatOpenAI and ChatOpenAICustom chat model nodes, allowing users to pass additional parameters to the model body. The input is parsed and assigned to the model configuration, with error handling in place for invalid JSON. A review comment points out a copy-paste error in the error message of the ChatOpenAICustom node, which incorrectly references ChatOpenAI instead of ChatOpenAICustom.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

const parsedModelKwargs = typeof modelKwargs === 'object' ? modelKwargs : JSON.parse(modelKwargs)
obj.modelKwargs = parsedModelKwargs
} catch (exception) {
throw new Error("Invalid JSON in the ChatOpenAI's Model Kwargs: " + exception)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

There is a copy-paste error in the error message. It refers to ChatOpenAI instead of ChatOpenAICustom. Updating this will make debugging easier and keep the error messages accurate for this node.

Suggested change
throw new Error("Invalid JSON in the ChatOpenAI's Model Kwargs: " + exception)
throw new Error("Invalid JSON in the ChatOpenAICustom's Model Kwargs: " + exception)

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.

1 participant