@app.prompt(output="q_ls,plan_ls,webnote_init_page_template->prompt_ls")
def webnote_init_page(
q_ls: List[str],
plan_ls: List[str],
template: str | Path,
) -> List[PromptMessage]:
template: Template = load_prompt_template(template)
all_prompts = []
for q, plan in zip(q_ls, plan_ls):
p = template.render(question=q, plan=plan)
all_prompts.append(p)
return all_prompts
@app.prompt(output="q_ls,webnote_gen_plan_template->prompt_ls")
def webnote_gen_plan(
q_ls: List[str],
template: str | Path,
) -> List[PromptMessage]:
template: Template = load_prompt_template(template)
all_prompts = []
for q in q_ls:
p = template.render(question=q)
all_prompts.append(p)
return all_prompts
@app.prompt(output="q_ls,plan_ls,page_ls,webnote_gen_subq_template->prompt_ls")
def webnote_gen_subq(
q_ls: List[str],
plan_ls: List[str],
page_ls: List[str],
template: str | Path,
) -> List[PromptMessage]:
template: Template = load_prompt_template(template)
all_prompts = []
for q, plan, page in zip(q_ls, plan_ls, page_ls):
p = template.render(question=q, plan=plan, page=page)
all_prompts.append(p)
return all_prompts
@app.prompt(output="q_ls,plan_ls,page_ls,subq_ls,psg_ls,webnote_fill_page_template->prompt_ls")
def webnote_fill_page(
q_ls: List[str],
plan_ls: List[str],
page_ls: List[str],
subq_ls: List[str],
psg_ls: List[Any],
template: str | Path,
) -> List[PromptMessage]:
template: Template = load_prompt_template(template)
all_prompts = []
for q, plan, page, subq, psg in zip(q_ls, plan_ls, page_ls, subq_ls, psg_ls):
p = template.render(question=q, plan=plan, page=page, subq=subq, psg=psg)
all_prompts.append(p)
return all_prompts
@app.prompt(output="q_ls,plan_ls,page_ls,webnote_gen_answer_template->prompt_ls")
def webnote_gen_answer(
q_ls: List[str],
plan_ls: List[str],
page_ls: List[str],
template: str | Path,
) -> List[PromptMessage]:
template: Template = load_prompt_template(template)
all_prompts = []
for q, plan, page in zip(q_ls, plan_ls, page_ls):
p = template.render(question=q, plan=plan, page=page)
all_prompts.append(p)
return all_prompts