tasks-prompts-chain 0.0.1__py3-none-any.whl → 0.0.3__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.
- tasks_prompts_chain/tasks_prompts_chain.py +12 -1
- {tasks_prompts_chain-0.0.1.dist-info → tasks_prompts_chain-0.0.3.dist-info}/METADATA +17 -5
- tasks_prompts_chain-0.0.3.dist-info/RECORD +6 -0
- tasks_prompts_chain-0.0.1.dist-info/RECORD +0 -6
- {tasks_prompts_chain-0.0.1.dist-info → tasks_prompts_chain-0.0.3.dist-info}/WHEEL +0 -0
- {tasks_prompts_chain-0.0.1.dist-info → tasks_prompts_chain-0.0.3.dist-info}/licenses/LICENSE +0 -0
@@ -89,6 +89,7 @@ class TasksPromptsChain:
|
|
89
89
|
self.final_result_placeholder = final_result_placeholder or "final_result"
|
90
90
|
self._results = {}
|
91
91
|
self._output_template = None
|
92
|
+
self._final_output_template = None
|
92
93
|
self._current_stream_buffer = ""
|
93
94
|
|
94
95
|
def set_output_template(self, template: str) -> None:
|
@@ -117,6 +118,7 @@ class TasksPromptsChain:
|
|
117
118
|
output = output.replace(f"{{{{{placeholder}}}}}", value or "")
|
118
119
|
# Replace current streaming placeholder
|
119
120
|
output = output.replace(f"{{{{{self.final_result_placeholder}}}}}", self._current_stream_buffer)
|
121
|
+
self._final_output_template=output
|
120
122
|
return output
|
121
123
|
|
122
124
|
async def execute_chain(self, prompts: List[Union[Dict, PromptTemplate]], temperature: float = 0.7) -> AsyncGenerator[str, None]:
|
@@ -181,7 +183,8 @@ class TasksPromptsChain:
|
|
181
183
|
delta = chunk.choices[0].delta.content
|
182
184
|
response_content += delta
|
183
185
|
self._current_stream_buffer = response_content
|
184
|
-
|
186
|
+
self._format_current_stream()
|
187
|
+
yield response_content
|
185
188
|
|
186
189
|
responses.append(response_content)
|
187
190
|
|
@@ -209,6 +212,14 @@ class TasksPromptsChain:
|
|
209
212
|
"""
|
210
213
|
return self._results.get(placeholder)
|
211
214
|
|
215
|
+
def get_final_result_within_template(self) -> Optional[str]:
|
216
|
+
"""
|
217
|
+
Get tje final result
|
218
|
+
Returns:
|
219
|
+
Optional[str]: The response for that placeholder if it exists, None otherwise
|
220
|
+
"""
|
221
|
+
return self._final_output_template
|
222
|
+
|
212
223
|
def template_output(self, template: str) -> None:
|
213
224
|
"""
|
214
225
|
Set the output template for streaming responses.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: tasks_prompts_chain
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: A Python library for creating and executing chains of prompts using OpenAI's SDK with streaming support and template formatting.
|
5
5
|
Project-URL: Homepage, https://github.com/smirfolio/tasks_prompts_chain
|
6
6
|
Project-URL: Issues, https://github.com/smirfolio/tasks_prompts_chain/issues
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.8
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
|
15
|
-
#
|
15
|
+
# TasksPromptsChain
|
16
16
|
|
17
17
|
A Mini Python library for creating and executing chains of prompts using OpenAI's API with streaming support and output template formatting.
|
18
18
|
|
@@ -26,14 +26,26 @@ A Mini Python library for creating and executing chains of prompts using OpenAI'
|
|
26
26
|
- Multiple output formats (JSON, Markdown, CSV, Text)
|
27
27
|
- Async/await support
|
28
28
|
|
29
|
-
##
|
29
|
+
## Dependancies
|
30
30
|
|
31
|
-
|
31
|
+
Please install typing-extensions and openai python packages
|
32
|
+
```bash
|
33
|
+
pip install typing-extensions
|
34
|
+
pip install openai
|
35
|
+
```
|
36
|
+
To Install the library:
|
37
|
+
```
|
38
|
+
pip install tasks_prompts_chain
|
39
|
+
```
|
40
|
+
|
41
|
+
## Installation from source code
|
42
|
+
|
43
|
+
### For Users required from source gitHub repo
|
32
44
|
```bash
|
33
45
|
pip install -r requirements/requirements.txt
|
34
46
|
```
|
35
47
|
|
36
|
-
### For Developers
|
48
|
+
### For Developers required from source gitHub repo
|
37
49
|
```bash
|
38
50
|
pip install -r requirements/requirements.txt
|
39
51
|
pip install -r requirements/requirements-dev.txt
|
@@ -0,0 +1,6 @@
|
|
1
|
+
tasks_prompts_chain/__init__.py,sha256=HVhC_vMTYCyZW6vnoErHh-TkAnNRqJ2JJqClJQSfU8Y,148
|
2
|
+
tasks_prompts_chain/tasks_prompts_chain.py,sha256=P6vJpuuwteXItmudhOnsiArojINeXB5lJnHgxTsXjCA,11816
|
3
|
+
tasks_prompts_chain-0.0.3.dist-info/METADATA,sha256=MhEBZjJQ_7m8jH9RxxtEGSNn2ppEIR0DBoGIUmo25bA,4906
|
4
|
+
tasks_prompts_chain-0.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
+
tasks_prompts_chain-0.0.3.dist-info/licenses/LICENSE,sha256=WYmcYJG1QFgu1hfo7qrEkZ3Jhcz8NUWe6XUraZvlIFs,10172
|
6
|
+
tasks_prompts_chain-0.0.3.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
tasks_prompts_chain/__init__.py,sha256=HVhC_vMTYCyZW6vnoErHh-TkAnNRqJ2JJqClJQSfU8Y,148
|
2
|
-
tasks_prompts_chain/tasks_prompts_chain.py,sha256=epD997ELkacml3pJibbgKEo-IhlKwLx8J5uJtuJ6uWw,11416
|
3
|
-
tasks_prompts_chain-0.0.1.dist-info/METADATA,sha256=Sds4Upqje_iKrhGWmuubtGftdOhrs1Uy0RgvNpQjffk,4613
|
4
|
-
tasks_prompts_chain-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
tasks_prompts_chain-0.0.1.dist-info/licenses/LICENSE,sha256=WYmcYJG1QFgu1hfo7qrEkZ3Jhcz8NUWe6XUraZvlIFs,10172
|
6
|
-
tasks_prompts_chain-0.0.1.dist-info/RECORD,,
|
File without changes
|
{tasks_prompts_chain-0.0.1.dist-info → tasks_prompts_chain-0.0.3.dist-info}/licenses/LICENSE
RENAMED
File without changes
|