mirror of https://github.com/FlowiseAI/Flowise.git
Feature: Add BasePath parameter setting support to ChatOpenAI LlamaIndex (#2132)
* ChatOpenAI LlamaIndex support BasePath Param * Add BasePath parameter setting support to ChatOpenAI LlamaIndex * Add BasePath parameter setting support to ChatOpenAI LlamaIndexchore/Dropdown-UI-Height
parent
19bb23440a
commit
827de07e94
|
|
@ -124,6 +124,13 @@ class ChatOpenAI_LlamaIndex_LLMs implements INode {
|
|||
step: 1,
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
},
|
||||
{
|
||||
label: 'BasePath',
|
||||
name: 'basepath',
|
||||
type: 'string',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -134,6 +141,7 @@ class ChatOpenAI_LlamaIndex_LLMs implements INode {
|
|||
const maxTokens = nodeData.inputs?.maxTokens as string
|
||||
const topP = nodeData.inputs?.topP as string
|
||||
const timeout = nodeData.inputs?.timeout as string
|
||||
const basePath = nodeData.inputs?.basepath as string
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData)
|
||||
|
|
@ -144,6 +152,12 @@ class ChatOpenAI_LlamaIndex_LLMs implements INode {
|
|||
apiKey: openAIApiKey
|
||||
}
|
||||
|
||||
if (basePath) {
|
||||
obj.additionalSessionOptions = {
|
||||
baseURL: basePath
|
||||
}
|
||||
}
|
||||
|
||||
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||
if (topP) obj.topP = parseFloat(topP)
|
||||
if (timeout) obj.timeout = parseInt(timeout, 10)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class OpenAIEmbedding_LlamaIndex_Embeddings implements INode {
|
|||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const timeout = nodeData.inputs?.timeout as string
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
const basePath = nodeData.inputs?.basepath as string
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const openAIApiKey = getCredentialParam('openAIApiKey', credentialData, nodeData)
|
||||
|
|
@ -82,7 +83,11 @@ class OpenAIEmbedding_LlamaIndex_Embeddings implements INode {
|
|||
model: modelName
|
||||
}
|
||||
if (timeout) obj.timeout = parseInt(timeout, 10)
|
||||
|
||||
if (basePath) {
|
||||
obj.additionalSessionOptions = {
|
||||
baseURL: basePath
|
||||
}
|
||||
}
|
||||
const model = new OpenAIEmbedding(obj)
|
||||
return model
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue