Skip to content

Commit

Permalink
fix: cannot load azure models (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed May 16, 2024
1 parent ab48f79 commit baa9d8d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/common/engines/azure.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
/* eslint-disable camelcase */
import { getSettings } from '../utils'
import { AbstractOpenAI } from './abstract-openai'
import { IModel } from './interfaces'

export class Azure extends AbstractOpenAI {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async listModels(apiKey_: string | undefined): Promise<IModel[]> {
return [
{ name: 'gpt-3.5-turbo-1106', id: 'gpt-3.5-turbo-1106' },
{ name: 'gpt-3.5-turbo', id: 'gpt-3.5-turbo' },
{ name: 'gpt-3.5-turbo-0613', id: 'gpt-3.5-turbo-0613' },
{ name: 'gpt-3.5-turbo-0301', id: 'gpt-3.5-turbo-0301' },
{ name: 'gpt-3.5-turbo-16k', id: 'gpt-3.5-turbo-16k' },
{ name: 'gpt-3.5-turbo-16k-0613', id: 'gpt-3.5-turbo-16k-0613' },
{ name: 'gpt-4', id: 'gpt-4' },
{ name: 'gpt-4o (recommended)', id: 'gpt-4o' },
{ name: 'gpt-4-turbo', id: 'gpt-4-turbo' },
{ name: 'gpt-4-turbo-2024-04-09', id: 'gpt-4-turbo-2024-04-09' },
{ name: 'gpt-4-turbo-preview', id: 'gpt-4-turbo-preview' },
{ name: 'gpt-4-0125-preview ', id: 'gpt-4-0125-preview' },
{ name: 'gpt-4-1106-preview', id: 'gpt-4-1106-preview' },
{ name: 'gpt-4-0314', id: 'gpt-4-0314' },
{ name: 'gpt-4-0613', id: 'gpt-4-0613' },
{ name: 'gpt-4-32k', id: 'gpt-4-32k' },
{ name: 'gpt-4-32k-0314', id: 'gpt-4-32k-0314' },
{ name: 'gpt-4-32k-0613', id: 'gpt-4-32k-0613' },
]
}

async isChatAPI(): Promise<boolean> {
const settings = await getSettings()
return !(settings.azureAPIURLPath && settings.azureAPIURLPath.indexOf('/chat/completions') < 0)
Expand Down

0 comments on commit baa9d8d

Please sign in to comment.