Skip to content
Snippets Groups Projects
Unverified Commit 2ca22abc authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

Add Version to AzureOpenAI (#3023)

parent 48dcb22b
Branches
Tags
No related merge requests found
......@@ -16,9 +16,13 @@ class AzureOpenAiLLM {
if (!process.env.AZURE_OPENAI_KEY)
throw new Error("No Azure API key was set.");
this.apiVersion = "2024-12-01-preview";
this.openai = new OpenAIClient(
process.env.AZURE_OPENAI_ENDPOINT,
new AzureKeyCredential(process.env.AZURE_OPENAI_KEY)
new AzureKeyCredential(process.env.AZURE_OPENAI_KEY),
{
apiVersion: this.apiVersion,
}
);
this.model = modelPreference ?? process.env.OPEN_MODEL_PREF;
this.limits = {
......@@ -29,6 +33,13 @@ class AzureOpenAiLLM {
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0.7;
this.#log(
`Initialized. Model "${this.model}" @ ${this.promptWindowLimit()} tokens. API-Version: ${this.apiVersion}`
);
}
#log(text, ...args) {
console.log(`\x1b[32m[AzureOpenAi]\x1b[0m ${text}`, ...args);
}
#appendContext(contextTexts = []) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment