-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: openai chat message dump logic #7849
Conversation
Hi @dongs0104, thanks for contributing this fix!
|
@rmccorm4 i signed it and add test case |
Started pipeline: 21452750 |
Hi @dongs0104, Have you tested this is passing locally? I get a schema validation error on your new test case (return code 422) because content is expected to be a
Your test case: def test_chat_completions_user_prompt_dict(self, client, model: str):
messages = [
{
"role": "user",
"content": {"type": "text", "text": "What is machine learning?"},
}
] Expected Schema: (note the list def test_chat_completions_user_prompt_dict(self, client, model: str):
# Pass a List of Dicts for content to expose the 'type' field
messages = [
{
"role": "user",
"content": [{"type": "text", "text": "What is machine learning?"}],
}
] I think this should get the test to pass. |
@rmccorm4 i tested it after your comment thanks |
CLA has been accepted. This PR can be merged at Triton's discretion. |
Thanks for your contribution @dongs0104! |
What does the PR do?
I found an issue with the OpenAI message format where user messages that are not strings are automatically converted to strings by the code, resulting in a
[ChatCompletionResponseMessageContentPart(text="~~~")]
string conversion problem. I have fixed this issue.Checklist
Agreement
<commit_type>: <Title>
pre-commit install, pre-commit run --all
)Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
#7561
Where should the reviewer start?
@rmccorm4
Test plan:
Caveats:
Background
To fix the issue of ChatCompletionResponseMessageContentPart being mixed with the output
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)