Text / Audio / Image embeddings behind the Post /embeddings
via discrimminated union and optional extra fields
#394
Labels
help wanted
Extra attention is needed
Feature request
Raised by @stikkireddy
#385
Last question is there any way to support this from OpenAI embeddings spec? extra_body is typically used to provide additional non spec features to allow the server to handle things. It would be nice to be able to reuse the openai embeddings client for things like:
I know its not exactly what openai supports but it would be great to be able to use existing clients to solve this problem if possible. they have built in retries, etc.
vllm does this for vllm specific features like guided decoding, etc.
Solution:
(Michael) Idea would be to implement a discriminated union in pydantic.
If it has text, it validates against text schema (str), if it has image or audio, it validates against the audio schema.
See: https://docs.pydantic.dev/latest/concepts/unions/#discriminated-unions-with-str-discriminators
Motivation
Ease of use with OpenAI client.
Your contribution
Looking for contriutors
The text was updated successfully, but these errors were encountered: