Skip to content

Commit

Permalink
Merge pull request openai#99 from openai/dev/logan/encoding-format
Browse files Browse the repository at this point in the history
Add encoding format
  • Loading branch information
logankilpatrick committed Oct 19, 2023
2 parents 3c3521b + 84e9aa6 commit e145786
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -787,15 +787,17 @@ paths:
-H "Content-Type: application/json" \
-d '{
"input": "The food was delicious and the waiter...",
"model": "text-embedding-ada-002"
"model": "text-embedding-ada-002",
"encoding_format": "float"
}'
python: |
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Embedding.create(
model="text-embedding-ada-002",
input="The food was delicious and the waiter..."
input="The food was delicious and the waiter...",
encoding_format="float"
)
node.js: |-
import OpenAI from "openai";
Expand All @@ -806,6 +808,7 @@ paths:
const embedding = await openai.embeddings.create({
model: "text-embedding-ada-002",
input: "The quick brown fox jumped over the lazy dog",
encoding_format: "float",
});
console.log(embedding);
Expand Down Expand Up @@ -3841,6 +3844,12 @@ components:
- type: string
enum: ["text-embedding-ada-002"]
x-oaiTypeLabel: string
encoding_format:
description: "The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/)."
example: "float"
default: "float"
type: string
enum: ["float", "base64"]
user: *end_user_param_configuration
required:
- model
Expand Down

0 comments on commit e145786

Please sign in to comment.