Skip to content

[Theia AI] Support prompt fragments #14899

@JonasHelming

Description

@JonasHelming

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.

Step 1: Allow referencing prompt fragments

The PromptCustomizationService should already load any file in the prompt service. When we add a file there which does not have the id of an agent, we assume it is a resuable prompt.
We now need a variable "#prompt:${promptId}" that resolves to the prompt with the specified id. We need to check the resolvement logic in the prompt service so that variables and function occuring in injected prompt fragments are resolved , too. same applies for chat messages.
With this, the user can add a prompt fragment by just placing a file e.g. myprompt.prompttemplate in the prompt templates directory and then use it via "#prompt:myprompt". "myPrompt" gets auto completed.

Step 2: Add UI

Add a new tab to the AI configuration view showing a list of all loaded prompt templates allowing to:

  • Edit
  • Add Variant (of an existing one)
  • Add prompt fragment
  • Reset/delete (if they are resettable, e.g. they have been created by an agent, otherwise delete)
  • Filter to agent prompts or prompt fragments
  • Open the directory
  • Sort

Metadata

Metadata

Assignees

Labels

theia-aiissues related to TheiaAI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions