Skip to content

Commit

Permalink
feat(vector-stores)!: Chroma databases, tenants and global headers su…
Browse files Browse the repository at this point in the history
…pport (#211)

- tenants and databases support
- global headers (e.g. for authentication)
  • Loading branch information
davidmigloz committed Nov 12, 2023
1 parent bfb0d89 commit 5a1d839
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/modules/retrieval/vector_stores/integrations/chroma.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ docker pull chromadb/chroma
docker run -p 8000:8000 chromadb/chroma
```

By default, the Chroma client will connect to a server running on `http://localhost:8000`. To connect to a different server, pass the `host` parameter to the constructor.
By default, the Chroma client will connect to a server running on `http://localhost:8000`. To connect to a different server, pass the `baseUrl` parameter to the constructor.

```dart
final vectorStore = Chroma(
embeddings: OpenAIEmbeddings(apiKey: openaiApiKey),
host: 'http://localhost:8888',
baseUrl: 'http://localhost:8888',
);
```

Expand Down
16 changes: 11 additions & 5 deletions packages/langchain_chroma/lib/src/vector_stores/chroma.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ import 'models/models.dart';
/// ```
///
/// By default, the Chroma client will connect to a server running on
/// `http://localhost:8000`. To connect to a different server, pass the `host`
/// parameter to the constructor.
/// `http://localhost:8000`. To connect to a different server, pass the
/// `baseUrl` parameter to the constructor.
///
/// ```dart
/// final vectorStore = Chroma(
/// embeddings: OpenAIEmbeddings(apiKey: openaiApiKey),
/// host: 'http://localhost:8888',
/// baseUrl: 'http://localhost:8888',
/// );
/// ```
///
Expand Down Expand Up @@ -94,10 +94,16 @@ class Chroma extends VectorStore {
this.collectionName = 'langchain',
this.collectionMetadata,
required super.embeddings,
final String? host,
final String tenant = 'default_tenant',
final String database = 'default_database',
final String baseUrl = 'http://localhost:8000',
final Map<String, String> headers = const {},
final http.Client? client,
}) : _client = ChromaClient(
host: host ?? 'http://localhost:8000',
tenant: tenant,
database: database,
baseUrl: baseUrl,
headers: headers,
client: client,
);

Expand Down

0 comments on commit 5a1d839

Please sign in to comment.