mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
fix(Anthropic): messages.X.content.Y.tool_use.input: Input should be a valid dictionary
This commit is contained in:
parent
9ff43bf958
commit
0c04018bb3
2 changed files with 10 additions and 2 deletions
|
|
@ -170,7 +170,15 @@ const formatAgentMessages = (payload) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: `tool_calls` list is defined when constructed by `AIMessage` class, and outputs should be excluded from it
|
// Note: `tool_calls` list is defined when constructed by `AIMessage` class, and outputs should be excluded from it
|
||||||
const { output, ...tool_call } = part.tool_call;
|
const { output, args: _args, ...tool_call } = part.tool_call;
|
||||||
|
// TODO: investigate; args as dictionary may need to be provider-or-tool-specific
|
||||||
|
let args = _args;
|
||||||
|
try {
|
||||||
|
args = JSON.parse(args);
|
||||||
|
} catch (e) {
|
||||||
|
// failed to parse, leave as is
|
||||||
|
}
|
||||||
|
tool_call.args = args;
|
||||||
lastAIMessage.tool_calls.push(tool_call);
|
lastAIMessage.tool_calls.push(tool_call);
|
||||||
|
|
||||||
// Add the corresponding ToolMessage
|
// Add the corresponding ToolMessage
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ class AgentClient extends BaseClient {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
logger.info(this.contentParts, { depth: null });
|
logger.debug(this.contentParts, { depth: null });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!abortController.signal.aborted) {
|
if (!abortController.signal.aborted) {
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue