Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export async function serializeNewMessagesInStep<TOOLS extends ToolSet>(
} satisfies Omit<MessageWithMetadata, "message" | "text" | "fileIds">;
const toolFields = { sources: step.sources };
const messages: MessageWithMetadata[] = await Promise.all(
(step.toolResults.length > 0
(step.finishReason === "tool-calls"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the case of error, is the finishReason tool-calls?
My understanding of tool-calls finishReason was that it was the signal that there were tool calls that need response, e.g. when you have a tool with no execute function, it will finish with tool-calls but there will only be one response message - the assistant response.

? step.response.messages.slice(-2)
: step.content.length
? step.response.messages.slice(-1)
Expand Down