ngpt 2.11.1__py3-none-any.whl → 2.11.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.
ngpt/cli/args.py CHANGED
@@ -48,7 +48,7 @@ def setup_argument_parser():
48
48
  global_group.add_argument('--model', help='Model to use')
49
49
  global_group.add_argument('--web-search', action='store_true',
50
50
  help='Enable web search capability (Note: Your API endpoint must support this feature)')
51
- global_group.add_argument('-n', '--no-stream', action='store_true',
51
+ global_group.add_argument('--no-stream', action='store_true',
52
52
  help='Return the whole response without streaming')
53
53
  global_group.add_argument('--temperature', type=float, default=0.7,
54
54
  help='Set temperature (controls randomness, default: 0.7)')
ngpt/utils/cli_config.py CHANGED
@@ -206,13 +206,23 @@ def apply_cli_config(args: Any, mode: str) -> Any:
206
206
  # Load CLI config
207
207
  cli_config = load_cli_config()
208
208
 
209
- # Get command-line arguments provided by the user
210
- explicit_args = set(arg for arg in sys.argv[1:] if arg.startswith('--'))
209
+ # Get command-line arguments provided by the user (both long and short forms)
210
+ explicit_args = set()
211
+ for arg in sys.argv[1:]:
212
+ if arg.startswith('--'):
213
+ explicit_args.add(arg)
214
+ # We've removed -n, but this pattern would handle other short options
211
215
 
212
216
  # Keep track of applied exclusive options
213
217
  applied_exclusives = set()
214
218
 
215
- # For each option in CLI config, check if it should be applied
219
+ # First pass: Check explicitly set args and track their exclusive options
220
+ for option in CLI_CONFIG_OPTIONS:
221
+ cli_option = f"--{option}"
222
+ if cli_option in explicit_args and "exclusive" in CLI_CONFIG_OPTIONS[option]:
223
+ applied_exclusives.update(CLI_CONFIG_OPTIONS[option]["exclusive"])
224
+
225
+ # Second pass: Apply CLI config options
216
226
  for option, value in cli_config.items():
217
227
  # Skip if not a valid option
218
228
  if option not in CLI_CONFIG_OPTIONS:
@@ -227,12 +237,8 @@ def apply_cli_config(args: Any, mode: str) -> Any:
227
237
  arg_name = option.replace("-", "_")
228
238
 
229
239
  # Skip if explicitly set via command line
230
- # Check common variants like --option
231
240
  cli_option = f"--{option}"
232
241
  if cli_option in explicit_args:
233
- # Add to applied_exclusives if this option has exclusivity constraints
234
- if "exclusive" in CLI_CONFIG_OPTIONS[option]:
235
- applied_exclusives.update(CLI_CONFIG_OPTIONS[option]["exclusive"])
236
242
  continue
237
243
 
238
244
  # Skip if an exclusive option has already been applied
@@ -240,7 +246,6 @@ def apply_cli_config(args: Any, mode: str) -> Any:
240
246
  continue
241
247
 
242
248
  # Check exclusivity constraints against *explicitly set* args
243
- # Don't apply a CLI config option if an exclusive option was explicitly set
244
249
  if "exclusive" in CLI_CONFIG_OPTIONS[option]:
245
250
  skip = False
246
251
  for excl_option in CLI_CONFIG_OPTIONS[option]["exclusive"]:
@@ -250,14 +255,23 @@ def apply_cli_config(args: Any, mode: str) -> Any:
250
255
  break # Skip applying this CLI config value
251
256
  if skip:
252
257
  continue
253
-
254
- # If we're applying this option, add its exclusives to the tracking set
255
- applied_exclusives.update(CLI_CONFIG_OPTIONS[option]["exclusive"])
256
-
258
+
257
259
  # Apply the value from CLI config
258
260
  # Ensure the attribute exists on args before setting
259
261
  if hasattr(args, arg_name):
260
262
  setattr(args, arg_name, value)
263
+
264
+ # For boolean options that are True, explicitly disable their exclusive options
265
+ option_type = CLI_CONFIG_OPTIONS[option]["type"]
266
+ if option_type == "bool" and value is True and "exclusive" in CLI_CONFIG_OPTIONS[option]:
267
+ for excl_option in CLI_CONFIG_OPTIONS[option]["exclusive"]:
268
+ # Convert to argparse naming and set to False if the attribute exists
269
+ excl_arg_name = excl_option.replace("-", "_")
270
+ if hasattr(args, excl_arg_name):
271
+ setattr(args, excl_arg_name, False)
272
+
273
+ # Add exclusives to tracking set to prevent them from being applied
274
+ applied_exclusives.update(CLI_CONFIG_OPTIONS[option]["exclusive"])
261
275
 
262
276
  return args
263
277
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 2.11.1
3
+ Version: 2.11.3
4
4
  Summary: A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints.
5
5
  Project-URL: Homepage, https://github.com/nazdridoy/ngpt
6
6
  Project-URL: Repository, https://github.com/nazdridoy/ngpt
@@ -83,7 +83,7 @@ ngpt "Tell me about quantum computing"
83
83
  ngpt -i
84
84
 
85
85
  # Return response without streaming
86
- ngpt -n "Tell me about quantum computing"
86
+ ngpt --no-stream "Tell me about quantum computing"
87
87
 
88
88
  # Generate code
89
89
  ngpt --code "function to calculate the Fibonacci sequence"
@@ -349,7 +349,7 @@ You can configure the client using the following options:
349
349
  | `--model` | Model to use |
350
350
  | `--list-models` | List all available models for the selected configuration (can be combined with --config-index) |
351
351
  | `--web-search` | Enable web search capability |
352
- | `-n, --no-stream` | Return the whole response without streaming |
352
+ | `--no-stream` | Return the whole response without streaming |
353
353
  | `--temperature` | Set temperature (controls randomness, default: 0.7) |
354
354
  | `--top_p` | Set top_p (controls diversity, default: 1.0) |
355
355
  | `--max_tokens` | Set maximum response length in tokens |
@@ -2,7 +2,7 @@ ngpt/__init__.py,sha256=kpKhViLakwMdHZkuLht2vWcjt0uD_5gR33gvMhfXr6w,664
2
2
  ngpt/cli.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
3
3
  ngpt/client.py,sha256=Rv-JO8RAmw1v3gdLkwaPe_PEw6p83cejO0YNT_DDjeg,15134
4
4
  ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
5
- ngpt/cli/args.py,sha256=2e13wYQGfHFXpxZz5wXuvmoYpIkK6PEZQamHxfHAdyY,8868
5
+ ngpt/cli/args.py,sha256=y8bjlmxzKucx7-uVbqlqLgneIMMBTDYzgA_sxd8e-Xw,8862
6
6
  ngpt/cli/config_manager.py,sha256=POjX3Asqap2N_Y6Qq0JC3OLZdzxRpFz3D0Lk19Now2U,3758
7
7
  ngpt/cli/formatters.py,sha256=1ofNEWEZtFr0MJ3oWomoL_mFmZHlUdT3I5qGtbDQ4g0,9378
8
8
  ngpt/cli/interactive.py,sha256=5xMMP1MuYW4jsbUEbjElE25fcJpgHVBbx2dIj8M39M8,10959
@@ -15,11 +15,11 @@ ngpt/cli/modes/code.py,sha256=bFE6x_CUncOM0gyAHOpcJs6nxj_ljFK0AYwJiT1Ndaw,4332
15
15
  ngpt/cli/modes/shell.py,sha256=oqqEqWdqcH5q4pmis-hT9ZEFNk9-kaKHHdpRu217u5A,2721
16
16
  ngpt/cli/modes/text.py,sha256=sUhgE5XubYxksnQDUvnCFrEbqz1G-CS_iWZZMGkULcI,3179
17
17
  ngpt/utils/__init__.py,sha256=E46suk2-QgYBI0Qrs6WXOajOUOebF3ETAFY7ah8DTWs,942
18
- ngpt/utils/cli_config.py,sha256=fUtahEUJlFt1cguIXrfHk0exn6O1qnm50uTKAgvtySc,9984
18
+ ngpt/utils/cli_config.py,sha256=7T5JDQPZG_qJnRa2FJM3_hhAFWiglIeHHlkLybRXXxU,10697
19
19
  ngpt/utils/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
20
20
  ngpt/utils/log.py,sha256=Bxv2-GbWtVYa3u94Zs_OVEvYk_CbuT5hrDH06KHLXa8,6369
21
- ngpt-2.11.1.dist-info/METADATA,sha256=8M9Vs0Me23qWxlCcuaynSHwC_xVuNOOfI4_s69OXN08,20627
22
- ngpt-2.11.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- ngpt-2.11.1.dist-info/entry_points.txt,sha256=1cnAMujyy34DlOahrJg19lePSnb08bLbkUs_kVerqdk,39
24
- ngpt-2.11.1.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
25
- ngpt-2.11.1.dist-info/RECORD,,
21
+ ngpt-2.11.3.dist-info/METADATA,sha256=dNmpBqL6H1HHUKvf5i_uiRS_t45q0l2bo61SHyrA_tw,20632
22
+ ngpt-2.11.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ ngpt-2.11.3.dist-info/entry_points.txt,sha256=1cnAMujyy34DlOahrJg19lePSnb08bLbkUs_kVerqdk,39
24
+ ngpt-2.11.3.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
25
+ ngpt-2.11.3.dist-info/RECORD,,
File without changes