Repository navigation
fix: support additional user instructions in the system prompt - #285
marcelklehr merged 2 commits into
Conversation
Declare a new optional `user_instructions` input on the agent providers (classic and multimodal). When set, e.g. by the Assistant app with its "Chat User Instructions" admin setting, the text is appended to the agent's own system prompt. It does not replace it, so the tool calling instructions stay intact. Refs nextcloud/assistant#338 Signed-off-by: Viacheslav Huliaiev <vyacheslavhulyaev@gmail.com>
1bc6c51 to
ea180eb
Compare
Add the optional "output_mode" input. With "speech", the agent's own system prompt asks for a reply without Markdown or other formatting, since it is sent to text-to-speech. This takes precedence over the admin-provided instructions. Signed-off-by: Viacheslav Huliaiev <vyacheslavhulyaev@gmail.com>
|
Thanks for the approvals! After the review in nextcloud/assistant#709 I added one more optional input, |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Part of the fix for nextcloud/assistant#338: the "Chat User Instructions for Chat Completions" admin setting of the Assistant is ignored when chatting through the Context Agent.
Companion PR in the Assistant: nextcloud/assistant#709
Changes
provider.py: declare a new optional inputuser_instructions(Text) on the classic and the multimodal provider, the same waymemoriesis declared. No server change is needed.agent.py: if set, append it after the agent's own system prompt, under a note telling the model to follow it unless it conflicts with the instructions above. As discussed in #338 by @janepie, admins can only add to the prompt, not replace it, so the tool calling instructions stay intact. Without the input, the prompt is unchanged.main.py: log the new input along withmemories.tests/test_user_instructions.py: unit tests for the formatting and the provider declaration.Testing
PYTHONPATH=. python tests/test_user_instructions.py: 3/3 passgpt-4.1-mini: the optional input shows up inoptionalInputShapeofcore:contextagent:interactionandcore:contextagent:multimodal-interaction. Withuser_instructions: "Always answer like a pirate. Your name is Captain Cloud."and the input "What is your name?", the agent answers "Ahoy! I be Captain Cloud, yer trusty AI assistant sailin' the digital seas…"Open questions
user_instructionsa good name for the input?ContextAgentInteractionoptional input shape later, so it's a documented API rather than something only this provider declares?