TOOL WIKI · DATA & RETRIEVAL
Voyage AI
Provides embedding and reranking models for retrieval applications.
Jump to a section 10 sections
EXAMPLE USE CASE
Rank policy snippets using query/document embeddings
A policy assistant needs usable source text or relevant evidence before a generation model can answer a question reliably.
- Input
- A question, two candidate texts and one configured embedding model.
- Expected output
- Similarity scores with the matching source snippets in ranked order.
- Success check: The query/document embedding roles are explicit and use the same model.
- Try a failure: Mixing dimensions or embedding models must fail before distance comparisons.
Example scope: Actual hosted embeddings with explicit query/document roles.
Official reference · Voyage AI
Preserve provenance, input format, and access-control metadata.
inputTo 02 · Voyage AIChoosing a model layer for semantic search over a specific corpus. Benchmark retrieval with your content and language distribution.
processTo 03 · Prepared recordsValidate the component-specific output, including failed or empty records.
Store derived data with source version and deletion information.
Use compatible query processing and tenant-scoped filtering.
outputTo 06 · EvaluationCheck extraction quality, retrieval recall, and answer grounding separately.
Result or stopping point
Choosing a model layer for semantic search over a specific corpus. Benchmark retrieval with your content and language distribution.
When to consider it
- Choosing a model layer for semantic search over a specific corpus.
A design decision to make
- Benchmark retrieval with your content and language distribution.
Prerequisites and setup
- A Voyage API key and an enabled text embedding model. Two embedding requests are made when you run the sample.
python3 -m venv .venv
source .venv/bin/activate
pip install voyageai
export VOYAGE_API_KEY="YOUR_KEY"
export VOYAGE_MODEL="YOUR_ENABLED_EMBEDDING_MODEL"Try a small integration
embed.py
import os
import math
import voyageai
client = voyageai.Client(api_key=os.environ["VOYAGE_API_KEY"])
documents = ["Returns are accepted within 30 days.","Shipping normally takes five days."]
model = os.environ["VOYAGE_MODEL"]
vectors = client.embed(documents,model=model,input_type="document").embeddings
query = client.embed(["What is the return deadline?"],model=model,input_type="query").embeddings[0]
def cosine(a,b):
assert len(a) == len(b)
return sum(x*y for x,y in zip(a,b))/(math.sqrt(sum(x*x for x in a))*math.sqrt(sum(y*y for y in b)))
print(sorted([(cosine(query,v),documents[i]) for i,v in enumerate(vectors)],reverse=True))Run and check the result
python embed.py- The query/document embedding roles are explicit and use the same model.
- Inspect vector dimensions before creating the database column/index.
Common failures
- A successful parse job does not prove table/reading-order accuracy; compare output with the original page.
- Enforce file-size, duration and memory limits. Treat extracted text as untrusted content rather than instructions.
Production decisions
- Preserve document ID, version, page/section, access scope and parser/model configuration alongside each chunk or vector.
- Evaluate extraction and retrieval separately. Test tables, scans, empty documents, duplicates, malformed input and source deletion.
Keep exploring
Explore the same layer
Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.