@medyll/idae-chroma 0.55.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -70
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# Idae Chroma Client
|
|
2
|
-
|
|
3
|
-
Idae Chroma Client is a library designed to interact with ChromaDB, providing tools for managing collections, adding, updating, and querying entries, as well as monitoring directories for changes using file watchers.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **ChromaDB Integration**: Easily interact with ChromaDB for managing collections and querying data.
|
|
8
|
-
- **File Watchers**: Monitor directories for file changes (add, modify, delete) and automatically process them.
|
|
9
|
-
- **Customizable Watcher Options**: Configure file watchers with various options like ignored files, polling intervals, and more.
|
|
10
|
-
- **Metadata Management**: Add, update, and query entries with metadata support.
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
Install the package via npm:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install @medyll/idae-chroma
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
### Basic Example
|
|
23
|
-
|
|
24
|
-
Below is an example of how to use the Idae Chroma Client to initialize a database, add a watcher, and perform a search query.
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import { type ChromaQueryParams } from './lib/database/chromaClient.js';
|
|
28
|
-
import IdaeChroma, { ChromaDbConfig, WatcherOptions } from './lib/main.js';
|
|
29
|
-
|
|
30
|
-
// Configuration for ChromaDB
|
|
31
|
-
const chromaDbConfig: ChromaDbConfig = {
|
|
32
|
-
path: './chromadb'
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Options for the watcher
|
|
36
|
-
const watcherOptions: WatcherOptions = {
|
|
37
|
-
ignored: /(^|[\/\\])\../, // Ignore hidden files
|
|
38
|
-
persistent: true
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Main function
|
|
42
|
-
async function main() {
|
|
43
|
-
try {
|
|
44
|
-
// Initialize IdaeChroma
|
|
45
|
-
const idaeChroma = new IdaeChroma(chromaDbConfig);
|
|
46
|
-
|
|
47
|
-
// Add a watcher
|
|
48
|
-
await idaeChroma.addWatcher('./documents', watcherOptions);
|
|
49
|
-
|
|
50
|
-
// Load saved watchers
|
|
51
|
-
await idaeChroma.loadSavedWatchers();
|
|
52
|
-
|
|
53
|
-
// Example search query
|
|
54
|
-
const searchParams: ChromaQueryParams = {
|
|
55
|
-
queryTexts: 'example query',
|
|
56
|
-
nResults: 5,
|
|
57
|
-
where: { type: 'document' }
|
|
58
|
-
};
|
|
59
|
-
await idaeChroma.chromaClient.initCollection('test_collection');
|
|
60
|
-
const searchResults = await idaeChroma.chromaClient.queryCollection('test_collection', searchParams);
|
|
61
|
-
console.log(searchResults);
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error('Error:', error);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
main();
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
# Idae Chroma Client
|
|
2
|
+
|
|
3
|
+
Idae Chroma Client is a library designed to interact with ChromaDB, providing tools for managing collections, adding, updating, and querying entries, as well as monitoring directories for changes using file watchers.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **ChromaDB Integration**: Easily interact with ChromaDB for managing collections and querying data.
|
|
8
|
+
- **File Watchers**: Monitor directories for file changes (add, modify, delete) and automatically process them.
|
|
9
|
+
- **Customizable Watcher Options**: Configure file watchers with various options like ignored files, polling intervals, and more.
|
|
10
|
+
- **Metadata Management**: Add, update, and query entries with metadata support.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Install the package via npm:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @medyll/idae-chroma
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Basic Example
|
|
23
|
+
|
|
24
|
+
Below is an example of how to use the Idae Chroma Client to initialize a database, add a watcher, and perform a search query.
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import { type ChromaQueryParams } from './lib/database/chromaClient.js';
|
|
28
|
+
import IdaeChroma, { ChromaDbConfig, WatcherOptions } from './lib/main.js';
|
|
29
|
+
|
|
30
|
+
// Configuration for ChromaDB
|
|
31
|
+
const chromaDbConfig: ChromaDbConfig = {
|
|
32
|
+
path: './chromadb'
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Options for the watcher
|
|
36
|
+
const watcherOptions: WatcherOptions = {
|
|
37
|
+
ignored: /(^|[\/\\])\../, // Ignore hidden files
|
|
38
|
+
persistent: true
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Main function
|
|
42
|
+
async function main() {
|
|
43
|
+
try {
|
|
44
|
+
// Initialize IdaeChroma
|
|
45
|
+
const idaeChroma = new IdaeChroma(chromaDbConfig);
|
|
46
|
+
|
|
47
|
+
// Add a watcher
|
|
48
|
+
await idaeChroma.addWatcher('./documents', watcherOptions);
|
|
49
|
+
|
|
50
|
+
// Load saved watchers
|
|
51
|
+
await idaeChroma.loadSavedWatchers();
|
|
52
|
+
|
|
53
|
+
// Example search query
|
|
54
|
+
const searchParams: ChromaQueryParams = {
|
|
55
|
+
queryTexts: 'example query',
|
|
56
|
+
nResults: 5,
|
|
57
|
+
where: { type: 'document' }
|
|
58
|
+
};
|
|
59
|
+
await idaeChroma.chromaClient.initCollection('test_collection');
|
|
60
|
+
const searchResults = await idaeChroma.chromaClient.queryCollection('test_collection', searchParams);
|
|
61
|
+
console.log(searchResults);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Error:', error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
|