ngpt 3.4.4__tar.gz → 3.4.5__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-3.4.4/docs → ngpt-3.4.5}/CONTRIBUTING.md +42 -12
- {ngpt-3.4.4 → ngpt-3.4.5}/PKG-INFO +21 -144
- {ngpt-3.4.4 → ngpt-3.4.5}/PKGBUILD +1 -1
- {ngpt-3.4.4 → ngpt-3.4.5}/README.md +19 -142
- {ngpt-3.4.4 → ngpt-3.4.5/docs}/CONTRIBUTING.md +50 -8
- {ngpt-3.4.4 → ngpt-3.4.5}/docs/LICENSE.md +4 -0
- ngpt-3.4.5/docs/_config.yml +11 -0
- ngpt-3.4.5/docs/_sass/custom/custom.scss +18 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/docs/configuration.md +79 -136
- ngpt-3.4.5/docs/examples/advanced.md +361 -0
- ngpt-3.4.5/docs/examples/basic.md +322 -0
- ngpt-3.4.5/docs/examples.md +14 -0
- ngpt-3.4.5/docs/index.md +72 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/docs/installation.md +40 -66
- ngpt-3.4.5/docs/overview.md +120 -0
- ngpt-3.4.5/docs/usage/cli_config.md +266 -0
- ngpt-3.4.5/docs/usage/cli_usage.md +544 -0
- ngpt-3.4.5/docs/usage/gitcommsg.md +278 -0
- ngpt-3.4.5/docs/usage.md +15 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/chat.py +15 -11
- {ngpt-3.4.4 → ngpt-3.4.5}/pyproject.toml +2 -2
- {ngpt-3.4.4 → ngpt-3.4.5}/uv.lock +1 -1
- {ngpt-3.4.4 → ngpt-3.4.5}/wiki.md +9 -9
- ngpt-3.4.4/docs/README.md +0 -39
- ngpt-3.4.4/docs/_config.yml +0 -7
- ngpt-3.4.4/docs/api/README.md +0 -114
- ngpt-3.4.4/docs/api/cli.md +0 -897
- ngpt-3.4.4/docs/api/cli_config.md +0 -364
- ngpt-3.4.4/docs/api/client.md +0 -329
- ngpt-3.4.4/docs/api/config.md +0 -512
- ngpt-3.4.4/docs/api/logging.md +0 -138
- ngpt-3.4.4/docs/assets/css/style.scss +0 -75
- ngpt-3.4.4/docs/examples/README.md +0 -115
- ngpt-3.4.4/docs/examples/advanced.md +0 -753
- ngpt-3.4.4/docs/examples/basic.md +0 -433
- ngpt-3.4.4/docs/examples/cli_components.md +0 -1197
- ngpt-3.4.4/docs/examples/integrations.md +0 -725
- ngpt-3.4.4/docs/overview.md +0 -62
- ngpt-3.4.4/docs/usage/README.md +0 -136
- ngpt-3.4.4/docs/usage/cli_config.md +0 -284
- ngpt-3.4.4/docs/usage/cli_framework.md +0 -782
- ngpt-3.4.4/docs/usage/cli_usage.md +0 -1022
- ngpt-3.4.4/docs/usage/gitcommsg.md +0 -410
- ngpt-3.4.4/docs/usage/library_usage.md +0 -759
- {ngpt-3.4.4 → ngpt-3.4.5}/.github/workflows/aur-publish.yml +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/.github/workflows/python-publish.yml +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/.gitignore +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/.python-version +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/COMMIT_GUIDELINES.md +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/LICENSE +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/__init__.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/__main__.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/__init__.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/args.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/config_manager.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/formatters.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/main.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/__init__.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/code.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/gitcommsg.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/interactive.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/rewrite.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/shell.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/modes/text.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/renderers.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/cli/ui.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/client.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/utils/__init__.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/utils/cli_config.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/utils/config.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/utils/log.py +0 -0
- {ngpt-3.4.4 → ngpt-3.4.5}/ngpt/utils/web_search.py +0 -0
@@ -1,8 +1,3 @@
|
|
1
|
-
---
|
2
|
-
title: Contributing to NGPT
|
3
|
-
description: Guidelines and instructions for contributing to the NGPT project
|
4
|
-
---
|
5
|
-
|
6
1
|
# Contributing to NGPT
|
7
2
|
|
8
3
|
Thank you for your interest in contributing to NGPT! This document provides guidelines and instructions for contributing to this project.
|
@@ -50,8 +45,7 @@ Thank you for your interest in contributing to NGPT! This document provides guid
|
|
50
45
|
- `cli_config.py` - CLI-specific option configuration management
|
51
46
|
- `log.py` - Logging setup and utilities
|
52
47
|
- `docs/` - Documentation files
|
53
|
-
- `
|
54
|
-
- `examples/` - Example code and usage
|
48
|
+
- `examples/` - Example usage
|
55
49
|
- `usage/` - Usage guides and tutorials
|
56
50
|
- `.github/` - GitHub workflows and templates
|
57
51
|
- `pyproject.toml` - Project configuration and dependencies
|
@@ -83,14 +77,22 @@ Before submitting a pull request, please make sure that:
|
|
83
77
|
5. Push to your fork: `git push origin feature/your-feature-name`
|
84
78
|
6. Open a Pull Request against the main repository
|
85
79
|
|
86
|
-
## Testing
|
80
|
+
## Testing Your Changes
|
87
81
|
|
88
82
|
Before submitting your changes, please test:
|
89
83
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
84
|
+
1. Basic CLI functionality
|
85
|
+
2. Any new features you've added
|
86
|
+
3. Any components you've modified
|
87
|
+
4. Test on different platforms if possible (Windows, Linux, macOS)
|
88
|
+
5. Try various prompts and inputs to ensure robustness
|
89
|
+
|
90
|
+
Test your changes with:
|
91
|
+
```bash
|
92
|
+
# After installing with -e flag
|
93
|
+
python -m ngpt --version
|
94
|
+
python -m ngpt "Test prompt"
|
95
|
+
```
|
94
96
|
|
95
97
|
## Issue Reporting
|
96
98
|
|
@@ -115,6 +117,34 @@ Feature requests are welcome! To submit a feature request:
|
|
115
117
|
|
116
118
|
For questions about the project that aren't bugs or feature requests, please use GitHub Discussions instead of opening an issue. This helps keep the issue tracker focused on bugs and features.
|
117
119
|
|
120
|
+
## Common Tasks
|
121
|
+
|
122
|
+
### Adding a New Mode
|
123
|
+
|
124
|
+
If you're adding a new mode to nGPT, you should:
|
125
|
+
|
126
|
+
1. Create a new file in `ngpt/cli/modes/` for your mode implementation
|
127
|
+
2. Add your mode to the mode selection logic in `ngpt/cli/args.py`
|
128
|
+
3. Update help documentation to include your mode
|
129
|
+
4. Add tests for your new mode
|
130
|
+
5. Update documentation in `docs/usage/` to describe your mode
|
131
|
+
|
132
|
+
### Improving Renderers
|
133
|
+
|
134
|
+
For improvements to the output rendering:
|
135
|
+
|
136
|
+
1. Modify the renderer code in `ngpt/cli/renderers.py`
|
137
|
+
2. Ensure backward compatibility if possible
|
138
|
+
3. Test with various types of output (code, markdown, tables, etc.)
|
139
|
+
|
140
|
+
### Updating Documentation
|
141
|
+
|
142
|
+
When updating documentation:
|
143
|
+
|
144
|
+
1. Ensure your changes are reflected in both the code docstrings and in the Markdown documentation
|
145
|
+
2. Update examples if necessary
|
146
|
+
3. Test that documentation renders correctly
|
147
|
+
|
118
148
|
## License
|
119
149
|
|
120
150
|
By contributing to this project, you agree that your contributions will be licensed under the same [LICENSE](LICENSE) as the project.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 3.4.
|
4
|
-
Summary: Swiss army knife for LLMs: powerful CLI
|
3
|
+
Version: 3.4.5
|
4
|
+
Summary: Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
7
7
|
Project-URL: Bug Tracker, https://github.com/nazdridoy/ngpt/issues
|
@@ -46,13 +46,13 @@ Description-Content-Type: text/markdown
|
|
46
46
|
</p>
|
47
47
|
|
48
48
|
<p align="center">
|
49
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
50
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
51
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
52
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
49
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/Linux-support-blue?logo=linux" alt="Linux"></a>
|
50
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/Windows-support-blue?logo=windows" alt="Windows"></a>
|
51
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/macOS-support-blue?logo=apple" alt="macOS"></a>
|
52
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/Android-Termux-blue?logo=android" alt="Android"></a>
|
53
53
|
</p>
|
54
54
|
|
55
|
-
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI
|
55
|
+
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
56
56
|
|
57
57
|
|
58
58
|

|
@@ -60,7 +60,7 @@ Description-Content-Type: text/markdown
|
|
60
60
|
|
61
61
|
## Features
|
62
62
|
|
63
|
-
- ✅ **Versatile**:
|
63
|
+
- ✅ **Versatile**: Powerful and easy-to-use CLI tool for various AI tasks
|
64
64
|
- 🪶 **Lightweight**: Minimal dependencies with everything you need included
|
65
65
|
- 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, Gemini, and any compatible endpoint
|
66
66
|
- 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
|
@@ -77,12 +77,11 @@ Description-Content-Type: text/markdown
|
|
77
77
|
- 📑 **Git Commit Messages**: AI-powered generation of conventional, detailed commit messages from git diffs
|
78
78
|
- 🎭 **System Prompts**: Customize model behavior with custom system prompts
|
79
79
|
- 📃 **Conversation Logging**: Save your conversations to text files for later reference
|
80
|
-
- 🧰 **CLI Components**: Reusable components for building custom AI-powered command-line tools
|
81
80
|
- 🔌 **Modular Architecture**: Well-structured codebase with clean separation of concerns
|
82
81
|
- 🔄 **Provider Switching**: Easily switch between different LLM providers with a single parameter
|
83
82
|
- 🚀 **Performance Optimized**: Fast response times and minimal resource usage
|
84
83
|
|
85
|
-
See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview
|
84
|
+
See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview/) for more details.
|
86
85
|
|
87
86
|
|
88
87
|
## Table of Contents
|
@@ -93,8 +92,6 @@ See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview.html) for m
|
|
93
92
|
- [Usage](#usage)
|
94
93
|
- [Documentation](https://nazdridoy.github.io/ngpt/)
|
95
94
|
- [CLI Tool](#as-a-cli-tool)
|
96
|
-
- [Python Library](#as-a-library)
|
97
|
-
- [CLI Framework](#as-a-cli-framework)
|
98
95
|
- [Configuration](#configuration)
|
99
96
|
- [Command Line Options](#command-line-options)
|
100
97
|
- [CLI Configuration](#cli-configuration)
|
@@ -205,21 +202,19 @@ ngpt --provider OpenAI "Explain quantum physics" > openai_response.txt
|
|
205
202
|
ngpt --provider Ollama "Explain quantum physics" > ollama_response.txt
|
206
203
|
```
|
207
204
|
|
208
|
-
For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
205
|
+
For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/).
|
209
206
|
|
210
207
|
## Documentation
|
211
208
|
|
212
|
-
Comprehensive documentation, including
|
209
|
+
Comprehensive documentation, including usage guides and examples, is available at:
|
213
210
|
|
214
211
|
**[https://nazdridoy.github.io/ngpt/](https://nazdridoy.github.io/ngpt/)**
|
215
212
|
|
216
213
|
Key documentation sections:
|
217
|
-
- [Installation Guide](https://nazdridoy.github.io/ngpt/installation
|
218
|
-
- [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
219
|
-
- [
|
220
|
-
- [
|
221
|
-
- [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration.html)
|
222
|
-
- [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic.html)
|
214
|
+
- [Installation Guide](https://nazdridoy.github.io/ngpt/installation/)
|
215
|
+
- [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/)
|
216
|
+
- [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/)
|
217
|
+
- [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic/)
|
223
218
|
|
224
219
|
## Installation
|
225
220
|
|
@@ -239,7 +234,7 @@ paru -S ngpt
|
|
239
234
|
|
240
235
|
Requires Python 3.8 or newer.
|
241
236
|
|
242
|
-
For detailed installation instructions, see the [Installation Guide](https://nazdridoy.github.io/ngpt/installation
|
237
|
+
For detailed installation instructions, see the [Installation Guide](https://nazdridoy.github.io/ngpt/installation/).
|
243
238
|
|
244
239
|
## Usage
|
245
240
|
|
@@ -291,125 +286,7 @@ ngpt -c "create a python function that calculates fibonacci numbers"
|
|
291
286
|
ngpt -t
|
292
287
|
```
|
293
288
|
|
294
|
-
For more CLI examples and detailed usage information, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
295
|
-
|
296
|
-
### As a Library
|
297
|
-
|
298
|
-
```python
|
299
|
-
from ngpt import NGPTClient
|
300
|
-
from ngpt.utils.config import load_config
|
301
|
-
|
302
|
-
# Load the first configuration (index 0) from config file
|
303
|
-
config = load_config(config_index=0)
|
304
|
-
|
305
|
-
# Initialize the client with config
|
306
|
-
client = NGPTClient(**config)
|
307
|
-
|
308
|
-
# Or initialize with custom parameters
|
309
|
-
client = NGPTClient(
|
310
|
-
api_key="your-key",
|
311
|
-
base_url="http://your-endpoint",
|
312
|
-
provider="openai",
|
313
|
-
model="o3-mini"
|
314
|
-
)
|
315
|
-
|
316
|
-
# Chat
|
317
|
-
response = client.chat("Hello, how are you?")
|
318
|
-
|
319
|
-
# Chat with web search (if your API endpoint supports it)
|
320
|
-
response = client.chat("What's the latest news about AI?", web_search=True)
|
321
|
-
|
322
|
-
# Generate shell command
|
323
|
-
command = client.generate_shell_command("list all files")
|
324
|
-
|
325
|
-
# Generate code
|
326
|
-
code = client.generate_code("create a python function that calculates fibonacci numbers")
|
327
|
-
```
|
328
|
-
|
329
|
-
For more library examples and advanced usage, see the [Library Usage Guide](https://nazdridoy.github.io/ngpt/usage/library_usage.html).
|
330
|
-
|
331
|
-
#### Advanced Library Usage
|
332
|
-
|
333
|
-
```python
|
334
|
-
# Stream responses
|
335
|
-
for chunk in client.chat("Write a poem about Python", stream=True):
|
336
|
-
print(chunk, end="", flush=True)
|
337
|
-
|
338
|
-
# Customize system prompt
|
339
|
-
response = client.chat(
|
340
|
-
"Explain quantum computing",
|
341
|
-
system_prompt="You are a quantum physics professor. Explain complex concepts simply."
|
342
|
-
)
|
343
|
-
|
344
|
-
# OS-aware shell commands
|
345
|
-
# Automatically generates appropriate commands for the current OS
|
346
|
-
command = client.generate_shell_command("find large files")
|
347
|
-
import subprocess
|
348
|
-
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
349
|
-
print(result.stdout)
|
350
|
-
|
351
|
-
# Clean code generation
|
352
|
-
# Returns only code without markdown or explanations
|
353
|
-
code = client.generate_code("function that converts Celsius to Fahrenheit")
|
354
|
-
print(code)
|
355
|
-
|
356
|
-
# Compare responses from different providers
|
357
|
-
openai_config = load_config(config_index=0) # OpenAI
|
358
|
-
groq_config = load_config(config_index=1) # Groq
|
359
|
-
|
360
|
-
openai_client = NGPTClient(**openai_config)
|
361
|
-
groq_client = NGPTClient(**groq_config)
|
362
|
-
|
363
|
-
openai_response = openai_client.chat("Explain quantum computing")
|
364
|
-
groq_response = groq_client.chat("Explain quantum computing")
|
365
|
-
```
|
366
|
-
|
367
|
-
For advanced usage patterns and integrations, check out the [Advanced Examples](https://nazdridoy.github.io/ngpt/examples/advanced.html).
|
368
|
-
|
369
|
-
### As a CLI Framework
|
370
|
-
|
371
|
-
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.
|
372
|
-
|
373
|
-
```python
|
374
|
-
from ngpt import NGPTClient
|
375
|
-
from ngpt.utils.config import load_config
|
376
|
-
from ngpt.cli.interactive import interactive_chat_session
|
377
|
-
from ngpt.cli.renderers import prettify_markdown
|
378
|
-
from ngpt.cli.args import setup_argument_parser
|
379
|
-
import sys
|
380
|
-
|
381
|
-
# Create a custom CLI tool with colorized help
|
382
|
-
parser = setup_argument_parser()
|
383
|
-
parser.description = "Specialized Code Assistant"
|
384
|
-
parser.add_argument("prompt", nargs="?", help="Code description")
|
385
|
-
parser.add_argument("--language", "-l", default="python", help="Programming language")
|
386
|
-
parser.add_argument("--interactive", "-i", action="store_true", help="Start interactive mode")
|
387
|
-
args = parser.parse_args()
|
388
|
-
|
389
|
-
# Initialize client
|
390
|
-
client = NGPTClient(**load_config())
|
391
|
-
|
392
|
-
# Use interactive session for conversation
|
393
|
-
if args.interactive:
|
394
|
-
system_prompt = f"You are an expert {args.language} developer. Provide clear, detailed answers."
|
395
|
-
interactive_chat_session(client=client, preprompt=system_prompt, prettify=True)
|
396
|
-
elif args.prompt:
|
397
|
-
# Generate and prettify code
|
398
|
-
code = client.generate_code(args.prompt, language=args.language)
|
399
|
-
print(prettify_markdown(f"```{args.language}\n{code}\n```"))
|
400
|
-
else:
|
401
|
-
parser.print_help()
|
402
|
-
sys.exit(1)
|
403
|
-
```
|
404
|
-
|
405
|
-
This allows you to build specialized AI tools like:
|
406
|
-
- Code generators for specific languages or frameworks
|
407
|
-
- Domain-specific assistants (SQL, legal, finance, etc.)
|
408
|
-
- Documentation generators
|
409
|
-
- Translation tools
|
410
|
-
- And much more
|
411
|
-
|
412
|
-
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).
|
289
|
+
For more CLI examples and detailed usage information, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/).
|
413
290
|
|
414
291
|
## Configuration
|
415
292
|
|
@@ -525,7 +402,7 @@ Modes (mutually exclusive)::
|
|
525
402
|
|
526
403
|
> **Note**: For better visualization of conventional commit messages on GitHub, you can use the [GitHub Commit Labels](https://greasyfork.org/en/scripts/526153-github-commit-labels) userscript, which adds colorful labels to your commits.
|
527
404
|
|
528
|
-
For a complete reference of all available options, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
405
|
+
For a complete reference of all available options, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/).
|
529
406
|
|
530
407
|
### CLI Configuration
|
531
408
|
|
@@ -598,7 +475,7 @@ CLI Configuration Help:
|
|
598
475
|
|
599
476
|
```
|
600
477
|
|
601
|
-
For more details, see the [CLI Configuration Guide](https://nazdridoy.github.io/ngpt/usage/cli_config
|
478
|
+
For more details, see the [CLI Configuration Guide](https://nazdridoy.github.io/ngpt/usage/cli_config/).
|
602
479
|
|
603
480
|
### Interactive Configuration
|
604
481
|
|
@@ -630,7 +507,7 @@ In interactive mode:
|
|
630
507
|
- For security, your API key is not displayed when editing configurations
|
631
508
|
- When removing a configuration, you'll be asked to confirm before deletion
|
632
509
|
|
633
|
-
For more details on configuring nGPT, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration
|
510
|
+
For more details on configuring nGPT, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/).
|
634
511
|
|
635
512
|
### Configuration File
|
636
513
|
|
@@ -666,7 +543,7 @@ The configuration file uses a JSON list format, allowing you to store multiple c
|
|
666
543
|
]
|
667
544
|
```
|
668
545
|
|
669
|
-
For details on the configuration file format and structure, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration
|
546
|
+
For details on the configuration file format and structure, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/).
|
670
547
|
|
671
548
|
### Configuration Priority
|
672
549
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
pkgname=ngpt
|
3
3
|
pkgver=0.0.0 # Automatically updated by CI on release
|
4
4
|
pkgrel=1
|
5
|
-
pkgdesc="Swiss army knife for LLMs: powerful CLI
|
5
|
+
pkgdesc="Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands."
|
6
6
|
arch=('any')
|
7
7
|
url="https://github.com/nazdridoy/ngpt"
|
8
8
|
license=('MIT')
|
@@ -8,13 +8,13 @@
|
|
8
8
|
</p>
|
9
9
|
|
10
10
|
<p align="center">
|
11
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
12
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
13
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
14
|
-
<a href="https://nazdridoy.github.io/ngpt/installation
|
11
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/Linux-support-blue?logo=linux" alt="Linux"></a>
|
12
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/Windows-support-blue?logo=windows" alt="Windows"></a>
|
13
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/macOS-support-blue?logo=apple" alt="macOS"></a>
|
14
|
+
<a href="https://nazdridoy.github.io/ngpt/installation/"><img src="https://img.shields.io/badge/Android-Termux-blue?logo=android" alt="Android"></a>
|
15
15
|
</p>
|
16
16
|
|
17
|
-
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI
|
17
|
+
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
18
18
|
|
19
19
|
|
20
20
|

|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
## Features
|
24
24
|
|
25
|
-
- ✅ **Versatile**:
|
25
|
+
- ✅ **Versatile**: Powerful and easy-to-use CLI tool for various AI tasks
|
26
26
|
- 🪶 **Lightweight**: Minimal dependencies with everything you need included
|
27
27
|
- 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, Gemini, and any compatible endpoint
|
28
28
|
- 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
|
@@ -39,12 +39,11 @@
|
|
39
39
|
- 📑 **Git Commit Messages**: AI-powered generation of conventional, detailed commit messages from git diffs
|
40
40
|
- 🎭 **System Prompts**: Customize model behavior with custom system prompts
|
41
41
|
- 📃 **Conversation Logging**: Save your conversations to text files for later reference
|
42
|
-
- 🧰 **CLI Components**: Reusable components for building custom AI-powered command-line tools
|
43
42
|
- 🔌 **Modular Architecture**: Well-structured codebase with clean separation of concerns
|
44
43
|
- 🔄 **Provider Switching**: Easily switch between different LLM providers with a single parameter
|
45
44
|
- 🚀 **Performance Optimized**: Fast response times and minimal resource usage
|
46
45
|
|
47
|
-
See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview
|
46
|
+
See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview/) for more details.
|
48
47
|
|
49
48
|
|
50
49
|
## Table of Contents
|
@@ -55,8 +54,6 @@ See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview.html) for m
|
|
55
54
|
- [Usage](#usage)
|
56
55
|
- [Documentation](https://nazdridoy.github.io/ngpt/)
|
57
56
|
- [CLI Tool](#as-a-cli-tool)
|
58
|
-
- [Python Library](#as-a-library)
|
59
|
-
- [CLI Framework](#as-a-cli-framework)
|
60
57
|
- [Configuration](#configuration)
|
61
58
|
- [Command Line Options](#command-line-options)
|
62
59
|
- [CLI Configuration](#cli-configuration)
|
@@ -167,21 +164,19 @@ ngpt --provider OpenAI "Explain quantum physics" > openai_response.txt
|
|
167
164
|
ngpt --provider Ollama "Explain quantum physics" > ollama_response.txt
|
168
165
|
```
|
169
166
|
|
170
|
-
For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
167
|
+
For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/).
|
171
168
|
|
172
169
|
## Documentation
|
173
170
|
|
174
|
-
Comprehensive documentation, including
|
171
|
+
Comprehensive documentation, including usage guides and examples, is available at:
|
175
172
|
|
176
173
|
**[https://nazdridoy.github.io/ngpt/](https://nazdridoy.github.io/ngpt/)**
|
177
174
|
|
178
175
|
Key documentation sections:
|
179
|
-
- [Installation Guide](https://nazdridoy.github.io/ngpt/installation
|
180
|
-
- [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
181
|
-
- [
|
182
|
-
- [
|
183
|
-
- [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration.html)
|
184
|
-
- [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic.html)
|
176
|
+
- [Installation Guide](https://nazdridoy.github.io/ngpt/installation/)
|
177
|
+
- [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/)
|
178
|
+
- [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/)
|
179
|
+
- [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic/)
|
185
180
|
|
186
181
|
## Installation
|
187
182
|
|
@@ -201,7 +196,7 @@ paru -S ngpt
|
|
201
196
|
|
202
197
|
Requires Python 3.8 or newer.
|
203
198
|
|
204
|
-
For detailed installation instructions, see the [Installation Guide](https://nazdridoy.github.io/ngpt/installation
|
199
|
+
For detailed installation instructions, see the [Installation Guide](https://nazdridoy.github.io/ngpt/installation/).
|
205
200
|
|
206
201
|
## Usage
|
207
202
|
|
@@ -253,125 +248,7 @@ ngpt -c "create a python function that calculates fibonacci numbers"
|
|
253
248
|
ngpt -t
|
254
249
|
```
|
255
250
|
|
256
|
-
For more CLI examples and detailed usage information, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
257
|
-
|
258
|
-
### As a Library
|
259
|
-
|
260
|
-
```python
|
261
|
-
from ngpt import NGPTClient
|
262
|
-
from ngpt.utils.config import load_config
|
263
|
-
|
264
|
-
# Load the first configuration (index 0) from config file
|
265
|
-
config = load_config(config_index=0)
|
266
|
-
|
267
|
-
# Initialize the client with config
|
268
|
-
client = NGPTClient(**config)
|
269
|
-
|
270
|
-
# Or initialize with custom parameters
|
271
|
-
client = NGPTClient(
|
272
|
-
api_key="your-key",
|
273
|
-
base_url="http://your-endpoint",
|
274
|
-
provider="openai",
|
275
|
-
model="o3-mini"
|
276
|
-
)
|
277
|
-
|
278
|
-
# Chat
|
279
|
-
response = client.chat("Hello, how are you?")
|
280
|
-
|
281
|
-
# Chat with web search (if your API endpoint supports it)
|
282
|
-
response = client.chat("What's the latest news about AI?", web_search=True)
|
283
|
-
|
284
|
-
# Generate shell command
|
285
|
-
command = client.generate_shell_command("list all files")
|
286
|
-
|
287
|
-
# Generate code
|
288
|
-
code = client.generate_code("create a python function that calculates fibonacci numbers")
|
289
|
-
```
|
290
|
-
|
291
|
-
For more library examples and advanced usage, see the [Library Usage Guide](https://nazdridoy.github.io/ngpt/usage/library_usage.html).
|
292
|
-
|
293
|
-
#### Advanced Library Usage
|
294
|
-
|
295
|
-
```python
|
296
|
-
# Stream responses
|
297
|
-
for chunk in client.chat("Write a poem about Python", stream=True):
|
298
|
-
print(chunk, end="", flush=True)
|
299
|
-
|
300
|
-
# Customize system prompt
|
301
|
-
response = client.chat(
|
302
|
-
"Explain quantum computing",
|
303
|
-
system_prompt="You are a quantum physics professor. Explain complex concepts simply."
|
304
|
-
)
|
305
|
-
|
306
|
-
# OS-aware shell commands
|
307
|
-
# Automatically generates appropriate commands for the current OS
|
308
|
-
command = client.generate_shell_command("find large files")
|
309
|
-
import subprocess
|
310
|
-
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
311
|
-
print(result.stdout)
|
312
|
-
|
313
|
-
# Clean code generation
|
314
|
-
# Returns only code without markdown or explanations
|
315
|
-
code = client.generate_code("function that converts Celsius to Fahrenheit")
|
316
|
-
print(code)
|
317
|
-
|
318
|
-
# Compare responses from different providers
|
319
|
-
openai_config = load_config(config_index=0) # OpenAI
|
320
|
-
groq_config = load_config(config_index=1) # Groq
|
321
|
-
|
322
|
-
openai_client = NGPTClient(**openai_config)
|
323
|
-
groq_client = NGPTClient(**groq_config)
|
324
|
-
|
325
|
-
openai_response = openai_client.chat("Explain quantum computing")
|
326
|
-
groq_response = groq_client.chat("Explain quantum computing")
|
327
|
-
```
|
328
|
-
|
329
|
-
For advanced usage patterns and integrations, check out the [Advanced Examples](https://nazdridoy.github.io/ngpt/examples/advanced.html).
|
330
|
-
|
331
|
-
### As a CLI Framework
|
332
|
-
|
333
|
-
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.
|
334
|
-
|
335
|
-
```python
|
336
|
-
from ngpt import NGPTClient
|
337
|
-
from ngpt.utils.config import load_config
|
338
|
-
from ngpt.cli.interactive import interactive_chat_session
|
339
|
-
from ngpt.cli.renderers import prettify_markdown
|
340
|
-
from ngpt.cli.args import setup_argument_parser
|
341
|
-
import sys
|
342
|
-
|
343
|
-
# Create a custom CLI tool with colorized help
|
344
|
-
parser = setup_argument_parser()
|
345
|
-
parser.description = "Specialized Code Assistant"
|
346
|
-
parser.add_argument("prompt", nargs="?", help="Code description")
|
347
|
-
parser.add_argument("--language", "-l", default="python", help="Programming language")
|
348
|
-
parser.add_argument("--interactive", "-i", action="store_true", help="Start interactive mode")
|
349
|
-
args = parser.parse_args()
|
350
|
-
|
351
|
-
# Initialize client
|
352
|
-
client = NGPTClient(**load_config())
|
353
|
-
|
354
|
-
# Use interactive session for conversation
|
355
|
-
if args.interactive:
|
356
|
-
system_prompt = f"You are an expert {args.language} developer. Provide clear, detailed answers."
|
357
|
-
interactive_chat_session(client=client, preprompt=system_prompt, prettify=True)
|
358
|
-
elif args.prompt:
|
359
|
-
# Generate and prettify code
|
360
|
-
code = client.generate_code(args.prompt, language=args.language)
|
361
|
-
print(prettify_markdown(f"```{args.language}\n{code}\n```"))
|
362
|
-
else:
|
363
|
-
parser.print_help()
|
364
|
-
sys.exit(1)
|
365
|
-
```
|
366
|
-
|
367
|
-
This allows you to build specialized AI tools like:
|
368
|
-
- Code generators for specific languages or frameworks
|
369
|
-
- Domain-specific assistants (SQL, legal, finance, etc.)
|
370
|
-
- Documentation generators
|
371
|
-
- Translation tools
|
372
|
-
- And much more
|
373
|
-
|
374
|
-
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).
|
251
|
+
For more CLI examples and detailed usage information, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/).
|
375
252
|
|
376
253
|
## Configuration
|
377
254
|
|
@@ -487,7 +364,7 @@ Modes (mutually exclusive)::
|
|
487
364
|
|
488
365
|
> **Note**: For better visualization of conventional commit messages on GitHub, you can use the [GitHub Commit Labels](https://greasyfork.org/en/scripts/526153-github-commit-labels) userscript, which adds colorful labels to your commits.
|
489
366
|
|
490
|
-
For a complete reference of all available options, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage
|
367
|
+
For a complete reference of all available options, see the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/).
|
491
368
|
|
492
369
|
### CLI Configuration
|
493
370
|
|
@@ -560,7 +437,7 @@ CLI Configuration Help:
|
|
560
437
|
|
561
438
|
```
|
562
439
|
|
563
|
-
For more details, see the [CLI Configuration Guide](https://nazdridoy.github.io/ngpt/usage/cli_config
|
440
|
+
For more details, see the [CLI Configuration Guide](https://nazdridoy.github.io/ngpt/usage/cli_config/).
|
564
441
|
|
565
442
|
### Interactive Configuration
|
566
443
|
|
@@ -592,7 +469,7 @@ In interactive mode:
|
|
592
469
|
- For security, your API key is not displayed when editing configurations
|
593
470
|
- When removing a configuration, you'll be asked to confirm before deletion
|
594
471
|
|
595
|
-
For more details on configuring nGPT, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration
|
472
|
+
For more details on configuring nGPT, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/).
|
596
473
|
|
597
474
|
### Configuration File
|
598
475
|
|
@@ -628,7 +505,7 @@ The configuration file uses a JSON list format, allowing you to store multiple c
|
|
628
505
|
]
|
629
506
|
```
|
630
507
|
|
631
|
-
For details on the configuration file format and structure, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration
|
508
|
+
For details on the configuration file format and structure, see the [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/).
|
632
509
|
|
633
510
|
### Configuration Priority
|
634
511
|
|