Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

VoyageAI embedding function #226

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions docs/embeddings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ Chroma provides lightweight wrappers around popular embedding providers, making

<div class="special_table"></div>

| | Python | JS |
|--------------|-----------|---------------|
| [OpenAI](/embeddings/openai) | ✅ | ✅ |
| [Google Generative AI](/embeddings/google-gemini) | ✅ | ✅ |
| [Cohere](/embeddings/cohere) | ✅ | ✅ |
| [Google PaLM](/embeddings/google-palm) | ✅ | ➖ |
| [Hugging Face](/embeddings/hugging-face) | ✅ | ➖ |
| [Instructor](/embeddings/instructor) | ✅ | ➖ |
| | Python | JS |
|---------------------------------------------------------------------------|-----------|---------------|
| [OpenAI](/embeddings/openai) | ✅ | ✅ |
| [Google Generative AI](/embeddings/google-gemini) | ✅ | ✅ |
| [Cohere](/embeddings/cohere) | ✅ | ✅ |
| [Google PaLM](/embeddings/google-palm) | ✅ | ➖ |
| [Hugging Face](/embeddings/hugging-face) | ✅ | ➖ |
| [Instructor](/embeddings/instructor) | ✅ | ➖ |
| [Hugging Face Embedding Server](/embeddings/hugging-face-embedding-server) | ✅ | ✅ |
| [Jina AI](/embeddings/jinaai) | ✅ | ✅ |
| [Jina AI](/embeddings/jinaai) | ✅ | ✅ |
| [VoyageAI](/embeddings/jinaai) | ✅ | ✅ |
fzowl marked this conversation as resolved.
Show resolved Hide resolved

We welcome pull requests to add new Embedding Functions to the community.

Expand Down
52 changes: 52 additions & 0 deletions docs/embeddings/voyageai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
---

# VoyageAI

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<div class="select-language">Select a language</div>

<Tabs queryString groupId="lang">
<TabItem value="py" label="Python"></TabItem>
<TabItem value="js" label="JavaScript"></TabItem>
</Tabs>

Chroma also provides a convenient wrapper around VoyageAI's embedding API. This embedding function runs remotely on VoyageAI’s servers, and requires an API key. You can get an API key by signing up for an account at [VoyageAI](https://dash.voyageai.com/api-keys).

<Tabs queryString groupId="lang" className="hideTabSwitcher">
<TabItem value="py" label="Python">

This embedding function relies on the `voyageai` python package, which you can install with `pip install voyageai`.

```python
from chromadb.utils.embedding_functions import VoyageAIEmbeddingFunction
voyageai_ef = VoyageAIEmbeddingFunction(api_key="YOUR_API_KEY", model_name="voyage-large-2", input_type=VoyageAIEmbeddingFunction.InputType.DOCUMENT)
result = voyageai_ef(input=["document1","document2"])
```

</TabItem>
<TabItem value="js" label="JavaScript">

```javascript
const {VoyageAIEmbeddingFunction, InputType} = require('chromadb');
fzowl marked this conversation as resolved.
Show resolved Hide resolved
const embedder = new VoyageAIEmbeddingFunction("apiKey", "voyage-large-2", InputType.DOCUMENT)

// use directly
const embeddings = embedder.generate(["document1","document2"])

// pass documents to query for .add and .query
const collection = await client.createCollection({name: "name", embeddingFunction: embedder})
const collectionGet = await client.getCollection({name:"name", embeddingFunction: embedder})
```

</TabItem>

</Tabs>



You should pass in the `model_name` argument, which lets you choose which VoyageAI embeddings model to use. You can see the available models [here](https://docs.voyageai.com/docs/embeddings).


2 changes: 1 addition & 1 deletion docs/js_reference/Client.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,4 @@ const version = await client.version();

`Promise`<`string`\>

A promise that resolves to the version of the Chroma API.
A promise that resolves to the version of the Chroma API.
2 changes: 1 addition & 1 deletion docs/js_reference/Collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,4 @@ const response = await collection.upsert({

`Promise`<`boolean`\>

- The response from the API. True if successful.
- The response from the API. True if successful.
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const sidebars = {
'embeddings/instructor',
'embeddings/hugging-face-embedding-server',
'embeddings/jinaai',
'embeddings/voyageai',
],
},
],
Expand Down