Embeddings are dense vector representations of text that capture semantic meaning. Two texts about the same topic will have similar embeddings, even if they use completely different words.
| Model | Dimensions | Max Tokens | Best For |
|---|---|---|---|
| text-embedding-3-small | 1,536 | 8,191 | Cost-effective, high-volume search |
| text-embedding-3-large | 3,072 | 8,191 | Maximum accuracy, complex similarity |
const embedding = await openai.embeddings.create({
model: "text-embedding-3-small",
input: "How do I reset my password?",
dimensions: 1024 // Optional: reduce dimensions for efficiency
});
// Returns: { embedding: [0.0023, -0.0091, 0.0154, ...] }
Both models support native dimension reduction. You can request fewer dimensions (e.g., 256, 512, 1024) to save storage and improve search speed with minimal accuracy loss.
text-embedding-3-small with 1,024 dimensions for 90% of use cases. Only upgrade to large when you need maximum precision for nuanced similarity tasks.