igbot-base 0.0.36__py3-none-any.whl → 0.0.39__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.
@@ -0,0 +1,17 @@
1
+ from pydantic.v1 import BaseModel
2
+ from typing import Any, Dict, Optional
3
+
4
+ class AdditionalData(BaseModel):
5
+ data: Dict[str, Any]
6
+
7
+ def get(self, key: str) -> Optional[Any]:
8
+ """
9
+ Get the value associated with the key, or return None if the key doesn't exist.
10
+
11
+ :param key: The key to look for in the dictionary.
12
+ :return: The value associated with the key, or None.
13
+ """
14
+ return self.data.get(key)
15
+
16
+
17
+ EMPTY = AdditionalData(data={})
igbot_base/agent.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from abc import ABC, abstractmethod
2
2
 
3
+ from igbot_base.additional_data import AdditionalData, EMPTY
3
4
  from igbot_base.agent_response import AgentResponse
4
5
 
5
6
  from igbot_base.exception_handler import ExceptionHandler, ReturnFailedResponseGracefully
@@ -30,7 +31,7 @@ class Agent(ABC):
30
31
  return self.__ex_handler.handle(e)
31
32
 
32
33
  @abstractmethod
33
- def _invoke(self, query, memory: LlmMemory) -> AgentResponse:
34
+ def _invoke(self, query, memory: LlmMemory, params: AdditionalData = EMPTY) -> AgentResponse:
34
35
  pass
35
36
 
36
37
  @abstractmethod
igbot_base/llm.py CHANGED
@@ -2,6 +2,7 @@ from abc import ABC, abstractmethod
2
2
  from builtins import dict
3
3
  from typing import Optional
4
4
 
5
+ from igbot_base.additional_data import AdditionalData, EMPTY
5
6
  from igbot_base.exception_handler import ExceptionHandler, NoopExceptionHandler
6
7
  from igbot_base.llmmemory import LlmMemory
7
8
  from igbot_base.models import Model
@@ -31,7 +32,7 @@ class Llm(ABC):
31
32
  return f"Llm({self._name} {self._model.value.get_name()})"
32
33
 
33
34
  @abstractmethod
34
- def _call(self, user_query: str, history: LlmMemory, params: dict) -> str:
35
+ def _call(self, user_query: str, history: LlmMemory, params: dict, additonal_data: AdditionalData = EMPTY) -> str:
35
36
  pass
36
37
 
37
38
  @abstractmethod
igbot_base/tool.py CHANGED
@@ -1,5 +1,12 @@
1
1
  from abc import ABC, abstractmethod
2
+ from typing import Any, Optional, Callable
2
3
 
4
+ from pydantic import BaseModel
5
+
6
+
7
+ class ToolResponse(BaseModel):
8
+ message: Optional[str] = None
9
+ data: Optional[Any] = None
3
10
 
4
11
  class Tool(ABC):
5
12
 
@@ -12,7 +19,7 @@ class Tool(ABC):
12
19
  return self._name
13
20
 
14
21
  @abstractmethod
15
- def get_function(self):
22
+ def get_function(self) -> Callable[..., ToolResponse]:
16
23
  pass
17
24
 
18
25
  @abstractmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: igbot_base
3
- Version: 0.0.36
3
+ Version: 0.0.39
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
@@ -1,9 +1,10 @@
1
1
  igbot_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- igbot_base/agent.py,sha256=yrZ4XSrR50g0xNpkUCnkgxljA8lOZnp8XqRMtNAss1M,1483
2
+ igbot_base/additional_data.py,sha256=CbuT4m4l4Kw_7yUVAyPpMMct0ED3yF91JVo79vqnXik,479
3
+ igbot_base/agent.py,sha256=pdDPQIg60V9bpT_VQQjEQXZNoaxRlk_82HB-ffg24ro,1576
3
4
  igbot_base/agent_response.py,sha256=ujLaFkIw9he-X1YFIICTJvq_4pmzTvTF4txEfeZtKSA,1041
4
5
  igbot_base/base_exception.py,sha256=uRZXwYdsER2y_Rlah1TaSXwR6Kb9t2lNyngar0p5YFk,2146
5
6
  igbot_base/exception_handler.py,sha256=Er5LbNt2ga2-e0GSzkJw66E-NS1dN_2msTRyyac1qX8,536
6
- igbot_base/llm.py,sha256=dBZo7utmmy1BJM34SMujP8iyidJnU6c1iAjLNhwYz2E,3071
7
+ igbot_base/llm.py,sha256=0i0VVtvLafH_tqpvtNMvmULj4vkoKCrntXFkiimMifI,3172
7
8
  igbot_base/llmmemory.py,sha256=eMjkjFMKgyAqpM7-q3xzQAP6gDeNfkpPkb9MK1hN8iY,1157
8
9
  igbot_base/logging_adapter.py,sha256=kMuAaQPCba2luk0-WPxAbPNJaBL1yZsaff35ltKWgww,256
9
10
  igbot_base/models.py,sha256=kbscj0jTNkJu9cglEQILjdOWJuwD3pZ0Q1rxz2q7tg8,1370
@@ -13,9 +14,9 @@ igbot_base/prompt_template.py,sha256=q7bnU2Rp2Cvm4ixEmKHCyuolTPan6CHfYVAomT5kp10
13
14
  igbot_base/response_formats.py,sha256=Sp679VfkcyxsR19ddFEHTOM7Ox0u2WBhdji_Y9pVc2M,94
14
15
  igbot_base/retriever.py,sha256=YHBHxiuPttsIAtjwwIz0fa9q2uFtsg0WoMRCorCt1PM,635
15
16
  igbot_base/tokenizer.py,sha256=WSR0GFc1eoMmyL58RAxtpb2iWCrqu9vQ2Ui-hqs4plw,1032
16
- igbot_base/tool.py,sha256=ghjuU3cK_VElHGStUl3IYf9dlRDOGM_aQucUQNUH3mU,431
17
+ igbot_base/tool.py,sha256=r0YV9KDVLyXyt2TnC4RLxK0r0llFPgDNwXw5TfhH_JA,634
17
18
  igbot_base/vectorstore.py,sha256=f-S9DmOuehC0rtVAPGz22Guo7ddb1jVw7BygzFJM624,928
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,,
19
+ igbot_base-0.0.39.dist-info/METADATA,sha256=0tx5AFH4T3wXbLg6hvVBiRtvZmeiA1sNt4MVeV7t43Y,235
20
+ igbot_base-0.0.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ igbot_base-0.0.39.dist-info/top_level.txt,sha256=RGpEN0pLsnfNLoLfpw1D_nLSyZwi3ggSaDq07o4ZEAI,11
22
+ igbot_base-0.0.39.dist-info/RECORD,,