ai-parrot 0.5.13__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.13
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
@@ -4,9 +4,9 @@ parrot/exceptions.cpython-311-x86_64-linux-gnu.so,sha256=1tKBneucxl6ShNqI8KS4-pa
4
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=aHBE_6_v6JpopyX_oKbxe3SHhZbdmyNey37ExnBxlCs,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=IVEXthWe-hR17LsJ8-Fa-I37D2gye5AlJ7qZrtLugsM,36110
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
@@ -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.13.dist-info/LICENSE,sha256=vRKOoa7onTsLNvSzJtGtMaNhWWh8B3YAT733Tlu6M4o,1070
148
- ai_parrot-0.5.13.dist-info/METADATA,sha256=vE_oi59f13e6dPb2wr1E5sv609OsORHePqtOfV9wRoY,9716
149
- ai_parrot-0.5.13.dist-info/WHEEL,sha256=lNWVJ6q28SO2kTKDIyc1kQ-4wE2w5snxBQXSv06oiUw,113
150
- ai_parrot-0.5.13.dist-info/top_level.txt,sha256=VCLpdIu_5wkShgIQjK85jFzL9HEVVjAqlQa_gupLekI,17
151
- ai_parrot-0.5.13.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
@@ -540,11 +540,12 @@ class AbstractBot(DBInterface, ABC):
540
540
  f"Error clearing chat history: {e}"
541
541
  )
542
542
 
543
- def get_response(self, response: dict):
543
+ def get_response(self, response: dict, query: str = None):
544
544
  if 'error' in response:
545
545
  return response # return this error directly
546
546
  try:
547
547
  response = ChatResponse(**response)
548
+ response.query = query
548
549
  response.response = self.as_markdown(
549
550
  response,
550
551
  return_sources=self.return_sources
@@ -697,15 +698,15 @@ class AbstractBot(DBInterface, ABC):
697
698
  )
698
699
  # re-configure LLM:
699
700
  new_llm = kwargs.pop('llm', None)
700
- llm_config = kwargs.pop(
701
- 'llm_config',
702
- {
703
- "temperature": 0.2,
704
- "top_k": 30,
705
- "Top_p": 0.6
706
- }
707
- )
708
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
+ )
709
710
  self.configure_llm(llm=new_llm, config=llm_config)
710
711
  # Combine into a ChatPromptTemplate
711
712
  prompt = PromptTemplate(
@@ -765,11 +766,11 @@ class AbstractBot(DBInterface, ABC):
765
766
  "query": question,
766
767
  "error": str(e)
767
768
  }
768
- return self.get_response(response)
769
+ return self.get_response(response, question)
769
770
 
770
771
  def as_markdown(self, response: ChatResponse, return_sources: bool = False) -> str:
771
772
  markdown_output = f"**Question**: {response.question} \n"
772
- markdown_output += f"**Answer**: {response.answer} \n"
773
+ markdown_output += f"**Answer**: \n {response.answer} \n"
773
774
  if return_sources is True and response.source_documents:
774
775
  source_documents = response.source_documents
775
776
  current_sources = []
@@ -1011,7 +1012,7 @@ class AbstractBot(DBInterface, ABC):
1011
1012
  response = await chain.ainvoke(
1012
1013
  {"question": question}
1013
1014
  )
1014
- return self.get_response(response)
1015
+ return self.get_response(response, question)
1015
1016
  except asyncio.CancelledError:
1016
1017
  # Handle task cancellation
1017
1018
  print("Conversation task was cancelled.")
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.13"
6
+ __version__ = "0.5.14"
7
7
  __author__ = "Jesus Lara"
8
8
  __author_email__ = "jesuslarag@gmail.com"
9
9
  __license__ = "MIT"