sharedkernel 1.6.8__tar.gz → 1.6.9__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.
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/PKG-INFO +3 -2
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/README.md +2 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/setup.py +2 -2
- sharedkernel-1.6.9/sharedkernel/database/vector_database_repository/__init__.py +2 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/database/vector_database_repository/vector_database_repository.py +5 -5
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel.egg-info/PKG-INFO +3 -2
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel.egg-info/SOURCES.txt +0 -1
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel.egg-info/requires.txt +0 -1
- sharedkernel-1.6.8/sharedkernel/database/vector_database_repository/__init__.py +0 -3
- sharedkernel-1.6.8/sharedkernel/database/vector_database_repository/milvus_strategy.py +0 -50
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/setup.cfg +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/common.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/database/__init__.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/database/mongo_generic_repository.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/database/vector_database_repository/chroma_startegy.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/database/vector_database_repository/vector_database_strategy.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/date_converter.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/enum/__init__.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/enum/error_code.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/enum/vector_database_type.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/exception/__init__.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/exception/exception.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/exception/exception_handlers.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/jwt_service.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/normalizer/__init__.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/normalizer/phone_number_normalizer.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/objects/__init__.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/objects/base_document.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/objects/jwt_model.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/objects/result.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/regex_masking.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/string_extentions.py +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel.egg-info/dependency_links.txt +0 -0
- {sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sharedkernel
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.9
|
|
4
4
|
Summary: sharekernel is a shared package between all python projects
|
|
5
5
|
Author: Smilinno
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -9,7 +9,6 @@ Requires-Dist: requests
|
|
|
9
9
|
Requires-Dist: pymongo
|
|
10
10
|
Requires-Dist: fastapi==0.111.0
|
|
11
11
|
Requires-Dist: PyJWT
|
|
12
|
-
Requires-Dist: pymilvus
|
|
13
12
|
Requires-Dist: chromadb
|
|
14
13
|
Requires-Dist: persian_tools
|
|
15
14
|
Requires-Dist: sentry-sdk
|
|
@@ -21,6 +20,8 @@ this a shared kernel package
|
|
|
21
20
|
|
|
22
21
|
# Change Log
|
|
23
22
|
### Version 1.6.8
|
|
23
|
+
- Delete milvus
|
|
24
|
+
### Version 1.6.8
|
|
24
25
|
- Fix Date Converter Bug
|
|
25
26
|
### Version 1.6.7
|
|
26
27
|
- Fix bug and remove additional features
|
|
@@ -26,7 +26,7 @@ setup(
|
|
|
26
26
|
"pymongo",
|
|
27
27
|
"fastapi==0.111.0",
|
|
28
28
|
"PyJWT",
|
|
29
|
-
"pymilvus",
|
|
29
|
+
#"pymilvus",
|
|
30
30
|
"chromadb",
|
|
31
31
|
"persian_tools",
|
|
32
32
|
"sentry-sdk",
|
|
@@ -34,7 +34,7 @@ setup(
|
|
|
34
34
|
"persiantools"
|
|
35
35
|
],
|
|
36
36
|
# *strongly* suggested for sharing
|
|
37
|
-
version="1.6.
|
|
37
|
+
version="1.6.9",
|
|
38
38
|
description="sharekernel is a shared package between all python projects",
|
|
39
39
|
long_description=long_description,
|
|
40
40
|
long_description_content_type="text/markdown",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
from .vector_database_strategy import VectorDatabaseStrategy
|
|
3
|
-
from .milvus_strategy import MilvusStrategy
|
|
3
|
+
# from .milvus_strategy import MilvusStrategy
|
|
4
4
|
from .chroma_startegy import ChromaStrategy
|
|
5
5
|
from sharedkernel.enum.vector_database_type import VectorDatabaseType
|
|
6
6
|
|
|
@@ -10,10 +10,10 @@ class VectorRepository:
|
|
|
10
10
|
self.strategy.connect(**connection_params)
|
|
11
11
|
|
|
12
12
|
def _get_strategy(self, database_type: VectorDatabaseType, collection_name: str) -> VectorDatabaseStrategy:
|
|
13
|
-
if database_type == VectorDatabaseType.MILVUS:
|
|
14
|
-
|
|
15
|
-
else:
|
|
16
|
-
|
|
13
|
+
# if database_type == VectorDatabaseType.MILVUS:
|
|
14
|
+
# return MilvusStrategy(collection_name)
|
|
15
|
+
# else:
|
|
16
|
+
return ChromaStrategy(collection_name)
|
|
17
17
|
|
|
18
18
|
def add_vector(self, vector: np.ndarray, metadata: dict) -> str:
|
|
19
19
|
return self.strategy.insert_vector(vector, metadata)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sharedkernel
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.9
|
|
4
4
|
Summary: sharekernel is a shared package between all python projects
|
|
5
5
|
Author: Smilinno
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -9,7 +9,6 @@ Requires-Dist: requests
|
|
|
9
9
|
Requires-Dist: pymongo
|
|
10
10
|
Requires-Dist: fastapi==0.111.0
|
|
11
11
|
Requires-Dist: PyJWT
|
|
12
|
-
Requires-Dist: pymilvus
|
|
13
12
|
Requires-Dist: chromadb
|
|
14
13
|
Requires-Dist: persian_tools
|
|
15
14
|
Requires-Dist: sentry-sdk
|
|
@@ -21,6 +20,8 @@ this a shared kernel package
|
|
|
21
20
|
|
|
22
21
|
# Change Log
|
|
23
22
|
### Version 1.6.8
|
|
23
|
+
- Delete milvus
|
|
24
|
+
### Version 1.6.8
|
|
24
25
|
- Fix Date Converter Bug
|
|
25
26
|
### Version 1.6.7
|
|
26
27
|
- Fix bug and remove additional features
|
|
@@ -14,7 +14,6 @@ sharedkernel/database/__init__.py
|
|
|
14
14
|
sharedkernel/database/mongo_generic_repository.py
|
|
15
15
|
sharedkernel/database/vector_database_repository/__init__.py
|
|
16
16
|
sharedkernel/database/vector_database_repository/chroma_startegy.py
|
|
17
|
-
sharedkernel/database/vector_database_repository/milvus_strategy.py
|
|
18
17
|
sharedkernel/database/vector_database_repository/vector_database_repository.py
|
|
19
18
|
sharedkernel/database/vector_database_repository/vector_database_strategy.py
|
|
20
19
|
sharedkernel/enum/__init__.py
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
from pymilvus import connections, Collection, FieldSchema, CollectionSchema, DataType
|
|
3
|
-
|
|
4
|
-
from .vector_database_strategy import VectorDatabaseStrategy
|
|
5
|
-
import uuid
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class MilvusStrategy(VectorDatabaseStrategy):
|
|
9
|
-
def __init__(self, collection_name: str):
|
|
10
|
-
self.collection_name = collection_name
|
|
11
|
-
self.collection = None
|
|
12
|
-
|
|
13
|
-
def connect(self, host: str = "localhost", port: str = "19530"):
|
|
14
|
-
connections.connect(alias="default", host=host, port=port)
|
|
15
|
-
# Define fields
|
|
16
|
-
fields = [
|
|
17
|
-
FieldSchema(
|
|
18
|
-
name="id", dtype=DataType.VARCHAR, max_length=36, is_primary=True
|
|
19
|
-
),
|
|
20
|
-
FieldSchema(name="vector", dtype=DataType.FLOAT_VECTOR, dim=128),
|
|
21
|
-
]
|
|
22
|
-
schema = CollectionSchema(
|
|
23
|
-
fields, description="Vector collection", enable_dynamic_field=True
|
|
24
|
-
)
|
|
25
|
-
self.collection = Collection(name=self.collection_name, schema=schema)
|
|
26
|
-
|
|
27
|
-
if not self.collection.has_index():
|
|
28
|
-
self.collection.create_index(field_name="vector", index_params={"index_type": "IVF_FLAT", "metric_type": "L2", "params": {"nlist": 128}})
|
|
29
|
-
|
|
30
|
-
self.collection.load()
|
|
31
|
-
|
|
32
|
-
def insert_vector(self, vector: np.ndarray, metadata: dict) -> str:
|
|
33
|
-
id = str(uuid.uuid4())
|
|
34
|
-
self.collection.insert(data={"id": id, "vector": vector.tolist()})
|
|
35
|
-
|
|
36
|
-
return id
|
|
37
|
-
|
|
38
|
-
def search_vector(self, vector: np.ndarray, top_k: int):
|
|
39
|
-
search_params = {"metric_type": "L2", "params": {"nprobe": 10}}
|
|
40
|
-
results = self.collection.search(
|
|
41
|
-
[vector.tolist()], "vector", search_params, top_k
|
|
42
|
-
)
|
|
43
|
-
return results
|
|
44
|
-
|
|
45
|
-
def get_vector_by_id(self, id: str):
|
|
46
|
-
result = self.collection.query(expr=f"id=='{id}'",output_fields=["vector"])
|
|
47
|
-
return result
|
|
48
|
-
|
|
49
|
-
def delete_vector(self, id: str):
|
|
50
|
-
self.collection.delete(expr=f"id=='{id}'")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sharedkernel-1.6.8 → sharedkernel-1.6.9}/sharedkernel/normalizer/phone_number_normalizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|