ai-parrot 0.5.12__cp311-cp311-manylinux_2_28_x86_64.whl → 0.5.14__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ai-parrot
3
- Version: 0.5.12
3
+ Version: 0.5.14
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
@@ -1,12 +1,12 @@
1
1
  parrot/__init__.py,sha256=eTkAkHeJ5BBDG2fxrXA4M37ODBJoS1DQYpeBAWL2xeI,387
2
2
  parrot/conf.py,sha256=BBbArVYjcGGaNKw3_h1dOw_pl1qcYNuT6Sj6dINwJd8,5404
3
3
  parrot/exceptions.cpython-311-x86_64-linux-gnu.so,sha256=1tKBneucxl6ShNqI8KS4-pa9G-YQw9kXCnqUB-n2tbc,361184
4
- parrot/manager.py,sha256=E1OdoNnZh1qCqVgZzcp8rdRnE1-xRwyQ6d1nFcOmg3U,6527
4
+ parrot/manager.py,sha256=JNE6vY1H2PvpVeKzLv18uXTY9u5rb-JvmKSx-aIH1y4,6618
5
5
  parrot/models.py,sha256=MT88rYdITenwTuyCfeqHqaNf49rieAKz43R2TibN7G8,14314
6
6
  parrot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- parrot/version.py,sha256=ocgzUZHJ4MXLtVKHnONHZUfuD_VQd8N3xw73-gr6wLA,378
7
+ parrot/version.py,sha256=hhUcCDigRFpD1xGNG4vekpgZxvQKfpPpOIlOCACvoZ0,378
8
8
  parrot/bots/__init__.py,sha256=qD-WOn8n34VUCp7Mq6Mq1lZV8h_cKAeXQxn27UtBDP4,153
9
- parrot/bots/abstract.py,sha256=EO7eq-CbR2xaBZoqRhYUcXYt66RwKXhSnxXhoCmYUXk,36088
9
+ parrot/bots/abstract.py,sha256=YH2XAHMlPCcc1q2V6RvZWkpAreHCqoDNnXATRPg8-5Y,36219
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=qn5Ml4KK0d8RqZhkXGCLYDKYOicIbgLDjqAeysWv3ls,4951
27
+ parrot/bots/retrievals/multi.py,sha256=92exQXAU5B2gk0uA9dAJnZMwFldPcarcQzLo-iEZy6o,4990
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.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,,
147
+ ai_parrot-0.5.14.dist-info/LICENSE,sha256=vRKOoa7onTsLNvSzJtGtMaNhWWh8B3YAT733Tlu6M4o,1070
148
+ ai_parrot-0.5.14.dist-info/METADATA,sha256=kIekwFxKW7hsvo_yzplt0uy0j2qk0OJWCauU8b9_k0w,9716
149
+ ai_parrot-0.5.14.dist-info/WHEEL,sha256=lNWVJ6q28SO2kTKDIyc1kQ-4wE2w5snxBQXSv06oiUw,113
150
+ ai_parrot-0.5.14.dist-info/top_level.txt,sha256=VCLpdIu_5wkShgIQjK85jFzL9HEVVjAqlQa_gupLekI,17
151
+ ai_parrot-0.5.14.dist-info/RECORD,,
parrot/bots/abstract.py CHANGED
@@ -486,7 +486,9 @@ class AbstractBot(DBInterface, ABC):
486
486
  raise ValueError(
487
487
  f"Invalid Vector Store Config: {self._vector_store}"
488
488
  )
489
- self.logger.info(f"Configured Vector Stores: {self.stores}")
489
+ self.logger.info(
490
+ f"Configured Vector Stores: {self.stores}"
491
+ )
490
492
  if self.stores:
491
493
  self.store = self.stores[0]
492
494
  print('=================================')
@@ -538,11 +540,12 @@ class AbstractBot(DBInterface, ABC):
538
540
  f"Error clearing chat history: {e}"
539
541
  )
540
542
 
541
- def get_response(self, response: dict):
543
+ def get_response(self, response: dict, query: str = None):
542
544
  if 'error' in response:
543
545
  return response # return this error directly
544
546
  try:
545
547
  response = ChatResponse(**response)
548
+ response.query = query
546
549
  response.response = self.as_markdown(
547
550
  response,
548
551
  return_sources=self.return_sources
@@ -695,15 +698,15 @@ class AbstractBot(DBInterface, ABC):
695
698
  )
696
699
  # re-configure LLM:
697
700
  new_llm = kwargs.pop('llm', None)
698
- llm_config = kwargs.pop(
699
- 'llm_config',
700
- {
701
- "temperature": 0.2,
702
- "top_k": 30,
703
- "Top_p": 0.6
704
- }
705
- )
706
701
  if new_llm:
702
+ llm_config = kwargs.pop(
703
+ 'llm_config',
704
+ {
705
+ "temperature": 0.2,
706
+ "top_k": 30,
707
+ "Top_p": 0.6
708
+ }
709
+ )
707
710
  self.configure_llm(llm=new_llm, config=llm_config)
708
711
  # Combine into a ChatPromptTemplate
709
712
  prompt = PromptTemplate(
@@ -763,11 +766,11 @@ class AbstractBot(DBInterface, ABC):
763
766
  "query": question,
764
767
  "error": str(e)
765
768
  }
766
- return self.get_response(response)
769
+ return self.get_response(response, question)
767
770
 
768
771
  def as_markdown(self, response: ChatResponse, return_sources: bool = False) -> str:
769
772
  markdown_output = f"**Question**: {response.question} \n"
770
- markdown_output += f"**Answer**: {response.answer} \n"
773
+ markdown_output += f"**Answer**: \n {response.answer} \n"
771
774
  if return_sources is True and response.source_documents:
772
775
  source_documents = response.source_documents
773
776
  current_sources = []
@@ -1009,7 +1012,7 @@ class AbstractBot(DBInterface, ABC):
1009
1012
  response = await chain.ainvoke(
1010
1013
  {"question": question}
1011
1014
  )
1012
- return self.get_response(response)
1015
+ return self.get_response(response, question)
1013
1016
  except asyncio.CancelledError:
1014
1017
  # Handle task cancellation
1015
1018
  print("Conversation task was cancelled.")
@@ -13,11 +13,10 @@ class MultiVectorStoreRetriever(BaseRetriever):
13
13
 
14
14
  # Define class attributes with default values
15
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
-
16
+ search_kwargs: Optional[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: Optional[str] = Field(default="stuff", description="Chain type for the retriever")
18
+ search_type: Optional[str] = Field(default="similarity", description="Search type (similarity, mmr)")
19
+ metric_type: Optional[str] = Field(default="COSINE", description="Similarity metric (COSINE, EUCLIDEAN, DOT_PRODUCT)")
21
20
  class Config:
22
21
  """Configuration for this pydantic object."""
23
22
  arbitrary_types_allowed = True
parrot/manager.py CHANGED
@@ -61,7 +61,9 @@ class BotManager:
61
61
  f"Failed to load chatbots from DB: {e}"
62
62
  )
63
63
  return
64
+ print('HERE >>>>>> ', len(bots))
64
65
  for bot in bots:
66
+ print('CREATING BOT > ', bot)
65
67
  if bot.bot_type == 'chatbot':
66
68
  self.logger.notice(
67
69
  f"Loading chatbot '{bot.name}'..."
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.12"
6
+ __version__ = "0.5.14"
7
7
  __author__ = "Jesus Lara"
8
8
  __author_email__ = "jesuslarag@gmail.com"
9
9
  __license__ = "MIT"