Skip to main content

Input Types

Voyage AI embedding models accept an input_type parameter that optimizes how text is embedded. The two types — query and document — enable asymmetric retrieval, where short queries find long documents effectively.

Why Input Types Matter

Queries and documents are fundamentally different:

  • Queries are short, often questions: "How do I scale MongoDB?"
  • Documents are long, informational passages that contain the answer

The model prepends different internal prompts for each type, adjusting the embedding to work better for retrieval. Using the wrong input type (or none) reduces search quality.

When to Use Each

Input TypeUse Forvai Commands
querySearch queries, questionsvai search, vai query, vai embed --input-type query
documentCorpus text being storedvai store, vai ingest, vai pipeline, vai embed --input-type document
(omit)Direct comparison (similarity)vai similarity

vai Defaults

Most vai commands set the input type automatically:

  • vai search uses query for the search text
  • vai store, vai ingest, vai pipeline use document for stored text
  • vai similarity omits input type (comparing texts directly)
  • vai embed shows a tip if you don't specify one
# Explicit input types
vai embed "What is sharding?" --input-type query
vai embed --file chapter.txt --input-type document

Further Reading