Closed yangcheng closed 2 weeks ago
for non stream mode, the response from llama does not contain tool_calls
, so just remove tool_calls
from stream response chunk would make the API more consistent, and more compatible with OpenAI
{
"id": "chatcmpl-602caf75",
"created": 1717387517,
"model": "meta.llama3-70b-instruct-v1:0",
"system_fingerprint": "fp",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "**masked content ***"
}
}
],
"object": "chat.completion",
"usage": {
"prompt_tokens": 477,
"completion_tokens": 165,
"total_tokens": 642
}
}
This should be fixed, please try it again.
Close for no updates
Describe the bug
tool_calls
should be an empty array, not missing. Should not be null. The null is causing typescript type validation error.In OpenAI's official sdk, tool_calls can be undefined or empty_array, but not null.
The type is defined here https://github.com/openai/openai-node/blob/fd70373450d6c39ff55d984a2ff13ea7a7df23d1/src/resources/chat/completions.ts#L434
Please complete the following information:
To Reproduce Steps to reproduce the behavior. If possible, please share an example request.
Expected behavior I understand that python allows null and undefined to be None. A more acceptable behavior will be omit the value in response if model does not support tool_calls or some optional field
Screenshots If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information).
Additional context Add any other context about the problem here.