ngpt 2.11.2__tar.gz → 2.11.4__tar.gz
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-2.11.2 → ngpt-2.11.4}/PKG-INFO +3 -3
- {ngpt-2.11.2 → ngpt-2.11.4}/README.md +2 -2
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/configuration.md +1 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/examples/basic.md +1 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/usage/cli_usage.md +3 -3
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/args.py +44 -29
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/config_manager.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/interactive.py +0 -3
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/main.py +3 -3
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/modes/chat.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/modes/code.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/modes/shell.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/modes/text.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/renderers.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/ui.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/client.py +1 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/utils/cli_config.py +7 -3
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/utils/log.py +0 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/pyproject.toml +1 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/uv.lock +1 -1
- {ngpt-2.11.2 → ngpt-2.11.4}/.github/workflows/python-publish.yml +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/.gitignore +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/.python-version +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/COMMIT_GUIDELINES.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/CONTRIBUTING.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/LICENSE +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/CONTRIBUTING.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/LICENSE.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/README.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/_config.yml +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/api/README.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/api/cli.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/api/cli_config.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/api/client.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/api/config.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/assets/css/style.scss +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/examples/README.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/examples/advanced.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/examples/cli_components.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/examples/integrations.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/installation.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/overview.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/usage/README.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/usage/cli_config.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/usage/cli_framework.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/docs/usage/library_usage.md +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/__init__.py +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/__init__.py +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/formatters.py +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli/modes/__init__.py +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/cli.py +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/utils/__init__.py +0 -0
- {ngpt-2.11.2 → ngpt-2.11.4}/ngpt/utils/config.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 2.11.
|
3
|
+
Version: 2.11.4
|
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 -
|
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
|
-
|
|
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 |
|
@@ -48,7 +48,7 @@ ngpt "Tell me about quantum computing"
|
|
48
48
|
ngpt -i
|
49
49
|
|
50
50
|
# Return response without streaming
|
51
|
-
ngpt -
|
51
|
+
ngpt --no-stream "Tell me about quantum computing"
|
52
52
|
|
53
53
|
# Generate code
|
54
54
|
ngpt --code "function to calculate the Fibonacci sequence"
|
@@ -314,7 +314,7 @@ You can configure the client using the following options:
|
|
314
314
|
| `--model` | Model to use |
|
315
315
|
| `--list-models` | List all available models for the selected configuration (can be combined with --config-index) |
|
316
316
|
| `--web-search` | Enable web search capability |
|
317
|
-
|
|
317
|
+
| `--no-stream` | Return the whole response without streaming |
|
318
318
|
| `--temperature` | Set temperature (controls randomness, default: 0.7) |
|
319
319
|
| `--top_p` | Set top_p (controls diversity, default: 1.0) |
|
320
320
|
| `--max_tokens` | Set maximum response length in tokens |
|
@@ -124,7 +124,7 @@ You can also set configuration options directly via command-line arguments:
|
|
124
124
|
- `-c, --code`: Generate code.
|
125
125
|
- `--language <lang>`: Specify the programming language for code generation (e.g., `python`, `javascript`, default: `python`).
|
126
126
|
- `-t, --text`: Use a multiline editor for input.
|
127
|
-
-
|
127
|
+
- `--no-stream`: Disable streaming output.
|
128
128
|
- `--prettify`: Enable formatted markdown/code output (disables streaming).
|
129
129
|
- `--renderer <name>`: Choose the renderer (`auto`, `rich`, `glow`).
|
130
130
|
- `--list-renderers`: Show available renderers.
|
@@ -128,7 +128,7 @@ print(response)
|
|
128
128
|
ngpt "Tell me about quantum computing"
|
129
129
|
|
130
130
|
# No streaming (wait for full response)
|
131
|
-
ngpt -
|
131
|
+
ngpt --no-stream "Explain the theory of relativity"
|
132
132
|
|
133
133
|
# Prettify markdown output
|
134
134
|
ngpt --prettify "Create a markdown table comparing different programming languages"
|
@@ -48,7 +48,7 @@ Below is a comprehensive list of all available command-line options, organized b
|
|
48
48
|
| `-s, --shell` | Generate and execute shell commands appropriate for your operating system |
|
49
49
|
| `-c, --code` | Generate clean code without markdown formatting or explanations |
|
50
50
|
| `-t, --text` | Open interactive multiline editor for complex prompts with syntax highlighting |
|
51
|
-
|
|
51
|
+
| `--no-stream` | Return the whole response without streaming (useful for scripts) |
|
52
52
|
|
53
53
|
### Configuration Management
|
54
54
|
|
@@ -598,7 +598,7 @@ You can combine various options:
|
|
598
598
|
ngpt -c --web-search "function to get current weather using an API"
|
599
599
|
|
600
600
|
# Use a specific model and no streaming
|
601
|
-
ngpt --model gpt-4o-mini -
|
601
|
+
ngpt --model gpt-4o-mini --no-stream "Explain quantum entanglement"
|
602
602
|
|
603
603
|
# Interactive session with custom prompt and logging
|
604
604
|
ngpt -i --preprompt "You are a data science tutor" --log datasci_tutoring.txt
|
@@ -768,6 +768,6 @@ If the `ngpt` command is not found after installation:
|
|
768
768
|
- Use environment variables when appropriate
|
769
769
|
|
770
770
|
5. **Improve efficiency**:
|
771
|
-
- Use
|
771
|
+
- Use `--no-stream` for faster responses in scripts
|
772
772
|
- Use interactive mode when having a conversation
|
773
773
|
- Exit interactive sessions when not in use to save API costs
|
@@ -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,
|
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,
|
36
|
-
|
37
|
-
config_group.add_argument('--
|
38
|
-
|
39
|
-
config_group.add_argument('--
|
40
|
-
|
41
|
-
config_group.add_argument('--
|
42
|
-
|
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',
|
47
|
-
|
48
|
-
global_group.add_argument('--
|
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('-n', '--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',
|
74
|
-
|
75
|
-
mode_exclusive_group.add_argument('-
|
76
|
-
|
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,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:
|
@@ -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
|
19
|
-
from .renderers import
|
20
|
-
from .config_manager import
|
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
|
@@ -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.
|
@@ -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,
|
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 = {
|
@@ -206,8 +206,12 @@ 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(
|
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()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "ngpt"
|
3
|
-
version = "2.11.
|
3
|
+
version = "2.11.4"
|
4
4
|
description = "A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints."
|
5
5
|
authors = [
|
6
6
|
{name = "nazDridoy", email = "nazdridoy399@gmail.com"},
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|