Skip to content

fix: allow base64 string in Embedding model to prevent Pydantic warni… #32

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LuminaX-alt
Copy link
Owner

…ngs for Azure embeddings

This PR fixes openai#1039 by updating the Embedding response model used for Azure async embedding calls.

Currently, when using the Azure Embeddings API in async mode, the SDK emits Pydantic warnings at every call because the embedding field is strictly typed as List[float]. However, Azure sometimes returns base64‑encoded strings instead of float arrays, which Pydantic tries to validate, resulting in noisy warnings and minor performance overhead.

This change modifies the model to accept both List[float] and str for the embedding field and disables unnecessary validation, preventing Pydantic from trying to coerce base64 strings into float arrays.

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Additional context & links

…ngs for Azure embeddings

This PR fixes openai#1039 by updating the Embedding response model used for Azure async embedding calls.

Currently, when using the Azure Embeddings API in async mode, the SDK emits Pydantic warnings at every call because the embedding field is strictly typed as List[float]. However, Azure sometimes returns base64‑encoded strings instead of float arrays, which Pydantic tries to validate, resulting in noisy warnings and minor performance overhead.

This change modifies the model to accept both List[float] and str for the embedding field and disables unnecessary validation, preventing Pydantic from trying to coerce base64 strings into float arrays.
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.

Pydantic warnings at every base64 embedding call for Async Azure
1 participant