Embed documents
cURL
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
- Split your documents into passages and embed them.
- Store the vectors with the original text.
- Embed a user’s question and retrieve similar passages.
- Rerank the matches, then pass the best passages to text generation.