Open rbyh opened 1 month ago
This will also be of use for the #258 once it's bitten, as some HuggingFace models do not support the System Prompt, e.g. Gemma-7B and its community derivatives.
Just thinking aloud -
We should be able to give the user control over the construction of the user & system prompts using this:
https://github.com/expectedparrot/edsl/blob/main/edsl/agents/prompt_helpers.py
The user creates a PromptPlan
by putting enums in the right order and location:
p = PromptPlan(user_prompt_order=(
PromptComponent.AGENT_INSTRUCTIONS,
PromptComponent.AGENT_PERSONA),
system_prompt_order=(
PromptComponent.QUESTION_INSTRUCTIONS,
PromptComponent.PRIOR_QUESTION_MEMORY)
)
Right now, the PromptConstructor just uses the default: https://github.com/expectedparrot/edsl/blob/main/edsl/agents/PromptConstructor.py
...
self.prompt_plan = PromptPlan()
...
We'd need to give the user the ability to pass their Constructed prompt during a run()
or prompts
call. This would then be passed down through to the PromptConstructor
module.
One thing we'd have to figure out is allowing the user to specify on a model-by-model basis e.g., they pass a dictionary of model names and prompt plans.
The syntax could be something like this:
p = PromptPlan.user_prompt_only()
Then the user could use a regular expression key for a dictionary to match models, like so:
my_cool_survey.run(prompt_plan = {'gemma*':p})
Thoughts @iwr-redmond ?
More user control is worth fixing, sure. But I reckon you're closer to the mark with the user_prompt_only idea.
An automated check to determine whether the System Prompt is obeyed when using SLMs could also be useful, as there are already some eyeless needles lurking in the models cache (not to mention Ollama). I'm not very familiar with your codebase, but the ProofOfWork function might could be a starting point, e.g. returning 'talk like a pirate' as a System Prompt test instead of 'hello world'. A manual unsupported list like OpenAI model_exclude_list is less helpful in the community realm where there is a proliferation of models - if you don’t like your SLM, wait a minute.
Purpose: This will allow you to use Scenario objects with Agent traits -- eg images.