igbot-base 0.0.35__py3-none-any.whl → 0.0.36__py3-none-any.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.
igbot_base/llm.py CHANGED
@@ -34,6 +34,10 @@ class Llm(ABC):
34
34
  def _call(self, user_query: str, history: LlmMemory, params: dict) -> str:
35
35
  pass
36
36
 
37
+ @abstractmethod
38
+ def _add_llm_message(self, user_query: str, history: LlmMemory, params: dict) -> str:
39
+ pass
40
+
37
41
  def _revert_memory(self, history: LlmMemory):
38
42
  history.revert_to_snapshot()
39
43
 
@@ -51,6 +55,20 @@ class Llm(ABC):
51
55
  self._exception_handler.handle(e)
52
56
  raise BaseLlmException(f"Exception occurred while calling llm api", self, e)
53
57
 
58
+ def add_llm_message(self, llm_message: str, history: LlmMemory, params: dict) -> str:
59
+ logger.debug("Call to %s with llm message: %s", self.__str__(), llm_message)
60
+ history.set_snapshot()
61
+ try:
62
+ response = self._add_llm_message(llm_message, history, params)
63
+ logger.debug("LLM %s %s responded: %s", self._name, self._model.value.get_name(), response)
64
+ return response
65
+ except Exception as e:
66
+ logger.error("Error occurred in LLM %s, Model %s at calling the API: %s",
67
+ self._name, self._model.value.get_name(), e)
68
+ self._revert_memory(history)
69
+ self._exception_handler.handle(e)
70
+ raise BaseLlmException(f"Exception occurred while calling llm api", self, e)
71
+
54
72
  def get_additional_llm_args(self):
55
73
  args = {}
56
74
  if self._temperature is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: igbot_base
3
- Version: 0.0.35
3
+ Version: 0.0.36
4
4
  Summary: Base classes for igbot
5
5
  Author-email: Igor Kopeć <igor.kopec95@gmail.com>
6
6
  License: LGPL-3.0-or-later
@@ -3,7 +3,7 @@ igbot_base/agent.py,sha256=yrZ4XSrR50g0xNpkUCnkgxljA8lOZnp8XqRMtNAss1M,1483
3
3
  igbot_base/agent_response.py,sha256=ujLaFkIw9he-X1YFIICTJvq_4pmzTvTF4txEfeZtKSA,1041
4
4
  igbot_base/base_exception.py,sha256=uRZXwYdsER2y_Rlah1TaSXwR6Kb9t2lNyngar0p5YFk,2146
5
5
  igbot_base/exception_handler.py,sha256=Er5LbNt2ga2-e0GSzkJw66E-NS1dN_2msTRyyac1qX8,536
6
- igbot_base/llm.py,sha256=0zul2Q3aiCpdhcLbTcpdSPkLdX7Dvwhhiv2V_KH7YRo,2157
6
+ igbot_base/llm.py,sha256=dBZo7utmmy1BJM34SMujP8iyidJnU6c1iAjLNhwYz2E,3071
7
7
  igbot_base/llmmemory.py,sha256=eMjkjFMKgyAqpM7-q3xzQAP6gDeNfkpPkb9MK1hN8iY,1157
8
8
  igbot_base/logging_adapter.py,sha256=kMuAaQPCba2luk0-WPxAbPNJaBL1yZsaff35ltKWgww,256
9
9
  igbot_base/models.py,sha256=kbscj0jTNkJu9cglEQILjdOWJuwD3pZ0Q1rxz2q7tg8,1370
@@ -15,7 +15,7 @@ igbot_base/retriever.py,sha256=YHBHxiuPttsIAtjwwIz0fa9q2uFtsg0WoMRCorCt1PM,635
15
15
  igbot_base/tokenizer.py,sha256=WSR0GFc1eoMmyL58RAxtpb2iWCrqu9vQ2Ui-hqs4plw,1032
16
16
  igbot_base/tool.py,sha256=ghjuU3cK_VElHGStUl3IYf9dlRDOGM_aQucUQNUH3mU,431
17
17
  igbot_base/vectorstore.py,sha256=f-S9DmOuehC0rtVAPGz22Guo7ddb1jVw7BygzFJM624,928
18
- igbot_base-0.0.35.dist-info/METADATA,sha256=4yed4GWeLRSXW96vrlBHo7fyb5EbXtRmUMcZPxZm00Y,235
19
- igbot_base-0.0.35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- igbot_base-0.0.35.dist-info/top_level.txt,sha256=RGpEN0pLsnfNLoLfpw1D_nLSyZwi3ggSaDq07o4ZEAI,11
21
- igbot_base-0.0.35.dist-info/RECORD,,
18
+ igbot_base-0.0.36.dist-info/METADATA,sha256=NC8x8EdzFLTvGUqSbv3L_odPpTIZOfl7GwuwjCXmfVQ,235
19
+ igbot_base-0.0.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ igbot_base-0.0.36.dist-info/top_level.txt,sha256=RGpEN0pLsnfNLoLfpw1D_nLSyZwi3ggSaDq07o4ZEAI,11
21
+ igbot_base-0.0.36.dist-info/RECORD,,