mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
add chatOpenAI Finetuned
This commit is contained in:
@@ -125,6 +125,13 @@ class OpenAI_LLMs implements INode {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
},
|
||||
{
|
||||
label: 'BaseOptions',
|
||||
name: 'baseOptions',
|
||||
type: 'json',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -141,6 +148,7 @@ class OpenAI_LLMs implements INode {
|
||||
const bestOf = nodeData.inputs?.bestOf as string
|
||||
const streaming = nodeData.inputs?.streaming as boolean
|
||||
const basePath = nodeData.inputs?.basepath as string
|
||||
const baseOptions = nodeData.inputs?.baseOptions
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData)
|
||||
@@ -160,8 +168,19 @@ class OpenAI_LLMs implements INode {
|
||||
if (batchSize) obj.batchSize = parseInt(batchSize, 10)
|
||||
if (bestOf) obj.bestOf = parseInt(bestOf, 10)
|
||||
|
||||
let parsedBaseOptions: any | undefined = undefined
|
||||
|
||||
if (baseOptions) {
|
||||
try {
|
||||
parsedBaseOptions = typeof baseOptions === 'object' ? baseOptions : JSON.parse(baseOptions)
|
||||
} catch (exception) {
|
||||
throw new Error("Invalid JSON in the OpenAI's BaseOptions: " + exception)
|
||||
}
|
||||
}
|
||||
|
||||
const model = new OpenAI(obj, {
|
||||
basePath
|
||||
basePath,
|
||||
baseOptions: parsedBaseOptions
|
||||
})
|
||||
return model
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user