ai-parrot 0.5.10__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.10.dist-info → ai_parrot-0.5.12.dist-info}/METADATA +1 -1
- {ai_parrot-0.5.10.dist-info → ai_parrot-0.5.12.dist-info}/RECORD +9 -9
- parrot/bots/abstract.py +6 -0
- parrot/bots/chatbot.py +3 -0
- parrot/bots/retrievals/multi.py +57 -36
- parrot/version.py +1 -1
- {ai_parrot-0.5.10.dist-info → ai_parrot-0.5.12.dist-info}/LICENSE +0 -0
- {ai_parrot-0.5.10.dist-info → ai_parrot-0.5.12.dist-info}/WHEEL +0 -0
- {ai_parrot-0.5.10.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,14 +4,14 @@ 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
|
|
13
13
|
parrot/bots/bose.py,sha256=gQQzAgt6wxGshihdr5H9_G4ns0lth814IkL7x1Ukjd4,759
|
|
14
|
-
parrot/bots/chatbot.py,sha256=
|
|
14
|
+
parrot/bots/chatbot.py,sha256=E7pz0duU2-qrbo9QzvwM_Gfw2OtpcWziXvEZmfWfPeo,10201
|
|
15
15
|
parrot/bots/cody.py,sha256=gPQPRcn7QNJfTF0zWI9i6K-PhyAG6PBVcoCxdvylRdI,616
|
|
16
16
|
parrot/bots/copilot.py,sha256=PDK1Hj3TmxHgZT0rAplMnbbDkmV51B9tTstWWQjsLFM,2795
|
|
17
17
|
parrot/bots/dataframe.py,sha256=CfZiLKIwnaku52nl2PNjciqRlH8m2lM4buO6xI7P408,3914
|
|
@@ -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
|
@@ -466,6 +466,7 @@ class AbstractBot(DBInterface, ABC):
|
|
|
466
466
|
|
|
467
467
|
def configure_store(self, **kwargs):
|
|
468
468
|
# TODO: Implement VectorStore Configuration
|
|
469
|
+
print('SELF > ', self._vector_store)
|
|
469
470
|
if isinstance(self._vector_store, list):
|
|
470
471
|
# Is a list of vector stores instances:
|
|
471
472
|
for st in self._vector_store:
|
|
@@ -476,6 +477,7 @@ class AbstractBot(DBInterface, ABC):
|
|
|
476
477
|
except ImportError:
|
|
477
478
|
continue
|
|
478
479
|
elif isinstance(self._vector_store, dict):
|
|
480
|
+
print('< ENTERING HERE > ', )
|
|
479
481
|
# Is a single vector store instance:
|
|
480
482
|
store_cls = self._get_database_store(self._vector_store)
|
|
481
483
|
store_cls.use_database = self._use_vector
|
|
@@ -487,6 +489,10 @@ class AbstractBot(DBInterface, ABC):
|
|
|
487
489
|
self.logger.info(f"Configured Vector Stores: {self.stores}")
|
|
488
490
|
if self.stores:
|
|
489
491
|
self.store = self.stores[0]
|
|
492
|
+
print('=================================')
|
|
493
|
+
print('END STORES >> ', self.stores, self.store)
|
|
494
|
+
print('=================================')
|
|
495
|
+
|
|
490
496
|
|
|
491
497
|
def get_memory(
|
|
492
498
|
self,
|
parrot/bots/chatbot.py
CHANGED
|
@@ -244,6 +244,9 @@ class Chatbot(AbstractBot):
|
|
|
244
244
|
vector_db = database.pop('vector_database', None)
|
|
245
245
|
# configure vector database:
|
|
246
246
|
if vector_db:
|
|
247
|
+
# Initialize the store:
|
|
248
|
+
self.stores = []
|
|
249
|
+
self.store = None
|
|
247
250
|
self._use_vector = vector_store
|
|
248
251
|
self._vector_store = database
|
|
249
252
|
self.configure_store()
|
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
|