ngpt 3.8.3__tar.gz → 3.9.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.
Files changed (65) hide show
  1. ngpt-3.9.1/.github/workflows/repo-mirror.yml +75 -0
  2. {ngpt-3.8.3 → ngpt-3.9.1}/PKG-INFO +57 -6
  3. {ngpt-3.8.3 → ngpt-3.9.1}/README.md +56 -5
  4. {ngpt-3.8.3 → ngpt-3.9.1}/docs/configuration.md +69 -6
  5. ngpt-3.9.1/docs/examples/role_gallery.md +1255 -0
  6. ngpt-3.9.1/docs/examples.md +11 -0
  7. {ngpt-3.8.3 → ngpt-3.9.1}/docs/usage/cli_config.md +1 -1
  8. {ngpt-3.8.3 → ngpt-3.9.1}/docs/usage/cli_usage.md +31 -8
  9. ngpt-3.9.1/docs/usage/roles.md +565 -0
  10. {ngpt-3.8.3 → ngpt-3.9.1}/docs/usage/web_search.md +1 -1
  11. ngpt-3.9.1/docs/usage.md +11 -0
  12. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/args.py +43 -2
  13. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/main.py +17 -1
  14. ngpt-3.9.1/ngpt/cli/roles.py +274 -0
  15. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/ui.py +17 -4
  16. {ngpt-3.8.3 → ngpt-3.9.1}/pyproject.toml +1 -1
  17. {ngpt-3.8.3 → ngpt-3.9.1}/uv.lock +1 -1
  18. ngpt-3.8.3/docs/examples.md +0 -14
  19. ngpt-3.8.3/docs/usage.md +0 -16
  20. {ngpt-3.8.3 → ngpt-3.9.1}/.github/workflows/aur-publish.yml +0 -0
  21. {ngpt-3.8.3 → ngpt-3.9.1}/.github/workflows/python-publish.yml +0 -0
  22. {ngpt-3.8.3 → ngpt-3.9.1}/.gitignore +0 -0
  23. {ngpt-3.8.3 → ngpt-3.9.1}/.python-version +0 -0
  24. {ngpt-3.8.3 → ngpt-3.9.1}/COMMIT_GUIDELINES.md +0 -0
  25. {ngpt-3.8.3 → ngpt-3.9.1}/CONTRIBUTING.md +0 -0
  26. {ngpt-3.8.3 → ngpt-3.9.1}/LICENSE +0 -0
  27. {ngpt-3.8.3 → ngpt-3.9.1}/PKGBUILD +0 -0
  28. {ngpt-3.8.3 → ngpt-3.9.1}/docs/CONTRIBUTING.md +0 -0
  29. {ngpt-3.8.3 → ngpt-3.9.1}/docs/LICENSE.md +0 -0
  30. {ngpt-3.8.3 → ngpt-3.9.1}/docs/_config.yml +0 -0
  31. {ngpt-3.8.3 → ngpt-3.9.1}/docs/_sass/custom/custom.scss +0 -0
  32. {ngpt-3.8.3 → ngpt-3.9.1}/docs/examples/advanced.md +0 -0
  33. {ngpt-3.8.3 → ngpt-3.9.1}/docs/examples/basic.md +0 -0
  34. {ngpt-3.8.3 → ngpt-3.9.1}/docs/index.md +0 -0
  35. {ngpt-3.8.3 → ngpt-3.9.1}/docs/installation.md +0 -0
  36. {ngpt-3.8.3 → ngpt-3.9.1}/docs/overview.md +0 -0
  37. {ngpt-3.8.3 → ngpt-3.9.1}/docs/usage/gitcommsg.md +0 -0
  38. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/__init__.py +0 -0
  39. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/__main__.py +0 -0
  40. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/__init__.py +0 -0
  41. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/config_manager.py +0 -0
  42. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/formatters.py +0 -0
  43. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/__init__.py +0 -0
  44. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/chat.py +0 -0
  45. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/code.py +0 -0
  46. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/gitcommsg.py +0 -0
  47. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/interactive.py +0 -0
  48. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/rewrite.py +0 -0
  49. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/shell.py +0 -0
  50. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/modes/text.py +0 -0
  51. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/cli/renderers.py +0 -0
  52. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/client.py +0 -0
  53. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/utils/__init__.py +0 -0
  54. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/utils/cli_config.py +0 -0
  55. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/utils/config.py +0 -0
  56. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/utils/log.py +0 -0
  57. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/utils/pipe.py +0 -0
  58. {ngpt-3.8.3 → ngpt-3.9.1}/ngpt/utils/web_search.py +0 -0
  59. {ngpt-3.8.3 → ngpt-3.9.1}/previews/ngpt-g.png +0 -0
  60. {ngpt-3.8.3 → ngpt-3.9.1}/previews/ngpt-i.png +0 -0
  61. {ngpt-3.8.3 → ngpt-3.9.1}/previews/ngpt-s-c.png +0 -0
  62. {ngpt-3.8.3 → ngpt-3.9.1}/previews/ngpt-sh-c-a.png +0 -0
  63. {ngpt-3.8.3 → ngpt-3.9.1}/previews/ngpt-w-self.png +0 -0
  64. {ngpt-3.8.3 → ngpt-3.9.1}/previews/ngpt-w.png +0 -0
  65. {ngpt-3.8.3 → ngpt-3.9.1}/wiki.md +0 -0
