infinity icon indicating copy to clipboard operation
infinity copied to clipboard

prepend v1 to OpenAI compatible APIs

Open samos123 opened this issue 1 year ago • 3 comments

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: https://github.com/substratusai/kubeai/pull/197

Your contribution

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

samos123 avatar Sep 22 '24 14:09 samos123

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 avatar Sep 22 '24 14:09 samos123

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 avatar Sep 22 '24 14:09 samos123

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

samos123 avatar Sep 22 '24 14:09 samos123

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.

benoitdion avatar Oct 25 '24 13:10 benoitdion

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.

wirthual avatar Oct 28 '24 14:10 wirthual

@wirthual looks like it will

benoitdion avatar Oct 29 '24 10:10 benoitdion

The changes are released and the embedding response is compatible with the openai response now.

wirthual avatar Dec 12 '24 16:12 wirthual