🪙 refactor: Remove Title maxTokens & Support New LMStudio/Ollama Reasoning Format (#9085)

* 📦 chore: bump `@librechat/agents` to v2.4.76

* refactor: remove default maxTokens from title `clientOptions`
This commit is contained in:
Danny Avila 2025-08-15 15:29:16 -04:00 committed by GitHub
parent 4ec7bcb60f
commit 81186312ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 15 deletions

View file

@ -49,12 +49,12 @@
"@langchain/google-vertexai": "^0.2.13", "@langchain/google-vertexai": "^0.2.13",
"@langchain/openai": "^0.5.18", "@langchain/openai": "^0.5.18",
"@langchain/textsplitters": "^0.1.0", "@langchain/textsplitters": "^0.1.0",
"@librechat/agents": "^2.4.75", "@librechat/agents": "^2.4.76",
"@librechat/api": "*", "@librechat/api": "*",
"@librechat/data-schemas": "*", "@librechat/data-schemas": "*",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@modelcontextprotocol/sdk": "^1.17.1", "@modelcontextprotocol/sdk": "^1.17.1",
"@node-saml/passport-saml": "^5.1.0", "@node-saml/passport-saml": "^5.1.0",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@waylaidwanderer/fetch-event-source": "^3.0.1", "@waylaidwanderer/fetch-event-source": "^3.0.1",
"axios": "^1.8.2", "axios": "^1.8.2",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",

View file

@ -1080,7 +1080,6 @@ class AgentClient extends BaseClient {
/** @type {import('@librechat/agents').ClientOptions} */ /** @type {import('@librechat/agents').ClientOptions} */
let clientOptions = { let clientOptions = {
maxTokens: 75,
model: agent.model || agent.model_parameters.model, model: agent.model || agent.model_parameters.model,
}; };
@ -1147,15 +1146,13 @@ class AgentClient extends BaseClient {
clientOptions.configuration = options.configOptions; clientOptions.configuration = options.configOptions;
} }
const shouldRemoveMaxTokens = /\b(o\d|gpt-[5-9])\b/i.test(clientOptions.model); if (clientOptions.maxTokens != null) {
if (shouldRemoveMaxTokens && clientOptions.maxTokens != null) {
delete clientOptions.maxTokens; delete clientOptions.maxTokens;
} else if (!shouldRemoveMaxTokens && !clientOptions.maxTokens) {
clientOptions.maxTokens = 75;
} }
if (shouldRemoveMaxTokens && clientOptions?.modelKwargs?.max_completion_tokens != null) { if (clientOptions?.modelKwargs?.max_completion_tokens != null) {
delete clientOptions.modelKwargs.max_completion_tokens; delete clientOptions.modelKwargs.max_completion_tokens;
} else if (shouldRemoveMaxTokens && clientOptions?.modelKwargs?.max_output_tokens != null) { }
if (clientOptions?.modelKwargs?.max_output_tokens != null) {
delete clientOptions.modelKwargs.max_output_tokens; delete clientOptions.modelKwargs.max_output_tokens;
} }

10
package-lock.json generated
View file

@ -64,7 +64,7 @@
"@langchain/google-vertexai": "^0.2.13", "@langchain/google-vertexai": "^0.2.13",
"@langchain/openai": "^0.5.18", "@langchain/openai": "^0.5.18",
"@langchain/textsplitters": "^0.1.0", "@langchain/textsplitters": "^0.1.0",
"@librechat/agents": "^2.4.75", "@librechat/agents": "^2.4.76",
"@librechat/api": "*", "@librechat/api": "*",
"@librechat/data-schemas": "*", "@librechat/data-schemas": "*",
"@microsoft/microsoft-graph-client": "^3.0.7", "@microsoft/microsoft-graph-client": "^3.0.7",
@ -21527,9 +21527,9 @@
} }
}, },
"node_modules/@librechat/agents": { "node_modules/@librechat/agents": {
"version": "2.4.75", "version": "2.4.76",
"resolved": "https://registry.npmjs.org/@librechat/agents/-/agents-2.4.75.tgz", "resolved": "https://registry.npmjs.org/@librechat/agents/-/agents-2.4.76.tgz",
"integrity": "sha512-GueaA5WAc0nliuQjqbqBVAR/7/qaFw8xpg5ClaFHbm5YseyKF+iuSg+sBaF0eo2ceswO3nEmdLa3QtIhKXsQgg==", "integrity": "sha512-DkWKpKcLgv9tA6bXJ8pSzHOA3iZRFQRt9oBjEEeW0onhEdPTmHVR3/dY5bxMKSP8rlA65M0yx1KaoLL8bhg06Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@langchain/anthropic": "^0.3.26", "@langchain/anthropic": "^0.3.26",
@ -51377,7 +51377,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@langchain/core": "^0.3.62", "@langchain/core": "^0.3.62",
"@librechat/agents": "^2.4.75", "@librechat/agents": "^2.4.76",
"@librechat/data-schemas": "*", "@librechat/data-schemas": "*",
"@modelcontextprotocol/sdk": "^1.17.1", "@modelcontextprotocol/sdk": "^1.17.1",
"axios": "^1.8.2", "axios": "^1.8.2",

View file

@ -70,7 +70,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@langchain/core": "^0.3.62", "@langchain/core": "^0.3.62",
"@librechat/agents": "^2.4.75", "@librechat/agents": "^2.4.76",
"@librechat/data-schemas": "*", "@librechat/data-schemas": "*",
"@modelcontextprotocol/sdk": "^1.17.1", "@modelcontextprotocol/sdk": "^1.17.1",
"axios": "^1.8.2", "axios": "^1.8.2",