add modelName selection into Azure

This commit is contained in:
chungyau97
2023-05-12 08:43:00 +07:00
parent bb3e6e3bf8
commit b0e9387087
3 changed files with 85 additions and 0 deletions
@@ -27,6 +27,39 @@ class AzureChatOpenAI_ChatModels implements INode {
name: 'azureOpenAIApiKey',
type: 'password'
},
{
label: 'Model Name',
name: 'modelName',
type: 'options',
options: [
{
label: 'gpt-4',
name: 'gpt-4'
},
{
label: 'gpt-4-0314',
name: 'gpt-4-0314'
},
{
label: 'gpt-4-32k',
name: 'gpt-4-32k'
},
{
label: 'gpt-4-32k-0314',
name: 'gpt-4-32k-0314'
},
{
label: 'gpt-3.5-turbo',
name: 'gpt-3.5-turbo'
},
{
label: 'gpt-3.5-turbo-0301',
name: 'gpt-3.5-turbo-0301'
}
],
default: 'gpt-3.5-turbo',
optional: true
},
{
label: 'Temperature',
name: 'temperature',
@@ -73,6 +106,7 @@ class AzureChatOpenAI_ChatModels implements INode {
async init(nodeData: INodeData): Promise<any> {
const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string
const modelName = nodeData.inputs?.modelName as string
const temperature = nodeData.inputs?.temperature as string
const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string
const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string
@@ -82,6 +116,7 @@ class AzureChatOpenAI_ChatModels implements INode {
const obj: Partial<AzureOpenAIInput> & Partial<OpenAIBaseInput> = {
temperature: parseInt(temperature, 10),
modelName,
azureOpenAIApiKey,
azureOpenAIApiInstanceName,
azureOpenAIApiDeploymentName,
@@ -27,6 +27,23 @@ class AzureOpenAIEmbedding_Embeddings implements INode {
name: 'azureOpenAIApiKey',
type: 'password'
},
{
label: 'Model Name',
name: 'modelName',
type: 'options',
options: [
{
label: 'text-embedding-ada-002',
name: 'text-embedding-ada-002'
},
{
label: 'text-search-ada-doc-001',
name: 'text-search-ada-doc-001'
}
],
default: 'text-embedding-ada-002',
optional: true
},
{
label: 'Azure OpenAI Api Instance Name',
name: 'azureOpenAIApiInstanceName',
@@ -74,11 +91,13 @@ class AzureOpenAIEmbedding_Embeddings implements INode {
const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string
const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string
const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string
const modelName = nodeData.inputs?.modelName as string
const stripNewLines = nodeData.inputs?.stripNewLines as boolean
const batchSize = nodeData.inputs?.batchSize as string
const timeout = nodeData.inputs?.timeout as string
const obj: Partial<OpenAIEmbeddingsParams> & Partial<AzureOpenAIInput> = {
modelName,
azureOpenAIApiKey,
azureOpenAIApiInstanceName,
azureOpenAIApiDeploymentName,
@@ -26,6 +26,35 @@ class AzureOpenAI_LLMs implements INode {
name: 'azureOpenAIApiKey',
type: 'password'
},
{
label: 'Model Name',
name: 'modelName',
type: 'options',
options: [
{
label: 'text-davinci-003',
name: 'text-davinci-003'
},
{
label: 'text-davinci-002',
name: 'text-davinci-002'
},
{
label: 'text-curie-001',
name: 'text-curie-001'
},
{
label: 'text-babbage-001',
name: 'text-babbage-001'
},
{
label: 'text-ada-001',
name: 'text-ada-001'
}
],
default: 'text-davinci-003',
optional: true
},
{
label: 'Temperature',
name: 'temperature',
@@ -73,6 +102,7 @@ class AzureOpenAI_LLMs implements INode {
async init(nodeData: INodeData): Promise<any> {
const azureOpenAIApiKey = nodeData.inputs?.azureOpenAIApiKey as string
const temperature = nodeData.inputs?.temperature as string
const modelName = nodeData.inputs?.modelName as string
const azureOpenAIApiInstanceName = nodeData.inputs?.azureOpenAIApiInstanceName as string
const azureOpenAIApiDeploymentName = nodeData.inputs?.azureOpenAIApiDeploymentName as string
const azureOpenAIApiVersion = nodeData.inputs?.azureOpenAIApiVersion as string
@@ -81,6 +111,7 @@ class AzureOpenAI_LLMs implements INode {
const obj: Partial<AzureOpenAIInput> & Partial<OpenAIInput> = {
temperature: parseInt(temperature, 10),
modelName,
azureOpenAIApiKey,
azureOpenAIApiInstanceName,
azureOpenAIApiDeploymentName,