Skip to content

Commit

Permalink
🤖 fix: GoogleClient Context Handling & GenAI Parameters (#5503)
Browse files Browse the repository at this point in the history
* fix: remove legacy code for GoogleClient and fix model parameters for GenAI

* refactor: streamline client init logic

* refactor: remove legacy vertex clients, WIP remote vertex token count

* refactor: enhance GoogleClient with improved type definitions and streamline token count method

* refactor: remove unused methods and consolidate methods

* refactor: remove examples

* refactor: improve input handling logic in DynamicInput component

* refactor: enhance GoogleClient with token usage tracking and context handling improvements

* refactor: update GoogleClient to support 'learnlm' model and streamline model checks

* refactor: remove unused text model handling in GoogleClient

* refactor: record token usage for GoogleClient titles and handle edge cases

* chore: remove unused undici, addresses verbose version warning
  • Loading branch information
danny-avila authored Jan 27, 2025
1 parent 47b72e8 commit 528ee62
Show file tree
Hide file tree
Showing 12 changed files with 274 additions and 267 deletions.
9 changes: 0 additions & 9 deletions api/app/clients/ChatGPTClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const {
const { extractBaseURL, constructAzureURL, genAzureChatCompletion } = require('~/utils');
const { createContextHandlers } = require('./prompts');
const { createCoherePayload } = require('./llm');
const { Agent, ProxyAgent } = require('undici');
const BaseClient = require('./BaseClient');
const { logger } = require('~/config');

Expand Down Expand Up @@ -186,10 +185,6 @@ class ChatGPTClient extends BaseClient {
headers: {
'Content-Type': 'application/json',
},
dispatcher: new Agent({
bodyTimeout: 0,
headersTimeout: 0,
}),
};

if (this.isVisionModel) {
Expand Down Expand Up @@ -275,10 +270,6 @@ class ChatGPTClient extends BaseClient {
opts.headers['X-Title'] = 'LibreChat';
}

if (this.options.proxy) {
opts.dispatcher = new ProxyAgent(this.options.proxy);
}

/* hacky fixes for Mistral AI API:
- Re-orders system message to the top of the messages payload, as not allowed anywhere else
- If there is only one message and it's a system message, change the role to user
Expand Down
Loading

0 comments on commit 528ee62

Please sign in to comment.