feat: add custom system prompt for the assistant#193
Open
HardeepAsrani wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A custom system prompt for the assistant, so a site owner can shape its persona, tone, and scope in their own words instead of relying only on the built in prompt.
Implements the single global master prompt discussed on Codeinwp/hyve#176 (one prompt for the whole chat, rather than per block).
How it works
{response, success}contract), the allowed HTML tags, and the "answer from context" behavior always stay in effect, so a custom prompt cannot break the response contract.hyve_system_promptfilter.Developer filter
hyve_system_promptfilters the custom prompt string that gets appended (defaults to thesystem_promptsetting).Manual QA
The backend behavior needs the Pro control (or the filter) to set a value, so QA is easiest with the Pro branch active, or via the filter.
add_filter( 'hyve_system_prompt', fn() => 'Always answer in French.' );and ask the chatbot something. The reply should follow the custom instruction while still answering from the knowledge base.