openai-openapi icon indicating copy to clipboard operation
openai-openapi copied to clipboard

OpenAPI spec doesn't allow embedding response to be base64 encoded string

Open aliok opened this issue 9 months ago • 1 comments

When I call the embeddings API with encoding_format=base64, the embedding field of the response item is a string.

curl -v https://api.openai.com/v1/embeddings \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "The food was delicious",
"model": "text-embedding-3-small",
"encoding_format": "base64",
"dimensions":10
}'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": "nMcovm6gOb7ldwO/AESlvk0Avz2nZIq+3c+EvZvdFT9HsZa9oSy+vg=="    <------ THIS
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 4,
    "total_tokens": 4
  }
}

However, the OpenAPI spec does not reflect that:

https://github.com/openai/openai-openapi/blob/acea67a5045a6873c6eb2573a6be0e0a7b092ec6/openapi.yaml#L17047-L17052

aliok avatar Feb 26 '25 12:02 aliok

Related: https://github.com/openai/openai-go/issues/241

aliok avatar Feb 26 '25 12:02 aliok