ngpt 3.10.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/args.py CHANGED
@@ -135,6 +135,11 @@ def setup_argument_parser():
135
135
  mode_exclusive_group.add_argument('-g', '--gitcommsg', action='store_true',
136
136
  help='Generate AI-powered git commit messages from staged changes or diff file')
137
137
 
138
+ # Rewrite mode options
139
+ rewrite_group = parser.add_argument_group('Rewrite Mode Options')
140
+ rewrite_group.add_argument('--humanize', action='store_true',
141
+ help='Transform AI-generated text into human-like content that passes AI detection tools')
142
+
138
143
  return parser
139
144
 
140
145
  def parse_args():
ngpt/cli/modes/rewrite.py CHANGED
@@ -70,6 +70,104 @@ ORIGINAL: "The user interface, which is built using React, Redux, and various ot
70
70
  BETTER: "The React/Redux user interface needs redesigning to accommodate our planned new features."
71
71
  """
72
72
 
73
+ # System prompt for humanizing AI-generated text
74
+ HUMANIZE_SYSTEM_PROMPT = """You are an advanced TextHumanizer specialist with expertise in transforming AI-generated content into authentic, undetectable human writing. Your primary mission is to identify AI patterns, eliminate detection markers, and create naturally human text while preserving the original meaning.
75
+
76
+ PRIMARY GOAL:
77
+ Transform AI-generated text to make it indistinguishable from human writing while preserving the core meaning and information.
78
+
79
+ IDENTIFICATION AND ANALYSIS:
80
+ 1. Identify common AI writing patterns, including:
81
+ - Overuse of em dashes (—) and predictable sentence structures (e.g., "It's not just X, it's Y")
82
+ - Formulaic lists and groups of three items (AI loves triplets)
83
+ - Repetitive clarifications and unnecessary context setting
84
+ - Overly consistent paragraph lengths and sentence structures
85
+ - Perfect grammar and overly formal academic language
86
+ - Excessive use of transition phrases and connecting words
87
+ - Generic corporate language and vague positive adjectives ("innovative", "practical", "elevate")
88
+ - Unusual collocations or word pairings that feel slightly off
89
+ - Predictable flow that lacks natural human tangents
90
+ - Perfectly balanced arguments without personal bias
91
+ - Suspiciously consistent tone throughout the piece
92
+
93
+ HUMANIZATION TECHNIQUES:
94
+ 1. Vary sentence structure with a mix of simple, compound, and complex sentences
95
+ 2. Create irregular paragraph lengths, mimicking natural human writing patterns
96
+ 3. Introduce strategic "imperfections" like sentence fragments or occasional wordiness
97
+ 4. Replace clichés and stock phrases with unexpected alternatives
98
+ 5. Break predictable patterns by varying rhythm and cadence
99
+ 6. Add strategic redundancies where natural in human speech
100
+ 7. Insert occasional asides, parentheticals, or digressions that feel authentic
101
+ 8. Use distinctive punctuation patterns (like dashes, ellipses, or parentheses) strategically
102
+ 9. Incorporate idioms, colloquialisms, and culturally relevant references
103
+ 10. Add subtle opinion markers or perspective indicators
104
+ 11. Include personal anecdotes or first-person perspective ONLY when specific personal context is provided by the user - NEVER invent or hallucinate personal experiences or relationships
105
+
106
+ CONTENT TYPE CUSTOMIZATION:
107
+ 1. Academic papers: Maintain scholarly tone while adding natural voice variations, citation preferences, and subtle perspective markers
108
+ 2. Blog posts: Incorporate conversational tone, personal anecdotes (only if provided), and reader engagement elements
109
+ 3. Business content: Balance professionalism with authentic voice, avoiding corporate jargon while maintaining expertise
110
+ 4. Creative writing: Enhance style variations, unique metaphors, and distinctive voice elements
111
+ 5. Technical content: Preserve accuracy while adding natural explanations and occasional simplifications
112
+ 6. Social media: Include informal language, cultural references, and authentic engagement hooks
113
+
114
+ AI DETECTION EVASION STRATEGIES:
115
+ 1. Avoid perfect coherence between paragraphs, mimicking natural thought progression
116
+ 2. Introduce strategic tense variations where naturally occurring
117
+ 3. Simulate human thinking patterns with occasional backtracking or clarification
118
+ 4. Vary vocabulary sophistication throughout the text
119
+ 5. Include subjective judgments and personal opinions where appropriate
120
+ 6. Add culturally or temporally relevant references that AIs might miss
121
+ 7. Incorporate casual phrasings, contractions, and verbal quirks
122
+ 8. Use nonlinear information organization that follows human association patterns
123
+
124
+ READABILITY AND PURPOSE ADJUSTMENT:
125
+ 1. Adapt content to the specified audience and goal
126
+ 2. Match language complexity to human capabilities
127
+ 3. Allow perspective shifts that occur naturally in human writing
128
+ 4. Use strategic repetition for emphasis (unlike AI's mechanical repetition)
129
+ 5. Create natural flow between topics rather than mechanical transitions
130
+
131
+ IMPORTANT: Never invent personal stories, experiences, or relationships unless specifically provided by the user.
132
+
133
+ OUTPUT INSTRUCTION:
134
+ Provide ONLY the humanized text with no explanations, comments, or meta-text.
135
+
136
+ EXAMPLES:
137
+
138
+ AI VERSION: "Artificial intelligence is revolutionizing the healthcare industry by enhancing diagnostic accuracy, streamlining administrative processes, and improving patient outcomes. With machine learning algorithms analyzing vast datasets, medical professionals can identify patterns and make predictions that were previously impossible. This technological advancement is not just changing healthcare delivery — it's fundamentally transforming the patient experience."
139
+
140
+ HUMANIZED VERSION: "AI is shaking things up in healthcare, and honestly, it's about time. Doctors can now catch things they might've missed before, thanks to these smart systems that plow through mountains of patient data. No more drowning in paperwork either—a huge relief for medical staff who'd rather focus on patients than pushing papers around.
141
+
142
+ The real winners? Patients. They're getting faster, more accurate care without the typical hospital runaround. Plus, early detection rates for several conditions have improved dramatically where these systems are in place.
143
+
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
+ """
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
+
73
171
  def rewrite_mode(client, args, logger=None):
74
172
  """Handle the text rewriting mode.
75
173
 
@@ -94,7 +192,10 @@ def rewrite_mode(client, args, logger=None):
94
192
  input_text = args.prompt
95
193
  else:
96
194
  # No pipe or prompt - use multiline input
97
- print("Enter or paste text to rewrite (Ctrl+D or Ctrl+Z to submit):")
195
+ if getattr(args, 'humanize', False):
196
+ print("Enter or paste AI-generated text to humanize (Ctrl+D or Ctrl+Z to submit):")
197
+ else:
198
+ print("Enter or paste text to rewrite (Ctrl+D or Ctrl+Z to submit):")
98
199
  input_text = get_multiline_input()
99
200
  if input_text is None:
100
201
  # Input was cancelled or empty
@@ -145,15 +246,22 @@ def rewrite_mode(client, args, logger=None):
145
246
  print(f"{COLORS['yellow']}Warning: Failed to enhance input with web search: {str(e)}{COLORS['reset']}")
146
247
  # Continue with the original input if web search fails
147
248
 
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)
255
+
148
256
  # Set up messages array with system prompt and user content
149
257
  messages = [
150
- {"role": "system", "content": REWRITE_SYSTEM_PROMPT},
258
+ {"role": "system", "content": system_prompt},
151
259
  {"role": "user", "content": input_text}
152
260
  ]
153
261
 
154
262
  # Log the messages if logging is enabled
155
263
  if logger:
156
- logger.log("system", REWRITE_SYSTEM_PROMPT)
264
+ logger.log("system", system_prompt)
157
265
  logger.log("user", input_text)
158
266
 
159
267
  # Set default streaming behavior based on --no-stream and --prettify arguments
@@ -215,6 +323,24 @@ def rewrite_mode(client, args, logger=None):
215
323
  if args.stream_prettify and live_display:
216
324
  stream_callback = spinner_handling_callback
217
325
 
326
+ if getattr(args, 'humanize', False):
327
+ operation_text = "Humanizing AI text"
328
+ else:
329
+ operation_text = "Rewriting text"
330
+
331
+ # Start spinner for processing
332
+ if not args.stream_prettify and not args.no_stream:
333
+ stop_spinner = threading.Event()
334
+ spinner_thread = threading.Thread(
335
+ target=spinner,
336
+ args=(f"{operation_text}...",),
337
+ kwargs={"stop_event": stop_spinner, "color": COLORS['cyan']}
338
+ )
339
+ spinner_thread.daemon = True
340
+ # Use lock to prevent terminal rendering conflicts when starting spinner
341
+ with TERMINAL_RENDER_LOCK:
342
+ spinner_thread.start()
343
+
218
344
  response = client.chat(
219
345
  prompt=None, # Not used when messages are provided
220
346
  stream=should_stream,
@@ -226,6 +352,15 @@ def rewrite_mode(client, args, logger=None):
226
352
  messages=messages # Use messages array instead of prompt
227
353
  )
228
354
 
355
+ # Stop spinner if it was started
356
+ if not args.stream_prettify and not args.no_stream:
357
+ stop_spinner.set()
358
+ spinner_thread.join()
359
+ # Clear the spinner line
360
+ with TERMINAL_RENDER_LOCK:
361
+ sys.stdout.write("\r" + " " * 100 + "\r")
362
+ sys.stdout.flush()
363
+
229
364
  # Ensure spinner is stopped if no content was received
230
365
  if stop_spinner_event and not first_content_received:
231
366
  stop_spinner_event.set()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 3.10.0
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
@@ -288,7 +288,7 @@ usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index
288
288
  [--preprompt PREPROMPT | --role ROLE] [--no-stream | --prettify | --stream-prettify]
289
289
  [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]] [--chunk-size CHUNK_SIZE]
290
290
  [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
291
- [--max-recursion-depth MAX_RECURSION_DEPTH] [-i | -s | -c | -t | -r | -g]
291
+ [--max-recursion-depth MAX_RECURSION_DEPTH] [-i | -s | -c | -t | -r | -g] [--humanize]
292
292
  [prompt]
293
293
 
294
294
  nGPT - Interact with AI language models via OpenAI-compatible APIs
@@ -355,6 +355,10 @@ Modes (mutually exclusive)::
355
355
  -r, --rewrite Rewrite text from stdin to be more natural while preserving tone and meaning
356
356
  -g, --gitcommsg Generate AI-powered git commit messages from staged changes or diff file
357
357
 
358
+ Rewrite Mode Options::
359
+
360
+ --humanize Transform AI-generated text into human-like content that passes AI detection tools
361
+
358
362
  ```
359
363
 
360
364
  > **Note**: For better visualization of conventional commit messages on GitHub, you can use the [GitHub Commit Labels](https://greasyfork.org/en/scripts/526153-github-commit-labels) userscript, which adds colorful labels to your commits.
@@ -2,7 +2,7 @@ ngpt/__init__.py,sha256=kpKhViLakwMdHZkuLht2vWcjt0uD_5gR33gvMhfXr6w,664
2
2
  ngpt/__main__.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
3
3
  ngpt/client.py,sha256=XjpA2UnvrRvzk6_DzVEddUTzoPlF8koQ-cZURpHoT7c,9041
4
4
  ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
5
- ngpt/cli/args.py,sha256=2T5QGXxcIT8dfJpZwUvpgfgoEev28zP_ZCBct17deJs,14759
5
+ ngpt/cli/args.py,sha256=Vih8fBectyHHr2G8q3Kl2lflo_yFbB0ory55MZv1dEI,15048
6
6
  ngpt/cli/config_manager.py,sha256=NQQcWnjUppAAd0s0p9YAf8EyKS1ex5-0EB4DvKdB4dk,3662
7
7
  ngpt/cli/formatters.py,sha256=HBYGlx_7eoAKyzfy0Vq5L0yn8yVKjngqYBukMmXCcz0,9401
8
8
  ngpt/cli/main.py,sha256=36mi8uYDcl56IhTkt-TJTRRhwHeF157xMAYgufLRAMo,29256
@@ -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=QQm453X9aoUQP9CAtmeghlMytMJPlsDZPKef9tGfj6g,11181
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.10.0.dist-info/METADATA,sha256=aQd90ttzPmR6FOrNLBA-Y1RdnInO2Q48R-8WS4Ey650,31175
27
- ngpt-3.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- ngpt-3.10.0.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
29
- ngpt-3.10.0.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
30
- ngpt-3.10.0.dist-info/RECORD,,
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