Skip to content

Commit 616e254

Browse files
committed
feat: map responses api to anthropic support tool_use and fix spelling errors
1 parent 11d256e commit 616e254

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/routes/messages/responses-stream-translation.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,7 @@ const messageStart = (
421421
usage: {
422422
input_tokens: inputTokens,
423423
output_tokens: 0,
424-
...(inputCachedTokens !== undefined && {
425-
cache_creation_input_tokens: inputCachedTokens,
426-
}),
424+
cache_read_input_tokens: inputCachedTokens ?? 0,
427425
},
428426
},
429427
},

src/routes/messages/responses-translation.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,9 @@ const mapResponsesStopReason = (
535535
const { status, incomplete_details: incompleteDetails } = response
536536

537537
if (status === "completed") {
538+
if (response.output.some((item) => item.type === "function_call")) {
539+
return "tool_use"
540+
}
538541
return "end_turn"
539542
}
540543

0 commit comments

Comments
 (0)