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

@ -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,
});
}