ovos-qdrant-embeddings-plugin 0.0.1a7__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.
- ovos_qdrant_embeddings_plugin-0.0.1a7/LICENSE +21 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/PKG-INFO +148 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/README.md +127 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings/__init__.py +618 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings/version.py +9 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings_plugin.egg-info/PKG-INFO +148 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings_plugin.egg-info/SOURCES.txt +13 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings_plugin.egg-info/dependency_links.txt +1 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings_plugin.egg-info/entry_points.txt +2 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings_plugin.egg-info/requires.txt +8 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/ovos_qdrant_embeddings_plugin.egg-info/top_level.txt +1 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/pyproject.toml +37 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/setup.cfg +4 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/test/test_e2e.py +133 -0
- ovos_qdrant_embeddings_plugin-0.0.1a7/test/test_qdrant.py +187 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OpenVoiceOS
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ovos-qdrant-embeddings-plugin
|
|
3
|
+
Version: 0.0.1a7
|
|
4
|
+
Summary: A qdrant embeddings plugin for OVOS
|
|
5
|
+
Author-email: jarbasai <jarbasai@mailfence.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/OpenVoiceOS/ovos-qdrant-embeddings-plugin
|
|
8
|
+
Project-URL: Repository, https://github.com/OpenVoiceOS/ovos-qdrant-embeddings-plugin
|
|
9
|
+
Keywords: OVOS,openvoiceos,plugin,qdrant,embeddings
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: ovos-plugin-manager<3.0.0,>=2.1.0
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: qdrant-client
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: pytest; extra == "test"
|
|
18
|
+
Requires-Dist: numpy; extra == "test"
|
|
19
|
+
Requires-Dist: qdrant-client; extra == "test"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
[](https://deepwiki.com/OpenVoiceOS/ovos-qdrant-embeddings-plugin)
|
|
23
|
+
|
|
24
|
+
# ovos-qdrant-embeddings-plugin
|
|
25
|
+
|
|
26
|
+
Qdrant-backed `EmbeddingsDB` vector store plugin for [OpenVoiceOS](https://openvoiceos.org).
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install ovos-qdrant-embeddings-plugin
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## What is EmbeddingsDB?
|
|
35
|
+
|
|
36
|
+
`EmbeddingsDB` is the abstract vector-store interface defined by
|
|
37
|
+
[ovos-plugin-manager](https://github.com/OpenVoiceOS/ovos_plugin_manager) (`opm.embeddings`).
|
|
38
|
+
It provides a uniform API for storing, retrieving, and nearest-neighbour querying of embedding
|
|
39
|
+
vectors regardless of the backend.
|
|
40
|
+
|
|
41
|
+
OVOS components that need semantic search (e.g. memory, skills, pipelines) discover the active
|
|
42
|
+
backend via the OPM entry-point group `opm.embeddings`. This plugin registers itself as:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
opm.embeddings = ovos-qdrant-embeddings-plugin
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
It pairs naturally with embedding producers such as
|
|
49
|
+
[ovos-gguf-plugin](https://github.com/OpenVoiceOS/ovos-gguf-plugin) that generate the vectors
|
|
50
|
+
you store here.
|
|
51
|
+
|
|
52
|
+
## Quickstart — in-memory DB
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import numpy as np
|
|
56
|
+
from ovos_qdrant_embeddings import QdrantEmbeddingsDB
|
|
57
|
+
|
|
58
|
+
# In-memory: no host, no path — perfect for development and CI
|
|
59
|
+
db = QdrantEmbeddingsDB(config={"vector_size": 4})
|
|
60
|
+
|
|
61
|
+
# Store vectors
|
|
62
|
+
db.add_embeddings("apple", np.array([1.0, 0.0, 0.0, 0.0]))
|
|
63
|
+
db.add_embeddings("banana", np.array([0.0, 1.0, 0.0, 0.0]))
|
|
64
|
+
db.add_embeddings("cherry", np.array([0.0, 0.0, 1.0, 0.0]))
|
|
65
|
+
|
|
66
|
+
# Nearest-neighbour query — returns [(key, score), ...]
|
|
67
|
+
results = db.query(np.array([0.9, 0.1, 0.0, 0.0]), top_k=2)
|
|
68
|
+
print(results) # [('apple', 0.999...), ('banana', 0.099...)]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
| Key | Default | Description |
|
|
74
|
+
|-----|---------|-------------|
|
|
75
|
+
| `vector_size` | **required** | Dimension of the embedding vectors. Must match your embedding model. |
|
|
76
|
+
| `distance_metric` | `"cosine"` | Similarity function: `"cosine"`, `"euclidean"`, or `"dot"`. |
|
|
77
|
+
| `default_collection_name` | `"embeddings"` | Collection created on startup and used when no collection is specified. |
|
|
78
|
+
| `host` | — | Remote Qdrant host (activates HTTP client mode). |
|
|
79
|
+
| `port` | `6333` | HTTP port for remote client. |
|
|
80
|
+
| `grpc_port` | `6334` | gRPC port for remote client. |
|
|
81
|
+
| `api_key` | — | API key for Qdrant Cloud or authenticated remote instances. |
|
|
82
|
+
| `path` | — | Filesystem path for local persistent storage (activates file-backed mode). |
|
|
83
|
+
|
|
84
|
+
### Three client modes
|
|
85
|
+
|
|
86
|
+
**In-memory** (development / CI) — neither `host` nor `path` set:
|
|
87
|
+
```python
|
|
88
|
+
config = {"vector_size": 384}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Local persistent** — data survives restarts:
|
|
92
|
+
```python
|
|
93
|
+
config = {"path": "/var/lib/ovos/qdrant", "vector_size": 384}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Remote** — connects to a running Qdrant server or Qdrant Cloud:
|
|
97
|
+
```python
|
|
98
|
+
config = {
|
|
99
|
+
"host": "my-qdrant.example.com",
|
|
100
|
+
"port": 6333,
|
|
101
|
+
"api_key": "my-secret-key",
|
|
102
|
+
"vector_size": 384,
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## When to choose Qdrant over ChromaDB
|
|
107
|
+
|
|
108
|
+
- You need to run the vector store as a **separate network service** (microservice / homelab).
|
|
109
|
+
- Your collection grows to **millions of vectors** — Qdrant's HNSW index scales well.
|
|
110
|
+
- You want **Qdrant Cloud** managed hosting.
|
|
111
|
+
- You need **gRPC** for high-throughput batch ingestion.
|
|
112
|
+
|
|
113
|
+
For a single-device OVOS installation with moderate data, the ChromaDB plugin may be simpler.
|
|
114
|
+
Both expose the same `EmbeddingsDB` interface, so switching is a config change.
|
|
115
|
+
|
|
116
|
+
## Further reading
|
|
117
|
+
|
|
118
|
+
- [`docs/configuration.md`](docs/configuration.md) — all config keys, client modes, cosine normalization note
|
|
119
|
+
- [`docs/usage.md`](docs/usage.md) — collections, CRUD, batch ops, metadata, query
|
|
120
|
+
- [`examples/quickstart.py`](examples/quickstart.py) — in-memory add + query
|
|
121
|
+
- [`examples/collections.py`](examples/collections.py) — multi-collection workflow
|
|
122
|
+
- [`examples/remote_server.py`](examples/remote_server.py) — remote Qdrant setup
|
|
123
|
+
|
|
124
|
+
## Testing
|
|
125
|
+
|
|
126
|
+
Tests use an in-memory Qdrant client — no server required.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pip install ovos-qdrant-embeddings-plugin[test]
|
|
130
|
+
pytest test/ -v
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Credits
|
|
134
|
+
|
|
135
|
+
Originally developed by [TigreGótico](https://tigregotico.pt) for [OpenVoiceOS](https://openvoiceos.org),
|
|
136
|
+
sponsored by VisioLab. Modernized under the [NGI0 Commons Fund](https://nlnet.nl/commonsfund) / [NLnet](https://nlnet.nl).
|
|
137
|
+
|
|
138
|
+
<img src="https://github.com/user-attachments/assets/809588a2-32a2-406c-98c0-f88bf7753cb4" width="220" alt="VisioLab"/>
|
|
139
|
+
|
|
140
|
+
> This work was sponsored by VisioLab, part of [Royal Dutch Visio](https://visio.org/), is the test, education, and research center in the field of (innovative) assistive technology for blind and visually impaired people and professionals. We explore (new) technological developments such as Voice, VR and AI and make the knowledge and expertise we gain available to everyone.
|
|
141
|
+
|
|
142
|
+
[](https://nlnet.nl/project/OpenVoiceOS)
|
|
143
|
+
|
|
144
|
+
This project was funded through the [NGI0 Commons Fund](https://nlnet.nl/commonsfund),
|
|
145
|
+
a fund established by [NLnet](https://nlnet.nl) with financial support from the
|
|
146
|
+
European Commission's [Next Generation Internet](https://ngi.eu) programme, under
|
|
147
|
+
the aegis of [DG Communications Networks, Content and Technology](https://commission.europa.eu/about-european-commission/departments-and-executive-agencies/communications-networks-content-and-technology_en)
|
|
148
|
+
under grant agreement No [101135429](https://cordis.europa.eu/project/id/101135429).
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
[](https://deepwiki.com/OpenVoiceOS/ovos-qdrant-embeddings-plugin)
|
|
2
|
+
|
|
3
|
+
# ovos-qdrant-embeddings-plugin
|
|
4
|
+
|
|
5
|
+
Qdrant-backed `EmbeddingsDB` vector store plugin for [OpenVoiceOS](https://openvoiceos.org).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install ovos-qdrant-embeddings-plugin
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What is EmbeddingsDB?
|
|
14
|
+
|
|
15
|
+
`EmbeddingsDB` is the abstract vector-store interface defined by
|
|
16
|
+
[ovos-plugin-manager](https://github.com/OpenVoiceOS/ovos_plugin_manager) (`opm.embeddings`).
|
|
17
|
+
It provides a uniform API for storing, retrieving, and nearest-neighbour querying of embedding
|
|
18
|
+
vectors regardless of the backend.
|
|
19
|
+
|
|
20
|
+
OVOS components that need semantic search (e.g. memory, skills, pipelines) discover the active
|
|
21
|
+
backend via the OPM entry-point group `opm.embeddings`. This plugin registers itself as:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
opm.embeddings = ovos-qdrant-embeddings-plugin
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
It pairs naturally with embedding producers such as
|
|
28
|
+
[ovos-gguf-plugin](https://github.com/OpenVoiceOS/ovos-gguf-plugin) that generate the vectors
|
|
29
|
+
you store here.
|
|
30
|
+
|
|
31
|
+
## Quickstart — in-memory DB
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import numpy as np
|
|
35
|
+
from ovos_qdrant_embeddings import QdrantEmbeddingsDB
|
|
36
|
+
|
|
37
|
+
# In-memory: no host, no path — perfect for development and CI
|
|
38
|
+
db = QdrantEmbeddingsDB(config={"vector_size": 4})
|
|
39
|
+
|
|
40
|
+
# Store vectors
|
|
41
|
+
db.add_embeddings("apple", np.array([1.0, 0.0, 0.0, 0.0]))
|
|
42
|
+
db.add_embeddings("banana", np.array([0.0, 1.0, 0.0, 0.0]))
|
|
43
|
+
db.add_embeddings("cherry", np.array([0.0, 0.0, 1.0, 0.0]))
|
|
44
|
+
|
|
45
|
+
# Nearest-neighbour query — returns [(key, score), ...]
|
|
46
|
+
results = db.query(np.array([0.9, 0.1, 0.0, 0.0]), top_k=2)
|
|
47
|
+
print(results) # [('apple', 0.999...), ('banana', 0.099...)]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
| Key | Default | Description |
|
|
53
|
+
|-----|---------|-------------|
|
|
54
|
+
| `vector_size` | **required** | Dimension of the embedding vectors. Must match your embedding model. |
|
|
55
|
+
| `distance_metric` | `"cosine"` | Similarity function: `"cosine"`, `"euclidean"`, or `"dot"`. |
|
|
56
|
+
| `default_collection_name` | `"embeddings"` | Collection created on startup and used when no collection is specified. |
|
|
57
|
+
| `host` | — | Remote Qdrant host (activates HTTP client mode). |
|
|
58
|
+
| `port` | `6333` | HTTP port for remote client. |
|
|
59
|
+
| `grpc_port` | `6334` | gRPC port for remote client. |
|
|
60
|
+
| `api_key` | — | API key for Qdrant Cloud or authenticated remote instances. |
|
|
61
|
+
| `path` | — | Filesystem path for local persistent storage (activates file-backed mode). |
|
|
62
|
+
|
|
63
|
+
### Three client modes
|
|
64
|
+
|
|
65
|
+
**In-memory** (development / CI) — neither `host` nor `path` set:
|
|
66
|
+
```python
|
|
67
|
+
config = {"vector_size": 384}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Local persistent** — data survives restarts:
|
|
71
|
+
```python
|
|
72
|
+
config = {"path": "/var/lib/ovos/qdrant", "vector_size": 384}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Remote** — connects to a running Qdrant server or Qdrant Cloud:
|
|
76
|
+
```python
|
|
77
|
+
config = {
|
|
78
|
+
"host": "my-qdrant.example.com",
|
|
79
|
+
"port": 6333,
|
|
80
|
+
"api_key": "my-secret-key",
|
|
81
|
+
"vector_size": 384,
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## When to choose Qdrant over ChromaDB
|
|
86
|
+
|
|
87
|
+
- You need to run the vector store as a **separate network service** (microservice / homelab).
|
|
88
|
+
- Your collection grows to **millions of vectors** — Qdrant's HNSW index scales well.
|
|
89
|
+
- You want **Qdrant Cloud** managed hosting.
|
|
90
|
+
- You need **gRPC** for high-throughput batch ingestion.
|
|
91
|
+
|
|
92
|
+
For a single-device OVOS installation with moderate data, the ChromaDB plugin may be simpler.
|
|
93
|
+
Both expose the same `EmbeddingsDB` interface, so switching is a config change.
|
|
94
|
+
|
|
95
|
+
## Further reading
|
|
96
|
+
|
|
97
|
+
- [`docs/configuration.md`](docs/configuration.md) — all config keys, client modes, cosine normalization note
|
|
98
|
+
- [`docs/usage.md`](docs/usage.md) — collections, CRUD, batch ops, metadata, query
|
|
99
|
+
- [`examples/quickstart.py`](examples/quickstart.py) — in-memory add + query
|
|
100
|
+
- [`examples/collections.py`](examples/collections.py) — multi-collection workflow
|
|
101
|
+
- [`examples/remote_server.py`](examples/remote_server.py) — remote Qdrant setup
|
|
102
|
+
|
|
103
|
+
## Testing
|
|
104
|
+
|
|
105
|
+
Tests use an in-memory Qdrant client — no server required.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install ovos-qdrant-embeddings-plugin[test]
|
|
109
|
+
pytest test/ -v
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Credits
|
|
113
|
+
|
|
114
|
+
Originally developed by [TigreGótico](https://tigregotico.pt) for [OpenVoiceOS](https://openvoiceos.org),
|
|
115
|
+
sponsored by VisioLab. Modernized under the [NGI0 Commons Fund](https://nlnet.nl/commonsfund) / [NLnet](https://nlnet.nl).
|
|
116
|
+
|
|
117
|
+
<img src="https://github.com/user-attachments/assets/809588a2-32a2-406c-98c0-f88bf7753cb4" width="220" alt="VisioLab"/>
|
|
118
|
+
|
|
119
|
+
> This work was sponsored by VisioLab, part of [Royal Dutch Visio](https://visio.org/), is the test, education, and research center in the field of (innovative) assistive technology for blind and visually impaired people and professionals. We explore (new) technological developments such as Voice, VR and AI and make the knowledge and expertise we gain available to everyone.
|
|
120
|
+
|
|
121
|
+
[](https://nlnet.nl/project/OpenVoiceOS)
|
|
122
|
+
|
|
123
|
+
This project was funded through the [NGI0 Commons Fund](https://nlnet.nl/commonsfund),
|
|
124
|
+
a fund established by [NLnet](https://nlnet.nl) with financial support from the
|
|
125
|
+
European Commission's [Next Generation Internet](https://ngi.eu) programme, under
|
|
126
|
+
the aegis of [DG Communications Networks, Content and Technology](https://commission.europa.eu/about-european-commission/departments-and-executive-agencies/communications-networks-content-and-technology_en)
|
|
127
|
+
under grant agreement No [101135429](https://cordis.europa.eu/project/id/101135429).
|