ragit 0.6__tar.gz → 0.8__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.
- ragit-0.8/LICENSE +21 -0
- {ragit-0.6 → ragit-0.8}/PKG-INFO +19 -21
- {ragit-0.6 → ragit-0.8}/README.md +17 -20
- {ragit-0.6 → ragit-0.8}/ragit/__init__.py +0 -0
- {ragit-0.6 → ragit-0.8}/ragit/main.py +0 -30
- {ragit-0.6 → ragit-0.8}/ragit.egg-info/PKG-INFO +19 -21
- {ragit-0.6 → ragit-0.8}/ragit.egg-info/SOURCES.txt +1 -0
- {ragit-0.6 → ragit-0.8}/ragit.egg-info/dependency_links.txt +0 -0
- {ragit-0.6 → ragit-0.8}/ragit.egg-info/requires.txt +0 -0
- {ragit-0.6 → ragit-0.8}/ragit.egg-info/top_level.txt +0 -0
- {ragit-0.6 → ragit-0.8}/setup.cfg +0 -0
- {ragit-0.6 → ragit-0.8}/setup.py +1 -1
ragit-0.8/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Salman Faroz
|
|
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.
|
{ragit-0.6 → ragit-0.8}/PKG-INFO
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ragit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8
|
|
4
4
|
Home-page: https://github.com/stsfaroz/ragit
|
|
5
5
|
Author: Salman Faroz
|
|
6
6
|
License: MIT
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
8
9
|
Requires-Dist: sentence-transformers>=3.4.1
|
|
9
10
|
Requires-Dist: pandas>=2.2.3
|
|
10
11
|
Requires-Dist: chromadb>=0.6.3
|
|
@@ -22,6 +23,11 @@ Dynamic: requires-dist
|
|
|
22
23
|
# Ragit
|
|
23
24
|
🚀 Smart, Fast, Scalable Search 🚀
|
|
24
25
|
|
|
26
|
+
## Installation
|
|
27
|
+
```
|
|
28
|
+
pip install ragit
|
|
29
|
+
```
|
|
30
|
+
|
|
25
31
|
**ragit** is a lightweight Python library that simplifies the management of vector databases. With **ragit**, you can easily create, update, query, and manage your vector database, all from CSV files containing text data.
|
|
26
32
|
|
|
27
33
|
## Features
|
|
@@ -72,13 +78,15 @@ db_manager.create_database(
|
|
|
72
78
|
```
|
|
73
79
|
### Reloading Your Database
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
To reuse your existing vector database, initialize VectorDBManager with the same parameters that were used when creating the database.
|
|
76
82
|
|
|
77
83
|
```python
|
|
78
84
|
from ragit import VectorDBManager
|
|
79
85
|
|
|
80
86
|
db_manager = VectorDBManager(
|
|
81
87
|
persist_directory="./my_vector_db",
|
|
88
|
+
provider="sentence_transformer",
|
|
89
|
+
model_name="all-mpnet-base-v2"
|
|
82
90
|
)
|
|
83
91
|
```
|
|
84
92
|
|
|
@@ -131,17 +139,7 @@ for item in results:
|
|
|
131
139
|
print(f"Distance ({item['metric']}): {item['raw_distance']}")
|
|
132
140
|
```
|
|
133
141
|
|
|
134
|
-
### 7.
|
|
135
|
-
Remove an entry from the collection by its ID:
|
|
136
|
-
|
|
137
|
-
```python
|
|
138
|
-
db_manager.delete_entry_by_id(
|
|
139
|
-
id_="1",
|
|
140
|
-
collection_name="my_collection"
|
|
141
|
-
)
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### 8. Fetching Texts by IDs
|
|
142
|
+
### 7. Fetching Texts by IDs
|
|
145
143
|
Retrieve text entries for a list of IDs:
|
|
146
144
|
|
|
147
145
|
```python
|
|
@@ -150,18 +148,18 @@ texts = db_manager.get_by_ids(ids_to_fetch, "my_collection")
|
|
|
150
148
|
print("Texts:", texts)
|
|
151
149
|
```
|
|
152
150
|
|
|
153
|
-
###
|
|
154
|
-
|
|
151
|
+
### 8. Deleting a Row / Collection
|
|
152
|
+
|
|
153
|
+
Remove an entry from the collection by its ID:
|
|
155
154
|
|
|
156
155
|
```python
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
print("IDs:", ids)
|
|
156
|
+
db_manager.delete_entry_by_id(
|
|
157
|
+
id_="1",
|
|
158
|
+
collection_name="my_collection"
|
|
159
|
+
)
|
|
162
160
|
```
|
|
163
161
|
|
|
164
|
-
|
|
162
|
+
|
|
165
163
|
Delete an entire collection. **Note:** You must pass `confirmation="yes"` to proceed with deletion.
|
|
166
164
|
|
|
167
165
|
```python
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
# Ragit
|
|
3
3
|
🚀 Smart, Fast, Scalable Search 🚀
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
```
|
|
7
|
+
pip install ragit
|
|
8
|
+
```
|
|
9
|
+
|
|
5
10
|
**ragit** is a lightweight Python library that simplifies the management of vector databases. With **ragit**, you can easily create, update, query, and manage your vector database, all from CSV files containing text data.
|
|
6
11
|
|
|
7
12
|
## Features
|
|
@@ -52,13 +57,15 @@ db_manager.create_database(
|
|
|
52
57
|
```
|
|
53
58
|
### Reloading Your Database
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
To reuse your existing vector database, initialize VectorDBManager with the same parameters that were used when creating the database.
|
|
56
61
|
|
|
57
62
|
```python
|
|
58
63
|
from ragit import VectorDBManager
|
|
59
64
|
|
|
60
65
|
db_manager = VectorDBManager(
|
|
61
66
|
persist_directory="./my_vector_db",
|
|
67
|
+
provider="sentence_transformer",
|
|
68
|
+
model_name="all-mpnet-base-v2"
|
|
62
69
|
)
|
|
63
70
|
```
|
|
64
71
|
|
|
@@ -111,17 +118,7 @@ for item in results:
|
|
|
111
118
|
print(f"Distance ({item['metric']}): {item['raw_distance']}")
|
|
112
119
|
```
|
|
113
120
|
|
|
114
|
-
### 7.
|
|
115
|
-
Remove an entry from the collection by its ID:
|
|
116
|
-
|
|
117
|
-
```python
|
|
118
|
-
db_manager.delete_entry_by_id(
|
|
119
|
-
id_="1",
|
|
120
|
-
collection_name="my_collection"
|
|
121
|
-
)
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### 8. Fetching Texts by IDs
|
|
121
|
+
### 7. Fetching Texts by IDs
|
|
125
122
|
Retrieve text entries for a list of IDs:
|
|
126
123
|
|
|
127
124
|
```python
|
|
@@ -130,18 +127,18 @@ texts = db_manager.get_by_ids(ids_to_fetch, "my_collection")
|
|
|
130
127
|
print("Texts:", texts)
|
|
131
128
|
```
|
|
132
129
|
|
|
133
|
-
###
|
|
134
|
-
|
|
130
|
+
### 8. Deleting a Row / Collection
|
|
131
|
+
|
|
132
|
+
Remove an entry from the collection by its ID:
|
|
135
133
|
|
|
136
134
|
```python
|
|
137
|
-
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
print("IDs:", ids)
|
|
135
|
+
db_manager.delete_entry_by_id(
|
|
136
|
+
id_="1",
|
|
137
|
+
collection_name="my_collection"
|
|
138
|
+
)
|
|
142
139
|
```
|
|
143
140
|
|
|
144
|
-
|
|
141
|
+
|
|
145
142
|
Delete an entire collection. **Note:** You must pass `confirmation="yes"` to proceed with deletion.
|
|
146
143
|
|
|
147
144
|
```python
|
|
File without changes
|
|
@@ -5,7 +5,6 @@ from sentence_transformers import SentenceTransformer
|
|
|
5
5
|
from typing import List, Dict, Optional, Union
|
|
6
6
|
import os
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
class VectorDBManager:
|
|
10
9
|
def __init__(
|
|
11
10
|
self,
|
|
@@ -353,32 +352,3 @@ class VectorDBManager:
|
|
|
353
352
|
except Exception as e:
|
|
354
353
|
self.logger.error(f"Error getting texts by IDs: {str(e)}")
|
|
355
354
|
return {}
|
|
356
|
-
|
|
357
|
-
def get_by_texts(self, texts: List[str], collection_name: str) -> Dict[str, str]:
|
|
358
|
-
"""
|
|
359
|
-
Get IDs for given texts in batch.
|
|
360
|
-
Note: For exact text matching. For similar texts, use find_nearby_texts.
|
|
361
|
-
|
|
362
|
-
Args:
|
|
363
|
-
texts (List[str]): List of texts to fetch
|
|
364
|
-
collection_name (str): Name of the collection
|
|
365
|
-
|
|
366
|
-
Returns:
|
|
367
|
-
Dict[str, str]: Dictionary mapping texts to their corresponding IDs
|
|
368
|
-
"""
|
|
369
|
-
try:
|
|
370
|
-
collection = self.client.get_collection(collection_name)
|
|
371
|
-
|
|
372
|
-
all_data = collection.get()
|
|
373
|
-
|
|
374
|
-
text_to_id = {
|
|
375
|
-
text: id_
|
|
376
|
-
for text, id_ in zip(all_data["documents"], all_data["ids"])
|
|
377
|
-
if text in texts
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return text_to_id
|
|
381
|
-
|
|
382
|
-
except Exception as e:
|
|
383
|
-
self.logger.error(f"Error getting IDs by texts: {str(e)}")
|
|
384
|
-
return {}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ragit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8
|
|
4
4
|
Home-page: https://github.com/stsfaroz/ragit
|
|
5
5
|
Author: Salman Faroz
|
|
6
6
|
License: MIT
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
8
9
|
Requires-Dist: sentence-transformers>=3.4.1
|
|
9
10
|
Requires-Dist: pandas>=2.2.3
|
|
10
11
|
Requires-Dist: chromadb>=0.6.3
|
|
@@ -22,6 +23,11 @@ Dynamic: requires-dist
|
|
|
22
23
|
# Ragit
|
|
23
24
|
🚀 Smart, Fast, Scalable Search 🚀
|
|
24
25
|
|
|
26
|
+
## Installation
|
|
27
|
+
```
|
|
28
|
+
pip install ragit
|
|
29
|
+
```
|
|
30
|
+
|
|
25
31
|
**ragit** is a lightweight Python library that simplifies the management of vector databases. With **ragit**, you can easily create, update, query, and manage your vector database, all from CSV files containing text data.
|
|
26
32
|
|
|
27
33
|
## Features
|
|
@@ -72,13 +78,15 @@ db_manager.create_database(
|
|
|
72
78
|
```
|
|
73
79
|
### Reloading Your Database
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
To reuse your existing vector database, initialize VectorDBManager with the same parameters that were used when creating the database.
|
|
76
82
|
|
|
77
83
|
```python
|
|
78
84
|
from ragit import VectorDBManager
|
|
79
85
|
|
|
80
86
|
db_manager = VectorDBManager(
|
|
81
87
|
persist_directory="./my_vector_db",
|
|
88
|
+
provider="sentence_transformer",
|
|
89
|
+
model_name="all-mpnet-base-v2"
|
|
82
90
|
)
|
|
83
91
|
```
|
|
84
92
|
|
|
@@ -131,17 +139,7 @@ for item in results:
|
|
|
131
139
|
print(f"Distance ({item['metric']}): {item['raw_distance']}")
|
|
132
140
|
```
|
|
133
141
|
|
|
134
|
-
### 7.
|
|
135
|
-
Remove an entry from the collection by its ID:
|
|
136
|
-
|
|
137
|
-
```python
|
|
138
|
-
db_manager.delete_entry_by_id(
|
|
139
|
-
id_="1",
|
|
140
|
-
collection_name="my_collection"
|
|
141
|
-
)
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### 8. Fetching Texts by IDs
|
|
142
|
+
### 7. Fetching Texts by IDs
|
|
145
143
|
Retrieve text entries for a list of IDs:
|
|
146
144
|
|
|
147
145
|
```python
|
|
@@ -150,18 +148,18 @@ texts = db_manager.get_by_ids(ids_to_fetch, "my_collection")
|
|
|
150
148
|
print("Texts:", texts)
|
|
151
149
|
```
|
|
152
150
|
|
|
153
|
-
###
|
|
154
|
-
|
|
151
|
+
### 8. Deleting a Row / Collection
|
|
152
|
+
|
|
153
|
+
Remove an entry from the collection by its ID:
|
|
155
154
|
|
|
156
155
|
```python
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
print("IDs:", ids)
|
|
156
|
+
db_manager.delete_entry_by_id(
|
|
157
|
+
id_="1",
|
|
158
|
+
collection_name="my_collection"
|
|
159
|
+
)
|
|
162
160
|
```
|
|
163
161
|
|
|
164
|
-
|
|
162
|
+
|
|
165
163
|
Delete an entire collection. **Note:** You must pass `confirmation="yes"` to proceed with deletion.
|
|
166
164
|
|
|
167
165
|
```python
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|