🤖 fix(assistants): Default Capabilities and Retrieval Models (#2102)

This commit is contained in:
Danny Avila 2024-03-14 20:42:56 -04:00 committed by GitHub
parent 5cd5c3bef8
commit f769077ab4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 3 deletions

View file

@ -29,7 +29,7 @@ module.exports = {
userProvidedOpenAI, userProvidedOpenAI,
googleKey, googleKey,
[EModelEndpoint.openAI]: generateConfig(openAIApiKey, OPENAI_REVERSE_PROXY), [EModelEndpoint.openAI]: generateConfig(openAIApiKey, OPENAI_REVERSE_PROXY),
[EModelEndpoint.assistants]: generateConfig(assistantsApiKey, ASSISTANTS_BASE_URL), [EModelEndpoint.assistants]: generateConfig(assistantsApiKey, ASSISTANTS_BASE_URL, true),
[EModelEndpoint.azureOpenAI]: generateConfig(azureOpenAIApiKey, AZURE_OPENAI_BASEURL), [EModelEndpoint.azureOpenAI]: generateConfig(azureOpenAIApiKey, AZURE_OPENAI_BASEURL),
[EModelEndpoint.chatGPTBrowser]: generateConfig(chatGPTToken), [EModelEndpoint.chatGPTBrowser]: generateConfig(chatGPTToken),
[EModelEndpoint.anthropic]: generateConfig(anthropicApiKey), [EModelEndpoint.anthropic]: generateConfig(anthropicApiKey),

View file

@ -1,6 +1,7 @@
const { Capabilities, defaultRetrievalModels } = require('librechat-data-provider');
const { getCitations, citeText } = require('./citations');
const partialRight = require('lodash/partialRight'); const partialRight = require('lodash/partialRight');
const { sendMessage } = require('./streamResponse'); const { sendMessage } = require('./streamResponse');
const { getCitations, citeText } = require('./citations');
const citationRegex = /\[\^\d+?\^]/g; const citationRegex = /\[\^\d+?\^]/g;
const addSpaceIfNeeded = (text) => (text.length > 0 && !text.endsWith(' ') ? text + ' ' : text); const addSpaceIfNeeded = (text) => (text.length > 0 && !text.endsWith(' ') ? text + ' ' : text);
@ -155,7 +156,7 @@ const isUserProvided = (value) => value === 'user_provided';
* @param {string} baseURL * @param {string} baseURL
* @returns {boolean | { userProvide: boolean, userProvideURL?: boolean }} * @returns {boolean | { userProvide: boolean, userProvideURL?: boolean }}
*/ */
function generateConfig(key, baseURL) { function generateConfig(key, baseURL, assistants = false) {
if (!key) { if (!key) {
return false; return false;
} }
@ -167,6 +168,16 @@ function generateConfig(key, baseURL) {
config.userProvideURL = isUserProvided(baseURL); config.userProvideURL = isUserProvided(baseURL);
} }
if (assistants) {
config.retrievalModels = defaultRetrievalModels;
config.capabilities = [
Capabilities.code_interpreter,
Capabilities.retrieval,
Capabilities.actions,
Capabilities.tools,
];
}
return config; return config;
} }