When the type of context in the incoming messages is text, an error occurs.
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
When the type of context in the incoming messages is text, an error occurs.
API: /v1/chat/completions
request
{
"max_tokens": 0,
"model": "qwen-72b-chat-int4",
"messages": [
{
"role": "user",
"content": [
{
"text": "Assistant is a large language model trained by Meta.",
"type": "text"
}
]
}
],
"functions": null,
"function_call": null,
"temperature": 0,
"top_p": 0,
"n": 0,
"stream": true,
"stop": [
"\nObservation:","Observation:"
],
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": null,
"user": "",
"response_format": {
"type": ""
},
"seed": null,
"tools": null,
"tool_choice": null
}
ERROR
ERROR | stderr | File "/app/fastchat/serve/openai_api_server.py", line 420, in create_chat_completion
ERROR | stderr | gen_params = await get_gen_params(
ERROR | stderr | File "/app/fastchat/serve/openai_api_server.py", line 329, in get_gen_params
ERROR | stderr | prompt = conv.get_prompt()
ERROR | stderr | File "/app/fastchat/conversation.py", line 168, in get_prompt
ERROR | stderr | ret += role + "\n" + message + self.sep + "\n"
ERROR | stderr | TypeError: can only concatenate str (not "tuple") to str
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing request in the issue and inspect get_gen_params in fastchat/serve/openai_api_server.py, then follow the call into conversation.py at Conversation.get_prompt. Reproduce the request and trace how the text message is represented. Done means this input no longer raises the reported TypeError while producing the expected chat-completion response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100