igbot-base 0.0.8__tar.gz → 0.0.10__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.8 → igbot_base-0.0.10}/PKG-INFO +1 -1
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/llm.py +9 -2
- igbot_base-0.0.10/igbot_base/logging_adapter.py +15 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/prompt_template.py +10 -0
- igbot_base-0.0.10/igbot_base/retriever.py +24 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/vectorstore.py +3 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base.egg-info/PKG-INFO +1 -1
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base.egg-info/SOURCES.txt +1 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/pyproject.toml +1 -1
- igbot_base-0.0.8/igbot_base/retriever.py +0 -11
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/__init__.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/agent.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/agent_response.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/exception_handler.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/llmmemory.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/models.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/persistable_memory.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/response_formats.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base/tool.py +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base.egg-info/dependency_links.txt +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base.egg-info/requires.txt +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/igbot_base.egg-info/top_level.txt +0 -0
- {igbot_base-0.0.8 → igbot_base-0.0.10}/setup.cfg +0 -0
@@ -5,6 +5,9 @@ from typing import Optional
|
|
5
5
|
from igbot_base.exception_handler import ExceptionHandler, NoopExceptionHandler
|
6
6
|
from igbot_base.llmmemory import LlmMemory
|
7
7
|
from igbot_base.models import Model
|
8
|
+
from igbot_base.logging_adapter import get_logger
|
9
|
+
|
10
|
+
logger = get_logger("application")
|
8
11
|
|
9
12
|
|
10
13
|
class Llm(ABC):
|
@@ -30,10 +33,14 @@ class Llm(ABC):
|
|
30
33
|
history.revert_to_snapshot()
|
31
34
|
|
32
35
|
def call(self, user_query: str, history: LlmMemory, params: dict) -> str:
|
33
|
-
|
36
|
+
history.set_snapshot()
|
34
37
|
try:
|
35
|
-
|
38
|
+
response = self._call(user_query, history, params)
|
39
|
+
logger.debug("LLM %s %s responded: %s", self._name, self._model.get_name(), response)
|
40
|
+
return response
|
36
41
|
except Exception as e:
|
42
|
+
logger.error("Error occurred in LLM %s, Model %s at calling the API: %s",
|
43
|
+
self._name, self._model.get_name(), e)
|
37
44
|
self._revert_memory(history)
|
38
45
|
self._exception_handler.handle(e)
|
39
46
|
|
@@ -2,6 +2,9 @@ import re
|
|
2
2
|
from typing import Optional
|
3
3
|
|
4
4
|
from igbot_base.exception_handler import ExceptionHandler, PrintingExceptionHandler
|
5
|
+
from igbot_base.logging_adapter import get_logger
|
6
|
+
|
7
|
+
logger = get_logger("application")
|
5
8
|
|
6
9
|
|
7
10
|
class Prompt:
|
@@ -30,9 +33,16 @@ class Prompt:
|
|
30
33
|
try:
|
31
34
|
return self.replace_placeholders(self.__content, params)
|
32
35
|
except KeyError as e:
|
36
|
+
logger.exception("Exception occurred when parsing prompt %s... %s", self.__get_content_short(), e)
|
33
37
|
self.__exception_handler.handle(e)
|
34
38
|
|
35
39
|
raise Exception(f"Error while substituting values for prompt")
|
36
40
|
|
37
41
|
def get_content(self) -> str:
|
38
42
|
return self.__content
|
43
|
+
|
44
|
+
def __get_content_short(self):
|
45
|
+
if len(self.__content) > 15:
|
46
|
+
return self.__content[:15]
|
47
|
+
else:
|
48
|
+
return self.__content
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
|
4
|
+
class RetrieverResponse:
|
5
|
+
|
6
|
+
def __init__(self, documents):
|
7
|
+
self.documents = documents
|
8
|
+
|
9
|
+
def get_content_list(self):
|
10
|
+
return [doc.page_content for doc in self.documents]
|
11
|
+
|
12
|
+
def get_content_string(self, delimiter: str):
|
13
|
+
contents = self.get_content_list()
|
14
|
+
return delimiter.join(contents)
|
15
|
+
|
16
|
+
|
17
|
+
class Retriever(ABC):
|
18
|
+
|
19
|
+
def __init__(self):
|
20
|
+
pass
|
21
|
+
|
22
|
+
@abstractmethod
|
23
|
+
def get_relevant_data(self, query: str) -> RetrieverResponse:
|
24
|
+
pass
|
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
|