Classic text embedding model for existing knowledge bases and semantic retrieval
text-embedding-ada-002 is OpenAI's classic text embedding model, converting natural language and code into comparable numerical vectors for semantic retrieval, similar-content matching, and code search. It connects queries and documents through a unified representation, making it suitable for maintaining existing ada-002 vector databases and serving as a baseline for retrieval experiments; its output is vectors, not chat responses.
Clarify capacity, inputs and outputs, and invocation methods before selecting a model.
Native input capacity
8192 tokens context length
Full vector dimensions
1536 dimensions
Input methods
Non-empty text, text batches, token arrays, or batches of token arrays
Batch size
Up to 2048 items for text batches and token batches
Output encoding
float or base64, float by default
Invocation method
POST /openai/embeddings;model=text-embedding-ada-002
8192 tokens and 1536 dimensions are publicly available native specifications; batch formats and return encoding are invocation settings for this platform endpoint, and batch size does not equal total token capacity.
Core capabilities
Learn what text-embedding-ada-002 can bring to your work.
Connect queries and documents with semantics
The model converts queries and documents into the same vector representation, making it suitable for finding content that is phrased differently but has similar meaning. Compared with retrieval methods that rely only on keywords, it can handle semantic candidate retrieval; applications can then combine keywords, business filters, or ranking rules to produce final search results, rather than treating similarity directly as a factual judgment.
Unify text and code search
ada-002 unifies text similarity, query and document search, and natural language and code search in a single model. It can index documentation as well as represent code snippets, supporting the discovery of relevant implementations based on functional descriptions. Its code capability here is semantic representation and retrieval, not writing programs, running code, or verifying program correctness.
Structured vectors for easy application integration
The complete output is a 1536-dimensional vector, making it easy to configure indexes with fixed dimensions. Returned data includes an index, which can be used to associate inputs within a batch, and provides token usage information. The default float format facilitates numerical processing; when choosing base64, decode it according to the encoding method before passing it to vector computation or storage components.
Use cases
Start with specific tasks to find where the model can be effective.
Maintain existing knowledge base retrieval
Split newly added help documents, product descriptions, and internal policies into text chunks, then continue using ada-002 to generate vectors and write them to an existing index. User questions are also encoded with the same model, and the retrieved relevant passages are passed to a response model. The deliverable is traceable candidate documents and passages, not answers generated directly by the embeddings interface.
Discover similar content and duplicate topics
Input ticket bodies, article summaries, or product descriptions, then perform similarity ranking or clustering on the resulting vectors to find similar issues, consolidate duplicate topics, and recommend related content. Applications must set thresholds and sample-check results themselves, especially to distinguish between similar topics and complete business duplicates, avoiding the automatic merging of important differences.
Build code snippet search
Encode function snippets, comments, and development documentation separately, then convert natural-language requirements such as “parse configuration files” into query vectors to return relevant code locations and explanations. This is suitable for codebase navigation and implementation reference; indexes should retain file paths and version information so developers can return to the original files and inspect the actual logic.
How to choose this model
Choose based on task complexity, input materials, and expected results.
Prioritize consistency when you already have an ada index
If existing document vectors were generated by ada-002, continue using it for new content and queries to help maintain a consistent retrieval space. Do not mix it directly into an old index simply because another model also outputs the same number of dimensions. When planning an upgrade, re-encode the documents and compare recall results, storage overhead, and migration costs using real queries before deciding whether to switch.
Evaluate third-generation embeddings for new projects as well
When building a new retrieval system, it is recommended to evaluate both text-embedding-3-small and text-embedding-3-large. Official comparisons show that both outperform ada-002 on multilingual retrieval and average benchmarks for English tasks, and they have native vector shortening capabilities. ada-002 is better suited as a continuation of an existing system or an experimental baseline; the choice should still be based on testing with business data.
Getting started
From a small-scale task to production integration.
01
Prepare the task and materials
Define the goal, required inputs, and output requirements, using real business examples as a starting point.
02
Try it in the API testing area
Open the trial page, confirm the parameters supported by this entry point, then submit a small-scale task to view the results.
03
Integrate according to the API documentation
Keep the full model ID, use the request format specified in the documentation, and confirm billing rules on the Pricing page.
Usage boundaries
Before formal use, understand output quality and capability limits.
8192 tokens is input capacity, not a count of Chinese characters; long documents should be counted first and split at content boundaries. A batch maximum of 2048 items also does not mean every item can use the full native capacity at the same time. Reasonable chunking not only helps control request size, but also enables retrieval results to point to more specific passages.
Do not use ada-002 as though it supports native variable dimensions; conventional indexes should be designed for the full 1536 dimensions. Arbitrarily truncating vectors cannot be considered an equivalent substitute; if the target vector database requires fewer dimensions, evaluate the text-embedding-3 series, which has native shortening capabilities.
Retrieval capability does not mean better performance on all classification tasks. Officially, it did not outperform text-similarity-davinci-001 on the SentEval linear-probe classification benchmark; if you want to train a lightweight classification layer on vectors, separately validate label separation performance rather than applying conclusions from search tasks.
Frequently Asked Questions
Answers to common questions about using text-embedding-ada-002.
Can ada-002 directly answer knowledge base questions?
It cannot generate answers directly. It converts questions and documents into vectors, which the application uses to find relevant passages, and a generative model then organizes the answer. When building knowledge base Q&A, you need to separately handle document storage, similarity retrieval, and answer generation; the embeddings API is responsible for the text representation step.
How can I generate vectors in batches and map them to the original text?
Submit a non-empty array of strings to input, or submit a batch made up of token arrays; both batch formats support up to 2048 items. Each item in the response data includes an index, which can be used to associate it with the input. It is recommended to also save your business document ID so you can still find the original content after vectors are written to the index.
Can I directly submit a PDF, image, or webpage URL?
This endpoint accepts text or token arrays; it is not a file parsing API. Text must first be extracted from PDFs, image content must first be converted into searchable text, and webpage body content must first be retrieved. Even if a URL is submitted as a string, it does not mean the model will automatically open the page and read its contents.
Do float and base64 change the vector dimensions?
They are used to select the return encoding, not the model or dimensions. float returns a numeric array, suitable for direct vector processing; base64 returns an encoded string that must be decoded before use. The full ada-002 vector has 1536 dimensions, and a change in transmission format should not be interpreted as a shorter vector.
Do I need to rebuild the index when switching to text-embedding-3-small?
You should re-embed the documents and build a corresponding index, and queries must also use the same new model. Vectors produced by different models should not be mixed for comparison simply because they have the same dimensions. Before migrating, you can retain the old index for comparison, use real search queries to check result quality, and then gradually switch the retrieval workflow.
Model information · Updated: 2026-10-01. For API parameters and pricing rules, see the API and pricing sections.