Embedding Models
Learn how to use Tune Studio’s Embedding API to generate text embeddings for tasks like semantic search, content recommendation, classification, and more.
Embeddings are numerical representations of text that capture its semantic meaning. These embeddings map similar pieces of text closer in vector space, enabling advanced text analysis tasks such as:
- Semantic Search: Retrieve content with similar meaning. Find similar texts by comparing embeddings using cosine similarity or dot product.
- Content Recommendation: Suggest relevant items or information. Use embeddings to recommend content similar to a user’s preferences.
- Text Classification: Categorize text into predefined groups. Group related texts together based on embedding similarity.
- Similarity Analysis: Measure how closely texts are related.
Available Models
Tune Studio supports the following embedding models:
Model Name | Dimensions | Max Input Tokens | Description | Best For |
---|---|---|---|---|
openai/text-embedding-3-small | 1536 | 8191 | Lightweight model with strong performance | Cost-effective, general-purpose use |
openai/text-embedding-3-large | 3072 | 8191 | High-accuracy model for critical tasks | Applications requiring high precision |
openai/text-embedding-ada-002 | 1536 | 8191 | Legacy model for compatibility | Systems already using Ada embeddings |
Understanding Model Parameters
Dimensions:
The dimensions value represents the length of the embedding vector that the model produces.
- Each piece of text is converted into a vector of floating-point numbers
- The number of dimensions affects the model’s ability to capture semantic nuances
- Higher dimensions (like 3072 in
text-embedding-3-large
) can capture more detailed semantic relationships - Lower dimensions (like 1536) require less storage and are faster to process while still maintaining good performance
Maximum Input Tokens:
- Represents the maximum length of text that can be processed in a single request
- Tokens are roughly equal to 4 characters or ~¾ of a word
- Longer texts need to be chunked into smaller pieces before processing
- All current models support up to 8,191 tokens per input
Higher dimensions don’t always mean better performance for your specific use case. text-embedding-3-small
(1536 dimensions) is suitable for most applications, while text-embedding-3-large
(3072 dimensions) should be used when maximum accuracy is required.
Getting Started
Create Embeddings
To generate embeddings, make a POST
request to the API endpoint with your text input and selected model.
Endpoint
Sample Request
Response Format
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
input | string or array | Yes | Text to embed |
model | string | Yes | ID of the model to use |
Best Practices
Input Types
The API accepts the following input types:
- Single string: For embedding one text at a time.
- Array of strings: For embedding multiple texts in a batch.
Example:
Batching Requests
- Batch requests for efficiency (up to 2048 tokens per batch).
- Balance batch size with response time based on your application needs.
Preprocessing
- Remove unnecessary whitespace and special characters.
- Use consistent formatting, such as lowercasing all text for uniformity.
Embeddings are billed based on the number of tokens in the input text. For details, see our pricing page.
The Embedding API generates embeddings but does not store them. Users are responsible for storing embeddings in their preferred database or storage solution.
Was this page helpful?