Skip to main content

An integration package connecting VoyageAI and LangChain

Project description

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
)

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.

Project details


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.0.tar.gz (14.3 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.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_voyageai-0.4.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langchain_voyageai-0.4.0.tar.gz
Algorithm Hash digest
SHA256 07cc420bdb07b9ac9d6a5e6264860a0b395e233f9e1260a065d9ba0baad594ec
MD5 aaae346e5fdd8006357a60b0df08340f
BLAKE2b-256 400b67b1c254700ad29b5ada8bf0505bf9746ce5cb7883536f5c53d2e526af62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_voyageai-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a327299f736e66693dfdd2e327987baa1ff517708166e182166e0612a610597e
MD5 01a5047a896d582bdcdc0d0f2dd1c376
BLAKE2b-256 91a9b5b55e15d90e9f69988985fecda31e124c9aa12d8d445662dfd392cf5d9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page