ai-parrot 0.5.9__cp311-cp311-manylinux_2_28_x86_64.whl → 0.5.10__cp311-cp311-manylinux_2_28_x86_64.whl
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.
Potentially problematic release.
This version of ai-parrot might be problematic. Click here for more details.
- {ai_parrot-0.5.9.dist-info → ai_parrot-0.5.10.dist-info}/METADATA +1 -1
- {ai_parrot-0.5.9.dist-info → ai_parrot-0.5.10.dist-info}/RECORD +10 -10
- parrot/bots/abstract.py +1 -0
- parrot/bots/retrievals/multi.py +73 -21
- parrot/stores/abstract.py +6 -1
- parrot/stores/milvus.py +3 -1
- parrot/version.py +1 -1
- {ai_parrot-0.5.9.dist-info → ai_parrot-0.5.10.dist-info}/LICENSE +0 -0
- {ai_parrot-0.5.9.dist-info → ai_parrot-0.5.10.dist-info}/WHEEL +0 -0
- {ai_parrot-0.5.9.dist-info → ai_parrot-0.5.10.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ai-parrot
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.10
|
|
4
4
|
Summary: Live Chatbots based on Langchain chatbots and Agents Integrated into Navigator Framework or used into any aiohttp applications.
|
|
5
5
|
Home-page: https://github.com/phenobarbital/ai-parrot
|
|
6
6
|
Author: Jesus Lara
|
|
@@ -4,9 +4,9 @@ parrot/exceptions.cpython-311-x86_64-linux-gnu.so,sha256=1tKBneucxl6ShNqI8KS4-pa
|
|
|
4
4
|
parrot/manager.py,sha256=E1OdoNnZh1qCqVgZzcp8rdRnE1-xRwyQ6d1nFcOmg3U,6527
|
|
5
5
|
parrot/models.py,sha256=MT88rYdITenwTuyCfeqHqaNf49rieAKz43R2TibN7G8,14314
|
|
6
6
|
parrot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
parrot/version.py,sha256=
|
|
7
|
+
parrot/version.py,sha256=4v06ictEMyN4FAHdwVqVglgCC5FEnrNaqJ3-c_JYdoc,378
|
|
8
8
|
parrot/bots/__init__.py,sha256=qD-WOn8n34VUCp7Mq6Mq1lZV8h_cKAeXQxn27UtBDP4,153
|
|
9
|
-
parrot/bots/abstract.py,sha256=
|
|
9
|
+
parrot/bots/abstract.py,sha256=gB3HM24a80vrMUSvoXJjVLChJlJQZDVOPSvN-gu_Sx0,35841
|
|
10
10
|
parrot/bots/agent.py,sha256=2v_5hQ3XCvCPpwTne7t-NDUpX3na1LIwXfufT-cK9LU,13432
|
|
11
11
|
parrot/bots/base.py,sha256=Wl2BXRzxdGsWdHltAi0jalIPPAiM0TkVIHkRc1HQ99I,13422
|
|
12
12
|
parrot/bots/basic.py,sha256=dg2kT_ynMEtZ3cMTcSovmDwrOo7BhBwL1o-Nn_7I85A,235
|
|
@@ -24,7 +24,7 @@ parrot/bots/prompts/__init__.py,sha256=rm_rAX7ZIxDIpSVOjHVuHRLMI9wS3avsu5fUfwAsd
|
|
|
24
24
|
parrot/bots/prompts/agents.py,sha256=nXmzmRG15jiTDnjhmZ8ljSYCB1xU4RwsayZThFSj0Zg,4310
|
|
25
25
|
parrot/bots/retrievals/__init__.py,sha256=AgI0mTB27tZ0Oyr7RU63G-ZO1VyX-uCJ6lwxgP4baag,45
|
|
26
26
|
parrot/bots/retrievals/constitutional.py,sha256=x7kFR0KpmkR0Wz6bXNOeU3Hesn_EXc6eOSd4TdXxb8o,600
|
|
27
|
-
parrot/bots/retrievals/multi.py,sha256=
|
|
27
|
+
parrot/bots/retrievals/multi.py,sha256=gVsGIM6ynqDFdqryrEyQg6yYXIN3uGwAGby9fvacl_w,3667
|
|
28
28
|
parrot/bots/retrievals/retrieval.py,sha256=wvMM53k76njV5b6t6CCKiYVk2o81JCHzCNmlHBKYFMg,20622
|
|
29
29
|
parrot/chatbots/__init__.py,sha256=ypskCnME0xUv6psBEGCEyXCrD0J0ULHSllpVmSxqb4A,200
|
|
30
30
|
parrot/chatbots/abstract.py,sha256=CmDn3k4r9uKImOZRN4L9zxLbCdC-1MPUAorDlfZT-kA,26421
|
|
@@ -101,12 +101,12 @@ parrot/loaders/handlers/data.py,sha256=olZ2p-wyUMGoazah7tgHY7V9buGX1FOeJ-cv2vGEo
|
|
|
101
101
|
parrot/loaders/utils/__init__.py,sha256=SkDyK3MuPGhp0NM6kHvaxQDe97Gcl3n9t5A741OVh1c,28
|
|
102
102
|
parrot/loaders/utils/models.py,sha256=BHcnFzS7oOKUGG-vPy_TlqeFNAC8puRgsIMX2mSgKxY,1059
|
|
103
103
|
parrot/stores/__init__.py,sha256=W7Ggvvxw4Dn13IWbuXaT0KTTJJORpvLtTKuaajNUxNA,264
|
|
104
|
-
parrot/stores/abstract.py,sha256=
|
|
104
|
+
parrot/stores/abstract.py,sha256=esoNpgcA_07RS3z2Qm7RtQd7pfKbhLoJMztoDwC_c1k,7387
|
|
105
105
|
parrot/stores/chroma.py,sha256=UbPNs6P1o8BnUA0B_IwQ6n89VuZt7H2j0FpNmK22Ids,5932
|
|
106
106
|
parrot/stores/duck.py,sha256=FTDV2HJb580ojVNBdUrC1ukuDUTyk4qUwF-LaN-IbWA,4740
|
|
107
107
|
parrot/stores/empty.py,sha256=bCQJt54YPpR_pN9uHA2VA95GPPp04daMBJHbHQsRY0Q,234
|
|
108
108
|
parrot/stores/faiss.py,sha256=tbur-YM7ictMh9S65Tc6WGK88JBkunQqES98w27CBtE,5694
|
|
109
|
-
parrot/stores/milvus.py,sha256=
|
|
109
|
+
parrot/stores/milvus.py,sha256=rRM-oODKsTIEKiFBcygchqxpC94am2TLgbE0gw0NfJg,13275
|
|
110
110
|
parrot/stores/postgres.py,sha256=7mZ4l8EKcTMegWw6ooI9nfIUCdlutMCzJfQ0ULQFh6k,24908
|
|
111
111
|
parrot/stores/qdrant.py,sha256=u07DUoFHWDf-IU5tHbhinhMjPGWFgUbzaBhT_lWrvCA,6003
|
|
112
112
|
parrot/stores/embeddings/__init__.py,sha256=ZQPpLBhiBx27Q5FhB_v-Vibcq3rHEP7x9GXfn_LGFOc,283
|
|
@@ -144,8 +144,8 @@ resources/users/handlers.py,sha256=BGzqBvPY_OaIF_nONWX4b_B5OyyBrdGuSihIsdlFwjk,2
|
|
|
144
144
|
resources/users/models.py,sha256=glk7Emv7QCi6i32xRFDrGc8UwK23_LPg0XUOJoHnwRU,6799
|
|
145
145
|
settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
146
146
|
settings/settings.py,sha256=9ueEvyLNurUX-AaIeRPV8GKX1c4YjDLbksUAeqEq6Ck,1854
|
|
147
|
-
ai_parrot-0.5.
|
|
148
|
-
ai_parrot-0.5.
|
|
149
|
-
ai_parrot-0.5.
|
|
150
|
-
ai_parrot-0.5.
|
|
151
|
-
ai_parrot-0.5.
|
|
147
|
+
ai_parrot-0.5.10.dist-info/LICENSE,sha256=vRKOoa7onTsLNvSzJtGtMaNhWWh8B3YAT733Tlu6M4o,1070
|
|
148
|
+
ai_parrot-0.5.10.dist-info/METADATA,sha256=gGylS-G34IJt1kWqVhIMJnIXoUrDY3sSwb7GSgPJfpM,9716
|
|
149
|
+
ai_parrot-0.5.10.dist-info/WHEEL,sha256=lNWVJ6q28SO2kTKDIyc1kQ-4wE2w5snxBQXSv06oiUw,113
|
|
150
|
+
ai_parrot-0.5.10.dist-info/top_level.txt,sha256=VCLpdIu_5wkShgIQjK85jFzL9HEVVjAqlQa_gupLekI,17
|
|
151
|
+
ai_parrot-0.5.10.dist-info/RECORD,,
|
parrot/bots/abstract.py
CHANGED
|
@@ -959,6 +959,7 @@ class AbstractBot(DBInterface, ABC):
|
|
|
959
959
|
return_messages=True
|
|
960
960
|
)
|
|
961
961
|
async with self.store as store: #pylint: disable=E1101
|
|
962
|
+
print('STORES > ', self.stores, store)
|
|
962
963
|
if self._use_vector:
|
|
963
964
|
if len(self.stores) > 1:
|
|
964
965
|
retriever = MultiVectorStoreRetriever(
|
parrot/bots/retrievals/multi.py
CHANGED
|
@@ -1,50 +1,102 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from typing import List, Dict, Any, Optional
|
|
2
|
+
from langchain_core.retrievers import BaseRetriever
|
|
3
|
+
from langchain_core.callbacks import CallbackManagerForRetrieverRun
|
|
4
|
+
from langchain_core.documents import Document
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
class MultiVectorStoreRetriever(BaseRetriever):
|
|
6
8
|
"""
|
|
7
9
|
This aggregator retriever queries multiple vector stores
|
|
8
10
|
and merges the results into a single list.
|
|
9
11
|
"""
|
|
10
12
|
|
|
13
|
+
stores: List[Any]
|
|
14
|
+
search_kwargs: Dict[str, Any]
|
|
15
|
+
chain_type: str
|
|
16
|
+
search_type: str
|
|
17
|
+
metric_type: str
|
|
18
|
+
|
|
11
19
|
def __init__(
|
|
12
20
|
self,
|
|
13
|
-
stores: List[
|
|
21
|
+
stores: List[Any],
|
|
14
22
|
metric_type: str = 'COSINE',
|
|
15
23
|
chain_type: str = 'stuff',
|
|
16
24
|
search_type: str = 'similarity',
|
|
17
|
-
search_kwargs:
|
|
25
|
+
search_kwargs: Optional[Dict[str, Any]] = None,
|
|
18
26
|
):
|
|
19
27
|
"""
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
Initialize the MultiVectorStoreRetriever.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
stores: List of vector stores that provide an as_retriever() method
|
|
32
|
+
metric_type: Similarity metric (COSINE, EUCLIDEAN, DOT_PRODUCT)
|
|
33
|
+
chain_type: Chain type for the retriever
|
|
34
|
+
search_type: Search type (similarity, mmr)
|
|
35
|
+
search_kwargs: Dict to pass to each store's retrieve method (like 'k' for top_k)
|
|
22
36
|
"""
|
|
37
|
+
super().__init__()
|
|
23
38
|
self.stores = stores
|
|
24
39
|
self.search_kwargs = search_kwargs or {}
|
|
25
40
|
self.chain_type = chain_type
|
|
26
41
|
self.search_type = search_type
|
|
27
42
|
self.metric_type = metric_type
|
|
28
43
|
|
|
29
|
-
def
|
|
44
|
+
def _get_relevant_documents(
|
|
45
|
+
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
|
|
46
|
+
) -> List[Document]:
|
|
47
|
+
"""
|
|
48
|
+
Get documents relevant to the query.
|
|
49
|
+
Implements the required method from BaseRetriever.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
query: Query string
|
|
53
|
+
run_manager: CallbackManager for the run
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
List of relevant documents
|
|
57
|
+
"""
|
|
30
58
|
all_results = []
|
|
31
59
|
for store in self.stores:
|
|
32
|
-
retriever = store.as_retriever(
|
|
33
|
-
|
|
60
|
+
retriever = store.as_retriever(
|
|
61
|
+
search_type=self.search_type,
|
|
62
|
+
search_kwargs=self.search_kwargs,
|
|
63
|
+
chain_type=self.chain_type
|
|
64
|
+
)
|
|
65
|
+
# Pass the run_manager to the sub-retrievers if they support it
|
|
66
|
+
if hasattr(retriever, "_get_relevant_documents"):
|
|
67
|
+
callback_manager = run_manager.get_child()
|
|
68
|
+
docs = retriever._get_relevant_documents(query, run_manager=callback_manager)
|
|
69
|
+
else:
|
|
70
|
+
docs = retriever.get_relevant_documents(query)
|
|
34
71
|
all_results.extend(docs)
|
|
35
72
|
return all_results
|
|
36
73
|
|
|
37
|
-
async def
|
|
38
|
-
|
|
74
|
+
async def _aget_relevant_documents(
|
|
75
|
+
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
|
|
76
|
+
) -> List[Document]:
|
|
77
|
+
"""
|
|
78
|
+
Asynchronously get documents relevant to the query.
|
|
79
|
+
Implements the required async method from BaseRetriever.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
query: Query string
|
|
83
|
+
run_manager: CallbackManager for the run
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
List of relevant documents
|
|
87
|
+
"""
|
|
39
88
|
all_results = []
|
|
40
89
|
for store in self.stores:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
90
|
+
retriever = store.as_retriever(
|
|
91
|
+
search_type=self.search_type,
|
|
92
|
+
search_kwargs=self.search_kwargs,
|
|
93
|
+
chain_type=self.chain_type
|
|
94
|
+
)
|
|
95
|
+
# Pass the run_manager to the sub-retrievers if they support it
|
|
96
|
+
if hasattr(retriever, "_aget_relevant_documents"):
|
|
97
|
+
callback_manager = run_manager.get_child()
|
|
98
|
+
docs = await retriever._aget_relevant_documents(query, run_manager=callback_manager)
|
|
99
|
+
else:
|
|
48
100
|
docs = await retriever.aget_relevant_documents(query)
|
|
49
|
-
|
|
101
|
+
all_results.extend(docs)
|
|
50
102
|
return all_results
|
parrot/stores/abstract.py
CHANGED
|
@@ -230,11 +230,16 @@ class AbstractStore(ABC):
|
|
|
230
230
|
def as_retriever(
|
|
231
231
|
self,
|
|
232
232
|
metric_type: str = 'COSINE',
|
|
233
|
+
index_type: str = 'IVF_FLAT',
|
|
233
234
|
search_type: str = 'similarity',
|
|
234
235
|
chain_type: str = 'stuff',
|
|
235
236
|
search_kwargs: dict = None
|
|
236
237
|
) -> Callable:
|
|
237
|
-
vector = self.get_vector(metric_type=metric_type)
|
|
238
|
+
vector = self.get_vector(metric_type=metric_type, index_type=index_type)
|
|
239
|
+
if not vector:
|
|
240
|
+
raise ConfigError(
|
|
241
|
+
"Vector Store is not connected. Check your connection."
|
|
242
|
+
)
|
|
238
243
|
return VectorStoreRetriever(
|
|
239
244
|
vectorstore=vector,
|
|
240
245
|
search_type=search_type,
|
parrot/stores/milvus.py
CHANGED
|
@@ -251,6 +251,7 @@ class MilvusStore(AbstractStore):
|
|
|
251
251
|
self,
|
|
252
252
|
collection: Union[str, None] = None,
|
|
253
253
|
metric_type: str = None,
|
|
254
|
+
index_type: str = None,
|
|
254
255
|
nprobe: int = 32,
|
|
255
256
|
metadata_field: str = None,
|
|
256
257
|
consistency_level: str = 'session'
|
|
@@ -261,10 +262,11 @@ class MilvusStore(AbstractStore):
|
|
|
261
262
|
collection = self.collection_name
|
|
262
263
|
if not metric_type:
|
|
263
264
|
metric_type = self._metric_type or 'COSINE'
|
|
265
|
+
_idx = index_type or self._index_type
|
|
264
266
|
_search = {
|
|
265
267
|
"search_params": {
|
|
266
268
|
"metric_type": metric_type,
|
|
267
|
-
"index_type":
|
|
269
|
+
"index_type": _idx,
|
|
268
270
|
"params": {"nprobe": nprobe, "nlist": 1024},
|
|
269
271
|
}
|
|
270
272
|
}
|
parrot/version.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
__title__ = "ai-parrot"
|
|
4
4
|
__description__ = "Live Chatbots based on Langchain chatbots and Agents \
|
|
5
5
|
Integrated into Navigator Framework or used into any aiohttp applications."
|
|
6
|
-
__version__ = "0.5.
|
|
6
|
+
__version__ = "0.5.10"
|
|
7
7
|
__author__ = "Jesus Lara"
|
|
8
8
|
__author_email__ = "jesuslarag@gmail.com"
|
|
9
9
|
__license__ = "MIT"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|