Add Version to AzureOpenAI (#3023)
This commit is contained in:
parent
48dcb22b25
commit
2ca22abc9c
@ -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 = []) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user