fix: add streamBuffer and streamRate to help prevent 'Overloaded' errors from Anthropic API

This commit is contained in:
Danny Avila 2024-09-04 11:00:57 -04:00
parent acd9088a6d
commit f593de85b2
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
3 changed files with 21 additions and 14 deletions

View file

@ -43,7 +43,7 @@
"@langchain/core": "^0.2.18",
"@langchain/google-genai": "^0.0.11",
"@langchain/google-vertexai": "^0.0.17",
"@librechat/agents": "^1.4.7",
"@librechat/agents": "^1.4.9",
"axios": "^1.3.4",
"bcryptjs": "^2.4.3",
"cheerio": "^1.0.0-rc.12",

View file

@ -1,4 +1,4 @@
const { Run } = require('@librechat/agents');
const { Run, Providers } = require('@librechat/agents');
const { providerEndpointMap } = require('librechat-data-provider');
/**
@ -43,15 +43,22 @@ async function createRun({
modelOptions,
);
const graphConfig = {
runId,
llmConfig,
tools,
toolMap,
instructions: agent.instructions,
additional_instructions: agent.additional_instructions,
};
if (agent.provider === Providers.ANTHROPIC) {
graphConfig.streamBuffer = 3000;
graphConfig.streamRate = 30;
}
return Run.create({
graphConfig: {
runId,
llmConfig,
tools,
toolMap,
instructions: agent.instructions,
additional_instructions: agent.additional_instructions,
},
graphConfig,
customHandlers,
});
}

8
package-lock.json generated
View file

@ -52,7 +52,7 @@
"@langchain/core": "^0.2.18",
"@langchain/google-genai": "^0.0.11",
"@langchain/google-vertexai": "^0.0.17",
"@librechat/agents": "^1.4.7",
"@librechat/agents": "^1.4.9",
"axios": "^1.3.4",
"bcryptjs": "^2.4.3",
"cheerio": "^1.0.0-rc.12",
@ -10015,9 +10015,9 @@
}
},
"node_modules/@librechat/agents": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/@librechat/agents/-/agents-1.4.7.tgz",
"integrity": "sha512-9HnotCsErbMG5TsOyePz5skiOsT/oF+XwXCcYm8oY1M/PbqiJI+xFib+ZkYzySUfi3f1KV75D6IB4PrFsbf2yw==",
"version": "1.4.9",
"resolved": "https://registry.npmjs.org/@librechat/agents/-/agents-1.4.9.tgz",
"integrity": "sha512-XHhQ/Pu0R8wwmXuQ+uSHXaCVVrGX08SnOSE1MHXLe14V6Litmyppd4dej9PVhVEOxfrWIwIGB84t9I3HGe9WZg==",
"dependencies": {
"@aws-crypto/sha256-js": "^5.2.0",
"@aws-sdk/credential-provider-node": "^3.613.0",