Skip to content

Commit

Permalink
fix: add more field name options
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed Dec 6, 2024
1 parent a3b0e59 commit 9e4b260
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib/server/textGeneration/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,15 @@ export async function* runTools(

calls.push(...newCalls);
} catch (e) {
logger.error(e, "Error while parsing tool calls, please retry");
logger.warn(
{ rawCall: output.generated_text, error: extractJson },
"Error while parsing tool calls"
);
// error parsing the calls
yield {
type: MessageUpdateType.Status,
status: MessageUpdateStatus.Error,
message: "Error while parsing tool calls, please retry",
message: "Error while parsing tool calls.",
};
}
}
Expand Down Expand Up @@ -293,7 +296,7 @@ function isValidCallObject(call: unknown): call is Record<string, unknown> {

function parseExternalCall(callObj: Record<string, unknown>) {
const nameFields = ["tool_name", "name"] as const;
const parametersFields = ["parameters", "arguments"] as const;
const parametersFields = ["parameters", "arguments", "parameter_definitions"] as const;

const groupedCall = {
tool_name: "" as string,
Expand Down

0 comments on commit 9e4b260

Please sign in to comment.