Skip to content

Commit 3b83be2

Browse files
authored
fix(chat): prevent error when a toolCall is not present at toolCalls index (#126)
1 parent 2050862 commit 3b83be2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/chat/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ export class OpenRouterChatLanguageModel implements LanguageModelV2 {
707707
// Forward any unsent tool calls if finish reason is 'tool-calls'
708708
if (finishReason === 'tool-calls') {
709709
for (const toolCall of toolCalls) {
710-
if (!toolCall.sent) {
710+
if (toolCall && !toolCall.sent) {
711711
controller.enqueue({
712712
type: 'tool-call',
713713
toolCallId: toolCall.id ?? generateId(),

0 commit comments

Comments
 (0)