1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pub
pub
pub
use Result;
use ;
/// Access a running Chroma server to store and retrieve data for embeddings.
///
/// This function creates a client for interacting with a Chroma server. It
/// supports authentication using tokens and can connect to a specified server
/// and database.
///
/// # Parameters
///
/// - `token`: An optional token for authentication.
/// - `server`: The URL of the Chroma server.
/// - `db`: The name of the database to connect to.
///
/// # Returns
///
/// A `Result` containing the `ChromaClient` or an error.
///
/// # Example
///
/// You can use the following Docker command to run a Chroma database:
///
/// ```bash
/// docker pull chromadb/chroma
/// # with auth using tokens and persistent storage:
/// docker run -p 8000:8000 -e chroma_server_auth_credentials_provider="chromadb.auth.token.tokenconfigserverauthcredentialsprovider" -e chroma_server_auth_provider="chromadb.auth.token.tokenauthserverprovider" -e chroma_server_auth_token_transport_header="$(sed -n 1p ~/.chroma_creds.txt)" -e chroma_server_auth_credentials="$(sed -n 2p ~/.chroma_creds.txt)" -v ~/chroma_storage/:/chroma/chroma chromadb/chroma
/// ```
pub async