chromadb 2.4.6 → 3.0.1-alpha.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/LICENSE +1 -1
- package/README.md +24 -79
- package/dist/chromadb.d.ts +838 -1939
- package/dist/chromadb.legacy-esm.js +1982 -12681
- package/dist/chromadb.mjs +1982 -12681
- package/dist/chromadb.mjs.map +1 -1
- package/dist/chunk-NSSMTXJJ.mjs +8 -0
- package/dist/cjs/chromadb.cjs +2017 -12720
- package/dist/cjs/chromadb.cjs.map +1 -1
- package/dist/cjs/chromadb.d.cts +838 -1939
- package/dist/cjs/cli.cjs +15 -12
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cli.mjs +16 -13
- package/dist/cli.mjs.map +1 -1
- package/package.json +44 -23
- package/src/admin-client.ts +166 -0
- package/src/api/client.gen.ts +19 -0
- package/src/api/index.ts +3 -0
- package/src/api/sdk.gen.ts +326 -0
- package/src/api/types.gen.ts +1267 -0
- package/src/bindings.ts +16 -12
- package/src/chroma-client.ts +461 -0
- package/src/chroma-fetch.ts +72 -0
- package/src/cloud-client.ts +85 -0
- package/src/collection-configuration.ts +140 -0
- package/src/collection.ts +771 -0
- package/src/deno.ts +32 -0
- package/src/embedding-function.ts +207 -0
- package/src/errors.ts +104 -0
- package/src/index.ts +15 -2
- package/src/next.ts +26 -0
- package/src/types.ts +304 -0
- package/src/utils.ts +530 -0
- package/dist/chunk-MJPHVYKR.mjs +0 -31
- package/src/browser-entry.js +0 -3
- package/src/punycode-shim.js +0 -8
- /package/dist/{chunk-MJPHVYKR.mjs.map → chunk-NSSMTXJJ.mjs.map} +0 -0
package/LICENSE
CHANGED
|
@@ -198,4 +198,4 @@
|
|
|
198
198
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
200
|
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,98 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
## chromadb
|
|
2
2
|
|
|
3
3
|
Chroma is the open-source embedding database. Chroma makes it easy to build LLM apps by making knowledge, facts, and skills pluggable for LLMs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package gives you a JS/TS interface to talk to a backend Chroma DB over REST.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[Learn more about Chroma](https://github.com/chroma-core/chroma)
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# npm
|
|
18
|
-
npm install chromadb
|
|
19
|
-
|
|
20
|
-
# pnpm
|
|
21
|
-
pnpm add chromadb
|
|
9
|
+
- [💬 Community Discord](https://discord.gg/MMeYNTmh3x)
|
|
10
|
+
- [📖 Documentation](https://docs.trychroma.com/)
|
|
11
|
+
- [💡 Colab Example](https://colab.research.google.com/drive/1QEzFyqnoFxq7LUGyP1vzR4iLt9PpCDXv?usp=sharing)
|
|
12
|
+
- [🏠 Homepage](https://www.trychroma.com/)
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
yarn add chromadb
|
|
25
|
-
```
|
|
14
|
+
## Getting started
|
|
26
15
|
|
|
27
|
-
|
|
16
|
+
Chroma needs to be running in order for this client to talk to it. Please see the [🧪 Usage Guide](https://docs.trychroma.com/guides) to learn how to quickly stand this up.
|
|
28
17
|
|
|
29
|
-
|
|
18
|
+
## Small example
|
|
30
19
|
|
|
31
20
|
```js
|
|
32
21
|
import { ChromaClient } from "chromadb";
|
|
33
|
-
|
|
34
|
-
// Initialize the client
|
|
35
22
|
const chroma = new ChromaClient({ path: "http://localhost:8000" });
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
],
|
|
47
|
-
metadatas: [{ source: "doc1" }, { source: "doc2" }],
|
|
48
|
-
documents: ["Document 1 content", "Document 2 content"],
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Query the collection
|
|
52
|
-
const results = await collection.query({
|
|
53
|
-
queryEmbeddings: [1.1, 2.3, 3.2],
|
|
54
|
-
nResults: 2,
|
|
23
|
+
const collection = await chroma.createCollection({ name: "test-from-js" });
|
|
24
|
+
for (let i = 0; i < 20; i++) {
|
|
25
|
+
await collection.add({
|
|
26
|
+
ids: ["test-id-" + i.toString()],
|
|
27
|
+
embeddings: [[1, 2, 3, 4, 5]],
|
|
28
|
+
documents: ["test"],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const queryData = await collection.query({
|
|
32
|
+
queryEmbeddings: [[1, 2, 3, 4, 5]],
|
|
33
|
+
queryTexts: ["test"],
|
|
55
34
|
});
|
|
56
35
|
```
|
|
57
36
|
|
|
58
|
-
##
|
|
59
|
-
|
|
60
|
-
This package includes all embedding libraries as bundled dependencies, so you can use them directly:
|
|
61
|
-
|
|
62
|
-
```js
|
|
63
|
-
import { ChromaClient, OpenAIEmbeddingFunction } from "chromadb";
|
|
37
|
+
## Local development
|
|
64
38
|
|
|
65
|
-
|
|
66
|
-
openai_api_key: "your-api-key",
|
|
67
|
-
model_name: "text-embedding-ada-002",
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const chroma = new ChromaClient({ path: "http://localhost:8000" });
|
|
71
|
-
const collection = await chroma.createCollection({
|
|
72
|
-
name: "my-collection",
|
|
73
|
-
embeddingFunction: embedder,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Now you can add documents without providing embeddings
|
|
77
|
-
await collection.add({
|
|
78
|
-
ids: ["id1"],
|
|
79
|
-
documents: ["Document content"],
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// And query with text
|
|
83
|
-
const results = await collection.query({
|
|
84
|
-
queryTexts: ["similar document"],
|
|
85
|
-
nResults: 2,
|
|
86
|
-
});
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Additional Resources
|
|
90
|
-
|
|
91
|
-
- [📖 Documentation](https://docs.trychroma.com/)
|
|
92
|
-
- [💬 Community Discord](https://discord.gg/MMeYNTmh3x)
|
|
93
|
-
- [🏠 Homepage](https://www.trychroma.com/)
|
|
94
|
-
- [GitHub Repository](https://github.com/chroma-core/chroma)
|
|
39
|
+
[View the Development Readme](./DEVELOP.md)
|
|
95
40
|
|
|
96
41
|
## License
|
|
97
42
|
|
|
98
|
-
Apache 2.0
|
|
43
|
+
Apache 2.0
|