Skip to main content
Use your API key to convert text into vectors. Store them in your own vector database and compare them with an embedded query.

Embed documents

cURL
Each vector is returned in data[i].embedding, with its input position in data[i].index. The response also includes token usage and cost. Use the same model and dimensions for documents and queries. For Voyage, set input_type to document when indexing and query when searching.

Build retrieval into your app

  1. Split your documents into passages and embed them.
  2. Store the vectors with the original text.
  3. Embed a user’s question and retrieve similar passages.
  4. Rerank the matches, then pass the best passages to text generation.