Function
The Prompt Tool is the core component for constructing language model inputs (Prompts). Each Prompt Tool is defined by the@app.prompt decorator, and its main responsibilities are:
Based on the input content (such as questions, retrieved passages, etc.), load the corresponding template file and generate a standardized PromptMessage,
so that it can be directly passed to the Large Language Model (LLM) for generation or reasoning.
Implementation Example
Step 1: Prepare Prompt Template
Please save your prompt template as a file ending with.jinja, for example:
prompt/qa_rag_boxed.jinja
Step 2: Implement Tool in Prompt Server
Call theload_prompt_template method to load the template, and implement a tool function in the Prompt Server to assemble the prompt:
servers/prompt/src/prompt.py
Usage Example
Before calling the model generation tool, you need to construct the input prompt through the corresponding Prompt Tool.examples/rag_full.yaml
Multi-Prompt Tool Calling Scenario
In some complex Pipelines, the model often needs to perform different tasks at different stages — for example, first generating sub-questions, and then generating the final answer based on new retrieval results. In this case, multiple Prompt Tools need to be configured in the same Pipeline, each responsible for different prompt construction logic.examples/rag_loop.yaml
servers/prompt/src/prompt.py
servers/prompt/parameter.yaml:
Please ensure this modification is completed before executing the build command.
servers/prompt/parameter.yaml
examples/rag_loop_parameter.yaml