The Rivet Chroma Plugin is a plugin for Rivet to add functionality for the Chroma vector database. It adds the following nodes to Rivet:
- Chroma Add
- Chroma Delete
- Chroma Get
- Chroma Query
- Chroma Update
- Create Collection
- Delete Collection
- List Collections
Note: unless Chroma is configured to accept CORS from tauri://localhost
, you must use the Node Executor with this plugin.
To use this plugin in Rivet:
- Open the plugins overlay at the top of the screen.
- Search for "rivet-plugin-chromadb"
- Click the "Install" button to install the plugin into your current project.
-
Import the plugin and Rivet into your project:
import * as Rivet from "@ironclad/rivet"; import RivetPluginChroma from "@ironclad/rivet-plugin-chromadb";
-
Initialize the plugin and register the nodes with the
globalRivetNodeRegistry
:Rivet.globalRivetNodeRegistry.registerPlugin(RivetPluginChroma(Rivet));
(You may also use your own node registry if you wish, instead of the global one.)
-
The nodes will now work when ran with
runGraphInFile
orcreateProcessor
.
By default, the plugin will attempt to connect to a database at http://localhost:8000
. If you would like you change this, you can open the Settings window, navigate to the Plugins area, and you will see a Database URI
setting. You can change this to the URI of your Chroma database.
When using the SDK, you can pass a databaseUri
option to the plugin to configure the database URI:
Using createProcessor
or runGraphInFile
, pass in via pluginSettings
in RunGraphOptions
:
await createProcessor(project, {
...etc,
pluginSettings: {
chroma: {
databaseUri: "http://localhost:8000",
},
},
});
Add an item to a collection in Chroma. You must provide an embedding for the item, and optionally a document. The item must also have an ID - you can use the RNG Node or Hash Node to generate random or deterministic IDs.
Title | Data Type | Description | Default Value | Notes |
---|---|---|---|---|
Embedding | vector |
The embedding of the item to add to the collection in Chroma | (required) | You can use the Get Embedding Node to get vector embeddings to store in Chroma. |
Document | string |
The document to associate with the embedding. Optional. | (empty) |
Additional inputs available with toggles in the editor.
Title | Data Type | Description | Notes |
---|---|---|---|
ID | string |
The ID of the row stored in Chroma. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to add the item into. | new-collection | Yes | string |
Create Collection If Not Exists | If the collection does not exist, create it. | true | Yes | boolean |
ID | The ID of the item to add. If empty, a random ID will not be generated. You can use the RNG Node or Hash Node to generate random or deterministic IDs. | (empty) | Yes (default true) | string |
Upsert | If the item already exists, update it instead of throwing an error. | true | Yes | boolean |
Metadata | Additional key/value pairs to store with the item. | (empty) | Yes | object |
Delete an item from a collection in Chroma.
See Editor Settings, all inputs are toggleable.
Title | Data Type | Description | Notes |
---|---|---|---|
IDs | string[] |
The IDs of the items that were deleted from the collection. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to delete the item from. | new-collection | Yes | string |
Create Collection If Not Exists | If the collection does not exist, create it. | true | Yes | boolean |
ID | The ID of the item to delete. If empty, then Where filters will be used instead. | (empty) | Yes (default true) | string |
Where | A JSON object representing Where filters to use to find the items to delete. | (empty) | Yes | object |
Where Document | A JSON object representing a Where document filter to use to find the items to delete. | (empty) | Yes | object |
Retrieves (not queries) one or more items from a collection in Chroma. If you are searching, use the Chroma Query node instead.
See Editor Settings, all inputs are toggleable.
Title | Data Type | Description | Notes |
---|---|---|---|
IDs | string[] |
The IDs of the items that were retrieved from Chroma. | |
Items | object[] |
The full item objects that were retrieved from Chroma. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to retrieve the item from. | new-collection | Yes | string |
Create Collection If Not Exists | If the collection does not exist, create it. | true | Yes | boolean |
Limit | The maximum number of items to retrieve. | 10 | Yes | number |
Offset | The number of items to skip before retrieving. | 0 | Yes | number |
IDs | The IDs of the items to retrieve. If empty, then Where filters will be used instead. | (empty) | Yes (default true) | string[] |
Where | A JSON object representing Where filters to use to find the items to retrieve. | (empty) | Yes | object |
Where Document | A JSON object representing a Where document filter to use to find the items to retrieve. | (empty) | Yes | object |
Queries one or more items from a collection in Chroma using an embedding to find the nearest neighbors. If you are retrieving a specific item, use the Chroma Get node instead.
Title | Data Type | Description | Default Value | Notes |
---|---|---|---|---|
Embedding | vector |
The embedding to use to find the nearest neighbors. | (required) | You can use the Get Embedding Node to get vector embeddings to store in Chroma. |
Additional inputs available with toggles in the editor.
Title | Data Type | Description | Notes |
---|---|---|---|
IDs | string[] |
The IDs of the items that were retrieved from Chroma. | |
Items | object[] |
The full item objects that were retrieved from Chroma. Includes the distances each item has from the embedding. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to query the item from. | new-collection | Yes | string |
Create Collection If Not Exists | If the collection does not exist, create it. | true | Yes | boolean |
Num Results | The maximum number of items to retrieve. | 10 | Yes | number |
Where | A JSON object representing Where filters to use to find the items to retrieve. | (empty) | Yes | object |
Where Document | A JSON object representing a Where document filter to use to find the items to retrieve. | (empty) | Yes | object |
Updates an existing item in a collection in Chroma.
Title | Data Type | Description | Default Value | Notes |
---|---|---|---|---|
Embedding | vector |
The embedding to set for the item to update in the collection in Chroma. | (required) | You can use the Get Embedding Node to get vector embeddings to store in Chroma. |
Additional inputs available with toggles in the editor.
Title | Data Type | Description | Notes |
---|---|---|---|
ID | string |
The ID of the item that was updated in Chroma. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to update the item in. | new-collection | Yes | string |
Create Collection If Not Exists | If the collection does not exist, create it. | true | Yes | boolean |
ID | The ID of the item to update. | (empty) | Yes (default true) | string |
Metadata | Additional key/value pairs to store with the item. | (empty) | Yes | object |
Creates a collection in Chroma.
See Editor Settings, all inputs are toggleable.
Title | Data Type | Description | Notes |
---|---|---|---|
Collection Name | string |
The name of the collection that was created. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to create. | new-collection | Yes | string |
Ignore If Exists | If the collection already exists, do not throw an error. | true | Yes | boolean |
Metadata | Additional key/value pairs to store with the collection. | (empty) | Yes | object |
Deletes a collection in Chroma.
See Editor Settings, all inputs are toggleable.
Title | Data Type | Description | Notes |
---|---|---|---|
Collection Name | string |
The name of the collection that was deleted. |
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Collection Name | The name of the collection to delete. | new-collection | Yes | string |
Lists all collections in Chroma.
This node has no inputs.
Title | Data Type | Description | Notes |
---|---|---|---|
Collection Names | string[] |
The names of the collections in Chroma. | |
Collections | object[] |
The full collection objects in Chroma. |
This node has no editor settings.
- Run
yarn dev
to start the compiler and bundler in watch mode. This will automatically recombine and rebundle your changes into thedist
folder. This will also copy the bundled files into the plugin install directory. - After each change, you must restart Rivet to see the changes.