vai logo
vai
Use CasesShared SpaceDocs
Get Started
Embeddings
Retrieval
Input Types

Document vs Query Embeddings

Show why input type matters by embedding the same sentence as both a document and a query, then validating the semantic overlap with similarity.

API key
View Source TapeOpen Docs
Prerequisites

A valid VOYAGE_API_KEY is set in the environment.

Under the hood

See the exact VAI command, the matching Voyage AI layer, and the MongoDB query shape behind the demo.

vai embed 'Vector search finds semantically similar content' --input-type query

The tape uses the same sentence twice so the only changing variable is intent. That makes it easy to see why input_type is a retrieval choice, not just a syntactic flag.

Share or copy this demo

Keep it lightweight. The prepared text stays behind the buttons.

Open canonical URL

Share

Copy

LinkedIn opens the share dialog and copies the prepared text so you can paste it in quickly.

Exact commands

The full walkthrough is included here so anyone can replay the demo exactly as published.

$vai explain embeddings
$echo '=> ingest-time: embed as a document'
$vai embed 'Vector search finds semantically similar content' --input-type document
$echo '=> search-time: embed as a query -- different vector, same space'
$vai embed 'Vector search finds semantically similar content' --input-type query
$echo '=> now measure semantic similarity between two different phrasings'
$vai similarity 'What is vector search?' 'How does semantic search work?' --model voyage-4-large
$echo '=> high similarity score: different words, same meaning'

Related demos

More shareable workflows from the same VAI demo library.

Getting Started
Embeddings
Featured
What Is an Embedding?

Start from first principles: generate a Voyage embedding, inspect its shape, and compare full-size versus Matryoshka-reduced vectors.

API key

VAI command

vai embed 'MongoDB Atlas makes vector search production-ready'

Show Under the Hood

Prerequisites

A valid VOYAGE_API_KEY is set in the environment.

View DemoSource
Retrieval
Reranking
Featured
Two-Stage Retrieval With Reranking

Walk through the classic retrieval stack: embed the query, run Atlas vector search, rerank the candidates, then compare the result to a vector-only pass.

Atlas
API key

VAI command

vai query 'how does vector search work?' --db vai_demo --collection knowledge --model voyage-4-lite

Show Under the Hood

Prerequisites

A valid VOYAGE_API_KEY is set in the environment.