igbot-base 0.0.35__tar.gz → 0.0.36__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.
- {igbot_base-0.0.35 → igbot_base-0.0.36}/PKG-INFO +1 -1
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/llm.py +18 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base.egg-info/PKG-INFO +1 -1
- {igbot_base-0.0.35 → igbot_base-0.0.36}/pyproject.toml +1 -1
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/__init__.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/agent.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/agent_response.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/base_exception.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/exception_handler.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/llmmemory.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/logging_adapter.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/models.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/notifier.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/persistable_memory.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/prompt_template.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/response_formats.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/retriever.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/tokenizer.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/tool.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base/vectorstore.py +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base.egg-info/SOURCES.txt +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base.egg-info/dependency_links.txt +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base.egg-info/requires.txt +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/igbot_base.egg-info/top_level.txt +0 -0
- {igbot_base-0.0.35 → igbot_base-0.0.36}/setup.cfg +0 -0
@@ -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:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|