🧠 feat: Cohere support as Custom Endpoint (#2328)

* chore: bump cohere-ai, fix firebase vulnerabilities by going down versions

* feat: cohere rates and context windows

* feat(createCoherePayload): transform openai payload for cohere compatibility

* feat: cohere backend support

* refactor(UnknownIcon): optimize icon render and add cohere

* docs: add cohere to Compatible AI Endpoints

* Update ai_endpoints.md
This commit is contained in:
Danny Avila 2024-04-05 15:19:41 -04:00 committed by GitHub
parent daa5f43ac6
commit cd7f3a51e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 1007 additions and 622 deletions

View file

@ -1,3 +1,5 @@
const { CohereConstants } = require('librechat-data-provider');
/**
* Extracts a valid OpenAI baseURL from a given string, matching "url/v1," followed by an optional suffix.
* The suffix can be one of several predefined values (e.g., 'openai', 'azure-openai', etc.),
@ -19,6 +21,10 @@ function extractBaseURL(url) {
return undefined;
}
if (url.startsWith(CohereConstants.API_URL)) {
return null;
}
if (!url.includes('/v1')) {
return url;
}