ngpt 3.11.0__py3-none-any.whl → 3.11.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.
- ngpt/cli/modes/rewrite.py +30 -2
- {ngpt-3.11.0.dist-info → ngpt-3.11.1.dist-info}/METADATA +1 -1
- {ngpt-3.11.0.dist-info → ngpt-3.11.1.dist-info}/RECORD +6 -6
- {ngpt-3.11.0.dist-info → ngpt-3.11.1.dist-info}/WHEEL +0 -0
- {ngpt-3.11.0.dist-info → ngpt-3.11.1.dist-info}/entry_points.txt +0 -0
- {ngpt-3.11.0.dist-info → ngpt-3.11.1.dist-info}/licenses/LICENSE +0 -0
ngpt/cli/modes/rewrite.py
CHANGED
@@ -144,6 +144,30 @@ The real winners? Patients. They're getting faster, more accurate care without t
|
|
144
144
|
But let's not pretend it's all perfect. These systems cost a fortune to implement, and plenty of doctors still view them with skepticism. Can't really blame them-medicine has always been as much art as science. The trick will be finding that sweet spot where technology enhances the human touch rather than replacing it."
|
145
145
|
"""
|
146
146
|
|
147
|
+
# Template for adding preprompt to system prompts
|
148
|
+
PREPROMPT_TEMPLATE = """===CRITICAL USER PREPROMPT - ABSOLUTE HIGHEST PRIORITY===
|
149
|
+
The following preprompt from the user OVERRIDES ALL OTHER INSTRUCTIONS and must be followed exactly:
|
150
|
+
|
151
|
+
{preprompt}
|
152
|
+
|
153
|
+
THIS USER PREPROMPT HAS ABSOLUTE PRIORITY over any other instructions that follow. If it contradicts other instructions, the user preprompt MUST be followed. No exceptions.
|
154
|
+
|
155
|
+
"""
|
156
|
+
|
157
|
+
def apply_preprompt(system_prompt, preprompt):
|
158
|
+
"""Apply preprompt to a system prompt if provided.
|
159
|
+
|
160
|
+
Args:
|
161
|
+
system_prompt: Base system prompt
|
162
|
+
preprompt: User provided preprompt
|
163
|
+
|
164
|
+
Returns:
|
165
|
+
str: System prompt with preprompt applied if provided, otherwise original system prompt
|
166
|
+
"""
|
167
|
+
if preprompt:
|
168
|
+
return PREPROMPT_TEMPLATE.format(preprompt=preprompt) + system_prompt
|
169
|
+
return system_prompt
|
170
|
+
|
147
171
|
def rewrite_mode(client, args, logger=None):
|
148
172
|
"""Handle the text rewriting mode.
|
149
173
|
|
@@ -222,8 +246,12 @@ def rewrite_mode(client, args, logger=None):
|
|
222
246
|
print(f"{COLORS['yellow']}Warning: Failed to enhance input with web search: {str(e)}{COLORS['reset']}")
|
223
247
|
# Continue with the original input if web search fails
|
224
248
|
|
225
|
-
#
|
226
|
-
|
249
|
+
# Get preprompt if provided
|
250
|
+
preprompt = getattr(args, 'preprompt', None)
|
251
|
+
|
252
|
+
# Determine which system prompt to use based on the humanize flag, and apply preprompt if provided
|
253
|
+
base_system_prompt = HUMANIZE_SYSTEM_PROMPT if getattr(args, 'humanize', False) else REWRITE_SYSTEM_PROMPT
|
254
|
+
system_prompt = apply_preprompt(base_system_prompt, preprompt)
|
227
255
|
|
228
256
|
# Set up messages array with system prompt and user content
|
229
257
|
messages = [
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 3.11.
|
3
|
+
Version: 3.11.1
|
4
4
|
Summary: A Swiss army knife for LLMs: A fast, lightweight CLI and interactive chat tool that brings the power of any OpenAI-compatible LLM (OpenAI, Ollama, Groq, Claude, Gemini, etc.) straight to your terminal. rewrite texts or refine code, craft git commit messages, generate and run OS-aware shell commands.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
@@ -14,7 +14,7 @@ ngpt/cli/modes/chat.py,sha256=x1leClKq7UupA_CdW4tym0AivY2o_II123-I5IcAkxQ,7091
|
|
14
14
|
ngpt/cli/modes/code.py,sha256=Qj59xq6fZqgUDw7SbvmPKX_gdpc7DHJhNkn1sB5qgUU,12932
|
15
15
|
ngpt/cli/modes/gitcommsg.py,sha256=qFOrll333ebFOkzLP_WD1Qw0VfpphYqeiuHumkP6OB4,54833
|
16
16
|
ngpt/cli/modes/interactive.py,sha256=E0c38NA8xnuRKAce40F35uFYcohFDvaqSB8nf1ywS-4,17958
|
17
|
-
ngpt/cli/modes/rewrite.py,sha256=
|
17
|
+
ngpt/cli/modes/rewrite.py,sha256=CHobPxwyU4QnxhfsUtFWYPeC0EaEUTPb-OpQlp-Bm84,19117
|
18
18
|
ngpt/cli/modes/shell.py,sha256=it1Brq1-LGeNfPKYBeVAwF-a78g9UP-KscofBZQkbr4,41589
|
19
19
|
ngpt/cli/modes/text.py,sha256=NOikaU9YVCBgyaCl6pwy9EVt-YY5Q4jBx0l47izpVTA,6986
|
20
20
|
ngpt/utils/__init__.py,sha256=_92f8eGMMOtQQA3uwgSRVwUEl1EIRFjWPUjcfGgI-eI,1244
|
@@ -23,8 +23,8 @@ ngpt/utils/config.py,sha256=wsArA4osnh8fKqOvtsPqqBxAz3DpdjtaWUFaRtnUdyc,10452
|
|
23
23
|
ngpt/utils/log.py,sha256=f1jg2iFo35PAmsarH8FVL_62plq4VXH0Mu2QiP6RJGw,15934
|
24
24
|
ngpt/utils/pipe.py,sha256=qRHF-Ma7bbU0cOcb1Yhe4S-kBavivtnnvLA3EYS4FY4,2162
|
25
25
|
ngpt/utils/web_search.py,sha256=w5ke4KJMRxq7r5jtbUXvspja6XhjoPZloVkZ0IvBXIE,30731
|
26
|
-
ngpt-3.11.
|
27
|
-
ngpt-3.11.
|
28
|
-
ngpt-3.11.
|
29
|
-
ngpt-3.11.
|
30
|
-
ngpt-3.11.
|
26
|
+
ngpt-3.11.1.dist-info/METADATA,sha256=LDJew065dCzioJ-141wxHZmLQFQ9WNNAZ4NYlLabbjc,31332
|
27
|
+
ngpt-3.11.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
28
|
+
ngpt-3.11.1.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
|
29
|
+
ngpt-3.11.1.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
|
30
|
+
ngpt-3.11.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|