Skip to content

Conversation

@jvmncs
Copy link
Contributor

@jvmncs jvmncs commented Jan 17, 2024

closes #1396
closes #2313
closes #2322

relaxes the pydantic version, which was previously pinned to 1.10.13 due to openai-python's dependency requirements. since openai has loosened their requirement, vllm should as well.

this is a retry of #2322. that PR has gotten a bit stale after the openai refactor, and there's been no communication from the author for a couple weeks

@jvmncs
Copy link
Contributor Author

jvmncs commented Jan 17, 2024

@zhuohan123 this should be ready as a replacement PR for #2322. if the original author shows up again, feel free to close this one. just wanted to get this rolling since multiple people expressed it as a blocker for them

@zhuohan123
Copy link
Member

@jvmncs Thanks for your contribution! Can you make sure the CI is passing?

@zhuohan123
Copy link
Member

zhuohan123 commented Jan 19, 2024

@jvmncs Can you help double check the code? The openAI server is not working on my side. When I install pydantic 2.5.3, and start the server with:

python vllm/entrypoints/openai/api_server.py

and query the server with:

python examples/openai_completion_client.py

I got this on the server side:

INFO:     ::1:52738 - "POST /v1/completions HTTP/1.1" 400 Bad Request

and this from the client side:

(base) zhuohan@zhuohan-1:~/vllm/vllm/examples$ python openai_completion_client.py
Traceback (most recent call last):
  File "/home/zhuohan/vllm/vllm/examples/openai_completion_client.py", line 18, in <module>
    completion = client.completions.create(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhuohan/anaconda3/lib/python3.11/site-packages/openai/_utils/_utils.py", line 303, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhuohan/anaconda3/lib/python3.11/site-packages/openai/resources/completions.py", line 562, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/zhuohan/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 1088, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zhuohan/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 853, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/zhuohan/anaconda3/lib/python3.11/site-packages/openai/_base_client.py", line 930, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'object': 'error', 'message': "[{'type': 'missing', 'loc': ('query', 'request'), 'msg': 'Field required', 'input': None, 'url': 'https://errors.pydantic.d
ev/2.5/v/missing'}]", 'type': 'BadRequestError', 'param': None, 'code': '400'}

I believe this is also why the CI is failing.

Tag more people to see whether there is a solution here: @saattrupdan @dbuades @rlouf

@jvmncs
Copy link
Contributor Author

jvmncs commented Jan 19, 2024

I spent some time debugging this yesterday. my suspicion for now is that openai-python might be changing how they structure the request based on which pydantic version is installed, which is somewhat suggested by this compat utility they wrote. haven't had time to get to the bottom of it though

@jvmncs
Copy link
Contributor Author

jvmncs commented Jan 19, 2024

okay I'm about 90% sure this is the case. using the v2 models in openai protocol got 2 of the failing tests to pass, the other two (streaming tests) now have pydantic validation errors. investigating those shortly

@dbuades
Copy link

dbuades commented Jan 19, 2024

Thanks for looking into this! I'll check it too this weekend.

@simon-mo
Copy link
Collaborator

Thank you for your contribution. I will close this in favor of #2531

@simon-mo simon-mo closed this Jan 21, 2024
@jvmncs jvmncs deleted the relax-pydantic-version branch January 23, 2024 14:28
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.

Outdated Pydantic Version bump pydantic to v2

4 participants