mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 19:30:15 +01:00
✨ feat: Azure Vision Support & Docs Update (#1389)
* feat(AzureOpenAI): Vision Support * chore(ci/OpenAIClient.test): update test to reflect Azure now uses chatCompletion method as opposed to getCompletion, while still testing the latter method * docs: update documentation mainly revolving around Azure setup, but also reformatting the 'Tokens and API' section completely * docs: add images and links to ai_setup.md * docs: ai setup reference
This commit is contained in:
parent
c9d3e0ab6a
commit
8d563d61f1
14 changed files with 378 additions and 85 deletions
|
|
@ -397,7 +397,7 @@ class OpenAIClient extends BaseClient {
|
|||
let streamResult = null;
|
||||
this.modelOptions.user = this.user;
|
||||
const invalidBaseUrl = this.completionsUrl && extractBaseURL(this.completionsUrl) === null;
|
||||
const useOldMethod = !!(this.azure || invalidBaseUrl || !this.isChatCompletion);
|
||||
const useOldMethod = !!(invalidBaseUrl || !this.isChatCompletion);
|
||||
if (typeof opts.onProgress === 'function' && useOldMethod) {
|
||||
await this.getCompletion(
|
||||
payload,
|
||||
|
|
@ -764,6 +764,15 @@ ${convo}
|
|||
modelOptions.max_tokens = 4000;
|
||||
}
|
||||
|
||||
if (this.azure || this.options.azure) {
|
||||
// Azure does not accept `model` in the body, so we need to remove it.
|
||||
delete modelOptions.model;
|
||||
|
||||
opts.baseURL = this.azureEndpoint.split('/chat')[0];
|
||||
opts.defaultQuery = { 'api-version': this.azure.azureOpenAIApiVersion };
|
||||
opts.defaultHeaders = { ...opts.defaultHeaders, 'api-key': this.apiKey };
|
||||
}
|
||||
|
||||
let chatCompletion;
|
||||
const openai = new OpenAI({
|
||||
apiKey: this.apiKey,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue