ragit 0.5__tar.gz → 0.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.
- {ragit-0.5 → ragit-0.7}/PKG-INFO +15 -23
- {ragit-0.5 → ragit-0.7}/README.md +14 -22
- {ragit-0.5 → ragit-0.7}/ragit/main.py +0 -30
- {ragit-0.5 → ragit-0.7}/ragit.egg-info/PKG-INFO +15 -23
- {ragit-0.5 → ragit-0.7}/setup.py +1 -1
- {ragit-0.5 → ragit-0.7}/ragit/__init__.py +0 -0
- {ragit-0.5 → ragit-0.7}/ragit.egg-info/SOURCES.txt +0 -0
- {ragit-0.5 → ragit-0.7}/ragit.egg-info/dependency_links.txt +0 -0
- {ragit-0.5 → ragit-0.7}/ragit.egg-info/requires.txt +0 -0
- {ragit-0.5 → ragit-0.7}/ragit.egg-info/top_level.txt +0 -0
- {ragit-0.5 → ragit-0.7}/setup.cfg +0 -0
{ragit-0.5 → ragit-0.7}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ragit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Home-page: https://github.com/stsfaroz/ragit
|
|
5
5
|
Author: Salman Faroz
|
|
6
6
|
License: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: requires-dist
|
|
|
22
22
|
# Ragit
|
|
23
23
|
🚀 Smart, Fast, Scalable Search 🚀
|
|
24
24
|
|
|
25
|
-
**ragit** is a lightweight Python library that simplifies the management of vector databases. With ragit
|
|
25
|
+
**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
26
|
|
|
27
27
|
## Features
|
|
28
28
|
|
|
@@ -33,7 +33,7 @@ Dynamic: requires-dist
|
|
|
33
33
|
- **Deletion:** Remove single entries or entire collections when needed.
|
|
34
34
|
|
|
35
35
|
## CSV File Format
|
|
36
|
-
ragit expects your CSV file to have exactly two columns: `id` and `text`.
|
|
36
|
+
ragit expects your CSV file to have exactly two columns: `id` and `text`. **Note:** Each `id` must be unique.
|
|
37
37
|
|
|
38
38
|
## Example CSV (`data.csv`):
|
|
39
39
|
|
|
@@ -72,13 +72,15 @@ db_manager.create_database(
|
|
|
72
72
|
```
|
|
73
73
|
### Reloading Your Database
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
To reuse your existing vector database, initialize VectorDBManager with the same parameters that were used when creating the database.
|
|
76
76
|
|
|
77
77
|
```python
|
|
78
78
|
from ragit import VectorDBManager
|
|
79
79
|
|
|
80
80
|
db_manager = VectorDBManager(
|
|
81
81
|
persist_directory="./my_vector_db",
|
|
82
|
+
provider="sentence_transformer",
|
|
83
|
+
model_name="all-mpnet-base-v2"
|
|
82
84
|
)
|
|
83
85
|
```
|
|
84
86
|
|
|
@@ -131,17 +133,7 @@ for item in results:
|
|
|
131
133
|
print(f"Distance ({item['metric']}): {item['raw_distance']}")
|
|
132
134
|
```
|
|
133
135
|
|
|
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
|
|
136
|
+
### 7. Fetching Texts by IDs
|
|
145
137
|
Retrieve text entries for a list of IDs:
|
|
146
138
|
|
|
147
139
|
```python
|
|
@@ -150,18 +142,18 @@ texts = db_manager.get_by_ids(ids_to_fetch, "my_collection")
|
|
|
150
142
|
print("Texts:", texts)
|
|
151
143
|
```
|
|
152
144
|
|
|
153
|
-
###
|
|
154
|
-
|
|
145
|
+
### 8. Deleting a Row / Collection
|
|
146
|
+
|
|
147
|
+
Remove an entry from the collection by its ID:
|
|
155
148
|
|
|
156
149
|
```python
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
print("IDs:", ids)
|
|
150
|
+
db_manager.delete_entry_by_id(
|
|
151
|
+
id_="1",
|
|
152
|
+
collection_name="my_collection"
|
|
153
|
+
)
|
|
162
154
|
```
|
|
163
155
|
|
|
164
|
-
|
|
156
|
+
|
|
165
157
|
Delete an entire collection. **Note:** You must pass `confirmation="yes"` to proceed with deletion.
|
|
166
158
|
|
|
167
159
|
```python
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Ragit
|
|
3
3
|
🚀 Smart, Fast, Scalable Search 🚀
|
|
4
4
|
|
|
5
|
-
**ragit** is a lightweight Python library that simplifies the management of vector databases. With ragit
|
|
5
|
+
**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
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
- **Deletion:** Remove single entries or entire collections when needed.
|
|
14
14
|
|
|
15
15
|
## CSV File Format
|
|
16
|
-
ragit expects your CSV file to have exactly two columns: `id` and `text`.
|
|
16
|
+
ragit expects your CSV file to have exactly two columns: `id` and `text`. **Note:** Each `id` must be unique.
|
|
17
17
|
|
|
18
18
|
## Example CSV (`data.csv`):
|
|
19
19
|
|
|
@@ -52,13 +52,15 @@ db_manager.create_database(
|
|
|
52
52
|
```
|
|
53
53
|
### Reloading Your Database
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
To reuse your existing vector database, initialize VectorDBManager with the same parameters that were used when creating the database.
|
|
56
56
|
|
|
57
57
|
```python
|
|
58
58
|
from ragit import VectorDBManager
|
|
59
59
|
|
|
60
60
|
db_manager = VectorDBManager(
|
|
61
61
|
persist_directory="./my_vector_db",
|
|
62
|
+
provider="sentence_transformer",
|
|
63
|
+
model_name="all-mpnet-base-v2"
|
|
62
64
|
)
|
|
63
65
|
```
|
|
64
66
|
|
|
@@ -111,17 +113,7 @@ for item in results:
|
|
|
111
113
|
print(f"Distance ({item['metric']}): {item['raw_distance']}")
|
|
112
114
|
```
|
|
113
115
|
|
|
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
|
|
116
|
+
### 7. Fetching Texts by IDs
|
|
125
117
|
Retrieve text entries for a list of IDs:
|
|
126
118
|
|
|
127
119
|
```python
|
|
@@ -130,18 +122,18 @@ texts = db_manager.get_by_ids(ids_to_fetch, "my_collection")
|
|
|
130
122
|
print("Texts:", texts)
|
|
131
123
|
```
|
|
132
124
|
|
|
133
|
-
###
|
|
134
|
-
|
|
125
|
+
### 8. Deleting a Row / Collection
|
|
126
|
+
|
|
127
|
+
Remove an entry from the collection by its ID:
|
|
135
128
|
|
|
136
129
|
```python
|
|
137
|
-
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
print("IDs:", ids)
|
|
130
|
+
db_manager.delete_entry_by_id(
|
|
131
|
+
id_="1",
|
|
132
|
+
collection_name="my_collection"
|
|
133
|
+
)
|
|
142
134
|
```
|
|
143
135
|
|
|
144
|
-
|
|
136
|
+
|
|
145
137
|
Delete an entire collection. **Note:** You must pass `confirmation="yes"` to proceed with deletion.
|
|
146
138
|
|
|
147
139
|
```python
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ragit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Home-page: https://github.com/stsfaroz/ragit
|
|
5
5
|
Author: Salman Faroz
|
|
6
6
|
License: MIT
|
|
@@ -22,7 +22,7 @@ Dynamic: requires-dist
|
|
|
22
22
|
# Ragit
|
|
23
23
|
🚀 Smart, Fast, Scalable Search 🚀
|
|
24
24
|
|
|
25
|
-
**ragit** is a lightweight Python library that simplifies the management of vector databases. With ragit
|
|
25
|
+
**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
26
|
|
|
27
27
|
## Features
|
|
28
28
|
|
|
@@ -33,7 +33,7 @@ Dynamic: requires-dist
|
|
|
33
33
|
- **Deletion:** Remove single entries or entire collections when needed.
|
|
34
34
|
|
|
35
35
|
## CSV File Format
|
|
36
|
-
ragit expects your CSV file to have exactly two columns: `id` and `text`.
|
|
36
|
+
ragit expects your CSV file to have exactly two columns: `id` and `text`. **Note:** Each `id` must be unique.
|
|
37
37
|
|
|
38
38
|
## Example CSV (`data.csv`):
|
|
39
39
|
|
|
@@ -72,13 +72,15 @@ db_manager.create_database(
|
|
|
72
72
|
```
|
|
73
73
|
### Reloading Your Database
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
To reuse your existing vector database, initialize VectorDBManager with the same parameters that were used when creating the database.
|
|
76
76
|
|
|
77
77
|
```python
|
|
78
78
|
from ragit import VectorDBManager
|
|
79
79
|
|
|
80
80
|
db_manager = VectorDBManager(
|
|
81
81
|
persist_directory="./my_vector_db",
|
|
82
|
+
provider="sentence_transformer",
|
|
83
|
+
model_name="all-mpnet-base-v2"
|
|
82
84
|
)
|
|
83
85
|
```
|
|
84
86
|
|
|
@@ -131,17 +133,7 @@ for item in results:
|
|
|
131
133
|
print(f"Distance ({item['metric']}): {item['raw_distance']}")
|
|
132
134
|
```
|
|
133
135
|
|
|
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
|
|
136
|
+
### 7. Fetching Texts by IDs
|
|
145
137
|
Retrieve text entries for a list of IDs:
|
|
146
138
|
|
|
147
139
|
```python
|
|
@@ -150,18 +142,18 @@ texts = db_manager.get_by_ids(ids_to_fetch, "my_collection")
|
|
|
150
142
|
print("Texts:", texts)
|
|
151
143
|
```
|
|
152
144
|
|
|
153
|
-
###
|
|
154
|
-
|
|
145
|
+
### 8. Deleting a Row / Collection
|
|
146
|
+
|
|
147
|
+
Remove an entry from the collection by its ID:
|
|
155
148
|
|
|
156
149
|
```python
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
print("IDs:", ids)
|
|
150
|
+
db_manager.delete_entry_by_id(
|
|
151
|
+
id_="1",
|
|
152
|
+
collection_name="my_collection"
|
|
153
|
+
)
|
|
162
154
|
```
|
|
163
155
|
|
|
164
|
-
|
|
156
|
+
|
|
165
157
|
Delete an entire collection. **Note:** You must pass `confirmation="yes"` to proceed with deletion.
|
|
166
158
|
|
|
167
159
|
```python
|
{ragit-0.5 → ragit-0.7}/setup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|