Create embeddings
embeddings.create(EmbeddingCreateParams**kwargs) -> CreateEmbeddingResponse
POST/embeddings
Creates an embedding vector representing the input text.
Parameters
dimensions: Optional[int]
The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
minimum1
user: Optional[str]
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
Create embeddings
from openai import OpenAI
client = OpenAI()
client.embeddings.create(
model="text-embedding-3-small",
input="Hello world",
encoding_format="float",
dimensions=3
)
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.26726124,
0.53452248,
0.80178373
],
"index": 0
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 2,
"total_tokens": 2
}
}
Returns Examples
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.26726124,
0.53452248,
0.80178373
],
"index": 0
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 2,
"total_tokens": 2
}
}