简体中文
@app.prompt
PromptMessage
Please answer the following question based on the given documents. Think step by step. Provide your final answer in the format \boxed{YOUR_ANSWER}. Documents: {{documents}} Question: {{question}}
load_prompt_template
@app.prompt(output="q_ls,ret_psg,template->prompt_ls") def qa_rag_boxed( q_ls: List[str], ret_psg: List[str | Any], template: str | Path ) -> list[PromptMessage]: template: Template = load_prompt_template(template) ret = [] for q, psg in zip(q_ls, ret_psg): passage_text = "\n".join(psg) p = template.render(question=q, documents=passage_text) ret.append(p) return ret
# MCP Server servers: generation: servers/generation prompt: servers/prompt # MCP Client Pipeline pipeline: - prompt.qa_rag_boxed - generation.generate
prompt: template: prompt/qa_rag_boxed.jinja
@app.prompt(output="q_ls,ret_psg,template1->prompt_ls") def qa_rag_boxed( q_ls: List[str], ret_psg: List[str | Any], template: str | Path ) -> list[PromptMessage]: xxxx @app.prompt(output="q_ls,ret_psg,template2->prompt_ls") def qa_rag_boxed_2( q_ls: List[str], ret_psg: List[str | Any], template: str | Path ) -> list[PromptMessage]: xxxx
servers/prompt/parameter.yaml
template1: prompt/qa_boxed.jinja template2: prompt/qa_boxed.jinja
此页面对您有帮助吗?