ngpt 2.8.0__py3-none-any.whl → 2.9.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/utils/__init__.py ADDED
@@ -0,0 +1 @@
1
+ # ngpt utils module
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 2.8.0
3
+ Version: 2.9.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
@@ -28,10 +28,9 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
28
28
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
29
  Classifier: Topic :: Utilities
30
30
  Requires-Python: >=3.8
31
+ Requires-Dist: prompt-toolkit>=3.0.0
31
32
  Requires-Dist: requests>=2.31.0
32
- Provides-Extra: full
33
- Requires-Dist: prompt-toolkit>=3.0.0; extra == 'full'
34
- Requires-Dist: rich>=10.0.0; extra == 'full'
33
+ Requires-Dist: rich>=10.0.0
35
34
  Description-Content-Type: text/markdown
36
35
 
37
36
  # nGPT
@@ -43,6 +42,9 @@ Description-Content-Type: text/markdown
43
42
 
44
43
  A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints.
45
44
 
45
+ ![2025-04-23_16-18-01](https://github.com/user-attachments/assets/b8e58926-5165-4352-b48b-9f4a982da86e)
46
+
47
+
46
48
  ## Table of Contents
47
49
  - [Quick Start](#quick-start)
48
50
  - [Features](#features)
@@ -52,6 +54,7 @@ A lightweight Python CLI and library for interacting with OpenAI-compatible APIs
52
54
  - [Documentation](https://nazdridoy.github.io/ngpt/)
53
55
  - [CLI Tool](#as-a-cli-tool)
54
56
  - [Python Library](#as-a-library)
57
+ - [CLI Framework](#as-a-cli-framework)
55
58
  - [Configuration](#configuration)
56
59
  - [Command Line Options](#command-line-options)
57
60
  - [CLI Configuration](#cli-configuration)
@@ -64,11 +67,14 @@ A lightweight Python CLI and library for interacting with OpenAI-compatible APIs
64
67
  ## Quick Start
65
68
 
66
69
  ```bash
67
- # Install
70
+ # Install with pip
68
71
  pip install ngpt
69
72
 
70
- # Install with additional features
71
- pip install "ngpt[full]"
73
+ # Or install with uv (faster)
74
+ uv pip install ngpt
75
+
76
+ # Or install globally as a CLI tool (recommended)
77
+ uv tool install ngpt
72
78
 
73
79
  # Chat with default settings
74
80
  ngpt "Tell me about quantum computing"
@@ -114,8 +120,8 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
114
120
 
115
121
  ## Features
116
122
 
117
- - ✅ **Dual Mode**: Use as a CLI tool or import as a Python library
118
- - 🪶 **Lightweight**: Minimal dependencies (just `requests`)
123
+ - ✅ **Versatile**: Use as a CLI tool, Python library, or CLI framework for building custom tools
124
+ - 🪶 **Lightweight**: Minimal dependencies with everything you need included
119
125
  - 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, and any compatible endpoint
120
126
  - 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
121
127
  - 📊 **Streaming Responses**: Real-time output for better user experience
@@ -128,6 +134,7 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
128
134
  - 📝 **Rich Multiline Editor**: Interactive multiline text input with syntax highlighting and intuitive controls
129
135
  - 🎭 **System Prompts**: Customize model behavior with custom system prompts
130
136
  - 📃 **Conversation Logging**: Save your conversations to text files for later reference
137
+ - 🧰 **CLI Components**: Reusable components for building custom AI-powered command-line tools
131
138
 
132
139
  See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview.html) for more details.
133
140
 
@@ -141,25 +148,25 @@ Key documentation sections:
141
148
  - [Installation Guide](https://nazdridoy.github.io/ngpt/installation.html)
142
149
  - [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage.html)
143
150
  - [Library Usage Guide](https://nazdridoy.github.io/ngpt/usage/library_usage.html)
151
+ - [CLI Framework Guide](https://nazdridoy.github.io/ngpt/usage/cli_framework.html)
144
152
  - [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration.html)
145
153
  - [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic.html)
146
154
 
147
155
  ## Installation
148
156
 
149
157
  ```bash
150
- # Basic installation (minimal dependencies)
158
+ # Installation with pip
151
159
  pip install ngpt
152
160
 
153
- # Full installation with all features (recommended)
154
- pip install "ngpt[full]"
161
+ # Or install with uv (faster installation)
162
+ uv pip install ngpt
163
+
164
+ # Or install globally as a CLI tool (recommended for command-line usage)
165
+ uv tool install ngpt
155
166
  ```
156
167
 
157
168
  Requires Python 3.8 or newer.
158
169
 
159
- The full installation includes:
160
- - Enhanced markdown rendering with syntax highlighting
161
- - Improved interactive input experience with multiline editing
162
-
163
170
  For detailed installation instructions, see the [Installation Guide](https://nazdridoy.github.io/ngpt/installation.html).
164
171
 
165
172
  ## Usage
@@ -279,6 +286,49 @@ print(code)
279
286
 
280
287
  For advanced usage patterns and integrations, check out the [Advanced Examples](https://nazdridoy.github.io/ngpt/examples/advanced.html).
281
288
 
289
+ ### As a CLI Framework
290
+
291
+ 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.
292
+
293
+ ```python
294
+ from ngpt import NGPTClient, load_config
295
+ from ngpt.cli.main import interactive_chat_session
296
+ from ngpt.cli.renderers import prettify_markdown
297
+ from ngpt.cli.formatters import ColoredHelpFormatter
298
+ import argparse
299
+
300
+ # Create a custom CLI tool with colorized help
301
+ parser = argparse.ArgumentParser(
302
+ description="Specialized Code Assistant",
303
+ formatter_class=ColoredHelpFormatter
304
+ )
305
+ parser.add_argument("prompt", nargs="?", help="Code description")
306
+ parser.add_argument("--language", "-l", default="python", help="Programming language")
307
+ parser.add_argument("--interactive", "-i", action="store_true", help="Start interactive mode")
308
+ args = parser.parse_args()
309
+
310
+ # Initialize client
311
+ client = NGPTClient(**load_config())
312
+
313
+ # Use interactive session for conversation
314
+ if args.interactive:
315
+ system_prompt = f"You are an expert {args.language} developer. Provide clear, detailed answers."
316
+ interactive_chat_session(client=client, preprompt=system_prompt, prettify=True)
317
+ elif args.prompt:
318
+ # Generate and prettify code
319
+ code = client.generate_code(args.prompt, language=args.language)
320
+ print(prettify_markdown(f"```{args.language}\n{code}\n```"))
321
+ ```
322
+
323
+ This allows you to build specialized AI tools like:
324
+ - Code generators for specific languages or frameworks
325
+ - Domain-specific assistants (SQL, legal, finance, etc.)
326
+ - Documentation generators
327
+ - Translation tools
328
+ - And much more
329
+
330
+ For detailed information about building CLI tools with nGPT, see the [CLI Framework Guide](https://nazdridoy.github.io/ngpt/usage/cli_framework.html) and explore the [CLI Component Examples](https://nazdridoy.github.io/ngpt/examples/cli_components.html).
331
+
282
332
  ## Configuration
283
333
 
284
334
  ### Command Line Options
@@ -305,13 +355,15 @@ You can configure the client using the following options:
305
355
  | `--config` | Path to a custom configuration file or, when used without a value, enters interactive configuration mode |
306
356
  | `--config-index` | Index of the configuration to use (default: 0) |
307
357
  | `--provider` | Provider name to identify the configuration to use (alternative to --config-index) |
308
- | `--remove` | Remove the configuration at the specified index (requires --config and --config-index) |
358
+ | `--remove` | Remove the configuration at the specified index (requires --config and --config-index or --provider) |
309
359
  | `--show-config` | Show configuration details and exit |
310
360
  | `--all` | Used with `--show-config` to display all configurations |
311
361
  | `-i, --interactive` | Start an interactive chat session with stylish UI, conversation history, and special commands |
312
362
  | `-s, --shell` | Generate and execute shell commands |
313
363
  | `-c, --code` | Generate clean code output |
314
364
  | `-t, --text` | Open interactive multiline editor for complex prompts |
365
+ | `--language` | Programming language to generate code in (for code mode, default: python) |
366
+ | `--cli-config` | Manage CLI configuration settings (set, get, unset, list, help) |
315
367
  | `-v, --version` | Show version information |
316
368
 
317
369
  For a complete reference of all available options, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage.html).
@@ -0,0 +1,23 @@
1
+ ngpt/__init__.py,sha256=awvycdj3tgcOr0BO81L4XU6DOtnToxFqkPHe1Pyu0Bw,652
2
+ ngpt/cli.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
3
+ ngpt/cli_config.py,sha256=LatikOJTtohbmCfXM6AH44qplbpyAD-x1kMkmaJHRS0,9046
4
+ ngpt/client.py,sha256=Rv-JO8RAmw1v3gdLkwaPe_PEw6p83cejO0YNT_DDjeg,15134
5
+ ngpt/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
6
+ ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
7
+ ngpt/cli/config_manager.py,sha256=L091h99ntMBth_FM39npGCOtDCV5kVkukNSkCIj6dpI,3752
8
+ ngpt/cli/formatters.py,sha256=1ofNEWEZtFr0MJ3oWomoL_mFmZHlUdT3I5qGtbDQ4g0,9378
9
+ ngpt/cli/interactive.py,sha256=J6DFkJVBdJ6NjZllsDgJnY1J5RTiKW341p4Zn4wHpGc,11718
10
+ ngpt/cli/main.py,sha256=HBa_FoyU3SOqtRz87qNAefk1CKoiSroYavR9qQMNhv0,30029
11
+ ngpt/cli/renderers.py,sha256=U3Vef3nY1NF2JKtLUtUjdFomyqIrijGWdxRPm46urr4,10546
12
+ ngpt/cli/ui.py,sha256=2JXkCRw5utaKpNZIy0u8F_Jh2zrWbm93dMz91wf9CkQ,5334
13
+ ngpt/cli/modes/__init__.py,sha256=11znFpqzHyRsEtaTrms5M3q2SrscT9VvUgr7C2B1o-E,179
14
+ ngpt/cli/modes/chat.py,sha256=ilTEGu3a8FJ_wGC_P5WnDLx0Okzh3QxJ8HoiYj84g0o,2721
15
+ ngpt/cli/modes/code.py,sha256=_Z3cKYdeifYZSXZ4dMnQWcnVpM2TvYQd-7S7Q3blfEw,3998
16
+ ngpt/cli/modes/shell.py,sha256=Fx83_JBc3P5vgCCPlXgXFSgzwTY0UMGfUwY4_CU10Ro,1654
17
+ ngpt/cli/modes/text.py,sha256=YpNpcujPweO_Biwg4aYwGw4_ShefzaNVtf8d_QrcR_Q,2719
18
+ ngpt/utils/__init__.py,sha256=NK8wlI9-YeaKPOaXBVfUj3mKOXohfD3GmNy5obOIXOM,20
19
+ ngpt-2.9.1.dist-info/METADATA,sha256=2_YMBdFfN_vPlaI5d6ZTsr9MPfq0ldkvTtr2rEfJ-n8,20343
20
+ ngpt-2.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
21
+ ngpt-2.9.1.dist-info/entry_points.txt,sha256=1cnAMujyy34DlOahrJg19lePSnb08bLbkUs_kVerqdk,39
22
+ ngpt-2.9.1.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
23
+ ngpt-2.9.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- ngpt/__init__.py,sha256=awvycdj3tgcOr0BO81L4XU6DOtnToxFqkPHe1Pyu0Bw,652
2
- ngpt/cli.py,sha256=8E65ovaJE0OJ3-M6aw_FqCNSy_1-x1h4NwhnsZOlXq4,81580
3
- ngpt/cli_config.py,sha256=LatikOJTtohbmCfXM6AH44qplbpyAD-x1kMkmaJHRS0,9046
4
- ngpt/client.py,sha256=Rv-JO8RAmw1v3gdLkwaPe_PEw6p83cejO0YNT_DDjeg,15134
5
- ngpt/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
6
- ngpt-2.8.0.dist-info/METADATA,sha256=g6KOwGut4qU6t1fbpsEaH1FPw6_PSDRRT3kZUGqO2ws,17993
7
- ngpt-2.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
- ngpt-2.8.0.dist-info/entry_points.txt,sha256=1cnAMujyy34DlOahrJg19lePSnb08bLbkUs_kVerqdk,39
9
- ngpt-2.8.0.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
10
- ngpt-2.8.0.dist-info/RECORD,,
File without changes