sie-chroma 0.1.7__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.
- sie_chroma-0.1.7/.gitignore +256 -0
- sie_chroma-0.1.7/PKG-INFO +138 -0
- sie_chroma-0.1.7/README.md +126 -0
- sie_chroma-0.1.7/pyproject.toml +31 -0
- sie_chroma-0.1.7/src/sie_chroma/__init__.py +45 -0
- sie_chroma-0.1.7/src/sie_chroma/embedding_function.py +229 -0
- sie_chroma-0.1.7/tests/__init__.py +0 -0
- sie_chroma-0.1.7/tests/conftest.py +116 -0
- sie_chroma-0.1.7/tests/test_embedding_function.py +253 -0
- sie_chroma-0.1.7/tests/test_integration.py +282 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.venv
|
|
140
|
+
env/
|
|
141
|
+
venv/
|
|
142
|
+
ENV/
|
|
143
|
+
env.bak/
|
|
144
|
+
venv.bak/
|
|
145
|
+
|
|
146
|
+
# Spyder project settings
|
|
147
|
+
.spyderproject
|
|
148
|
+
.spyproject
|
|
149
|
+
|
|
150
|
+
# Rope project settings
|
|
151
|
+
.ropeproject
|
|
152
|
+
|
|
153
|
+
# mkdocs documentation
|
|
154
|
+
/site
|
|
155
|
+
|
|
156
|
+
# Pyre type checker
|
|
157
|
+
.pyre/
|
|
158
|
+
|
|
159
|
+
# pytype static type analyzer
|
|
160
|
+
.pytype/
|
|
161
|
+
|
|
162
|
+
# Cython debug symbols
|
|
163
|
+
cython_debug/
|
|
164
|
+
|
|
165
|
+
# PyCharm
|
|
166
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
167
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
168
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
169
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
170
|
+
#.idea/
|
|
171
|
+
|
|
172
|
+
# Abstra
|
|
173
|
+
# Abstra is an AI-powered process automation framework.
|
|
174
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
175
|
+
# Learn more at https://abstra.io/docs
|
|
176
|
+
.abstra/
|
|
177
|
+
|
|
178
|
+
# Visual Studio Code
|
|
179
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
180
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
181
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
182
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
183
|
+
# .vscode/
|
|
184
|
+
|
|
185
|
+
# Ruff stuff:
|
|
186
|
+
.ruff_cache/
|
|
187
|
+
|
|
188
|
+
# PyPI configuration file
|
|
189
|
+
.pypirc
|
|
190
|
+
|
|
191
|
+
# Cursor
|
|
192
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
193
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
194
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
195
|
+
.cursorignore
|
|
196
|
+
.cursorindexingignore
|
|
197
|
+
|
|
198
|
+
# vcscode
|
|
199
|
+
.vscode
|
|
200
|
+
|
|
201
|
+
# Marimo
|
|
202
|
+
marimo/_static/
|
|
203
|
+
marimo/_lsp/
|
|
204
|
+
__marimo__/
|
|
205
|
+
|
|
206
|
+
# SIE specific
|
|
207
|
+
# Model weights cache
|
|
208
|
+
.cache/
|
|
209
|
+
*.safetensors
|
|
210
|
+
*.bin
|
|
211
|
+
|
|
212
|
+
# Secrets (never commit)
|
|
213
|
+
*.pem
|
|
214
|
+
*.key
|
|
215
|
+
credentials.json
|
|
216
|
+
*-key.json
|
|
217
|
+
|
|
218
|
+
# Terraform
|
|
219
|
+
# Local .terraform directories (cached providers/modules)
|
|
220
|
+
**/.terraform/*
|
|
221
|
+
.terraform.lock*
|
|
222
|
+
# State files (contain sensitive data)
|
|
223
|
+
*.tfstate
|
|
224
|
+
*.tfstate.*
|
|
225
|
+
# Crash log files
|
|
226
|
+
crash.log
|
|
227
|
+
crash.*.log
|
|
228
|
+
# Override files (local developer overrides)
|
|
229
|
+
override.tf
|
|
230
|
+
override.tf.json
|
|
231
|
+
*_override.tf
|
|
232
|
+
*_override.tf.json
|
|
233
|
+
# tfvars files may contain secrets
|
|
234
|
+
*.tfvars
|
|
235
|
+
*.tfvars.json
|
|
236
|
+
# Keep .terraform.lock.hcl for reproducibility (provider versions)
|
|
237
|
+
|
|
238
|
+
# Node.js
|
|
239
|
+
node_modules/
|
|
240
|
+
|
|
241
|
+
# OS
|
|
242
|
+
.DS_Store
|
|
243
|
+
Thumbs.db
|
|
244
|
+
|
|
245
|
+
# VIM
|
|
246
|
+
*.swp
|
|
247
|
+
|
|
248
|
+
# Worktree metadata
|
|
249
|
+
.base-branch
|
|
250
|
+
|
|
251
|
+
# Temporary files
|
|
252
|
+
tmp/
|
|
253
|
+
.tmp/
|
|
254
|
+
.local/
|
|
255
|
+
|
|
256
|
+
.requirements-modal.txt
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sie-chroma
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: SIE integration for ChromaDB
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: chromadb>=0.4
|
|
7
|
+
Requires-Dist: sie-sdk>=0.1.0
|
|
8
|
+
Provides-Extra: dev
|
|
9
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
10
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# sie-chroma
|
|
14
|
+
|
|
15
|
+
SIE integration for [ChromaDB](https://www.trychroma.com/).
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install sie-chroma
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **SIEEmbeddingFunction**: Custom embedding function for ChromaDB collections
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### Basic Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import chromadb
|
|
33
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
34
|
+
|
|
35
|
+
# Create SIE embedding function
|
|
36
|
+
embedding_function = SIEEmbeddingFunction(
|
|
37
|
+
base_url="http://localhost:8080",
|
|
38
|
+
model="BAAI/bge-m3",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Create ChromaDB client and collection
|
|
42
|
+
client = chromadb.Client()
|
|
43
|
+
collection = client.create_collection(
|
|
44
|
+
name="my_collection",
|
|
45
|
+
embedding_function=embedding_function,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# Add documents (embeddings are generated automatically)
|
|
49
|
+
collection.add(
|
|
50
|
+
documents=[
|
|
51
|
+
"Machine learning enables pattern recognition.",
|
|
52
|
+
"Deep learning uses neural networks.",
|
|
53
|
+
"Natural language processing analyzes text.",
|
|
54
|
+
],
|
|
55
|
+
ids=["doc1", "doc2", "doc3"],
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Query the collection
|
|
59
|
+
results = collection.query(
|
|
60
|
+
query_texts=["What is deep learning?"],
|
|
61
|
+
n_results=2,
|
|
62
|
+
)
|
|
63
|
+
print(results["documents"])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### With Persistent Storage
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import chromadb
|
|
70
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
71
|
+
|
|
72
|
+
# Persistent client
|
|
73
|
+
client = chromadb.PersistentClient(path="./chroma_data")
|
|
74
|
+
|
|
75
|
+
embedding_function = SIEEmbeddingFunction(
|
|
76
|
+
base_url="http://localhost:8080",
|
|
77
|
+
model="BAAI/bge-m3",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Get or create collection
|
|
81
|
+
collection = client.get_or_create_collection(
|
|
82
|
+
name="research_papers",
|
|
83
|
+
embedding_function=embedding_function,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Add documents with metadata
|
|
87
|
+
collection.add(
|
|
88
|
+
documents=["Paper about transformers...", "Study on attention mechanisms..."],
|
|
89
|
+
metadatas=[{"year": 2023}, {"year": 2024}],
|
|
90
|
+
ids=["paper1", "paper2"],
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# Query with metadata filtering
|
|
94
|
+
results = collection.query(
|
|
95
|
+
query_texts=["attention in neural networks"],
|
|
96
|
+
n_results=5,
|
|
97
|
+
where={"year": {"$gte": 2023}},
|
|
98
|
+
)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### With LangChain or LlamaIndex
|
|
102
|
+
|
|
103
|
+
The SIEEmbeddingFunction works with ChromaDB's LangChain and LlamaIndex integrations:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# LangChain
|
|
107
|
+
from langchain_chroma import Chroma
|
|
108
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
109
|
+
|
|
110
|
+
embedding_function = SIEEmbeddingFunction(model="BAAI/bge-m3")
|
|
111
|
+
vectorstore = Chroma(
|
|
112
|
+
collection_name="docs",
|
|
113
|
+
embedding_function=embedding_function, # Works directly!
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# LlamaIndex
|
|
117
|
+
from llama_index.vector_stores.chroma import ChromaVectorStore
|
|
118
|
+
|
|
119
|
+
# SIE can also be used via LlamaIndex's SIEEmbedding
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## SIE Server
|
|
123
|
+
|
|
124
|
+
Start the SIE server before using this integration:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
mise run serve -d cpu -p 8080
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Testing
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Unit tests (no server required)
|
|
134
|
+
pytest
|
|
135
|
+
|
|
136
|
+
# Integration tests (requires running server)
|
|
137
|
+
pytest -m integration
|
|
138
|
+
```
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# sie-chroma
|
|
2
|
+
|
|
3
|
+
SIE integration for [ChromaDB](https://www.trychroma.com/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install sie-chroma
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **SIEEmbeddingFunction**: Custom embedding function for ChromaDB collections
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import chromadb
|
|
21
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
22
|
+
|
|
23
|
+
# Create SIE embedding function
|
|
24
|
+
embedding_function = SIEEmbeddingFunction(
|
|
25
|
+
base_url="http://localhost:8080",
|
|
26
|
+
model="BAAI/bge-m3",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Create ChromaDB client and collection
|
|
30
|
+
client = chromadb.Client()
|
|
31
|
+
collection = client.create_collection(
|
|
32
|
+
name="my_collection",
|
|
33
|
+
embedding_function=embedding_function,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Add documents (embeddings are generated automatically)
|
|
37
|
+
collection.add(
|
|
38
|
+
documents=[
|
|
39
|
+
"Machine learning enables pattern recognition.",
|
|
40
|
+
"Deep learning uses neural networks.",
|
|
41
|
+
"Natural language processing analyzes text.",
|
|
42
|
+
],
|
|
43
|
+
ids=["doc1", "doc2", "doc3"],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Query the collection
|
|
47
|
+
results = collection.query(
|
|
48
|
+
query_texts=["What is deep learning?"],
|
|
49
|
+
n_results=2,
|
|
50
|
+
)
|
|
51
|
+
print(results["documents"])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### With Persistent Storage
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import chromadb
|
|
58
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
59
|
+
|
|
60
|
+
# Persistent client
|
|
61
|
+
client = chromadb.PersistentClient(path="./chroma_data")
|
|
62
|
+
|
|
63
|
+
embedding_function = SIEEmbeddingFunction(
|
|
64
|
+
base_url="http://localhost:8080",
|
|
65
|
+
model="BAAI/bge-m3",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Get or create collection
|
|
69
|
+
collection = client.get_or_create_collection(
|
|
70
|
+
name="research_papers",
|
|
71
|
+
embedding_function=embedding_function,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Add documents with metadata
|
|
75
|
+
collection.add(
|
|
76
|
+
documents=["Paper about transformers...", "Study on attention mechanisms..."],
|
|
77
|
+
metadatas=[{"year": 2023}, {"year": 2024}],
|
|
78
|
+
ids=["paper1", "paper2"],
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Query with metadata filtering
|
|
82
|
+
results = collection.query(
|
|
83
|
+
query_texts=["attention in neural networks"],
|
|
84
|
+
n_results=5,
|
|
85
|
+
where={"year": {"$gte": 2023}},
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### With LangChain or LlamaIndex
|
|
90
|
+
|
|
91
|
+
The SIEEmbeddingFunction works with ChromaDB's LangChain and LlamaIndex integrations:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
# LangChain
|
|
95
|
+
from langchain_chroma import Chroma
|
|
96
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
97
|
+
|
|
98
|
+
embedding_function = SIEEmbeddingFunction(model="BAAI/bge-m3")
|
|
99
|
+
vectorstore = Chroma(
|
|
100
|
+
collection_name="docs",
|
|
101
|
+
embedding_function=embedding_function, # Works directly!
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# LlamaIndex
|
|
105
|
+
from llama_index.vector_stores.chroma import ChromaVectorStore
|
|
106
|
+
|
|
107
|
+
# SIE can also be used via LlamaIndex's SIEEmbedding
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## SIE Server
|
|
111
|
+
|
|
112
|
+
Start the SIE server before using this integration:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
mise run serve -d cpu -p 8080
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Testing
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Unit tests (no server required)
|
|
122
|
+
pytest
|
|
123
|
+
|
|
124
|
+
# Integration tests (requires running server)
|
|
125
|
+
pytest -m integration
|
|
126
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sie-chroma"
|
|
3
|
+
version = "0.1.7"
|
|
4
|
+
description = "SIE integration for ChromaDB"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"sie-sdk>=0.1.0",
|
|
9
|
+
"chromadb>=0.4",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[project.optional-dependencies]
|
|
13
|
+
dev = [
|
|
14
|
+
"pytest>=8.0",
|
|
15
|
+
"pytest-asyncio>=0.24",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["hatchling"]
|
|
20
|
+
build-backend = "hatchling.build"
|
|
21
|
+
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["src/sie_chroma"]
|
|
24
|
+
|
|
25
|
+
[tool.pytest.ini_options]
|
|
26
|
+
testpaths = ["tests"]
|
|
27
|
+
asyncio_mode = "auto"
|
|
28
|
+
markers = [
|
|
29
|
+
"integration: marks tests as integration tests (require running SIE server)",
|
|
30
|
+
]
|
|
31
|
+
addopts = "-v --tb=short -m 'not integration'"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""SIE integration for ChromaDB.
|
|
2
|
+
|
|
3
|
+
This package provides embedding functions for ChromaDB:
|
|
4
|
+
|
|
5
|
+
- SIEEmbeddingFunction: Dense embeddings for standard ChromaDB collections
|
|
6
|
+
- SIESparseEmbeddingFunction: Sparse embeddings for Chroma Cloud hybrid search
|
|
7
|
+
|
|
8
|
+
Example usage (dense):
|
|
9
|
+
|
|
10
|
+
import chromadb
|
|
11
|
+
from sie_chroma import SIEEmbeddingFunction
|
|
12
|
+
|
|
13
|
+
embedding_function = SIEEmbeddingFunction(
|
|
14
|
+
base_url="http://localhost:8080",
|
|
15
|
+
model="BAAI/bge-m3",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
client = chromadb.Client()
|
|
19
|
+
collection = client.create_collection(
|
|
20
|
+
name="my_collection",
|
|
21
|
+
embedding_function=embedding_function,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
collection.add(
|
|
25
|
+
documents=["doc1", "doc2"],
|
|
26
|
+
ids=["id1", "id2"],
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
Example usage (sparse for hybrid search with Chroma Cloud):
|
|
30
|
+
|
|
31
|
+
from sie_chroma import SIESparseEmbeddingFunction
|
|
32
|
+
|
|
33
|
+
sparse_ef = SIESparseEmbeddingFunction(
|
|
34
|
+
base_url="http://localhost:8080",
|
|
35
|
+
model="BAAI/bge-m3",
|
|
36
|
+
)
|
|
37
|
+
# Use with SparseVectorIndexConfig for hybrid search
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from sie_chroma.embedding_function import SIEEmbeddingFunction, SIESparseEmbeddingFunction
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"SIEEmbeddingFunction",
|
|
44
|
+
"SIESparseEmbeddingFunction",
|
|
45
|
+
]
|