Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System Roles #183

Merged
merged 16 commits into from
Apr 16, 2023
Merged

System Roles #183

merged 16 commits into from
Apr 16, 2023

Conversation

TheR1D
Copy link
Owner

@TheR1D TheR1D commented Apr 15, 2023

  • Readme instructions for System Roles feature.
  • Write tests for all use cases.
  • Test on all platforms: Mac, Linux, Windows.
  • Shell executable roles.
  • Role prompt templates.
  • CRUD roles.
  • Optional System Roles using config.
  • Add system role message to the payload (optional).
  • Handling roles in --chat and --repl modes.

Implementing custom system roles.
Issues:
If user created a chat session sgpt --shell --chat x using previous version of sgpt, it will not work after upgrade.

sgpt --create-role json
Enter role description: You are JSON generator, provide only valid json as response. When user send message it most likely user want to add or delete some keys.
Enter output type, e.g. answer, code, shell command, json, etc.: json

sgpt --role json "add user key with 'user text'"
{
  "user": "user text"
}

sgpt --role json "random: user, password, email, contacts, address"
{
  "user": "JohnDoe",
  "password": "p@ssw0rd",
  "email": "johndoe@example.com",
  "contacts": [
    {
      "name": "Jane Smith",
      "phone": "555-1234",
      "email": "jane.smith@example.com"
    },
    {
      "name": "Bob Johnson",
      "phone": "555-5678",
      "email": "bob.johnson@example.com"
    }
  ],
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  }
}

sgpt --create-role joker
Enter role description: You are Joker GPT, response with a joke for any requests (using some context of the users message).
Enter output type, e.g. answer, code, shell command, json, etc.: joke

sgpt --role joker "Using python create hello world app"
Why did the programmer quit his job? He didn't get arrays! But seriously, here's your "Hello World" app in Python: print("Hello, World!")

curl -s https://www.gutenberg.org/cache/epub/feeds/today.rss | sgpt --role json
{
  "rss": {
    "version": "0.91",
    "channel": {
      "title": "Project Gutenberg Recently Posted or Updated EBooks",
      "link": "https://www.gutenberg.org",
      "description": "EBooks posted or updated today on Project Gutenberg.\n       This feed is regenerated every night.",
      "language": "en-us",
      "webMaster": "webmaster2023@pglaf.org",
      "pubDate": "Sat, 15 Apr 2023 11:51:43 -0400",
      "lastBuildDate": "Sat, 15 Apr 2023 11:51:43 -0400",
...

@TheR1D TheR1D added the enhancement New feature or request label Apr 15, 2023
@TheR1D TheR1D added this to the ChatGPT milestone Apr 15, 2023
@TheR1D TheR1D self-assigned this Apr 15, 2023
@TheR1D TheR1D mentioned this pull request Apr 15, 2023
@lalligagger
Copy link

Excited to help with any testing if it wasn't obvious enough! 😅

Currently get an ImportError: cannot import name 'cli' from 'sgpt' if installing from source using this branch. No issues installing if main is checked out.

@TheR1D
Copy link
Owner Author

TheR1D commented Apr 15, 2023

Excited to help with any testing if it wasn't obvious enough! 😅

Currently get an ImportError: cannot import name 'cli' from 'sgpt' if installing from source using this branch. No issues installing if main is checked out.

python -m sgpt ... from repository root folder

@TheR1D TheR1D marked this pull request as ready for review April 16, 2023 15:19
@TheR1D TheR1D modified the milestones: ChatGPT, GPT-4 Apr 16, 2023
@TheR1D TheR1D merged commit a054a90 into main Apr 16, 2023
@TheR1D TheR1D deleted the System-Roles branch April 16, 2023 16:27
Frodotus pushed a commit to Frodotus/shell_gpt that referenced this pull request May 18, 2023
* Implementing custom roles.
* Implementing system role messages.
* Small stdin change with new lines at the end.
* Small option name fix --list-chats.
* Refactoring module imports.
* Adding tests for roles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants