Closed
Description
Reminder
- I have read the README and searched the existing issues.
Reproduction
在ChatMessage中content被设定为str,而在ChatCompletionMessage中content可以为None。
如果使用api demo,并且需要模型使用工具,那么由于: src/llmtuner/api/app.py 中的 create_chat_completion函数中的
使用ChatCompletionMessage的content缺省值,会导致错误:
openai.UnprocessableEntityError: Error code: 422 - {'detail': [{'type': 'string_type', 'loc': ['body', 'messages', 2, 'content'], 'msg': 'Input should be a valid string', 'input': None, 'url': 'https://errors.pydantic.dev/2.6/v/string_type'}]}
Expected behavior
No response
System Info
No response
Others
No response
Activity