Skip to content

Feature/Add base path to azure #2984

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

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AzureChatOpenAI_ChatModels implements INode {
constructor() {
this.label = 'Azure ChatOpenAI'
this.name = 'azureChatOpenAI'
this.version = 4.0
this.version = 5.0
this.type = 'AzureChatOpenAI'
this.icon = 'Azure.svg'
this.category = 'Chat Models'
Expand Down Expand Up @@ -94,6 +94,13 @@ class AzureChatOpenAI_ChatModels implements INode {
optional: true,
additionalParams: true
},
{
label: 'BasePath',
name: 'basepath',
type: 'string',
optional: true,
additionalParams: true
},
{
label: 'Allow Image Uploads',
name: 'allowImageUploads',
Expand Down Expand Up @@ -146,6 +153,7 @@ class AzureChatOpenAI_ChatModels implements INode {
const streaming = nodeData.inputs?.streaming as boolean
const cache = nodeData.inputs?.cache as BaseCache
const topP = nodeData.inputs?.topP as string
const basePath = nodeData.inputs?.basepath as string

const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData)
Expand All @@ -172,6 +180,7 @@ class AzureChatOpenAI_ChatModels implements INode {
if (timeout) obj.timeout = parseInt(timeout, 10)
if (cache) obj.cache = cache
if (topP) obj.topP = parseFloat(topP)
if (basePath) obj.azureOpenAIBasePath = basePath

const multiModalOption: IMultiModalOption = {
image: {
Expand Down
11 changes: 10 additions & 1 deletion packages/components/nodes/llms/Azure OpenAI/AzureOpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AzureOpenAI_LLMs implements INode {
constructor() {
this.label = 'Azure OpenAI'
this.name = 'azureOpenAI'
this.version = 3.0
this.version = 4.0
this.type = 'AzureOpenAI'
this.icon = 'Azure.svg'
this.category = 'LLMs'
Expand Down Expand Up @@ -101,6 +101,13 @@ class AzureOpenAI_LLMs implements INode {
step: 1,
optional: true,
additionalParams: true
},
{
label: 'BasePath',
name: 'basepath',
type: 'string',
optional: true,
additionalParams: true
}
]
}
Expand All @@ -122,6 +129,7 @@ class AzureOpenAI_LLMs implements INode {
const timeout = nodeData.inputs?.timeout as string
const bestOf = nodeData.inputs?.bestOf as string
const streaming = nodeData.inputs?.streaming as boolean
const basePath = nodeData.inputs?.basepath as string

const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const azureOpenAIApiKey = getCredentialParam('azureOpenAIApiKey', credentialData, nodeData)
Expand All @@ -148,6 +156,7 @@ class AzureOpenAI_LLMs implements INode {
if (timeout) obj.timeout = parseInt(timeout, 10)
if (bestOf) obj.bestOf = parseInt(bestOf, 10)
if (cache) obj.cache = cache
if (basePath) obj.azureOpenAIBasePath = basePath

const model = new OpenAI(obj)
return model
Expand Down
Loading