mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-08-26 09:03:43 +02:00
Merge pull request #435 from Zgrill2/azure-profile
Add support for GPT models in Azure AI Studio
This commit is contained in:
commit
7d3fb22dfe
2 changed files with 38 additions and 0 deletions
15
profiles/azure.json
Normal file
15
profiles/azure.json
Normal 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
23
src/models/azure.js
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue