mb-rag 1.1.47__py3-none-any.whl → 1.1.57.post1__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.
Potentially problematic release.
This version of mb-rag might be problematic. Click here for more details.
- mb_rag/basic.py +306 -0
- mb_rag/chatbot/chains.py +206 -206
- mb_rag/chatbot/conversation.py +185 -0
- mb_rag/chatbot/prompts.py +58 -58
- mb_rag/rag/embeddings.py +810 -810
- mb_rag/utils/all_data_extract.py +64 -64
- mb_rag/utils/bounding_box.py +231 -231
- mb_rag/utils/document_extract.py +354 -354
- mb_rag/utils/extra.py +73 -73
- mb_rag/utils/pdf_extract.py +428 -428
- mb_rag/version.py +1 -1
- {mb_rag-1.1.47.dist-info → mb_rag-1.1.57.post1.dist-info}/METADATA +11 -11
- mb_rag-1.1.57.post1.dist-info/RECORD +19 -0
- mb_rag/chatbot/basic.py +0 -644
- mb_rag-1.1.47.dist-info/RECORD +0 -18
- {mb_rag-1.1.47.dist-info → mb_rag-1.1.57.post1.dist-info}/WHEEL +0 -0
- {mb_rag-1.1.47.dist-info → mb_rag-1.1.57.post1.dist-info}/top_level.txt +0 -0
mb_rag/chatbot/prompts.py
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
## file for storing basic prompts template
|
|
2
|
-
from langchain.prompts import ChatPromptTemplate
|
|
3
|
-
|
|
4
|
-
__all__ = ["prompts", "invoke_prompt"]
|
|
5
|
-
|
|
6
|
-
class prompts:
|
|
7
|
-
"""
|
|
8
|
-
Class to get different prompts example for chatbot and templates
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
def get_code_prompts(self):
|
|
12
|
-
"""
|
|
13
|
-
Get code prompts
|
|
14
|
-
Returns:
|
|
15
|
-
str: Code prompt
|
|
16
|
-
"""
|
|
17
|
-
list_code_prompts = {'coding_python ': """You are a Python developer.
|
|
18
|
-
Human: {}"""}
|
|
19
|
-
|
|
20
|
-
def get_text_prompts(self):
|
|
21
|
-
"""
|
|
22
|
-
Get text prompts
|
|
23
|
-
Returns:
|
|
24
|
-
str: Text prompt
|
|
25
|
-
"""
|
|
26
|
-
list_text_prompts = {
|
|
27
|
-
'multiple_placeholders': """You are a helpful assistant.
|
|
28
|
-
Human: Tell me a more about {adjective1} and its relation to {adjective2}.
|
|
29
|
-
Assistant:"""
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
def get_image_prompts(self):
|
|
33
|
-
"""
|
|
34
|
-
Get image prompts
|
|
35
|
-
Returns:
|
|
36
|
-
str: Image prompt
|
|
37
|
-
"""
|
|
38
|
-
list_image_prompts = {'map_function': "*map(lambda x: image_url, baseframes_list)"} # for passing multiple images from a video or a list of images
|
|
39
|
-
|
|
40
|
-
def get_assistant_prompts(self):
|
|
41
|
-
"""
|
|
42
|
-
Get assistant prompts
|
|
43
|
-
Returns:
|
|
44
|
-
str: Assistant prompt
|
|
45
|
-
"""
|
|
46
|
-
list_assistant_prompts = {}
|
|
47
|
-
|
|
48
|
-
def invoke_prompt(template: str, input_dict : dict = None):
|
|
49
|
-
"""
|
|
50
|
-
Invoke a prompt
|
|
51
|
-
Args:
|
|
52
|
-
template (str): Template for the prompt
|
|
53
|
-
input_dict (dict): Input dictionary for the prompt
|
|
54
|
-
Returns:
|
|
55
|
-
str: Prompt
|
|
56
|
-
"""
|
|
57
|
-
prompt_multiple = ChatPromptTemplate.from_template(template)
|
|
58
|
-
prompt = prompt_multiple.invoke(input_dict)
|
|
1
|
+
## file for storing basic prompts template
|
|
2
|
+
from langchain.prompts import ChatPromptTemplate
|
|
3
|
+
|
|
4
|
+
__all__ = ["prompts", "invoke_prompt"]
|
|
5
|
+
|
|
6
|
+
class prompts:
|
|
7
|
+
"""
|
|
8
|
+
Class to get different prompts example for chatbot and templates
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def get_code_prompts(self):
|
|
12
|
+
"""
|
|
13
|
+
Get code prompts
|
|
14
|
+
Returns:
|
|
15
|
+
str: Code prompt
|
|
16
|
+
"""
|
|
17
|
+
list_code_prompts = {'coding_python ': """You are a Python developer.
|
|
18
|
+
Human: {}"""}
|
|
19
|
+
|
|
20
|
+
def get_text_prompts(self):
|
|
21
|
+
"""
|
|
22
|
+
Get text prompts
|
|
23
|
+
Returns:
|
|
24
|
+
str: Text prompt
|
|
25
|
+
"""
|
|
26
|
+
list_text_prompts = {
|
|
27
|
+
'multiple_placeholders': """You are a helpful assistant.
|
|
28
|
+
Human: Tell me a more about {adjective1} and its relation to {adjective2}.
|
|
29
|
+
Assistant:"""
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def get_image_prompts(self):
|
|
33
|
+
"""
|
|
34
|
+
Get image prompts
|
|
35
|
+
Returns:
|
|
36
|
+
str: Image prompt
|
|
37
|
+
"""
|
|
38
|
+
list_image_prompts = {'map_function': "*map(lambda x: image_url, baseframes_list)"} # for passing multiple images from a video or a list of images
|
|
39
|
+
|
|
40
|
+
def get_assistant_prompts(self):
|
|
41
|
+
"""
|
|
42
|
+
Get assistant prompts
|
|
43
|
+
Returns:
|
|
44
|
+
str: Assistant prompt
|
|
45
|
+
"""
|
|
46
|
+
list_assistant_prompts = {}
|
|
47
|
+
|
|
48
|
+
def invoke_prompt(template: str, input_dict : dict = None):
|
|
49
|
+
"""
|
|
50
|
+
Invoke a prompt
|
|
51
|
+
Args:
|
|
52
|
+
template (str): Template for the prompt
|
|
53
|
+
input_dict (dict): Input dictionary for the prompt
|
|
54
|
+
Returns:
|
|
55
|
+
str: Prompt
|
|
56
|
+
"""
|
|
57
|
+
prompt_multiple = ChatPromptTemplate.from_template(template)
|
|
58
|
+
prompt = prompt_multiple.invoke(input_dict)
|
|
59
59
|
return prompt
|