openai / openai/openai-openapi

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

Open
#424 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug specification
Dominant language
No language data
Stars
2.5k
Forks
527
Avg merge
1h 46m
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in openapi.yaml at the schema around lines 17047-17052 and compare it with the embeddings API example in the issue. Update the response schema so the embedding field reflects the base64 string form as well as the existing form, then verify the generated specification accepts the documented response.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.