@@ -0,0 +1,75 @@
1
+ name: Repository Mirroring
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ delete:
7
+ branches: [ "main" ]
8
+ workflow_dispatch: # Allows manual triggering
9
+
10
+ jobs:
11
+ mirror_to_gitlab:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ with:
16
+ fetch-depth: 0
17
+ - name: Configure Git
18
+ run: |
19
+ git config --global user.name "GitHub Actions"
20
+ git config --global user.email "actions@github.com"
21
+ - name: Mirror to GitLab
22
+ env:
23
+ SSH_PRIVATE_KEY: ${{ secrets.GITLAB_SSH_PRIVATE_KEY }}
24
+ TARGET_URL: ${{ secrets.GITLAB_REPO_URL }}
25
+ run: |
26
+ mkdir -p ~/.ssh
27
+ echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
28
+ chmod 600 ~/.ssh/id_rsa
29
+ ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
30
+ # Push local branches and tags, excluding remote refs
31
+ git push --force ${TARGET_URL} 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
32
+
33
+ mirror_to_gitea:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v3
37
+ with:
38
+ fetch-depth: 0
39
+ - name: Configure Git
40
+ run: |
41
+ git config --global user.name "GitHub Actions"
42
+ git config --global user.email "actions@github.com"
43
+ - name: Mirror to Gitea
44
+ env:
45
+ SSH_PRIVATE_KEY: ${{ secrets.GITEA_SSH_PRIVATE_KEY }}
46
+ TARGET_URL: ${{ secrets.GITEA_REPO_URL }}
47
+ run: |
48
+ mkdir -p ~/.ssh
49
+ echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
50
+ chmod 600 ~/.ssh/id_rsa
51
+ ssh-keyscan -t rsa $(echo ${TARGET_URL} | cut -d '@' -f 2 | cut -d ':' -f 1) >> ~/.ssh/known_hosts
52
+ # Push local branches and tags, excluding remote refs
53
+ git push --force ${TARGET_URL} 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
54
+
55
+ mirror_to_codeberg:
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - uses: actions/checkout@v3
59
+ with:
60
+ fetch-depth: 0
61
+ - name: Configure Git
62
+ run: |
63
+ git config --global user.name "GitHub Actions"
64
+ git config --global user.email "actions@github.com"
65
+ - name: Mirror to Codeberg
66
+ env:
67
+ SSH_PRIVATE_KEY: ${{ secrets.CODEBERG_SSH_PRIVATE_KEY }}
68
+ TARGET_URL: ${{ secrets.CODEBERG_REPO_URL }}
69
+ run: |
70
+ mkdir -p ~/.ssh
71
+ echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
72
+ chmod 600 ~/.ssh/id_rsa
73
+ ssh-keyscan -t rsa codeberg.org >> ~/.ssh/known_hosts
74
+ # Push local branches and tags, excluding remote refs
75
+ git push --force ${TARGET_URL} 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 3.8.3
3
+ Version: 3.9.1
4
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
@@ -75,6 +75,7 @@ Description-Content-Type: text/markdown
75
75
  - 📝 **Rich Multiline Editor**: Interactive multiline text input with syntax highlighting and intuitive controls
