feat(components): add modelKwargs parameter to OpenAI & Custom OpenAI nodes#6486
feat(components): add modelKwargs parameter to OpenAI & Custom OpenAI nodes#6486v1nayG wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| throw new Error("Invalid JSON in the ChatOpenAI's Model Kwargs: " + exception) | |
| throw new Error("Invalid JSON in the ChatOpenAICustom's Model Kwargs: " + exception) |
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, orlogit_bias) that are not standard, first-class fields on the Flowise model card.Adding the
Model KwargsJSON 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
pretty-quickandeslintscripts.