Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ChatOpenAI_ChatModels to include stopSequence parameter #3388

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/components/nodes/chatmodels/ChatOpenAI/ChatOpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ class ChatOpenAI_ChatModels implements INode {
optional: true,
additionalParams: true
},
{
label: 'Stop Sequence',
name: 'stopSequence',
type: 'string',
optional: true,
additionalParams: true
HenryHengZJ marked this conversation as resolved.
Show resolved Hide resolved
},
{
label: 'BaseOptions',
name: 'baseOptions',
Expand Down Expand Up @@ -168,6 +175,7 @@ class ChatOpenAI_ChatModels implements INode {
const frequencyPenalty = nodeData.inputs?.frequencyPenalty as string
const presencePenalty = nodeData.inputs?.presencePenalty as string
const timeout = nodeData.inputs?.timeout as string
const stopSequenceArray = nodeData.inputs?.stopSequence.split(' ')
const streaming = nodeData.inputs?.streaming as boolean
const basePath = nodeData.inputs?.basepath as string
const proxyUrl = nodeData.inputs?.proxyUrl as string
Expand Down Expand Up @@ -199,6 +207,7 @@ class ChatOpenAI_ChatModels implements INode {
if (presencePenalty) obj.presencePenalty = parseFloat(presencePenalty)
if (timeout) obj.timeout = parseInt(timeout, 10)
if (cache) obj.cache = cache
if (stopSequenceArray) obj.stop = stopSequenceArray

let parsedBaseOptions: any | undefined = undefined

Expand Down
Loading