ai-parrot 0.5.11__cp311-cp311-manylinux_2_28_x86_64.whl → 0.5.12__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.11.dist-info → ai_parrot-0.5.12.dist-info}/METADATA +1 -1
- {ai_parrot-0.5.11.dist-info → ai_parrot-0.5.12.dist-info}/RECORD +8 -8
- parrot/bots/abstract.py +5 -0
- parrot/bots/retrievals/multi.py +57 -36
- parrot/version.py +1 -1
- {ai_parrot-0.5.11.dist-info → ai_parrot-0.5.12.dist-info}/LICENSE +0 -0
- {ai_parrot-0.5.11.dist-info → ai_parrot-0.5.12.dist-info}/WHEEL +0 -0
- {ai_parrot-0.5.11.dist-info → ai_parrot-0.5.12.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.12
|
|
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=ocgzUZHJ4MXLtVKHnONHZUfuD_VQd8N3xw73-gr6wLA,378
|
|
8
8
|
parrot/bots/__init__.py,sha256=qD-WOn8n34VUCp7Mq6Mq1lZV8h_cKAeXQxn27UtBDP4,153
|
|
9
|
-
parrot/bots/abstract.py,sha256=
|
|
9
|
+
parrot/bots/abstract.py,sha256=EO7eq-CbR2xaBZoqRhYUcXYt66RwKXhSnxXhoCmYUXk,36088
|
|
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=qn5Ml4KK0d8RqZhkXGCLYDKYOicIbgLDjqAeysWv3ls,4951
|
|
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
|
|
@@ -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.12.dist-info/LICENSE,sha256=vRKOoa7onTsLNvSzJtGtMaNhWWh8B3YAT733Tlu6M4o,1070
|
|
148
|
+
ai_parrot-0.5.12.dist-info/METADATA,sha256=uTQuV_HZPiAA3HFYtKvrU-SKB8C0J9UYkxiTVeqUySY,9716
|
|
149
|
+
ai_parrot-0.5.12.dist-info/WHEEL,sha256=lNWVJ6q28SO2kTKDIyc1kQ-4wE2w5snxBQXSv06oiUw,113
|
|
150
|
+
ai_parrot-0.5.12.dist-info/top_level.txt,sha256=VCLpdIu_5wkShgIQjK85jFzL9HEVVjAqlQa_gupLekI,17
|
|
151
|
+
ai_parrot-0.5.12.dist-info/RECORD,,
|
parrot/bots/abstract.py
CHANGED
|
@@ -477,6 +477,7 @@ class AbstractBot(DBInterface, ABC):
|
|
|
477
477
|
except ImportError:
|
|
478
478
|
continue
|
|
479
479
|
elif isinstance(self._vector_store, dict):
|
|
480
|
+
print('< ENTERING HERE > ', )
|
|
480
481
|
# Is a single vector store instance:
|
|
481
482
|
store_cls = self._get_database_store(self._vector_store)
|
|
482
483
|
store_cls.use_database = self._use_vector
|
|
@@ -488,6 +489,10 @@ class AbstractBot(DBInterface, ABC):
|
|
|
488
489
|
self.logger.info(f"Configured Vector Stores: {self.stores}")
|
|
489
490
|
if self.stores:
|
|
490
491
|
self.store = self.stores[0]
|
|
492
|
+
print('=================================')
|
|
493
|
+
print('END STORES >> ', self.stores, self.store)
|
|
494
|
+
print('=================================')
|
|
495
|
+
|
|
491
496
|
|
|
492
497
|
def get_memory(
|
|
493
498
|
self,
|
parrot/bots/retrievals/multi.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from typing import List, Dict, Any, Optional
|
|
2
|
+
from collections.abc import Callable
|
|
2
3
|
from langchain_core.retrievers import BaseRetriever
|
|
3
4
|
from langchain_core.callbacks import CallbackManagerForRetrieverRun
|
|
4
5
|
from langchain_core.documents import Document
|
|
5
|
-
|
|
6
|
+
from pydantic import Field
|
|
6
7
|
|
|
7
8
|
class MultiVectorStoreRetriever(BaseRetriever):
|
|
8
9
|
"""
|
|
@@ -10,11 +11,16 @@ class MultiVectorStoreRetriever(BaseRetriever):
|
|
|
10
11
|
and merges the results into a single list.
|
|
11
12
|
"""
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
# Define class attributes with default values
|
|
15
|
+
stores: List[Any] = Field(description="List of vector stores that provide an as_retriever() method")
|
|
16
|
+
search_kwargs: Dict[str, Any] = Field(default_factory=dict, description="Dict to pass to each store's retrieve method (like 'k' for top_k)")
|
|
17
|
+
chain_type: str = Field(default="stuff", description="Chain type for the retriever")
|
|
18
|
+
search_type: str = Field(default="similarity", description="Search type (similarity, mmr)")
|
|
19
|
+
metric_type: str = Field(default="COSINE", description="Similarity metric (COSINE, EUCLIDEAN, DOT_PRODUCT)")
|
|
20
|
+
|
|
21
|
+
class Config:
|
|
22
|
+
"""Configuration for this pydantic object."""
|
|
23
|
+
arbitrary_types_allowed = True
|
|
18
24
|
|
|
19
25
|
def __init__(
|
|
20
26
|
self,
|
|
@@ -23,6 +29,7 @@ class MultiVectorStoreRetriever(BaseRetriever):
|
|
|
23
29
|
chain_type: str = 'stuff',
|
|
24
30
|
search_type: str = 'similarity',
|
|
25
31
|
search_kwargs: Optional[Dict[str, Any]] = None,
|
|
32
|
+
**kwargs
|
|
26
33
|
):
|
|
27
34
|
"""
|
|
28
35
|
Initialize the MultiVectorStoreRetriever.
|
|
@@ -34,12 +41,18 @@ class MultiVectorStoreRetriever(BaseRetriever):
|
|
|
34
41
|
search_type: Search type (similarity, mmr)
|
|
35
42
|
search_kwargs: Dict to pass to each store's retrieve method (like 'k' for top_k)
|
|
36
43
|
"""
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
# Initialize with default values
|
|
45
|
+
search_kwargs = search_kwargs or {}
|
|
46
|
+
|
|
47
|
+
# Call super().__init__ with all properties
|
|
48
|
+
super().__init__(
|
|
49
|
+
stores=stores,
|
|
50
|
+
search_kwargs=search_kwargs,
|
|
51
|
+
chain_type=chain_type,
|
|
52
|
+
search_type=search_type,
|
|
53
|
+
metric_type=metric_type,
|
|
54
|
+
**kwargs
|
|
55
|
+
)
|
|
43
56
|
|
|
44
57
|
def _get_relevant_documents(
|
|
45
58
|
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
|
|
@@ -57,18 +70,22 @@ class MultiVectorStoreRetriever(BaseRetriever):
|
|
|
57
70
|
"""
|
|
58
71
|
all_results = []
|
|
59
72
|
for store in self.stores:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
try:
|
|
74
|
+
retriever = store.as_retriever(
|
|
75
|
+
search_type=self.search_type,
|
|
76
|
+
search_kwargs=self.search_kwargs,
|
|
77
|
+
)
|
|
78
|
+
# Pass the run_manager to the sub-retrievers if they support it
|
|
79
|
+
if hasattr(retriever, "_get_relevant_documents"):
|
|
80
|
+
callback_manager = run_manager.get_child()
|
|
81
|
+
docs = retriever._get_relevant_documents(query, run_manager=callback_manager)
|
|
82
|
+
else:
|
|
83
|
+
docs = retriever.get_relevant_documents(query)
|
|
84
|
+
all_results.extend(docs)
|
|
85
|
+
except Exception as e:
|
|
86
|
+
# Log the error but continue with other stores
|
|
87
|
+
run_manager.on_retriever_error(f"Error retrieving from store: {str(e)}")
|
|
88
|
+
continue
|
|
72
89
|
return all_results
|
|
73
90
|
|
|
74
91
|
async def _aget_relevant_documents(
|
|
@@ -87,16 +104,20 @@ class MultiVectorStoreRetriever(BaseRetriever):
|
|
|
87
104
|
"""
|
|
88
105
|
all_results = []
|
|
89
106
|
for store in self.stores:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
try:
|
|
108
|
+
retriever = store.as_retriever(
|
|
109
|
+
search_type=self.search_type,
|
|
110
|
+
search_kwargs=self.search_kwargs,
|
|
111
|
+
)
|
|
112
|
+
# Pass the run_manager to the sub-retrievers if they support it
|
|
113
|
+
if hasattr(retriever, "_aget_relevant_documents"):
|
|
114
|
+
callback_manager = run_manager.get_child()
|
|
115
|
+
docs = await retriever._aget_relevant_documents(query, run_manager=callback_manager)
|
|
116
|
+
else:
|
|
117
|
+
docs = await retriever.aget_relevant_documents(query)
|
|
118
|
+
all_results.extend(docs)
|
|
119
|
+
except Exception as e:
|
|
120
|
+
# Log the error but continue with other stores
|
|
121
|
+
run_manager.on_retriever_error(f"Error retrieving from store: {str(e)}")
|
|
122
|
+
continue
|
|
102
123
|
return all_results
|
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.12"
|
|
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
|