Reference · Snippet · python
OpenAI embeddings — batch
Last updated
from openai import OpenAI
client = OpenAI()
chunks = [
"Annual plans refund within 14 days of purchase.",
"Monthly plans renew automatically each month.",
"Contact support@example.com for billing disputes.",
]
response = client.embeddings.create(
model="text-embedding-3-small",
input=chunks,
)
for i, row in enumerate(response.data):
print(chunks[i][:40], "→", len(row.embedding), "dims")