Skip to content

Commit 6e53bf9

Browse files
authored
Merge pull request #3 from voyage-ai/voyage_2_model
community: model attribute is required, set default batch size
2 parents 1113700 + 4de3553 commit 6e53bf9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/docs/integrations/text_embedding/voyageai.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"id": "137cfde9-b88c-409a-9394-a9e31a6bf30d",
2828
"metadata": {},
2929
"source": [
30-
"Voyage AI utilizes API keys to monitor usage and manage permissions. To obtain your key, create an account on our [homepage](https://www.voyageai.com). Then, create a VoyageEmbeddings model with your API key."
30+
"Voyage AI utilizes API keys to monitor usage and manage permissions. To obtain your key, create an account on our [homepage](https://www.voyageai.com). Then, create a VoyageEmbeddings model with your API key. Please refer to the documentation for further details on the available models: https://docs.voyageai.com/embeddings/"
3131
]
3232
},
3333
{
@@ -37,7 +37,7 @@
3737
"metadata": {},
3838
"outputs": [],
3939
"source": [
40-
"embeddings = VoyageEmbeddings(voyage_api_key=\"[ Your Voyage API key ]\")"
40+
"embeddings = VoyageEmbeddings(voyage_api_key=\"[ Your Voyage API key ]\", model=\"voyage-2\")"
4141
]
4242
},
4343
{

libs/community/langchain_community/embeddings/voyageai.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ class VoyageEmbeddings(BaseModel, Embeddings):
6969
7070
from langchain_community.embeddings import VoyageEmbeddings
7171
72-
voyage = VoyageEmbeddings(voyage_api_key="your-api-key")
72+
voyage = VoyageEmbeddings(voyage_api_key="your-api-key", model="voyage-2")
7373
text = "This is a test query."
7474
query_result = voyage.embed_query(text)
7575
"""
7676

77-
model: str = "voyage-01"
77+
model: str
7878
voyage_api_base: str = "https://api.voyageai.com/v1/embeddings"
7979
voyage_api_key: Optional[SecretStr] = None
80-
batch_size: int = 8
80+
batch_size: Optional[int] = None
8181
"""Maximum number of texts to embed in each API request."""
8282
max_retries: int = 6
8383
"""Maximum number of retries to make when generating."""
@@ -121,7 +121,7 @@ def _get_embeddings(
121121
embeddings: List[List[float]] = []
122122

123123
if batch_size is None:
124-
batch_size = self.batch_size
124+
batch_size = 72 if self.model in ["voyage-2", "voyage-02"] else 7
125125

126126
if self.show_progress_bar:
127127
try:

libs/community/tests/integration_tests/embeddings/test_voyageai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from langchain_community.embeddings.voyageai import VoyageEmbeddings
33

44
# Please set VOYAGE_API_KEY in the environment variables
5-
MODEL = "voyage-01"
5+
MODEL = "voyage-2"
66

77

88
def test_voyagi_embedding_documents() -> None:

0 commit comments

Comments
 (0)