Open
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
I see several warnings with this:
UserWarning: Pydantic serializer warnings:
Expected `list[float]` but got `str` - serialized value may not be as expected
return self.__pydantic_serializer__.to_json
This is impacting LiteLLM users too: BerriAI/litellm#1187
To Reproduce
import openai
client = openai.AsyncAzureOpenAI(
api_key=os.environ["AZURE_API_KEY"],
azure_endpoint=os.environ["AZURE_API_BASE"]
)
async def _test():
response = await client.embeddings.create(
model="azure-embedding-model",
input=["write a litellm poem"],
encoding_format="base64"
)
print(response)
response = response.model_dump_json()
print(response)
import json
response = json.loads(response)
print(response)
import asyncio
asyncio.run(_test())
Code snippets
No response
OS
macOS
Python version
3.10
Library version
1.6.1