prompt-caller 0.1.0__py3-none-any.whl → 0.1.1__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.
- prompt_caller/prompt_caller.py +4 -1
- {prompt_caller-0.1.0.dist-info → prompt_caller-0.1.1.dist-info}/METADATA +21 -21
- prompt_caller-0.1.1.dist-info/RECORD +8 -0
- prompt_caller-0.1.0.dist-info/RECORD +0 -8
- {prompt_caller-0.1.0.dist-info → prompt_caller-0.1.1.dist-info}/LICENSE +0 -0
- {prompt_caller-0.1.0.dist-info → prompt_caller-0.1.1.dist-info}/WHEEL +0 -0
- {prompt_caller-0.1.0.dist-info → prompt_caller-0.1.1.dist-info}/top_level.txt +0 -0
prompt_caller/prompt_caller.py
CHANGED
|
@@ -19,6 +19,9 @@ load_dotenv()
|
|
|
19
19
|
|
|
20
20
|
class PromptCaller:
|
|
21
21
|
|
|
22
|
+
def __init__(self, promptPath="prompts"):
|
|
23
|
+
self.promptPath = promptPath
|
|
24
|
+
|
|
22
25
|
def _loadPrompt(self, file_path):
|
|
23
26
|
with open(file_path, "r", encoding="utf-8") as file:
|
|
24
27
|
content = file.read()
|
|
@@ -62,7 +65,7 @@ class PromptCaller:
|
|
|
62
65
|
context = {}
|
|
63
66
|
|
|
64
67
|
configuration, template = self._loadPrompt(
|
|
65
|
-
os.path.join(
|
|
68
|
+
os.path.join(self.promptPath, f"{promptName}.prompt")
|
|
66
69
|
)
|
|
67
70
|
|
|
68
71
|
template = self._renderTemplate(template, context)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: prompt_caller
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: This package is responsible for calling prompts in a specific format. It uses LangChain and OpenAI API
|
|
5
5
|
Home-page: https://github.com/ThiNepo/prompt-caller
|
|
6
6
|
Author: Thiago Nepomuceno
|
|
@@ -89,33 +89,33 @@ In this example:
|
|
|
89
89
|
|
|
90
90
|
3. **Using the agent feature:**
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
The `agent` method allows you to enhance the prompt's functionality by integrating external tools. Here’s an example where we evaluate a mathematical expression using Python’s `eval` in a safe execution environment:
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
```python
|
|
95
|
+
from prompt_caller import PromptCaller
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
ai = PromptCaller()
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
def evaluate_expression(expression: str):
|
|
100
|
+
"""
|
|
101
|
+
Evaluate a math expression using eval.
|
|
102
|
+
"""
|
|
103
|
+
safe_globals = {"__builtins__": None}
|
|
104
|
+
return eval(expression, safe_globals, {})
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
response = ai.agent(
|
|
107
|
+
"sample-agent", {"expression": "3+8/9"}, tools=[evaluate_expression]
|
|
108
|
+
)
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
print(response)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
In this example:
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
- The `agent` method is used to process the prompt while integrating external tools.
|
|
116
|
+
- The `evaluate_expression` function evaluates the mathematical expression securely.
|
|
117
|
+
- The response includes the processed result based on the prompt and tool execution.
|
|
114
118
|
|
|
115
|
-
- The `agent` method is used to process the prompt while integrating external tools.
|
|
116
|
-
- The `evaluate_expression` function evaluates the mathematical expression securely.
|
|
117
|
-
- The response includes the processed result based on the prompt and tool execution.
|
|
118
|
-
|
|
119
119
|
|
|
120
120
|
## How It Works
|
|
121
121
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
prompt_caller/__init__.py,sha256=4EGdeAJ_Ig7A-b-e17-nYbiXjckT7uL3to5lchMsoW4,41
|
|
2
|
+
prompt_caller/__main__.py,sha256=dJ0dYtVmnhZuoV79R6YiAIta1ZkUKb-TEX4VEuYbgk0,139
|
|
3
|
+
prompt_caller/prompt_caller.py,sha256=fy-pLXmYD2j5fnAxgBvxCNBrkQvDPGX0nWyqnaWeqSo,6737
|
|
4
|
+
prompt_caller-0.1.1.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
5
|
+
prompt_caller-0.1.1.dist-info/METADATA,sha256=j1xmg_Y_NAhh7CmlCgAcfSMuHChZ9C4DPcszLADg7dk,4909
|
|
6
|
+
prompt_caller-0.1.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
7
|
+
prompt_caller-0.1.1.dist-info/top_level.txt,sha256=iihiDRq-0VrKB8IKjxf7Lrtv-fLMq4tvgM4fH3x0I94,14
|
|
8
|
+
prompt_caller-0.1.1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
prompt_caller/__init__.py,sha256=4EGdeAJ_Ig7A-b-e17-nYbiXjckT7uL3to5lchMsoW4,41
|
|
2
|
-
prompt_caller/__main__.py,sha256=dJ0dYtVmnhZuoV79R6YiAIta1ZkUKb-TEX4VEuYbgk0,139
|
|
3
|
-
prompt_caller/prompt_caller.py,sha256=FlQEmNJWrxrdLMaoTxsCfPPcbr3DXWN5Oq1pp45yVQM,6644
|
|
4
|
-
prompt_caller-0.1.0.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
5
|
-
prompt_caller-0.1.0.dist-info/METADATA,sha256=0ciKS5ENrpqRA6EjrulhMu_R-7iwWwmMEbiYpjJbymk,4957
|
|
6
|
-
prompt_caller-0.1.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
7
|
-
prompt_caller-0.1.0.dist-info/top_level.txt,sha256=iihiDRq-0VrKB8IKjxf7Lrtv-fLMq4tvgM4fH3x0I94,14
|
|
8
|
-
prompt_caller-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|