[Inference Connector] Return an empty object for tool arguments if empty (#208253)

This commit is contained in:
Steph Milovic 2025-01-24 12:35:50 -07:00 committed by GitHub
parent ee97316a6c
commit 02a2e054d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -102,6 +102,11 @@ export function chunksIntoMessage(obs$: Observable<UnifiedChatCompleteResponse>)
if (concatenatedChunk.choices[0].message.content === '') {
concatenatedChunk.choices[0].message.content = null;
}
concatenatedChunk.choices[0].message.tool_calls?.forEach((toolCall: any) => {
if (toolCall.function?.arguments?.trim() === '') {
toolCall.function.arguments = '{}';
}
});
return concatenatedChunk;
})
)