karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.04k stars 111 forks source link

Prepend additional directive to user message instead of system prompt #277

Open karthink opened 3 months ago

karthink commented 3 months ago

If I may suggest: the directive needs to be prepended to the first user message with Anthropic, or we should have an option. Appending to the system message is not a good general solution. Why do you think they should be prepended?

According to Anthropic documentation:

"in general, you can think about system prompts as a space to provide guidance about the overall interaction with Claude, and the user turn as part of the interaction itself, or when you have only a one-off task you want to accomplish"

That's how I work: system prompt defines the context, while the user prompt sends the specific directive and the text to be operated on.

This isn't clear-cut and is definitely up for debate, but I think we should at least have the option.

Originally posted by @jwr in https://github.com/karthink/gptel/issues/276#issuecomment-2035112175

jwr commented 2 months ago

Closely related suggestion, based on the reading of docs for the Mistral-7B-Instruct-v0.2 model:

In order to leverage instruction fine-tuning, your prompt should be surrounded by [INST] and [/INST] tokens.

A :process-directive option to gptel-make-ollama (and others) that would accept a function taking backend, model, and directive arguments and return a processed directive. This is probably more user-friendly than a generic fn.

This might also be useful for Anthropic models, which like XML-style tagging.