You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here I found an issue when creating an inference tool from the JS API.
Version
"@huggingface/inference": "^2.8.0" with npm installation
Description
The issue is that the delta of the tool call (ChatCompletionStreamOutputDeltaToolCall ) is a type of "number", but the full result (ChatCompletionStreamOutputDeltaToolCall) is identified by "string"
// At @huggingface\tasks\src\tasks\chat-completionexportinterfaceChatCompletionOutputToolCall{function: ChatCompletionOutputFunctionDefinition;id: number;type: string;[property: string]: unknown;}
// At @huggingface\tasks\src\tasks\chat-completionexportinterfaceChatCompletionStreamOutputDeltaToolCall{function: ChatCompletionStreamOutputFunction;id: string;index: number;type: string;[property: string]: unknown;}
The ChatCompletionStreamOutputDelta.tool_calls type is ChatCompletionStreamOutputDeltaToolCall but might be a mistake as that should be the ChatCompletionStreamOutputDeltaToolCall[] (Array of calls instead of a single object, this one needs some help of explanation.
Is the current API endpoint with stream only support a single tool result?
But the full one is an Array ChatCompletionOutputMessage.tool_calls: ChatCompletionOutputToolCall[]
// At @huggingface\tasks\src\tasks\chat-completionexportinterfaceChatCompletionStreamOutputDelta{content?: string;role: string;tool_calls?: ChatCompletionStreamOutputDeltaToolCall;[property: string]: unknown;}
// At @huggingface\tasks\src\tasks\chat-completionexportinterfaceChatCompletionOutputMessage{content?: string;name?: string;role: string;tool_calls?: ChatCompletionOutputToolCall[];[property: string]: unknown;}
ScreenShot
Reference Link
If you want to check it out, here is the link can compare to almost the same code for OpenAI and HuggingFace. And the HuggingFace one have the above issue (OpenAI one is correctly work, hope can help to debug) OpenAI Tool Use Inference HuggingFace Tool Use Inference
The text was updated successfully, but these errors were encountered:
Here I found an issue when creating an inference tool from the JS API.
Version
"@huggingface/inference": "^2.8.0" with npm installation
Description
ChatCompletionStreamOutputDeltaToolCall
) is a type of "number", but the full result (ChatCompletionStreamOutputDeltaToolCall
) is identified by "string"ChatCompletionStreamOutputDelta.tool_calls
type isChatCompletionStreamOutputDeltaToolCall
but might be a mistake as that should be theChatCompletionStreamOutputDeltaToolCall[]
(Array of calls instead of a single object, this one needs some help of explanation.ChatCompletionOutputMessage.tool_calls: ChatCompletionOutputToolCall[]
ScreenShot
Reference Link
If you want to check it out, here is the link can compare to almost the same code for OpenAI and HuggingFace. And the HuggingFace one have the above issue (OpenAI one is correctly work, hope can help to debug)
OpenAI Tool Use Inference
HuggingFace Tool Use Inference
The text was updated successfully, but these errors were encountered: