justyns/silverbullet-ai

Custom instructions for chat

Closed this issue · 6 comments

ChatGPT has this feature "custom instructions" which I think just invisibly injects the text more or less verbatim in the original prompt. It's very useful to have a place to add these instructions once, and not have to re-enter them for every chat:

CleanShot 2024-02-25 at 15 29 18@2x

Seems like something easy to add? Not sure how to best configure this, though. Perhaps a dedicated page? A setting pointing to a page with these instructions, some other way?

You can sort of do this with a template, e.g. this is my "New AI Chat" page template:

---
description: "Create a chat session with your LLM"
tags: template
hooks.newPage:
  suggestedName: "Inbox/{{today}} {{time}} - AI Chat"
  confirmName: false
  command: "New AI Chat"
  key: "Alt-Shift-c"
frontmatter:
  dateCreated: "{{today}}"
---

**system**: You are an AI note assistant in a markdown-based note tool.  You are having an interactive chat with the user.  Keep your responses short and concise.

**assistant**: Hello, how can I help you?

**user**: |^|

The first **system**: could be changed to include this information. It's not as convenient as having it always available though, adding it to the settings page probably would be fine. Something like aisettings.userInformation and aisettings.userInstructions and just add those automatically to the first system message by default

Right yeah I suppose adding it to a page template is another way.

Thinking about this more, what do you think about this in SETTINGS?

indexPage: index

ai:
  defaultTextModel: gpt-4-0125-preview
  # openAIBaseUrl: http://localhost:11434/v1
  # defaultTextModel: phi
  # requireAuth: false
  chat:
    userInformation: >
      I'm a person.
    userInstructions: >
      Please give short and concise responses.  When providing code, do so in python unless requested otherwise.

And then those two fields would only get used by the "Chat" command. Any other prompts would still be able to set their own system prompt so they don't have to worry about random things being injected into the prompt. I like the idea of a default system prompt for everything but I also think it could cause confusion.

Makes sense to me. Putting it in SETTINGS is fine I think.

If you want to give it a try, I just pushed it to main

Seems to work!

Where do I live?


**assistant**: You live in Poland.