From c987ceecb2f5da3dc15a718af9d2b77b7382df9d Mon Sep 17 00:00:00 2001 From: "jinli.yl" Date: Thu, 10 Jul 2025 21:03:54 +0800 Subject: [PATCH] update summary op --- experiencemaker/op/base_op.py | 3 +- ...op_prompt.yaml => build_query_prompt.yaml} | 0 .../summarizer/simple_summarizer_prompt.yaml | 22 ---------- ...ple_summarizer.py => simple_summary_op.py} | 0 .../op/summarizer/simple_summary_prompt.yaml | 41 +++++++++++++++++++ 5 files changed, 43 insertions(+), 23 deletions(-) rename experiencemaker/op/retriever/{build_query_op_prompt.yaml => build_query_prompt.yaml} (100%) delete mode 100644 experiencemaker/op/summarizer/simple_summarizer_prompt.yaml rename experiencemaker/op/summarizer/{simple_summarizer.py => simple_summary_op.py} (100%) create mode 100644 experiencemaker/op/summarizer/simple_summary_prompt.yaml diff --git a/experiencemaker/op/base_op.py b/experiencemaker/op/base_op.py index b7bdbc60..aba4b263 100644 --- a/experiencemaker/op/base_op.py +++ b/experiencemaker/op/base_op.py @@ -33,7 +33,8 @@ class BaseOp(PromptMixin, ABC): if self.op_config.prompt_file_path: prompt_file_path = self.op_config.prompt_file_path else: - prompt_file_path = Path(__file__).parent / f"{self.simple_name}_prompt.yaml" + prompt_name = self.simple_name.replace("op", "").strip("_") + "_prompt.yaml" + prompt_file_path = Path(__file__).parent / prompt_name # Load custom prompts from prompt file self.load_prompt_by_file(prompt_file_path=prompt_file_path) diff --git a/experiencemaker/op/retriever/build_query_op_prompt.yaml b/experiencemaker/op/retriever/build_query_prompt.yaml similarity index 100% rename from experiencemaker/op/retriever/build_query_op_prompt.yaml rename to experiencemaker/op/retriever/build_query_prompt.yaml diff --git a/experiencemaker/op/summarizer/simple_summarizer_prompt.yaml b/experiencemaker/op/summarizer/simple_summarizer_prompt.yaml deleted file mode 100644 index 6ca36914..00000000 --- a/experiencemaker/op/summarizer/simple_summarizer_prompt.yaml +++ /dev/null @@ -1,22 +0,0 @@ -summary_prompt: | - # Role - You are a helpful assistant named BeyondAgent. - - # User Question - {query} - - # Execution Process - {execution_process} - - # Answer - {answer} - - # Task - Reflect on the strengths and weaknesses of the **Execution Process** and the **Answer** based on the **User Question**. - Finally, summarize generalized experience from handling such problems to accumulate experience for future similar tasks. - The experience should be broadly applicable, such as how to use tools effectively or approaches to solving certain types of problems. - Also, specify the conditions or scenarios in which these experience are applicable. - - # Output Format - Output the scenarios or conditions in which applying this experience would be particularly effective... - Output generalized experience, concise content is required... \ No newline at end of file diff --git a/experiencemaker/op/summarizer/simple_summarizer.py b/experiencemaker/op/summarizer/simple_summary_op.py similarity index 100% rename from experiencemaker/op/summarizer/simple_summarizer.py rename to experiencemaker/op/summarizer/simple_summary_op.py diff --git a/experiencemaker/op/summarizer/simple_summary_prompt.yaml b/experiencemaker/op/summarizer/simple_summary_prompt.yaml new file mode 100644 index 00000000..1cdb5427 --- /dev/null +++ b/experiencemaker/op/summarizer/simple_summary_prompt.yaml @@ -0,0 +1,41 @@ +summary_prompt: | + # Role + You are a helpful assistant. + + # User Question + {query} + + # Execution Process + {execution_process} + + # Answer + {answer} + + # Task + Reflect on what went well and what did not go well in the execution path based on the user's question. + The summarized experiences should be generalizable, providing assistance in solving similar types of problems in the future. + They can include good suggestions or highlight areas to avoid and potential pitfalls. + The type of experience can be plain text or a piece of code that solves a specific problem. + If there are no experiences to summarize, output an empty list []. + For each experience, first state the scenario when it is applicable (when to use), then provide the experience itself, with a maximum of three experiences summarized. + + # Output Format + {summary_example} + +summary_example: | + ``` json + [ + { + "when_to_use": "...", + "experience": "..." + }, + { + "when_to_use": "...", + "experience": "..." + }, + { + "when_to_use": "...", + "experience": "..." + } + ] + ``` \ No newline at end of file