Skip to content

[Bug]: Pydantic warnings at every embedding call for Azure #1187

@jeromeroussin

Description

@jeromeroussin

What happened?

I am seeing a ton of these in my logs:

UserWarning: Pydantic serializer warnings:
Expected list[float] but got str - serialized value may not be as expected

I added these lines at the top of the litellm app:

import warnings
warnings.filterwarnings("error")

and got this tracktrace:

#9 10.27 Traceback (most recent call last):
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/proxy/proxy_server.py", line 1108, in embeddings
#9 10.27 response = await llm_router.aembedding(data)
#9 10.27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/router.py", line 374, in aembedding
#9 10.27 return await litellm.aembedding(
{**data, "input": input, "caching": self.cache_responses, "client": model_client, **kwargs})
#9 10.27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/utils.py", line 1792, in wrapper_async
#9 10.27 raise e
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/utils.py", line 1723, in wrapper_async
#9 10.27 result = await original_function(*args, **kwargs)
#9 10.27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/main.py", line 1772, in aembedding
#9 10.27 raise exception_type(
#9 10.27 ^^^^^^^^^^^^^^^
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/utils.py", line 5194, in exception_type
#9 10.27 raise original_exception
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/main.py", line 1765, in aembedding
#9 10.27 response = await init_response
#9 10.27 ^^^^^^^^^^^^^^^^^^^
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/llms/azure.py", line 361, in aembedding
#9 10.27 raise e
#9 10.27 File "/usr/local/lib/python3.11/site-packages/litellm/llms/azure.py", line 344, in aembedding
#9 10.27 stringified_response = response.model_dump_json()
#9 10.27 ^^^^^^^^^^^^^^^^^^^^^^^^^^
#9 10.27 File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 352, in model_dump_json
#9 10.27 return self.pydantic_serializer.to_json(

Relevant log output

No response

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions