ngpt 2.11.3__py3-none-any.whl → 2.11.5__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/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
ngpt/cli/args.py CHANGED
@@ -28,28 +28,47 @@ def setup_argument_parser():
28
28
  parser.exit()
29
29
 
30
30
  # Version flag
31
- parser.add_argument('-v', '--version', action=ColoredVersionAction, nargs=0, help='Show version information and exit')
31
+ parser.add_argument('-v', '--version', action=ColoredVersionAction, nargs=0,
32
+ help='Show version information and exit')
33
+ # Language option for code mode
34
+ parser.add_argument('--language', default="python",
35
+ help='Programming language to generate code in (for code mode)')
32
36
 
37
+ # Prompt argument
38
+ parser.add_argument('prompt', nargs='?', default=None,
39
+ help='The prompt to send')
40
+
33
41
  # Config options
34
42
  config_group = parser.add_argument_group('Configuration Options')
35
- config_group.add_argument('--config', nargs='?', const=True, help='Path to a custom config file or, if no value provided, enter interactive configuration mode to create a new config')
36
- config_group.add_argument('--config-index', type=int, default=0, help='Index of the configuration to use or edit (default: 0)')
37
- config_group.add_argument('--provider', help='Provider name to identify the configuration to use')
38
- config_group.add_argument('--remove', action='store_true', help='Remove the configuration at the specified index (requires --config and --config-index)')
39
- config_group.add_argument('--show-config', action='store_true', help='Show the current configuration(s) and exit')
40
- config_group.add_argument('--all', action='store_true', help='Show details for all configurations (requires --show-config)')
41
- config_group.add_argument('--list-models', action='store_true', help='List all available models for the current configuration and exit')
42
- config_group.add_argument('--list-renderers', action='store_true', help='Show available markdown renderers for use with --prettify')
43
-
43
+ config_group.add_argument('--config', nargs='?', const=True,
44
+ help='Path to a custom config file or, if no value provided, enter interactive configuration mode to create a new config')
45
+ config_group.add_argument('--config-index', type=int, default=0,
46
+ help='Index of the configuration to use or edit (default: 0)')
47
+ config_group.add_argument('--provider',
48
+ help='Provider name to identify the configuration to use')
49
+ config_group.add_argument('--remove', action='store_true',
50
+ help='Remove the configuration at the specified index (requires --config and --config-index or --provider)')
51
+ config_group.add_argument('--show-config', action='store_true',
52
+ help='Show the current configuration(s) and exit')
53
+ config_group.add_argument('--all', action='store_true',
54
+ help='Show details for all configurations (requires --show-config)')
55
+ config_group.add_argument('--list-models', action='store_true',
56
+ help='List all available models for the current configuration and exit')
57
+ config_group.add_argument('--list-renderers', action='store_true',
58
+ help='Show available markdown renderers for use with --prettify')
59
+ config_group.add_argument('--cli-config', nargs='*', metavar='COMMAND',
60
+ help='Manage CLI configuration (set, get, unset, list, help)')
61
+
44
62
  # Global options
45
63
  global_group = parser.add_argument_group('Global Options')
46
- global_group.add_argument('--api-key', help='API key for the service')
47
- global_group.add_argument('--base-url', help='Base URL for the API')
48
- global_group.add_argument('--model', help='Model to use')
64
+ global_group.add_argument('--api-key',
65
+ help='API key for the service')
66
+ global_group.add_argument('--base-url',
67
+ help='Base URL for the API')
68
+ global_group.add_argument('--model',
69
+ help='Model to use')
49
70
  global_group.add_argument('--web-search', action='store_true',
50
71
  help='Enable web search capability (Note: Your API endpoint must support this feature)')
51
- global_group.add_argument('--no-stream', action='store_true',
52
- help='Return the whole response without streaming')
53
72
  global_group.add_argument('--temperature', type=float, default=0.7,
54
73
  help='Set temperature (controls randomness, default: 0.7)')
55
74
  global_group.add_argument('--top_p', type=float, default=1.0,
@@ -60,6 +79,8 @@ def setup_argument_parser():
60
79
  help='Set filepath to log conversation to, or create a temporary log file if no path provided')
61
80
  global_group.add_argument('--preprompt',
62
81
  help='Set custom system prompt to control AI behavior')
