mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
🔀 feat: moonshotai/kimi Context and OpenRouter Endpoint Token Config (#8604)
* ✨ feat: Enhance agent initialization with endpoint token configuration and round max context tokens
* feat: recognize moonshot/kimi model context window
* chore: remove unused i18n key
This commit is contained in:
parent
259224d986
commit
f797e90d79
5 changed files with 55 additions and 6 deletions
|
|
@ -131,7 +131,7 @@ const initializeAgent = async ({
|
|||
);
|
||||
const agentMaxContextTokens = optionalChainWithEmptyCheck(
|
||||
maxContextTokens,
|
||||
getModelMaxTokens(tokensModel, providerEndpointMap[provider]),
|
||||
getModelMaxTokens(tokensModel, providerEndpointMap[provider], options.endpointTokenConfig),
|
||||
4096,
|
||||
);
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ const initializeAgent = async ({
|
|||
resendFiles,
|
||||
toolContextMap,
|
||||
useLegacyContent: !!options.useLegacyContent,
|
||||
maxContextTokens: (agentMaxContextTokens - maxTokens) * 0.9,
|
||||
maxContextTokens: Math.round((agentMaxContextTokens - maxTokens) * 0.9),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -141,8 +141,9 @@ const initializeClient = async ({ req, res, endpointOption, optionsOnly, overrid
|
|||
const options = getOpenAIConfig(apiKey, clientOptions, endpoint);
|
||||
if (options != null) {
|
||||
options.useLegacyContent = true;
|
||||
options.endpointTokenConfig = endpointTokenConfig;
|
||||
}
|
||||
if (!customOptions.streamRate) {
|
||||
if (!clientOptions.streamRate) {
|
||||
return options;
|
||||
}
|
||||
options.llmConfig.callbacks = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue