llama-index-vector-stores-chroma 0.4.1__tar.gz → 0.4.2__tar.gz
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.
Potentially problematic release.
This version of llama-index-vector-stores-chroma might be problematic. Click here for more details.
- llama_index_vector_stores_chroma-0.4.2/.gitignore +153 -0
- llama_index_vector_stores_chroma-0.4.2/LICENSE +21 -0
- llama_index_vector_stores_chroma-0.4.2/PKG-INFO +13 -0
- {llama_index_vector_stores_chroma-0.4.1 → llama_index_vector_stores_chroma-0.4.2}/llama_index/vector_stores/chroma/base.py +17 -10
- llama_index_vector_stores_chroma-0.4.2/pyproject.toml +65 -0
- llama_index_vector_stores_chroma-0.4.1/PKG-INFO +0 -20
- llama_index_vector_stores_chroma-0.4.1/pyproject.toml +0 -63
- {llama_index_vector_stores_chroma-0.4.1 → llama_index_vector_stores_chroma-0.4.2}/README.md +0 -0
- {llama_index_vector_stores_chroma-0.4.1 → llama_index_vector_stores_chroma-0.4.2}/llama_index/py.typed +0 -0
- {llama_index_vector_stores_chroma-0.4.1 → llama_index_vector_stores_chroma-0.4.2}/llama_index/vector_stores/chroma/__init__.py +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
llama_index/_static
|
|
2
|
+
.DS_Store
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
bin/
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
etc/
|
|
21
|
+
include/
|
|
22
|
+
lib/
|
|
23
|
+
lib64/
|
|
24
|
+
parts/
|
|
25
|
+
sdist/
|
|
26
|
+
share/
|
|
27
|
+
var/
|
|
28
|
+
wheels/
|
|
29
|
+
pip-wheel-metadata/
|
|
30
|
+
share/python-wheels/
|
|
31
|
+
*.egg-info/
|
|
32
|
+
.installed.cfg
|
|
33
|
+
*.egg
|
|
34
|
+
MANIFEST
|
|
35
|
+
|
|
36
|
+
# PyInstaller
|
|
37
|
+
# Usually these files are written by a python script from a template
|
|
38
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
39
|
+
*.manifest
|
|
40
|
+
*.spec
|
|
41
|
+
|
|
42
|
+
# Installer logs
|
|
43
|
+
pip-log.txt
|
|
44
|
+
pip-delete-this-directory.txt
|
|
45
|
+
|
|
46
|
+
# Unit test / coverage reports
|
|
47
|
+
htmlcov/
|
|
48
|
+
.tox/
|
|
49
|
+
.nox/
|
|
50
|
+
.coverage
|
|
51
|
+
.coverage.*
|
|
52
|
+
.cache
|
|
53
|
+
nosetests.xml
|
|
54
|
+
coverage.xml
|
|
55
|
+
*.cover
|
|
56
|
+
*.py,cover
|
|
57
|
+
.hypothesis/
|
|
58
|
+
.pytest_cache/
|
|
59
|
+
.ruff_cache
|
|
60
|
+
|
|
61
|
+
# Translations
|
|
62
|
+
*.mo
|
|
63
|
+
*.pot
|
|
64
|
+
|
|
65
|
+
# Django stuff:
|
|
66
|
+
*.log
|
|
67
|
+
local_settings.py
|
|
68
|
+
db.sqlite3
|
|
69
|
+
db.sqlite3-journal
|
|
70
|
+
|
|
71
|
+
# Flask stuff:
|
|
72
|
+
instance/
|
|
73
|
+
.webassets-cache
|
|
74
|
+
|
|
75
|
+
# Scrapy stuff:
|
|
76
|
+
.scrapy
|
|
77
|
+
|
|
78
|
+
# Sphinx documentation
|
|
79
|
+
docs/_build/
|
|
80
|
+
|
|
81
|
+
# PyBuilder
|
|
82
|
+
target/
|
|
83
|
+
|
|
84
|
+
# Jupyter Notebook
|
|
85
|
+
.ipynb_checkpoints
|
|
86
|
+
notebooks/
|
|
87
|
+
|
|
88
|
+
# IPython
|
|
89
|
+
profile_default/
|
|
90
|
+
ipython_config.py
|
|
91
|
+
|
|
92
|
+
# pyenv
|
|
93
|
+
.python-version
|
|
94
|
+
|
|
95
|
+
# pipenv
|
|
96
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
97
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
98
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
99
|
+
# install all needed dependencies.
|
|
100
|
+
#Pipfile.lock
|
|
101
|
+
|
|
102
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
103
|
+
__pypackages__/
|
|
104
|
+
|
|
105
|
+
# Celery stuff
|
|
106
|
+
celerybeat-schedule
|
|
107
|
+
celerybeat.pid
|
|
108
|
+
|
|
109
|
+
# SageMath parsed files
|
|
110
|
+
*.sage.py
|
|
111
|
+
|
|
112
|
+
# Environments
|
|
113
|
+
.env
|
|
114
|
+
.venv
|
|
115
|
+
env/
|
|
116
|
+
venv/
|
|
117
|
+
ENV/
|
|
118
|
+
env.bak/
|
|
119
|
+
venv.bak/
|
|
120
|
+
pyvenv.cfg
|
|
121
|
+
|
|
122
|
+
# Spyder project settings
|
|
123
|
+
.spyderproject
|
|
124
|
+
.spyproject
|
|
125
|
+
|
|
126
|
+
# Rope project settings
|
|
127
|
+
.ropeproject
|
|
128
|
+
|
|
129
|
+
# mkdocs documentation
|
|
130
|
+
/site
|
|
131
|
+
|
|
132
|
+
# mypy
|
|
133
|
+
.mypy_cache/
|
|
134
|
+
.dmypy.json
|
|
135
|
+
dmypy.json
|
|
136
|
+
|
|
137
|
+
# Pyre type checker
|
|
138
|
+
.pyre/
|
|
139
|
+
|
|
140
|
+
# Jetbrains
|
|
141
|
+
.idea
|
|
142
|
+
modules/
|
|
143
|
+
*.swp
|
|
144
|
+
|
|
145
|
+
# VsCode
|
|
146
|
+
.vscode
|
|
147
|
+
|
|
148
|
+
# pipenv
|
|
149
|
+
Pipfile
|
|
150
|
+
Pipfile.lock
|
|
151
|
+
|
|
152
|
+
# pyright
|
|
153
|
+
pyrightconfig.json
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Jerry Liu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: llama-index-vector-stores-chroma
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: llama-index vector_stores chroma integration
|
|
5
|
+
Author-email: Your Name <you@example.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: <4.0,>=3.10
|
|
9
|
+
Requires-Dist: chromadb>=0.5.17
|
|
10
|
+
Requires-Dist: llama-index-core<0.13,>=0.12.0
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# LlamaIndex Vector_Stores Integration: Chroma
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import math
|
|
5
|
-
from typing import Any, Dict, Generator, List, Optional, cast
|
|
5
|
+
from typing import Any, Dict, Generator, List, Optional, Union, cast
|
|
6
6
|
|
|
7
7
|
import chromadb
|
|
8
8
|
from chromadb.api.models.Collection import Collection
|
|
@@ -95,7 +95,8 @@ MAX_CHUNK_SIZE = 41665 # One less than the max chunk size for ChromaDB
|
|
|
95
95
|
def chunk_list(
|
|
96
96
|
lst: List[BaseNode], max_chunk_size: int
|
|
97
97
|
) -> Generator[List[BaseNode], None, None]:
|
|
98
|
-
"""
|
|
98
|
+
"""
|
|
99
|
+
Yield successive max_chunk_size-sized chunks from lst.
|
|
99
100
|
|
|
100
101
|
Args:
|
|
101
102
|
lst (List[BaseNode]): list of nodes with embeddings
|
|
@@ -103,13 +104,15 @@ def chunk_list(
|
|
|
103
104
|
|
|
104
105
|
Yields:
|
|
105
106
|
Generator[List[BaseNode], None, None]: list of nodes with embeddings
|
|
107
|
+
|
|
106
108
|
"""
|
|
107
109
|
for i in range(0, len(lst), max_chunk_size):
|
|
108
110
|
yield lst[i : i + max_chunk_size]
|
|
109
111
|
|
|
110
112
|
|
|
111
113
|
class ChromaVectorStore(BasePydanticVectorStore):
|
|
112
|
-
"""
|
|
114
|
+
"""
|
|
115
|
+
Chroma vector store.
|
|
113
116
|
|
|
114
117
|
In this vector store, embeddings are stored within a ChromaDB collection.
|
|
115
118
|
|
|
@@ -142,7 +145,7 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
142
145
|
|
|
143
146
|
collection_name: Optional[str]
|
|
144
147
|
host: Optional[str]
|
|
145
|
-
port: Optional[str]
|
|
148
|
+
port: Optional[Union[str, int]]
|
|
146
149
|
ssl: bool
|
|
147
150
|
headers: Optional[Dict[str, str]]
|
|
148
151
|
persist_dir: Optional[str]
|
|
@@ -155,7 +158,7 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
155
158
|
chroma_collection: Optional[Any] = None,
|
|
156
159
|
collection_name: Optional[str] = None,
|
|
157
160
|
host: Optional[str] = None,
|
|
158
|
-
port: Optional[str] = None,
|
|
161
|
+
port: Optional[Union[str, int]] = None,
|
|
159
162
|
ssl: bool = False,
|
|
160
163
|
headers: Optional[Dict[str, str]] = None,
|
|
161
164
|
persist_dir: Optional[str] = None,
|
|
@@ -199,7 +202,7 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
199
202
|
cls,
|
|
200
203
|
collection_name: str,
|
|
201
204
|
host: Optional[str] = None,
|
|
202
|
-
port: Optional[str] = None,
|
|
205
|
+
port: Optional[Union[str, int]] = None,
|
|
203
206
|
ssl: bool = False,
|
|
204
207
|
headers: Optional[Dict[str, str]] = None,
|
|
205
208
|
persist_dir: Optional[str] = None,
|
|
@@ -240,7 +243,8 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
240
243
|
node_ids: Optional[List[str]],
|
|
241
244
|
filters: Optional[List[MetadataFilters]] = None,
|
|
242
245
|
) -> List[BaseNode]:
|
|
243
|
-
"""
|
|
246
|
+
"""
|
|
247
|
+
Get nodes from index.
|
|
244
248
|
|
|
245
249
|
Args:
|
|
246
250
|
node_ids (List[str]): list of node ids
|
|
@@ -262,7 +266,8 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
262
266
|
return result.nodes
|
|
263
267
|
|
|
264
268
|
def add(self, nodes: List[BaseNode], **add_kwargs: Any) -> List[str]:
|
|
265
|
-
"""
|
|
269
|
+
"""
|
|
270
|
+
Add nodes to index.
|
|
266
271
|
|
|
267
272
|
Args:
|
|
268
273
|
nodes: List[BaseNode]: list of nodes with embeddings
|
|
@@ -317,7 +322,8 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
317
322
|
node_ids: Optional[List[str]] = None,
|
|
318
323
|
filters: Optional[List[MetadataFilters]] = None,
|
|
319
324
|
) -> None:
|
|
320
|
-
"""
|
|
325
|
+
"""
|
|
326
|
+
Delete nodes from index.
|
|
321
327
|
|
|
322
328
|
Args:
|
|
323
329
|
node_ids (List[str]): list of node ids
|
|
@@ -347,7 +353,8 @@ class ChromaVectorStore(BasePydanticVectorStore):
|
|
|
347
353
|
return self._collection
|
|
348
354
|
|
|
349
355
|
def query(self, query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult:
|
|
350
|
-
"""
|
|
356
|
+
"""
|
|
357
|
+
Query index for top k most similar nodes.
|
|
351
358
|
|
|
352
359
|
Args:
|
|
353
360
|
query_embedding (List[float]): query embedding
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[dependency-groups]
|
|
6
|
+
dev = [
|
|
7
|
+
"ipython==8.10.0",
|
|
8
|
+
"jupyter>=1.0.0,<2",
|
|
9
|
+
"mypy==0.991",
|
|
10
|
+
"pre-commit==3.2.0",
|
|
11
|
+
"pylint==2.15.10",
|
|
12
|
+
"pytest==7.2.1",
|
|
13
|
+
"pytest-asyncio==0.21.0",
|
|
14
|
+
"pytest-mock==3.11.1",
|
|
15
|
+
"ruff==0.11.11",
|
|
16
|
+
"types-Deprecated>=0.1.0",
|
|
17
|
+
"types-PyYAML>=6.0.12.12,<7",
|
|
18
|
+
"types-protobuf>=4.24.0.4,<5",
|
|
19
|
+
"types-redis==4.5.5.0",
|
|
20
|
+
"types-requests==2.28.11.8",
|
|
21
|
+
"types-setuptools==67.1.0.0",
|
|
22
|
+
"black[jupyter]<=23.9.1,>=23.7.0",
|
|
23
|
+
"codespell[toml]>=v2.2.6",
|
|
24
|
+
"diff-cover>=9.2.0",
|
|
25
|
+
"pytest-cov>=6.1.1",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project]
|
|
29
|
+
name = "llama-index-vector-stores-chroma"
|
|
30
|
+
version = "0.4.2"
|
|
31
|
+
description = "llama-index vector_stores chroma integration"
|
|
32
|
+
authors = [{name = "Your Name", email = "you@example.com"}]
|
|
33
|
+
requires-python = ">=3.10,<4.0"
|
|
34
|
+
readme = "README.md"
|
|
35
|
+
license = "MIT"
|
|
36
|
+
dependencies = [
|
|
37
|
+
"chromadb>=0.5.17",
|
|
38
|
+
"llama-index-core>=0.12.0,<0.13",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.codespell]
|
|
42
|
+
check-filenames = true
|
|
43
|
+
check-hidden = true
|
|
44
|
+
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.sdist]
|
|
47
|
+
include = ["llama_index/"]
|
|
48
|
+
exclude = ["**/BUILD"]
|
|
49
|
+
|
|
50
|
+
[tool.hatch.build.targets.wheel]
|
|
51
|
+
include = ["llama_index/"]
|
|
52
|
+
exclude = ["**/BUILD"]
|
|
53
|
+
|
|
54
|
+
[tool.llamahub]
|
|
55
|
+
contains_example = false
|
|
56
|
+
import_path = "llama_index.vector_stores.chroma"
|
|
57
|
+
|
|
58
|
+
[tool.llamahub.class_authors]
|
|
59
|
+
ChromaVectorStore = "llama-index"
|
|
60
|
+
|
|
61
|
+
[tool.mypy]
|
|
62
|
+
disallow_untyped_defs = true
|
|
63
|
+
exclude = ["_static", "build", "examples", "notebooks", "venv"]
|
|
64
|
+
ignore_missing_imports = true
|
|
65
|
+
python_version = "3.8"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: llama-index-vector-stores-chroma
|
|
3
|
-
Version: 0.4.1
|
|
4
|
-
Summary: llama-index vector_stores chroma integration
|
|
5
|
-
License: MIT
|
|
6
|
-
Author: Your Name
|
|
7
|
-
Author-email: you@example.com
|
|
8
|
-
Requires-Python: >=3.9,<4.0
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Requires-Dist: chromadb (>=0.5.17)
|
|
16
|
-
Requires-Dist: llama-index-core (>=0.12.0,<0.13.0)
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
|
|
19
|
-
# LlamaIndex Vector_Stores Integration: Chroma
|
|
20
|
-
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
build-backend = "poetry.core.masonry.api"
|
|
3
|
-
requires = ["poetry-core"]
|
|
4
|
-
|
|
5
|
-
[tool.codespell]
|
|
6
|
-
check-filenames = true
|
|
7
|
-
check-hidden = true
|
|
8
|
-
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
|
|
9
|
-
|
|
10
|
-
[tool.llamahub]
|
|
11
|
-
contains_example = false
|
|
12
|
-
import_path = "llama_index.vector_stores.chroma"
|
|
13
|
-
|
|
14
|
-
[tool.llamahub.class_authors]
|
|
15
|
-
ChromaVectorStore = "llama-index"
|
|
16
|
-
|
|
17
|
-
[tool.mypy]
|
|
18
|
-
disallow_untyped_defs = true
|
|
19
|
-
exclude = ["_static", "build", "examples", "notebooks", "venv"]
|
|
20
|
-
ignore_missing_imports = true
|
|
21
|
-
python_version = "3.8"
|
|
22
|
-
|
|
23
|
-
[tool.poetry]
|
|
24
|
-
authors = ["Your Name <you@example.com>"]
|
|
25
|
-
description = "llama-index vector_stores chroma integration"
|
|
26
|
-
exclude = ["**/BUILD"]
|
|
27
|
-
license = "MIT"
|
|
28
|
-
name = "llama-index-vector-stores-chroma"
|
|
29
|
-
readme = "README.md"
|
|
30
|
-
version = "0.4.1"
|
|
31
|
-
|
|
32
|
-
[tool.poetry.dependencies]
|
|
33
|
-
python = ">=3.9,<4.0"
|
|
34
|
-
chromadb = ">=0.5.17"
|
|
35
|
-
llama-index-core = "^0.12.0"
|
|
36
|
-
|
|
37
|
-
[tool.poetry.group.dev.dependencies]
|
|
38
|
-
ipython = "8.10.0"
|
|
39
|
-
jupyter = "^1.0.0"
|
|
40
|
-
mypy = "0.991"
|
|
41
|
-
pre-commit = "3.2.0"
|
|
42
|
-
pylint = "2.15.10"
|
|
43
|
-
pytest = "7.2.1"
|
|
44
|
-
pytest-mock = "3.11.1"
|
|
45
|
-
ruff = "0.0.292"
|
|
46
|
-
tree-sitter-languages = "^1.8.0"
|
|
47
|
-
types-Deprecated = ">=0.1.0"
|
|
48
|
-
types-PyYAML = "^6.0.12.12"
|
|
49
|
-
types-protobuf = "^4.24.0.4"
|
|
50
|
-
types-redis = "4.5.5.0"
|
|
51
|
-
types-requests = "2.28.11.8"
|
|
52
|
-
types-setuptools = "67.1.0.0"
|
|
53
|
-
|
|
54
|
-
[tool.poetry.group.dev.dependencies.black]
|
|
55
|
-
extras = ["jupyter"]
|
|
56
|
-
version = "<=23.9.1,>=23.7.0"
|
|
57
|
-
|
|
58
|
-
[tool.poetry.group.dev.dependencies.codespell]
|
|
59
|
-
extras = ["toml"]
|
|
60
|
-
version = ">=v2.2.6"
|
|
61
|
-
|
|
62
|
-
[[tool.poetry.packages]]
|
|
63
|
-
include = "llama_index/"
|
|
File without changes
|
|
File without changes
|