Merge pull request #435 from Zgrill2/azure-profile

Add support for GPT models in Azure AI Studio
This commit is contained in:
Max Robinson 2025-08-23 15:39:19 -05:00 committed by GitHub
commit 7d3fb22dfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 0 deletions

15
profiles/azure.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "azure",
"model": {
"api": "azure",
"url": "",
"model": "gpt-4o",
"api_version": "2024-08-01-preview"
},
"embedding": {
"api": "azure",
"url": "",
"model": "text-embedding-ada-002",
"api_version": "2024-08-01-preview"
}
}

23
src/models/azure.js Normal file
View file

@ -0,0 +1,23 @@
import { AzureOpenAI } from "openai";
import { getKey } from '../utils/keys.js';
import { GPT } from './gpt.js'
export class AzureGPT extends GPT {
constructor(model_name, url, api_version, params) {
super(model_name, url)
this.model_name = model_name;
this.params = params;
let config = {}
if (url)
config.endpoint = url;
config.apiKey = getKey('OPENAI_API_KEY');
config.deployment = model_name; // This must be what you named the deployment in Azure, not the model version itself
config.apiVersion = api_version; // This is required for Azure
this.openai = new AzureOpenAI(config)
}
}