θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion server/utils/AiProviders/azureOpenAi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = []) {
Expand Down