[TheiaAi] Support referencing prompt fragments via variable #14985
+193
−24
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 it does
Prompt fragments allow to define parts of prompts in a reusable way. You can embed these prompts then via a variable in the chat or in our prompt templates. This also allows to have a set of prompts available in the chat without always defining a custom agent.
This PR defines a Theia Ai variable
prompt
with an argument containing the prompt fragment's id. The variable is fully resolved including variables and function calls in the fragment.This also adds auto completion for available custom and builtin prompt fragments to the chat UI.
The variable is defined as a context variable meaning it is added to the chat context similar to referenced files. This was discussed here: #14899 (comment)
Note that agents need to be adapted to use this from the context as explained here: #14787 (comment)
This is not part of this PR.
prompt-template-autocomplete.webm
Part of #14899
How to test
Ai-features › Prompt Templates: Prompt Templates Folder
to point to a folder of your choosing.prompttemplate
file in the specified folder.What id does
)Follow-ups
Step 2 of #14899 implementing settings UI and editing for prompt fragments
Breaking changes
Attribution
Review checklist
Reminder for reviewers