Skip to content
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: AttributeError in OpenAI-compatible server #3018

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

jaywonchung
Copy link
Contributor

Fixed a small typo that triggers an AttributeError in the OpenAI-compatible server when add_generation_prompt is False.

Side note, it's unclear to me why ChatCompletionRequest.messages is typed as Union[str, List[Dict[str, str]]] instead of just List[Dict[str, str]]. The OpenAI chat API spec also says it's an array. If messages can sometimes actually be str, the modified line will raise an error and will require this case to be handled.

I'm not familiar enough with how stuff works in vLLM to confidently modify one of the core schemas, but I can push a quick fix to this PR if you think it's appropriate.

Screenshot 2024-02-23 at 9 50 07 PM

@simon-mo
Copy link
Collaborator

it's unclear to me why ChatCompletionRequest.messages is typed as Union[str, List[Dict[str, str]]] instead of just List[Dict[str, str]]

Great spotting! The type should really be List[Dict[str, str]].

@jaywonchung
Copy link
Contributor Author

Cool, I'll push a quick fix.

@jaywonchung
Copy link
Contributor Author

@simon-mo Seems like it's all good to go.

@WoosukKwon WoosukKwon merged commit a6d471c into vllm-project:main Feb 29, 2024
22 checks passed
@jaywonchung jaywonchung deleted the patch-1 branch February 29, 2024 06:04
@WoosukKwon
Copy link
Collaborator

@jaywonchung Thanks for the PR! 😄

xjpang pushed a commit to xjpang/vllm that referenced this pull request Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants