diff --git a/profiles/azure.json b/profiles/azure.json new file mode 100644 index 0000000..fbd382d --- /dev/null +++ b/profiles/azure.json @@ -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" + } +} \ No newline at end of file diff --git a/src/models/azure.js b/src/models/azure.js new file mode 100644 index 0000000..d8e2f4a --- /dev/null +++ b/src/models/azure.js @@ -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) + } +} \ No newline at end of file