File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ interface AnthropicTool extends PromptCache {
3232 }
3333 > ;
3434 required : string [ ] ;
35+ $defs : Record < string , any > ;
3536 } ;
3637 type ?: string ;
3738 display_width_px ?: number ;
@@ -134,7 +135,9 @@ const transformAssistantMessage = (msg: Message): AnthropicMessage => {
134135 type : 'tool_use' ,
135136 name : toolCall . function . name ,
136137 id : toolCall . id ,
137- input : JSON . parse ( toolCall . function . arguments ) ,
138+ input : toolCall . function . arguments ?. length
139+ ? JSON . parse ( toolCall . function . arguments )
140+ : { } ,
138141 } ) ;
139142 } ) ;
140143 }
@@ -340,6 +343,7 @@ export const AnthropicChatCompleteConfig: ProviderConfig = {
340343 type : tool . function . parameters ?. type || 'object' ,
341344 properties : tool . function . parameters ?. properties || { } ,
342345 required : tool . function . parameters ?. required || [ ] ,
346+ $defs : tool . function . parameters ?. [ '$defs' ] || { } ,
343347 } ,
344348 ...( tool . cache_control && {
345349 cache_control : { type : 'ephemeral' } ,
You can’t perform that action at this time.
0 commit comments