igbot-base 0.0.10__tar.gz → 0.0.11__tar.gz

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.
Files changed (29) hide show
  1. {igbot_base-0.0.10 → igbot_base-0.0.11}/PKG-INFO +1 -1
  2. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/agent.py +8 -1
  3. igbot_base-0.0.11/igbot_base/exception/agent_exception.py +14 -0
  4. igbot_base-0.0.11/igbot_base/exception/base_exception.py +12 -0
  5. igbot_base-0.0.11/igbot_base/exception/llm_exception.py +13 -0
  6. igbot_base-0.0.11/igbot_base/exception/memory_exception.py +14 -0
  7. igbot_base-0.0.11/igbot_base/exception/prompt_exception.py +14 -0
  8. igbot_base-0.0.11/igbot_base/exception/retriever_exception.py +14 -0
  9. igbot_base-0.0.11/igbot_base/exception/tool_exception.py +14 -0
  10. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/llm.py +4 -0
  11. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/llmmemory.py +7 -0
  12. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/prompt_template.py +3 -0
  13. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/retriever.py +7 -0
  14. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/tool.py +7 -0
  15. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base.egg-info/PKG-INFO +1 -1
  16. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base.egg-info/SOURCES.txt +8 -1
  17. {igbot_base-0.0.10 → igbot_base-0.0.11}/pyproject.toml +1 -1
  18. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/__init__.py +0 -0
  19. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/agent_response.py +0 -0
  20. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/exception_handler.py +0 -0
  21. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/logging_adapter.py +0 -0
  22. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/models.py +0 -0
  23. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/persistable_memory.py +0 -0
  24. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/response_formats.py +0 -0
  25. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base/vectorstore.py +0 -0
  26. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base.egg-info/dependency_links.txt +0 -0
  27. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base.egg-info/requires.txt +0 -0
  28. {igbot_base-0.0.10 → igbot_base-0.0.11}/igbot_base.egg-info/top_level.txt +0 -0
  29. {igbot_base-0.0.10 → igbot_base-0.0.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: igbot_base
3
- Version: 0.0.10
3
+ Version: 0.0.11
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
@@ -7,4 +7,11 @@ class Agent(ABC):
7
7
 
8
8
  @abstractmethod
9
9
  def invoke(self, query) -> AgentResponse:
10
- pass
10
+ pass
11
+
12
+ @abstractmethod
13
+ def describe(self):
14
+ pass
15
+
16
+ def __str__(self):
17
+ return self.describe()
@@ -0,0 +1,14 @@
1
+ from igbot_base.agent import Agent
2
+ from igbot_base.exception.base_exception import IgBotBaseException
3
+
4
+
5
+ class BaseAgentException(IgBotBaseException):
6
+
7
+ def __init__(self, message, agent: Agent, cause: Exception = None):
8
+ super().__init__(message, cause)
9
+ self.agent = agent
10
+
11
+ def __str__(self):
12
+ result = super().__str__()
13
+ result += f" at agent {self.agent}"
14
+
@@ -0,0 +1,12 @@
1
+ class IgBotBaseException(Exception):
2
+
3
+ def __init__(self, message, cause: Exception = None):
4
+ super().__init__(message)
5
+ self.cause = cause
6
+
7
+ def __str__(self):
8
+ result = self.args[0]
9
+ if self.cause:
10
+ result += f" Caused by: {self.cause}"
11
+
12
+ return result
@@ -0,0 +1,13 @@
1
+ from igbot_base.exception.base_exception import IgBotBaseException
2
+ from igbot_base.llm import Llm
3
+
4
+
5
+ class BaseLlmException(IgBotBaseException):
6
+
7
+ def __init__(self, message, llm: Llm, cause: Exception = None):
8
+ super().__init__(message, cause)
9
+ self.llm = llm
10
+
11
+ def __str__(self):
12
+ result = super().__str__()
13
+ result += f" at llm {self.llm}"
@@ -0,0 +1,14 @@
1
+ from igbot_base.exception.base_exception import IgBotBaseException
2
+ from igbot_base.llmmemory import LlmMemory
3
+
4
+
5
+ class BaseMemoryException(IgBotBaseException):
6
+
7
+ def __init__(self, message, memory: LlmMemory, cause: Exception = None):
8
+ super().__init__(message, cause)
9
+ self.memory = memory
10
+
11
+ def __str__(self):
12
+ result = super().__str__()
13
+ result += f" at memory {self.memory}"
14
+
@@ -0,0 +1,14 @@
1
+ from igbot_base.exception.base_exception import IgBotBaseException
2
+ from igbot_base.prompt_template import Prompt
3
+
4
+
5
+ class BasePromptException(IgBotBaseException):
6
+
7
+ def __init__(self, message, prompt: Prompt, cause: Exception = None):
8
+ super().__init__(message, cause)
9
+ self.prompt = prompt
10
+
11
+ def __str__(self):
12
+ result = super().__str__()
13
+ result += f" at prompt {self.prompt}"
14
+
@@ -0,0 +1,14 @@
1
+ from igbot_base.exception.base_exception import IgBotBaseException
2
+ from igbot_base.retriever import Retriever
3
+
4
+
5
+ class BaseRetrieverException(IgBotBaseException):
6
+
7
+ def __init__(self, message, retriever: Retriever, cause: Exception = None):
8
+ super().__init__(message, cause)
9
+ self.retriever = retriever
10
+
11
+ def __str__(self):
12
+ result = super().__str__()
13
+ result += f" at retriever {self.retriever}"
14
+
@@ -0,0 +1,14 @@
1
+ from igbot_base.exception.base_exception import IgBotBaseException
2
+ from igbot_base.tool import Tool
3
+
4
+
5
+ class BaseToolException(IgBotBaseException):
6
+
7
+ def __init__(self, message, tool: Tool, cause: Exception = None):
8
+ super().__init__(message, cause)
9
+ self.tool = tool
10
+
11
+ def __str__(self):
12
+ result = super().__str__()
13
+ result += f" at tool {self.tool}"
14
+
@@ -25,6 +25,9 @@ class Llm(ABC):
25
25
  self._format = response_format
26
26
  self._exception_handler = llm_exception_handler
27
27
 
28
+ def __str__(self):
29
+ return f"Llm({self._name} {self._model.get_name()})"
30
+
28
31
  @abstractmethod
29
32
  def _call(self, user_query: str, history: LlmMemory, params: dict) -> str:
30
33
  pass
@@ -52,3 +55,4 @@ class Llm(ABC):
52
55
  args["response_format"] = self._format
53
56
 
54
57
  return args
58
+
@@ -50,3 +50,10 @@ class LlmMemory(ABC):
50
50
  @abstractmethod
51
51
  def set_snapshot(self):
52
52
  pass
53
+
54
+ @abstractmethod
55
+ def describe(self):
56
+ pass
57
+
58
+ def __str__(self):
59
+ return self.describe()
@@ -18,6 +18,9 @@ class Prompt:
18
18
  self.__variables = variables
19
19
  self.__exception_handler = exception_handler
20
20
 
21
+ def __str__(self):
22
+ return f"Prompt({self.__get_content_short()} ({",".join(self.__variables)}))"
23
+
21
24
  @staticmethod
22
25
  def replace_placeholders(text: str, values: dict) -> str:
23
26
  def replacer(match):
@@ -22,3 +22,10 @@ class Retriever(ABC):
22
22
  @abstractmethod
23
23
  def get_relevant_data(self, query: str) -> RetrieverResponse:
24
24
  pass
25
+
26
+ @abstractmethod
27
+ def describe(self):
28
+ pass
29
+
30
+ def __str__(self):
31
+ return self.describe()
@@ -18,3 +18,10 @@ class Tool(ABC):
18
18
  @abstractmethod
19
19
  def get_definition(self):
20
20
  pass
21
+
22
+ @abstractmethod
23
+ def describe(self):
24
+ pass
25
+
26
+ def __str__(self):
27
+ return self.describe()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: igbot_base
3
- Version: 0.0.10
3
+ Version: 0.0.11
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
@@ -17,4 +17,11 @@ igbot_base.egg-info/PKG-INFO
17
17
  igbot_base.egg-info/SOURCES.txt
18
18
  igbot_base.egg-info/dependency_links.txt
19
19
  igbot_base.egg-info/requires.txt
20
- igbot_base.egg-info/top_level.txt
20
+ igbot_base.egg-info/top_level.txt
21
+ igbot_base/exception/agent_exception.py
22
+ igbot_base/exception/base_exception.py
23
+ igbot_base/exception/llm_exception.py
24
+ igbot_base/exception/memory_exception.py
25
+ igbot_base/exception/prompt_exception.py
26
+ igbot_base/exception/retriever_exception.py
27
+ igbot_base/exception/tool_exception.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "igbot_base"
7
- version = "0.0.10"
7
+ version = "0.0.11"
8
8
  description = "Base classes for igbot"
9
9
  authors = [{name = "Igor Kopeć", email = "igor.kopec95@gmail.com"}]
10
10
  license={text="LGPL-3.0-or-later"}
File without changes