Skip to content

[Feature Request] Chat: Custom /commands expanding to prompts #611

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

Open
secondtruth opened this issue Dec 5, 2023 · 0 comments
Open

[Feature Request] Chat: Custom /commands expanding to prompts #611

secondtruth opened this issue Dec 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@secondtruth
Copy link
Contributor

secondtruth commented Dec 5, 2023

Inspired by #464, I'd like to suggest custom slash-commands defined in the env (on model level and/or global level), that will be expanded to prompt text, maybe using handlebars templates. This could also be useful in the future for inserting user-defined prompts by a shortname or calling agents (#462), made even easier with some kind of autocompletion.

Suggestions and improvements of this proposal are very welcome!

Example:

CHAT_COMMANDS=`[
  {
    "command": "news",
    "description": "Get a summary of the latest news.",
    "type": "text",
    "content": "Please summarize today's news.",
    "features": {
      "websearch": true // temporarily enable websearch feature
    }
  }, {
    "command": "words-starting-with",
    "description": "Get words starting with your favorite letter.",
    "min_args": 1,
    "type": "template",
    "content": "Find {{#if args[1]}}{{args[1]}}{{else}}5{{/if}} words starting with {{args[0]}}"
  }
]`
  • Usage example for Command 1: /news
  • Usage example for Command 2: /words-starting-with a

Additional Proposal: Prompts from external APIs

In building upon the previous feature concept, a future enhancement is proposed to allow commands to trigger API requests, thereby enabling completely dynamic prompt generation based on external data or services. This would significantly increase the versatility and interactivity of the commands.

Example:

  {
    "command": "do-request",
    "description": "Do an API request that returns a prompt text.",
    "min_args": 2,
    "type": "request",
    "request": {
      "url": "https://example.com/script",
      "method": "post",
      "datatype": "json",
      "data": {
        "x": "{{args[0]}}",
        "y": "{{args[1]}}"
      },
      "result": {
        "datatype": "json",
        "path": "result.prompt_text",
        "templated": true
      }
    }
  }
  • Usage example for Command: /do-request 1, 2
@secondtruth secondtruth changed the title Feature Request: Custom slash-commands [Feature Request] Custom /commands in chat Dec 15, 2023
@secondtruth secondtruth changed the title [Feature Request] Custom /commands in chat [Feature Request] Custom /commands in chat that expand to pr Mar 19, 2024
@secondtruth secondtruth changed the title [Feature Request] Custom /commands in chat that expand to pr [Feature Request] Chat: Custom /commands expanding to prompts Mar 19, 2024
@nsarrazin nsarrazin added the enhancement New feature or request label Mar 19, 2024
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
Development

No branches or pull requests

2 participants