76
76
  - 📑 **Git Commit Messages**: AI-powered generation of conventional, detailed commit messages from git diffs
77
77
  - 🎭 **System Prompts**: Customize model behavior with custom system prompts
78
+ - 🤖 **Custom Roles**: Create and use reusable AI roles for specialized tasks
78
79
  - 📃 **Conversation Logging**: Save your conversations to text files for later reference
79
80
  - 🔌 **Modular Architecture**: Well-structured codebase with clean separation of concerns
80
81
  - 🔄 **Provider Switching**: Easily switch between different LLM providers with a single parameter
@@ -164,6 +165,17 @@ What is the best way to learn Golang?
164
165
  Provide simple hello world example.
165
166
  EOF
166
167
 
168
+ # Create a custom role for specialized tasks
169
+ ngpt --role-config create json_generator
170
+
171
+ # Use a custom role for specific tasks
172
+ ngpt --role json_generator "Generate user data with name, email, and address"
173
+
174
+ # Use a role from the Role Gallery (first create it, then use it)
175
+ ngpt --role-config create sql_expert
176
+ # Paste the SQL Expert role from https://nazdridoy.github.io/ngpt/examples/role-gallery/
177
+ ngpt --role sql_expert "Write a query to find all users who made a purchase in the last 30 days"
178
+
167
179
  # Rewrite text to improve quality while preserving tone and meaning
168
180
  echo "your text" | ngpt -r
169
181
 
@@ -267,10 +279,11 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
267
279
 
268
280
  usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index CONFIG_INDEX] [--provider PROVIDER]
269
281
  [--remove] [--show-config] [--all] [--list-models] [--list-renderers] [--cli-config [COMMAND ...]]
270
- [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search] [--pipe]
271
- [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]] [--preprompt PREPROMPT]
272
- [--no-stream | --prettify | --stream-prettify] [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]]
273
- [--chunk-size CHUNK_SIZE] [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
282
+ [--role-config [ACTION ...]] [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search]
283
+ [--pipe] [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]]
284
+ [--preprompt PREPROMPT | --role ROLE] [--no-stream | --prettify | --stream-prettify]
285
+ [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]] [--chunk-size CHUNK_SIZE]
286
+ [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
274
287
  [--max-recursion-depth MAX_RECURSION_DEPTH] [-i | -s | -c | -t | -r | -g]
275
288
  [prompt]
276
289
 
@@ -297,6 +310,7 @@ Configuration Options::
297
310
  --list-models List all available models for the current configuration and exit
298
311
  --list-renderers Show available markdown renderers for use with --prettify
299
312
  --cli-config [COMMAND ...] Manage CLI configuration (set, get, unset, list, help)
313
+ --role-config [ACTION ...] Manage custom roles (help, create, show, edit, list, remove) [role_name]
300
314
 
301
315
  Global Options::
302
316
 
@@ -310,6 +324,7 @@ Global Options::
310
324
  --max_tokens MAX_TOKENS Set max response length in tokens
311
325
  --log [FILE] Set filepath to log conversation to, or create a temporary log file if no path provided
312
326
  --preprompt PREPROMPT Set custom system prompt to control AI behavior
327
+ --role ROLE Use a predefined role to set system prompt (mutually exclusive with --preprompt)
313
328
  --renderer {auto,rich,glow} Select which markdown renderer to use with --prettify or --stream-prettify (auto, rich, or glow)
314
329
 
315
330
  Output Display Options (mutually exclusive)::
@@ -325,7 +340,7 @@ Git Commit Message Options::
325
340
  --chunk-size CHUNK_SIZE Number of lines per chunk when chunking is enabled (default: 200)
326
341
  --analyses-chunk-size ANALYSES_CHUNK_SIZE Number of lines per chunk when recursively chunking analyses (default: 200)
327
342
  --max-msg-lines MAX_MSG_LINES Maximum number of lines in commit message before condensing (default: 20)
328
- --max-recursion-depth MAX_RECURSION_DEPTH Maximum recursion depth for commit message condensing (default: 3)
343
+ --max-recursion-depth MAX_RECURSION_DEPTH Maximum recursion depth for commit message condensing (default: 3)
329
344
 
330
345
  Modes (mutually exclusive)::
331
346
 
@@ -353,6 +368,8 @@ Key documentation sections:
353
368
  - [Installation Guide](https://nazdridoy.github.io/ngpt/installation/)
354
369
  - [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/)
355
370
  - [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/)
371
+ - [Custom Roles Guide](https://nazdridoy.github.io/ngpt/usage/roles/)
372
+ - [Role Gallery](https://nazdridoy.github.io/ngpt/examples/role-gallery/)
356
373
  - [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic/)
357
374
  - [Git Commit Message Guide](https://nazdridoy.github.io/ngpt/usage/gitcommsg/)
358
375
 
@@ -601,6 +618,40 @@ This is a huge time-saver. nGPT analyzes your git diff and generates a properly
601
618
 
602
619
  ![ngpt-g](https://raw.githubusercontent.com/nazdridoy/ngpt/main/previews/ngpt-g.png)
603
620
 
621
+ #### Custom AI Roles
622
+
623
+ ```bash
624
+ # Create a specialized role for JSON generation
625
+ ngpt --role-config create json_generator
626
+
627
+ # Use the custom role to generate structured data
628
+ ngpt --role json_generator "Generate random user profile data"
629
+ ```
630
+ ```json
631
+ {
632
+ "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
633
+ "firstName": "Aurora",
634
+ "lastName": "Reynolds",
635
+ "email": "aurora.reynolds@example.com",
636
+ "phone": "+1-555-0101",
637
+ "address": {
638
+ "street": "123 Main St",
639
+ "city": "Anytown",
640
+ "state": "CA",
641
+ "zipCode": "90210"
642
+ },
643
+ "birthDate": "1990-07-15",
644
+ "registrationDate": "2022-01-20",
645
+ "isActive": true,
646
+ "roles": [
647
+ "user",
648
+ "premium"
649
+ ]
650
+ }
651
+ ```
652
+
653
+ Custom roles allow you to create reusable AI personas for consistent responses across various prompts. For more details, see the [Custom Roles Guide](https://nazdridoy.github.io/ngpt/usage/roles/) and check out the [Role Gallery](https://nazdridoy.github.io/ngpt/examples/role-gallery/) for ready-to-use roles.
654
+
604
655
  #### Web Search Integration
605
656
 
606
657
  ```bash
@@ -38,6 +38,7 @@
38
38
  - 📝 **Rich Multiline Editor**: Interactive multiline text input with syntax highlighting and intuitive controls
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
+ - 🤖 **Custom Roles**: Create and use reusable AI roles for specialized tasks
41
42
  - 📃 **Conversation Logging**: Save your conversations to text files for later reference
42
43
  - 🔌 **Modular Architecture**: Well-structured codebase with clean separation of concerns
43
44
  - 🔄 **Provider Switching**: Easily switch between different LLM providers with a single parameter
@@ -127,6 +128,17 @@ What is the best way to learn Golang?
127
128
  Provide simple hello world example.
128
129
  EOF
129
130
 
131
+ # Create a custom role for specialized tasks
132
+ ngpt --role-config create json_generator
133
+
134
+ # Use a custom role for specific tasks
135
+ ngpt --role json_generator "Generate user data with name, email, and address"
136
+
137
+ # Use a role from the Role Gallery (first create it, then use it)
138
+ ngpt --role-config create sql_expert
139
+ # Paste the SQL Expert role from https://nazdridoy.github.io/ngpt/examples/role-gallery/
140
+ ngpt --role sql_expert "Write a query to find all users who made a purchase in the last 30 days"
141
+
130
142
  # Rewrite text to improve quality while preserving tone and meaning
131
143
  echo "your text" | ngpt -r
132
144
 
@@ -230,10 +242,11 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
230
242
 
231
243
  usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index CONFIG_INDEX] [--provider PROVIDER]
232
244
  [--remove] [--show-config] [--all] [--list-models] [--list-renderers] [--cli-config [COMMAND ...]]
233
- [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search] [--pipe]
234
- [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]] [--preprompt PREPROMPT]
235
- [--no-stream | --prettify | --stream-prettify] [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]]
236
- [--chunk-size CHUNK_SIZE] [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
245
+ [--role-config [ACTION ...]] [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search]
246
+ [--pipe] [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]]
247
+ [--preprompt PREPROMPT | --role ROLE] [--no-stream | --prettify | --stream-prettify]
248
+ [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]] [--chunk-size CHUNK_SIZE]
249
+ [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
237
250
  [--max-recursion-depth MAX_RECURSION_DEPTH] [-i | -s | -c | -t | -r | -g]
238
251
  [prompt]
239
252
 
@@ -260,6 +273,7 @@ Configuration Options::
260
273
  --list-models List all available models for the current configuration and exit
261
274
  --list-renderers Show available markdown renderers for use with --prettify
262
275
  --cli-config [COMMAND ...] Manage CLI configuration (set, get, unset, list, help)
276
+ --role-config [ACTION ...] Manage custom roles (help, create, show, edit, list, remove) [role_name]
263
277
 
264
278
  Global Options::
265
279
 
@@ -273,6 +287,7 @@ Global Options::
273
287
  --max_tokens MAX_TOKENS Set max response length in tokens
274
288
  --log [FILE] Set filepath to log conversation to, or create a temporary log file if no path provided
275
289
  --preprompt PREPROMPT Set custom system prompt to control AI behavior
290
+ --role ROLE Use a predefined role to set system prompt (mutually exclusive with --preprompt)
276
291
  --renderer {auto,rich,glow} Select which markdown renderer to use with --prettify or --stream-prettify (auto, rich, or glow)
277
292
 
278
293
  Output Display Options (mutually exclusive)::
@@ -288,7 +303,7 @@ Git Commit Message Options::
288
303
  --chunk-size CHUNK_SIZE Number of lines per chunk when chunking is enabled (default: 200)
289
304
  --analyses-chunk-size ANALYSES_CHUNK_SIZE Number of lines per chunk when recursively chunking analyses (default: 200)
290
305
  --max-msg-lines MAX_MSG_LINES Maximum number of lines in commit message before condensing (default: 20)
291
- --max-recursion-depth MAX_RECURSION_DEPTH Maximum recursion depth for commit message condensing (default: 3)
306
+ --max-recursion-depth MAX_RECURSION_DEPTH Maximum recursion depth for commit message condensing (default: 3)
292
307
 
293
308
  Modes (mutually exclusive)::
294
309
 
@@ -316,6 +331,8 @@ Key documentation sections:
316
331
  - [Installation Guide](https://nazdridoy.github.io/ngpt/installation/)
317
332
  - [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage/)
318
333
  - [Configuration Guide](https://nazdridoy.github.io/ngpt/configuration/)
334
+ - [Custom Roles Guide](https://nazdridoy.github.io/ngpt/usage/roles/)
335
+ - [Role Gallery](https://nazdridoy.github.io/ngpt/examples/role-gallery/)
319
336
  - [Examples & Tutorials](https://nazdridoy.github.io/ngpt/examples/basic/)
320
337
  - [Git Commit Message Guide](https://nazdridoy.github.io/ngpt/usage/gitcommsg/)
321
338
 
@@ -564,6 +581,40 @@ This is a huge time-saver. nGPT analyzes your git diff and generates a properly
564
581
 
565
582
  ![ngpt-g](https://raw.githubusercontent.com/nazdridoy/ngpt/main/previews/ngpt-g.png)
566
583
 
584
+ #### Custom AI Roles
585
+
586
+ ```bash
587
+ # Create a specialized role for JSON generation
588
+ ngpt --role-config create json_generator
589
+
590
+ # Use the custom role to generate structured data
591
+ ngpt --role json_generator "Generate random user profile data"
592
+ ```
593
+ ```json
594
+ {
595
+ "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
596
+ "firstName": "Aurora",
597
+ "lastName": "Reynolds",
598
+ "email": "aurora.reynolds@example.com",
599
+ "phone": "+1-555-0101",
600
+ "address": {
601
+ "street": "123 Main St",
602
+ "city": "Anytown",
603
+ "state": "CA",
604
+ "zipCode": "90210"
605
+ },
606
+ "birthDate": "1990-07-15",
607
+ "registrationDate": "2022-01-20",
608
+ "isActive": true,
609
+ "roles": [
610
+ "user",
611
+ "premium"
612
+ ]
613
+ }
614
+ ```
615
+
616
+ Custom roles allow you to create reusable AI personas for consistent responses across various prompts. For more details, see the [Custom Roles Guide](https://nazdridoy.github.io/ngpt/usage/roles/) and check out the [Role Gallery](https://nazdridoy.github.io/ngpt/examples/role-gallery/) for ready-to-use roles.
617
+
567
618
  #### Web Search Integration
568
619
 
569
620
  ```bash
@@ -147,12 +147,15 @@ You can set configuration options directly via command-line arguments:
147
147
  ```
148
148
  usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index CONFIG_INDEX] [--provider PROVIDER]
149
149
  [--remove] [--show-config] [--all] [--list-models] [--list-renderers] [--cli-config [COMMAND ...]]
150
- [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search] [--pipe]
151
- [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]] [--preprompt PREPROMPT]
152
- [--no-stream | --prettify | --stream-prettify] [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]]
153
- [--chunk-size CHUNK_SIZE] [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
150
+ [--role-config [ACTION ...]] [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search]
151
+ [--pipe] [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]]
152
+ [--preprompt PREPROMPT | --role ROLE] [--no-stream | --prettify | --stream-prettify]
153
+ [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]] [--chunk-size CHUNK_SIZE]
154
+ [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
154
155
  [--max-recursion-depth MAX_RECURSION_DEPTH] [-i | -s | -c | -t | -r | -g]
155
156
  [prompt]
157
+
158
+ nGPT - Interact with AI language models via OpenAI-compatible APIs
156
159
  ```
157
160
 
158
161
  ### Positional Arguments
@@ -176,6 +179,7 @@ usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index
176
179
  - `--list-models`: List all available models for the current configuration and exit
177
180
  - `--list-renderers`: Show available markdown renderers for use with --prettify
178
181
  - `--cli-config <[COMMAND ...]>`: Manage CLI configuration (set, get, unset, list, help)
182
+ - `--role-config <[ACTION ...]>`: Manage custom roles (help, create, show, edit, list, remove) [role_name]
179
183
 
180
184
  ### Global Options
181
185
 
@@ -183,11 +187,13 @@ usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index
183
187
  - `--base-url <BASE_URL>`: Base URL for the API
184
188
  - `--model <MODEL>`: Model to use
185
189
  - `--web-search`: Enable web search capability using DuckDuckGo to enhance prompts with relevant information
190
+ - `--pipe`: Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content. Can be used with any mode option except --text and --interactive
186
191
  - `--temperature <TEMPERATURE>`: Set temperature (controls randomness, default: 0.7)
187
192
  - `--top_p <TOP_P>`: Set top_p (controls diversity, default: 1.0)
188
193
  - `--max_tokens <MAX_TOKENS>`: Set max response length in tokens
189
194
  - `--log <[FILE]>`: Set filepath to log conversation to, or create a temporary log file if no path provided
190
195
  - `--preprompt <PREPROMPT>`: Set custom system prompt to control AI behavior
196
+ - `--role <ROLE>`: Use a predefined role to set system prompt (mutually exclusive with --preprompt)
191
197
  - `--renderer <{auto,rich,glow}>`: Select which markdown renderer to use with --prettify or --stream-prettify (auto, rich, or glow)
192
198
 
193
199
  ### Output Display Options (mutually exclusive)
@@ -211,7 +217,6 @@ usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index
211
217
  - `-s, --shell`: Generate and execute shell commands
212
218
  - `-c, --code`: Generate code
213
219
  - `-t, --text`: Enter multi-line text input (submit with Ctrl+D)
214
- - `--pipe`: Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content. Can be used with any mode option except --text and --interactive.
215
220
  - `-r, --rewrite`: Rewrite text from stdin to be more natural while preserving tone and meaning
216
221
  - `-g, --gitcommsg`: Generate AI-powered git commit messages from staged changes or diff file
217
222
 
@@ -297,6 +302,64 @@ ngpt --list-models --provider OpenAI
297
302
 
298
303
  nGPT also supports a CLI configuration system for setting default parameter values. See the [CLI Configuration Guide](usage/cli_config.md) for details.
299
304
 
305
+ ## Role Configuration
306
+
307
+ nGPT allows you to create and manage custom roles, which are saved system prompts that define specialized AI personas. Roles are stored in the following locations:
308
+
309
+ - **Linux**: `~/.config/ngpt/ngpt_roles/`
310
+ - **macOS**: `~/Library/Application Support/ngpt/ngpt_roles/`
311
+ - **Windows**: `%APPDATA%\ngpt\ngpt_roles\`
312
+
313
+ Each role is saved as a separate JSON file with the role name as the filename.
314
+
315
+ ### Managing Roles
316
+
317
+ You can manage roles using the `--role-config` option:
318
+
319
+ ```bash
320
+ # Show role configuration help
321
+ ngpt --role-config help
322
+
323
+ # Create a new role
324
+ ngpt --role-config create expert_coder
325
+
326
+ # List all available roles
327
+ ngpt --role-config list
328
+
329
+ # Show details of a specific role
330
+ ngpt --role-config show expert_coder
331
+
332
+ # Edit an existing role
333
+ ngpt --role-config edit expert_coder
334
+
335
+ # Remove a role
336
+ ngpt --role-config remove expert_coder
337
+ ```
338
+
339
+ When creating or editing a role, nGPT opens a multiline editor where you can enter or modify the system prompt for that role. This makes it easy to define complex instructions that guide the AI's behavior.
340
+
341
+ ### Using Roles
342
+
343
+ To use a role, specify it with the `--role` parameter:
344
+
345
+ ```bash
346
+ # Use a role in standard chat mode
347
+ ngpt --role expert_coder "Create a function to parse JSON data"
348
+
349
+ # Use a role with code generation
350
+ ngpt --code --role python_expert "Create a class for managing user data"
351
+
352
+ # Use a role with shell command generation
353
+ ngpt --shell --role linux_expert "Find all large log files"
354
+
355
+ # Use a role in interactive mode
356
+ ngpt -i --role writing_assistant
357
+ ```
358
+
359
+ The `--role` parameter is mutually exclusive with `--preprompt` since both set the system prompt.
360
+
361
+ For detailed documentation on creating and managing roles, including examples and best practices, see the [Custom Roles Guide](usage/roles.md).
362
+
300
363
  ## Troubleshooting
301
364
 
302
365
  ### Common Configuration Issues
@@ -346,4 +409,4 @@ After configuring nGPT, explore:
346
409
 
347
410
  - [CLI Usage Guide](usage/cli_usage.md) for general usage information
348
411
  - [CLI Configuration Guide](usage/cli_config.md) for setting up default CLI options
349
- - [Basic Examples](examples/basic.md) for common usage patterns
412
+ - [Basic Examples](examples/basic.md) for common usage patterns