Skip to content
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

prepend v1 to OpenAI compatible APIs #371

Open
samos123 opened this issue Sep 22, 2024 · 6 comments
Open

prepend v1 to OpenAI compatible APIs #371

samos123 opened this issue Sep 22, 2024 · 6 comments

Comments

@samos123
Copy link
Contributor

Feature request

prepend v1 to OpenAI compatible APIs

Motivation

This allows us to integrate infinity the same way as other openai compatible API engines into KubeAI: https://github.com/substratusai/kubeai

PR: substratusai/kubeai#197

Your contribution

Yeah I could probably do it once I get go ahead from you.

@samos123
Copy link
Contributor Author

Seems the response isn't exactly following the OpenAI response. This is from OpenAI docs:
image

And this is what Infinity returns:

{
  "object": "embedding",
  "data": [
    {
      "object": "embedding",
      "embedding": [

The "object" should be "list" but infinity returns "embedding". Not sure if this matters though but sharing observation here.

@samos123
Copy link
Contributor Author

I confirmed that this is blocking integration with KubeAI:

INFO:     10.244.0.15:35798 - "POST /v1/embeddings HTTP/1.1" 404 Not Found
INFO:     10.244.0.15:35798 - "POST /v1/embeddings HTTP/1.1" 404 Not Found
INFO:     10.244.0.1:43268 - "GET /health HTTP/1.1" 200 OK
INFO:     10.244.0.15:35798 - "GET /metrics HTTP/1.1" 200 OK
INFO:     10.244.0.1:50798 - "GET /health HTTP/1.1" 200 OK
INFO:     10.244.0.1:50796 - "GET /health HTTP/1.1" 200 OK
INFO:     10.244.0.15:40274 - "GET /metrics HTTP/1.1" 200 OK
INFO:     10.244.0.15:40274 - "POST /v1/embeddings HTTP/1.1" 404 Not Found

@samos123
Copy link
Contributor Author

samos123 commented Sep 22, 2024

I may be able to make this work with url_prefix. Giving that a try.

On 2nd thought, I still think there should be 2 endpoitns by default for backwards compatability:

/embeddings
/v1/embeddings

@benoitdion
Copy link

The "object" should be "list" but infinity returns "embedding". Not sure if this matters though but sharing observation here

@samos123 this is indeed an issue. Using an openai compatible clients errors out since the response json is incompatible.

@wirthual
Copy link
Collaborator

Hi @benoitdion ,
Thanks for bringing this to our attention. This should be fixed on the main branch now. It would be great if you could let us know if the changes resolve your issues.

@benoitdion
Copy link

@wirthual looks like it will

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

No branches or pull requests

3 participants