Skip to main content

langchain-voyageai

This package contains the LangChain integrations for VoyageAI through their voyageai client package.

Installation and Setup

  • Install the LangChain partner package
pip install langchain-voyageai
  • Get an VoyageAI api key and set it as an environment variable (VOYAGE_API_KEY) or use the API key as a parameter in the Client.

Text Embedding Model

See a usage example

from langchain_voyageai import VoyageAIEmbeddings

Voyage-4 Family Models

The latest generation of VoyageAI embedding models with improved quality and flexibility:

# voyage-4: Balanced model for general-purpose and multilingual retrieval
embeddings = VoyageAIEmbeddings(model="voyage-4")

# voyage-4-lite: Optimized for latency and cost, highest batch throughput (1M tokens/batch)
embeddings = VoyageAIEmbeddings(model="voyage-4-lite")

# voyage-4-large: Best retrieval quality for demanding applications
embeddings = VoyageAIEmbeddings(model="voyage-4-large")

All voyage-4 family models support flexible output dimensions (256, 512, 1024, 2048):

embeddings = VoyageAIEmbeddings(
    model="voyage-4",
    output_dimension=512  # Choose from: 256, 512, 1024, 2048
)

Code Embeddings

voyage-code-4 is optimized for code retrieval and supports flexible output dimensions (256, 512, 1024, 2048):

# voyage-code-4: optimized for code retrieval
embeddings = VoyageAIEmbeddings(model="voyage-code-4")

embeddings = VoyageAIEmbeddings(
    model="voyage-code-4",
    output_dimension=512  # Choose from: 256, 512, 1024, 2048
)

Contextualized Chunk Embeddings

voyage-context-4 produces contextualized chunk embeddings, where each chunk is embedded in the context of the other chunks from the same document:

# voyage-context-4: contextualized chunk embeddings for document-aware retrieval
embeddings = VoyageAIEmbeddings(model="voyage-context-4")

It also supports flexible output dimensions (256, 512, 1024, 2048):

embeddings = VoyageAIEmbeddings(
    model="voyage-context-4",
    output_dimension=512  # Choose from: 256, 512, 1024, 2048
)

Custom API Endpoint

You can specify a custom API endpoint using the base_url parameter:

embeddings = VoyageAIEmbeddings(
    model="voyage-3.5",
    base_url="https://ai.mongodb.com/v1"
)

This is useful for MongoDB Atlas users or custom deployments.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_voyageai-0.4.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_voyageai-0.4.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_voyageai-0.4.1.tar.gz.

File metadata

  • Download URL: langchain_voyageai-0.4.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langchain_voyageai-0.4.1.tar.gz
Algorithm Hash digest
SHA256 294293b35f6973a965b521e51a1d1423d467921fc74ccfac2568ca92775201d1
MD5 bf5e5daed590c99fdc034833604ccc95
BLAKE2b-256 7621b24ec7cb5d6f8f87b01abfcf183f88365e55ab6a18bf1a50c7467185e3f6

See more details on using hashes here.

File details

Details for the file langchain_voyageai-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_voyageai-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a9c22da5f2e4a48ad2c7108f01d221a6660438d8cfcd587f073d96610d19f8c
MD5 3aec050df8f0f139f65d47484e4e8bbf
BLAKE2b-256 aa8f7155079af6e924acd17238a14b6cd07e357eca27c55981628ec5065e2e87

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page