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.
Metadata
Release files for langchain-voyageai 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_voyageai-0.4.1.tar.gz | 14.7 kB | Without provenance | Details for langchain_voyageai-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_voyageai-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for langchain_voyageai-0.4.1-py3-none-any.whl |
Total release size: 22.2 kB
Release files / langchain_voyageai-0.4.1.tar.gz
| Download URL | langchain_voyageai-0.4.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
294293b35f6973a965b521e51a1d1423d467921fc74ccfac2568ca92775201d1
|
|
BLAKE2b-256 checksum How to use checksums |
7621b24ec7cb5d6f8f87b01abfcf183f88365e55ab6a18bf1a50c7467185e3f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / langchain_voyageai-0.4.1-py3-none-any.whl
| Download URL | langchain_voyageai-0.4.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a9c22da5f2e4a48ad2c7108f01d221a6660438d8cfcd587f073d96610d19f8c
|
|
BLAKE2b-256 checksum How to use checksums |
aa8f7155079af6e924acd17238a14b6cd07e357eca27c55981628ec5065e2e87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for langchain-voyageai 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.