ngpt 2.10.0__tar.gz → 2.11.1__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.10.0 → ngpt-2.11.1}/CONTRIBUTING.md +18 -4
- {ngpt-2.10.0 → ngpt-2.11.1}/PKG-INFO +9 -4
- {ngpt-2.10.0 → ngpt-2.11.1}/README.md +8 -3
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/CONTRIBUTING.md +17 -3
- ngpt-2.11.1/docs/api/README.md +85 -0
- ngpt-2.11.1/docs/api/cli.md +663 -0
- ngpt-2.11.1/docs/api/cli_config.md +256 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/api/client.md +44 -3
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/api/config.md +59 -21
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/configuration.md +6 -3
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/examples/README.md +10 -1
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/examples/advanced.md +54 -19
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/examples/basic.md +32 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/examples/cli_components.md +15 -7
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/examples/integrations.md +13 -10
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/overview.md +5 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/usage/README.md +4 -2
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/usage/cli_config.md +36 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/usage/cli_framework.md +122 -21
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/usage/cli_usage.md +27 -4
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/usage/library_usage.md +72 -13
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/__init__.py +2 -2
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/args.py +2 -2
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/config_manager.py +1 -1
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/interactive.py +18 -33
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/main.py +75 -16
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/modes/chat.py +15 -1
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/modes/code.py +11 -1
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/modes/shell.py +33 -3
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/modes/text.py +15 -1
- ngpt-2.11.1/ngpt/utils/__init__.py +33 -0
- {ngpt-2.10.0/ngpt → ngpt-2.11.1/ngpt/utils}/cli_config.py +1 -1
- ngpt-2.11.1/ngpt/utils/log.py +180 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/pyproject.toml +1 -1
- {ngpt-2.10.0 → ngpt-2.11.1}/uv.lock +1 -1
- ngpt-2.10.0/docs/api/README.md +0 -47
- ngpt-2.10.0/docs/api/cli.md +0 -389
- ngpt-2.10.0/ngpt/utils/__init__.py +0 -1
- {ngpt-2.10.0 → ngpt-2.11.1}/.github/workflows/python-publish.yml +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/.gitignore +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/.python-version +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/COMMIT_GUIDELINES.md +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/LICENSE +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/LICENSE.md +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/README.md +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/_config.yml +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/assets/css/style.scss +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/docs/installation.md +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/__init__.py +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/formatters.py +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/modes/__init__.py +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/renderers.py +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli/ui.py +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/cli.py +0 -0
- {ngpt-2.10.0 → ngpt-2.11.1}/ngpt/client.py +0 -0
- {ngpt-2.10.0/ngpt → ngpt-2.11.1/ngpt/utils}/config.py +0 -0
@@ -20,9 +20,23 @@ Thank you for your interest in contributing to NGPT! This document provides guid
|
|
20
20
|
|
21
21
|
- `ngpt/` - Main package directory
|
22
22
|
- `__init__.py` - Package initialization
|
23
|
-
- `cli.py` -
|
24
|
-
- `
|
25
|
-
- `
|
23
|
+
- `cli.py` - Top-level CLI script (potentially legacy)
|
24
|
+
- `client.py` - Client implementation for API interaction
|
25
|
+
- `cli/` - Command-line interface implementation
|
26
|
+
- `__init__.py`
|
27
|
+
- `main.py` - Main CLI application logic
|
28
|
+
- `args.py` - Argument parsing setup
|
29
|
+
- `config_manager.py` - CLI configuration handling
|
30
|
+
- `formatters.py` - Output formatting logic
|
31
|
+
- `interactive.py` - Interactive mode implementation
|
32
|
+
- `modes/` - Different operational modes (e.g., chat, run)
|
33
|
+
- `renderers.py` - Output rendering logic (e.g., markdown)
|
34
|
+
- `ui.py` - User interface elements (e.g., prompts, spinners)
|
35
|
+
- `utils/` - Utility modules
|
36
|
+
- `__init__.py`
|
37
|
+
- `config.py` - API endpoint and general configuration management
|
38
|
+
- `cli_config.py` - CLI-specific option configuration management
|
39
|
+
- `log.py` - Logging setup and utilities
|
26
40
|
- `.github/` - GitHub workflows and templates
|
27
41
|
- `pyproject.toml` - Project configuration and dependencies
|
28
42
|
|
@@ -87,4 +101,4 @@ For questions about the project that aren't bugs or feature requests, please use
|
|
87
101
|
|
88
102
|
## License
|
89
103
|
|
90
|
-
By contributing to this project, you agree that your contributions will be licensed under the same [LICENSE](LICENSE) as the project.
|
104
|
+
By contributing to this project, you agree that your contributions will be licensed under the same [LICENSE](LICENSE) as the project.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.11.1
|
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
|
@@ -114,6 +114,9 @@ ngpt --preprompt "You are a Linux expert" "How do I find large files?"
|
|
114
114
|
|
115
115
|
# Log your conversation to a file
|
116
116
|
ngpt --interactive --log conversation.log
|
117
|
+
|
118
|
+
# Create a temporary log file automatically
|
119
|
+
ngpt --log "Tell me about quantum computing"
|
117
120
|
```
|
118
121
|
|
119
122
|
For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage.html).
|
@@ -228,7 +231,8 @@ For more CLI examples and detailed usage information, see the [CLI Usage Guide](
|
|
228
231
|
### As a Library
|
229
232
|
|
230
233
|
```python
|
231
|
-
from ngpt import NGPTClient
|
234
|
+
from ngpt import NGPTClient
|
235
|
+
from ngpt.utils.config import load_config
|
232
236
|
|
233
237
|
# Load the first configuration (index 0) from config file
|
234
238
|
config = load_config(config_index=0)
|
@@ -292,7 +296,8 @@ For advanced usage patterns and integrations, check out the [Advanced Examples](
|
|
292
296
|
nGPT can also be used as a framework to build your own AI-powered command-line tools. You can leverage nGPT's pre-built CLI components to quickly develop sophisticated CLI applications.
|
293
297
|
|
294
298
|
```python
|
295
|
-
from ngpt import NGPTClient
|
299
|
+
from ngpt import NGPTClient
|
300
|
+
from ngpt.utils.config import load_config
|
296
301
|
from ngpt.cli.interactive import interactive_chat_session
|
297
302
|
from ngpt.cli.renderers import prettify_markdown
|
298
303
|
from ngpt.cli.args import setup_argument_parser
|
@@ -349,7 +354,7 @@ You can configure the client using the following options:
|
|
349
354
|
| `--top_p` | Set top_p (controls diversity, default: 1.0) |
|
350
355
|
| `--max_tokens` | Set maximum response length in tokens |
|
351
356
|
| `--preprompt` | Set custom system prompt to control AI behavior |
|
352
|
-
| `--log` |
|
357
|
+
| `--log` | Enable logging: use `--log` to create a temporary log file, or `--log PATH` for a specific location |
|
353
358
|
| `--prettify` | Render markdown responses and code with syntax highlighting |
|
354
359
|
| `--stream-prettify` | Enable real-time markdown rendering with syntax highlighting while streaming |
|
355
360
|
| `--renderer` | Select which markdown renderer to use with --prettify (auto, rich, or glow) |
|
@@ -79,6 +79,9 @@ ngpt --preprompt "You are a Linux expert" "How do I find large files?"
|
|
79
79
|
|
80
80
|
# Log your conversation to a file
|
81
81
|
ngpt --interactive --log conversation.log
|
82
|
+
|
83
|
+
# Create a temporary log file automatically
|
84
|
+
ngpt --log "Tell me about quantum computing"
|
82
85
|
```
|
83
86
|
|
84
87
|
For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage.html).
|
@@ -193,7 +196,8 @@ For more CLI examples and detailed usage information, see the [CLI Usage Guide](
|
|
193
196
|
### As a Library
|
194
197
|
|
195
198
|
```python
|
196
|
-
from ngpt import NGPTClient
|
199
|
+
from ngpt import NGPTClient
|
200
|
+
from ngpt.utils.config import load_config
|
197
201
|
|
198
202
|
# Load the first configuration (index 0) from config file
|
199
203
|
config = load_config(config_index=0)
|
@@ -257,7 +261,8 @@ For advanced usage patterns and integrations, check out the [Advanced Examples](
|
|
257
261
|
nGPT can also be used as a framework to build your own AI-powered command-line tools. You can leverage nGPT's pre-built CLI components to quickly develop sophisticated CLI applications.
|
258
262
|
|
259
263
|
```python
|
260
|
-
from ngpt import NGPTClient
|
264
|
+
from ngpt import NGPTClient
|
265
|
+
from ngpt.utils.config import load_config
|
261
266
|
from ngpt.cli.interactive import interactive_chat_session
|
262
267
|
from ngpt.cli.renderers import prettify_markdown
|
263
268
|
from ngpt.cli.args import setup_argument_parser
|
@@ -314,7 +319,7 @@ You can configure the client using the following options:
|
|
314
319
|
| `--top_p` | Set top_p (controls diversity, default: 1.0) |
|
315
320
|
| `--max_tokens` | Set maximum response length in tokens |
|
316
321
|
| `--preprompt` | Set custom system prompt to control AI behavior |
|
317
|
-
| `--log` |
|
322
|
+
| `--log` | Enable logging: use `--log` to create a temporary log file, or `--log PATH` for a specific location |
|
318
323
|
| `--prettify` | Render markdown responses and code with syntax highlighting |
|
319
324
|
| `--stream-prettify` | Enable real-time markdown rendering with syntax highlighting while streaming |
|
320
325
|
| `--renderer` | Select which markdown renderer to use with --prettify (auto, rich, or glow) |
|
@@ -23,9 +23,23 @@ Thank you for your interest in contributing to NGPT! This document provides guid
|
|
23
23
|
|
24
24
|
- `ngpt/` - Main package directory
|
25
25
|
- `__init__.py` - Package initialization
|
26
|
-
- `cli.py` -
|
27
|
-
- `
|
28
|
-
- `
|
26
|
+
- `cli.py` - Top-level CLI script (potentially legacy)
|
27
|
+
- `client.py` - Client implementation for API interaction
|
28
|
+
- `cli/` - Command-line interface implementation
|
29
|
+
- `__init__.py`
|
30
|
+
- `main.py` - Main CLI application logic
|
31
|
+
- `args.py` - Argument parsing setup
|
32
|
+
- `config_manager.py` - CLI configuration handling
|
33
|
+
- `formatters.py` - Output formatting logic
|
34
|
+
- `interactive.py` - Interactive mode implementation
|
35
|
+
- `modes/` - Different operational modes (e.g., chat, run)
|
36
|
+
- `renderers.py` - Output rendering logic (e.g., markdown)
|
37
|
+
- `ui.py` - User interface elements (e.g., prompts, spinners)
|
38
|
+
- `utils/` - Utility modules
|
39
|
+
- `__init__.py`
|
40
|
+
- `config.py` - API endpoint and general configuration management
|
41
|
+
- `cli_config.py` - CLI-specific option configuration management
|
42
|
+
- `log.py` - Logging setup and utilities
|
29
43
|
- `.github/` - GitHub workflows and templates
|
30
44
|
- `pyproject.toml` - Project configuration and dependencies
|
31
45
|
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# API Reference
|
2
|
+
|
3
|
+
This section provides detailed documentation for the nGPT API, including all classes, methods, functions, and parameters.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
nGPT's API consists of several main components:
|
8
|
+
|
9
|
+
1. **NGPTClient**: The main client class used to interact with AI providers
|
10
|
+
2. **Configuration Utilities**: Functions for managing configuration files and settings
|
11
|
+
3. **CLI Components**: Modular CLI utilities that can be reused in custom applications
|
12
|
+
4. **CLI Configuration Utilities**: Functions for managing CLI-specific configurations
|
13
|
+
|
14
|
+
## Table of Contents
|
15
|
+
|
16
|
+
- [NGPTClient](client.md) - Primary client for interacting with LLM APIs
|
17
|
+
- [Initialization](client.md#initialization)
|
18
|
+
- [Chat Method](client.md#chat-method)
|
19
|
+
- [Generate Shell Command](client.md#generate-shell-command)
|
20
|
+
- [Generate Code](client.md#generate-code)
|
21
|
+
- [List Models](client.md#list-models)
|
22
|
+
|
23
|
+
- [Configuration](config.md) - Functions for managing configurations
|
24
|
+
- [Loading Configurations](config.md#loading-configurations)
|
25
|
+
- [Creating Configurations](config.md#creating-configurations)
|
26
|
+
- [Editing Configurations](config.md#editing-configurations)
|
27
|
+
- [Removing Configurations](config.md#removing-configurations)
|
28
|
+
- [Configuration Paths](config.md#configuration-paths)
|
29
|
+
|
30
|
+
- [CLI Components](cli.md) - CLI functionality
|
31
|
+
- [Module Structure](cli.md#module-structure)
|
32
|
+
- [Interactive Chat Module](cli.md#interactive-chat-module)
|
33
|
+
- [Formatters Module](cli.md#formatters-module)
|
34
|
+
- [Renderers Module](cli.md#renderers-module)
|
35
|
+
- [CLI Configuration Utilities](cli.md#cli-configuration-utilities)
|
36
|
+
- [Operation Modes](cli.md#operation-modes)
|
37
|
+
|
38
|
+
- [CLI Configuration](cli_config.md) - Persistent CLI settings
|
39
|
+
- [Loading Configuration](cli_config.md#load_cli_config)
|
40
|
+
- [Setting Options](cli_config.md#set_cli_config_option)
|
41
|
+
- [Getting Options](cli_config.md#get_cli_config_option)
|
42
|
+
- [Removing Options](cli_config.md#unset_cli_config_option)
|
43
|
+
- [Applying Configuration](cli_config.md#apply_cli_config)
|
44
|
+
- [Available Options](cli_config.md#available-cli-configuration-options)
|
45
|
+
|
46
|
+
## Quick Reference
|
47
|
+
|
48
|
+
```python
|
49
|
+
# Import core components
|
50
|
+
from ngpt import NGPTClient, load_config
|
51
|
+
|
52
|
+
# Import configuration utilities
|
53
|
+
from ngpt.utils.config import (
|
54
|
+
load_configs,
|
55
|
+
get_config_path,
|
56
|
+
get_config_dir,
|
57
|
+
add_config_entry,
|
58
|
+
remove_config_entry
|
59
|
+
)
|
60
|
+
|
61
|
+
# Import CLI configuration utilities
|
62
|
+
from ngpt.utils.cli_config import (
|
63
|
+
load_cli_config,
|
64
|
+
set_cli_config_option,
|
65
|
+
get_cli_config_option,
|
66
|
+
unset_cli_config_option,
|
67
|
+
apply_cli_config
|
68
|
+
)
|
69
|
+
|
70
|
+
# Import CLI module components
|
71
|
+
from ngpt.cli.interactive import interactive_chat_session
|
72
|
+
from ngpt.cli.formatters import prettify_markdown, ColoredHelpFormatter, COLORS
|
73
|
+
from ngpt.cli.renderers import prettify_streaming_markdown, has_markdown_renderer
|
74
|
+
|
75
|
+
# Import operation modes
|
76
|
+
from ngpt.cli.modes.chat import chat_mode
|
77
|
+
from ngpt.cli.modes.code import code_mode
|
78
|
+
from ngpt.cli.modes.shell import shell_mode
|
79
|
+
from ngpt.cli.modes.text import text_mode
|
80
|
+
|
81
|
+
# Import version information
|
82
|
+
from ngpt import __version__
|
83
|
+
```
|
84
|
+
|
85
|
+
For complete documentation on using these components, see the linked reference pages.
|