82
+ global_group.add_argument('--no-stream', action='store_true',
83
+ help='Return the whole response without streaming')
63
84
  global_group.add_argument('--prettify', action='store_const', const='auto',
64
85
  help='Render markdown responses and code with syntax highlighting and formatting')
65
86
  global_group.add_argument('--stream-prettify', action='store_true',
@@ -70,22 +91,16 @@ def setup_argument_parser():
70
91
  # Mode flags (mutually exclusive)
71
92
  mode_group = parser.add_argument_group('Modes (mutually exclusive)')
72
93
  mode_exclusive_group = mode_group.add_mutually_exclusive_group()
73
- mode_exclusive_group.add_argument('-i', '--interactive', action='store_true', help='Start an interactive chat session')
74
- mode_exclusive_group.add_argument('-s', '--shell', action='store_true', help='Generate and execute shell commands')
75
- mode_exclusive_group.add_argument('-c', '--code', action='store_true', help='Generate code')
76
- mode_exclusive_group.add_argument('-t', '--text', action='store_true', help='Enter multi-line text input (submit with Ctrl+D)')
94
+ mode_exclusive_group.add_argument('-i', '--interactive', action='store_true',
95
+ help='Start an interactive chat session')
96
+ mode_exclusive_group.add_argument('-s', '--shell', action='store_true',
97
+ help='Generate and execute shell commands')
98
+ mode_exclusive_group.add_argument('-c', '--code', action='store_true',
99
+ help='Generate code')
100
+ mode_exclusive_group.add_argument('-t', '--text', action='store_true',
101
+ help='Enter multi-line text input (submit with Ctrl+D)')
77
102
  # Note: --show-config is handled separately and implicitly acts as a mode
78
103
 
79
- # Language option for code mode
80
- parser.add_argument('--language', default="python", help='Programming language to generate code in (for code mode)')
81
-
82
- # Prompt argument
83
- parser.add_argument('prompt', nargs='?', default=None, help='The prompt to send')
84
-
85
- # Add CLI configuration command
86
- config_group.add_argument('--cli-config', nargs='*', metavar='COMMAND',
87
- help='Manage CLI configuration (set, get, unset, list)')
88
-
89
104
  return parser
90
105
 
91
106
  def parse_args():
@@ -1,5 +1,4 @@
1
1
  import sys
2
- from ..utils.config import get_config_path, load_configs, add_config_entry, remove_config_entry
3
2
  from .formatters import COLORS
4
3
 
5
4
  def show_config_help():
ngpt/cli/interactive.py CHANGED
@@ -1,11 +1,8 @@
1
- import sys
2
1
  import os
3
2
  import shutil
4
- import datetime
5
3
  import traceback
6
4
  from .formatters import COLORS
7
5
  from .renderers import prettify_markdown, prettify_streaming_markdown
8
- from ..utils.log import create_logger
9
6
 
10
7
  # Optional imports for enhanced UI
11
8
  try:
ngpt/cli/main.py CHANGED
@@ -15,9 +15,9 @@ from ..utils.cli_config import (
15
15
  from ..utils.log import create_logger
16
16
  from .. import __version__
17
17
 
18
- from .formatters import COLORS, ColoredHelpFormatter
19
- from .renderers import has_markdown_renderer, warn_if_no_markdown_renderer, show_available_renderers
20
- from .config_manager import show_config_help, check_config
18
+ from .formatters import COLORS
19
+ from .renderers import show_available_renderers
20
+ from .config_manager import check_config
21
21
  from .interactive import interactive_chat_session
22
22
  from .modes.chat import chat_mode
23
23
  from .modes.code import code_mode
ngpt/cli/modes/chat.py CHANGED
@@ -1,6 +1,5 @@
1
1
  from ..formatters import COLORS
2
2
  from ..renderers import prettify_markdown, prettify_streaming_markdown
3
- from ...utils.log import create_logger
4
3
  import sys
5
4
 
6
5
  def chat_mode(client, args, logger=None):
ngpt/cli/modes/code.py CHANGED
@@ -1,6 +1,5 @@
1
1
  from ..formatters import COLORS
2
2
  from ..renderers import prettify_markdown, prettify_streaming_markdown, has_markdown_renderer, show_available_renderers
3
- from ...utils.log import create_logger
4
3
  import sys
5
4
 
6
5
  def code_mode(client, args, logger=None):
ngpt/cli/modes/shell.py CHANGED
@@ -1,5 +1,4 @@
1
1
  from ..formatters import COLORS
2
- from ...utils.log import create_logger
3
2
  import subprocess
4
3
  import sys
5
4
 
ngpt/cli/modes/text.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from ..formatters import COLORS
2
2
  from ..renderers import prettify_markdown, prettify_streaming_markdown
3
3
  from ..ui import get_multiline_input
4
- from ...utils.log import create_logger
5
4
 
6
5
  def text_mode(client, args, logger=None):
7
6
  """Handle the multi-line text input mode.
ngpt/cli/renderers.py CHANGED
@@ -1,4 +1,3 @@
1
- import sys
2
1
  import os
3
2
  import shutil
4
3
  import subprocess
ngpt/cli/ui.py CHANGED
@@ -1,6 +1,5 @@
1
1
  import sys
2
2
  import shutil
3
- from .formatters import COLORS
4
3
 
5
4
  # Optional imports for enhanced UI
6
5
  try:
ngpt/client.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Optional, Dict, Any, List
1
+ from typing import Optional, Dict, List
2
2
  import os
3
3
  import json
4
4
  import requests
ngpt/utils/cli_config.py CHANGED
@@ -2,7 +2,7 @@ import os
2
2
  import sys
3
3
  import json
4
4
  from pathlib import Path
5
- from typing import Dict, Optional, Any, List, Union, Tuple
5
+ from typing import Dict, Any, List, Union, Tuple
6
6
 
7
7
  # CLI config options with their types and default values
8
8
  CLI_CONFIG_OPTIONS = {
ngpt/utils/log.py CHANGED
@@ -1,7 +1,6 @@
1
1
  import os
2
2
  import sys
3
3
  import datetime
4
- import tempfile
5
4
  from pathlib import Path
6
5
  from typing import Optional, TextIO, Dict, Any
7
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 2.11.3
3
+ Version: 2.11.5
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
@@ -79,6 +79,9 @@ uv tool install ngpt
79
79
  # Chat with default settings
80
80
  ngpt "Tell me about quantum computing"
81
81
 
82
+ # Alternatively, run as a Python module
83
+ python -m ngpt "Tell me about quantum computing"
84
+
82
85
  # Start an interactive chat session with conversation memory
83
86
  ngpt -i
84
87
 
@@ -0,0 +1,26 @@
1
+ ngpt/__init__.py,sha256=kpKhViLakwMdHZkuLht2vWcjt0uD_5gR33gvMhfXr6w,664
2
+ ngpt/__main__.py,sha256=8jnUtGyV5HLiixnmWKxRK9nrWOSgE7yr95XbdmemvxE,61
3
+ ngpt/cli.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
4
+ ngpt/client.py,sha256=rLgDPmJe8_yi13-XUiHJ45z54rJVrupxWmeb-fQZGF4,15129
5
+ ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
6
+ ngpt/cli/args.py,sha256=3yrTkgd5N0IiQyalV1sDs2-jMBRicWkYg3x3RKk8SgI,9409
7
+ ngpt/cli/config_manager.py,sha256=NQQcWnjUppAAd0s0p9YAf8EyKS1ex5-0EB4DvKdB4dk,3662
8
+ ngpt/cli/formatters.py,sha256=1ofNEWEZtFr0MJ3oWomoL_mFmZHlUdT3I5qGtbDQ4g0,9378
9
+ ngpt/cli/interactive.py,sha256=DZFbExcXd7RylkpBiZBhiI6N8FBaT0m_lBes0Pvhi48,10894
10
+ ngpt/cli/main.py,sha256=lDJOeaXTiiqXbcYDwCLFixMfAZZ8zN4wzBew1lOdr4w,27440
11
+ ngpt/cli/renderers.py,sha256=gJ3WdVvCGkNxrLEkLCh6gk9HBFMK8y7an6CsEkqt2Z8,10535
12
+ ngpt/cli/ui.py,sha256=iMinm_QdsmwrEUpb7CBRexyyBqf4sviFI9M3E8D-hhA,5303
13
+ ngpt/cli/modes/__init__.py,sha256=11znFpqzHyRsEtaTrms5M3q2SrscT9VvUgr7C2B1o-E,179
14
+ ngpt/cli/modes/chat.py,sha256=gXgy8lZNIfu-UTCsRpZJzW_vEriUl19QB_oFQtXRRL0,3138
15
+ ngpt/cli/modes/code.py,sha256=RjOAj7BDO5vLUdIPkUfPtyIkI_W6qEHsZvYh-sIdVaM,4293
16
+ ngpt/cli/modes/shell.py,sha256=lF9f7w-0bl_FdZl-WJnZuV736BKrWQtrwoKr3ejPXFE,2682
17
+ ngpt/cli/modes/text.py,sha256=ncYnfLFMdTPuHiOvAaHNiOWhox6GF6S-2fTwMIrAz-g,3140
18
+ ngpt/utils/__init__.py,sha256=E46suk2-QgYBI0Qrs6WXOajOUOebF3ETAFY7ah8DTWs,942
19
+ ngpt/utils/cli_config.py,sha256=A1TgO1rkRs6zgfNwIw5v8-N5jxqrHMZ4B6r3w48egi8,10687
20
+ ngpt/utils/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
21
+ ngpt/utils/log.py,sha256=3AJiry9vUbo9Rzzrgj6-NMM4lCbgoZhrGcXvdxMqtrs,6353
22
+ ngpt-2.11.5.dist-info/METADATA,sha256=4SN84RPaPPQj5uHmppF9CPfZiwLsMyytqt3JJyElbew,20722
23
+ ngpt-2.11.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ ngpt-2.11.5.dist-info/entry_points.txt,sha256=1cnAMujyy34DlOahrJg19lePSnb08bLbkUs_kVerqdk,39
25
+ ngpt-2.11.5.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
26
+ ngpt-2.11.5.dist-info/RECORD,,
@@ -1,25 +0,0 @@
1
- ngpt/__init__.py,sha256=kpKhViLakwMdHZkuLht2vWcjt0uD_5gR33gvMhfXr6w,664
2
- ngpt/cli.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
3
- ngpt/client.py,sha256=Rv-JO8RAmw1v3gdLkwaPe_PEw6p83cejO0YNT_DDjeg,15134
4
- ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
5
- ngpt/cli/args.py,sha256=y8bjlmxzKucx7-uVbqlqLgneIMMBTDYzgA_sxd8e-Xw,8862
6
- ngpt/cli/config_manager.py,sha256=POjX3Asqap2N_Y6Qq0JC3OLZdzxRpFz3D0Lk19Now2U,3758
7
- ngpt/cli/formatters.py,sha256=1ofNEWEZtFr0MJ3oWomoL_mFmZHlUdT3I5qGtbDQ4g0,9378
8
- ngpt/cli/interactive.py,sha256=5xMMP1MuYW4jsbUEbjElE25fcJpgHVBbx2dIj8M39M8,10959
9
- ngpt/cli/main.py,sha256=wSFVkg42NYIJQLMI9iOkW9nz2c6uukmwZghbaw6fYDk,27533
10
- ngpt/cli/renderers.py,sha256=U3Vef3nY1NF2JKtLUtUjdFomyqIrijGWdxRPm46urr4,10546
11
- ngpt/cli/ui.py,sha256=2JXkCRw5utaKpNZIy0u8F_Jh2zrWbm93dMz91wf9CkQ,5334
12
- ngpt/cli/modes/__init__.py,sha256=11znFpqzHyRsEtaTrms5M3q2SrscT9VvUgr7C2B1o-E,179
13
- ngpt/cli/modes/chat.py,sha256=OtD0iNoSpJ79gojaaCDOr0WPpRmAwzPPG8kwDjESrXo,3177
14
- ngpt/cli/modes/code.py,sha256=bFE6x_CUncOM0gyAHOpcJs6nxj_ljFK0AYwJiT1Ndaw,4332
15
- ngpt/cli/modes/shell.py,sha256=oqqEqWdqcH5q4pmis-hT9ZEFNk9-kaKHHdpRu217u5A,2721
16
- ngpt/cli/modes/text.py,sha256=sUhgE5XubYxksnQDUvnCFrEbqz1G-CS_iWZZMGkULcI,3179
17
- ngpt/utils/__init__.py,sha256=E46suk2-QgYBI0Qrs6WXOajOUOebF3ETAFY7ah8DTWs,942
18
- ngpt/utils/cli_config.py,sha256=7T5JDQPZG_qJnRa2FJM3_hhAFWiglIeHHlkLybRXXxU,10697
19
- ngpt/utils/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
20
- ngpt/utils/log.py,sha256=Bxv2-GbWtVYa3u94Zs_OVEvYk_CbuT5hrDH06KHLXa8,6369
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