From 1d2b229bce10972c371bb7b89f34d234f851669b Mon Sep 17 00:00:00 2001 From: liqun Date: Fri, 6 Sep 2024 17:51:16 +0800 Subject: [PATCH 01/12] init --- .../code_interpreter/code_generator.py | 37 +++++++++--- taskweaver/ext_role/echo/echo.py | 6 ++ taskweaver/memory/attachment.py | 4 ++ taskweaver/memory/experience.py | 58 +++++++++++++------ taskweaver/planner/planner.py | 41 ++++++++++--- taskweaver/session/session.py | 40 +++++++++++-- tests/unit_tests/test_experience.py | 2 +- 7 files changed, 147 insertions(+), 41 deletions(-) diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator.py b/taskweaver/code_interpreter/code_interpreter/code_generator.py index f72e1ecd..7011c4f3 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator.py +++ b/taskweaver/code_interpreter/code_interpreter/code_generator.py @@ -56,6 +56,7 @@ def _configure(self) -> None: self.auto_plugin_selection_topk = self._get_int("auto_plugin_selection_topk", 3) self.use_experience = self._get_bool("use_experience", False) + self.dynamic_experience_filter = self._get_bool("dynamic_experience_filter", False) self.llm_alias = self._get_str("llm_alias", default="", required=False) @@ -104,17 +105,31 @@ def __init__( logger.info("Plugin embeddings loaded") self.selected_plugin_pool = SelectedPluginPool() - if self.config.use_experience: - self.experience_generator = experience_generator - self.experience_generator.refresh() - self.experience_generator.load_experience() - self.logger.info( - "Experience loaded successfully, " - "there are {} experiences".format(len(self.experience_generator.experience_list)), - ) + self.experience_generator = experience_generator + self.exp_loaded = False + if self.config.dynamic_experience_filter: + self.exp_filter_str = None + else: + # use the experience folder + self.exp_filter_str = "" self.logger.info("CodeGenerator initialized successfully") + def load_experience(self): + if self.exp_filter_str is None or self.exp_loaded: + return + self.experience_generator.set_sub_dir(self.exp_filter_str) + self.experience_generator.refresh() + self.experience_generator.load_experience() + self.logger.info( + "Experience loaded successfully, " + "there are {} experiences with filter [{}]".format( + len(self.experience_generator.experience_list), + self.exp_filter_str, + ) + ) + self.exp_loaded = True + def configure_verification( self, code_verification_on: bool, @@ -363,6 +378,11 @@ def reply( # obtain the query from the last round query = rounds[-1].post_list[-1].message + exp_filter = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_filter) + if exp_filter: + self.exp_filter_str = exp_filter[0].content + self.tracing.set_span_attribute("exp_filter", self.exp_filter_str) + self.tracing.set_span_attribute("query", query) self.tracing.set_span_attribute("enable_auto_plugin_selection", self.config.enable_auto_plugin_selection) self.tracing.set_span_attribute("use_experience", self.config.use_experience) @@ -371,6 +391,7 @@ def reply( self.plugin_pool = self.select_plugins_for_prompt(query) if self.config.use_experience: + self.load_experience() selected_experiences = self.experience_generator.retrieve_experience(query) else: selected_experiences = None diff --git a/taskweaver/ext_role/echo/echo.py b/taskweaver/ext_role/echo/echo.py index c7951a15..d82d02e1 100644 --- a/taskweaver/ext_role/echo/echo.py +++ b/taskweaver/ext_role/echo/echo.py @@ -2,6 +2,7 @@ from taskweaver.logging import TelemetryLogger from taskweaver.memory import Memory, Post +from taskweaver.memory.attachment import AttachmentType from taskweaver.module.event_emitter import SessionEventEmitter from taskweaver.module.tracing import Tracing from taskweaver.role import Role @@ -41,4 +42,9 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: self.config.decorator + last_post.message + self.config.decorator, ) + post_proxy.update_attachment( + type=AttachmentType.signal, + message="exp_filter:sub_exp", + ) + return post_proxy.end() diff --git a/taskweaver/memory/attachment.py b/taskweaver/memory/attachment.py index 183a5b70..4c298930 100644 --- a/taskweaver/memory/attachment.py +++ b/taskweaver/memory/attachment.py @@ -45,6 +45,10 @@ class AttachmentType(Enum): # board info board = "board" + # signal + signal = "signal" + exp_filter = "exp_filter" + @dataclass class Attachment: diff --git a/taskweaver/memory/experience.py b/taskweaver/memory/experience.py index b61a0954..70044175 100644 --- a/taskweaver/memory/experience.py +++ b/taskweaver/memory/experience.py @@ -1,7 +1,8 @@ import json import os +from collections import defaultdict from dataclasses import dataclass, field -from typing import Any, Dict, List, Optional, Tuple +from typing import Any, Dict, List, Optional, Tuple, Set from injector import inject @@ -83,6 +84,11 @@ def __init__( "run `python -m experience_mgt --refresh` to refresh the experience." ) + self.sub_dir = None + + def set_sub_dir(self, sub_dir: str): + self.sub_dir = sub_dir + @staticmethod def _preprocess_conversation_data( conv_data: dict, @@ -109,7 +115,9 @@ def summarize_experience( exp_id: str, prompt: Optional[str] = None, ): - raw_exp_file_path = os.path.join(self.config.experience_dir, f"raw_exp_{exp_id}.yaml") + exp_dir = self.get_experience_dir() + + raw_exp_file_path = os.path.join(exp_dir, f"raw_exp_{exp_id}.yaml") conversation = read_yaml(raw_exp_file_path) conversation = self._preprocess_conversation_data(conversation) @@ -145,10 +153,12 @@ def refresh( self, prompt: Optional[str] = None, ): - if not os.path.exists(self.config.experience_dir): - raise ValueError(f"Experience directory {self.config.experience_dir} does not exist.") + exp_dir = self.get_experience_dir() - exp_files = os.listdir(self.config.experience_dir) + if not os.path.exists(exp_dir): + raise ValueError(f"Experience directory {exp_dir} does not exist.") + + exp_files = os.listdir(exp_dir) raw_exp_ids = [ os.path.splitext(os.path.basename(exp_file))[0].split("_")[2] @@ -176,10 +186,10 @@ def refresh( for idx, exp_id in enumerate(exp_ids): rebuild_flag = False exp_file_name = f"exp_{exp_id}.yaml" - if exp_file_name not in os.listdir(self.config.experience_dir): + if exp_file_name not in os.listdir(exp_dir): rebuild_flag = True else: - exp_file_path = os.path.join(self.config.experience_dir, exp_file_name) + exp_file_path = os.path.join(exp_dir, exp_file_name) experience = read_yaml(exp_file_path) if ( experience["embedding_model"] != self.llm_api.embedding_service.config.embedding_model @@ -194,13 +204,13 @@ def refresh( experience_text=summarized_experience, exp_id=exp_id, raw_experience_path=os.path.join( - self.config.experience_dir, + exp_dir, f"raw_exp_{exp_id}.yaml", ), ) elif exp_id in handcrafted_exp_ids: handcrafted_exp_file_path = os.path.join( - self.config.experience_dir, + exp_dir, f"handcrafted_exp_{exp_id}.yaml", ) experience_obj = Experience.from_dict(read_yaml(handcrafted_exp_file_path)) @@ -218,21 +228,21 @@ def refresh( for i, exp in enumerate(to_be_embedded): exp.embedding = exp_embeddings[i] exp.embedding_model = self.llm_api.embedding_service.config.embedding_model - experience_file_path = os.path.join(self.config.experience_dir, f"exp_{exp.exp_id}.yaml") + experience_file_path = os.path.join(exp_dir, f"exp_{exp.exp_id}.yaml") write_yaml(experience_file_path, exp.to_dict()) self.logger.info("Experience obj saved.") @tracing_decorator - def load_experience( - self, - ): - if not os.path.exists(self.config.experience_dir): - raise ValueError(f"Experience directory {self.config.experience_dir} does not exist.") + def load_experience(self): + exp_dir = self.get_experience_dir() + + if not os.path.exists(exp_dir): + raise ValueError(f"Experience directory {exp_dir} does not exist.") original_exp_files = [ exp_file - for exp_file in os.listdir(self.config.experience_dir) + for exp_file in os.listdir(exp_dir) if exp_file.startswith("raw_exp_") or exp_file.startswith("handcrafted_exp_") ] exp_ids = [os.path.splitext(os.path.basename(exp_file))[0].split("_")[2] for exp_file in original_exp_files] @@ -245,8 +255,12 @@ def load_experience( return for exp_id in exp_ids: + exp_id_exists = exp_id in [exp.exp_id for exp in self.experience_list] + if exp_id_exists: + continue + exp_file = f"exp_{exp_id}.yaml" - exp_file_path = os.path.join(self.config.experience_dir, exp_file) + exp_file_path = os.path.join(exp_dir, exp_file) assert os.path.exists(exp_file_path), ( f"Experience {exp_file} not found. " + self.exception_message_for_refresh ) @@ -293,12 +307,18 @@ def retrieve_experience(self, user_query: str) -> List[Tuple[Experience, float]] return selected_experiences def _delete_exp_file(self, exp_file_name: str): - if exp_file_name in os.listdir(self.config.experience_dir): - os.remove(os.path.join(self.config.experience_dir, exp_file_name)) + exp_dir = self.get_experience_dir() + + if exp_file_name in os.listdir(exp_dir): + os.remove(os.path.join(exp_dir, exp_file_name)) self.logger.info(f"Experience {exp_file_name} deleted.") else: self.logger.info(f"Experience {exp_file_name} not found.") + def get_experience_dir(self): + return os.path.join(self.config.experience_dir, self.sub_dir) \ + if self.sub_dir else self.config.experience_dir + def delete_experience(self, exp_id: str): exp_file_name = f"exp_{exp_id}.yaml" self._delete_exp_file(exp_file_name) diff --git a/taskweaver/planner/planner.py b/taskweaver/planner/planner.py index 6c5241e1..fab5f167 100644 --- a/taskweaver/planner/planner.py +++ b/taskweaver/planner/planner.py @@ -50,6 +50,7 @@ def _configure(self) -> None: ) self.use_experience = self._get_bool("use_experience", False) + self.dynamic_experience_filter = self._get_bool("dynamic_experience_filter", False) self.llm_alias = self._get_str("llm_alias", default="", required=False) @@ -100,18 +101,32 @@ def __init__( self.round_compressor = round_compressor self.compression_prompt_template = read_yaml(self.config.compression_prompt_path)["content"] - if self.config.use_experience: - assert experience_generator is not None, "Experience generator is required when use_experience is True" - self.experience_generator = experience_generator - self.experience_generator.refresh() - self.experience_generator.load_experience() - self.logger.info( - "Experience loaded successfully, " - "there are {} experiences".format(len(self.experience_generator.experience_list)), - ) + self.experience_generator = experience_generator + self.exp_loaded = False + if self.config.dynamic_experience_filter: + self.exp_filter_str = None + else: + # use the experience folder + self.exp_filter_str = "" self.logger.info("Planner initialized successfully") + def load_experience(self): + if self.exp_filter_str is None or self.exp_loaded: + return + self.experience_generator.set_sub_dir(self.exp_filter_str) + self.experience_generator.refresh() + self.experience_generator.load_experience() + self.logger.info( + "Experience loaded successfully, " + "there are {} experiences with filter [{}]".format( + len(self.experience_generator.experience_list), + self.exp_filter_str, + ) + ) + + self.exp_loaded = True + def compose_sys_prompt(self, context: str): worker_description = "" for alias, role in self.workers.items(): @@ -274,10 +289,18 @@ def reply( assert len(rounds) != 0, "No chat rounds found for planner" user_query = rounds[-1].user_query + + exp_filter = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_filter) + if exp_filter: + self.exp_filter_str = exp_filter[0] + self.tracing.set_span_attribute("exp_filter", self.exp_filter_str) + self.tracing.set_span_attribute("user_query", user_query) self.tracing.set_span_attribute("use_experience", self.config.use_experience) + self.tracing.set_span_attribute("exp_filter", self.exp_filter_str) if self.config.use_experience: + self.load_experience() selected_experiences = self.experience_generator.retrieve_experience(user_query) else: selected_experiences = None diff --git a/taskweaver/session/session.py b/taskweaver/session/session.py index 0919eeb2..a94a55f4 100644 --- a/taskweaver/session/session.py +++ b/taskweaver/session/session.py @@ -4,10 +4,11 @@ from typing import Any, Dict, List, Literal, Optional from injector import Injector, inject +from scipy.stats import logser from taskweaver.config.module_config import ModuleConfig from taskweaver.logging import TelemetryLogger -from taskweaver.memory import Memory, Post, Round +from taskweaver.memory import Memory, Post, Round, Attachment from taskweaver.memory.attachment import AttachmentType from taskweaver.module.event_emitter import SessionEventEmitter, SessionEventHandler from taskweaver.module.tracing import Tracing, tracing_decorator, tracing_decorator_non_class @@ -88,6 +89,7 @@ def __init__( self.memory = Memory(session_id=self.session_id) self.session_var: Dict[str, str] = {} + self.session_signal: Dict[AttachmentType, str] = {} self.event_emitter = self.session_injector.get(SessionEventEmitter) self.session_injector.binder.bind(SessionEventEmitter, self.event_emitter) @@ -100,11 +102,21 @@ def __init__( if role_name not in role_registry.get_role_name_list(): raise ValueError(f"Unknown role {role_name}") role_entry = self.role_registry.get(role_name) - role_instance = self.session_injector.create_object(role_entry.module, {"role_entry": role_entry}) + role_instance = self.session_injector.create_object( + role_entry.module, + { + "role_entry": role_entry + } + ) self.worker_instances[role_instance.get_alias()] = role_instance if "planner" in self.config.roles: - self.planner = self.session_injector.create_object(Planner, {"workers": self.worker_instances}) + self.planner = self.session_injector.create_object( + Planner, + { + "workers": self.worker_instances + } + ) self.session_injector.binder.bind(Planner, self.planner) self.max_internal_chat_round_num = self.config.max_internal_chat_round_num @@ -163,6 +175,16 @@ def _send_text_message( @tracing_decorator_non_class def _send_message(recipient: str, post: Post) -> Post: + # add session signal to the post + if self.session_signal: + for signal_type in self.session_signal: + post.add_attachment( + Attachment.create( + type=signal_type, + content=self.session_signal[signal_type], + ) + ) + self.tracing.set_span_attribute("in.from", post.send_from) self.tracing.set_span_attribute("in.recipient", recipient) self.tracing.set_span_attribute("in.message", post.message) @@ -191,7 +213,17 @@ def _send_message(recipient: str, post: Post) -> Post: board_attachment = reply_post.get_attachment(AttachmentType.board) if len(board_attachment) > 0: - chat_round.write_board(reply_post.send_from, reply_post.get_attachment(AttachmentType.board)[0]) + chat_round.write_board( + reply_post.send_from, + reply_post.get_attachment(AttachmentType.board)[0] + ) + + signal_attachments = reply_post.get_attachment(AttachmentType.signal) + for signal in signal_attachments: + signal_type, signal_value = signal.split(":") + self.logger.info(f"Session signal: {signal_type}={signal_value}") + # signal_type must be in AttachmentType + self.session_signal[AttachmentType(signal_type)] = signal_value return reply_post diff --git a/tests/unit_tests/test_experience.py b/tests/unit_tests/test_experience.py index 46a0d6d2..1db44ed1 100644 --- a/tests/unit_tests/test_experience.py +++ b/tests/unit_tests/test_experience.py @@ -10,7 +10,7 @@ IN_GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true" -@pytest.mark.skipif(True, reason="Test doesn't work in Github Actions.") +@pytest.mark.skipif(IN_GITHUB_ACTIONS, reason="Test doesn't work in Github Actions.") def test_experience_retrieval(): app_injector = Injector([LoggingModule]) app_config = AppConfigSource( From 9cf39cbe9dd5aa2978b804bc7630c64e9fdc40e5 Mon Sep 17 00:00:00 2001 From: liqun Date: Mon, 9 Sep 2024 11:26:14 +0800 Subject: [PATCH 02/12] refactor --- scripts/experience_mgt.py | 96 ------------------- .../code_interpreter/code_generator.py | 58 ++++++----- taskweaver/ext_role/echo/echo.py | 2 +- taskweaver/memory/attachment.py | 2 +- taskweaver/memory/experience.py | 21 ++-- taskweaver/planner/planner.py | 61 ++++++------ 6 files changed, 77 insertions(+), 163 deletions(-) delete mode 100644 scripts/experience_mgt.py diff --git a/scripts/experience_mgt.py b/scripts/experience_mgt.py deleted file mode 100644 index a1f897ab..00000000 --- a/scripts/experience_mgt.py +++ /dev/null @@ -1,96 +0,0 @@ -import argparse -import os -import sys - -sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) - -from injector import Injector - -from taskweaver.config.config_mgt import AppConfigSource -from taskweaver.logging import LoggingModule -from taskweaver.memory.experience import ExperienceGenerator - -parser = argparse.ArgumentParser() -parser.add_argument( - "--project_dir", - type=str, - default=os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "..", - "project", - ), -) -parser.add_argument("--refresh", action="store_true") -parser.add_argument( - "--delete", - metavar="EXP_ID", - type=str, - help="Delete experience with experience id, e.g., exp_{ID}.yaml", -) -parser.add_argument("--delete_raw", metavar="EXP_ID", type=str, help="Delete raw experience with experience id") -parser.add_argument( - "--delete_handcraft", - metavar="EXP_ID", - type=str, - help="Delete handcraft experience with experience id", -) -parser.add_argument("--show", action="store_true") - -args = parser.parse_args() - - -class ExperienceManager: - def __init__(self): - app_injector = Injector([LoggingModule]) - app_config = AppConfigSource( - config_file_path=os.path.join( - args.project_dir, - "taskweaver_config.json", - ), - app_base_path=args.project_dir, - ) - app_injector.binder.bind(AppConfigSource, to=app_config) - self.experience_generator = app_injector.create_object(ExperienceGenerator) - - def refresh(self): - self.experience_generator.refresh() - print("Refreshed experience list") - - def delete_experience(self, exp_id: str): - self.experience_generator.delete_experience(exp_id=exp_id) - print(f"Deleted experience with id: {exp_id}") - - def delete_raw_experience(self, exp_id: str): - self.experience_generator.delete_raw_experience(exp_id=exp_id) - print(f"Deleted raw experience with id: {exp_id}") - - def delete_handcraft_experience(self, exp_id: str): - self.experience_generator.delete_handcrafted_experience(exp_id=exp_id) - print(f"Deleted handcraft experience with id: {exp_id}") - - def show(self): - self.experience_generator.load_experience() - if len(self.experience_generator.experience_list) == 0: - print("No experience found") - return - for exp in self.experience_generator.experience_list: - print(f"* Experience ID: {exp.exp_id}") - print(f"* Experience Text: {exp.experience_text}") - print(f"* Experience Embedding Dim: {len(exp.embedding)}") - print(f"* Experience Embedding Model: {exp.embedding_model}") - print(f"* Experience Raw Path: {exp.raw_experience_path}") - print("_________________________") - - -if __name__ == "__main__": - experience_manager = ExperienceManager() - if args.refresh: - experience_manager.refresh() - if args.delete: - experience_manager.delete_experience(args.delete) - if args.delete_raw: - experience_manager.delete_raw_experience(args.delete_raw) - if args.delete_handcraft: - experience_manager.delete_handcraft_experience(args.delete_handcraft) - if args.show: - experience_manager.show() diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator.py b/taskweaver/code_interpreter/code_interpreter/code_generator.py index 7011c4f3..2963b0fc 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator.py +++ b/taskweaver/code_interpreter/code_interpreter/code_generator.py @@ -56,7 +56,14 @@ def _configure(self) -> None: self.auto_plugin_selection_topk = self._get_int("auto_plugin_selection_topk", 3) self.use_experience = self._get_bool("use_experience", False) - self.dynamic_experience_filter = self._get_bool("dynamic_experience_filter", False) + self.experience_dir = self._get_path( + "experience_dir", + os.path.join( + self.src.app_base_path, + "experience", + ), + ) + self.dynamic_experience_sub_path = self._get_bool("dynamic_experience_sub_path", False) self.llm_alias = self._get_str("llm_alias", default="", required=False) @@ -106,29 +113,26 @@ def __init__( self.selected_plugin_pool = SelectedPluginPool() self.experience_generator = experience_generator - self.exp_loaded = False - if self.config.dynamic_experience_filter: - self.exp_filter_str = None - else: - # use the experience folder - self.exp_filter_str = "" + self.experience_loaded_from = None self.logger.info("CodeGenerator initialized successfully") - def load_experience(self): - if self.exp_filter_str is None or self.exp_loaded: - return - self.experience_generator.set_sub_dir(self.exp_filter_str) - self.experience_generator.refresh() - self.experience_generator.load_experience() - self.logger.info( - "Experience loaded successfully, " - "there are {} experiences with filter [{}]".format( - len(self.experience_generator.experience_list), - self.exp_filter_str, + def load_experience(self, sub_path: str = ""): + load_from = os.path.join(self.config.experience_dir, sub_path) + if self.experience_loaded_from is None or self.experience_loaded_from != load_from: + self.experience_loaded_from = load_from + self.experience_generator.set_experience_dir(self.config.experience_dir) + self.experience_generator.set_sub_path(sub_path) + self.experience_generator.refresh() + self.experience_generator.load_experience() + self.logger.info( + "Experience loaded successfully, there are {} experiences with filter [{}]".format( + len(self.experience_generator.experience_list), + sub_path, + ), ) - ) - self.exp_loaded = True + else: + self.logger.info(f"Experience already loaded from {load_from}.") def configure_verification( self, @@ -378,11 +382,6 @@ def reply( # obtain the query from the last round query = rounds[-1].post_list[-1].message - exp_filter = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_filter) - if exp_filter: - self.exp_filter_str = exp_filter[0].content - self.tracing.set_span_attribute("exp_filter", self.exp_filter_str) - self.tracing.set_span_attribute("query", query) self.tracing.set_span_attribute("enable_auto_plugin_selection", self.config.enable_auto_plugin_selection) self.tracing.set_span_attribute("use_experience", self.config.use_experience) @@ -391,7 +390,14 @@ def reply( self.plugin_pool = self.select_plugins_for_prompt(query) if self.config.use_experience: - self.load_experience() + if not self.config.dynamic_experience_sub_path: + self.load_experience() + else: + exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_sub_path) + if exp_sub_path: + self.load_experience(exp_sub_path[0]) + self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) + selected_experiences = self.experience_generator.retrieve_experience(query) else: selected_experiences = None diff --git a/taskweaver/ext_role/echo/echo.py b/taskweaver/ext_role/echo/echo.py index d82d02e1..4684b4ff 100644 --- a/taskweaver/ext_role/echo/echo.py +++ b/taskweaver/ext_role/echo/echo.py @@ -44,7 +44,7 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: post_proxy.update_attachment( type=AttachmentType.signal, - message="exp_filter:sub_exp", + message="exp_sub_path:sub_exp", ) return post_proxy.end() diff --git a/taskweaver/memory/attachment.py b/taskweaver/memory/attachment.py index 4c298930..67b1c82a 100644 --- a/taskweaver/memory/attachment.py +++ b/taskweaver/memory/attachment.py @@ -47,7 +47,7 @@ class AttachmentType(Enum): # signal signal = "signal" - exp_filter = "exp_filter" + exp_sub_path = "exp_sub_path" @dataclass diff --git a/taskweaver/memory/experience.py b/taskweaver/memory/experience.py index 70044175..d0fcb356 100644 --- a/taskweaver/memory/experience.py +++ b/taskweaver/memory/experience.py @@ -1,8 +1,7 @@ import json import os -from collections import defaultdict from dataclasses import dataclass, field -from typing import Any, Dict, List, Optional, Tuple, Set +from typing import Any, Dict, List, Optional, Tuple from injector import inject @@ -45,10 +44,6 @@ class ExperienceConfig(ModuleConfig): def _configure(self) -> None: self._set_name("experience") - self.experience_dir = self._get_path( - "experience_dir", - os.path.join(self.src.app_base_path, "experience"), - ) self.default_exp_prompt_path = self._get_path( "default_exp_prompt_path", os.path.join( @@ -84,10 +79,14 @@ def __init__( "run `python -m experience_mgt --refresh` to refresh the experience." ) - self.sub_dir = None + self.experience_dir = None + self.sub_path = None + + def set_experience_dir(self, experience_dir: str): + self.experience_dir = experience_dir - def set_sub_dir(self, sub_dir: str): - self.sub_dir = sub_dir + def set_sub_path(self, sub_path: str): + self.sub_path = sub_path @staticmethod def _preprocess_conversation_data( @@ -316,8 +315,8 @@ def _delete_exp_file(self, exp_file_name: str): self.logger.info(f"Experience {exp_file_name} not found.") def get_experience_dir(self): - return os.path.join(self.config.experience_dir, self.sub_dir) \ - if self.sub_dir else self.config.experience_dir + assert self.experience_dir is not None, "Experience directory is not set. Call set_experience_dir() first." + return os.path.join(self.experience_dir, self.sub_path) if self.sub_path else self.experience_dir def delete_experience(self, exp_id: str): exp_file_name = f"exp_{exp_id}.yaml" diff --git a/taskweaver/planner/planner.py b/taskweaver/planner/planner.py index fab5f167..93746f00 100644 --- a/taskweaver/planner/planner.py +++ b/taskweaver/planner/planner.py @@ -49,8 +49,16 @@ def _configure(self) -> None: ), ) + # experience related self.use_experience = self._get_bool("use_experience", False) - self.dynamic_experience_filter = self._get_bool("dynamic_experience_filter", False) + self.experience_dir = self._get_path( + "experience_dir", + os.path.join( + app_dir, + "experience", + ), + ) + self.dynamic_experience_sub_path = self._get_bool("dynamic_experience_sub_path", False) self.llm_alias = self._get_str("llm_alias", default="", required=False) @@ -102,30 +110,26 @@ def __init__( self.compression_prompt_template = read_yaml(self.config.compression_prompt_path)["content"] self.experience_generator = experience_generator - self.exp_loaded = False - if self.config.dynamic_experience_filter: - self.exp_filter_str = None - else: - # use the experience folder - self.exp_filter_str = "" + self.experience_loaded_from = None self.logger.info("Planner initialized successfully") - def load_experience(self): - if self.exp_filter_str is None or self.exp_loaded: - return - self.experience_generator.set_sub_dir(self.exp_filter_str) - self.experience_generator.refresh() - self.experience_generator.load_experience() - self.logger.info( - "Experience loaded successfully, " - "there are {} experiences with filter [{}]".format( - len(self.experience_generator.experience_list), - self.exp_filter_str, + def load_experience(self, sub_path: str = ""): + load_from = os.path.join(self.config.experience_dir, sub_path) + if self.experience_loaded_from is None or self.experience_loaded_from != load_from: + self.experience_loaded_from = load_from + self.experience_generator.set_experience_dir(self.config.experience_dir) + self.experience_generator.set_sub_path(sub_path) + self.experience_generator.refresh() + self.experience_generator.load_experience() + self.logger.info( + "Experience loaded successfully, there are {} experiences with filter [{}]".format( + len(self.experience_generator.experience_list), + sub_path, + ), ) - ) - - self.exp_loaded = True + else: + self.logger.info(f"Experience already loaded from {load_from}.") def compose_sys_prompt(self, context: str): worker_description = "" @@ -290,17 +294,18 @@ def reply( user_query = rounds[-1].user_query - exp_filter = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_filter) - if exp_filter: - self.exp_filter_str = exp_filter[0] - self.tracing.set_span_attribute("exp_filter", self.exp_filter_str) - self.tracing.set_span_attribute("user_query", user_query) self.tracing.set_span_attribute("use_experience", self.config.use_experience) - self.tracing.set_span_attribute("exp_filter", self.exp_filter_str) if self.config.use_experience: - self.load_experience() + if not self.config.dynamic_experience_sub_path: + self.load_experience() + else: + exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_sub_path) + if exp_sub_path: + self.load_experience(exp_sub_path[0]) + self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) + selected_experiences = self.experience_generator.retrieve_experience(user_query) else: selected_experiences = None From 089ef418f8f9dc549b85497392d44084c758c68c Mon Sep 17 00:00:00 2001 From: liqun Date: Mon, 9 Sep 2024 17:44:11 +0800 Subject: [PATCH 03/12] add doc --- project/exp1/exp_1.yaml | 773 +++++++++++++++++ project/exp1/exp_2.yaml | 773 +++++++++++++++++ .../exp1/exp_20240909-060027-bee84199.yaml | 780 ++++++++++++++++++ project/exp1/handcrafted_exp_1.yaml | 2 + project/exp1/handcrafted_exp_2.yaml | 2 + .../raw_exp_20240909-060027-bee84199.yaml | 122 +++ project/exp2/sub_exp/exp_3.yaml | 773 +++++++++++++++++ project/exp2/sub_exp/handcrafted_exp_3.yaml | 2 + .../code_interpreter/code_generator.py | 59 +- .../code_generator_prompt.yaml | 4 +- taskweaver/memory/attachment.py | 2 +- taskweaver/planner/planner.py | 55 +- taskweaver/role/role.py | 71 +- .../data/prompts/planner_prompt.yaml | 5 +- website/blog/experience.md | 123 +++ .../{ => experience}/experience.md | 32 +- .../experience/handcrafted_experience.md | 39 + website/sidebars.js | 5 +- 18 files changed, 3513 insertions(+), 109 deletions(-) create mode 100644 project/exp1/exp_1.yaml create mode 100644 project/exp1/exp_2.yaml create mode 100644 project/exp1/exp_20240909-060027-bee84199.yaml create mode 100644 project/exp1/handcrafted_exp_1.yaml create mode 100644 project/exp1/handcrafted_exp_2.yaml create mode 100644 project/exp1/raw_exp_20240909-060027-bee84199.yaml create mode 100644 project/exp2/sub_exp/exp_3.yaml create mode 100644 project/exp2/sub_exp/handcrafted_exp_3.yaml create mode 100644 website/blog/experience.md rename website/docs/customization/{ => experience}/experience.md (92%) create mode 100644 website/docs/customization/experience/handcrafted_experience.md diff --git a/project/exp1/exp_1.yaml b/project/exp1/exp_1.yaml new file mode 100644 index 00000000..ae4d6bd6 --- /dev/null +++ b/project/exp1/exp_1.yaml @@ -0,0 +1,773 @@ +exp_id: 1 +experience_text: say "peach" if you hear "apple" +raw_experience_path: null +embedding_model: all-mpnet-base-v2 +embedding: +- 0.002076677745208144 +- 0.03603915870189667 +- -0.00438379542902112 +- -0.006364651024341583 +- -0.03103785216808319 +- 0.006088016554713249 +- -0.0425165593624115 +- -0.007801680359989405 +- 0.09853632003068924 +- 0.023470615968108177 +- -5.9094189055031165e-05 +- 0.0005395212210714817 +- 0.017150644212961197 +- -0.029298895969986916 +- -0.001350462669506669 +- -0.0061452011577785015 +- 0.025449100881814957 +- -0.0018475071992725134 +- 0.036011140793561935 +- -0.06823521852493286 +- -0.020742280408740044 +- 0.0357234850525856 +- 0.00017347944958601147 +- 0.046203527599573135 +- -0.04696705937385559 +- 0.017058782279491425 +- -0.005500210914760828 +- -0.01062320638448 +- -0.010328603908419609 +- -0.007481658365577459 +- -0.042505696415901184 +- 0.011486653238534927 +- -0.07994496077299118 +- -0.03583734109997749 +- 1.347435272691655e-06 +- -0.008092010393738747 +- 0.056404680013656616 +- -0.0033975313417613506 +- -0.047097429633140564 +- 0.008133894763886929 +- -0.03904419392347336 +- 0.03220275044441223 +- 0.003711898345500231 +- 0.00043004725011996925 +- 0.008502623997628689 +- 0.04752719774842262 +- 0.05434797331690788 +- -0.008307415060698986 +- -0.022433506324887276 +- -0.01214484591037035 +- 0.0021314139012247324 +- -0.0566505566239357 +- -0.030621344223618507 +- -0.015628762543201447 +- 0.028187928721308708 +- -0.009570904076099396 +- 0.03340108320116997 +- -0.06464093923568726 +- 0.013063393533229828 +- 0.007416849955916405 +- -0.0013422371121123433 +- -0.0481734424829483 +- -0.0009201560169458389 +- 0.037509143352508545 +- -0.0695284903049469 +- 0.05793822929263115 +- 0.034442462027072906 +- -0.0017623575404286385 +- -0.030781906098127365 +- 0.0314258337020874 +- -0.0017764178337529302 +- -0.005944704636931419 +- -0.008905707858502865 +- 0.025610677897930145 +- -0.011823438107967377 +- 0.00563499890267849 +- 0.013761444017291069 +- -0.05740906298160553 +- 0.000861245091073215 +- -0.024140018969774246 +- 0.002327855909243226 +- 0.004410585388541222 +- -0.002547980984672904 +- 0.04610956832766533 +- 0.004986982326954603 +- 0.10052293539047241 +- 0.03814912214875221 +- -0.019217846915125847 +- 0.047517720609903336 +- -0.048128921538591385 +- 0.015024186111986637 +- -0.004630940966308117 +- 0.053204506635665894 +- 0.002992269117385149 +- -0.001619020476937294 +- -0.020715676248073578 +- -0.03116990625858307 +- 0.07352283596992493 +- -0.014303816482424736 +- -0.09593293070793152 +- -0.09685911238193512 +- -0.022254446521401405 +- -0.021341226994991302 +- 0.04037946090102196 +- -0.037482768297195435 +- -0.03211713582277298 +- -0.010238692164421082 +- -0.00018940112204290926 +- -0.018315626308321953 +- -0.0032111527398228645 +- -0.04594588652253151 +- 0.0028249863535165787 +- -0.01794695481657982 +- 0.007159973494708538 +- 0.0013245906447991729 +- -0.02030939795076847 +- -0.02632329612970352 +- -0.020243996754288673 +- -0.027683965861797333 +- -0.06582917273044586 +- -0.04921343922615051 +- 0.024676352739334106 +- -0.00872780755162239 +- -0.024157095700502396 +- -0.0016795555129647255 +- -0.03356792405247688 +- -0.05118071660399437 +- 0.04726361110806465 +- -0.02097543515264988 +- -0.05408035218715668 +- -0.024142742156982422 +- -0.008733950555324554 +- -0.0005831241724081337 +- 0.03477107360959053 +- 0.035863522440195084 +- -0.01458810642361641 +- -0.007914717309176922 +- 0.009369838051497936 +- -0.0013688582694157958 +- 0.003468629904091358 +- -0.0704500824213028 +- 0.02644258178770542 +- -0.012175425887107849 +- -0.03775809705257416 +- -0.07665875554084778 +- 0.004715278744697571 +- 0.05289830267429352 +- -0.0687127411365509 +- 0.012859043665230274 +- 0.01791408099234104 +- -0.03663010895252228 +- 0.040060609579086304 +- 0.03263015300035477 +- 0.03364340588450432 +- 0.004044105298817158 +- -0.02602696791291237 +- 0.07014371454715729 +- 0.06168773025274277 +- -0.0013638748787343502 +- 0.03404739871621132 +- 0.003815646981820464 +- -0.005994131322950125 +- 0.043578170239925385 +- 0.002631360199302435 +- -0.019474495202302933 +- 0.021050570532679558 +- -0.03289240971207619 +- -0.04185330495238304 +- -0.05373257026076317 +- -0.01687896065413952 +- 0.03457324206829071 +- 0.03978060558438301 +- 0.002181214978918433 +- -0.0914001315832138 +- 0.03118555247783661 +- 0.08668036013841629 +- 0.0018093687249347568 +- -0.0029208504129201174 +- -0.0016485510859638453 +- -0.04095043987035751 +- -0.03883252292871475 +- -0.0050103673711419106 +- 0.02692575566470623 +- -0.00402176333591342 +- -0.09104945510625839 +- -0.011796768754720688 +- 0.0018781599355861545 +- 0.06296037882566452 +- -0.03463843837380409 +- 0.01777021586894989 +- -0.02909718081355095 +- -0.000527676718775183 +- -0.0072013214230537415 +- 0.018438348546624184 +- -0.020547572523355484 +- -0.0026535966899245977 +- 0.01860532909631729 +- 0.039946746081113815 +- 0.0126409363001585 +- -0.02174372784793377 +- -0.06482450664043427 +- -0.04519755765795708 +- 0.049855589866638184 +- -0.004091357812285423 +- -0.006785662844777107 +- -0.05018608272075653 +- 0.0807730108499527 +- 0.028833355754613876 +- 0.010815749876201153 +- -0.008261998184025288 +- -0.03277555853128433 +- -0.047926705330610275 +- 0.04970525577664375 +- 0.025168579071760178 +- 0.0007037348113954067 +- 0.06970125436782837 +- 0.004370851907879114 +- 0.032200731337070465 +- 0.030835097655653954 +- 0.058661431074142456 +- 0.02717328630387783 +- -0.012376091443002224 +- 0.024631820619106293 +- -0.006828790996223688 +- -0.023268604651093483 +- -0.032871946692466736 +- 0.03756893426179886 +- -0.033317930996418 +- -0.04522555693984032 +- 0.023212600499391556 +- 0.016763262450695038 +- 0.027942413464188576 +- -0.00949570070952177 +- 0.043241679668426514 +- 0.05621872842311859 +- 0.03779369965195656 +- 0.011897232383489609 +- 0.014896179549396038 +- -0.018681490793824196 +- -0.01839243806898594 +- 0.0014975026715546846 +- 0.06089029088616371 +- 0.014674119651317596 +- -0.007072165608406067 +- 0.0005660092574544251 +- -0.021704886108636856 +- 0.09804512560367584 +- -0.028681350871920586 +- 0.026131214573979378 +- -0.05372387915849686 +- -0.005636673420667648 +- 0.0033364719711244106 +- -0.04439677298069 +- -0.03332102298736572 +- 0.002857217099517584 +- -0.0695226788520813 +- 0.005851385183632374 +- -0.028129683807492256 +- -0.06458700448274612 +- -0.05328310653567314 +- 0.06805721670389175 +- -0.02303682640194893 +- 0.02927636355161667 +- -0.03685043379664421 +- 0.014780215919017792 +- -0.039876922965049744 +- -0.04678170382976532 +- -0.10566980391740799 +- -0.03823954984545708 +- 0.037394486367702484 +- -0.015171647071838379 +- -0.024194631725549698 +- -0.002981469500809908 +- -0.0025484063662588596 +- -0.010369437746703625 +- 0.010459685698151588 +- -0.012130135670304298 +- -0.04029158130288124 +- 0.06367271393537521 +- -0.062239766120910645 +- -0.06549864262342453 +- -0.04904807358980179 +- 0.0012324590934440494 +- -0.01734771765768528 +- 0.004981398582458496 +- 0.019108407199382782 +- 0.005648917518556118 +- -0.04709982872009277 +- 0.003991040401160717 +- -0.08564452081918716 +- -0.023371165618300438 +- 0.01684756390750408 +- 0.014827366918325424 +- 0.07519230991601944 +- 0.005368346348404884 +- 0.02326340414583683 +- 0.037553709000349045 +- 0.037121668457984924 +- -0.0035797394812107086 +- 0.0014295236906036735 +- -0.009887749329209328 +- -0.014791231602430344 +- 0.008341723121702671 +- -0.023585587739944458 +- -0.010909190401434898 +- 0.032456379383802414 +- -0.013742965646088123 +- -0.04287289083003998 +- -0.02176453173160553 +- 0.04054110869765282 +- 0.031863436102867126 +- 0.01249129232019186 +- 0.013631017878651619 +- 0.03573000803589821 +- -0.038331855088472366 +- -0.07673068344593048 +- 0.008214067667722702 +- -0.06557852029800415 +- 0.008703329600393772 +- 0.014376544393599033 +- -0.004012516234070063 +- -0.03467757999897003 +- 0.0364082008600235 +- -0.05605095624923706 +- 0.003813741263002157 +- -0.025966621935367584 +- -0.013676607050001621 +- 0.04143631458282471 +- 0.031575560569763184 +- -0.0646434873342514 +- 0.0017937890952453017 +- 0.058420948684215546 +- -0.028528044000267982 +- 0.02018536441028118 +- 0.03148900344967842 +- -0.07690513134002686 +- -0.029643412679433823 +- 0.07786562293767929 +- -0.01596500352025032 +- 0.025838198140263557 +- 0.03145137056708336 +- -0.006283584516495466 +- -0.04023025184869766 +- -0.04701944440603256 +- -0.07168013602495193 +- 0.033260226249694824 +- 0.02889508381485939 +- -0.016154443845152855 +- 0.042212530970573425 +- 0.06163421645760536 +- -0.04267815127968788 +- -0.02102702297270298 +- 0.010803395882248878 +- -0.012728383764624596 +- 0.0025914269499480724 +- -0.005297738127410412 +- -0.004795115906745195 +- 0.07159675657749176 +- -0.018772628158330917 +- 0.04775341600179672 +- -0.006243865005671978 +- -0.05831030756235123 +- 0.06404168158769608 +- 0.008118683472275734 +- 0.01265101507306099 +- 0.014954347163438797 +- 0.02838132157921791 +- -0.027388298884034157 +- 0.052084892988204956 +- 0.01176188513636589 +- -0.008273257873952389 +- 0.05026450753211975 +- -0.04247705638408661 +- 0.008241587318480015 +- 0.007868432439863682 +- -0.08382180333137512 +- 0.02508809231221676 +- 0.017005018889904022 +- 0.01154959388077259 +- -0.0042104776948690414 +- 0.021971499547362328 +- -0.004030514042824507 +- -0.05146895721554756 +- -0.009352650493383408 +- -0.0513167679309845 +- -0.0037430506199598312 +- 0.03956839069724083 +- -0.01713515631854534 +- -0.08742104470729828 +- -0.04096211493015289 +- 0.028735244646668434 +- -0.0021137436851859093 +- -0.06367598474025726 +- 0.029276860877871513 +- 0.007907219231128693 +- 0.00640992121770978 +- 0.01538486871868372 +- 0.02454337105154991 +- -0.02500874735414982 +- -0.0029450715519487858 +- 0.019643273204565048 +- 0.05889872461557388 +- -0.04381910711526871 +- 0.03596780076622963 +- 0.06818603724241257 +- 0.012050165794789791 +- 0.06007668748497963 +- -0.03739720210433006 +- -0.04501721262931824 +- 0.0011157882399857044 +- -0.008083175867795944 +- 0.006017289124429226 +- 0.008121469058096409 +- -0.024602709338068962 +- -0.01302304957062006 +- 0.03609442710876465 +- 0.0010172611800953746 +- -0.01212900597602129 +- -0.022230537608265877 +- 0.04761526733636856 +- -0.013647089712321758 +- 0.08188152313232422 +- 0.002165150595828891 +- 0.013312667608261108 +- 0.00031405678601004183 +- 0.012408865615725517 +- 0.0319778248667717 +- 0.01620842143893242 +- 0.0031853518448770046 +- 0.02964790351688862 +- -0.01832352951169014 +- 0.02087281458079815 +- 0.005490979645401239 +- -0.013054708018898964 +- -0.030826788395643234 +- -0.031177520751953125 +- 0.026310278102755547 +- 0.04316142946481705 +- -0.08321823924779892 +- -0.05837981402873993 +- -0.013886687345802784 +- -0.003000007476657629 +- 0.02049127034842968 +- 0.04259631410241127 +- -0.022787071764469147 +- 0.033182643353939056 +- 0.014836517162621021 +- 0.024208124727010727 +- -0.03500240296125412 +- 0.05583534017205238 +- 0.05724038556218147 +- -0.053016405552625656 +- -0.029100680723786354 +- 0.03905566409230232 +- -0.0019505724776536226 +- -0.0018223834922537208 +- 0.03215079382061958 +- -0.008438159711658955 +- -0.01993289589881897 +- 0.034782055765390396 +- -0.00551842013373971 +- 0.028034934774041176 +- 0.03648987412452698 +- -0.031495969742536545 +- -0.03625999391078949 +- 0.050006747245788574 +- 0.10163374990224838 +- 0.05784887820482254 +- 0.02914799563586712 +- -0.005682471673935652 +- -0.006481640040874481 +- -0.003536946140229702 +- 0.006187054328620434 +- 0.003116358071565628 +- 0.014476004987955093 +- 0.0076301489025354385 +- -0.011084741912782192 +- -0.09346790611743927 +- -0.0862889438867569 +- 0.03016080893576145 +- 0.003039182163774967 +- -0.0039209662936627865 +- 0.011930620297789574 +- 0.026278382167220116 +- 0.004760068841278553 +- -0.010594258084893227 +- 0.05689861997961998 +- -0.0007324875914491713 +- 0.02788800746202469 +- -0.008394870907068253 +- 0.003696719417348504 +- -0.01581752672791481 +- 0.0231858529150486 +- -0.04351469501852989 +- -0.010194777511060238 +- -0.024645352736115456 +- -0.018337849527597427 +- -0.0690787136554718 +- 0.014263218268752098 +- 0.05291473865509033 +- -0.007287757471203804 +- -0.0035238706041127443 +- -0.03219309076666832 +- -0.03305663913488388 +- -0.0125225018709898 +- 0.015062364749610424 +- 0.013767071068286896 +- 0.04554641991853714 +- 0.0073592280969023705 +- -0.020955096930265427 +- -0.01320643536746502 +- 0.0546344593167305 +- -0.0008281502523459494 +- -0.040356431156396866 +- -0.04589741677045822 +- 0.07846048474311829 +- -0.018984323367476463 +- -0.0759328305721283 +- -0.0014797657495364547 +- -0.01091212872415781 +- 0.004964845255017281 +- -0.010090334340929985 +- 0.00819682702422142 +- -0.03131427988409996 +- -0.030788661912083626 +- 0.07827675342559814 +- -0.0006403547013178468 +- 0.00011955734953517094 +- -0.03146335482597351 +- 0.0139079000800848 +- -0.03513038530945778 +- -0.008790791966021061 +- -0.03694099560379982 +- -0.008018656633794308 +- 0.018809182569384575 +- -0.015283645130693913 +- -0.01777135580778122 +- 0.003806393127888441 +- -0.044869404286146164 +- 0.04717610776424408 +- -0.0447596050798893 +- -0.024633485823869705 +- 0.03003646247088909 +- -0.0009385698940604925 +- 0.11098053306341171 +- -0.009789965115487576 +- 0.030640657991170883 +- 0.02632221207022667 +- 0.034881845116615295 +- 0.01734756864607334 +- 0.022650709375739098 +- -0.014218107797205448 +- -0.09831289201974869 +- -0.03357334062457085 +- -0.03335385024547577 +- -4.9941924419341086e-33 +- -0.018254568800330162 +- -0.01017495896667242 +- 0.0014997586840763688 +- 0.02117929421365261 +- 0.001093653030693531 +- 0.0520971454679966 +- -0.0274690892547369 +- 0.01883840560913086 +- -0.007513700984418392 +- -0.005217412952333689 +- 0.016758721321821213 +- -0.02570030465722084 +- 0.01816483400762081 +- -0.0250912606716156 +- 0.037176258862018585 +- 0.00502456771209836 +- 0.0014612789964303374 +- 0.06800714135169983 +- -0.0029353995341807604 +- 0.012491936795413494 +- 0.017134245485067368 +- -0.02395143173635006 +- 0.016619808971881866 +- 0.0882359966635704 +- 0.0056934477761387825 +- 0.021360019221901894 +- -0.038114070892333984 +- -0.015525737777352333 +- -0.008841847069561481 +- 0.0010531722800806165 +- -0.025727344676852226 +- 0.02471284009516239 +- 0.01694098487496376 +- 0.04902321845293045 +- 0.009044262580573559 +- 0.025249771773815155 +- 0.0718131810426712 +- -0.01520281657576561 +- -0.02790706418454647 +- -0.029794353991746902 +- -0.032558318227529526 +- 0.04894554242491722 +- 0.042309969663619995 +- 0.02879968471825123 +- -0.010560710914433002 +- 0.03929167613387108 +- 0.06337568163871765 +- -0.0011555020464584231 +- -0.03629377484321594 +- 0.04187283292412758 +- -0.04013555496931076 +- -0.0007976212655194104 +- 0.019660573452711105 +- -0.05348984897136688 +- 0.02391401119530201 +- 0.0957329273223877 +- -0.01736452430486679 +- 0.04128472879528999 +- 0.037504833191633224 +- 0.06426160037517548 +- 0.035195790231227875 +- -0.009661535732448101 +- 0.0170342605561018 +- 0.084307461977005 +- -0.0056257243268191814 +- 0.013174369931221008 +- 0.09377964586019516 +- -0.0875358060002327 +- -0.01620960235595703 +- 0.022455135360360146 +- 0.008165093138813972 +- 0.016633454710245132 +- 0.06943229585886002 +- -0.004645914770662785 +- 0.01881401240825653 +- -0.0504886619746685 +- 0.011036847718060017 +- 0.01905742660164833 +- -0.007070848252624273 +- -0.03512505069375038 +- -0.03572680428624153 +- 0.029036086052656174 +- -0.031596675515174866 +- -0.0234194565564394 +- -0.005703635048121214 +- 0.022586535662412643 +- -0.004910896997898817 +- 0.019988449290394783 +- 0.006426703184843063 +- -0.02491970919072628 +- -0.01402664091438055 +- 0.08610770851373672 +- 0.003936620429158211 +- 0.03209668770432472 +- -0.05400601774454117 +- -0.04310345649719238 +- 0.01958833821117878 +- -0.02128911018371582 +- -0.03494998812675476 +- -0.007754477672278881 +- -0.04791589081287384 +- 0.014497642405331135 +- 0.00854917149990797 +- 0.03573589771986008 +- 0.021876895800232887 +- 0.003631952917203307 +- -0.02195160463452339 +- 0.001553969457745552 +- -0.05464157462120056 +- 0.008729442022740841 +- -0.036202408373355865 +- -0.040282417088747025 +- 0.022788001224398613 +- -0.04418254643678665 +- 0.02053702622652054 +- 0.03480884060263634 +- -0.010269279591739178 +- 0.04696961119771004 +- 0.012995004653930664 +- -0.07897445559501648 +- -0.05740431696176529 +- -0.05682487413287163 +- 0.01492974441498518 +- 0.05019513517618179 +- -0.019237514585256577 +- 0.0055320546962320805 +- 0.01198672316968441 +- -0.06887609511613846 +- -0.09016828238964081 +- -0.019979100674390793 +- -0.0004406376974657178 +- 0.06647977977991104 +- 2.1121290671999304e-07 +- -0.027091048657894135 +- -0.04953813552856445 +- 0.030832741409540176 +- 0.05622001737356186 +- -0.007221754174679518 +- 0.0278745349496603 +- 0.01044386625289917 +- -0.0018569700187072158 +- 0.005692501086741686 +- 0.0005474583012983203 +- -0.027324436232447624 +- -0.03328273072838783 +- 0.01871141977608204 +- 0.009414284490048885 +- -0.02895166166126728 +- 0.07302535325288773 +- -0.06450684368610382 +- 0.04119069501757622 +- -0.030550461262464523 +- -0.04789623245596886 +- -0.01566251739859581 +- -0.014292830601334572 +- 0.008455101400613785 +- -0.017121752724051476 +- 0.008203166536986828 +- -0.042506858706474304 +- -0.01298887375742197 +- 0.005528432782739401 +- 0.06563985347747803 +- -0.004232094157487154 +- -0.03617222234606743 +- -0.033045921474695206 +- 0.006677519530057907 +- 0.03733176365494728 +- -0.035495299845933914 +- -0.017911100760102272 +- 0.020448874682188034 +- -0.04964633285999298 +- -0.060697782784700394 +- 0.050749849528074265 +- -0.017255015671253204 +- 0.066440150141716 +- -0.03588384389877319 +- -0.03561566397547722 +- 0.0021299421787261963 +- 0.0004946758854202926 +- 0.013357064686715603 +- 0.018466709181666374 +- 0.0675460696220398 +- -0.02202661707997322 +- 0.0327652283012867 +- 0.002804954769089818 +- -0.03475608676671982 +- -0.018413031473755836 +- -0.018951160833239555 +- 0.0036126142367720604 +- 0.03940947726368904 +- -0.004678904078900814 +- 0.037915490567684174 +- -0.0006026980117894709 +- -0.02389153093099594 +- -0.02986828051507473 +- 0.06569203734397888 +- 0.05028827488422394 +- -0.01563316211104393 +- 0.03349592164158821 +- 0.0026056848000735044 +- 6.380121288923332e-35 +- -0.005537340883165598 +- 0.001875287969596684 +- 0.02620490826666355 +- 0.04339710995554924 +- 0.0029878471978008747 +- 0.01628286764025688 +- 0.0831407830119133 +- 0.033180221915245056 +- 0.013483740389347076 +- 0.022158915176987648 +- -0.04180760681629181 diff --git a/project/exp1/exp_2.yaml b/project/exp1/exp_2.yaml new file mode 100644 index 00000000..add8e4f1 --- /dev/null +++ b/project/exp1/exp_2.yaml @@ -0,0 +1,773 @@ +exp_id: 2 +experience_text: Say "world" if you hear "hello" +raw_experience_path: null +embedding_model: all-mpnet-base-v2 +embedding: +- 0.03770161047577858 +- 0.015260828658938408 +- 0.011654765345156193 +- -0.043227072805166245 +- 0.008040567860007286 +- 0.0012962525943294168 +- -0.029643122106790543 +- 0.002577129751443863 +- 0.041701365262269974 +- 0.019863322377204895 +- -0.06414484977722168 +- -0.07328800857067108 +- 0.016461851075291634 +- 0.014285909943282604 +- 0.06828439235687256 +- -0.0391310416162014 +- 0.0334206186234951 +- -0.05230560153722763 +- -0.04891263321042061 +- -0.028536424040794373 +- -0.0013956865295767784 +- 0.00774912117049098 +- 0.0024153124541044235 +- 0.050088975578546524 +- 0.027662837877869606 +- 0.008375070989131927 +- 0.010521573945879936 +- -0.03286492079496384 +- 0.0088978111743927 +- 0.00866076722741127 +- -0.025507131591439247 +- 0.011845295317471027 +- 0.0333932489156723 +- -0.004294443875551224 +- 1.6005080851755338e-06 +- -0.03541667014360428 +- 0.05130691081285477 +- -0.058463048189878464 +- 9.117766603594646e-05 +- -0.06587754189968109 +- -0.034934815019369125 +- 0.06678854674100876 +- 0.01877608895301819 +- 0.009511202573776245 +- -0.02215624786913395 +- -0.02755170501768589 +- 0.01608552411198616 +- -0.026578187942504883 +- -0.014043113216757774 +- -0.007409931626170874 +- 0.008557961322367191 +- 0.006937611382454634 +- -0.0327741838991642 +- -0.029916750267148018 +- 0.04237094148993492 +- 0.01216681394726038 +- 0.026179537177085876 +- 0.014258801937103271 +- -0.0243583545088768 +- -0.0378614217042923 +- -0.031179649755358696 +- 0.001333642634563148 +- 0.003080826485529542 +- 0.020475978031754494 +- -0.0003005199832841754 +- 0.04041438549757004 +- -0.004375794902443886 +- 0.027485668659210205 +- -0.005255893338471651 +- 0.07257787883281708 +- -0.011383410543203354 +- -0.03908785432577133 +- 0.014056934043765068 +- 0.064444400370121 +- 0.007434479426592588 +- -0.06368442624807358 +- -0.007358503062278032 +- 0.0028030758257955313 +- 0.04040984809398651 +- 0.02259001135826111 +- -0.027185164391994476 +- 0.01418297365307808 +- -0.038672223687171936 +- -0.008651084266602993 +- -0.026026500388979912 +- 0.10797334462404251 +- -0.005325615871697664 +- -0.009688745252788067 +- 0.005179217550903559 +- -0.022740162909030914 +- 0.022393863648176193 +- 0.03511680290102959 +- 0.0032473234459757805 +- -0.004239055328071117 +- 0.0003833693917840719 +- -0.02804042212665081 +- -0.01719619892537594 +- 0.03616011142730713 +- -0.008799486793577671 +- -0.09382113069295883 +- -0.020445263013243675 +- -0.0011057124938815832 +- -0.023739101365208626 +- 0.03938119485974312 +- -0.011825475841760635 +- -0.027204478159546852 +- 0.022995417937636375 +- -0.08701358735561371 +- -0.013715233653783798 +- -0.018995074555277824 +- -0.04925267770886421 +- 0.012124109081923962 +- 0.03280827775597572 +- -0.005217003170400858 +- -0.053769927471876144 +- -0.021743105724453926 +- -0.0070466212928295135 +- 0.009713055565953255 +- 0.03297695890069008 +- -0.015778860077261925 +- -0.020879000425338745 +- -0.017451373860239983 +- 0.006396296434104443 +- -0.010501282289624214 +- 0.04855453222990036 +- 0.0121320690959692 +- -0.04622287303209305 +- 0.016785066574811935 +- -0.01645517162978649 +- -0.09306468814611435 +- -0.006510382518172264 +- -0.007951407693326473 +- 0.027384178712964058 +- 0.04490070044994354 +- 0.0007170891622081399 +- 0.045816194266080856 +- -0.03541984036564827 +- -0.005954004358500242 +- 0.05126989632844925 +- 0.05625636875629425 +- -0.052142027765512466 +- -0.002337090438231826 +- 0.032380033284425735 +- -0.056381307542324066 +- -0.01131097786128521 +- -0.014318730682134628 +- 0.04896633327007294 +- 0.0552961640059948 +- 0.007818006910383701 +- -0.04617944359779358 +- -0.031630948185920715 +- 0.04194357991218567 +- -0.05587031692266464 +- 0.014986417256295681 +- 0.03721534088253975 +- 0.00568470498546958 +- 0.05165747553110123 +- 0.020130546763539314 +- -0.04037341848015785 +- -0.059297826141119 +- 0.013797988183796406 +- 0.0236357394605875 +- 0.022123336791992188 +- 0.04677799344062805 +- 0.014986587688326836 +- 0.042244650423526764 +- 0.02463829703629017 +- -0.021790005266666412 +- -0.014185643754899502 +- -0.051752444356679916 +- 0.016091128811240196 +- -0.025408871471881866 +- -0.004616331309080124 +- 0.002464518416672945 +- 0.011269024573266506 +- -0.016831479966640472 +- -0.05544956773519516 +- -0.04453176259994507 +- 0.025718802586197853 +- 0.012693840079009533 +- -0.048942431807518005 +- -0.04048214852809906 +- -0.026056434959173203 +- -0.023748729377985 +- -0.06638790667057037 +- 0.0005285385414026678 +- 0.0509391650557518 +- 0.019543481990695 +- -0.03196631371974945 +- 0.02623622864484787 +- 0.009538133628666401 +- 0.03483378142118454 +- -0.02508186176419258 +- 0.02043452113866806 +- -0.010725446976721287 +- -0.0074797142297029495 +- 0.014813465066254139 +- 0.013983956538140774 +- 0.05100783705711365 +- -0.06045455113053322 +- -0.025909405201673508 +- -0.025109220296144485 +- 0.031531546264886856 +- -0.027345962822437286 +- -0.024721402674913406 +- 0.02084783837199211 +- 0.09586375951766968 +- -0.008180346339941025 +- 0.015048526227474213 +- 0.04171084240078926 +- -0.007213604636490345 +- 0.005185933317989111 +- 0.014219473116099834 +- 0.03887265920639038 +- 0.006981587037444115 +- 0.06657340377569199 +- -0.0031540400814265013 +- 0.031057722866535187 +- 0.003798832418397069 +- 0.09330818057060242 +- -0.01144392415881157 +- -0.03706010803580284 +- 0.03340112417936325 +- -0.034626130014657974 +- 0.037274204194545746 +- -0.050508707761764526 +- 0.03197618946433067 +- 0.01573924534022808 +- -0.027317821979522705 +- 0.01917574368417263 +- -0.026374073699116707 +- 0.005931815132498741 +- -0.027819974347949028 +- 0.022738324478268623 +- -0.009882564656436443 +- 0.004274012520909309 +- -0.05382080376148224 +- -0.06422704458236694 +- -0.0037522080820053816 +- -0.09904822707176208 +- -0.0038907958660274744 +- 0.023477153852581978 +- 0.04183608666062355 +- -0.010195894166827202 +- 0.007519648876041174 +- 0.0478956401348114 +- 0.06119244173169136 +- 0.017770763486623764 +- 0.0031069153919816017 +- -0.019519055262207985 +- 0.01839151605963707 +- 0.007158738095313311 +- -0.0713043361902237 +- -0.04761949181556702 +- 0.026049980893731117 +- -0.047883182764053345 +- 0.014867996796965599 +- 0.00928537454456091 +- -0.0407157763838768 +- -0.1118495911359787 +- 0.07564633339643478 +- -0.048067085444927216 +- 0.018672022968530655 +- 0.02629098854959011 +- 0.05120433494448662 +- -0.0188148133456707 +- -0.009329553693532944 +- -0.10229811817407608 +- -0.021712183952331543 +- 0.02768830396234989 +- 0.02979288250207901 +- 0.010588753037154675 +- 0.027784010395407677 +- -0.022417576983571053 +- -0.0477118156850338 +- -0.019707977771759033 +- 0.043368637561798096 +- -0.002604682696983218 +- 0.05778846517205238 +- 0.0032716221176087856 +- -0.016919787973165512 +- 0.001729412586428225 +- -0.028190720826387405 +- -0.04968857392668724 +- 0.0181594081223011 +- 0.011803517118096352 +- -0.02502574771642685 +- -0.07610262185335159 +- 0.01390276849269867 +- -0.03878704458475113 +- -0.043086905032396317 +- 0.04730651155114174 +- -0.0208892859518528 +- -0.005661654286086559 +- 0.038437001407146454 +- 0.028558600693941116 +- 0.04621468484401703 +- -0.0277409665286541 +- -0.012964108027517796 +- -0.05556506663560867 +- 0.027492046356201172 +- -0.007763118948787451 +- -0.011776722967624664 +- -0.041421692818403244 +- -0.014284875243902206 +- 0.0024534789845347404 +- -0.025437604635953903 +- -0.07751662284135818 +- -0.039282042533159256 +- 0.06303831189870834 +- 0.044384051114320755 +- 0.003853065427392721 +- 0.0043038735166192055 +- 0.001415966427884996 +- -0.032784949988126755 +- -0.07216829806566238 +- -0.06405965238809586 +- -0.07864663749933243 +- 0.007194001227617264 +- -0.01512132491916418 +- 0.057427480816841125 +- 0.01871199905872345 +- 0.002615442266687751 +- -0.019085833802819252 +- -0.03211134672164917 +- 0.02497853711247444 +- 0.009740686044096947 +- 0.04712676629424095 +- 0.014834719710052013 +- -0.0216281209141016 +- 0.0026223789900541306 +- 0.031738318502902985 +- -0.06511115282773972 +- 0.018047373741865158 +- -0.05825822427868843 +- -0.06928882747888565 +- 0.024454424157738686 +- -0.028324056416749954 +- 0.003804718842729926 +- -0.0017671874957159162 +- -0.00875526200979948 +- -0.012061065062880516 +- -0.0714389830827713 +- 0.06825675815343857 +- -0.08810510486364365 +- 0.03354572132229805 +- 0.0004574693739414215 +- -0.014058583416044712 +- 0.006580387242138386 +- 0.020362654700875282 +- -0.017877236008644104 +- 0.003640989540144801 +- 0.00761835603043437 +- -0.0013692042557522655 +- -0.004554315935820341 +- -0.07044420391321182 +- 0.05243919789791107 +- 0.019296985119581223 +- 0.006655104458332062 +- 0.011780296452343464 +- -0.005403762683272362 +- -0.06105198338627815 +- 0.06538153439760208 +- 0.01744009181857109 +- 0.04235944524407387 +- 0.01116121280938387 +- 0.0439041405916214 +- 0.07044947147369385 +- -0.0012615721207112074 +- 0.052524104714393616 +- -0.00472694355994463 +- 0.0700119286775589 +- 0.015710053965449333 +- 0.06473696231842041 +- -0.02549312636256218 +- -0.019381161779165268 +- -0.012512899935245514 +- -0.036598071455955505 +- 0.014136865735054016 +- -0.03888177499175072 +- -0.009207700379192829 +- -0.029045933857560158 +- -0.01925111562013626 +- -0.01584102213382721 +- -0.020850270986557007 +- -0.0007262067520059645 +- 0.025219272822141647 +- 0.02446514554321766 +- -0.03503533452749252 +- 0.005304895341396332 +- 0.0558466762304306 +- -0.07577811181545258 +- -0.02071310393512249 +- 0.06525979191064835 +- -0.006340986583381891 +- 0.030026115477085114 +- 0.018616529181599617 +- 0.015562169253826141 +- -0.03970484063029289 +- -0.0058183143846690655 +- -0.030402889475226402 +- 0.016910970211029053 +- 0.08447960764169693 +- 0.030522271990776062 +- 0.02209566906094551 +- 0.037809114903211594 +- 0.04860290139913559 +- -0.02600998617708683 +- 0.029071344062685966 +- -0.03889188542962074 +- -0.03067505732178688 +- 0.050907254219055176 +- 0.020721672102808952 +- -0.010848396457731724 +- -0.01116504892706871 +- -0.002083761850371957 +- -0.030995143577456474 +- -0.0458257757127285 +- -0.019136330112814903 +- -0.0308342557400465 +- 0.00565183674916625 +- 0.07874057441949844 +- 0.0038244135212153196 +- 0.024108774960041046 +- -0.01915900968015194 +- 0.02007138356566429 +- 0.06350391358137131 +- 0.048261046409606934 +- 0.03814397379755974 +- 0.03294387832283974 +- -0.030421528965234756 +- 0.03831914812326431 +- 0.03895830735564232 +- 0.017689364030957222 +- 0.008748199790716171 +- -0.020921260118484497 +- -0.03600146993994713 +- -0.0037120229098945856 +- -0.042820435017347336 +- -0.03473712131381035 +- 0.020170249044895172 +- 0.008261213079094887 +- 0.008062402717769146 +- 0.005055050831288099 +- 0.019371723756194115 +- 0.10489551723003387 +- -0.0003611571155488491 +- -0.007438078057020903 +- -0.016777552664279938 +- -0.058316804468631744 +- 0.03275390341877937 +- -0.06735731661319733 +- -0.003918819595128298 +- 0.03461066260933876 +- 0.005690631456673145 +- -0.033279165625572205 +- 0.031183233484625816 +- 0.011194959282875061 +- -0.016929173842072487 +- -0.012761923484504223 +- 0.012990987859666348 +- 0.02138291485607624 +- 0.0013042341452091932 +- 0.005421041510999203 +- 0.00550623144954443 +- 0.015361975878477097 +- -0.006454655434936285 +- 0.023045657202601433 +- 0.052985116839408875 +- 0.010047507472336292 +- -0.02859446406364441 +- -0.005586408544331789 +- -0.00349820195697248 +- 0.005481155123561621 +- -0.02478955313563347 +- 0.031984806060791016 +- -0.013082249090075493 +- -0.027859549969434738 +- -0.07622745633125305 +- 0.003646149532869458 +- -0.008291426114737988 +- -0.01867637224495411 +- -0.031240388751029968 +- 0.03297831118106842 +- -0.03184446692466736 +- -0.023041030392050743 +- 0.09066202491521835 +- -0.014461378566920757 +- -0.024871403351426125 +- 0.039309822022914886 +- -0.020350798964500427 +- 0.007679751608520746 +- 0.037645373493433 +- 0.021200789138674736 +- -0.06969033926725388 +- 0.02792828343808651 +- 0.01129328366369009 +- -0.06004638969898224 +- 0.006861166562885046 +- 0.044250912964344025 +- 0.029625611379742622 +- -0.009557127952575684 +- -0.05960233882069588 +- 0.0017424698453396559 +- 0.017338726669549942 +- -0.04044404253363609 +- 0.028692111372947693 +- 0.003438263200223446 +- 0.01927531510591507 +- -0.04809967428445816 +- 0.036329999566078186 +- 0.04538080468773842 +- 0.007264549843966961 +- -0.09445788711309433 +- -0.0031028203666210175 +- 0.09188473224639893 +- 0.006122107617557049 +- 0.004153246991336346 +- -0.0009691837476566434 +- -0.0192609541118145 +- 0.013033772818744183 +- 0.007635330781340599 +- -0.012832255102694035 +- -0.028537679463624954 +- -0.0039044697768986225 +- 0.03140951320528984 +- -0.018394710496068 +- -0.018766168504953384 +- -0.009520076215267181 +- -0.019677508622407913 +- -0.013935834169387817 +- -0.022296525537967682 +- 0.046354617923498154 +- 0.027911093086004257 +- -0.03439607471227646 +- 0.04835047945380211 +- 0.04744994267821312 +- 0.08087560534477234 +- -0.03324320539832115 +- 0.09356484562158585 +- -0.05506376922130585 +- -0.015122752636671066 +- -0.017576247453689575 +- 0.0164752509444952 +- -0.009802558459341526 +- 0.03434855490922928 +- 0.05297086760401726 +- -0.021666349843144417 +- 0.0236513651907444 +- -0.016122274100780487 +- 0.015448885969817638 +- 0.05725741386413574 +- -0.0049414788372814655 +- -0.006801162846386433 +- 0.00823257863521576 +- -5.4276196169433485e-33 +- -0.04082207381725311 +- -0.019555607810616493 +- -0.040040839463472366 +- -0.0001141502070822753 +- -0.051626596599817276 +- -0.03195520490407944 +- -0.013592409901320934 +- 0.035518426448106766 +- -0.02025427110493183 +- 0.003525864565744996 +- -0.010595621541142464 +- -0.010334410704672337 +- 0.005470395088195801 +- -0.010931993834674358 +- 0.019002994522452354 +- -0.008090449497103691 +- 0.023338936269283295 +- 0.02729245461523533 +- -0.02518153376877308 +- 0.014246493577957153 +- 0.05546674504876137 +- -0.003024680307134986 +- 0.09591367840766907 +- 0.01541182305663824 +- 0.012257235124707222 +- 0.014503195881843567 +- -0.06009455397725105 +- -0.020580431446433067 +- 0.04156920313835144 +- -0.028271107003092766 +- -0.05132425203919411 +- 0.029513904824852943 +- -0.0017966947052627802 +- 0.049365900456905365 +- -0.004055812489241362 +- 0.04952320456504822 +- -0.0026710391975939274 +- -0.022057930007576942 +- 0.044722456485033035 +- -0.03439272195100784 +- -0.019913332536816597 +- 0.04651929438114166 +- -0.06508281826972961 +- -0.014435326680541039 +- 0.011593392118811607 +- 0.0795234888792038 +- 0.012000009417533875 +- 0.02052253857254982 +- 0.011723524890840054 +- 0.046198442578315735 +- -0.08271150290966034 +- -0.010815484449267387 +- 0.0161152146756649 +- -0.0689789205789566 +- -0.07248946279287338 +- 0.04016651213169098 +- -0.033289846032857895 +- -0.058603834360837936 +- -0.0054756342433393 +- 0.0909019261598587 +- 0.10557299107313156 +- 0.02360360696911812 +- -0.014354990795254707 +- 0.048548873513936996 +- 0.0019736471585929394 +- 0.06898210942745209 +- 0.05895812064409256 +- -0.02885180339217186 +- 0.033372119069099426 +- -0.03948585316538811 +- 0.055792562663555145 +- 0.03762234374880791 +- -0.02001100406050682 +- 0.0384683795273304 +- -0.0013603812549263239 +- 0.002101999009028077 +- 0.021199950948357582 +- -0.0396786630153656 +- 0.0019316099351271987 +- -0.02689376100897789 +- -0.016210021451115608 +- 0.007637509144842625 +- -0.0295636598020792 +- -0.00559998070821166 +- 0.007571681868284941 +- 0.019282475113868713 +- -0.00989591795951128 +- 0.02802428789436817 +- 0.03746981546282768 +- 0.010514799505472183 +- -0.0071000768803060055 +- -0.017970241606235504 +- 0.05796752870082855 +- -0.030826766043901443 +- -0.009067504666745663 +- -0.004731421358883381 +- -0.003460831707343459 +- -0.03639674559235573 +- 0.029955849051475525 +- 0.010226797312498093 +- -0.018062757328152657 +- -0.006389494054019451 +- 0.007409690413624048 +- -0.006125683430582285 +- -0.042033396661281586 +- 0.051985014230012894 +- -0.036104828119277954 +- -0.028968362137675285 +- -0.052876509726047516 +- 0.011303597129881382 +- 0.000993435736745596 +- -0.008258406072854996 +- -0.0005200817831791937 +- -0.03318827226758003 +- -0.022004326805472374 +- -0.005636484827846289 +- -0.009486468508839607 +- 0.04843885824084282 +- -0.04006384685635567 +- -0.09285368770360947 +- -0.010983766056597233 +- -0.02521510049700737 +- -0.02511165291070938 +- 0.08779968321323395 +- -0.05451599881052971 +- 0.022082850337028503 +- -0.011556071229279041 +- -0.0016166914720088243 +- 0.01935880444943905 +- -0.01695958711206913 +- -0.013522415421903133 +- 0.018605517223477364 +- 2.1817804451984557e-07 +- -0.04431600868701935 +- -0.04570120945572853 +- 0.01669955812394619 +- 0.06607300788164139 +- 0.017166996374726295 +- 0.03357904404401779 +- -0.0017406007973477244 +- 0.047135964035987854 +- -0.008087290450930595 +- 0.029634656384587288 +- -0.037854839116334915 +- -0.06868617236614227 +- 0.016353294253349304 +- -0.06975943595170975 +- -0.0658138319849968 +- 0.05246325954794884 +- -0.05415238440036774 +- -0.05535067617893219 +- 0.013516568578779697 +- -0.03186754509806633 +- -0.01734168268740177 +- 0.02797715552151203 +- -0.04415814206004143 +- 0.013990371488034725 +- 0.0017030416056513786 +- -0.02903452143073082 +- 0.004722150508314371 +- -0.02650137059390545 +- 0.01564672589302063 +- -0.001661005662754178 +- -0.04083627089858055 +- -0.07906034588813782 +- 0.009867316111922264 +- -0.016816100105643272 +- -0.012638971209526062 +- 0.01591288298368454 +- 0.056589581072330475 +- 0.0064044068567454815 +- 0.013809708878397942 +- 0.04792078584432602 +- -0.019602905958890915 +- 0.03162536397576332 +- -0.022116828709840775 +- -0.0833219587802887 +- 0.021573832258582115 +- -0.00447801360860467 +- 0.04292779415845871 +- 0.045142997056245804 +- 0.03226413205265999 +- -0.027286192402243614 +- 0.013176245614886284 +- -0.049645982682704926 +- 0.007549443282186985 +- -0.00999278575181961 +- -0.013706004247069359 +- 0.01598244160413742 +- 0.051234692335128784 +- 0.06402378529310226 +- 0.03811778500676155 +- -0.05885973572731018 +- 0.02408667653799057 +- -0.08148571103811264 +- 0.015307127498090267 +- 0.0055137514136731625 +- -0.015415924601256847 +- 0.004939137492328882 +- 0.0049317083321511745 +- 7.191724947853642e-35 +- 0.029207047075033188 +- 0.0606287457048893 +- 0.03528021648526192 +- 0.04207465425133705 +- -0.019572963938117027 +- -0.006242445670068264 +- -0.001600156887434423 +- 0.021258467808365822 +- 0.021815242245793343 +- -0.02305923029780388 +- -0.02104978635907173 diff --git a/project/exp1/exp_20240909-060027-bee84199.yaml b/project/exp1/exp_20240909-060027-bee84199.yaml new file mode 100644 index 00000000..fe058dd6 --- /dev/null +++ b/project/exp1/exp_20240909-060027-bee84199.yaml @@ -0,0 +1,780 @@ +exp_id: 20240909-060027-bee84199 +experience_text: "\n {\n \"User Query\": \"ask code interpreter to print hello world\"\ + ,\n \"Roles\": [\"User\", \"Planner\", \"CodeInterpreter\"],\n \"Error Resolution\"\ + : {\n \"Error 1\": \"The CodeInterpreter printed 'Hello World :)' instead of\ + \ 'Hello World' as requested by the User.\",\n \"Resolution 1\": \"Ensure that\ + \ the exact phrase 'Hello World' is printed by the CodeInterpreter without any additional\ + \ characters or emoticons.\"\n },\n \"Preferences\": {\n \"Preference 1\":\ + \ \"The User prefers the exact phrase 'Hello World' to be printed by the CodeInterpreter.\"\ + \n }\n}" +raw_experience_path: exp1\raw_exp_20240909-060027-bee84199.yaml +embedding_model: all-mpnet-base-v2 +embedding: +- 0.03650199621915817 +- 0.019063962623476982 +- -0.01010815892368555 +- 0.03230191022157669 +- 0.00967459101229906 +- 0.01629781164228916 +- -0.04084751009941101 +- 0.0166975948959589 +- 0.001384068513289094 +- 0.04583757743239403 +- 0.002849709242582321 +- 0.07021525502204895 +- -0.01608499139547348 +- 0.038873810321092606 +- -0.030341612175107002 +- -0.02888357825577259 +- 0.03969240561127663 +- -0.01944999024271965 +- 0.033980872482061386 +- 0.002481618197634816 +- -0.024041233584284782 +- 0.05306457728147507 +- 0.005178075283765793 +- 0.06399565190076828 +- 0.02358604036271572 +- -0.027425013482570648 +- 0.004436379298567772 +- 0.019265344366431236 +- -0.003472236916422844 +- -0.04355144128203392 +- 0.033810149878263474 +- 0.002894420875236392 +- -0.0014372023288160563 +- -0.029702944681048393 +- 2.159270934498636e-06 +- -0.030278382822871208 +- -0.01437467336654663 +- 0.007538159377872944 +- 0.008817843161523342 +- -0.02799857221543789 +- -0.005138462409377098 +- 0.02006506733596325 +- 0.01577572338283062 +- 0.018632253631949425 +- -0.03697778657078743 +- 0.015873927623033524 +- 0.05214408040046692 +- -0.006439996883273125 +- 0.057969216257333755 +- 0.055799469351768494 +- 0.01599987782537937 +- -0.017073500901460648 +- -0.012963840737938881 +- -0.03039512224495411 +- 0.03999326750636101 +- -0.008120743557810783 +- 0.015163810923695564 +- -0.011621535755693913 +- 0.04782847687602043 +- 0.007099832873791456 +- -0.0154671436175704 +- -0.020601553842425346 +- -0.01888253167271614 +- -0.05239752307534218 +- -0.05359145998954773 +- -0.03564131632447243 +- 0.02294674888253212 +- -0.10942035913467407 +- 0.05875062569975853 +- -0.01761804334819317 +- 0.0680980235338211 +- -0.00023549275647383183 +- -0.01628176122903824 +- 0.02975529059767723 +- -0.01963278092443943 +- -0.02591628208756447 +- 0.0009945088531821966 +- -0.010786302387714386 +- 0.00034342295839451253 +- 0.00882516335695982 +- 0.002033964265137911 +- 0.013059866614639759 +- -0.05831601470708847 +- -0.006232714746147394 +- -0.0677214115858078 +- 0.10047215223312378 +- -0.02564368024468422 +- -0.033130545169115067 +- -0.03196122124791145 +- 0.0036024870350956917 +- 0.030747825279831886 +- 0.014264383353292942 +- -0.021448222920298576 +- 0.05187259241938591 +- -0.04652926325798035 +- -0.031512290239334106 +- 0.02209184132516384 +- -0.008867657743394375 +- 0.062387630343437195 +- 0.003188725560903549 +- -0.006650672759860754 +- 0.047966018319129944 +- -0.005174477118998766 +- -0.0032584890723228455 +- 0.0405985452234745 +- 0.05157212167978287 +- 0.10211936384439468 +- 0.05893828719854355 +- 0.007700721267610788 +- 0.010334809310734272 +- 0.010215973481535912 +- -0.0025417038705199957 +- -0.037533700466156006 +- -0.002161915646865964 +- 0.0003367524186614901 +- 0.011290473863482475 +- 0.008038701489567757 +- 0.0491543784737587 +- 0.022629352286458015 +- 0.07176218926906586 +- 0.03630655258893967 +- -0.014728685840964317 +- -0.014489897526800632 +- 0.07115117460489273 +- -0.04456067830324173 +- -0.09103377163410187 +- -0.014775274321436882 +- -0.05909285694360733 +- -0.028135865926742554 +- -0.026152273640036583 +- -0.0057229395024478436 +- 0.002872011624276638 +- 0.032319873571395874 +- 0.0030611350666731596 +- -0.0393146276473999 +- 0.032184433192014694 +- 0.020893681794404984 +- -0.009306630119681358 +- 0.04177384823560715 +- -0.0460730716586113 +- 0.02283678762614727 +- -0.03645949438214302 +- -0.026047229766845703 +- -0.005442500114440918 +- -0.030837424099445343 +- 0.001454545883461833 +- 0.019628645852208138 +- -0.046583086252212524 +- -0.004137054551392794 +- 0.00031139160273596644 +- 0.011494139209389687 +- 0.0037731630727648735 +- -0.058076534420251846 +- 0.027242153882980347 +- -0.0024274811148643494 +- 0.02545524761080742 +- 0.057939741760492325 +- 0.030511314049363136 +- 0.009854871779680252 +- -0.01368540059775114 +- -0.0021010800264775753 +- 0.014711201190948486 +- 0.008250394836068153 +- -0.031792789697647095 +- -0.0021059513092041016 +- -0.005583674646914005 +- -0.011089176870882511 +- 0.0027945288456976414 +- -0.01840946078300476 +- -0.022178243845701218 +- 0.008241801522672176 +- 0.007792035583406687 +- -0.018055962398648262 +- 0.041718415915966034 +- -0.07277035713195801 +- 0.04033379256725311 +- 0.039081960916519165 +- -0.0465276874601841 +- 0.013711976818740368 +- 0.012119779363274574 +- -0.01728629507124424 +- 0.0029297093860805035 +- -0.005026562605053186 +- -0.04414927214384079 +- 0.011204316280782223 +- -0.0017567889299243689 +- -0.013977141119539738 +- -0.02226760797202587 +- 0.04048320651054382 +- -0.04534720629453659 +- 0.026010630652308464 +- 0.011539110913872719 +- -0.051474396139383316 +- -0.017884137108922005 +- 0.01061796024441719 +- 0.02324778400361538 +- -0.03084588050842285 +- -0.07174546271562576 +- 0.014583921059966087 +- -0.004208678379654884 +- -0.007992745377123356 +- -0.012023459188640118 +- 0.02171032316982746 +- 0.11041239649057388 +- -0.003199615515768528 +- -0.028993086889386177 +- 0.03247155249118805 +- 0.02290230058133602 +- -0.10762998461723328 +- -0.011635362170636654 +- 0.04346613213419914 +- -0.010731887072324753 +- 0.0068705095909535885 +- 0.04816587641835213 +- -0.028950059786438942 +- 0.03554090857505798 +- 0.032100677490234375 +- 0.03299139440059662 +- 0.020563526079058647 +- -0.012154274620115757 +- -0.027507049962878227 +- 0.019385581836104393 +- -0.05658388137817383 +- -0.006999157834798098 +- 0.028847388923168182 +- -0.058033064007759094 +- -0.011883762665092945 +- 0.0049120462499558926 +- -0.0017832611920312047 +- 0.013273099437355995 +- -0.029274173080921173 +- 0.03268425166606903 +- -0.012329413555562496 +- -0.0012030431535094976 +- -0.02430119551718235 +- -0.019168170168995857 +- -0.05457765981554985 +- -0.0554073303937912 +- -0.016768518835306168 +- -0.012221619486808777 +- -0.00556898582726717 +- 0.04278269037604332 +- -0.0011293146526440978 +- 0.012236008420586586 +- 0.04618168994784355 +- 0.0029959974344819784 +- 0.005823892075568438 +- 0.008390912786126137 +- 0.02036885730922222 +- -0.0086804935708642 +- -0.0038372776471078396 +- 0.001814811141230166 +- -0.013591759838163853 +- -0.007561895065009594 +- -0.02792813628911972 +- -0.01082109659910202 +- 0.005258654244244099 +- -0.027613122016191483 +- -0.0692027360200882 +- -0.03592248633503914 +- 0.11819431930780411 +- -0.01205260120332241 +- -0.01811525970697403 +- 0.023646386340260506 +- 0.08018726855516434 +- 0.039637163281440735 +- -0.018061667680740356 +- -0.057694509625434875 +- -0.045918308198451996 +- -0.009750580415129662 +- -0.004940384533256292 +- 0.009346549399197102 +- 0.039679840207099915 +- -0.02043306455016136 +- 0.02251438796520233 +- -0.007262335158884525 +- -0.014631232246756554 +- 0.03680229187011719 +- 0.0031033798586577177 +- 0.007265770807862282 +- -0.020529044792056084 +- -0.024859866127371788 +- -0.03790897876024246 +- -0.01824168860912323 +- -0.04123998433351517 +- 0.03618818521499634 +- 0.010167263448238373 +- -0.027102774009108543 +- -0.001689991680905223 +- 0.00503492821007967 +- 0.006579197943210602 +- 0.007833055220544338 +- 0.05603867024183273 +- -0.05276698246598244 +- 0.0003785685694310814 +- -0.022163309156894684 +- -0.03831585496664047 +- 0.02349357306957245 +- -0.0004349916707724333 +- 0.06748777627944946 +- 0.02076246589422226 +- 0.040166452527046204 +- -0.0756010040640831 +- -0.007003300357609987 +- -0.0025534220039844513 +- -0.08708585053682327 +- 0.0334453247487545 +- -0.03482700139284134 +- 0.024774344637989998 +- 0.03521222993731499 +- 0.04481435567140579 +- 0.014677970670163631 +- -0.04810449853539467 +- 0.0462379977107048 +- 0.007280406542122364 +- -0.01782773621380329 +- 0.051005374640226364 +- -0.061830293387174606 +- -0.028725532814860344 +- 0.11600051820278168 +- 0.02980647422373295 +- -0.029852300882339478 +- 0.06244149059057236 +- -0.02165360003709793 +- 0.020062735304236412 +- -0.055377691984176636 +- -0.05279934033751488 +- -0.04348861798644066 +- 0.02482166886329651 +- 0.012182345613837242 +- 0.052540767937898636 +- 0.018707433715462685 +- -0.08804966509342194 +- 0.05499080941081047 +- -0.04715437814593315 +- 0.013706481084227562 +- 0.019067775458097458 +- -0.035118717700242996 +- 0.011700774542987347 +- -0.02336474135518074 +- -0.018644146621227264 +- -0.004686446860432625 +- 0.00308492430485785 +- 0.01583041436970234 +- -0.01981874741613865 +- 0.019767317920923233 +- 0.04057164490222931 +- -0.0072626229375600815 +- 0.021153226494789124 +- -0.003723096800968051 +- 0.0256344061344862 +- 0.031599029898643494 +- 0.01639559306204319 +- 0.009381079114973545 +- -0.01437310315668583 +- -0.12636440992355347 +- -0.01765822060406208 +- 0.011237585917115211 +- -0.04503163695335388 +- 0.005626212805509567 +- 0.03942876681685448 +- -0.03072195127606392 +- -0.02083384431898594 +- 0.05520300194621086 +- 0.015896199271082878 +- 0.018475566059350967 +- 0.021363774314522743 +- 0.0001011369313346222 +- 0.001242650905624032 +- -0.003882152261212468 +- -0.023001654073596 +- -0.00396678177639842 +- -0.014734441414475441 +- 0.06194522604346275 +- -0.010029478929936886 +- -0.0363856740295887 +- 0.060385942459106445 +- -0.010417847894132137 +- -0.03165370598435402 +- 0.0020375880412757397 +- 0.011441579088568687 +- -0.06173594295978546 +- 0.06451550871133804 +- -0.03594602644443512 +- 0.07127977162599564 +- -0.029159296303987503 +- 0.026816019788384438 +- -0.03566635772585869 +- 0.013026712462306023 +- -0.019223667681217194 +- 0.017018398270010948 +- -0.09750735014677048 +- -0.08482908457517624 +- 0.019067825749516487 +- -0.016575906425714493 +- -0.018837369978427887 +- -0.019881898537278175 +- -0.006542363669723272 +- 0.027561279013752937 +- 0.03667883947491646 +- -0.02264517731964588 +- 0.03140289708971977 +- -0.021825017407536507 +- -0.02250180020928383 +- 0.015438721515238285 +- -0.02598598413169384 +- 0.16919063031673431 +- -0.011539521627128124 +- 0.06546410173177719 +- 0.10228725522756577 +- -0.05589429661631584 +- -0.019117912277579308 +- 0.04685910418629646 +- -0.030754555016756058 +- -0.01764487661421299 +- -0.04952290654182434 +- -0.023641206324100494 +- 0.009775570593774319 +- 0.03318585827946663 +- -0.06548891961574554 +- -0.00522626144811511 +- 0.027656421065330505 +- -0.006009647622704506 +- -0.0004900101339444518 +- 0.009803522378206253 +- -0.03418729081749916 +- 0.031401026993989944 +- 0.010864220559597015 +- -0.03505794331431389 +- 0.06078314781188965 +- 0.023262938484549522 +- -0.05835193023085594 +- -0.05142442137002945 +- 0.027432624250650406 +- -0.07568961381912231 +- -0.054134320467710495 +- -0.05009257420897484 +- 0.009990572929382324 +- -0.008881265297532082 +- -0.02960691787302494 +- -0.03287572041153908 +- 0.05400466173887253 +- 0.0595538467168808 +- -0.024172497913241386 +- -0.018908828496932983 +- 0.03582540526986122 +- -0.015922952443361282 +- 0.017268380150198936 +- -0.06446479260921478 +- -0.009215420112013817 +- -0.017715206369757652 +- -0.03415748104453087 +- -0.07049231231212616 +- -0.0314682200551033 +- 0.0519050657749176 +- 0.005576093215495348 +- -0.07397657632827759 +- 0.03600810095667839 +- -0.05751391872763634 +- 0.029768360778689384 +- 0.006622924003750086 +- 0.04706555977463722 +- -0.013701669871807098 +- -0.06159682944417 +- -0.03720347210764885 +- -0.07853514701128006 +- 0.045081768184900284 +- -0.022467488422989845 +- 0.014809702523052692 +- 0.0006731791654601693 +- 0.0670522153377533 +- 0.018043329939246178 +- 0.015820646658539772 +- -0.025274597108364105 +- -0.011738503351807594 +- -0.07919713109731674 +- -0.04253692552447319 +- -0.08102281391620636 +- -0.0698060467839241 +- -0.018778780475258827 +- 0.04976924881339073 +- -0.03799819201231003 +- 0.015926595777273178 +- -0.09179370850324631 +- 0.03195550665259361 +- -0.003975256811827421 +- -0.026863208040595055 +- -0.017320867627859116 +- 0.015543772839009762 +- 0.018975693732500076 +- -0.023153122514486313 +- -0.056106459349393845 +- 0.036853596568107605 +- -0.03029652126133442 +- -0.026304155588150024 +- 0.04910549893975258 +- 0.027001112699508667 +- 0.0641222894191742 +- 0.03932790830731392 +- -0.003479540813714266 +- 0.0431060791015625 +- 0.02150081656873226 +- -0.06129409745335579 +- 0.0035558550152927637 +- 0.007836258970201015 +- 0.009342554956674576 +- 0.029769649729132652 +- -0.0045354790054261684 +- -0.03674178570508957 +- 0.0009125868673436344 +- 0.03726142644882202 +- -0.030408194288611412 +- -0.03317251428961754 +- -0.09752847999334335 +- 0.06741469353437424 +- -0.007684178184717894 +- -0.03772740066051483 +- 0.01645496115088463 +- 0.004345745779573917 +- 0.013358850963413715 +- 0.05533774197101593 +- -0.003880938980728388 +- -0.01004269253462553 +- -0.014566345140337944 +- 0.02752722054719925 +- -0.01914203353226185 +- 0.007446188014000654 +- 0.040934544056653976 +- -0.07924695312976837 +- 0.07732801139354706 +- -0.004089479334652424 +- 0.025174342095851898 +- 0.007742186542600393 +- 0.0021767811849713326 +- -0.050897035747766495 +- -0.011844993568956852 +- 0.04060881957411766 +- 0.03563510626554489 +- -0.00019295875972602516 +- -0.011732073500752449 +- -0.027353426441550255 +- -0.0027017961256206036 +- -0.01237565465271473 +- 0.029830098152160645 +- 0.0035693852696567774 +- -0.017718762159347534 +- -0.003512526396661997 +- 0.005582711193710566 +- -0.014288374222815037 +- -0.019669488072395325 +- 0.020938942208886147 +- -0.011075489223003387 +- -0.01717577874660492 +- -0.002177111804485321 +- 0.031843241304159164 +- -5.373291941468189e-33 +- -0.08552851527929306 +- -0.08748151361942291 +- -0.02104608528316021 +- -0.013850229792296886 +- 0.024606892839074135 +- -0.06701470911502838 +- -0.0194350965321064 +- -0.014033172279596329 +- -0.02600841410458088 +- -0.04803629592061043 +- 0.02466132678091526 +- -0.014942169189453125 +- 0.021199559792876244 +- 0.0015342104015871882 +- 0.04609009250998497 +- 0.011064610444009304 +- 0.04178307577967644 +- 0.02651437371969223 +- -0.023429743945598602 +- 0.029441362246870995 +- 0.024511214345693588 +- -0.0077877352014184 +- 0.013183764182031155 +- -0.020712893456220627 +- 0.04322870820760727 +- 0.01531900092959404 +- -0.03291461616754532 +- 0.044358983635902405 +- -0.0063957031816244125 +- 0.021997665986418724 +- -0.011797011829912663 +- -0.01731301285326481 +- -0.014372491277754307 +- 0.11477121710777283 +- -0.03179844096302986 +- 0.0048909867182374 +- -0.03593689948320389 +- -0.07110868394374847 +- 0.009432819671928883 +- 0.00503186509013176 +- -0.001560961245559156 +- -0.061824217438697815 +- 0.014810576103627682 +- -0.029208658263087273 +- 0.00611378438770771 +- -0.0205992478877306 +- -0.017889924347400665 +- 0.03235344961285591 +- 0.046222299337387085 +- 0.05640076473355293 +- -0.06722082197666168 +- 0.014873472973704338 +- -0.028457071632146835 +- 0.01720324344933033 +- -0.0382581502199173 +- 0.01678885892033577 +- 0.030047737061977386 +- 0.002848980948328972 +- -0.006784745026379824 +- -0.002970340196043253 +- -0.014819652773439884 +- -0.013166380114853382 +- 0.02034863643348217 +- 0.025862589478492737 +- -0.052696406841278076 +- 0.014604015275835991 +- 0.018056802451610565 +- 0.05104074999690056 +- 0.0016283628065139055 +- 0.02568085305392742 +- 0.009313143789768219 +- 0.05139518156647682 +- -0.0032265731133520603 +- 0.03236458823084831 +- -0.034355681389570236 +- 0.00641967449337244 +- 0.03172388672828674 +- 0.021700801327824593 +- -0.0019692385103553534 +- 0.04475796967744827 +- 0.011245938017964363 +- 0.014955893158912659 +- -0.03294605389237404 +- -0.0315995030105114 +- -0.02876635640859604 +- -0.0487474724650383 +- -0.024815136566758156 +- -0.03878059983253479 +- -0.02567311003804207 +- -0.03251257538795471 +- 0.006007736548781395 +- 0.012290014885365963 +- -0.015623975545167923 +- -0.027067823335528374 +- 0.005853686016052961 +- 0.029197733849287033 +- -0.019857460632920265 +- -0.03854504972696304 +- -0.03325950726866722 +- 0.03262234479188919 +- -0.020538268610835075 +- 0.03784097358584404 +- 0.011546340771019459 +- 0.017298277467489243 +- 0.0685167908668518 +- 0.05192657932639122 +- -0.03835073485970497 +- 0.010031093843281269 +- -0.02847314439713955 +- -0.004457042086869478 +- -0.00025269881007261574 +- -0.02012699842453003 +- -0.018131881952285767 +- -0.0066079385578632355 +- -0.016368430107831955 +- -0.02322203852236271 +- 0.0007369770319201052 +- 0.007095770910382271 +- -0.00307568721473217 +- -0.06603654474020004 +- -0.018490228801965714 +- -0.008162550628185272 +- 0.03762397542595863 +- -0.0026141242124140263 +- -0.017483333125710487 +- -0.03365292772650719 +- -0.02012041211128235 +- 0.020460236817598343 +- 0.056094855070114136 +- 0.038169898092746735 +- -0.0020708611700683832 +- -0.012658493593335152 +- 3.035753479707637e-07 +- 0.0641026571393013 +- 0.013453432358801365 +- 0.02648753486573696 +- 0.04601139575242996 +- -0.005700817797333002 +- -0.00776885449886322 +- 0.0482080839574337 +- 0.01491200178861618 +- -0.004206918179988861 +- 0.03886588662862778 +- 0.0057850307784974575 +- -0.03055516444146633 +- -0.03337744623422623 +- 0.02218221314251423 +- -0.016443734988570213 +- 0.001704895170405507 +- -0.003499707207083702 +- 0.003041616640985012 +- -0.05943898484110832 +- 0.0325356088578701 +- 0.1334337294101715 +- 0.0015891153598204255 +- 0.007730413228273392 +- 0.03185172751545906 +- -0.008854957297444344 +- -0.02309987135231495 +- -0.03650851920247078 +- -0.018481481820344925 +- -0.0076439641416072845 +- 0.018511313945055008 +- -0.06227108836174011 +- -0.016242336481809616 +- 0.08618585765361786 +- -0.02451656199991703 +- -0.0006623297813348472 +- -0.022263944149017334 +- -0.011223441921174526 +- 0.057890549302101135 +- -0.0021590199321508408 +- 0.036611128598451614 +- 0.03942060098052025 +- 0.01710212230682373 +- -0.008060959167778492 +- -0.056093402206897736 +- 0.022938771173357964 +- 0.03800104558467865 +- -0.007309217471629381 +- 0.04246346279978752 +- 0.02996652014553547 +- -0.04494723677635193 +- -0.01572621427476406 +- -0.03998018428683281 +- -0.0073930867947638035 +- 0.029242485761642456 +- -0.008671361953020096 +- 0.021386398002505302 +- 0.0020652152597904205 +- 0.024667901918292046 +- 0.03111426904797554 +- -0.010373709723353386 +- -0.0324309803545475 +- -0.07589073479175568 +- -0.008076506666839123 +- 0.016693206503987312 +- 0.03834793344140053 +- 0.02176501974463463 +- 0.005304788704961538 +- 3.4432098387931616e-34 +- -0.0003316005168017 +- 0.04583214595913887 +- 0.027648521587252617 +- 0.010216344147920609 +- 0.02475813962519169 +- -0.0004624639987014234 +- 0.0008806366822682321 +- 0.045936718583106995 +- 0.06086653843522072 +- -0.048120152205228806 +- -0.03659486770629883 diff --git a/project/exp1/handcrafted_exp_1.yaml b/project/exp1/handcrafted_exp_1.yaml new file mode 100644 index 00000000..232dd8cd --- /dev/null +++ b/project/exp1/handcrafted_exp_1.yaml @@ -0,0 +1,2 @@ +exp_id: 1 +experience_text: say "peach" if you hear "apple" \ No newline at end of file diff --git a/project/exp1/handcrafted_exp_2.yaml b/project/exp1/handcrafted_exp_2.yaml new file mode 100644 index 00000000..cea439c2 --- /dev/null +++ b/project/exp1/handcrafted_exp_2.yaml @@ -0,0 +1,2 @@ +exp_id: 2 +experience_text: Say "world" if you hear "hello" \ No newline at end of file diff --git a/project/exp1/raw_exp_20240909-060027-bee84199.yaml b/project/exp1/raw_exp_20240909-060027-bee84199.yaml new file mode 100644 index 00000000..5ffae013 --- /dev/null +++ b/project/exp1/raw_exp_20240909-060027-bee84199.yaml @@ -0,0 +1,122 @@ +id: conv-20240909-060027-8372548e +plugins: [] +roles: [] +enabled: true +rounds: +- id: round-20240909-060037-05d0804a + user_query: echo "maga"! + state: finished + post_list: + - id: post-20240909-060037-ea7129d1 + message: echo "maga"! + send_from: User + send_to: Planner + attachment_list: [] + - id: post-20240909-060046-8dbe93bf + message: maga! + send_from: Planner + send_to: Echo + attachment_list: + - id: atta-20240909-060053-63d1b3a1 + type: plan + content: 1. Ask Echo to echo the user's input, 'maga!' + extra: null + - id: post-20240909-060056-368acc3b + message: maga! + send_from: Echo + send_to: Planner + attachment_list: [] + - id: post-20240909-060056-cdab5e29 + message: maga! + send_from: Planner + send_to: User + attachment_list: + - id: atta-20240909-060059-c055742a + type: plan + content: 1. Ask Echo to echo the user's input, 'maga!' + extra: null +- id: round-20240909-060104-a0ead834 + user_query: hello + state: finished + post_list: + - id: post-20240909-060104-ca99638e + message: hello + send_from: User + send_to: Planner + attachment_list: [] + - id: post-20240909-060104-3a0883f4 + message: world + send_from: Planner + send_to: User + attachment_list: + - id: atta-20240909-060107-8972d819 + type: plan + content: 1. Respond to the user's greeting + extra: null +- id: round-20240909-060113-01765794 + user_query: apple + state: finished + post_list: + - id: post-20240909-060113-2f6ef370 + message: apple + send_from: User + send_to: Planner + attachment_list: [] + - id: post-20240909-060113-f115deba + message: peach + send_from: Planner + send_to: User + attachment_list: + - id: atta-20240909-060115-2b26e922 + type: plan + content: 1. Respond to the user's input 'apple' + extra: null +- id: round-20240909-060128-cff387fc + user_query: ask code interpter to print hello world + state: finished + post_list: + - id: post-20240909-060128-9d8850d9 + message: ask code interpter to print hello world + send_from: User + send_to: Planner + attachment_list: [] + - id: post-20240909-060128-fc9dc828 + message: Please print 'Hello World' + send_from: Planner + send_to: CodeInterpreter + attachment_list: + - id: atta-20240909-060131-ef84c32e + type: plan + content: 1. Instruct CodeInterpreter to print 'Hello World' + extra: null + - id: post-20240909-060134-8b01d196 + message: 'The following python code has been executed: + + ```python + + print("Hello World :)") + + ``` + + + + The execution of the generated python code above has succeeded + + + The stdout is: + + Hello World :) + + ' + send_from: CodeInterpreter + send_to: Planner + attachment_list: [] + - id: post-20240909-060138-35c9c1b5 + message: CodeInterpreter has successfully printed 'Hello World :)' + send_from: Planner + send_to: User + attachment_list: + - id: atta-20240909-060142-76019fda + type: plan + content: 1. Instruct CodeInterpreter to print 'Hello World' + extra: null diff --git a/project/exp2/sub_exp/exp_3.yaml b/project/exp2/sub_exp/exp_3.yaml new file mode 100644 index 00000000..ee457366 --- /dev/null +++ b/project/exp2/sub_exp/exp_3.yaml @@ -0,0 +1,773 @@ +exp_id: 3 +experience_text: when print "hello world", add ":)" at the end. +raw_experience_path: null +embedding_model: all-mpnet-base-v2 +embedding: +- 0.023647969588637352 +- -0.06699104607105255 +- 0.026490386575460434 +- 0.013333769515156746 +- 0.07264811545610428 +- 0.025502655655145645 +- -0.022705063223838806 +- -0.0037680407986044884 +- -0.006599642336368561 +- 0.03579946607351303 +- -0.0019424272468313575 +- 0.015122786164283752 +- 0.016950739547610283 +- 0.03661608323454857 +- 0.0287507101893425 +- -0.02064850740134716 +- 0.028487898409366608 +- 0.01534595713019371 +- -0.022608354687690735 +- 0.0024748079013079405 +- -0.00843294057995081 +- 0.06407760083675385 +- -0.010757122188806534 +- 0.030830606818199158 +- 0.025880182161927223 +- -0.007216230966150761 +- -0.022689033299684525 +- -0.01660372130572796 +- 0.01570126973092556 +- -0.04894566908478737 +- -0.008977293036878109 +- -0.020179422572255135 +- 0.0059577589854598045 +- -0.005190636031329632 +- 1.5489948737013037e-06 +- -0.04522012546658516 +- -0.012999712489545345 +- 0.024831244722008705 +- -0.032739635556936264 +- 0.012072871439158916 +- 0.025547968223690987 +- 0.057359762489795685 +- 0.013172680512070656 +- 0.014332137070596218 +- 0.031837109476327896 +- 0.0074957506731152534 +- 0.04590829834342003 +- 0.009592466987669468 +- 0.02685278095304966 +- 0.04193970933556557 +- 0.023376429453492165 +- -0.005582902580499649 +- 0.036251988261938095 +- -0.029845906421542168 +- 0.05725118890404701 +- 0.051108695566654205 +- -0.038331564515829086 +- -0.028968721628189087 +- -0.019173514097929 +- 0.02340221218764782 +- 0.01310095563530922 +- 0.019173305481672287 +- -0.01977192610502243 +- -0.022274140268564224 +- -0.008169521577656269 +- 0.026858370751142502 +- 0.03179169073700905 +- -0.06561122089624405 +- 0.016383253037929535 +- 0.05293712392449379 +- 0.046275120228528976 +- -0.027528584003448486 +- -0.0031661870889365673 +- 0.012217619456350803 +- 0.001754899974912405 +- -0.09870275110006332 +- -0.053444039076566696 +- -0.028401395305991173 +- 0.011324216611683369 +- 0.012155933305621147 +- -0.027337852865457535 +- 0.00949719175696373 +- -0.03255042806267738 +- -0.0071402909234166145 +- -0.05373576655983925 +- 0.022565867751836777 +- -0.015962541103363037 +- -0.04552825912833214 +- -0.02508155256509781 +- 0.035370808094739914 +- 0.006122989114373922 +- 0.05878908559679985 +- -0.01891448348760605 +- 0.008765354752540588 +- 0.055245574563741684 +- 0.011633289977908134 +- 0.008428278379142284 +- -0.006855460815131664 +- 0.035383518785238266 +- -0.01702948659658432 +- -0.039022691547870636 +- -0.012881919741630554 +- 0.010117867030203342 +- 0.01150472741574049 +- -0.014843175187706947 +- -0.059077344834804535 +- 0.06398797035217285 +- 0.019811412319540977 +- 0.04800045117735863 +- 0.005025487393140793 +- 0.02101411297917366 +- -0.03275725245475769 +- 0.039893683046102524 +- 0.03219442814588547 +- 0.042239710688591 +- -0.013889599591493607 +- -0.004417693242430687 +- -0.0007103093666955829 +- 0.057016197592020035 +- 0.00695951608940959 +- 0.037476442754268646 +- 0.005961423274129629 +- -0.0042409091256558895 +- 0.03411049395799637 +- -0.030116742476820946 +- -0.03227858990430832 +- 0.05607235059142113 +- -0.003884766483679414 +- -0.03425878286361694 +- -0.018665313720703125 +- -0.012080349959433079 +- 0.03289390727877617 +- 0.02498440258204937 +- -0.0012517152354121208 +- -0.04078954458236694 +- 0.09917409718036652 +- -0.019405441358685493 +- -0.014351562596857548 +- 0.08764803409576416 +- 0.036339327692985535 +- -0.04055468738079071 +- -0.023806553333997726 +- 0.042050283402204514 +- -0.00043262646067887545 +- 0.008542581461369991 +- 0.007916952483355999 +- 0.06382283568382263 +- 0.10206150263547897 +- 0.02080509625375271 +- -0.02892816811800003 +- 0.03056088276207447 +- 0.09243138134479523 +- -0.1262265294790268 +- -0.0028156517073512077 +- 0.03338947892189026 +- -0.02520628646016121 +- 0.07362597435712814 +- -0.07512447237968445 +- -0.01896696351468563 +- -0.022038811817765236 +- 0.01136830635368824 +- -0.009068546816706657 +- -0.012632768601179123 +- -0.021844616159796715 +- 0.05728274583816528 +- -0.023315362632274628 +- 0.012827320024371147 +- -0.016910141333937645 +- -0.017458250746130943 +- -0.041368886828422546 +- 0.0229178573936224 +- -0.0027960550505667925 +- 0.010831696912646294 +- 0.050911106169223785 +- -0.04944615066051483 +- -0.006444724276661873 +- -0.04826412349939346 +- -0.03174629062414169 +- 0.026668056845664978 +- 0.009024680592119694 +- -0.04147907346487045 +- 0.0003156719612888992 +- -0.0697779729962349 +- -0.04077934846282005 +- -0.03872134909033775 +- 0.040947671979665756 +- 0.015262225642800331 +- -0.002363906940445304 +- -0.00525589007884264 +- 0.015777062624692917 +- 0.030420364812016487 +- 0.035329826176166534 +- 0.0011872225441038609 +- -0.017272260040044785 +- 0.022768797352910042 +- 0.03165746480226517 +- -0.016481224447488785 +- -0.003524100175127387 +- 0.027803046628832817 +- -0.029728733003139496 +- 0.0010200351243838668 +- -0.06040525063872337 +- 0.03241315111517906 +- 0.02583557553589344 +- 0.013113876804709435 +- 0.04248172044754028 +- 0.04338715225458145 +- -0.017721371725201607 +- -0.03173799067735672 +- 0.02079116180539131 +- -0.012789960950613022 +- 0.006817546207457781 +- 0.027119368314743042 +- 0.04638398066163063 +- -0.004429249558597803 +- 0.018438953906297684 +- 0.02299366146326065 +- 0.03514427691698074 +- 0.05477634444832802 +- 0.0564679317176342 +- 0.05178668722510338 +- 0.005133605096489191 +- 0.03745915740728378 +- 0.045055024325847626 +- 0.017856843769550323 +- -0.08919542282819748 +- -0.022339586168527603 +- 0.040954604744911194 +- -0.026231208816170692 +- 0.02504633739590645 +- -0.05594286322593689 +- 0.05739277973771095 +- -0.0001560598029755056 +- 0.033202238380908966 +- -0.028082195669412613 +- 0.006948388647288084 +- -0.05147198960185051 +- -0.09190408885478973 +- 0.024752942845225334 +- -0.05387328937649727 +- -0.018917344510555267 +- 0.04030332714319229 +- 0.02740936167538166 +- 0.029675070196390152 +- 0.021227095276117325 +- 0.014755443669855595 +- 0.029426341876387596 +- 0.008126544766128063 +- 0.06584704667329788 +- 0.026027893647551537 +- -0.004889408592134714 +- 0.014068913646042347 +- -0.06363003700971603 +- -0.03655213490128517 +- -0.032220132648944855 +- -0.04560035839676857 +- 0.03356119617819786 +- -0.04195208102464676 +- -0.06842205673456192 +- -0.036074135452508926 +- 0.09954603016376495 +- 0.0029158752877265215 +- 0.0043912287801504135 +- 0.04374042898416519 +- 0.08303333818912506 +- 0.059720490127801895 +- -0.05991696938872337 +- -0.05198970437049866 +- -0.03306231647729874 +- 0.036187026649713516 +- -0.016350755468010902 +- -0.003349152859300375 +- -0.019396506249904633 +- -0.017889998853206635 +- 0.01733621023595333 +- -0.008317309431731701 +- -0.0018689362332224846 +- 0.018778586760163307 +- 0.03452446311712265 +- 0.043253570795059204 +- -0.02563333883881569 +- -0.007544731255620718 +- -0.02965470962226391 +- -0.043263405561447144 +- 0.009261886589229107 +- -0.02964804507791996 +- 0.005921342875808477 +- -0.06508436053991318 +- -0.007346277125179768 +- -0.003947784658521414 +- 0.0008750561974011362 +- -0.03456665948033333 +- -0.002786778612062335 +- -0.02522152103483677 +- 0.006268075667321682 +- -0.02771187759935856 +- -0.06576161086559296 +- 0.029843980446457863 +- -0.0013061389327049255 +- -0.006519871298223734 +- 5.3496347391046584e-05 +- -0.0025294863153249025 +- -0.053240593522787094 +- 0.03631047159433365 +- -0.04266117885708809 +- 0.014763470739126205 +- 0.0501873679459095 +- -0.04871668666601181 +- 0.007149228360503912 +- 0.04351523146033287 +- 0.015139073133468628 +- 0.022989042103290558 +- -0.021512819454073906 +- 0.03189275041222572 +- 0.018044717609882355 +- -0.04567403346300125 +- -0.05525405332446098 +- -0.01900695636868477 +- 0.016673434525728226 +- -0.017750252038240433 +- 0.02105524390935898 +- -0.018439028412103653 +- 0.023308226838707924 +- -0.042095016688108444 +- -0.03443186357617378 +- 0.05279696732759476 +- 0.01577943190932274 +- -0.01506796758621931 +- 0.012787357904016972 +- -0.028777187690138817 +- -0.011992817744612694 +- 0.044704634696245193 +- -0.07332193106412888 +- 0.0029408850241452456 +- 0.0001943765237228945 +- 0.009294100105762482 +- 0.05569850280880928 +- -0.04493540897965431 +- 0.0562814399600029 +- -0.018798045814037323 +- -0.01121372077614069 +- -0.04353370890021324 +- -0.008234033361077309 +- -0.013494164682924747 +- -0.06099751219153404 +- -0.012683073990046978 +- -0.022936437278985977 +- -0.026702530682086945 +- -0.03094605915248394 +- 0.03197716921567917 +- 0.03598514944314957 +- -0.042919352650642395 +- -0.048924241214990616 +- 0.0035544848069548607 +- 0.017668087035417557 +- -0.06508690863847733 +- 0.00866837427020073 +- -0.05150257796049118 +- 0.014135189354419708 +- -0.023493962362408638 +- 0.05377325788140297 +- -0.052736103534698486 +- -0.07926781475543976 +- 0.04874742776155472 +- 0.056367695331573486 +- 0.01970135048031807 +- -0.040096648037433624 +- 0.04523846507072449 +- -0.0228949636220932 +- -0.014423024840652943 +- -0.00615393603220582 +- 0.007589769084006548 +- 0.0034514639992266893 +- 0.03881969675421715 +- -0.02454245649278164 +- 0.04858333244919777 +- 0.019037578254938126 +- -0.0001557262148708105 +- 0.008079594932496548 +- -0.06151853874325752 +- -0.024467846378684044 +- -0.011362985707819462 +- -0.018902773037552834 +- -0.021968143060803413 +- 0.04560081288218498 +- 0.02823130041360855 +- 0.049475569278001785 +- 0.002960345707833767 +- -0.03748640790581703 +- -0.029717426747083664 +- 0.0013365313643589616 +- -0.07171782106161118 +- -0.05034836381673813 +- -0.024924933910369873 +- -0.02358253300189972 +- 0.01769520342350006 +- 0.028169400990009308 +- -0.019453542307019234 +- -0.01471041887998581 +- -0.017291534692049026 +- 0.010128832422196865 +- 0.0315534844994545 +- 0.015503053553402424 +- -0.02324424311518669 +- 0.09062881767749786 +- 0.0048804813995957375 +- 0.09838959574699402 +- 0.024319283664226532 +- 0.02750607579946518 +- 0.011812349781394005 +- 0.011246902868151665 +- 0.016758162528276443 +- 0.009026558138430119 +- 0.008039970882236958 +- 0.00931618083268404 +- -0.05853959172964096 +- 0.00013269724149722606 +- -0.013102443888783455 +- -0.02270873263478279 +- 0.01214159931987524 +- 0.00015548865485470742 +- 0.022333018481731415 +- -0.044126637279987335 +- 0.033776380121707916 +- 0.0043291025795042515 +- -0.016874045133590698 +- 0.0531545914709568 +- -0.0024485494941473007 +- -0.016678255051374435 +- -0.0037788066547363997 +- -0.009139078669250011 +- -0.07009334117174149 +- 0.014182495884597301 +- 0.025277312844991684 +- -0.00864940881729126 +- -0.0011112720239907503 +- -0.06421687453985214 +- -0.044857826083898544 +- -0.03403536230325699 +- -0.004954355303198099 +- -0.000996691407635808 +- 0.045491572469472885 +- -0.0199164766818285 +- -0.03631591796875 +- -0.007574436254799366 +- 0.04415115341544151 +- 0.03248235955834389 +- -0.013249599374830723 +- -0.06358231604099274 +- -0.04904785752296448 +- -0.05942308530211449 +- -0.055287525057792664 +- -0.003231668844819069 +- -0.08443249017000198 +- -0.0017650972586125135 +- 0.016616573557257652 +- 0.036932822316884995 +- -0.09925613552331924 +- -0.027785152196884155 +- -0.038582656532526016 +- 0.02681993693113327 +- 0.009034210816025734 +- -0.01593759097158909 +- -0.06785503774881363 +- -0.022210625931620598 +- -0.024103360250592232 +- 0.06671728938817978 +- 0.03491780534386635 +- 0.018026474863290787 +- -0.02052195556461811 +- 0.010637333616614342 +- 0.00824712309986353 +- -0.014377336949110031 +- 0.016102822497487068 +- -0.05635799467563629 +- -0.03250807151198387 +- -0.05990437790751457 +- -0.02493998408317566 +- -0.10304346680641174 +- -0.027277104556560516 +- 0.046187590807676315 +- 0.0104141840711236 +- -0.045448221266269684 +- -0.042361270636320114 +- -0.0047792294062674046 +- -0.01620299369096756 +- -0.0374755859375 +- -0.006525077391415834 +- 0.005457844119518995 +- 0.006595294922590256 +- -0.03853338584303856 +- 0.008090266957879066 +- 0.032346099615097046 +- -0.05349979177117348 +- -0.05923490971326828 +- 0.060188423842191696 +- 0.054021891206502914 +- -0.035707127302885056 +- 0.0015420319978147745 +- 0.02762061171233654 +- 0.06390834599733353 +- 0.012838046066462994 +- -0.07547629624605179 +- 0.01782052218914032 +- 0.04316016659140587 +- -0.04153606668114662 +- 0.02578345686197281 +- -0.014199216850101948 +- -0.02333952486515045 +- -0.0004302052839193493 +- 0.03865307942032814 +- 0.01549230981618166 +- -0.0069337510503828526 +- -0.047033801674842834 +- -0.014476099982857704 +- 0.07541544735431671 +- 0.0004473808512557298 +- 0.026116859167814255 +- -0.039203159511089325 +- 0.019973978400230408 +- 0.015353531576693058 +- 0.0011661675525829196 +- 0.018275128677487373 +- -0.02201635017991066 +- -0.01522282138466835 +- -0.013238429091870785 +- -0.014821577817201614 +- -0.0013655922375619411 +- -0.038537587970495224 +- 0.008494322188198566 +- 0.010665830224752426 +- -0.025086289271712303 +- 0.0847599059343338 +- -0.008123155683279037 +- -0.03822917491197586 +- 0.01778198964893818 +- 0.06318674236536026 +- 0.027301739901304245 +- 0.017049213871359825 +- 0.04797408729791641 +- 0.041632119566202164 +- -0.04480177164077759 +- -0.013540055602788925 +- 0.011395737528800964 +- -0.004419302102178335 +- 0.028964001685380936 +- 0.02115786448121071 +- -0.027285104617476463 +- -0.04166306555271149 +- -0.03587403520941734 +- 0.041929107159376144 +- 0.07041016221046448 +- 0.06947541236877441 +- 0.009396318346261978 +- 0.007558135315775871 +- -4.665459201912917e-33 +- -0.09207778424024582 +- -0.037035852670669556 +- -0.03397854045033455 +- 0.009481784887611866 +- -0.006117627024650574 +- 0.0176729504019022 +- 0.01619536802172661 +- 0.04649313911795616 +- 0.01731838844716549 +- 0.010544701479375362 +- -0.024344366043806076 +- -0.013100150972604752 +- 0.012487337924540043 +- -0.02991599403321743 +- -0.05605403333902359 +- 0.002820769092068076 +- 0.06319424510002136 +- 0.017878703773021698 +- 0.007595762610435486 +- 0.016323747113347054 +- -0.01426068414002657 +- -0.006187396124005318 +- 0.042504169046878815 +- 0.007422230206429958 +- 0.046938586980104446 +- -0.023112459108233452 +- -0.08439762890338898 +- -0.007399159017950296 +- 0.04498773440718651 +- -0.012089265510439873 +- -0.023740673437714577 +- -0.02906077355146408 +- -0.014017249457538128 +- 0.09799429029226303 +- -0.020228911191225052 +- 0.06181029975414276 +- -0.010676661506295204 +- -0.02813793160021305 +- 0.009677990339696407 +- -0.02478334680199623 +- 0.03494333475828171 +- 0.01852623000741005 +- -0.03871740773320198 +- -0.008425893262028694 +- 0.025788292288780212 +- 0.038793087005615234 +- 0.030802465975284576 +- 0.05345524102449417 +- 0.020154684782028198 +- 0.025192473083734512 +- -0.030543508008122444 +- 0.010783430188894272 +- 0.005537064280360937 +- -0.06725859642028809 +- -0.1072763130068779 +- -0.0007889792323112488 +- 0.0023686655331403017 +- -0.04509982094168663 +- -0.038918279111385345 +- 0.0387057326734066 +- 0.09877839684486389 +- -0.008087996393442154 +- 0.003774310927838087 +- 0.02098446525633335 +- -0.008655812591314316 +- 0.03179642930626869 +- 0.004677895922213793 +- 0.08736427128314972 +- -0.039624568074941635 +- -0.013641497120261192 +- 0.034147001802921295 +- -2.4649112674524076e-05 +- 0.009755458682775497 +- 0.0018330244347453117 +- -0.019866254180669785 +- 0.031721584498882294 +- -0.04608422890305519 +- 0.0012359495740383863 +- 0.013341939076781273 +- -0.019285328686237335 +- -0.021651338785886765 +- -0.02204015478491783 +- -0.03958950564265251 +- -0.03456680104136467 +- 0.007871673442423344 +- 0.007919060066342354 +- 0.03800927475094795 +- -0.015154007822275162 +- -0.016564369201660156 +- 0.012888561002910137 +- -0.02069621905684471 +- -0.02939559891819954 +- 0.0003189573180861771 +- -0.022446870803833008 +- -0.062365565448999405 +- -0.010836339555680752 +- -0.00906467903405428 +- -0.05984185263514519 +- -0.07137075811624527 +- -0.02126775123178959 +- -0.05340132489800453 +- -0.013168694451451302 +- -0.010444628074765205 +- 0.00344151072204113 +- 0.04687386006116867 +- 0.05060546100139618 +- -0.0181451253592968 +- -0.02159814164042473 +- -0.03558919206261635 +- -0.015937285497784615 +- 0.04445328190922737 +- 0.010268966667354107 +- 0.030854331329464912 +- 0.0006580561748705804 +- 0.015207369811832905 +- -0.014253402128815651 +- -0.02257111854851246 +- 0.0013478342443704605 +- -0.010952959768474102 +- -0.0328119695186615 +- -0.0008623320027254522 +- 0.023091087117791176 +- 0.037236277014017105 +- 0.03879738226532936 +- -0.07142169773578644 +- -0.03222329169511795 +- -0.031002892181277275 +- 8.296631131088361e-05 +- 0.029117098078131676 +- -0.029697803780436516 +- -0.015380283817648888 +- -0.032827965915203094 +- 2.211369007909525e-07 +- 0.009894445538520813 +- -0.022480148822069168 +- 0.06068386882543564 +- 0.03662610426545143 +- -0.01135424617677927 +- 0.03843483701348305 +- 0.033573735505342484 +- 0.07217518985271454 +- -0.020257893949747086 +- 0.054246049374341965 +- 0.004983620252460241 +- -0.02957138419151306 +- 0.034587837755680084 +- -0.040918707847595215 +- -0.08170808106660843 +- 0.05125834047794342 +- -0.07571951299905777 +- 0.04547373205423355 +- -0.00038312748074531555 +- 0.018519442528486252 +- 0.011552835814654827 +- -0.015642188489437103 +- -0.017755979672074318 +- 0.038084376603364944 +- 0.004508016165345907 +- -0.03471803292632103 +- -0.01703125238418579 +- 0.006085297092795372 +- -0.004077882971614599 +- -0.02057558111846447 +- -0.05940168350934982 +- -0.04311370477080345 +- 0.0451522096991539 +- -0.05290566012263298 +- -0.010352851822972298 +- -0.013663693331182003 +- 0.053201496601104736 +- 0.03423302620649338 +- 0.0057129161432385445 +- 0.07225050032138824 +- 0.028867142274975777 +- 0.06187751144170761 +- -0.007683475036174059 +- -0.07758203893899918 +- 0.028780145570635796 +- 0.015536436811089516 +- 0.02360416390001774 +- 0.007105186115950346 +- 0.014292426407337189 +- -0.018409261479973793 +- 0.006786591839045286 +- -0.0675104632973671 +- -0.010684511624276638 +- -0.005805912893265486 +- -0.002070970833301544 +- 0.017903372645378113 +- 0.029349613934755325 +- -0.02315070480108261 +- -0.057336561381816864 +- -0.06601695716381073 +- 0.0038525122217833996 +- -0.07616522908210754 +- 0.03188705816864967 +- -0.00038399893674068153 +- 0.06459735333919525 +- 0.013434529304504395 +- 0.03839268535375595 +- 1.8706440573451636e-34 +- -0.007212114054709673 +- 0.03210149705410004 +- 0.02112351357936859 +- 0.03680972754955292 +- -0.013683917932212353 +- 0.012538144364953041 +- 0.014851651154458523 +- 0.010223165154457092 +- 0.05871982127428055 +- 0.0004368910158518702 +- -0.01793687604367733 diff --git a/project/exp2/sub_exp/handcrafted_exp_3.yaml b/project/exp2/sub_exp/handcrafted_exp_3.yaml new file mode 100644 index 00000000..7f626b33 --- /dev/null +++ b/project/exp2/sub_exp/handcrafted_exp_3.yaml @@ -0,0 +1,2 @@ +exp_id: 3 +experience_text: when print "hello world", add ":)" at the end. \ No newline at end of file diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator.py b/taskweaver/code_interpreter/code_interpreter/code_generator.py index 2963b0fc..64909d1d 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator.py +++ b/taskweaver/code_interpreter/code_interpreter/code_generator.py @@ -1,7 +1,7 @@ import datetime import json import os -from typing import List, Optional +from typing import List, Optional, Tuple from injector import inject @@ -55,16 +55,6 @@ def _configure(self) -> None: ) self.auto_plugin_selection_topk = self._get_int("auto_plugin_selection_topk", 3) - self.use_experience = self._get_bool("use_experience", False) - self.experience_dir = self._get_path( - "experience_dir", - os.path.join( - self.src.app_base_path, - "experience", - ), - ) - self.dynamic_experience_sub_path = self._get_bool("dynamic_experience_sub_path", False) - self.llm_alias = self._get_str("llm_alias", default="", required=False) @@ -113,27 +103,9 @@ def __init__( self.selected_plugin_pool = SelectedPluginPool() self.experience_generator = experience_generator - self.experience_loaded_from = None self.logger.info("CodeGenerator initialized successfully") - def load_experience(self, sub_path: str = ""): - load_from = os.path.join(self.config.experience_dir, sub_path) - if self.experience_loaded_from is None or self.experience_loaded_from != load_from: - self.experience_loaded_from = load_from - self.experience_generator.set_experience_dir(self.config.experience_dir) - self.experience_generator.set_sub_path(sub_path) - self.experience_generator.refresh() - self.experience_generator.load_experience() - self.logger.info( - "Experience loaded successfully, there are {} experiences with filter [{}]".format( - len(self.experience_generator.experience_list), - sub_path, - ), - ) - else: - self.logger.info(f"Experience already loaded from {load_from}.") - def configure_verification( self, code_verification_on: bool, @@ -185,15 +157,11 @@ def compose_prompt( self, rounds: List[Round], plugins: List[PluginEntry], - selected_experiences: Optional[List[Experience]] = None, + selected_experiences: Optional[List[Tuple[Experience, float]]] = None, ) -> List[ChatMessageType]: - experiences = ( - self.experience_generator.format_experience_in_prompt( - self.prompt_data["experience_instruction"], - selected_experiences, - ) - if self.config.use_experience - else "" + experiences = self.format_experience( + template=self.prompt_data["experience_instruction"], + experiences=selected_experiences, ) chat_history = [ @@ -389,18 +357,13 @@ def reply( if self.config.enable_auto_plugin_selection: self.plugin_pool = self.select_plugins_for_prompt(query) - if self.config.use_experience: - if not self.config.dynamic_experience_sub_path: - self.load_experience() - else: - exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_sub_path) - if exp_sub_path: - self.load_experience(exp_sub_path[0]) - self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) - - selected_experiences = self.experience_generator.retrieve_experience(query) + exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType._signal_exp_sub_path) + if exp_sub_path: + self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) + exp_sub_path = exp_sub_path[0] else: - selected_experiences = None + exp_sub_path = "" + selected_experiences = self.load_experience(query=query, sub_path=exp_sub_path) prompt = self.compose_prompt(rounds, self.plugin_pool, selected_experiences) self.tracing.set_span_attribute("prompt", json.dumps(prompt, indent=2)) diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml b/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml index 4d394d76..a1cfc5e1 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml +++ b/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml @@ -97,6 +97,6 @@ requirements: |- experience_instruction: |- ## Experience And Lessons - Before generating Python code, please refer to the experiences and lessons learned from the previous tasks: + Before generating code, please learn from the following past experiences and lessons: {experiences} - You must use the experiences and lessons learned to generate the Python code. + You must apply them in code generation. diff --git a/taskweaver/memory/attachment.py b/taskweaver/memory/attachment.py index 67b1c82a..7ef94f48 100644 --- a/taskweaver/memory/attachment.py +++ b/taskweaver/memory/attachment.py @@ -47,7 +47,7 @@ class AttachmentType(Enum): # signal signal = "signal" - exp_sub_path = "exp_sub_path" + _signal_exp_sub_path = "_signal_exp_sub_path" @dataclass diff --git a/taskweaver/planner/planner.py b/taskweaver/planner/planner.py index 93746f00..86f688d9 100644 --- a/taskweaver/planner/planner.py +++ b/taskweaver/planner/planner.py @@ -49,17 +49,6 @@ def _configure(self) -> None: ), ) - # experience related - self.use_experience = self._get_bool("use_experience", False) - self.experience_dir = self._get_path( - "experience_dir", - os.path.join( - app_dir, - "experience", - ), - ) - self.dynamic_experience_sub_path = self._get_bool("dynamic_experience_sub_path", False) - self.llm_alias = self._get_str("llm_alias", default="", required=False) @@ -114,23 +103,6 @@ def __init__( self.logger.info("Planner initialized successfully") - def load_experience(self, sub_path: str = ""): - load_from = os.path.join(self.config.experience_dir, sub_path) - if self.experience_loaded_from is None or self.experience_loaded_from != load_from: - self.experience_loaded_from = load_from - self.experience_generator.set_experience_dir(self.config.experience_dir) - self.experience_generator.set_sub_path(sub_path) - self.experience_generator.refresh() - self.experience_generator.load_experience() - self.logger.info( - "Experience loaded successfully, there are {} experiences with filter [{}]".format( - len(self.experience_generator.experience_list), - sub_path, - ), - ) - else: - self.logger.info(f"Experience already loaded from {load_from}.") - def compose_sys_prompt(self, context: str): worker_description = "" for alias, role in self.workers.items(): @@ -240,13 +212,9 @@ def compose_prompt( rounds: List[Round], selected_experiences: Optional[List[Tuple[Experience, float]]] = None, ) -> List[ChatMessageType]: - experiences = ( - self.experience_generator.format_experience_in_prompt( - self.prompt_data["experience_instruction"], - selected_experiences, - ) - if self.config.use_experience - else "" + experiences = self.format_experience( + template=self.prompt_data["experience_instruction"], + experiences=selected_experiences, ) chat_history = [ @@ -297,18 +265,13 @@ def reply( self.tracing.set_span_attribute("user_query", user_query) self.tracing.set_span_attribute("use_experience", self.config.use_experience) - if self.config.use_experience: - if not self.config.dynamic_experience_sub_path: - self.load_experience() - else: - exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType.exp_sub_path) - if exp_sub_path: - self.load_experience(exp_sub_path[0]) - self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) - - selected_experiences = self.experience_generator.retrieve_experience(user_query) + exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType._signal_exp_sub_path) + if exp_sub_path: + self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) + exp_sub_path = exp_sub_path[0] else: - selected_experiences = None + exp_sub_path = "" + selected_experiences = self.load_experience(query=user_query, sub_path=exp_sub_path) post_proxy = self.event_emitter.create_post_proxy(self.alias) diff --git a/taskweaver/role/role.py b/taskweaver/role/role.py index f1638c00..54c8bffa 100644 --- a/taskweaver/role/role.py +++ b/taskweaver/role/role.py @@ -10,6 +10,7 @@ from taskweaver.config.module_config import ModuleConfig from taskweaver.logging import TelemetryLogger from taskweaver.memory import Memory, Post +from taskweaver.memory.experience import Experience, ExperienceGenerator from taskweaver.misc.component_registry import ComponentRegistry from taskweaver.module.event_emitter import SessionEventEmitter from taskweaver.module.tracing import Tracing @@ -41,8 +42,26 @@ def from_yaml_file(file_path: str): class RoleConfig(ModuleConfig): @inject def __init__(self, src: AppConfigSource) -> None: + super().__init__(src) self.src: AppConfigSource = src self._set_role_name() + + self.use_experience = self._get_bool( + "use_experience", + False, + ) + self.experience_dir = self._get_path( + "experience_dir", + os.path.join( + self.src.app_base_path, + "experience", + ), + ) + self.dynamic_experience_sub_path = self._get_bool( + "dynamic_experience_sub_path", + False, + ) + self._configure() def _set_role_name(self): @@ -56,7 +75,7 @@ class Role: @inject def __init__( self, - config: ModuleConfig, + config: RoleConfig, logger: TelemetryLogger, tracing: Tracing, event_emitter: SessionEventEmitter, @@ -84,6 +103,9 @@ def __init__( self.alias: str = self.role_entry.alias if self.role_entry else "" self.intro: str = self.role_entry.intro if self.role_entry else "" + self.experience_loaded_from: Optional[str] = None + self.experience_generator: Optional[ExperienceGenerator] = None + def get_intro(self) -> str: return self.intro @@ -99,6 +121,53 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: def close(self) -> None: self.logger.info(f"{self.alias} closed successfully") + def load_experience(self, query: str, sub_path: str = "") -> List[Tuple[Experience, float]]: + if self.experience_generator is None: + raise ValueError("Experience generator is not initialized.") + + if self.config.use_experience: + if not self.config.dynamic_experience_sub_path: + self._load_experience() + elif sub_path: + self._load_experience(sub_path=sub_path) + else: + # if sub_path is empty, experience should not have been loaded + assert self.experience_loaded_from is None, "Experience loaded from is not None" + + return self.experience_generator.retrieve_experience(query) + else: + return [] + + def _load_experience(self, sub_path: str = "") -> None: + load_from = os.path.join(self.config.experience_dir, sub_path) + if self.experience_loaded_from is None or self.experience_loaded_from != load_from: + self.experience_loaded_from = load_from + self.experience_generator.set_experience_dir(self.config.experience_dir) + self.experience_generator.set_sub_path(sub_path) + self.experience_generator.refresh() + self.experience_generator.load_experience() + self.logger.info( + "Experience loaded successfully for {}, there are {} experiences with filter [{}]".format( + self.alias, + len(self.experience_generator.experience_list), + sub_path, + ), + ) + else: + self.logger.info(f"Experience already loaded from {load_from}.") + + def format_experience(self, template: str, experiences: Optional[List[Tuple[Experience, float]]]) -> str: + experiences_str = ( + self.experience_generator.format_experience_in_prompt( + template, + experiences, + ) + if self.config.use_experience + else "" + ) + + return experiences_str + class RoleModuleConfig(ModuleConfig): def _configure(self) -> None: diff --git a/tests/unit_tests/data/prompts/planner_prompt.yaml b/tests/unit_tests/data/prompts/planner_prompt.yaml index ee885d99..7de60a60 100644 --- a/tests/unit_tests/data/prompts/planner_prompt.yaml +++ b/tests/unit_tests/data/prompts/planner_prompt.yaml @@ -107,9 +107,10 @@ instruction_template: |- experience_instruction: |- # Experience And Lessons - Before starting planning, please refer to the following experiences and lessons learned from the previous tasks and include them in your plan. + Before planning, please learn from the following past experiences: {experiences} - You need to borrow the experience and lessons learned from the previous tasks in your current plan. + You must apply them in planning. + response_json_schema: |- { diff --git a/website/blog/experience.md b/website/blog/experience.md new file mode 100644 index 00000000..b1c1d33c --- /dev/null +++ b/website/blog/experience.md @@ -0,0 +1,123 @@ +# Experience selection + +We have introduced the motivation of the `experience` module in [Experience](/docs/customization/experience/experience) +and how to create a handcrafted experience in [Handcrafted Experience](/docs/customization/experience/handcrafted_experience). +In this blog post, we discuss more advanced topics about the experience module on experience selection. + +## Static experience selection + +Every role in TaskWeaver can configure its own experience directory, which can be configured +by setting the `role_name.experience_dir` field in the project configuration file. +For the `Planner` and `CodeInterpreter` roles, you can configure the experience directory +by setting the `planner.experience_dir` and `code_interpreter.experience_dir` fields respectively. +The default experience directory is `experience` in the project directory. + + + +:::info +The role name is by default the name of the implementation file of the role unless +you have specified the role name by calling `_set_name` in the implementation file. +::: + +By configuring different experience directories for different roles, +you can have different experiences for different roles in a static way. +Use the `Planner` role as an example, you can have the following project configuration file +to enable the experience selection for the `Planner` role. + +```json +{ + "planner.use_experience": true, + "planner.experience_dir": "planner_exp_dir" +} +``` + +## Dynamic experience selection + +In some cases, you may want to select the experience dynamically based on the input task. +In TaskWeaver, although we retrieve the experience based on the query content, +it is sometimes difficult to obtain the right experience based solely on the similarity +between the query content and the experience content. + +One real example we encountered is that we need to retrieve the experience based on the +task type. We have many task types in the project, let's say `task_type_1`, `task_type_2`, and `task_type_3`. +Every task type is about following a set of instructions to complete a task. +Although different task types have different instructions, the instructions are similar in structure. +For example, they all have similar steps like `step_1`, `step_2`, and `step_3`, only +the content of the steps is slightly different for different task types. +Actually, even most of the step titles are the same for different task types. + +Each task type has its own experience, and we want to select the experience based on the task type. +Even though we can mix all the experiences into one experience directory, it is very hard +to differentiate the experiences based on the user input or the step content. +In this project, the user input is simply a task ID, and we need to first figure out the task type based on the task ID, +and then select the experience based on the task type. + +To achieve this, we add a layer in the experience selection process. Specifically, we allow +having subdirectories in the experience directory. +For example, we can have the following experience directory structure: + +``` +planner_experience +├── task_type_1 +│ ├── exp_1.yaml +│ ├── exp_2.yaml +│ └── ... +``` + +When we can identify the task type based on the task ID, we can set the experience subdirectory. +This looks straightforward, but how can we set the experience subdirectory in TaskWeaver? +As we need to do this in a dynamic way, the only way is to set the experience subdirectory in a [role](/docs/concepts/role). +We can add a new role called `TaskTypeIdentifier` to identify the task type based on the task ID. +The key part of the `reply` function in `TaskTypeIdentifier` is shown below: + +```python +def reply(self, memory: Memory, **kwargs: ...) -> Post: + # ... + # get the task type from the last post message + task_type = get_task_type(last_post.message) + # issue a signal to set the experience subdirectory + post_proxy.update_attachment( + type=AttachmentType.signal, + message=f"_signal_exp_sub_path:{task_type}", + ) + + return post_proxy.end() +``` + +In the `reply` method, we first obtain the query from the last round. +Then we identify the task type based on the query content. +The interesting part is that we set the experience subdirectory in the attachment of the response. +We set the attachment type to `signal` and the message to `_signal_exp_sub_path:{task_type}`. + +The `signal` attachment type is a special type in TaskWeaver, which is used to send signals to other roles. +Its content is a string with format `key:value`, where `key` is an attachment type and `value` is the content of the attachment. +In this case, we send a signal to all roles to set the experience subdirectory to the value of `task_type`. +This is done by broadcasting an attachment with type `_signal_exp_sub_path` and its value, which is the task type, +to all the roles in TaskWeaver. Every role can decide whether to use the signal or not. + +A role responds to the signal by setting the experience subdirectory to the value in the signal. +The key part of the `Planner` role implementation is shown below: + +```python +# obtain the experience subdirectory from the attachment of the last post +exp_sub_path = last_post.get_attachment(AttachmentType._signal_exp_sub_path) +if exp_sub_path: + self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) + exp_sub_path = exp_sub_path[0] +else: + exp_sub_path = "" +selected_experiences = self.load_experience(query=query, sub_path=exp_sub_path) +``` +Other roles that are not responsible for setting the experience subdirectory can ignore the attachment. +In this way, we can set the experience subdirectory dynamically based on the task type. + +The signal is maintained at the session level, which means that the signal is valid for the current session. +The value of the signal can be changed by sending another signal with the same attachment type. +Note that after the signal is set, all roles will keep receiving the signal until the session ends. +So, it is each role's responsibility to implement the logic to handle duplicate signals. + +## Conclusion + +In this blog post, we have discussed how to select experiences in TaskWeaver. +We have static experience selection by configuring the experience directory for each role. +To enable dynamic experience selection, we have introduced the concept of experience subdirectory and signal attachment. diff --git a/website/docs/customization/experience.md b/website/docs/customization/experience/experience.md similarity index 92% rename from website/docs/customization/experience.md rename to website/docs/customization/experience/experience.md index bbe5daa5..8b7512dd 100644 --- a/website/docs/customization/experience.md +++ b/website/docs/customization/experience/experience.md @@ -15,20 +15,36 @@ to guide its planning and code generation. An experience tip is about what should do or should not do when seeing a request like this. We will add the retrieved experiences to the prompt when received a similar request afterward. -![Save User Experience](../../static/img/experience.png) +![Save User Experience](../../../static/img/experience.png) -## How to use experience memory +## Quick start -1. To enable the experience feature, you only need to set the `planner.use_experience` and `code_generator.use_experience` parameter in the configuration file to `true`. -2. Start a new conversation with TaskWeaver. You will find `experience` directory is created in your project directory. Note that there is no experience now because we have not saved any chat history yet. -3. If you think the current chat history is worth saving, you can save it by typing command `/save` and you will find a new file named `raw_exp_{session_id}.yaml` is created in the `experience` directory. -4. Restart TaskWeaver and start a new conversation. In the initialization stage, TaskWeaver will read the `raw_exp_{session_id}.yaml` file and make a summarization in a new file named `All_exp_{session_id}.yaml`. This process may take a while. `All_` denotes that this experience will be loaded for Planner and CodeInterpreter. -5. When user send a similar query to TaskWeaver, it will retrieve the relevant experience and load it into the system prompt (for Planner and CodeInterpreter). In this way, the experience can be used to guide the future conversation. +In this quick start tutorial, we are going to show you how to enable the experience feature and save the chat history to the experience pool. +1. To enable the experience feature, you need to set the `planner.use_experience` and `code_generator.use_experience` parameter in the configuration file to `true`. +So, both the Planner and CodeInterpreter can use the experience to guide the planning and code generation. -## A walk-through example +2. Start a new conversation with TaskWeaver. You will find `experience` directory is created in your project directory. +Note that it is empty now because we have not saved any chat history yet. + +3. If you think the current chat history is worth saving, you can save it by typing command `/save` in the console chat interface. +And you will find a new file named `raw_exp_{session_id}.yaml` created in the `experience` directory. + +4. Restart TaskWeaver and start a new conversation. In the initialization stage, TaskWeaver will read the `raw_exp_{session_id}.yaml` file +and make a summarization in a new file named `exp_{session_id}.yaml`. +This process may take a while because TaskWeaver needs to call the LLM model to extract the experience tips from the chat history. + +5. Next time, when user send a similar query to TaskWeaver, it will retrieve the relevant experience and load it into the system prompt (for Planner and CodeInterpreter). In this way, the experience can be used to guide the future conversation. + +:::info +The `experience` folder is created in the project directory. +You can change the location of the `experience` folder by setting the `session.experience_dir` parameter +in the configuration file. +::: + +### A walk-through example 1. Start a new conversation with TaskWeaver. Send a request "calculate the mean value of ./project/sample_data/data_demo.csv" to TaskWeaver. 2. You will find TaskWeaver made a mistake, calculating the mean value of the non-numerical column. diff --git a/website/docs/customization/experience/handcrafted_experience.md b/website/docs/customization/experience/handcrafted_experience.md new file mode 100644 index 00000000..d03b20d4 --- /dev/null +++ b/website/docs/customization/experience/handcrafted_experience.md @@ -0,0 +1,39 @@ +# Handcrafted Experience + +We have introduced the motivation of the `experience` module in [Experience](./experience.md). +In the quick start guide, we have shown how to extract experiences and lessons from the current conversation. +However, a more common scenario is that you have a handcrafted experience that you want to use to guide the agent. + +## Create a handcrafted experience + +To create a handcrafted experience, you need to create a YAML file that contains the experience. +The YAML file should have the following structure: + +```yaml +exp_id: the-id-of-the-experience +experience_text: the content of the experience +``` +The file should be saved in the `experience` folder in the project directory. +The file name should be prefixed with `handcrafted_exp_{exp_id}`. +For example, if the `exp_id` is `1`, the file name should be `handcrafted_exp_1.yaml`. + +:::tip +Do not use underscores in the `exp_id` field in order to avoid conflicts with the file name. +::: + +In the `experience_text` field, you can write the content of the experience in Markdown format. +For example: + +```yaml +exp_id: 1 +experience_text: |- + - Say "world" if you hear "hello". + - Say "peace" if you hear "love". +``` + +## Load the handcrafted experience + +Loading the handcrafted experience is the same with loading the extracted experience. +If either `planner.use_experience` or `code_generator.use_experience` is set to `True` in the project configuration file `taskweaver_config.json`, +the handcrafted experience will be loaded at the time of starting the agent. +If your agent is running, you need to restart the agent to load the handcrafted experience. diff --git a/website/sidebars.js b/website/sidebars.js index 4f34ebdc..75d6c830 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -124,7 +124,10 @@ const sidebars = { label: 'Experience', collapsible: true, collapsed: true, - items: ['customization/experience'], + items: [ + 'customization/experience/experience', + 'customization/experience/handcrafted_experience' + ], }, ], }, From 31ada454ab6c64a812a1e3c71d553db80a3c99fb Mon Sep 17 00:00:00 2001 From: liqun Date: Mon, 9 Sep 2024 17:47:55 +0800 Subject: [PATCH 04/12] delete tmp files --- project/exp1/exp_1.yaml | 773 ----------------- project/exp1/exp_2.yaml | 773 ----------------- .../exp1/exp_20240909-060027-bee84199.yaml | 780 ------------------ project/exp1/handcrafted_exp_1.yaml | 2 - project/exp1/handcrafted_exp_2.yaml | 2 - .../raw_exp_20240909-060027-bee84199.yaml | 122 --- project/exp2/sub_exp/exp_3.yaml | 773 ----------------- project/exp2/sub_exp/handcrafted_exp_3.yaml | 2 - 8 files changed, 3227 deletions(-) delete mode 100644 project/exp1/exp_1.yaml delete mode 100644 project/exp1/exp_2.yaml delete mode 100644 project/exp1/exp_20240909-060027-bee84199.yaml delete mode 100644 project/exp1/handcrafted_exp_1.yaml delete mode 100644 project/exp1/handcrafted_exp_2.yaml delete mode 100644 project/exp1/raw_exp_20240909-060027-bee84199.yaml delete mode 100644 project/exp2/sub_exp/exp_3.yaml delete mode 100644 project/exp2/sub_exp/handcrafted_exp_3.yaml diff --git a/project/exp1/exp_1.yaml b/project/exp1/exp_1.yaml deleted file mode 100644 index ae4d6bd6..00000000 --- a/project/exp1/exp_1.yaml +++ /dev/null @@ -1,773 +0,0 @@ -exp_id: 1 -experience_text: say "peach" if you hear "apple" -raw_experience_path: null -embedding_model: all-mpnet-base-v2 -embedding: -- 0.002076677745208144 -- 0.03603915870189667 -- -0.00438379542902112 -- -0.006364651024341583 -- -0.03103785216808319 -- 0.006088016554713249 -- -0.0425165593624115 -- -0.007801680359989405 -- 0.09853632003068924 -- 0.023470615968108177 -- -5.9094189055031165e-05 -- 0.0005395212210714817 -- 0.017150644212961197 -- -0.029298895969986916 -- -0.001350462669506669 -- -0.0061452011577785015 -- 0.025449100881814957 -- -0.0018475071992725134 -- 0.036011140793561935 -- -0.06823521852493286 -- -0.020742280408740044 -- 0.0357234850525856 -- 0.00017347944958601147 -- 0.046203527599573135 -- -0.04696705937385559 -- 0.017058782279491425 -- -0.005500210914760828 -- -0.01062320638448 -- -0.010328603908419609 -- -0.007481658365577459 -- -0.042505696415901184 -- 0.011486653238534927 -- -0.07994496077299118 -- -0.03583734109997749 -- 1.347435272691655e-06 -- -0.008092010393738747 -- 0.056404680013656616 -- -0.0033975313417613506 -- -0.047097429633140564 -- 0.008133894763886929 -- -0.03904419392347336 -- 0.03220275044441223 -- 0.003711898345500231 -- 0.00043004725011996925 -- 0.008502623997628689 -- 0.04752719774842262 -- 0.05434797331690788 -- -0.008307415060698986 -- -0.022433506324887276 -- -0.01214484591037035 -- 0.0021314139012247324 -- -0.0566505566239357 -- -0.030621344223618507 -- -0.015628762543201447 -- 0.028187928721308708 -- -0.009570904076099396 -- 0.03340108320116997 -- -0.06464093923568726 -- 0.013063393533229828 -- 0.007416849955916405 -- -0.0013422371121123433 -- -0.0481734424829483 -- -0.0009201560169458389 -- 0.037509143352508545 -- -0.0695284903049469 -- 0.05793822929263115 -- 0.034442462027072906 -- -0.0017623575404286385 -- -0.030781906098127365 -- 0.0314258337020874 -- -0.0017764178337529302 -- -0.005944704636931419 -- -0.008905707858502865 -- 0.025610677897930145 -- -0.011823438107967377 -- 0.00563499890267849 -- 0.013761444017291069 -- -0.05740906298160553 -- 0.000861245091073215 -- -0.024140018969774246 -- 0.002327855909243226 -- 0.004410585388541222 -- -0.002547980984672904 -- 0.04610956832766533 -- 0.004986982326954603 -- 0.10052293539047241 -- 0.03814912214875221 -- -0.019217846915125847 -- 0.047517720609903336 -- -0.048128921538591385 -- 0.015024186111986637 -- -0.004630940966308117 -- 0.053204506635665894 -- 0.002992269117385149 -- -0.001619020476937294 -- -0.020715676248073578 -- -0.03116990625858307 -- 0.07352283596992493 -- -0.014303816482424736 -- -0.09593293070793152 -- -0.09685911238193512 -- -0.022254446521401405 -- -0.021341226994991302 -- 0.04037946090102196 -- -0.037482768297195435 -- -0.03211713582277298 -- -0.010238692164421082 -- -0.00018940112204290926 -- -0.018315626308321953 -- -0.0032111527398228645 -- -0.04594588652253151 -- 0.0028249863535165787 -- -0.01794695481657982 -- 0.007159973494708538 -- 0.0013245906447991729 -- -0.02030939795076847 -- -0.02632329612970352 -- -0.020243996754288673 -- -0.027683965861797333 -- -0.06582917273044586 -- -0.04921343922615051 -- 0.024676352739334106 -- -0.00872780755162239 -- -0.024157095700502396 -- -0.0016795555129647255 -- -0.03356792405247688 -- -0.05118071660399437 -- 0.04726361110806465 -- -0.02097543515264988 -- -0.05408035218715668 -- -0.024142742156982422 -- -0.008733950555324554 -- -0.0005831241724081337 -- 0.03477107360959053 -- 0.035863522440195084 -- -0.01458810642361641 -- -0.007914717309176922 -- 0.009369838051497936 -- -0.0013688582694157958 -- 0.003468629904091358 -- -0.0704500824213028 -- 0.02644258178770542 -- -0.012175425887107849 -- -0.03775809705257416 -- -0.07665875554084778 -- 0.004715278744697571 -- 0.05289830267429352 -- -0.0687127411365509 -- 0.012859043665230274 -- 0.01791408099234104 -- -0.03663010895252228 -- 0.040060609579086304 -- 0.03263015300035477 -- 0.03364340588450432 -- 0.004044105298817158 -- -0.02602696791291237 -- 0.07014371454715729 -- 0.06168773025274277 -- -0.0013638748787343502 -- 0.03404739871621132 -- 0.003815646981820464 -- -0.005994131322950125 -- 0.043578170239925385 -- 0.002631360199302435 -- -0.019474495202302933 -- 0.021050570532679558 -- -0.03289240971207619 -- -0.04185330495238304 -- -0.05373257026076317 -- -0.01687896065413952 -- 0.03457324206829071 -- 0.03978060558438301 -- 0.002181214978918433 -- -0.0914001315832138 -- 0.03118555247783661 -- 0.08668036013841629 -- 0.0018093687249347568 -- -0.0029208504129201174 -- -0.0016485510859638453 -- -0.04095043987035751 -- -0.03883252292871475 -- -0.0050103673711419106 -- 0.02692575566470623 -- -0.00402176333591342 -- -0.09104945510625839 -- -0.011796768754720688 -- 0.0018781599355861545 -- 0.06296037882566452 -- -0.03463843837380409 -- 0.01777021586894989 -- -0.02909718081355095 -- -0.000527676718775183 -- -0.0072013214230537415 -- 0.018438348546624184 -- -0.020547572523355484 -- -0.0026535966899245977 -- 0.01860532909631729 -- 0.039946746081113815 -- 0.0126409363001585 -- -0.02174372784793377 -- -0.06482450664043427 -- -0.04519755765795708 -- 0.049855589866638184 -- -0.004091357812285423 -- -0.006785662844777107 -- -0.05018608272075653 -- 0.0807730108499527 -- 0.028833355754613876 -- 0.010815749876201153 -- -0.008261998184025288 -- -0.03277555853128433 -- -0.047926705330610275 -- 0.04970525577664375 -- 0.025168579071760178 -- 0.0007037348113954067 -- 0.06970125436782837 -- 0.004370851907879114 -- 0.032200731337070465 -- 0.030835097655653954 -- 0.058661431074142456 -- 0.02717328630387783 -- -0.012376091443002224 -- 0.024631820619106293 -- -0.006828790996223688 -- -0.023268604651093483 -- -0.032871946692466736 -- 0.03756893426179886 -- -0.033317930996418 -- -0.04522555693984032 -- 0.023212600499391556 -- 0.016763262450695038 -- 0.027942413464188576 -- -0.00949570070952177 -- 0.043241679668426514 -- 0.05621872842311859 -- 0.03779369965195656 -- 0.011897232383489609 -- 0.014896179549396038 -- -0.018681490793824196 -- -0.01839243806898594 -- 0.0014975026715546846 -- 0.06089029088616371 -- 0.014674119651317596 -- -0.007072165608406067 -- 0.0005660092574544251 -- -0.021704886108636856 -- 0.09804512560367584 -- -0.028681350871920586 -- 0.026131214573979378 -- -0.05372387915849686 -- -0.005636673420667648 -- 0.0033364719711244106 -- -0.04439677298069 -- -0.03332102298736572 -- 0.002857217099517584 -- -0.0695226788520813 -- 0.005851385183632374 -- -0.028129683807492256 -- -0.06458700448274612 -- -0.05328310653567314 -- 0.06805721670389175 -- -0.02303682640194893 -- 0.02927636355161667 -- -0.03685043379664421 -- 0.014780215919017792 -- -0.039876922965049744 -- -0.04678170382976532 -- -0.10566980391740799 -- -0.03823954984545708 -- 0.037394486367702484 -- -0.015171647071838379 -- -0.024194631725549698 -- -0.002981469500809908 -- -0.0025484063662588596 -- -0.010369437746703625 -- 0.010459685698151588 -- -0.012130135670304298 -- -0.04029158130288124 -- 0.06367271393537521 -- -0.062239766120910645 -- -0.06549864262342453 -- -0.04904807358980179 -- 0.0012324590934440494 -- -0.01734771765768528 -- 0.004981398582458496 -- 0.019108407199382782 -- 0.005648917518556118 -- -0.04709982872009277 -- 0.003991040401160717 -- -0.08564452081918716 -- -0.023371165618300438 -- 0.01684756390750408 -- 0.014827366918325424 -- 0.07519230991601944 -- 0.005368346348404884 -- 0.02326340414583683 -- 0.037553709000349045 -- 0.037121668457984924 -- -0.0035797394812107086 -- 0.0014295236906036735 -- -0.009887749329209328 -- -0.014791231602430344 -- 0.008341723121702671 -- -0.023585587739944458 -- -0.010909190401434898 -- 0.032456379383802414 -- -0.013742965646088123 -- -0.04287289083003998 -- -0.02176453173160553 -- 0.04054110869765282 -- 0.031863436102867126 -- 0.01249129232019186 -- 0.013631017878651619 -- 0.03573000803589821 -- -0.038331855088472366 -- -0.07673068344593048 -- 0.008214067667722702 -- -0.06557852029800415 -- 0.008703329600393772 -- 0.014376544393599033 -- -0.004012516234070063 -- -0.03467757999897003 -- 0.0364082008600235 -- -0.05605095624923706 -- 0.003813741263002157 -- -0.025966621935367584 -- -0.013676607050001621 -- 0.04143631458282471 -- 0.031575560569763184 -- -0.0646434873342514 -- 0.0017937890952453017 -- 0.058420948684215546 -- -0.028528044000267982 -- 0.02018536441028118 -- 0.03148900344967842 -- -0.07690513134002686 -- -0.029643412679433823 -- 0.07786562293767929 -- -0.01596500352025032 -- 0.025838198140263557 -- 0.03145137056708336 -- -0.006283584516495466 -- -0.04023025184869766 -- -0.04701944440603256 -- -0.07168013602495193 -- 0.033260226249694824 -- 0.02889508381485939 -- -0.016154443845152855 -- 0.042212530970573425 -- 0.06163421645760536 -- -0.04267815127968788 -- -0.02102702297270298 -- 0.010803395882248878 -- -0.012728383764624596 -- 0.0025914269499480724 -- -0.005297738127410412 -- -0.004795115906745195 -- 0.07159675657749176 -- -0.018772628158330917 -- 0.04775341600179672 -- -0.006243865005671978 -- -0.05831030756235123 -- 0.06404168158769608 -- 0.008118683472275734 -- 0.01265101507306099 -- 0.014954347163438797 -- 0.02838132157921791 -- -0.027388298884034157 -- 0.052084892988204956 -- 0.01176188513636589 -- -0.008273257873952389 -- 0.05026450753211975 -- -0.04247705638408661 -- 0.008241587318480015 -- 0.007868432439863682 -- -0.08382180333137512 -- 0.02508809231221676 -- 0.017005018889904022 -- 0.01154959388077259 -- -0.0042104776948690414 -- 0.021971499547362328 -- -0.004030514042824507 -- -0.05146895721554756 -- -0.009352650493383408 -- -0.0513167679309845 -- -0.0037430506199598312 -- 0.03956839069724083 -- -0.01713515631854534 -- -0.08742104470729828 -- -0.04096211493015289 -- 0.028735244646668434 -- -0.0021137436851859093 -- -0.06367598474025726 -- 0.029276860877871513 -- 0.007907219231128693 -- 0.00640992121770978 -- 0.01538486871868372 -- 0.02454337105154991 -- -0.02500874735414982 -- -0.0029450715519487858 -- 0.019643273204565048 -- 0.05889872461557388 -- -0.04381910711526871 -- 0.03596780076622963 -- 0.06818603724241257 -- 0.012050165794789791 -- 0.06007668748497963 -- -0.03739720210433006 -- -0.04501721262931824 -- 0.0011157882399857044 -- -0.008083175867795944 -- 0.006017289124429226 -- 0.008121469058096409 -- -0.024602709338068962 -- -0.01302304957062006 -- 0.03609442710876465 -- 0.0010172611800953746 -- -0.01212900597602129 -- -0.022230537608265877 -- 0.04761526733636856 -- -0.013647089712321758 -- 0.08188152313232422 -- 0.002165150595828891 -- 0.013312667608261108 -- 0.00031405678601004183 -- 0.012408865615725517 -- 0.0319778248667717 -- 0.01620842143893242 -- 0.0031853518448770046 -- 0.02964790351688862 -- -0.01832352951169014 -- 0.02087281458079815 -- 0.005490979645401239 -- -0.013054708018898964 -- -0.030826788395643234 -- -0.031177520751953125 -- 0.026310278102755547 -- 0.04316142946481705 -- -0.08321823924779892 -- -0.05837981402873993 -- -0.013886687345802784 -- -0.003000007476657629 -- 0.02049127034842968 -- 0.04259631410241127 -- -0.022787071764469147 -- 0.033182643353939056 -- 0.014836517162621021 -- 0.024208124727010727 -- -0.03500240296125412 -- 0.05583534017205238 -- 0.05724038556218147 -- -0.053016405552625656 -- -0.029100680723786354 -- 0.03905566409230232 -- -0.0019505724776536226 -- -0.0018223834922537208 -- 0.03215079382061958 -- -0.008438159711658955 -- -0.01993289589881897 -- 0.034782055765390396 -- -0.00551842013373971 -- 0.028034934774041176 -- 0.03648987412452698 -- -0.031495969742536545 -- -0.03625999391078949 -- 0.050006747245788574 -- 0.10163374990224838 -- 0.05784887820482254 -- 0.02914799563586712 -- -0.005682471673935652 -- -0.006481640040874481 -- -0.003536946140229702 -- 0.006187054328620434 -- 0.003116358071565628 -- 0.014476004987955093 -- 0.0076301489025354385 -- -0.011084741912782192 -- -0.09346790611743927 -- -0.0862889438867569 -- 0.03016080893576145 -- 0.003039182163774967 -- -0.0039209662936627865 -- 0.011930620297789574 -- 0.026278382167220116 -- 0.004760068841278553 -- -0.010594258084893227 -- 0.05689861997961998 -- -0.0007324875914491713 -- 0.02788800746202469 -- -0.008394870907068253 -- 0.003696719417348504 -- -0.01581752672791481 -- 0.0231858529150486 -- -0.04351469501852989 -- -0.010194777511060238 -- -0.024645352736115456 -- -0.018337849527597427 -- -0.0690787136554718 -- 0.014263218268752098 -- 0.05291473865509033 -- -0.007287757471203804 -- -0.0035238706041127443 -- -0.03219309076666832 -- -0.03305663913488388 -- -0.0125225018709898 -- 0.015062364749610424 -- 0.013767071068286896 -- 0.04554641991853714 -- 0.0073592280969023705 -- -0.020955096930265427 -- -0.01320643536746502 -- 0.0546344593167305 -- -0.0008281502523459494 -- -0.040356431156396866 -- -0.04589741677045822 -- 0.07846048474311829 -- -0.018984323367476463 -- -0.0759328305721283 -- -0.0014797657495364547 -- -0.01091212872415781 -- 0.004964845255017281 -- -0.010090334340929985 -- 0.00819682702422142 -- -0.03131427988409996 -- -0.030788661912083626 -- 0.07827675342559814 -- -0.0006403547013178468 -- 0.00011955734953517094 -- -0.03146335482597351 -- 0.0139079000800848 -- -0.03513038530945778 -- -0.008790791966021061 -- -0.03694099560379982 -- -0.008018656633794308 -- 0.018809182569384575 -- -0.015283645130693913 -- -0.01777135580778122 -- 0.003806393127888441 -- -0.044869404286146164 -- 0.04717610776424408 -- -0.0447596050798893 -- -0.024633485823869705 -- 0.03003646247088909 -- -0.0009385698940604925 -- 0.11098053306341171 -- -0.009789965115487576 -- 0.030640657991170883 -- 0.02632221207022667 -- 0.034881845116615295 -- 0.01734756864607334 -- 0.022650709375739098 -- -0.014218107797205448 -- -0.09831289201974869 -- -0.03357334062457085 -- -0.03335385024547577 -- -4.9941924419341086e-33 -- -0.018254568800330162 -- -0.01017495896667242 -- 0.0014997586840763688 -- 0.02117929421365261 -- 0.001093653030693531 -- 0.0520971454679966 -- -0.0274690892547369 -- 0.01883840560913086 -- -0.007513700984418392 -- -0.005217412952333689 -- 0.016758721321821213 -- -0.02570030465722084 -- 0.01816483400762081 -- -0.0250912606716156 -- 0.037176258862018585 -- 0.00502456771209836 -- 0.0014612789964303374 -- 0.06800714135169983 -- -0.0029353995341807604 -- 0.012491936795413494 -- 0.017134245485067368 -- -0.02395143173635006 -- 0.016619808971881866 -- 0.0882359966635704 -- 0.0056934477761387825 -- 0.021360019221901894 -- -0.038114070892333984 -- -0.015525737777352333 -- -0.008841847069561481 -- 0.0010531722800806165 -- -0.025727344676852226 -- 0.02471284009516239 -- 0.01694098487496376 -- 0.04902321845293045 -- 0.009044262580573559 -- 0.025249771773815155 -- 0.0718131810426712 -- -0.01520281657576561 -- -0.02790706418454647 -- -0.029794353991746902 -- -0.032558318227529526 -- 0.04894554242491722 -- 0.042309969663619995 -- 0.02879968471825123 -- -0.010560710914433002 -- 0.03929167613387108 -- 0.06337568163871765 -- -0.0011555020464584231 -- -0.03629377484321594 -- 0.04187283292412758 -- -0.04013555496931076 -- -0.0007976212655194104 -- 0.019660573452711105 -- -0.05348984897136688 -- 0.02391401119530201 -- 0.0957329273223877 -- -0.01736452430486679 -- 0.04128472879528999 -- 0.037504833191633224 -- 0.06426160037517548 -- 0.035195790231227875 -- -0.009661535732448101 -- 0.0170342605561018 -- 0.084307461977005 -- -0.0056257243268191814 -- 0.013174369931221008 -- 0.09377964586019516 -- -0.0875358060002327 -- -0.01620960235595703 -- 0.022455135360360146 -- 0.008165093138813972 -- 0.016633454710245132 -- 0.06943229585886002 -- -0.004645914770662785 -- 0.01881401240825653 -- -0.0504886619746685 -- 0.011036847718060017 -- 0.01905742660164833 -- -0.007070848252624273 -- -0.03512505069375038 -- -0.03572680428624153 -- 0.029036086052656174 -- -0.031596675515174866 -- -0.0234194565564394 -- -0.005703635048121214 -- 0.022586535662412643 -- -0.004910896997898817 -- 0.019988449290394783 -- 0.006426703184843063 -- -0.02491970919072628 -- -0.01402664091438055 -- 0.08610770851373672 -- 0.003936620429158211 -- 0.03209668770432472 -- -0.05400601774454117 -- -0.04310345649719238 -- 0.01958833821117878 -- -0.02128911018371582 -- -0.03494998812675476 -- -0.007754477672278881 -- -0.04791589081287384 -- 0.014497642405331135 -- 0.00854917149990797 -- 0.03573589771986008 -- 0.021876895800232887 -- 0.003631952917203307 -- -0.02195160463452339 -- 0.001553969457745552 -- -0.05464157462120056 -- 0.008729442022740841 -- -0.036202408373355865 -- -0.040282417088747025 -- 0.022788001224398613 -- -0.04418254643678665 -- 0.02053702622652054 -- 0.03480884060263634 -- -0.010269279591739178 -- 0.04696961119771004 -- 0.012995004653930664 -- -0.07897445559501648 -- -0.05740431696176529 -- -0.05682487413287163 -- 0.01492974441498518 -- 0.05019513517618179 -- -0.019237514585256577 -- 0.0055320546962320805 -- 0.01198672316968441 -- -0.06887609511613846 -- -0.09016828238964081 -- -0.019979100674390793 -- -0.0004406376974657178 -- 0.06647977977991104 -- 2.1121290671999304e-07 -- -0.027091048657894135 -- -0.04953813552856445 -- 0.030832741409540176 -- 0.05622001737356186 -- -0.007221754174679518 -- 0.0278745349496603 -- 0.01044386625289917 -- -0.0018569700187072158 -- 0.005692501086741686 -- 0.0005474583012983203 -- -0.027324436232447624 -- -0.03328273072838783 -- 0.01871141977608204 -- 0.009414284490048885 -- -0.02895166166126728 -- 0.07302535325288773 -- -0.06450684368610382 -- 0.04119069501757622 -- -0.030550461262464523 -- -0.04789623245596886 -- -0.01566251739859581 -- -0.014292830601334572 -- 0.008455101400613785 -- -0.017121752724051476 -- 0.008203166536986828 -- -0.042506858706474304 -- -0.01298887375742197 -- 0.005528432782739401 -- 0.06563985347747803 -- -0.004232094157487154 -- -0.03617222234606743 -- -0.033045921474695206 -- 0.006677519530057907 -- 0.03733176365494728 -- -0.035495299845933914 -- -0.017911100760102272 -- 0.020448874682188034 -- -0.04964633285999298 -- -0.060697782784700394 -- 0.050749849528074265 -- -0.017255015671253204 -- 0.066440150141716 -- -0.03588384389877319 -- -0.03561566397547722 -- 0.0021299421787261963 -- 0.0004946758854202926 -- 0.013357064686715603 -- 0.018466709181666374 -- 0.0675460696220398 -- -0.02202661707997322 -- 0.0327652283012867 -- 0.002804954769089818 -- -0.03475608676671982 -- -0.018413031473755836 -- -0.018951160833239555 -- 0.0036126142367720604 -- 0.03940947726368904 -- -0.004678904078900814 -- 0.037915490567684174 -- -0.0006026980117894709 -- -0.02389153093099594 -- -0.02986828051507473 -- 0.06569203734397888 -- 0.05028827488422394 -- -0.01563316211104393 -- 0.03349592164158821 -- 0.0026056848000735044 -- 6.380121288923332e-35 -- -0.005537340883165598 -- 0.001875287969596684 -- 0.02620490826666355 -- 0.04339710995554924 -- 0.0029878471978008747 -- 0.01628286764025688 -- 0.0831407830119133 -- 0.033180221915245056 -- 0.013483740389347076 -- 0.022158915176987648 -- -0.04180760681629181 diff --git a/project/exp1/exp_2.yaml b/project/exp1/exp_2.yaml deleted file mode 100644 index add8e4f1..00000000 --- a/project/exp1/exp_2.yaml +++ /dev/null @@ -1,773 +0,0 @@ -exp_id: 2 -experience_text: Say "world" if you hear "hello" -raw_experience_path: null -embedding_model: all-mpnet-base-v2 -embedding: -- 0.03770161047577858 -- 0.015260828658938408 -- 0.011654765345156193 -- -0.043227072805166245 -- 0.008040567860007286 -- 0.0012962525943294168 -- -0.029643122106790543 -- 0.002577129751443863 -- 0.041701365262269974 -- 0.019863322377204895 -- -0.06414484977722168 -- -0.07328800857067108 -- 0.016461851075291634 -- 0.014285909943282604 -- 0.06828439235687256 -- -0.0391310416162014 -- 0.0334206186234951 -- -0.05230560153722763 -- -0.04891263321042061 -- -0.028536424040794373 -- -0.0013956865295767784 -- 0.00774912117049098 -- 0.0024153124541044235 -- 0.050088975578546524 -- 0.027662837877869606 -- 0.008375070989131927 -- 0.010521573945879936 -- -0.03286492079496384 -- 0.0088978111743927 -- 0.00866076722741127 -- -0.025507131591439247 -- 0.011845295317471027 -- 0.0333932489156723 -- -0.004294443875551224 -- 1.6005080851755338e-06 -- -0.03541667014360428 -- 0.05130691081285477 -- -0.058463048189878464 -- 9.117766603594646e-05 -- -0.06587754189968109 -- -0.034934815019369125 -- 0.06678854674100876 -- 0.01877608895301819 -- 0.009511202573776245 -- -0.02215624786913395 -- -0.02755170501768589 -- 0.01608552411198616 -- -0.026578187942504883 -- -0.014043113216757774 -- -0.007409931626170874 -- 0.008557961322367191 -- 0.006937611382454634 -- -0.0327741838991642 -- -0.029916750267148018 -- 0.04237094148993492 -- 0.01216681394726038 -- 0.026179537177085876 -- 0.014258801937103271 -- -0.0243583545088768 -- -0.0378614217042923 -- -0.031179649755358696 -- 0.001333642634563148 -- 0.003080826485529542 -- 0.020475978031754494 -- -0.0003005199832841754 -- 0.04041438549757004 -- -0.004375794902443886 -- 0.027485668659210205 -- -0.005255893338471651 -- 0.07257787883281708 -- -0.011383410543203354 -- -0.03908785432577133 -- 0.014056934043765068 -- 0.064444400370121 -- 0.007434479426592588 -- -0.06368442624807358 -- -0.007358503062278032 -- 0.0028030758257955313 -- 0.04040984809398651 -- 0.02259001135826111 -- -0.027185164391994476 -- 0.01418297365307808 -- -0.038672223687171936 -- -0.008651084266602993 -- -0.026026500388979912 -- 0.10797334462404251 -- -0.005325615871697664 -- -0.009688745252788067 -- 0.005179217550903559 -- -0.022740162909030914 -- 0.022393863648176193 -- 0.03511680290102959 -- 0.0032473234459757805 -- -0.004239055328071117 -- 0.0003833693917840719 -- -0.02804042212665081 -- -0.01719619892537594 -- 0.03616011142730713 -- -0.008799486793577671 -- -0.09382113069295883 -- -0.020445263013243675 -- -0.0011057124938815832 -- -0.023739101365208626 -- 0.03938119485974312 -- -0.011825475841760635 -- -0.027204478159546852 -- 0.022995417937636375 -- -0.08701358735561371 -- -0.013715233653783798 -- -0.018995074555277824 -- -0.04925267770886421 -- 0.012124109081923962 -- 0.03280827775597572 -- -0.005217003170400858 -- -0.053769927471876144 -- -0.021743105724453926 -- -0.0070466212928295135 -- 0.009713055565953255 -- 0.03297695890069008 -- -0.015778860077261925 -- -0.020879000425338745 -- -0.017451373860239983 -- 0.006396296434104443 -- -0.010501282289624214 -- 0.04855453222990036 -- 0.0121320690959692 -- -0.04622287303209305 -- 0.016785066574811935 -- -0.01645517162978649 -- -0.09306468814611435 -- -0.006510382518172264 -- -0.007951407693326473 -- 0.027384178712964058 -- 0.04490070044994354 -- 0.0007170891622081399 -- 0.045816194266080856 -- -0.03541984036564827 -- -0.005954004358500242 -- 0.05126989632844925 -- 0.05625636875629425 -- -0.052142027765512466 -- -0.002337090438231826 -- 0.032380033284425735 -- -0.056381307542324066 -- -0.01131097786128521 -- -0.014318730682134628 -- 0.04896633327007294 -- 0.0552961640059948 -- 0.007818006910383701 -- -0.04617944359779358 -- -0.031630948185920715 -- 0.04194357991218567 -- -0.05587031692266464 -- 0.014986417256295681 -- 0.03721534088253975 -- 0.00568470498546958 -- 0.05165747553110123 -- 0.020130546763539314 -- -0.04037341848015785 -- -0.059297826141119 -- 0.013797988183796406 -- 0.0236357394605875 -- 0.022123336791992188 -- 0.04677799344062805 -- 0.014986587688326836 -- 0.042244650423526764 -- 0.02463829703629017 -- -0.021790005266666412 -- -0.014185643754899502 -- -0.051752444356679916 -- 0.016091128811240196 -- -0.025408871471881866 -- -0.004616331309080124 -- 0.002464518416672945 -- 0.011269024573266506 -- -0.016831479966640472 -- -0.05544956773519516 -- -0.04453176259994507 -- 0.025718802586197853 -- 0.012693840079009533 -- -0.048942431807518005 -- -0.04048214852809906 -- -0.026056434959173203 -- -0.023748729377985 -- -0.06638790667057037 -- 0.0005285385414026678 -- 0.0509391650557518 -- 0.019543481990695 -- -0.03196631371974945 -- 0.02623622864484787 -- 0.009538133628666401 -- 0.03483378142118454 -- -0.02508186176419258 -- 0.02043452113866806 -- -0.010725446976721287 -- -0.0074797142297029495 -- 0.014813465066254139 -- 0.013983956538140774 -- 0.05100783705711365 -- -0.06045455113053322 -- -0.025909405201673508 -- -0.025109220296144485 -- 0.031531546264886856 -- -0.027345962822437286 -- -0.024721402674913406 -- 0.02084783837199211 -- 0.09586375951766968 -- -0.008180346339941025 -- 0.015048526227474213 -- 0.04171084240078926 -- -0.007213604636490345 -- 0.005185933317989111 -- 0.014219473116099834 -- 0.03887265920639038 -- 0.006981587037444115 -- 0.06657340377569199 -- -0.0031540400814265013 -- 0.031057722866535187 -- 0.003798832418397069 -- 0.09330818057060242 -- -0.01144392415881157 -- -0.03706010803580284 -- 0.03340112417936325 -- -0.034626130014657974 -- 0.037274204194545746 -- -0.050508707761764526 -- 0.03197618946433067 -- 0.01573924534022808 -- -0.027317821979522705 -- 0.01917574368417263 -- -0.026374073699116707 -- 0.005931815132498741 -- -0.027819974347949028 -- 0.022738324478268623 -- -0.009882564656436443 -- 0.004274012520909309 -- -0.05382080376148224 -- -0.06422704458236694 -- -0.0037522080820053816 -- -0.09904822707176208 -- -0.0038907958660274744 -- 0.023477153852581978 -- 0.04183608666062355 -- -0.010195894166827202 -- 0.007519648876041174 -- 0.0478956401348114 -- 0.06119244173169136 -- 0.017770763486623764 -- 0.0031069153919816017 -- -0.019519055262207985 -- 0.01839151605963707 -- 0.007158738095313311 -- -0.0713043361902237 -- -0.04761949181556702 -- 0.026049980893731117 -- -0.047883182764053345 -- 0.014867996796965599 -- 0.00928537454456091 -- -0.0407157763838768 -- -0.1118495911359787 -- 0.07564633339643478 -- -0.048067085444927216 -- 0.018672022968530655 -- 0.02629098854959011 -- 0.05120433494448662 -- -0.0188148133456707 -- -0.009329553693532944 -- -0.10229811817407608 -- -0.021712183952331543 -- 0.02768830396234989 -- 0.02979288250207901 -- 0.010588753037154675 -- 0.027784010395407677 -- -0.022417576983571053 -- -0.0477118156850338 -- -0.019707977771759033 -- 0.043368637561798096 -- -0.002604682696983218 -- 0.05778846517205238 -- 0.0032716221176087856 -- -0.016919787973165512 -- 0.001729412586428225 -- -0.028190720826387405 -- -0.04968857392668724 -- 0.0181594081223011 -- 0.011803517118096352 -- -0.02502574771642685 -- -0.07610262185335159 -- 0.01390276849269867 -- -0.03878704458475113 -- -0.043086905032396317 -- 0.04730651155114174 -- -0.0208892859518528 -- -0.005661654286086559 -- 0.038437001407146454 -- 0.028558600693941116 -- 0.04621468484401703 -- -0.0277409665286541 -- -0.012964108027517796 -- -0.05556506663560867 -- 0.027492046356201172 -- -0.007763118948787451 -- -0.011776722967624664 -- -0.041421692818403244 -- -0.014284875243902206 -- 0.0024534789845347404 -- -0.025437604635953903 -- -0.07751662284135818 -- -0.039282042533159256 -- 0.06303831189870834 -- 0.044384051114320755 -- 0.003853065427392721 -- 0.0043038735166192055 -- 0.001415966427884996 -- -0.032784949988126755 -- -0.07216829806566238 -- -0.06405965238809586 -- -0.07864663749933243 -- 0.007194001227617264 -- -0.01512132491916418 -- 0.057427480816841125 -- 0.01871199905872345 -- 0.002615442266687751 -- -0.019085833802819252 -- -0.03211134672164917 -- 0.02497853711247444 -- 0.009740686044096947 -- 0.04712676629424095 -- 0.014834719710052013 -- -0.0216281209141016 -- 0.0026223789900541306 -- 0.031738318502902985 -- -0.06511115282773972 -- 0.018047373741865158 -- -0.05825822427868843 -- -0.06928882747888565 -- 0.024454424157738686 -- -0.028324056416749954 -- 0.003804718842729926 -- -0.0017671874957159162 -- -0.00875526200979948 -- -0.012061065062880516 -- -0.0714389830827713 -- 0.06825675815343857 -- -0.08810510486364365 -- 0.03354572132229805 -- 0.0004574693739414215 -- -0.014058583416044712 -- 0.006580387242138386 -- 0.020362654700875282 -- -0.017877236008644104 -- 0.003640989540144801 -- 0.00761835603043437 -- -0.0013692042557522655 -- -0.004554315935820341 -- -0.07044420391321182 -- 0.05243919789791107 -- 0.019296985119581223 -- 0.006655104458332062 -- 0.011780296452343464 -- -0.005403762683272362 -- -0.06105198338627815 -- 0.06538153439760208 -- 0.01744009181857109 -- 0.04235944524407387 -- 0.01116121280938387 -- 0.0439041405916214 -- 0.07044947147369385 -- -0.0012615721207112074 -- 0.052524104714393616 -- -0.00472694355994463 -- 0.0700119286775589 -- 0.015710053965449333 -- 0.06473696231842041 -- -0.02549312636256218 -- -0.019381161779165268 -- -0.012512899935245514 -- -0.036598071455955505 -- 0.014136865735054016 -- -0.03888177499175072 -- -0.009207700379192829 -- -0.029045933857560158 -- -0.01925111562013626 -- -0.01584102213382721 -- -0.020850270986557007 -- -0.0007262067520059645 -- 0.025219272822141647 -- 0.02446514554321766 -- -0.03503533452749252 -- 0.005304895341396332 -- 0.0558466762304306 -- -0.07577811181545258 -- -0.02071310393512249 -- 0.06525979191064835 -- -0.006340986583381891 -- 0.030026115477085114 -- 0.018616529181599617 -- 0.015562169253826141 -- -0.03970484063029289 -- -0.0058183143846690655 -- -0.030402889475226402 -- 0.016910970211029053 -- 0.08447960764169693 -- 0.030522271990776062 -- 0.02209566906094551 -- 0.037809114903211594 -- 0.04860290139913559 -- -0.02600998617708683 -- 0.029071344062685966 -- -0.03889188542962074 -- -0.03067505732178688 -- 0.050907254219055176 -- 0.020721672102808952 -- -0.010848396457731724 -- -0.01116504892706871 -- -0.002083761850371957 -- -0.030995143577456474 -- -0.0458257757127285 -- -0.019136330112814903 -- -0.0308342557400465 -- 0.00565183674916625 -- 0.07874057441949844 -- 0.0038244135212153196 -- 0.024108774960041046 -- -0.01915900968015194 -- 0.02007138356566429 -- 0.06350391358137131 -- 0.048261046409606934 -- 0.03814397379755974 -- 0.03294387832283974 -- -0.030421528965234756 -- 0.03831914812326431 -- 0.03895830735564232 -- 0.017689364030957222 -- 0.008748199790716171 -- -0.020921260118484497 -- -0.03600146993994713 -- -0.0037120229098945856 -- -0.042820435017347336 -- -0.03473712131381035 -- 0.020170249044895172 -- 0.008261213079094887 -- 0.008062402717769146 -- 0.005055050831288099 -- 0.019371723756194115 -- 0.10489551723003387 -- -0.0003611571155488491 -- -0.007438078057020903 -- -0.016777552664279938 -- -0.058316804468631744 -- 0.03275390341877937 -- -0.06735731661319733 -- -0.003918819595128298 -- 0.03461066260933876 -- 0.005690631456673145 -- -0.033279165625572205 -- 0.031183233484625816 -- 0.011194959282875061 -- -0.016929173842072487 -- -0.012761923484504223 -- 0.012990987859666348 -- 0.02138291485607624 -- 0.0013042341452091932 -- 0.005421041510999203 -- 0.00550623144954443 -- 0.015361975878477097 -- -0.006454655434936285 -- 0.023045657202601433 -- 0.052985116839408875 -- 0.010047507472336292 -- -0.02859446406364441 -- -0.005586408544331789 -- -0.00349820195697248 -- 0.005481155123561621 -- -0.02478955313563347 -- 0.031984806060791016 -- -0.013082249090075493 -- -0.027859549969434738 -- -0.07622745633125305 -- 0.003646149532869458 -- -0.008291426114737988 -- -0.01867637224495411 -- -0.031240388751029968 -- 0.03297831118106842 -- -0.03184446692466736 -- -0.023041030392050743 -- 0.09066202491521835 -- -0.014461378566920757 -- -0.024871403351426125 -- 0.039309822022914886 -- -0.020350798964500427 -- 0.007679751608520746 -- 0.037645373493433 -- 0.021200789138674736 -- -0.06969033926725388 -- 0.02792828343808651 -- 0.01129328366369009 -- -0.06004638969898224 -- 0.006861166562885046 -- 0.044250912964344025 -- 0.029625611379742622 -- -0.009557127952575684 -- -0.05960233882069588 -- 0.0017424698453396559 -- 0.017338726669549942 -- -0.04044404253363609 -- 0.028692111372947693 -- 0.003438263200223446 -- 0.01927531510591507 -- -0.04809967428445816 -- 0.036329999566078186 -- 0.04538080468773842 -- 0.007264549843966961 -- -0.09445788711309433 -- -0.0031028203666210175 -- 0.09188473224639893 -- 0.006122107617557049 -- 0.004153246991336346 -- -0.0009691837476566434 -- -0.0192609541118145 -- 0.013033772818744183 -- 0.007635330781340599 -- -0.012832255102694035 -- -0.028537679463624954 -- -0.0039044697768986225 -- 0.03140951320528984 -- -0.018394710496068 -- -0.018766168504953384 -- -0.009520076215267181 -- -0.019677508622407913 -- -0.013935834169387817 -- -0.022296525537967682 -- 0.046354617923498154 -- 0.027911093086004257 -- -0.03439607471227646 -- 0.04835047945380211 -- 0.04744994267821312 -- 0.08087560534477234 -- -0.03324320539832115 -- 0.09356484562158585 -- -0.05506376922130585 -- -0.015122752636671066 -- -0.017576247453689575 -- 0.0164752509444952 -- -0.009802558459341526 -- 0.03434855490922928 -- 0.05297086760401726 -- -0.021666349843144417 -- 0.0236513651907444 -- -0.016122274100780487 -- 0.015448885969817638 -- 0.05725741386413574 -- -0.0049414788372814655 -- -0.006801162846386433 -- 0.00823257863521576 -- -5.4276196169433485e-33 -- -0.04082207381725311 -- -0.019555607810616493 -- -0.040040839463472366 -- -0.0001141502070822753 -- -0.051626596599817276 -- -0.03195520490407944 -- -0.013592409901320934 -- 0.035518426448106766 -- -0.02025427110493183 -- 0.003525864565744996 -- -0.010595621541142464 -- -0.010334410704672337 -- 0.005470395088195801 -- -0.010931993834674358 -- 0.019002994522452354 -- -0.008090449497103691 -- 0.023338936269283295 -- 0.02729245461523533 -- -0.02518153376877308 -- 0.014246493577957153 -- 0.05546674504876137 -- -0.003024680307134986 -- 0.09591367840766907 -- 0.01541182305663824 -- 0.012257235124707222 -- 0.014503195881843567 -- -0.06009455397725105 -- -0.020580431446433067 -- 0.04156920313835144 -- -0.028271107003092766 -- -0.05132425203919411 -- 0.029513904824852943 -- -0.0017966947052627802 -- 0.049365900456905365 -- -0.004055812489241362 -- 0.04952320456504822 -- -0.0026710391975939274 -- -0.022057930007576942 -- 0.044722456485033035 -- -0.03439272195100784 -- -0.019913332536816597 -- 0.04651929438114166 -- -0.06508281826972961 -- -0.014435326680541039 -- 0.011593392118811607 -- 0.0795234888792038 -- 0.012000009417533875 -- 0.02052253857254982 -- 0.011723524890840054 -- 0.046198442578315735 -- -0.08271150290966034 -- -0.010815484449267387 -- 0.0161152146756649 -- -0.0689789205789566 -- -0.07248946279287338 -- 0.04016651213169098 -- -0.033289846032857895 -- -0.058603834360837936 -- -0.0054756342433393 -- 0.0909019261598587 -- 0.10557299107313156 -- 0.02360360696911812 -- -0.014354990795254707 -- 0.048548873513936996 -- 0.0019736471585929394 -- 0.06898210942745209 -- 0.05895812064409256 -- -0.02885180339217186 -- 0.033372119069099426 -- -0.03948585316538811 -- 0.055792562663555145 -- 0.03762234374880791 -- -0.02001100406050682 -- 0.0384683795273304 -- -0.0013603812549263239 -- 0.002101999009028077 -- 0.021199950948357582 -- -0.0396786630153656 -- 0.0019316099351271987 -- -0.02689376100897789 -- -0.016210021451115608 -- 0.007637509144842625 -- -0.0295636598020792 -- -0.00559998070821166 -- 0.007571681868284941 -- 0.019282475113868713 -- -0.00989591795951128 -- 0.02802428789436817 -- 0.03746981546282768 -- 0.010514799505472183 -- -0.0071000768803060055 -- -0.017970241606235504 -- 0.05796752870082855 -- -0.030826766043901443 -- -0.009067504666745663 -- -0.004731421358883381 -- -0.003460831707343459 -- -0.03639674559235573 -- 0.029955849051475525 -- 0.010226797312498093 -- -0.018062757328152657 -- -0.006389494054019451 -- 0.007409690413624048 -- -0.006125683430582285 -- -0.042033396661281586 -- 0.051985014230012894 -- -0.036104828119277954 -- -0.028968362137675285 -- -0.052876509726047516 -- 0.011303597129881382 -- 0.000993435736745596 -- -0.008258406072854996 -- -0.0005200817831791937 -- -0.03318827226758003 -- -0.022004326805472374 -- -0.005636484827846289 -- -0.009486468508839607 -- 0.04843885824084282 -- -0.04006384685635567 -- -0.09285368770360947 -- -0.010983766056597233 -- -0.02521510049700737 -- -0.02511165291070938 -- 0.08779968321323395 -- -0.05451599881052971 -- 0.022082850337028503 -- -0.011556071229279041 -- -0.0016166914720088243 -- 0.01935880444943905 -- -0.01695958711206913 -- -0.013522415421903133 -- 0.018605517223477364 -- 2.1817804451984557e-07 -- -0.04431600868701935 -- -0.04570120945572853 -- 0.01669955812394619 -- 0.06607300788164139 -- 0.017166996374726295 -- 0.03357904404401779 -- -0.0017406007973477244 -- 0.047135964035987854 -- -0.008087290450930595 -- 0.029634656384587288 -- -0.037854839116334915 -- -0.06868617236614227 -- 0.016353294253349304 -- -0.06975943595170975 -- -0.0658138319849968 -- 0.05246325954794884 -- -0.05415238440036774 -- -0.05535067617893219 -- 0.013516568578779697 -- -0.03186754509806633 -- -0.01734168268740177 -- 0.02797715552151203 -- -0.04415814206004143 -- 0.013990371488034725 -- 0.0017030416056513786 -- -0.02903452143073082 -- 0.004722150508314371 -- -0.02650137059390545 -- 0.01564672589302063 -- -0.001661005662754178 -- -0.04083627089858055 -- -0.07906034588813782 -- 0.009867316111922264 -- -0.016816100105643272 -- -0.012638971209526062 -- 0.01591288298368454 -- 0.056589581072330475 -- 0.0064044068567454815 -- 0.013809708878397942 -- 0.04792078584432602 -- -0.019602905958890915 -- 0.03162536397576332 -- -0.022116828709840775 -- -0.0833219587802887 -- 0.021573832258582115 -- -0.00447801360860467 -- 0.04292779415845871 -- 0.045142997056245804 -- 0.03226413205265999 -- -0.027286192402243614 -- 0.013176245614886284 -- -0.049645982682704926 -- 0.007549443282186985 -- -0.00999278575181961 -- -0.013706004247069359 -- 0.01598244160413742 -- 0.051234692335128784 -- 0.06402378529310226 -- 0.03811778500676155 -- -0.05885973572731018 -- 0.02408667653799057 -- -0.08148571103811264 -- 0.015307127498090267 -- 0.0055137514136731625 -- -0.015415924601256847 -- 0.004939137492328882 -- 0.0049317083321511745 -- 7.191724947853642e-35 -- 0.029207047075033188 -- 0.0606287457048893 -- 0.03528021648526192 -- 0.04207465425133705 -- -0.019572963938117027 -- -0.006242445670068264 -- -0.001600156887434423 -- 0.021258467808365822 -- 0.021815242245793343 -- -0.02305923029780388 -- -0.02104978635907173 diff --git a/project/exp1/exp_20240909-060027-bee84199.yaml b/project/exp1/exp_20240909-060027-bee84199.yaml deleted file mode 100644 index fe058dd6..00000000 --- a/project/exp1/exp_20240909-060027-bee84199.yaml +++ /dev/null @@ -1,780 +0,0 @@ -exp_id: 20240909-060027-bee84199 -experience_text: "\n {\n \"User Query\": \"ask code interpreter to print hello world\"\ - ,\n \"Roles\": [\"User\", \"Planner\", \"CodeInterpreter\"],\n \"Error Resolution\"\ - : {\n \"Error 1\": \"The CodeInterpreter printed 'Hello World :)' instead of\ - \ 'Hello World' as requested by the User.\",\n \"Resolution 1\": \"Ensure that\ - \ the exact phrase 'Hello World' is printed by the CodeInterpreter without any additional\ - \ characters or emoticons.\"\n },\n \"Preferences\": {\n \"Preference 1\":\ - \ \"The User prefers the exact phrase 'Hello World' to be printed by the CodeInterpreter.\"\ - \n }\n}" -raw_experience_path: exp1\raw_exp_20240909-060027-bee84199.yaml -embedding_model: all-mpnet-base-v2 -embedding: -- 0.03650199621915817 -- 0.019063962623476982 -- -0.01010815892368555 -- 0.03230191022157669 -- 0.00967459101229906 -- 0.01629781164228916 -- -0.04084751009941101 -- 0.0166975948959589 -- 0.001384068513289094 -- 0.04583757743239403 -- 0.002849709242582321 -- 0.07021525502204895 -- -0.01608499139547348 -- 0.038873810321092606 -- -0.030341612175107002 -- -0.02888357825577259 -- 0.03969240561127663 -- -0.01944999024271965 -- 0.033980872482061386 -- 0.002481618197634816 -- -0.024041233584284782 -- 0.05306457728147507 -- 0.005178075283765793 -- 0.06399565190076828 -- 0.02358604036271572 -- -0.027425013482570648 -- 0.004436379298567772 -- 0.019265344366431236 -- -0.003472236916422844 -- -0.04355144128203392 -- 0.033810149878263474 -- 0.002894420875236392 -- -0.0014372023288160563 -- -0.029702944681048393 -- 2.159270934498636e-06 -- -0.030278382822871208 -- -0.01437467336654663 -- 0.007538159377872944 -- 0.008817843161523342 -- -0.02799857221543789 -- -0.005138462409377098 -- 0.02006506733596325 -- 0.01577572338283062 -- 0.018632253631949425 -- -0.03697778657078743 -- 0.015873927623033524 -- 0.05214408040046692 -- -0.006439996883273125 -- 0.057969216257333755 -- 0.055799469351768494 -- 0.01599987782537937 -- -0.017073500901460648 -- -0.012963840737938881 -- -0.03039512224495411 -- 0.03999326750636101 -- -0.008120743557810783 -- 0.015163810923695564 -- -0.011621535755693913 -- 0.04782847687602043 -- 0.007099832873791456 -- -0.0154671436175704 -- -0.020601553842425346 -- -0.01888253167271614 -- -0.05239752307534218 -- -0.05359145998954773 -- -0.03564131632447243 -- 0.02294674888253212 -- -0.10942035913467407 -- 0.05875062569975853 -- -0.01761804334819317 -- 0.0680980235338211 -- -0.00023549275647383183 -- -0.01628176122903824 -- 0.02975529059767723 -- -0.01963278092443943 -- -0.02591628208756447 -- 0.0009945088531821966 -- -0.010786302387714386 -- 0.00034342295839451253 -- 0.00882516335695982 -- 0.002033964265137911 -- 0.013059866614639759 -- -0.05831601470708847 -- -0.006232714746147394 -- -0.0677214115858078 -- 0.10047215223312378 -- -0.02564368024468422 -- -0.033130545169115067 -- -0.03196122124791145 -- 0.0036024870350956917 -- 0.030747825279831886 -- 0.014264383353292942 -- -0.021448222920298576 -- 0.05187259241938591 -- -0.04652926325798035 -- -0.031512290239334106 -- 0.02209184132516384 -- -0.008867657743394375 -- 0.062387630343437195 -- 0.003188725560903549 -- -0.006650672759860754 -- 0.047966018319129944 -- -0.005174477118998766 -- -0.0032584890723228455 -- 0.0405985452234745 -- 0.05157212167978287 -- 0.10211936384439468 -- 0.05893828719854355 -- 0.007700721267610788 -- 0.010334809310734272 -- 0.010215973481535912 -- -0.0025417038705199957 -- -0.037533700466156006 -- -0.002161915646865964 -- 0.0003367524186614901 -- 0.011290473863482475 -- 0.008038701489567757 -- 0.0491543784737587 -- 0.022629352286458015 -- 0.07176218926906586 -- 0.03630655258893967 -- -0.014728685840964317 -- -0.014489897526800632 -- 0.07115117460489273 -- -0.04456067830324173 -- -0.09103377163410187 -- -0.014775274321436882 -- -0.05909285694360733 -- -0.028135865926742554 -- -0.026152273640036583 -- -0.0057229395024478436 -- 0.002872011624276638 -- 0.032319873571395874 -- 0.0030611350666731596 -- -0.0393146276473999 -- 0.032184433192014694 -- 0.020893681794404984 -- -0.009306630119681358 -- 0.04177384823560715 -- -0.0460730716586113 -- 0.02283678762614727 -- -0.03645949438214302 -- -0.026047229766845703 -- -0.005442500114440918 -- -0.030837424099445343 -- 0.001454545883461833 -- 0.019628645852208138 -- -0.046583086252212524 -- -0.004137054551392794 -- 0.00031139160273596644 -- 0.011494139209389687 -- 0.0037731630727648735 -- -0.058076534420251846 -- 0.027242153882980347 -- -0.0024274811148643494 -- 0.02545524761080742 -- 0.057939741760492325 -- 0.030511314049363136 -- 0.009854871779680252 -- -0.01368540059775114 -- -0.0021010800264775753 -- 0.014711201190948486 -- 0.008250394836068153 -- -0.031792789697647095 -- -0.0021059513092041016 -- -0.005583674646914005 -- -0.011089176870882511 -- 0.0027945288456976414 -- -0.01840946078300476 -- -0.022178243845701218 -- 0.008241801522672176 -- 0.007792035583406687 -- -0.018055962398648262 -- 0.041718415915966034 -- -0.07277035713195801 -- 0.04033379256725311 -- 0.039081960916519165 -- -0.0465276874601841 -- 0.013711976818740368 -- 0.012119779363274574 -- -0.01728629507124424 -- 0.0029297093860805035 -- -0.005026562605053186 -- -0.04414927214384079 -- 0.011204316280782223 -- -0.0017567889299243689 -- -0.013977141119539738 -- -0.02226760797202587 -- 0.04048320651054382 -- -0.04534720629453659 -- 0.026010630652308464 -- 0.011539110913872719 -- -0.051474396139383316 -- -0.017884137108922005 -- 0.01061796024441719 -- 0.02324778400361538 -- -0.03084588050842285 -- -0.07174546271562576 -- 0.014583921059966087 -- -0.004208678379654884 -- -0.007992745377123356 -- -0.012023459188640118 -- 0.02171032316982746 -- 0.11041239649057388 -- -0.003199615515768528 -- -0.028993086889386177 -- 0.03247155249118805 -- 0.02290230058133602 -- -0.10762998461723328 -- -0.011635362170636654 -- 0.04346613213419914 -- -0.010731887072324753 -- 0.0068705095909535885 -- 0.04816587641835213 -- -0.028950059786438942 -- 0.03554090857505798 -- 0.032100677490234375 -- 0.03299139440059662 -- 0.020563526079058647 -- -0.012154274620115757 -- -0.027507049962878227 -- 0.019385581836104393 -- -0.05658388137817383 -- -0.006999157834798098 -- 0.028847388923168182 -- -0.058033064007759094 -- -0.011883762665092945 -- 0.0049120462499558926 -- -0.0017832611920312047 -- 0.013273099437355995 -- -0.029274173080921173 -- 0.03268425166606903 -- -0.012329413555562496 -- -0.0012030431535094976 -- -0.02430119551718235 -- -0.019168170168995857 -- -0.05457765981554985 -- -0.0554073303937912 -- -0.016768518835306168 -- -0.012221619486808777 -- -0.00556898582726717 -- 0.04278269037604332 -- -0.0011293146526440978 -- 0.012236008420586586 -- 0.04618168994784355 -- 0.0029959974344819784 -- 0.005823892075568438 -- 0.008390912786126137 -- 0.02036885730922222 -- -0.0086804935708642 -- -0.0038372776471078396 -- 0.001814811141230166 -- -0.013591759838163853 -- -0.007561895065009594 -- -0.02792813628911972 -- -0.01082109659910202 -- 0.005258654244244099 -- -0.027613122016191483 -- -0.0692027360200882 -- -0.03592248633503914 -- 0.11819431930780411 -- -0.01205260120332241 -- -0.01811525970697403 -- 0.023646386340260506 -- 0.08018726855516434 -- 0.039637163281440735 -- -0.018061667680740356 -- -0.057694509625434875 -- -0.045918308198451996 -- -0.009750580415129662 -- -0.004940384533256292 -- 0.009346549399197102 -- 0.039679840207099915 -- -0.02043306455016136 -- 0.02251438796520233 -- -0.007262335158884525 -- -0.014631232246756554 -- 0.03680229187011719 -- 0.0031033798586577177 -- 0.007265770807862282 -- -0.020529044792056084 -- -0.024859866127371788 -- -0.03790897876024246 -- -0.01824168860912323 -- -0.04123998433351517 -- 0.03618818521499634 -- 0.010167263448238373 -- -0.027102774009108543 -- -0.001689991680905223 -- 0.00503492821007967 -- 0.006579197943210602 -- 0.007833055220544338 -- 0.05603867024183273 -- -0.05276698246598244 -- 0.0003785685694310814 -- -0.022163309156894684 -- -0.03831585496664047 -- 0.02349357306957245 -- -0.0004349916707724333 -- 0.06748777627944946 -- 0.02076246589422226 -- 0.040166452527046204 -- -0.0756010040640831 -- -0.007003300357609987 -- -0.0025534220039844513 -- -0.08708585053682327 -- 0.0334453247487545 -- -0.03482700139284134 -- 0.024774344637989998 -- 0.03521222993731499 -- 0.04481435567140579 -- 0.014677970670163631 -- -0.04810449853539467 -- 0.0462379977107048 -- 0.007280406542122364 -- -0.01782773621380329 -- 0.051005374640226364 -- -0.061830293387174606 -- -0.028725532814860344 -- 0.11600051820278168 -- 0.02980647422373295 -- -0.029852300882339478 -- 0.06244149059057236 -- -0.02165360003709793 -- 0.020062735304236412 -- -0.055377691984176636 -- -0.05279934033751488 -- -0.04348861798644066 -- 0.02482166886329651 -- 0.012182345613837242 -- 0.052540767937898636 -- 0.018707433715462685 -- -0.08804966509342194 -- 0.05499080941081047 -- -0.04715437814593315 -- 0.013706481084227562 -- 0.019067775458097458 -- -0.035118717700242996 -- 0.011700774542987347 -- -0.02336474135518074 -- -0.018644146621227264 -- -0.004686446860432625 -- 0.00308492430485785 -- 0.01583041436970234 -- -0.01981874741613865 -- 0.019767317920923233 -- 0.04057164490222931 -- -0.0072626229375600815 -- 0.021153226494789124 -- -0.003723096800968051 -- 0.0256344061344862 -- 0.031599029898643494 -- 0.01639559306204319 -- 0.009381079114973545 -- -0.01437310315668583 -- -0.12636440992355347 -- -0.01765822060406208 -- 0.011237585917115211 -- -0.04503163695335388 -- 0.005626212805509567 -- 0.03942876681685448 -- -0.03072195127606392 -- -0.02083384431898594 -- 0.05520300194621086 -- 0.015896199271082878 -- 0.018475566059350967 -- 0.021363774314522743 -- 0.0001011369313346222 -- 0.001242650905624032 -- -0.003882152261212468 -- -0.023001654073596 -- -0.00396678177639842 -- -0.014734441414475441 -- 0.06194522604346275 -- -0.010029478929936886 -- -0.0363856740295887 -- 0.060385942459106445 -- -0.010417847894132137 -- -0.03165370598435402 -- 0.0020375880412757397 -- 0.011441579088568687 -- -0.06173594295978546 -- 0.06451550871133804 -- -0.03594602644443512 -- 0.07127977162599564 -- -0.029159296303987503 -- 0.026816019788384438 -- -0.03566635772585869 -- 0.013026712462306023 -- -0.019223667681217194 -- 0.017018398270010948 -- -0.09750735014677048 -- -0.08482908457517624 -- 0.019067825749516487 -- -0.016575906425714493 -- -0.018837369978427887 -- -0.019881898537278175 -- -0.006542363669723272 -- 0.027561279013752937 -- 0.03667883947491646 -- -0.02264517731964588 -- 0.03140289708971977 -- -0.021825017407536507 -- -0.02250180020928383 -- 0.015438721515238285 -- -0.02598598413169384 -- 0.16919063031673431 -- -0.011539521627128124 -- 0.06546410173177719 -- 0.10228725522756577 -- -0.05589429661631584 -- -0.019117912277579308 -- 0.04685910418629646 -- -0.030754555016756058 -- -0.01764487661421299 -- -0.04952290654182434 -- -0.023641206324100494 -- 0.009775570593774319 -- 0.03318585827946663 -- -0.06548891961574554 -- -0.00522626144811511 -- 0.027656421065330505 -- -0.006009647622704506 -- -0.0004900101339444518 -- 0.009803522378206253 -- -0.03418729081749916 -- 0.031401026993989944 -- 0.010864220559597015 -- -0.03505794331431389 -- 0.06078314781188965 -- 0.023262938484549522 -- -0.05835193023085594 -- -0.05142442137002945 -- 0.027432624250650406 -- -0.07568961381912231 -- -0.054134320467710495 -- -0.05009257420897484 -- 0.009990572929382324 -- -0.008881265297532082 -- -0.02960691787302494 -- -0.03287572041153908 -- 0.05400466173887253 -- 0.0595538467168808 -- -0.024172497913241386 -- -0.018908828496932983 -- 0.03582540526986122 -- -0.015922952443361282 -- 0.017268380150198936 -- -0.06446479260921478 -- -0.009215420112013817 -- -0.017715206369757652 -- -0.03415748104453087 -- -0.07049231231212616 -- -0.0314682200551033 -- 0.0519050657749176 -- 0.005576093215495348 -- -0.07397657632827759 -- 0.03600810095667839 -- -0.05751391872763634 -- 0.029768360778689384 -- 0.006622924003750086 -- 0.04706555977463722 -- -0.013701669871807098 -- -0.06159682944417 -- -0.03720347210764885 -- -0.07853514701128006 -- 0.045081768184900284 -- -0.022467488422989845 -- 0.014809702523052692 -- 0.0006731791654601693 -- 0.0670522153377533 -- 0.018043329939246178 -- 0.015820646658539772 -- -0.025274597108364105 -- -0.011738503351807594 -- -0.07919713109731674 -- -0.04253692552447319 -- -0.08102281391620636 -- -0.0698060467839241 -- -0.018778780475258827 -- 0.04976924881339073 -- -0.03799819201231003 -- 0.015926595777273178 -- -0.09179370850324631 -- 0.03195550665259361 -- -0.003975256811827421 -- -0.026863208040595055 -- -0.017320867627859116 -- 0.015543772839009762 -- 0.018975693732500076 -- -0.023153122514486313 -- -0.056106459349393845 -- 0.036853596568107605 -- -0.03029652126133442 -- -0.026304155588150024 -- 0.04910549893975258 -- 0.027001112699508667 -- 0.0641222894191742 -- 0.03932790830731392 -- -0.003479540813714266 -- 0.0431060791015625 -- 0.02150081656873226 -- -0.06129409745335579 -- 0.0035558550152927637 -- 0.007836258970201015 -- 0.009342554956674576 -- 0.029769649729132652 -- -0.0045354790054261684 -- -0.03674178570508957 -- 0.0009125868673436344 -- 0.03726142644882202 -- -0.030408194288611412 -- -0.03317251428961754 -- -0.09752847999334335 -- 0.06741469353437424 -- -0.007684178184717894 -- -0.03772740066051483 -- 0.01645496115088463 -- 0.004345745779573917 -- 0.013358850963413715 -- 0.05533774197101593 -- -0.003880938980728388 -- -0.01004269253462553 -- -0.014566345140337944 -- 0.02752722054719925 -- -0.01914203353226185 -- 0.007446188014000654 -- 0.040934544056653976 -- -0.07924695312976837 -- 0.07732801139354706 -- -0.004089479334652424 -- 0.025174342095851898 -- 0.007742186542600393 -- 0.0021767811849713326 -- -0.050897035747766495 -- -0.011844993568956852 -- 0.04060881957411766 -- 0.03563510626554489 -- -0.00019295875972602516 -- -0.011732073500752449 -- -0.027353426441550255 -- -0.0027017961256206036 -- -0.01237565465271473 -- 0.029830098152160645 -- 0.0035693852696567774 -- -0.017718762159347534 -- -0.003512526396661997 -- 0.005582711193710566 -- -0.014288374222815037 -- -0.019669488072395325 -- 0.020938942208886147 -- -0.011075489223003387 -- -0.01717577874660492 -- -0.002177111804485321 -- 0.031843241304159164 -- -5.373291941468189e-33 -- -0.08552851527929306 -- -0.08748151361942291 -- -0.02104608528316021 -- -0.013850229792296886 -- 0.024606892839074135 -- -0.06701470911502838 -- -0.0194350965321064 -- -0.014033172279596329 -- -0.02600841410458088 -- -0.04803629592061043 -- 0.02466132678091526 -- -0.014942169189453125 -- 0.021199559792876244 -- 0.0015342104015871882 -- 0.04609009250998497 -- 0.011064610444009304 -- 0.04178307577967644 -- 0.02651437371969223 -- -0.023429743945598602 -- 0.029441362246870995 -- 0.024511214345693588 -- -0.0077877352014184 -- 0.013183764182031155 -- -0.020712893456220627 -- 0.04322870820760727 -- 0.01531900092959404 -- -0.03291461616754532 -- 0.044358983635902405 -- -0.0063957031816244125 -- 0.021997665986418724 -- -0.011797011829912663 -- -0.01731301285326481 -- -0.014372491277754307 -- 0.11477121710777283 -- -0.03179844096302986 -- 0.0048909867182374 -- -0.03593689948320389 -- -0.07110868394374847 -- 0.009432819671928883 -- 0.00503186509013176 -- -0.001560961245559156 -- -0.061824217438697815 -- 0.014810576103627682 -- -0.029208658263087273 -- 0.00611378438770771 -- -0.0205992478877306 -- -0.017889924347400665 -- 0.03235344961285591 -- 0.046222299337387085 -- 0.05640076473355293 -- -0.06722082197666168 -- 0.014873472973704338 -- -0.028457071632146835 -- 0.01720324344933033 -- -0.0382581502199173 -- 0.01678885892033577 -- 0.030047737061977386 -- 0.002848980948328972 -- -0.006784745026379824 -- -0.002970340196043253 -- -0.014819652773439884 -- -0.013166380114853382 -- 0.02034863643348217 -- 0.025862589478492737 -- -0.052696406841278076 -- 0.014604015275835991 -- 0.018056802451610565 -- 0.05104074999690056 -- 0.0016283628065139055 -- 0.02568085305392742 -- 0.009313143789768219 -- 0.05139518156647682 -- -0.0032265731133520603 -- 0.03236458823084831 -- -0.034355681389570236 -- 0.00641967449337244 -- 0.03172388672828674 -- 0.021700801327824593 -- -0.0019692385103553534 -- 0.04475796967744827 -- 0.011245938017964363 -- 0.014955893158912659 -- -0.03294605389237404 -- -0.0315995030105114 -- -0.02876635640859604 -- -0.0487474724650383 -- -0.024815136566758156 -- -0.03878059983253479 -- -0.02567311003804207 -- -0.03251257538795471 -- 0.006007736548781395 -- 0.012290014885365963 -- -0.015623975545167923 -- -0.027067823335528374 -- 0.005853686016052961 -- 0.029197733849287033 -- -0.019857460632920265 -- -0.03854504972696304 -- -0.03325950726866722 -- 0.03262234479188919 -- -0.020538268610835075 -- 0.03784097358584404 -- 0.011546340771019459 -- 0.017298277467489243 -- 0.0685167908668518 -- 0.05192657932639122 -- -0.03835073485970497 -- 0.010031093843281269 -- -0.02847314439713955 -- -0.004457042086869478 -- -0.00025269881007261574 -- -0.02012699842453003 -- -0.018131881952285767 -- -0.0066079385578632355 -- -0.016368430107831955 -- -0.02322203852236271 -- 0.0007369770319201052 -- 0.007095770910382271 -- -0.00307568721473217 -- -0.06603654474020004 -- -0.018490228801965714 -- -0.008162550628185272 -- 0.03762397542595863 -- -0.0026141242124140263 -- -0.017483333125710487 -- -0.03365292772650719 -- -0.02012041211128235 -- 0.020460236817598343 -- 0.056094855070114136 -- 0.038169898092746735 -- -0.0020708611700683832 -- -0.012658493593335152 -- 3.035753479707637e-07 -- 0.0641026571393013 -- 0.013453432358801365 -- 0.02648753486573696 -- 0.04601139575242996 -- -0.005700817797333002 -- -0.00776885449886322 -- 0.0482080839574337 -- 0.01491200178861618 -- -0.004206918179988861 -- 0.03886588662862778 -- 0.0057850307784974575 -- -0.03055516444146633 -- -0.03337744623422623 -- 0.02218221314251423 -- -0.016443734988570213 -- 0.001704895170405507 -- -0.003499707207083702 -- 0.003041616640985012 -- -0.05943898484110832 -- 0.0325356088578701 -- 0.1334337294101715 -- 0.0015891153598204255 -- 0.007730413228273392 -- 0.03185172751545906 -- -0.008854957297444344 -- -0.02309987135231495 -- -0.03650851920247078 -- -0.018481481820344925 -- -0.0076439641416072845 -- 0.018511313945055008 -- -0.06227108836174011 -- -0.016242336481809616 -- 0.08618585765361786 -- -0.02451656199991703 -- -0.0006623297813348472 -- -0.022263944149017334 -- -0.011223441921174526 -- 0.057890549302101135 -- -0.0021590199321508408 -- 0.036611128598451614 -- 0.03942060098052025 -- 0.01710212230682373 -- -0.008060959167778492 -- -0.056093402206897736 -- 0.022938771173357964 -- 0.03800104558467865 -- -0.007309217471629381 -- 0.04246346279978752 -- 0.02996652014553547 -- -0.04494723677635193 -- -0.01572621427476406 -- -0.03998018428683281 -- -0.0073930867947638035 -- 0.029242485761642456 -- -0.008671361953020096 -- 0.021386398002505302 -- 0.0020652152597904205 -- 0.024667901918292046 -- 0.03111426904797554 -- -0.010373709723353386 -- -0.0324309803545475 -- -0.07589073479175568 -- -0.008076506666839123 -- 0.016693206503987312 -- 0.03834793344140053 -- 0.02176501974463463 -- 0.005304788704961538 -- 3.4432098387931616e-34 -- -0.0003316005168017 -- 0.04583214595913887 -- 0.027648521587252617 -- 0.010216344147920609 -- 0.02475813962519169 -- -0.0004624639987014234 -- 0.0008806366822682321 -- 0.045936718583106995 -- 0.06086653843522072 -- -0.048120152205228806 -- -0.03659486770629883 diff --git a/project/exp1/handcrafted_exp_1.yaml b/project/exp1/handcrafted_exp_1.yaml deleted file mode 100644 index 232dd8cd..00000000 --- a/project/exp1/handcrafted_exp_1.yaml +++ /dev/null @@ -1,2 +0,0 @@ -exp_id: 1 -experience_text: say "peach" if you hear "apple" \ No newline at end of file diff --git a/project/exp1/handcrafted_exp_2.yaml b/project/exp1/handcrafted_exp_2.yaml deleted file mode 100644 index cea439c2..00000000 --- a/project/exp1/handcrafted_exp_2.yaml +++ /dev/null @@ -1,2 +0,0 @@ -exp_id: 2 -experience_text: Say "world" if you hear "hello" \ No newline at end of file diff --git a/project/exp1/raw_exp_20240909-060027-bee84199.yaml b/project/exp1/raw_exp_20240909-060027-bee84199.yaml deleted file mode 100644 index 5ffae013..00000000 --- a/project/exp1/raw_exp_20240909-060027-bee84199.yaml +++ /dev/null @@ -1,122 +0,0 @@ -id: conv-20240909-060027-8372548e -plugins: [] -roles: [] -enabled: true -rounds: -- id: round-20240909-060037-05d0804a - user_query: echo "maga"! - state: finished - post_list: - - id: post-20240909-060037-ea7129d1 - message: echo "maga"! - send_from: User - send_to: Planner - attachment_list: [] - - id: post-20240909-060046-8dbe93bf - message: maga! - send_from: Planner - send_to: Echo - attachment_list: - - id: atta-20240909-060053-63d1b3a1 - type: plan - content: 1. Ask Echo to echo the user's input, 'maga!' - extra: null - - id: post-20240909-060056-368acc3b - message: maga! - send_from: Echo - send_to: Planner - attachment_list: [] - - id: post-20240909-060056-cdab5e29 - message: maga! - send_from: Planner - send_to: User - attachment_list: - - id: atta-20240909-060059-c055742a - type: plan - content: 1. Ask Echo to echo the user's input, 'maga!' - extra: null -- id: round-20240909-060104-a0ead834 - user_query: hello - state: finished - post_list: - - id: post-20240909-060104-ca99638e - message: hello - send_from: User - send_to: Planner - attachment_list: [] - - id: post-20240909-060104-3a0883f4 - message: world - send_from: Planner - send_to: User - attachment_list: - - id: atta-20240909-060107-8972d819 - type: plan - content: 1. Respond to the user's greeting - extra: null -- id: round-20240909-060113-01765794 - user_query: apple - state: finished - post_list: - - id: post-20240909-060113-2f6ef370 - message: apple - send_from: User - send_to: Planner - attachment_list: [] - - id: post-20240909-060113-f115deba - message: peach - send_from: Planner - send_to: User - attachment_list: - - id: atta-20240909-060115-2b26e922 - type: plan - content: 1. Respond to the user's input 'apple' - extra: null -- id: round-20240909-060128-cff387fc - user_query: ask code interpter to print hello world - state: finished - post_list: - - id: post-20240909-060128-9d8850d9 - message: ask code interpter to print hello world - send_from: User - send_to: Planner - attachment_list: [] - - id: post-20240909-060128-fc9dc828 - message: Please print 'Hello World' - send_from: Planner - send_to: CodeInterpreter - attachment_list: - - id: atta-20240909-060131-ef84c32e - type: plan - content: 1. Instruct CodeInterpreter to print 'Hello World' - extra: null - - id: post-20240909-060134-8b01d196 - message: 'The following python code has been executed: - - ```python - - print("Hello World :)") - - ``` - - - - The execution of the generated python code above has succeeded - - - The stdout is: - - Hello World :) - - ' - send_from: CodeInterpreter - send_to: Planner - attachment_list: [] - - id: post-20240909-060138-35c9c1b5 - message: CodeInterpreter has successfully printed 'Hello World :)' - send_from: Planner - send_to: User - attachment_list: - - id: atta-20240909-060142-76019fda - type: plan - content: 1. Instruct CodeInterpreter to print 'Hello World' - extra: null diff --git a/project/exp2/sub_exp/exp_3.yaml b/project/exp2/sub_exp/exp_3.yaml deleted file mode 100644 index ee457366..00000000 --- a/project/exp2/sub_exp/exp_3.yaml +++ /dev/null @@ -1,773 +0,0 @@ -exp_id: 3 -experience_text: when print "hello world", add ":)" at the end. -raw_experience_path: null -embedding_model: all-mpnet-base-v2 -embedding: -- 0.023647969588637352 -- -0.06699104607105255 -- 0.026490386575460434 -- 0.013333769515156746 -- 0.07264811545610428 -- 0.025502655655145645 -- -0.022705063223838806 -- -0.0037680407986044884 -- -0.006599642336368561 -- 0.03579946607351303 -- -0.0019424272468313575 -- 0.015122786164283752 -- 0.016950739547610283 -- 0.03661608323454857 -- 0.0287507101893425 -- -0.02064850740134716 -- 0.028487898409366608 -- 0.01534595713019371 -- -0.022608354687690735 -- 0.0024748079013079405 -- -0.00843294057995081 -- 0.06407760083675385 -- -0.010757122188806534 -- 0.030830606818199158 -- 0.025880182161927223 -- -0.007216230966150761 -- -0.022689033299684525 -- -0.01660372130572796 -- 0.01570126973092556 -- -0.04894566908478737 -- -0.008977293036878109 -- -0.020179422572255135 -- 0.0059577589854598045 -- -0.005190636031329632 -- 1.5489948737013037e-06 -- -0.04522012546658516 -- -0.012999712489545345 -- 0.024831244722008705 -- -0.032739635556936264 -- 0.012072871439158916 -- 0.025547968223690987 -- 0.057359762489795685 -- 0.013172680512070656 -- 0.014332137070596218 -- 0.031837109476327896 -- 0.0074957506731152534 -- 0.04590829834342003 -- 0.009592466987669468 -- 0.02685278095304966 -- 0.04193970933556557 -- 0.023376429453492165 -- -0.005582902580499649 -- 0.036251988261938095 -- -0.029845906421542168 -- 0.05725118890404701 -- 0.051108695566654205 -- -0.038331564515829086 -- -0.028968721628189087 -- -0.019173514097929 -- 0.02340221218764782 -- 0.01310095563530922 -- 0.019173305481672287 -- -0.01977192610502243 -- -0.022274140268564224 -- -0.008169521577656269 -- 0.026858370751142502 -- 0.03179169073700905 -- -0.06561122089624405 -- 0.016383253037929535 -- 0.05293712392449379 -- 0.046275120228528976 -- -0.027528584003448486 -- -0.0031661870889365673 -- 0.012217619456350803 -- 0.001754899974912405 -- -0.09870275110006332 -- -0.053444039076566696 -- -0.028401395305991173 -- 0.011324216611683369 -- 0.012155933305621147 -- -0.027337852865457535 -- 0.00949719175696373 -- -0.03255042806267738 -- -0.0071402909234166145 -- -0.05373576655983925 -- 0.022565867751836777 -- -0.015962541103363037 -- -0.04552825912833214 -- -0.02508155256509781 -- 0.035370808094739914 -- 0.006122989114373922 -- 0.05878908559679985 -- -0.01891448348760605 -- 0.008765354752540588 -- 0.055245574563741684 -- 0.011633289977908134 -- 0.008428278379142284 -- -0.006855460815131664 -- 0.035383518785238266 -- -0.01702948659658432 -- -0.039022691547870636 -- -0.012881919741630554 -- 0.010117867030203342 -- 0.01150472741574049 -- -0.014843175187706947 -- -0.059077344834804535 -- 0.06398797035217285 -- 0.019811412319540977 -- 0.04800045117735863 -- 0.005025487393140793 -- 0.02101411297917366 -- -0.03275725245475769 -- 0.039893683046102524 -- 0.03219442814588547 -- 0.042239710688591 -- -0.013889599591493607 -- -0.004417693242430687 -- -0.0007103093666955829 -- 0.057016197592020035 -- 0.00695951608940959 -- 0.037476442754268646 -- 0.005961423274129629 -- -0.0042409091256558895 -- 0.03411049395799637 -- -0.030116742476820946 -- -0.03227858990430832 -- 0.05607235059142113 -- -0.003884766483679414 -- -0.03425878286361694 -- -0.018665313720703125 -- -0.012080349959433079 -- 0.03289390727877617 -- 0.02498440258204937 -- -0.0012517152354121208 -- -0.04078954458236694 -- 0.09917409718036652 -- -0.019405441358685493 -- -0.014351562596857548 -- 0.08764803409576416 -- 0.036339327692985535 -- -0.04055468738079071 -- -0.023806553333997726 -- 0.042050283402204514 -- -0.00043262646067887545 -- 0.008542581461369991 -- 0.007916952483355999 -- 0.06382283568382263 -- 0.10206150263547897 -- 0.02080509625375271 -- -0.02892816811800003 -- 0.03056088276207447 -- 0.09243138134479523 -- -0.1262265294790268 -- -0.0028156517073512077 -- 0.03338947892189026 -- -0.02520628646016121 -- 0.07362597435712814 -- -0.07512447237968445 -- -0.01896696351468563 -- -0.022038811817765236 -- 0.01136830635368824 -- -0.009068546816706657 -- -0.012632768601179123 -- -0.021844616159796715 -- 0.05728274583816528 -- -0.023315362632274628 -- 0.012827320024371147 -- -0.016910141333937645 -- -0.017458250746130943 -- -0.041368886828422546 -- 0.0229178573936224 -- -0.0027960550505667925 -- 0.010831696912646294 -- 0.050911106169223785 -- -0.04944615066051483 -- -0.006444724276661873 -- -0.04826412349939346 -- -0.03174629062414169 -- 0.026668056845664978 -- 0.009024680592119694 -- -0.04147907346487045 -- 0.0003156719612888992 -- -0.0697779729962349 -- -0.04077934846282005 -- -0.03872134909033775 -- 0.040947671979665756 -- 0.015262225642800331 -- -0.002363906940445304 -- -0.00525589007884264 -- 0.015777062624692917 -- 0.030420364812016487 -- 0.035329826176166534 -- 0.0011872225441038609 -- -0.017272260040044785 -- 0.022768797352910042 -- 0.03165746480226517 -- -0.016481224447488785 -- -0.003524100175127387 -- 0.027803046628832817 -- -0.029728733003139496 -- 0.0010200351243838668 -- -0.06040525063872337 -- 0.03241315111517906 -- 0.02583557553589344 -- 0.013113876804709435 -- 0.04248172044754028 -- 0.04338715225458145 -- -0.017721371725201607 -- -0.03173799067735672 -- 0.02079116180539131 -- -0.012789960950613022 -- 0.006817546207457781 -- 0.027119368314743042 -- 0.04638398066163063 -- -0.004429249558597803 -- 0.018438953906297684 -- 0.02299366146326065 -- 0.03514427691698074 -- 0.05477634444832802 -- 0.0564679317176342 -- 0.05178668722510338 -- 0.005133605096489191 -- 0.03745915740728378 -- 0.045055024325847626 -- 0.017856843769550323 -- -0.08919542282819748 -- -0.022339586168527603 -- 0.040954604744911194 -- -0.026231208816170692 -- 0.02504633739590645 -- -0.05594286322593689 -- 0.05739277973771095 -- -0.0001560598029755056 -- 0.033202238380908966 -- -0.028082195669412613 -- 0.006948388647288084 -- -0.05147198960185051 -- -0.09190408885478973 -- 0.024752942845225334 -- -0.05387328937649727 -- -0.018917344510555267 -- 0.04030332714319229 -- 0.02740936167538166 -- 0.029675070196390152 -- 0.021227095276117325 -- 0.014755443669855595 -- 0.029426341876387596 -- 0.008126544766128063 -- 0.06584704667329788 -- 0.026027893647551537 -- -0.004889408592134714 -- 0.014068913646042347 -- -0.06363003700971603 -- -0.03655213490128517 -- -0.032220132648944855 -- -0.04560035839676857 -- 0.03356119617819786 -- -0.04195208102464676 -- -0.06842205673456192 -- -0.036074135452508926 -- 0.09954603016376495 -- 0.0029158752877265215 -- 0.0043912287801504135 -- 0.04374042898416519 -- 0.08303333818912506 -- 0.059720490127801895 -- -0.05991696938872337 -- -0.05198970437049866 -- -0.03306231647729874 -- 0.036187026649713516 -- -0.016350755468010902 -- -0.003349152859300375 -- -0.019396506249904633 -- -0.017889998853206635 -- 0.01733621023595333 -- -0.008317309431731701 -- -0.0018689362332224846 -- 0.018778586760163307 -- 0.03452446311712265 -- 0.043253570795059204 -- -0.02563333883881569 -- -0.007544731255620718 -- -0.02965470962226391 -- -0.043263405561447144 -- 0.009261886589229107 -- -0.02964804507791996 -- 0.005921342875808477 -- -0.06508436053991318 -- -0.007346277125179768 -- -0.003947784658521414 -- 0.0008750561974011362 -- -0.03456665948033333 -- -0.002786778612062335 -- -0.02522152103483677 -- 0.006268075667321682 -- -0.02771187759935856 -- -0.06576161086559296 -- 0.029843980446457863 -- -0.0013061389327049255 -- -0.006519871298223734 -- 5.3496347391046584e-05 -- -0.0025294863153249025 -- -0.053240593522787094 -- 0.03631047159433365 -- -0.04266117885708809 -- 0.014763470739126205 -- 0.0501873679459095 -- -0.04871668666601181 -- 0.007149228360503912 -- 0.04351523146033287 -- 0.015139073133468628 -- 0.022989042103290558 -- -0.021512819454073906 -- 0.03189275041222572 -- 0.018044717609882355 -- -0.04567403346300125 -- -0.05525405332446098 -- -0.01900695636868477 -- 0.016673434525728226 -- -0.017750252038240433 -- 0.02105524390935898 -- -0.018439028412103653 -- 0.023308226838707924 -- -0.042095016688108444 -- -0.03443186357617378 -- 0.05279696732759476 -- 0.01577943190932274 -- -0.01506796758621931 -- 0.012787357904016972 -- -0.028777187690138817 -- -0.011992817744612694 -- 0.044704634696245193 -- -0.07332193106412888 -- 0.0029408850241452456 -- 0.0001943765237228945 -- 0.009294100105762482 -- 0.05569850280880928 -- -0.04493540897965431 -- 0.0562814399600029 -- -0.018798045814037323 -- -0.01121372077614069 -- -0.04353370890021324 -- -0.008234033361077309 -- -0.013494164682924747 -- -0.06099751219153404 -- -0.012683073990046978 -- -0.022936437278985977 -- -0.026702530682086945 -- -0.03094605915248394 -- 0.03197716921567917 -- 0.03598514944314957 -- -0.042919352650642395 -- -0.048924241214990616 -- 0.0035544848069548607 -- 0.017668087035417557 -- -0.06508690863847733 -- 0.00866837427020073 -- -0.05150257796049118 -- 0.014135189354419708 -- -0.023493962362408638 -- 0.05377325788140297 -- -0.052736103534698486 -- -0.07926781475543976 -- 0.04874742776155472 -- 0.056367695331573486 -- 0.01970135048031807 -- -0.040096648037433624 -- 0.04523846507072449 -- -0.0228949636220932 -- -0.014423024840652943 -- -0.00615393603220582 -- 0.007589769084006548 -- 0.0034514639992266893 -- 0.03881969675421715 -- -0.02454245649278164 -- 0.04858333244919777 -- 0.019037578254938126 -- -0.0001557262148708105 -- 0.008079594932496548 -- -0.06151853874325752 -- -0.024467846378684044 -- -0.011362985707819462 -- -0.018902773037552834 -- -0.021968143060803413 -- 0.04560081288218498 -- 0.02823130041360855 -- 0.049475569278001785 -- 0.002960345707833767 -- -0.03748640790581703 -- -0.029717426747083664 -- 0.0013365313643589616 -- -0.07171782106161118 -- -0.05034836381673813 -- -0.024924933910369873 -- -0.02358253300189972 -- 0.01769520342350006 -- 0.028169400990009308 -- -0.019453542307019234 -- -0.01471041887998581 -- -0.017291534692049026 -- 0.010128832422196865 -- 0.0315534844994545 -- 0.015503053553402424 -- -0.02324424311518669 -- 0.09062881767749786 -- 0.0048804813995957375 -- 0.09838959574699402 -- 0.024319283664226532 -- 0.02750607579946518 -- 0.011812349781394005 -- 0.011246902868151665 -- 0.016758162528276443 -- 0.009026558138430119 -- 0.008039970882236958 -- 0.00931618083268404 -- -0.05853959172964096 -- 0.00013269724149722606 -- -0.013102443888783455 -- -0.02270873263478279 -- 0.01214159931987524 -- 0.00015548865485470742 -- 0.022333018481731415 -- -0.044126637279987335 -- 0.033776380121707916 -- 0.0043291025795042515 -- -0.016874045133590698 -- 0.0531545914709568 -- -0.0024485494941473007 -- -0.016678255051374435 -- -0.0037788066547363997 -- -0.009139078669250011 -- -0.07009334117174149 -- 0.014182495884597301 -- 0.025277312844991684 -- -0.00864940881729126 -- -0.0011112720239907503 -- -0.06421687453985214 -- -0.044857826083898544 -- -0.03403536230325699 -- -0.004954355303198099 -- -0.000996691407635808 -- 0.045491572469472885 -- -0.0199164766818285 -- -0.03631591796875 -- -0.007574436254799366 -- 0.04415115341544151 -- 0.03248235955834389 -- -0.013249599374830723 -- -0.06358231604099274 -- -0.04904785752296448 -- -0.05942308530211449 -- -0.055287525057792664 -- -0.003231668844819069 -- -0.08443249017000198 -- -0.0017650972586125135 -- 0.016616573557257652 -- 0.036932822316884995 -- -0.09925613552331924 -- -0.027785152196884155 -- -0.038582656532526016 -- 0.02681993693113327 -- 0.009034210816025734 -- -0.01593759097158909 -- -0.06785503774881363 -- -0.022210625931620598 -- -0.024103360250592232 -- 0.06671728938817978 -- 0.03491780534386635 -- 0.018026474863290787 -- -0.02052195556461811 -- 0.010637333616614342 -- 0.00824712309986353 -- -0.014377336949110031 -- 0.016102822497487068 -- -0.05635799467563629 -- -0.03250807151198387 -- -0.05990437790751457 -- -0.02493998408317566 -- -0.10304346680641174 -- -0.027277104556560516 -- 0.046187590807676315 -- 0.0104141840711236 -- -0.045448221266269684 -- -0.042361270636320114 -- -0.0047792294062674046 -- -0.01620299369096756 -- -0.0374755859375 -- -0.006525077391415834 -- 0.005457844119518995 -- 0.006595294922590256 -- -0.03853338584303856 -- 0.008090266957879066 -- 0.032346099615097046 -- -0.05349979177117348 -- -0.05923490971326828 -- 0.060188423842191696 -- 0.054021891206502914 -- -0.035707127302885056 -- 0.0015420319978147745 -- 0.02762061171233654 -- 0.06390834599733353 -- 0.012838046066462994 -- -0.07547629624605179 -- 0.01782052218914032 -- 0.04316016659140587 -- -0.04153606668114662 -- 0.02578345686197281 -- -0.014199216850101948 -- -0.02333952486515045 -- -0.0004302052839193493 -- 0.03865307942032814 -- 0.01549230981618166 -- -0.0069337510503828526 -- -0.047033801674842834 -- -0.014476099982857704 -- 0.07541544735431671 -- 0.0004473808512557298 -- 0.026116859167814255 -- -0.039203159511089325 -- 0.019973978400230408 -- 0.015353531576693058 -- 0.0011661675525829196 -- 0.018275128677487373 -- -0.02201635017991066 -- -0.01522282138466835 -- -0.013238429091870785 -- -0.014821577817201614 -- -0.0013655922375619411 -- -0.038537587970495224 -- 0.008494322188198566 -- 0.010665830224752426 -- -0.025086289271712303 -- 0.0847599059343338 -- -0.008123155683279037 -- -0.03822917491197586 -- 0.01778198964893818 -- 0.06318674236536026 -- 0.027301739901304245 -- 0.017049213871359825 -- 0.04797408729791641 -- 0.041632119566202164 -- -0.04480177164077759 -- -0.013540055602788925 -- 0.011395737528800964 -- -0.004419302102178335 -- 0.028964001685380936 -- 0.02115786448121071 -- -0.027285104617476463 -- -0.04166306555271149 -- -0.03587403520941734 -- 0.041929107159376144 -- 0.07041016221046448 -- 0.06947541236877441 -- 0.009396318346261978 -- 0.007558135315775871 -- -4.665459201912917e-33 -- -0.09207778424024582 -- -0.037035852670669556 -- -0.03397854045033455 -- 0.009481784887611866 -- -0.006117627024650574 -- 0.0176729504019022 -- 0.01619536802172661 -- 0.04649313911795616 -- 0.01731838844716549 -- 0.010544701479375362 -- -0.024344366043806076 -- -0.013100150972604752 -- 0.012487337924540043 -- -0.02991599403321743 -- -0.05605403333902359 -- 0.002820769092068076 -- 0.06319424510002136 -- 0.017878703773021698 -- 0.007595762610435486 -- 0.016323747113347054 -- -0.01426068414002657 -- -0.006187396124005318 -- 0.042504169046878815 -- 0.007422230206429958 -- 0.046938586980104446 -- -0.023112459108233452 -- -0.08439762890338898 -- -0.007399159017950296 -- 0.04498773440718651 -- -0.012089265510439873 -- -0.023740673437714577 -- -0.02906077355146408 -- -0.014017249457538128 -- 0.09799429029226303 -- -0.020228911191225052 -- 0.06181029975414276 -- -0.010676661506295204 -- -0.02813793160021305 -- 0.009677990339696407 -- -0.02478334680199623 -- 0.03494333475828171 -- 0.01852623000741005 -- -0.03871740773320198 -- -0.008425893262028694 -- 0.025788292288780212 -- 0.038793087005615234 -- 0.030802465975284576 -- 0.05345524102449417 -- 0.020154684782028198 -- 0.025192473083734512 -- -0.030543508008122444 -- 0.010783430188894272 -- 0.005537064280360937 -- -0.06725859642028809 -- -0.1072763130068779 -- -0.0007889792323112488 -- 0.0023686655331403017 -- -0.04509982094168663 -- -0.038918279111385345 -- 0.0387057326734066 -- 0.09877839684486389 -- -0.008087996393442154 -- 0.003774310927838087 -- 0.02098446525633335 -- -0.008655812591314316 -- 0.03179642930626869 -- 0.004677895922213793 -- 0.08736427128314972 -- -0.039624568074941635 -- -0.013641497120261192 -- 0.034147001802921295 -- -2.4649112674524076e-05 -- 0.009755458682775497 -- 0.0018330244347453117 -- -0.019866254180669785 -- 0.031721584498882294 -- -0.04608422890305519 -- 0.0012359495740383863 -- 0.013341939076781273 -- -0.019285328686237335 -- -0.021651338785886765 -- -0.02204015478491783 -- -0.03958950564265251 -- -0.03456680104136467 -- 0.007871673442423344 -- 0.007919060066342354 -- 0.03800927475094795 -- -0.015154007822275162 -- -0.016564369201660156 -- 0.012888561002910137 -- -0.02069621905684471 -- -0.02939559891819954 -- 0.0003189573180861771 -- -0.022446870803833008 -- -0.062365565448999405 -- -0.010836339555680752 -- -0.00906467903405428 -- -0.05984185263514519 -- -0.07137075811624527 -- -0.02126775123178959 -- -0.05340132489800453 -- -0.013168694451451302 -- -0.010444628074765205 -- 0.00344151072204113 -- 0.04687386006116867 -- 0.05060546100139618 -- -0.0181451253592968 -- -0.02159814164042473 -- -0.03558919206261635 -- -0.015937285497784615 -- 0.04445328190922737 -- 0.010268966667354107 -- 0.030854331329464912 -- 0.0006580561748705804 -- 0.015207369811832905 -- -0.014253402128815651 -- -0.02257111854851246 -- 0.0013478342443704605 -- -0.010952959768474102 -- -0.0328119695186615 -- -0.0008623320027254522 -- 0.023091087117791176 -- 0.037236277014017105 -- 0.03879738226532936 -- -0.07142169773578644 -- -0.03222329169511795 -- -0.031002892181277275 -- 8.296631131088361e-05 -- 0.029117098078131676 -- -0.029697803780436516 -- -0.015380283817648888 -- -0.032827965915203094 -- 2.211369007909525e-07 -- 0.009894445538520813 -- -0.022480148822069168 -- 0.06068386882543564 -- 0.03662610426545143 -- -0.01135424617677927 -- 0.03843483701348305 -- 0.033573735505342484 -- 0.07217518985271454 -- -0.020257893949747086 -- 0.054246049374341965 -- 0.004983620252460241 -- -0.02957138419151306 -- 0.034587837755680084 -- -0.040918707847595215 -- -0.08170808106660843 -- 0.05125834047794342 -- -0.07571951299905777 -- 0.04547373205423355 -- -0.00038312748074531555 -- 0.018519442528486252 -- 0.011552835814654827 -- -0.015642188489437103 -- -0.017755979672074318 -- 0.038084376603364944 -- 0.004508016165345907 -- -0.03471803292632103 -- -0.01703125238418579 -- 0.006085297092795372 -- -0.004077882971614599 -- -0.02057558111846447 -- -0.05940168350934982 -- -0.04311370477080345 -- 0.0451522096991539 -- -0.05290566012263298 -- -0.010352851822972298 -- -0.013663693331182003 -- 0.053201496601104736 -- 0.03423302620649338 -- 0.0057129161432385445 -- 0.07225050032138824 -- 0.028867142274975777 -- 0.06187751144170761 -- -0.007683475036174059 -- -0.07758203893899918 -- 0.028780145570635796 -- 0.015536436811089516 -- 0.02360416390001774 -- 0.007105186115950346 -- 0.014292426407337189 -- -0.018409261479973793 -- 0.006786591839045286 -- -0.0675104632973671 -- -0.010684511624276638 -- -0.005805912893265486 -- -0.002070970833301544 -- 0.017903372645378113 -- 0.029349613934755325 -- -0.02315070480108261 -- -0.057336561381816864 -- -0.06601695716381073 -- 0.0038525122217833996 -- -0.07616522908210754 -- 0.03188705816864967 -- -0.00038399893674068153 -- 0.06459735333919525 -- 0.013434529304504395 -- 0.03839268535375595 -- 1.8706440573451636e-34 -- -0.007212114054709673 -- 0.03210149705410004 -- 0.02112351357936859 -- 0.03680972754955292 -- -0.013683917932212353 -- 0.012538144364953041 -- 0.014851651154458523 -- 0.010223165154457092 -- 0.05871982127428055 -- 0.0004368910158518702 -- -0.01793687604367733 diff --git a/project/exp2/sub_exp/handcrafted_exp_3.yaml b/project/exp2/sub_exp/handcrafted_exp_3.yaml deleted file mode 100644 index 7f626b33..00000000 --- a/project/exp2/sub_exp/handcrafted_exp_3.yaml +++ /dev/null @@ -1,2 +0,0 @@ -exp_id: 3 -experience_text: when print "hello world", add ":)" at the end. \ No newline at end of file From edc3dd32dcf37266a46a038fa9d4937edefa3533 Mon Sep 17 00:00:00 2001 From: liqun Date: Thu, 12 Sep 2024 16:58:38 +0800 Subject: [PATCH 05/12] add shared memory entry --- .../code_interpreter/code_generator.py | 38 +- .../code_generator_prompt.yaml | 6 +- taskweaver/ext_role/echo/echo.py | 6 - taskweaver/memory/__init__.py | 3 +- taskweaver/memory/attachment.py | 14 +- taskweaver/memory/memory.py | 28 +- taskweaver/memory/round.py | 16 +- taskweaver/memory/shared_memory_entry.py | 68 ++ taskweaver/planner/planner.py | 28 +- taskweaver/planner/planner_prompt.yaml | 33 +- taskweaver/role/role.py | 16 +- taskweaver/role/translator.py | 2 +- taskweaver/session/session.py | 37 +- .../experience/sub_path/exp_test-exp-1.yaml | 793 ++++++++++++++++++ .../sub_path/raw_exp_test-exp-1.yaml | 364 ++++++++ .../data/prompts/generator_prompt.yaml | 46 +- .../data/prompts/planner_prompt.yaml | 86 +- tests/unit_tests/test_code_generator.py | 126 ++- tests/unit_tests/test_experience.py | 10 +- tests/unit_tests/test_memory.py | 342 ++++++++ tests/unit_tests/test_planner.py | 15 +- tests/unit_tests/test_role.py | 73 ++ website/blog/evaluation.md | 2 + website/blog/experience.md | 4 + website/blog/role.md | 28 - website/docs/concepts/attachment.md | 2 - website/docs/concepts/round.md | 16 - 27 files changed, 1985 insertions(+), 217 deletions(-) create mode 100644 taskweaver/memory/shared_memory_entry.py create mode 100644 tests/unit_tests/data/experience/sub_path/exp_test-exp-1.yaml create mode 100644 tests/unit_tests/data/experience/sub_path/raw_exp_test-exp-1.yaml create mode 100644 tests/unit_tests/test_role.py diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator.py b/taskweaver/code_interpreter/code_interpreter/code_generator.py index 64909d1d..0917206d 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator.py +++ b/taskweaver/code_interpreter/code_interpreter/code_generator.py @@ -158,6 +158,7 @@ def compose_prompt( rounds: List[Round], plugins: List[PluginEntry], selected_experiences: Optional[List[Tuple[Experience, float]]] = None, + planning_enrichments: Optional[List[str]] = None, ) -> List[ChatMessageType]: experiences = self.format_experience( template=self.prompt_data["experience_instruction"], @@ -194,6 +195,7 @@ def compose_prompt( add_requirements=True, summary=summary, plugins=plugins, + planning_enrichments=planning_enrichments, ), ) return chat_history @@ -210,6 +212,7 @@ def compose_conversation( plugins: List[PluginEntry], add_requirements: bool = False, summary: Optional[str] = None, + planning_enrichments: Optional[List[str]] = None, ) -> List[ChatMessageType]: chat_history: List[ChatMessageType] = [] ignored_types = [ @@ -247,10 +250,8 @@ def compose_conversation( user_query = conversation_round.user_query enrichment = f"The user request is: {user_query}\n\n" - supplementary_info_dict = conversation_round.read_board() - supplementary_info = "\n\n".join([bulletin for bulletin in supplementary_info_dict.values()]) - if supplementary_info != "": - enrichment += f"Additional context:\n" f" {supplementary_info}\n\n" + if planning_enrichments: + enrichment += "Additional context:\n" + "\n".join(planning_enrichments) + "\n\n" user_feedback = "None" if last_post is not None and last_post.send_from == self.alias: @@ -258,7 +259,7 @@ def compose_conversation( user_message += self.user_message_head_template.format( FEEDBACK=user_feedback, - MESSAGE=f"{enrichment}{post.message}", + MESSAGE=f"{enrichment}The task for this specific step is: {post.message}", ) elif post.send_from == post.send_to == self.alias: # for code correction @@ -357,15 +358,32 @@ def reply( if self.config.enable_auto_plugin_selection: self.plugin_pool = self.select_plugins_for_prompt(query) - exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType._signal_exp_sub_path) - if exp_sub_path: - self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) - exp_sub_path = exp_sub_path[0] + exp_sub_paths = memory.get_shared_memory_entry( + entry_type="experience_sub_path", + entry_scopes=["conversation"], + entry_scope_ids=[memory.conversation.id], + ) + + if exp_sub_paths: + self.tracing.set_span_attribute("experience_sub_path", str(exp_sub_paths)) + exp_sub_path = exp_sub_paths[0].content else: exp_sub_path = "" selected_experiences = self.load_experience(query=query, sub_path=exp_sub_path) - prompt = self.compose_prompt(rounds, self.plugin_pool, selected_experiences) + planning_enrichments = memory.get_shared_memory_entry( + entry_type="plan", + entry_scopes=["conversation", "round"], + entry_scope_ids=[memory.conversation.id, rounds[-1].id], + ) + + prompt = self.compose_prompt( + rounds, + self.plugin_pool, + selected_experiences, + planning_enrichments=[pe.content for pe in planning_enrichments], + ) + self.tracing.set_span_attribute("prompt", json.dumps(prompt, indent=2)) prompt_size = self.tracing.count_tokens(json.dumps(prompt)) self.tracing.set_span_attribute("prompt_size", prompt_size) diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml b/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml index a1cfc5e1..673d7f49 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml +++ b/taskweaver/code_interpreter/code_interpreter/code_generator_prompt.yaml @@ -80,10 +80,10 @@ conversation_head: |- user_message_head: |- ----------------------------- - # Feedback of the code in the last round (None if no feedback): + ### Feedback of the code in the last round (None if no feedback): {FEEDBACK} - # Additional information from the User in this round: + ### Request from the User in this round: {MESSAGE} requirements: |- @@ -96,7 +96,7 @@ requirements: |- {CODE_GENERATION_REQUIREMENTS} experience_instruction: |- - ## Experience And Lessons + ### Experience And Lessons Before generating code, please learn from the following past experiences and lessons: {experiences} You must apply them in code generation. diff --git a/taskweaver/ext_role/echo/echo.py b/taskweaver/ext_role/echo/echo.py index 4684b4ff..c7951a15 100644 --- a/taskweaver/ext_role/echo/echo.py +++ b/taskweaver/ext_role/echo/echo.py @@ -2,7 +2,6 @@ from taskweaver.logging import TelemetryLogger from taskweaver.memory import Memory, Post -from taskweaver.memory.attachment import AttachmentType from taskweaver.module.event_emitter import SessionEventEmitter from taskweaver.module.tracing import Tracing from taskweaver.role import Role @@ -42,9 +41,4 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: self.config.decorator + last_post.message + self.config.decorator, ) - post_proxy.update_attachment( - type=AttachmentType.signal, - message="exp_sub_path:sub_exp", - ) - return post_proxy.end() diff --git a/taskweaver/memory/__init__.py b/taskweaver/memory/__init__.py index e056a602..6cd182a8 100644 --- a/taskweaver/memory/__init__.py +++ b/taskweaver/memory/__init__.py @@ -1,8 +1,9 @@ from __future__ import annotations from .attachment import Attachment +from .compression import RoundCompressor from .conversation import Conversation from .memory import Memory from .post import Post from .round import Round -from .compression import RoundCompressor +from .shared_memory_entry import SharedMemoryEntry diff --git a/taskweaver/memory/attachment.py b/taskweaver/memory/attachment.py index 7ef94f48..625dc146 100644 --- a/taskweaver/memory/attachment.py +++ b/taskweaver/memory/attachment.py @@ -42,12 +42,8 @@ class AttachmentType(Enum): # Misc invalid_response = "invalid_response" - # board info - board = "board" - - # signal - signal = "signal" - _signal_exp_sub_path = "_signal_exp_sub_path" + # shared memory entry + shared_memory_entry = "shared_memory_entry" @dataclass @@ -98,11 +94,15 @@ def __str__(self) -> str: return self.__repr__() def to_dict(self) -> AttachmentDict: + if self.extra is not None and hasattr(self.extra, "to_dict"): + extra_dict = self.extra.to_dict() + else: + extra_dict = self.extra return { "id": self.id, "type": self.type.value, "content": self.content, - "extra": self.extra, + "extra": extra_dict, } @staticmethod diff --git a/taskweaver/memory/memory.py b/taskweaver/memory/memory.py index 0b01ee3a..3a26a38a 100644 --- a/taskweaver/memory/memory.py +++ b/taskweaver/memory/memory.py @@ -4,6 +4,7 @@ import os from typing import List +from taskweaver.memory import SharedMemoryEntry from taskweaver.memory.attachment import AttachmentType from taskweaver.memory.conversation import Conversation from taskweaver.memory.round import Round @@ -44,7 +45,6 @@ def get_role_rounds(self, role: RoleName, include_failure_rounds: bool = False) user_query=round.user_query, id=round.id, state=round.state, - board=copy.deepcopy(round.board), ) for post in round.post_list: if post.send_from == role or post.send_to == role: @@ -76,6 +76,32 @@ def save_experience(self, exp_dir: str, thin_mode: bool = True) -> None: else: write_yaml(raw_exp_path, self.conversation.to_dict()) + def get_shared_memory_entry( + self, + entry_type: str, + entry_scopes: List[str], + entry_scope_ids: List[str], + ) -> List[SharedMemoryEntry]: + entry_dict = {} + order_at = 0 + for round in self.conversation.rounds: + for post in round.post_list: + for attachment in post.attachment_list: + if attachment.type == AttachmentType.shared_memory_entry: + entry = attachment.extra + if ( + entry.type == entry_type + and entry.scope in entry_scopes + and entry.scope_id in entry_scope_ids + ): + entry_dict[entry.get_aggregation_key()] = (entry, order_at) + order_at += 1 + + # Sort the entries by the order_at + entries = list(entry_dict.values()) + entries.sort(key=lambda x: x[1]) + return [entry[0] for entry in entries] + def from_yaml(self, session_id: str, path: str) -> Memory: """Load the memory from a yaml file.""" conversation = Conversation.from_yaml(path) diff --git a/taskweaver/memory/round.py b/taskweaver/memory/round.py index c90bf20f..050bd0fd 100644 --- a/taskweaver/memory/round.py +++ b/taskweaver/memory/round.py @@ -1,7 +1,7 @@ from __future__ import annotations import secrets -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Any, Dict, List, Literal, Optional, Union from taskweaver.memory.type_vars import RoundState @@ -19,14 +19,12 @@ class Round: post_list: a list of posts in the round. user_query: the query of the user. state: the state of the round. - board: a dict to store the bulletin of the round. """ id: str user_query: str state: RoundState post_list: List[Post] - board: Dict[str, str] = field(default_factory=dict) @staticmethod def create( @@ -34,7 +32,6 @@ def create( id: Optional[Union[str, None]] = None, state: RoundState = "created", post_list: Optional[List[Post]] = None, - board: Optional[Dict[str, str]] = None, ) -> Round: """Create a round with the given user query, id, and state.""" return Round( @@ -42,7 +39,6 @@ def create( user_query=user_query, state=state, post_list=post_list if post_list is not None else [], - board=board if board is not None else dict(), ) def __repr__(self): @@ -88,13 +84,3 @@ def add_post(self, post: Post): def change_round_state(self, new_state: Literal["finished", "failed", "created"]): """Change the state of the round.""" self.state = new_state - - def write_board(self, role_alias: str, bulletin: str) -> None: - """Add a bulletin to the round.""" - self.board[role_alias] = bulletin - - def read_board(self, role_alias: Optional[str] = None) -> Union[Dict[str, str], str]: - """Read the bulletin of the round.""" - if role_alias is None: - return self.board - return self.board.get(role_alias, None) diff --git a/taskweaver/memory/shared_memory_entry.py b/taskweaver/memory/shared_memory_entry.py new file mode 100644 index 00000000..b86d42c8 --- /dev/null +++ b/taskweaver/memory/shared_memory_entry.py @@ -0,0 +1,68 @@ +from __future__ import annotations + +from dataclasses import dataclass +from typing import Literal, Optional, Tuple + +from taskweaver.memory.type_vars import RoleName +from taskweaver.utils import create_id + + +@dataclass +class SharedMemoryEntry: + type: Literal["plan", "experience_sub_path"] + by: str + content: str + scope: Literal["round", "conversation"] + # The id of the round or conversation + scope_id: str + aggregation_keys: Tuple[Literal["by", "type", "scope", "scope_id", "id"], ...] + id: str + + @staticmethod + def create( + type: Literal["plan", "experience_sub_path"], + by: RoleName, + content: str, + scope: Literal["round", "conversation"], + scope_id: str, + aggregation_keys: Optional[Tuple[Literal["by", "type", "scope", "scope_id", "id"], ...]] = None, + id: str = None, + ) -> SharedMemoryEntry: + if aggregation_keys is None: + aggregation_keys = ("by", "type", "scope", "scope_id") + if id is None: + id = "sme-" + create_id() + return SharedMemoryEntry( + type=type, + by=by, + content=content, + scope=scope, + scope_id=scope_id, + aggregation_keys=aggregation_keys, + id=id, + ) + + def get_aggregation_key(self) -> str: + key = "" + for _field in self.aggregation_keys: + if not hasattr(self, _field): + raise ValueError(f"SharedMemoryEntry does not have the field {_field}") + key += f"{getattr(self, _field)}_" + return key.strip("_") + + def __repr__(self): + return f"SharedMemoryEntry: {self.type} by {self.by} in {self.scope} {self.scope_id}\n{self.content}" + + def __str__(self): + return self.__repr__() + + def to_dict(self) -> dict: + return { + "type": self.type, + "by": self.by, + "content": self.content, + "scope": self.scope, + "scope_id": self.scope_id, + "unique_key_fields": self.aggregation_keys, + "id": self.id, + } diff --git a/taskweaver/planner/planner.py b/taskweaver/planner/planner.py index 86f688d9..7fb305ec 100644 --- a/taskweaver/planner/planner.py +++ b/taskweaver/planner/planner.py @@ -13,6 +13,7 @@ from taskweaver.memory import Conversation, Memory, Post, Round, RoundCompressor from taskweaver.memory.attachment import AttachmentType from taskweaver.memory.experience import Experience, ExperienceGenerator +from taskweaver.memory.memory import SharedMemoryEntry from taskweaver.misc.example import load_examples from taskweaver.module.event_emitter import SessionEventEmitter from taskweaver.module.tracing import Tracing, tracing_decorator @@ -265,10 +266,15 @@ def reply( self.tracing.set_span_attribute("user_query", user_query) self.tracing.set_span_attribute("use_experience", self.config.use_experience) - exp_sub_path = rounds[-1].post_list[-1].get_attachment(AttachmentType._signal_exp_sub_path) - if exp_sub_path: - self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) - exp_sub_path = exp_sub_path[0] + exp_sub_paths = memory.get_shared_memory_entry( + entry_type="experience_sub_path", + entry_scopes=["conversation"], + entry_scope_ids=[memory.conversation.id], + ) + + if exp_sub_paths: + self.tracing.set_span_attribute("experience_sub_path", str(exp_sub_paths)) + exp_sub_path = exp_sub_paths[0].content else: exp_sub_path = "" selected_experiences = self.load_experience(query=user_query, sub_path=exp_sub_path) @@ -346,10 +352,18 @@ def stream_filter(s: Iterable[ChatMessageType]): ) plan = post_proxy.post.get_attachment(type=AttachmentType.plan)[0] - bulletin_message = "\n====== Plan ======\n" f"I have drawn up a plan:\n{plan}" "\n==================\n" + bulletin_message = f"\n====== Plan ======\nI have drawn up a plan:\n{plan}\n==================\n" post_proxy.update_attachment( - message=bulletin_message, - type=AttachmentType.board, + type=AttachmentType.shared_memory_entry, + message="Add the plan to the shared memory", + extra=SharedMemoryEntry.create( + type="plan", + by=self.alias, + scope="round", + scope_id=rounds[-1].id, + content=bulletin_message, + aggregation_keys=("by", "type", "scope_id"), + ), ) except (JSONDecodeError, AssertionError) as e: diff --git a/taskweaver/planner/planner_prompt.yaml b/taskweaver/planner/planner_prompt.yaml index 5de980bc..851daf70 100644 --- a/taskweaver/planner/planner_prompt.yaml +++ b/taskweaver/planner/planner_prompt.yaml @@ -1,4 +1,4 @@ -version: 0.3 +version: 0.4 instruction_template: |- You are the Planner who can coordinate Workers to finish the user task. @@ -16,26 +16,26 @@ instruction_template: |- - The input of the User will contain a `send_from` field, which is the name of the User. ## Worker Character - There are multiple Workers in the environment. The details of the Workers are as follows: + There are multiple Workers in the environment. The expertise of the Workers are listed below: {worker_intro} ## Planner Character - - Planner's role is to plan the subtasks and to instruct Workers to resolve the request from the User. - - If needs additional information from the User, Planner should ask the User to provide. - - Planner can talk to the User and Workers by specifying the "send_to" field in the response. - - Planner MUST NOT talk to the Planner itself. - - Planner can assign different subtasks to different Workers, but each subtask should be assigned to only one Worker. - - Planner should try the best to complete the tasks before asking the User for additional information. - - Planner should refine or change the plan according to the replies of the Workers or the new requests of User. - - Planner should ignore the permission or file access issues since Workers are powerful and can handle them. - - Planner needs to inform Workers on the User's request and the current step. + - Planner's main job is to make planning and to instruct Workers to resolve the request from the User. + - Planner can conduct basic analysis (e.g., comprehension, extraction, etc.) to solve simple problems after reading the messages from the User and the Workers. + - Planner should first try to solve the task by itself before reaching out to the Workers for their special expertise. + - Planner can assign different subtasks to different Workers, and each subtask should be assigned to only one Worker. - Planner must reject the User's request if it contains potential security risks or illegal activities. + - Planner should ask the User to provide additional information critical for problem solving, but only after trying the best. + - Planner can talk to the User and Workers by specifying the `send_to` field in the response, but MUST NOT talk to the Planner itself. + - Planner should refine the plan according to its observations from the replies of the Workers or the new requests of User. + - Planner needs to inform Workers on the User's request, the current step, and necessary information to complete the task. - Planner must check the Worker's response and provide feedback to the Worker if the response is incorrect or incomplete. + - Planner can ignore the permission or file access issues since Workers are powerful and can handle them. ## Planner's planning process - You need to make a step-by-step plan to complete the User's task. The planning process includes 2 phases: "init_plan" and "plan". - In the "init_plan" phase, you need to decompose the User's task into subtasks and list them as the detailed plan steps. - In the "plan" phase, you need to refine the initial plan by merging adjacent steps that have sequential dependency or no dependency, unless the merged step becomes too complicated. + You need to make a step-by-step plan to complete the User's task. The planning process includes 2 phases: `init_plan` and `plan`. + In the `init_plan` phase, you need to decompose the User's task into subtasks and list them as the detailed plan steps. + In the `plan` phase, you need to refine the initial plan by merging adjacent steps that have sequential dependency or no dependency, unless the merged step becomes too complicated. ### init_plan - Decompose User's task into subtasks and list them as the detailed subtask steps. @@ -99,8 +99,9 @@ instruction_template: |- 2. Join the two dataframes 3. Check the execution result and report the joined data to the user - ## Useful Tips - - When the request involves loading a file, Planner should always set the first subtask to reading the file content to understand the structure or schema of the data. + ## Planner's useful tips + - When the request involves loading a file or pulling a table from db, Planner should always set the first subtask to reading the content to understand the structure or schema of the data. + - When the request involves text analysis, Planner should always set the first subtask to read and print the text content to understand its content structure. ## Planner's response format - Planner must strictly format the response into the following JSON object: diff --git a/taskweaver/role/role.py b/taskweaver/role/role.py index 54c8bffa..64c48ff5 100644 --- a/taskweaver/role/role.py +++ b/taskweaver/role/role.py @@ -103,8 +103,8 @@ def __init__( self.alias: str = self.role_entry.alias if self.role_entry else "" self.intro: str = self.role_entry.intro if self.role_entry else "" - self.experience_loaded_from: Optional[str] = None self.experience_generator: Optional[ExperienceGenerator] = None + self.experience_loaded_from: Optional[str] = None def get_intro(self) -> str: return self.intro @@ -121,7 +121,11 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: def close(self) -> None: self.logger.info(f"{self.alias} closed successfully") - def load_experience(self, query: str, sub_path: str = "") -> List[Tuple[Experience, float]]: + def load_experience( + self, + query: str, + sub_path: str = "", + ) -> List[Tuple[Experience, float]]: if self.experience_generator is None: raise ValueError("Experience generator is not initialized.") @@ -132,7 +136,7 @@ def load_experience(self, query: str, sub_path: str = "") -> List[Tuple[Experien self._load_experience(sub_path=sub_path) else: # if sub_path is empty, experience should not have been loaded - assert self.experience_loaded_from is None, "Experience loaded from is not None" + assert self.experience_loaded_from is None, "sub_path is empty when dynamic_experience_sub_path is True" return self.experience_generator.retrieve_experience(query) else: @@ -156,7 +160,11 @@ def _load_experience(self, sub_path: str = "") -> None: else: self.logger.info(f"Experience already loaded from {load_from}.") - def format_experience(self, template: str, experiences: Optional[List[Tuple[Experience, float]]]) -> str: + def format_experience( + self, + template: str, + experiences: Optional[List[Tuple[Experience, float]]], + ) -> str: experiences_str = ( self.experience_generator.format_experience_in_prompt( template, diff --git a/taskweaver/role/translator.py b/taskweaver/role/translator.py index 7608bbbc..95f6e25a 100644 --- a/taskweaver/role/translator.py +++ b/taskweaver/role/translator.py @@ -144,7 +144,7 @@ def post_to_raw_text( """ if ignored_types is None: ignored_types = [] - ignored_types.append(AttachmentType.board) + ignored_types.append(AttachmentType.shared_memory_entry) structured_llm: Dict[str, str] = {} for attachment in post.attachment_list: diff --git a/taskweaver/session/session.py b/taskweaver/session/session.py index a94a55f4..bc56fd47 100644 --- a/taskweaver/session/session.py +++ b/taskweaver/session/session.py @@ -4,12 +4,10 @@ from typing import Any, Dict, List, Literal, Optional from injector import Injector, inject -from scipy.stats import logser from taskweaver.config.module_config import ModuleConfig from taskweaver.logging import TelemetryLogger -from taskweaver.memory import Memory, Post, Round, Attachment -from taskweaver.memory.attachment import AttachmentType +from taskweaver.memory import Memory, Post, Round from taskweaver.module.event_emitter import SessionEventEmitter, SessionEventHandler from taskweaver.module.tracing import Tracing, tracing_decorator, tracing_decorator_non_class from taskweaver.planner.planner import Planner @@ -89,7 +87,6 @@ def __init__( self.memory = Memory(session_id=self.session_id) self.session_var: Dict[str, str] = {} - self.session_signal: Dict[AttachmentType, str] = {} self.event_emitter = self.session_injector.get(SessionEventEmitter) self.session_injector.binder.bind(SessionEventEmitter, self.event_emitter) @@ -105,8 +102,8 @@ def __init__( role_instance = self.session_injector.create_object( role_entry.module, { - "role_entry": role_entry - } + "role_entry": role_entry, + }, ) self.worker_instances[role_instance.get_alias()] = role_instance @@ -114,8 +111,8 @@ def __init__( self.planner = self.session_injector.create_object( Planner, { - "workers": self.worker_instances - } + "workers": self.worker_instances, + }, ) self.session_injector.binder.bind(Planner, self.planner) @@ -175,16 +172,6 @@ def _send_text_message( @tracing_decorator_non_class def _send_message(recipient: str, post: Post) -> Post: - # add session signal to the post - if self.session_signal: - for signal_type in self.session_signal: - post.add_attachment( - Attachment.create( - type=signal_type, - content=self.session_signal[signal_type], - ) - ) - self.tracing.set_span_attribute("in.from", post.send_from) self.tracing.set_span_attribute("in.recipient", recipient) self.tracing.set_span_attribute("in.message", post.message) @@ -211,20 +198,6 @@ def _send_message(recipient: str, post: Post) -> Post: else: raise Exception(f"Unknown recipient {recipient}") - board_attachment = reply_post.get_attachment(AttachmentType.board) - if len(board_attachment) > 0: - chat_round.write_board( - reply_post.send_from, - reply_post.get_attachment(AttachmentType.board)[0] - ) - - signal_attachments = reply_post.get_attachment(AttachmentType.signal) - for signal in signal_attachments: - signal_type, signal_value = signal.split(":") - self.logger.info(f"Session signal: {signal_type}={signal_value}") - # signal_type must be in AttachmentType - self.session_signal[AttachmentType(signal_type)] = signal_value - return reply_post try: diff --git a/tests/unit_tests/data/experience/sub_path/exp_test-exp-1.yaml b/tests/unit_tests/data/experience/sub_path/exp_test-exp-1.yaml new file mode 100644 index 00000000..6ffe2eab --- /dev/null +++ b/tests/unit_tests/data/experience/sub_path/exp_test-exp-1.yaml @@ -0,0 +1,793 @@ +exp_id: test-exp-1 +experience_text: 'User Query: show top 3 data in ./demo_data.csv + + + Best Practice: When the user provides a new file path, update the code to use the + new file path and check if the file exists before attempting to read it. + + + Mistakes to Avoid: + + 1. Not checking if the file exists before attempting to read it, which can lead + to FileNotFoundError. + + 2. Not updating the file path when the user provides a new one. + + + Critical Information: + + 1. Use os.path.exists(file_path) to check if the file exists before attempting to + read it. + + 2. Update the file path in the code when the user provides a new one.' +raw_experience_path: D:\TaskWeaver\tests\unit_tests\data\experience\raw_exp_test-exp-1.yaml +embedding_model: all-mpnet-base-v2 +embedding: +- 0.07244912534952164 +- -0.0018297189380973577 +- -0.04247937351465225 +- -0.002424704609438777 +- 0.024126920849084854 +- 0.02373603731393814 +- -0.023702137172222137 +- 0.009939087554812431 +- 0.058809034526348114 +- 0.032518934458494186 +- -0.023578859865665436 +- -0.02198844775557518 +- -0.020363617688417435 +- 0.0028404928743839264 +- -0.0005056665395386517 +- 0.013709185644984245 +- 0.053519655019044876 +- -0.014736873097717762 +- 0.010113721713423729 +- 0.0002740946947596967 +- -0.06893929094076157 +- -0.0015790866455063224 +- 0.03329068049788475 +- -0.022374488413333893 +- 0.016250023618340492 +- 0.02676330879330635 +- -0.07358315587043762 +- 0.08057551085948944 +- 0.031772445887327194 +- -0.0910724326968193 +- -0.01920764520764351 +- -0.014724267646670341 +- 0.012773633003234863 +- 0.048156265169382095 +- 1.8980924778588815e-06 +- -0.03619755432009697 +- 0.0005571527290157974 +- -0.013719063252210617 +- -0.019510671496391296 +- -0.06322908401489258 +- 0.059024203568696976 +- -0.009066871367394924 +- -0.006358940154314041 +- -0.028360214084386826 +- -0.027577456086874008 +- 0.030370939522981644 +- -0.011259626597166061 +- -0.018781496211886406 +- 0.07544233649969101 +- 0.0726826936006546 +- -0.001781896804459393 +- -0.027340203523635864 +- -0.05387841537594795 +- -0.00021583339548669755 +- 0.046441685408353806 +- -0.02580885775387287 +- 0.06847605854272842 +- 0.06975821405649185 +- 0.029857615008950233 +- -0.056737881153821945 +- -0.0044606407172977924 +- -0.015332729555666447 +- 0.004389295354485512 +- 0.009293724782764912 +- 0.025309167802333832 +- 0.048358552157878876 +- -0.043672945350408554 +- -0.0592198483645916 +- -0.021458681672811508 +- 0.045250941067934036 +- 0.01874804124236107 +- -0.014315150678157806 +- 0.012203305959701538 +- -0.019887562841176987 +- -0.03437769412994385 +- -0.03362594544887543 +- -0.009671411477029324 +- 0.003449036506935954 +- 0.011154146865010262 +- 0.02751007117331028 +- 0.010988104157149792 +- 0.021359758451581 +- -0.045103635638952255 +- 0.07066059112548828 +- -0.00490353861823678 +- -0.027494240552186966 +- -0.07193432748317719 +- -0.04040493443608284 +- 0.03805162012577057 +- 0.014088987372815609 +- 0.030064811930060387 +- -0.007189569063484669 +- 0.016871454194188118 +- 0.000821259047370404 +- -0.01972915045917034 +- -0.03670269623398781 +- 0.014500276185572147 +- -0.03816597908735275 +- -0.01617465913295746 +- -0.009354486130177975 +- 0.03466549143195152 +- -0.06051798164844513 +- 0.03589222952723503 +- 0.03996746242046356 +- 0.09304384887218475 +- -0.010681589134037495 +- -0.023550087586045265 +- 0.015637334436178207 +- 0.03723038360476494 +- -0.0031286729499697685 +- 0.013319226913154125 +- -0.0045195347629487514 +- -0.017091017216444016 +- -0.05096958950161934 +- 0.03142775222659111 +- 0.03964478522539139 +- 0.025045616552233696 +- 0.03858919441699982 +- -0.032512255012989044 +- -0.0005675660795532167 +- 0.01959408074617386 +- 0.006862363778054714 +- -0.011326904408633709 +- 0.10291832685470581 +- -0.009324631653726101 +- -0.0010065946262329817 +- 0.019049063324928284 +- 0.04591256380081177 +- 0.009515060111880302 +- -0.008097921498119831 +- 0.022431140765547752 +- -0.005635915789753199 +- 0.02216806821525097 +- 0.002702507423236966 +- 0.030584651976823807 +- -0.010200124233961105 +- 0.03901197761297226 +- -0.00652227783575654 +- -0.04124196246266365 +- -0.07732449471950531 +- 0.041135404258966446 +- -0.053653452545404434 +- -0.03285795822739601 +- 0.008698106743395329 +- -0.029747599735856056 +- 0.0006073535769246519 +- 0.02500084601342678 +- -0.01669972389936447 +- -0.03598366305232048 +- 0.023974664509296417 +- -0.07383307069540024 +- -0.01227108296006918 +- -0.0008901717374101281 +- 0.02898467145860195 +- -0.020598232746124268 +- 0.007663161959499121 +- -0.03472026437520981 +- -0.053893450647592545 +- 0.005860771052539349 +- 0.014200916513800621 +- -0.03870551660656929 +- 0.00412966962903738 +- 0.02222307398915291 +- -0.0727243646979332 +- -0.0172482430934906 +- 0.016584694385528564 +- -0.0529426746070385 +- 0.08171410113573074 +- -0.06871671974658966 +- 0.024868061766028404 +- -0.051330018788576126 +- 0.03039807267487049 +- 0.025863876566290855 +- 0.015607579611241817 +- -0.044379886239767075 +- 0.048711903393268585 +- 0.01207214780151844 +- -0.03064558282494545 +- -0.020730409771203995 +- 0.04675041884183884 +- -0.0001602906995685771 +- 0.029617315158247948 +- 0.025648489594459534 +- 0.02748004160821438 +- 0.060203708708286285 +- -0.03396637737751007 +- -0.03383998945355415 +- 0.001523081911727786 +- 0.05018147453665733 +- -0.04546835273504257 +- 0.008210675790905952 +- 0.03352188691496849 +- -0.011123848147690296 +- 0.011785742826759815 +- -0.024414408951997757 +- -0.009893261827528477 +- 0.011178563348948956 +- -0.12936954200267792 +- -0.011995494365692139 +- -0.05153230205178261 +- 0.019652139395475388 +- 0.0029771963600069284 +- 0.021937182173132896 +- 0.048440322279930115 +- -0.01831335946917534 +- 0.03897761180996895 +- 0.0015480363508686423 +- -0.015072043053805828 +- -0.008898169733583927 +- -0.13837406039237976 +- 0.05949113145470619 +- -0.04113796725869179 +- -0.014553154818713665 +- -0.012766540981829166 +- -0.001374350395053625 +- 0.05271576717495918 +- -0.029153337702155113 +- -0.012870448641479015 +- 0.012586858123540878 +- -0.017739929258823395 +- -0.011165064759552479 +- -0.025093942880630493 +- 0.00573757104575634 +- -0.015085494145751 +- 0.00608181394636631 +- 0.017522001639008522 +- 0.026275403797626495 +- -0.005915618967264891 +- 0.019992537796497345 +- 0.004202157258987427 +- -0.007251514121890068 +- -0.00776250334456563 +- 0.011708325706422329 +- 0.09433057904243469 +- 0.07323940843343735 +- 0.026110021397471428 +- 0.024829747155308723 +- -0.022392049431800842 +- -0.05561985820531845 +- 0.047644734382629395 +- -0.019868353381752968 +- 0.028604673221707344 +- 0.0040971143171191216 +- 0.03984890505671501 +- -0.04843706637620926 +- 0.03438512980937958 +- -0.07710950076580048 +- -0.02441728115081787 +- -0.02310040220618248 +- 0.03893303871154785 +- 0.0029284737538546324 +- 0.012652669101953506 +- 0.0024781026877462864 +- 0.049856703728437424 +- -0.021559564396739006 +- 0.08754678070545197 +- -0.01281831320375204 +- 0.03847458213567734 +- -0.08885427564382553 +- 0.051528200507164 +- 0.0795275941491127 +- 0.01097955647855997 +- 0.0035488398279994726 +- -0.017673309892416 +- 0.04740910977125168 +- -0.030114147812128067 +- 0.009598239324986935 +- 0.0054936399683356285 +- -0.03242594748735428 +- 0.03672260791063309 +- -0.013587512075901031 +- -0.038868967443704605 +- -0.02230633981525898 +- -0.0413605235517025 +- -0.002245428739115596 +- -0.006425444968044758 +- -0.033288661390542984 +- 0.0051304977387189865 +- -0.017024002969264984 +- 0.03400342911481857 +- 0.061151087284088135 +- 0.009211032651364803 +- 0.030818263068795204 +- 0.01625378057360649 +- -0.026460539549589157 +- 0.04456653073430061 +- 0.04927760362625122 +- -0.024226564913988113 +- 0.0019316072575747967 +- -0.02103232592344284 +- -0.0050481460057199 +- -0.009780037216842175 +- 0.03823333978652954 +- 0.029149169102311134 +- -0.05407164990901947 +- 0.014596785418689251 +- 0.019413158297538757 +- 0.00047277568955905735 +- 0.020065611228346825 +- -0.006743925157934427 +- 0.019448012113571167 +- 0.030148571357131004 +- 0.020037835463881493 +- 0.008624507114291191 +- 0.02247401513159275 +- -0.013033910654485226 +- 0.038955386728048325 +- -0.003644970478489995 +- 0.022220607846975327 +- -0.0362677276134491 +- 0.040653251111507416 +- -0.05759996920824051 +- 0.004145992919802666 +- 0.06568755954504013 +- -0.01697588339447975 +- -0.040828410536050797 +- -0.03163664788007736 +- -0.037147022783756256 +- -0.008176281116902828 +- 0.023841101676225662 +- 0.04434298723936081 +- 0.02160828746855259 +- 0.053484782576560974 +- 0.02352866157889366 +- 0.010510314255952835 +- -0.027954332530498505 +- -0.03358226269483566 +- -0.005426883697509766 +- -0.008880563080310822 +- 0.04098699241876602 +- 0.01500045694410801 +- 0.018481925129890442 +- -0.025129780173301697 +- -0.007157974876463413 +- -0.04038197547197342 +- -0.03665386140346527 +- 0.006787129677832127 +- -0.04543548449873924 +- 0.027521297335624695 +- 0.02083709090948105 +- 0.020778585225343704 +- 0.016573745757341385 +- -0.03092128224670887 +- -0.006941207684576511 +- -0.0065062022767961025 +- -0.04436473175883293 +- -0.0523710623383522 +- 0.040221840143203735 +- 0.023103924468159676 +- -0.04355907067656517 +- 0.043620362877845764 +- 0.007873542606830597 +- -0.0040883333422243595 +- -0.04174155741930008 +- 0.015941407531499863 +- 0.02847151644527912 +- -0.06278780102729797 +- 0.040969427675008774 +- -0.04516986012458801 +- 0.0002622225147206336 +- 0.016721151769161224 +- 0.037941429764032364 +- 0.07024811208248138 +- 0.019850732758641243 +- 0.023303385823965073 +- 0.07783612608909607 +- -0.04227915778756142 +- 0.02889014035463333 +- 0.02287254109978676 +- 0.01612577773630619 +- -0.039751745760440826 +- -0.04252450540661812 +- -0.0013236660743132234 +- -0.010974347591400146 +- 0.0034001998137682676 +- 0.09684048593044281 +- 0.024998972192406654 +- 0.004488843958824873 +- -0.0859595537185669 +- -0.006237197667360306 +- 0.05636211112141609 +- 0.002138267969712615 +- 0.027118602767586708 +- 0.029742518439888954 +- 0.05890796333551407 +- -0.029764335602521896 +- -0.007783249020576477 +- -0.06511618196964264 +- 0.06285106390714645 +- 0.10576077550649643 +- 0.01510331965982914 +- 0.03451496735215187 +- -0.05094541609287262 +- -0.02150942012667656 +- -0.02278074063360691 +- -0.045310430228710175 +- -0.06445858627557755 +- 0.06595352292060852 +- -0.011924033984541893 +- -0.014018287882208824 +- 0.03057316690683365 +- 0.08390099555253983 +- 0.0395582914352417 +- 0.0010698342230170965 +- 0.009788197465240955 +- -0.093132883310318 +- 0.013675925321877003 +- 0.04536272585391998 +- 0.030681779608130455 +- 0.014367555268108845 +- -0.04410269483923912 +- 0.05403256043791771 +- 0.04578877240419388 +- -0.05142880231142044 +- 0.00507911155000329 +- 0.04279765114188194 +- -0.0008216215064749122 +- -0.025039324536919594 +- -0.032353177666664124 +- 0.02200445905327797 +- -0.03010653145611286 +- -0.005344000644981861 +- -0.01624074950814247 +- -0.04522557556629181 +- -0.02538757584989071 +- -0.028882743790745735 +- 0.0533321350812912 +- -0.012849107384681702 +- -0.01324241142719984 +- 0.016529563814401627 +- 0.06958413124084473 +- 0.011287041939795017 +- 0.0013872572453692555 +- 0.009986471384763718 +- -0.023392898961901665 +- -0.015346433967351913 +- 0.04198852926492691 +- -0.025585545226931572 +- 0.019024301320314407 +- -0.011300099082291126 +- -0.04856543615460396 +- 0.02652454562485218 +- 0.057381272315979004 +- -0.03488056734204292 +- 0.030045101419091225 +- 0.004120811820030212 +- 0.009326339699327946 +- -0.005656685680150986 +- -0.01634882763028145 +- 0.026304228231310844 +- -0.03591650351881981 +- -0.004497161600738764 +- -0.03467745706439018 +- 0.027103153988718987 +- 0.00036564518813975155 +- -0.01810336299240589 +- -0.03395523503422737 +- -0.047989197075366974 +- 0.01759573444724083 +- 0.006661472376435995 +- -0.07971180230379105 +- 0.01593165099620819 +- -0.03358190506696701 +- 0.061344873160123825 +- 0.031046118587255478 +- -0.024606849998235703 +- 0.040137238800525665 +- 0.018368316814303398 +- 0.012695206329226494 +- -0.06210453063249588 +- -0.021544301882386208 +- 0.037674855440855026 +- 0.0066422694362699986 +- 0.027470871806144714 +- 0.00017733759887050837 +- -0.07259869575500488 +- -0.011414417997002602 +- -0.003500407561659813 +- 0.010620228946208954 +- -0.027372926473617554 +- 0.09043410420417786 +- 0.023492703214287758 +- 0.03814705088734627 +- -0.08672188222408295 +- -0.027044309303164482 +- 0.023388534784317017 +- 0.007837709970772266 +- -0.02010205015540123 +- -0.028832146897912025 +- -0.03230075538158417 +- -0.011984017677605152 +- 0.06474103033542633 +- -0.02601240575313568 +- -0.021590957418084145 +- 0.0065309652127325535 +- -0.07428891211748123 +- -0.10445255041122437 +- -0.002215370535850525 +- 0.08086708188056946 +- -0.03796069324016571 +- 0.007027162238955498 +- -0.014657163061201572 +- -0.04514995589852333 +- 0.0030427153687924147 +- 0.008482160046696663 +- 0.031503334641456604 +- -0.023856496438384056 +- 0.0021539670415222645 +- -0.029607240110635757 +- -0.035766977816820145 +- 0.02825091779232025 +- -0.03394908085465431 +- -0.05262262374162674 +- 0.0188194140791893 +- 0.009241105988621712 +- -0.003097479697316885 +- -0.062433645129203796 +- -0.03302712365984917 +- -0.009181157685816288 +- -0.04252379760146141 +- 0.0002566370239946991 +- -0.025869540870189667 +- 0.017454028129577637 +- -0.0043889437802135944 +- -0.05338546633720398 +- -0.07683144509792328 +- -0.020449429750442505 +- -0.020259803161025047 +- 0.011330431327223778 +- -0.024220256134867668 +- -0.010681644082069397 +- -0.007873221300542355 +- -0.024933574721217155 +- -0.015915177762508392 +- -0.00019608906586654484 +- 0.055303096771240234 +- 0.0016314893728122115 +- -0.059351030737161636 +- 0.050423506647348404 +- 0.009606711566448212 +- 0.006546804215759039 +- -0.05163466930389404 +- 0.020586369559168816 +- 0.033222559839487076 +- -0.005306532606482506 +- 0.005002151243388653 +- -0.029756443575024605 +- 0.018593505024909973 +- -0.034762512892484665 +- 0.050872690975666046 +- -0.050599757581949234 +- 0.0165041945874691 +- -0.019964326173067093 +- -0.06677841395139694 +- 0.014438861981034279 +- -5.4731556967003115e-33 +- 0.020387280732393265 +- -0.02628690004348755 +- 0.009132687002420425 +- -0.0281083844602108 +- -0.0020335058216005564 +- 0.006847280543297529 +- 0.006910571362823248 +- -0.05607045069336891 +- -0.01109815388917923 +- -0.058862242847681046 +- -0.04085550829768181 +- 0.002903180895373225 +- 0.014769015833735466 +- -0.025011535733938217 +- -0.0057344515807926655 +- -0.03641977906227112 +- -0.0567348413169384 +- 0.023100847378373146 +- -0.0255106333643198 +- -0.03764010965824127 +- 0.068535715341568 +- 0.02110118791460991 +- 0.0078656654804945 +- -0.0051740617491304874 +- -0.032167933881282806 +- 0.03387593850493431 +- -0.030142219737172127 +- -0.01093331165611744 +- -0.008119898848235607 +- -0.031151272356510162 +- 0.01748816668987274 +- 0.000761534902267158 +- 0.014942540787160397 +- -0.049997661262750626 +- -0.012074167840182781 +- -0.07145340740680695 +- -0.00021450217172969133 +- 0.0022810306400060654 +- -0.06727239489555359 +- -0.013510804623365402 +- 0.02266819402575493 +- 0.0748755931854248 +- 0.07213350385427475 +- -0.06482695788145065 +- 0.036521065980196 +- 0.05711895599961281 +- -0.017611855641007423 +- 0.02137061208486557 +- 0.03824342414736748 +- -0.004369682632386684 +- 0.05485890805721283 +- 0.016908572986721992 +- 0.002875283360481262 +- 0.03330868110060692 +- 0.03502766788005829 +- 0.06190846860408783 +- 0.01980624534189701 +- 0.03452107310295105 +- -0.015237282030284405 +- 0.06271406263113022 +- 0.0375853069126606 +- 0.006512188818305731 +- 0.02007884718477726 +- -0.022051839157938957 +- 0.042642880231142044 +- -0.018336724489927292 +- 0.02994447760283947 +- -0.02336154505610466 +- 0.03520141914486885 +- -0.029291817918419838 +- 0.0038337018340826035 +- -0.050948262214660645 +- -0.09121139347553253 +- 0.0016636451473459601 +- -0.04791174829006195 +- -0.04891374334692955 +- -0.04089883342385292 +- 0.04440123215317726 +- 0.03948137164115906 +- -0.061142448335886 +- -0.017232349142432213 +- -0.011881831102073193 +- -0.037997882813215256 +- 0.005518762860447168 +- 0.005502220708876848 +- 0.025151778012514114 +- -0.011898066848516464 +- 0.004525656811892986 +- -0.01575278490781784 +- -0.011790752410888672 +- 0.006835195701569319 +- 0.001982429763302207 +- -0.0036659459583461285 +- 0.005564550403505564 +- -0.03065667115151882 +- -0.003285064361989498 +- -0.04245128855109215 +- -0.0108277453109622 +- -0.02954847924411297 +- -0.002012475160881877 +- 0.051326002925634384 +- 0.06347838044166565 +- 0.051774848252534866 +- -0.015365514904260635 +- 0.015061273239552975 +- -0.007367939222604036 +- 0.0010637410450726748 +- 0.06276016682386398 +- -0.02957945689558983 +- -0.051781173795461655 +- 0.027817975729703903 +- 0.0335148423910141 +- 0.013744115829467773 +- 0.027316000312566757 +- 0.025438742712140083 +- 0.043146174401044846 +- 0.004890078213065863 +- 0.029609275981783867 +- 0.0027664026711136103 +- -0.032663438469171524 +- -0.06768232583999634 +- -0.02759111300110817 +- -0.01304713822901249 +- 0.01896962895989418 +- -0.024471092969179153 +- 0.01752583496272564 +- 0.014895530417561531 +- -0.02933850884437561 +- -0.005240517668426037 +- 0.011430944316089153 +- 0.00038782143383286893 +- 0.06265012174844742 +- 2.793936175748968e-07 +- 0.04171879589557648 +- 0.021326567977666855 +- -0.006491364911198616 +- 0.033413417637348175 +- -0.10268592834472656 +- 0.022930173203349113 +- -0.05774132162332535 +- -0.0025584890972822905 +- 0.004056774079799652 +- 0.028190597891807556 +- 0.06420814245939255 +- -0.005803675390779972 +- 0.006756909657269716 +- 0.04273530840873718 +- -0.028952768072485924 +- -0.017482642084360123 +- -0.04779893159866333 +- 0.00010195205686613917 +- -0.003987823612987995 +- 0.011002378538250923 +- -0.029599053785204887 +- 0.01962190680205822 +- 0.032979533076286316 +- 0.019116386771202087 +- -0.0028004201594740152 +- 0.011610236950218678 +- -0.05887481942772865 +- -0.005668789613991976 +- 0.015520419925451279 +- 0.0035459434147924185 +- 0.02312924712896347 +- -0.00916894432157278 +- 0.026975736021995544 +- -0.019005153328180313 +- -0.029934121295809746 +- -0.00555479945614934 +- -0.029487231746315956 +- -0.014738216996192932 +- 0.07038892805576324 +- 0.008675076067447662 +- 0.04255333170294762 +- 0.054058123379945755 +- -0.023106325417757034 +- -0.03951043635606766 +- -0.030077045783400536 +- 0.013856841251254082 +- 0.01211903803050518 +- 0.009252346120774746 +- 0.04849030822515488 +- -0.00609244592487812 +- -0.00025523302610963583 +- 0.010324900038540363 +- -0.010443597100675106 +- -0.004541265778243542 +- -0.062441956251859665 +- -0.013903431594371796 +- 0.03468233719468117 +- 0.02928573451936245 +- -0.008723189122974873 +- -0.04756011813879013 +- -0.0013190138852223754 +- -0.013374523259699345 +- 0.03462078422307968 +- -0.024128414690494537 +- 0.0458071194589138 +- 0.05631611868739128 +- -0.013718623667955399 +- 2.6096174330458926e-34 +- -0.010453467257320881 +- -0.013761325739324093 +- 0.05034365504980087 +- -0.10686467587947845 +- -0.02344868890941143 +- 0.0332661047577858 +- 0.044834405183792114 +- -0.0037930277176201344 +- -0.028101306408643723 +- 0.005715076345950365 +- -0.03135063126683235 diff --git a/tests/unit_tests/data/experience/sub_path/raw_exp_test-exp-1.yaml b/tests/unit_tests/data/experience/sub_path/raw_exp_test-exp-1.yaml new file mode 100644 index 00000000..7c25c7a5 --- /dev/null +++ b/tests/unit_tests/data/experience/sub_path/raw_exp_test-exp-1.yaml @@ -0,0 +1,364 @@ +enabled: true +id: conv-20231228-031939-964dd166 +plugins: [] +rounds: +- id: round-20231228-031954-a6ab565a + post_list: + - attachment_list: [] + id: post-20231228-031954-6ac1372a + message: show top 3 data in ./demo_data.csv + send_from: User + send_to: Planner + - attachment_list: + - content: '1. load the demo_data.csv file + + 2. show the top 3 rows of the loaded data + + 3. report the result to the user ' + extra: null + id: atta-20231228-032002-a97f6161 + type: init_plan + - content: '1. instruct CodeInterpreter to load the demo_data.csv file and show + the top 3 rows of the loaded data + + 2. report the result to the user' + extra: null + id: atta-20231228-032002-6d8208ef + type: plan + - content: 1. instruct CodeInterpreter to load the demo_data.csv file and show + the top 3 rows of the loaded data + extra: null + id: atta-20231228-032002-486f818e + type: current_plan_step + id: post-20231228-032002-01609337 + message: Please load the demo_data.csv file and show the top 3 rows of the loaded + data + send_from: Planner + send_to: CodeInterpreter + - attachment_list: + - content: ProgramApe will generate a code snippet to load the demo_data.csv file + and show the top 3 rows of the loaded data. + extra: null + id: atta-20231228-032008-8e2b5b03 + type: thought + - content: 'import pandas as pd + + + data = pd.read_csv("./demo_data.csv") + + top_3_rows = data.head(3) + + top_3_rows' + extra: null + id: atta-20231228-032008-58d4ca3c + type: python + - content: NONE + extra: null + id: atta-20231228-032008-03db9154 + type: verification + - content: No code verification is performed. + extra: null + id: atta-20231228-032008-2ed4993c + type: code_error + - content: FAILURE + extra: null + id: atta-20231228-032022-d5d2fda6 + type: execution_status + - content: "The execution of the generated python code above has failed\n\nDuring\ + \ execution, the following messages were logged:\nTraceback (most recent call\ + \ last):\n\n Cell In[1], line 3\n data = pd.read_csv(\"./demo_data.csv\"\ + )\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\pandas\\\ + io\\parsers\\readers.py:948 in read_csv\n return _read(filepath_or_buffer,\ + \ kwds)\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\\ + pandas\\io\\parsers\\readers.py:611 in _read\n parser = TextFileReader(filepath_or_buffer,\ + \ **kwds)\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\\ + pandas\\io\\parsers\\readers.py:1448 in __init__\n self._engine = self._make_engine(f,\ + \ self.engine)\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\\ + pandas\\io\\parsers\\readers.py:1705 in _make_engine\n self.handles = get_handle(\n\ + \n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\pandas\\io\\\ + common.py:863 in get_handle\n handle = open(\n\nFileNotFoundError: [Errno\ + \ 2] No such file or directory: './demo_data.csv'\n\n" + extra: null + id: atta-20231228-032022-d68ae261 + type: execution_result + - content: [] + extra: null + id: atta-20231228-032022-757abf34 + type: artifact_paths + - content: 'The execution of the previous generated code has failed. If you think + you can fix the problem by rewriting the code, please generate code and run + it again. + + Otherwise, please explain the problem to me.' + extra: null + id: atta-20231228-032022-258d06b5 + type: revise_message + id: post-20231228-032008-873b0f67 + message: "The following python code has been executed:\n```python\nimport pandas\ + \ as pd\n\ndata = pd.read_csv(\"./demo_data.csv\")\ntop_3_rows = data.head(3)\n\ + top_3_rows\n```\n\n\nThe execution of the generated python code above has failed\n\ + \nDuring execution, the following messages were logged:\nTraceback (most recent\ + \ call last):\n\n Cell In[1], line 3\n data = pd.read_csv(\"./demo_data.csv\"\ + )\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\pandas\\\ + io\\parsers\\readers.py:948 in read_csv\n return _read(filepath_or_buffer,\ + \ kwds)\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\pandas\\\ + io\\parsers\\readers.py:611 in _read\n parser = TextFileReader(filepath_or_buffer,\ + \ **kwds)\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\\ + pandas\\io\\parsers\\readers.py:1448 in __init__\n self._engine = self._make_engine(f,\ + \ self.engine)\n\n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\\ + pandas\\io\\parsers\\readers.py:1705 in _make_engine\n self.handles = get_handle(\n\ + \n File D:\\python_project\\Octopus\\venv\\Lib\\site-packages\\pandas\\io\\\ + common.py:863 in get_handle\n handle = open(\n\nFileNotFoundError: [Errno\ + \ 2] No such file or directory: './demo_data.csv'\n\n" + send_from: CodeInterpreter + send_to: CodeInterpreter + - attachment_list: + - content: ProgramApe understands that the execution of the previous round has + failed due to the FileNotFoundError. + extra: null + id: atta-20231228-032034-ef93fd30 + type: thought + - content: ProgramApe will generate a code snippet to check if the file exists + before attempting to read it. + extra: null + id: atta-20231228-032034-abc40f7d + type: thought + - content: "import os\nimport pandas as pd\n\nfile_path = \"./demo_data.csv\"\n\ + \nif os.path.exists(file_path):\n data = pd.read_csv(file_path)\n top_3_rows\ + \ = data.head(3)\n top_3_rows\nelse:\n print(\"File not found: {}\"\ + .format(file_path))" + extra: null + id: atta-20231228-032034-cd811837 + type: python + - content: NONE + extra: null + id: atta-20231228-032034-a9bf281d + type: verification + - content: No code verification is performed. + extra: null + id: atta-20231228-032034-16286524 + type: code_error + - content: SUCCESS + extra: null + id: atta-20231228-032035-97fd92cf + type: execution_status + - content: 'The execution of the generated python code above has succeeded + + + The stdout is: + + File not found: ./demo_data.csv + + ' + extra: null + id: atta-20231228-032035-08c1452e + type: execution_result + - content: [] + extra: null + id: atta-20231228-032035-6a9bdea7 + type: artifact_paths + id: post-20231228-032034-7cd82303 + message: "The following python code has been executed:\n```python\nimport os\n\ + import pandas as pd\n\nfile_path = \"./demo_data.csv\"\n\nif os.path.exists(file_path):\n\ + \ data = pd.read_csv(file_path)\n top_3_rows = data.head(3)\n top_3_rows\n\ + else:\n print(\"File not found: {}\".format(file_path))\n```\n\n\nThe execution\ + \ of the generated python code above has succeeded\n\nThe stdout is:\nFile not\ + \ found: ./demo_data.csv\n" + send_from: CodeInterpreter + send_to: Planner + - attachment_list: + - content: '1. load the demo_data.csv file + + 2. show the top 3 rows of the loaded data + + 3. report the result to the user ' + extra: null + id: atta-20231228-032044-4b231548 + type: init_plan + - content: '1. instruct CodeInterpreter to load the demo_data.csv file and show + the top 3 rows of the loaded data + + 2. report the result to the user' + extra: null + id: atta-20231228-032044-e43c4dbb + type: plan + - content: 2. report the result to the user + extra: null + id: atta-20231228-032044-0c0abfa1 + type: current_plan_step + id: post-20231228-032044-e439bc0a + message: The demo_data.csv file was not found in the current directory. Please + check the file path and try again. + send_from: Planner + send_to: User + state: finished + user_query: show top 3 data in ./demo_data.csv +- id: round-20231228-032111-c43aa177 + post_list: + - attachment_list: [] + id: post-20231228-032111-1b808a75 + message: sorry, try d:/demo_data.csv + send_from: User + send_to: Planner + - attachment_list: + - content: '1. load the d:/demo_data.csv file + + 2. show the top 3 rows of the loaded data + + 3. report the result to the user ' + extra: null + id: atta-20231228-032121-24bbf7f8 + type: init_plan + - content: '1. instruct CodeInterpreter to load the d:/demo_data.csv file and + show the top 3 rows of the loaded data + + 2. report the result to the user' + extra: null + id: atta-20231228-032121-3dfc52c0 + type: plan + - content: 1. instruct CodeInterpreter to load the d:/demo_data.csv file and show + the top 3 rows of the loaded data + extra: null + id: atta-20231228-032121-7a0a9ab1 + type: current_plan_step + id: post-20231228-032121-09256132 + message: Please load the d:/demo_data.csv file and show the top 3 rows of the + loaded data + send_from: Planner + send_to: CodeInterpreter + - attachment_list: + - content: ProgramApe will generate a code snippet to load the d:/demo_data.csv + file and show the top 3 rows of the loaded data. + extra: null + id: atta-20231228-032128-ba8c80ab + type: thought + - content: "file_path = \"d:/demo_data.csv\"\n\nif os.path.exists(file_path):\n\ + \ data = pd.read_csv(file_path)\n top_3_rows = data.head(3)\n top_3_rows\n\ + else:\n print(\"File not found: {}\".format(file_path))" + extra: null + id: atta-20231228-032128-538ec4c9 + type: python + - content: NONE + extra: null + id: atta-20231228-032128-3774f660 + type: verification + - content: No code verification is performed. + extra: null + id: atta-20231228-032128-134e741a + type: code_error + - content: SUCCESS + extra: null + id: atta-20231228-032129-1c0299e7 + type: execution_status + - content: 'The execution of the generated python code above has succeeded + + + The execution is successful but no output is generated.' + extra: null + id: atta-20231228-032129-0528f68e + type: execution_result + - content: [] + extra: null + id: atta-20231228-032129-002cb73c + type: artifact_paths + id: post-20231228-032128-ab8d2155 + message: "The following python code has been executed:\n```python\nfile_path =\ + \ \"d:/demo_data.csv\"\n\nif os.path.exists(file_path):\n data = pd.read_csv(file_path)\n\ + \ top_3_rows = data.head(3)\n top_3_rows\nelse:\n print(\"File not\ + \ found: {}\".format(file_path))\n```\n\n\nThe execution of the generated python\ + \ code above has succeeded\n\nThe execution is successful but no output is generated." + send_from: CodeInterpreter + send_to: Planner + - attachment_list: + - content: '1. load the d:/demo_data.csv file + + 2. show the top 3 rows of the loaded data + + 3. report the result to the user ' + extra: null + id: atta-20231228-032136-dc3160cd + type: init_plan + - content: '1. instruct CodeInterpreter to load the d:/demo_data.csv file and + show the top 3 rows of the loaded data + + 2. report the result to the user' + extra: null + id: atta-20231228-032136-83ecbbcb + type: plan + - content: 2. report the result to the user + extra: null + id: atta-20231228-032136-275ea72a + type: current_plan_step + id: post-20231228-032136-307540e8 + message: Please provide the top 3 rows of the loaded data from d:/demo_data.csv + send_from: Planner + send_to: CodeInterpreter + - attachment_list: + - content: ProgramApe will use the previously loaded data and show the top 3 rows + of the loaded data. + extra: null + id: atta-20231228-032139-92b37879 + type: thought + - content: top_3_rows + extra: null + id: atta-20231228-032139-63972e50 + type: python + - content: NONE + extra: null + id: atta-20231228-032139-410e4ece + type: verification + - content: No code verification is performed. + extra: null + id: atta-20231228-032139-50ff8673 + type: code_error + - content: SUCCESS + extra: null + id: atta-20231228-032140-42bf16f2 + type: execution_status + - content: "The execution of the generated python code above has succeeded\n\n\ + The result of above Python code after execution is:\n TimeBucket\ + \ Count\n0 2023-02-01T00:00:00Z 67814\n1 2023-02-01T04:00:00Z 84569\n\ + 2 2023-02-01T08:00:00Z 81796" + extra: null + id: atta-20231228-032140-7c46d695 + type: execution_result + - content: [] + extra: null + id: atta-20231228-032140-6d5c162c + type: artifact_paths + id: post-20231228-032139-2c5806cd + message: "The following python code has been executed:\n```python\ntop_3_rows\n\ + ```\n\n\nThe execution of the generated python code above has succeeded\n\n\ + The result of above Python code after execution is:\n TimeBucket\ + \ Count\n0 2023-02-01T00:00:00Z 67814\n1 2023-02-01T04:00:00Z 84569\n2\ + \ 2023-02-01T08:00:00Z 81796" + send_from: CodeInterpreter + send_to: Planner + - attachment_list: + - content: '1. load the d:/demo_data.csv file + + 2. show the top 3 rows of the loaded data + + 3. report the result to the user ' + extra: null + id: atta-20231228-032204-67fb371f + type: init_plan + - content: '1. instruct CodeInterpreter to load the d:/demo_data.csv file and + show the top 3 rows of the loaded data + + 2. report the result to the user' + extra: null + id: atta-20231228-032204-321fc7d0 + type: plan + - content: 2. report the result to the user + extra: null + id: atta-20231228-032204-ee807746 + type: current_plan_step + id: post-20231228-032204-3b716830 + message: "Here are the top 3 rows of the d:/demo_data.csv file:\n\n \ + \ TimeBucket Count\n0 2023-02-01T00:00:00Z 67814\n1 2023-02-01T04:00:00Z\ + \ 84569\n2 2023-02-01T08:00:00Z 81796" + send_from: Planner + send_to: User + state: finished + user_query: sorry, try d:/demo_data.csv diff --git a/tests/unit_tests/data/prompts/generator_prompt.yaml b/tests/unit_tests/data/prompts/generator_prompt.yaml index b8a977d7..aa7da4d0 100644 --- a/tests/unit_tests/data/prompts/generator_prompt.yaml +++ b/tests/unit_tests/data/prompts/generator_prompt.yaml @@ -1,5 +1,8 @@ -version: 0.1 +version: 0.2 content: |- + ## On current environment context: + {ENVIRONMENT_CONTEXT} + ## On conversations: - Each conversation starts with "==============================\n## Conversation Start" - Each conversation has multiple rounds, each round starts with "-----------------------------" @@ -23,9 +26,6 @@ content: |- ## On {ROLE_NAME}'s response format: - The response is a JSON object with the following format: {RESPONSE_JSON_SCHEMA} - - The value of "thought" is a string that contains the thought of {ROLE_NAME} before generating the code. - - The value of "reply_type" is a string that indicates the type of the reply, which can be "python" or "text". Select "text" if the response is not a executable code snippet. - - The value of "reply_content" is a string that contains the actual content and {ROLE_NAME} must be very careful about escaping the special characters (e.g., '\', '/', and '"') in the string for JSON format. response_json_schema: |- { @@ -35,21 +35,35 @@ response_json_schema: |- "type": "object", "properties": { "thought": { - "type": "string" + "type": "string", + "maxLength": 1000, + "description": "The thoughts before generating the code." }, "reply_type": { "type": "string", - "enum": ["python", "text"] + "enum": [ + "python", + "text" + ], + "description": "The type of the reply, which can be 'python' or 'text'. Select 'text' if the response is not a executable code snippet." }, "reply_content": { - "type": "string" - } + "type": "string", + "minLength": 10, + "description": "The actual content of the response. If the reply_type is 'python', the content should be a valid python code snippet. Make sure escaping the special characters (e.g., '\\', '/', and '\"') in the strings for JSON format." + } }, - "required": ["thought", "reply_type", "reply_content"] + "required": [ + "thought", + "reply_type", + "reply_content" + ] } }, - "required": ["response"] - } + "required": [ + "response" + ] + } conversation_head: |- @@ -66,10 +80,10 @@ conversation_head: |- user_message_head: |- ----------------------------- - # Feedback of the code in the last round (None if no feedback): + ### Feedback of the code in the last round (None if no feedback): {FEEDBACK} - # Additional information from the User in this round: + ### Request from the User in this round: {MESSAGE} requirements: |- @@ -82,7 +96,7 @@ requirements: |- {CODE_GENERATION_REQUIREMENTS} experience_instruction: |- - ## Experience And Lessons - Before generating Python code, please refer to the experiences and lessons learned from the previous tasks: + ### Experience And Lessons + Before generating code, please learn from the following past experiences and lessons: {experiences} - You must use the experiences and lessons learned to generate the Python code. + You must apply them in code generation. diff --git a/tests/unit_tests/data/prompts/planner_prompt.yaml b/tests/unit_tests/data/prompts/planner_prompt.yaml index 7de60a60..851daf70 100644 --- a/tests/unit_tests/data/prompts/planner_prompt.yaml +++ b/tests/unit_tests/data/prompts/planner_prompt.yaml @@ -1,7 +1,10 @@ -version: 0.2 +version: 0.4 instruction_template: |- You are the Planner who can coordinate Workers to finish the user task. + ## About the current environment context + {environment_context} + ## About conversation history - There could be multiple Conversations in the chat history - Each Conversation starts with the User query "Let's start a new conversation!". @@ -10,28 +13,29 @@ instruction_template: |- ## User Character - The User's input should be the request or additional information required to complete the user's task. - The User can only talk to the Planner. - - The input of the User will be prefixed with "From: User". + - The input of the User will contain a `send_from` field, which is the name of the User. ## Worker Character - There are multiple Workers in the environment. The details of the Workers are as follows: + There are multiple Workers in the environment. The expertise of the Workers are listed below: {worker_intro} ## Planner Character - - Planner's role is to plan the subtasks and to instruct Workers to resolve the request from the User. - - If needs additional information from the User, Planner should ask the User to provide. - - Planner can talk to the User and Workers by specifying the "send_to" field in the response. - - Planner MUST NOT talk to the Planner itself. - - Planner can assign different subtasks to different Workers, but each subtask should be assigned to only one Worker. - - Planner should try the best to complete the tasks before asking the User for additional information. - - Planner should refine or change the plan according to the replies of the Workers or the new requests of User. - - Planner should ignore the permission or file access issues since Workers are powerful and can handle them. - - Planner needs to inform Workers on the User's request and the current step. + - Planner's main job is to make planning and to instruct Workers to resolve the request from the User. + - Planner can conduct basic analysis (e.g., comprehension, extraction, etc.) to solve simple problems after reading the messages from the User and the Workers. + - Planner should first try to solve the task by itself before reaching out to the Workers for their special expertise. + - Planner can assign different subtasks to different Workers, and each subtask should be assigned to only one Worker. - Planner must reject the User's request if it contains potential security risks or illegal activities. + - Planner should ask the User to provide additional information critical for problem solving, but only after trying the best. + - Planner can talk to the User and Workers by specifying the `send_to` field in the response, but MUST NOT talk to the Planner itself. + - Planner should refine the plan according to its observations from the replies of the Workers or the new requests of User. + - Planner needs to inform Workers on the User's request, the current step, and necessary information to complete the task. + - Planner must check the Worker's response and provide feedback to the Worker if the response is incorrect or incomplete. + - Planner can ignore the permission or file access issues since Workers are powerful and can handle them. ## Planner's planning process - You need to make a step-by-step plan to complete the User's task. The planning process includes 2 phases: "init_plan" and "plan". - In the "init_plan" phase, you need to decompose the User's task into subtasks and list them as the detailed plan steps. - In the "plan" phase, you need to refine the initial plan by merging adjacent steps that have sequential dependency or no dependency, unless the merged step becomes too complicated. + You need to make a step-by-step plan to complete the User's task. The planning process includes 2 phases: `init_plan` and `plan`. + In the `init_plan` phase, you need to decompose the User's task into subtasks and list them as the detailed plan steps. + In the `plan` phase, you need to refine the initial plan by merging adjacent steps that have sequential dependency or no dependency, unless the merged step becomes too complicated. ### init_plan - Decompose User's task into subtasks and list them as the detailed subtask steps. @@ -54,17 +58,21 @@ instruction_template: |- init_plan: 1. Read ./data.csv file 2. Count the rows of the loaded data + 3. Check the execution result and report the result to the user plan: 1. Read ./data.csv file and count the rows of the loaded data + 2. Check the execution result and report the result to the user [Example 2] User: Read a manual file and follow the instructions in it. init_plan: 1. Read the file content and show its content to the user 2. Follow the instructions based on the file content. + 3. Confirm the completion of the instructions and report the result to the user plan: 1. Read the file content and show its content to the user 2. follow the instructions based on the file content. + 3. Confirm the completion of the instructions and report the result to the user [Example 3] User: detect anomaly on ./data.csv @@ -72,11 +80,11 @@ instruction_template: |- 1. Read the ./data.csv and show me the top 5 rows to understand the data schema 2. Confirm the columns to be detected anomalies 3. Detect anomalies on the loaded data - 4. Report the detected anomalies to the user + 4. Check the execution result and report the detected anomalies to the user plan: 1. Read the ./data.csv and show me the top 5 rows to understand the data schema and confirm the columns to be detected anomalies 2. Detect anomalies on the loaded data - 3. Report the detected anomalies to the user + 3. Check the execution result and report the detected anomalies to the user [Example 4] User: read a.csv and b.csv and join them together @@ -85,32 +93,25 @@ instruction_template: |- 2. Load b.csv as dataframe and show me the top 5 rows to understand the data schema 3. Ask which column to join 4. Join the two dataframes - 5. report the result to the user + 5. Check the execution result and report the joined data to the user plan: 1. Load a.csv and b.csv as dataframes, show me the top 5 rows to understand the data schema, and ask which column to join 2. Join the two dataframes - 3. report the result to the user + 3. Check the execution result and report the joined data to the user - ## Useful Tips - - When the request involves loading a file, Planner should always set the first subtask to reading the file content to understand the structure or schema of the data. + ## Planner's useful tips + - When the request involves loading a file or pulling a table from db, Planner should always set the first subtask to reading the content to understand the structure or schema of the data. + - When the request involves text analysis, Planner should always set the first subtask to read and print the text content to understand its content structure. ## Planner's response format - Planner must strictly format the response into the following JSON object: {response_json_schema} - - Planner's response must include 5 attributes "init_plan", "plan", "current_plan_step", "send_to", and "message". - - "init_plan" is the initial plan. - - "plan" is the refined plan. - - "current_plan_step" is the current step Planner is executing. - - "send_to" is the name of character (User or name of the Worker) that Planner wants to speak to. - - "message" is the message of Planner sent to the receipt Character. If there is any file path in the message, it should be formatted as links in Markdown, i.e., [file_name](file_path) - - Planner must not include any other elements in the response that can cause parsing errors. experience_instruction: |- # Experience And Lessons - Before planning, please learn from the following past experiences: + Before starting planning, please refer to the following experiences and lessons learned from the previous tasks and include them in your plan. {experiences} - You must apply them in planning. - + You need to borrow the experience and lessons learned from the previous tasks in your current plan. response_json_schema: |- { @@ -120,19 +121,28 @@ response_json_schema: |- "type": "object", "properties": { "init_plan": { - "type": "string" + "type": "string", + "description": "The initial plan to decompose the User's task into subtasks and list them as the detailed subtask steps. The initial plan must contain dependency annotations for sequential and interactive dependencies." }, "plan": { - "type": "string" + "type": "string", + "description": "The refined plan by merging adjacent steps that have sequential dependency or no dependency. The final plan must not contain dependency annotations." }, "current_plan_step": { - "type": "string" + "type": "string", + "description": "The current step Planner is executing." + }, + "review": { + "type": "string", + "description": "The review of the current step. If the Worker's response is incorrect or incomplete, Planner should provide feedback to the Worker." }, "send_to": { - "type": "string" + "type": "string", + "description": "The name of character (User or name of the Worker) that Planner wants to speak to." }, "message": { - "type": "string" + "type": "string", + "description": "The message of Planner sent to the receipt Character. If there is any file path in the message, it should be formatted as links in Markdown, i.e., [file_name](file_path)" } }, "required": [ @@ -144,5 +154,7 @@ response_json_schema: |- ] } }, - "required": ["response"] + "required": [ + "response" + ] } diff --git a/tests/unit_tests/test_code_generator.py b/tests/unit_tests/test_code_generator.py index 12cf698d..666a020c 100644 --- a/tests/unit_tests/test_code_generator.py +++ b/tests/unit_tests/test_code_generator.py @@ -5,6 +5,7 @@ from taskweaver.config.config_mgt import AppConfigSource from taskweaver.logging import LoggingModule from taskweaver.memory.attachment import AttachmentType +from taskweaver.memory.experience import Experience from taskweaver.memory.plugin import PluginModule @@ -153,7 +154,7 @@ def test_compose_prompt(): ) assert messages[0]["role"] == "system" - assert messages[0]["content"].startswith("## On conversations:") + assert messages[0]["content"].startswith("## On current environment context:") assert messages[1]["role"] == "user" assert messages[1]["content"] == ( "==============================\n" @@ -168,11 +169,11 @@ def test_compose_prompt(): "The functions can be directly called without importing:\n" "None\n" "-----------------------------\n" - "# Feedback of the code in the last round (None if no feedback):\n" + "### Feedback of the code in the last round (None if no feedback):\n" "None\n" "\n" - "# Additional information from the User in this round:\n" - "create a dataframe" + "### Request from the User in this round:\n" + "The task for this specific step is: create a dataframe" ) assert messages[2]["role"] == "assistant" assert messages[2]["content"] == ( @@ -188,17 +189,17 @@ def test_compose_prompt(): assert messages[5]["role"] == "user" assert messages[5]["content"] == ( "-----------------------------\n" - "# Feedback of the code in the last round (None if no feedback):\n" + "### Feedback of the code in the last round (None if no feedback):\n" "## Execution\n" "Your code has been executed successfully with the following result:\n" "The minimum value in the 'VALUE' column is 0.05;The maximum value in the " "'VALUE' column is 0.99;The data range for the 'VALUE' column is 0.94\n" "\n" "\n" - "# Additional information from the User in this round:\n" + "### Request from the User in this round:\n" "The user request is: hello again\n" "\n" - "what is the max value?\n" + "The task for this specific step is: what is the max value?\n" "Please follow the instructions below to complete the task:\n" "- ProgramApe can refer to intermediate variables in the generated code from " "previous successful rounds and the context summary in the current " @@ -559,13 +560,13 @@ def test_code_correction_prompt(): assert messages[3]["role"] == "user" assert messages[3]["content"] == ( "-----------------------------\n" - "# Feedback of the code in the last round (None if no feedback):\n" + "### Feedback of the code in the last round (None if no feedback):\n" "## Execution\n" "Your code has failed to execute with the following error:\n" "The code failed to execute. Please check the code and try again.\n" "\n" "\n" - "# Additional information from the User in this round:\n" + "### Request from the User in this round:\n" "Please check the code and try again.\n" "Please follow the instructions below to complete the task:\n" "- ProgramApe can refer to intermediate variables in the generated code from " @@ -579,3 +580,110 @@ def test_code_correction_prompt(): "- ProgramApe must try to directly import required modules without installing " "them, and only install the modules if the execution fails. \n" ) + + +def test_compose_with_shared_plan(): + app_injector = Injector( + [PluginModule, LoggingModule], + ) + app_config = AppConfigSource( + config={ + "app_dir": os.path.dirname(os.path.abspath(__file__)), + "llm.api_key": "this_is_not_a_real_key", # pragma: allowlist secret + "code_generator.prompt_compression": True, + "code_generator.prompt_file_path": os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "data/prompts/generator_prompt.yaml", + ), + "code_generator.use_experience": True, + }, + ) + app_injector.binder.bind(AppConfigSource, to=app_config) + + from taskweaver.code_interpreter.code_interpreter import CodeGenerator + from taskweaver.memory import Memory, Post, Round + + code_generator = app_injector.create_object(CodeGenerator) + code_generator.set_alias("CodeInterpreter") + + post1 = Post.create( + message="create a dataframe", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[], + ) + + round1 = Round.create(user_query="hello", id="round-1") + round1.add_post(post1) + + memory = Memory(session_id="session-1") + memory.conversation.add_round(round1) + + selected_experiences = [ + ( + Experience( + exp_id="exp-1", + experience_text="this is a test experience", + ), + 0.3, + ), + ( + Experience( + exp_id="exp-2", + experience_text="this is another test experience", + ), + 0.2, + ), + ] + + messages = code_generator.compose_prompt( + rounds=memory.conversation.rounds, + plugins=code_generator.get_plugin_pool(), + selected_experiences=selected_experiences, + planning_enrichments=[ + "shared_memory_entry1", + "shared_memory_entry2", + ], + ) + + assert messages[0]["role"] == "system" + assert messages[0]["content"].startswith("## On current environment context:") + assert "this is a test experience" in messages[0]["content"] + assert "this is another test experience" in messages[0]["content"] + assert messages[1]["role"] == "user" + assert messages[1]["content"] == ( + "==============================\n" + "## Conversation Start\n" + "\n" + "### Context Summary\n" + "The context summary of previous rounds and the variables that ProgramApe can " + "refer to:\n" + "None\n" + "\n" + "### Plugin Functions\n" + "The functions can be directly called without importing:\n" + "None\n" + "-----------------------------\n" + "### Feedback of the code in the last round (None if no feedback):\n" + "None\n" + "\n" + "### Request from the User in this round:\n" + "The user request is: hello\n" + "\n" + "Additional context:\n" + "shared_memory_entry1\n" + "shared_memory_entry2\n" + "\n" + "The task for this specific step is: create a dataframe\n" + "Please follow the instructions below to complete the task:\n" + "- ProgramApe can refer to intermediate variables in the generated code from " + "previous successful rounds and the context summary in the current " + "Conversation, \n" + "- ProgramApe should not refer to any information from failed rounds, rounds " + "that have not been executed, or previous Conversations.\n" + "- ProgramApe put all the result variables in the last line of the code.\n" + "- ProgramApe must not import the plugins and otherwise the code will be " + "failed to execute.\n" + "- ProgramApe must try to directly import required modules without installing " + "them, and only install the modules if the execution fails. \n" + ) diff --git a/tests/unit_tests/test_experience.py b/tests/unit_tests/test_experience.py index 1db44ed1..0a25afa0 100644 --- a/tests/unit_tests/test_experience.py +++ b/tests/unit_tests/test_experience.py @@ -23,16 +23,18 @@ def test_experience_retrieval(): config={ "llm.embedding_api_type": "sentence_transformers", "llm.embedding_model": "all-mpnet-base-v2", - "experience.experience_dir": os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "data/experience", - ), "experience.refresh_experience": False, "experience.retrieve_threshold": 0.0, }, ) app_injector.binder.bind(AppConfigSource, to=app_config) experience_manager = app_injector.create_object(ExperienceGenerator) + experience_manager.set_experience_dir( + os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "data/experience", + ), + ) user_query = "show top 10 data in ./data.csv" diff --git a/tests/unit_tests/test_memory.py b/tests/unit_tests/test_memory.py index f599c157..d0e0e3c6 100644 --- a/tests/unit_tests/test_memory.py +++ b/tests/unit_tests/test_memory.py @@ -1,3 +1,7 @@ +from taskweaver.memory import Attachment, SharedMemoryEntry +from taskweaver.memory.attachment import AttachmentType + + def test_memory_get_rounds(): from taskweaver.memory import Memory, Post, Round from taskweaver.module.prompt_util import PromptUtil @@ -75,3 +79,341 @@ def test_memory_get_rounds(): rounds[0].post_list[0].message = "create a dataframe 1" assert rounds[0].post_list[0].message == "create a dataframe 1" assert memory.conversation.rounds[0].post_list[0].message == "create a dataframe" + + +def test_memory_get_shared1(): + from taskweaver.memory import Memory, Post, Round + from taskweaver.module.prompt_util import PromptUtil + + memory = Memory(session_id="session-1") + + post1 = Post.create( + message="create a dataframe", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: create a dataframe", + scope="conversation", + scope_id=memory.conversation.id, + aggregation_keys=("type",), + by="Planner", + ), + ), + ], + ) + post2 = Post.create( + message="A dataframe `df` with 10 rows and 2 columns: " + + PromptUtil.wrap_text_with_delimiter( + "'DATE' and 'VALUE' has been generated.", + PromptUtil.DELIMITER_TEMPORAL, + ), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + + round1 = Round.create(user_query="hello", id="round-1") + round1.add_post(post1) + round1.add_post(post2) + + round2 = Round.create(user_query="hello again", id="round-2") + post3 = Post.create( + message="what is the data range", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: what is the data range", + scope="conversation", + scope_id=memory.conversation.id, + aggregation_keys=("type",), + by="Planner", + ), + ), + ], + ) + post4 = Post.create( + message="The data range for the 'VALUE' column is " + + PromptUtil.wrap_text_with_delimiter("0.94", PromptUtil.DELIMITER_TEMPORAL), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + + round2.add_post(post3) + round2.add_post(post4) + + round3 = Round.create(user_query="hello again", id="round-3") + post5 = Post.create( + message="what is the max value?", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: what is the max value?", + scope="conversation", + scope_id=memory.conversation.id, + aggregation_keys=("type",), + by="Planner", + ), + ), + ], + ) + post6 = Post.create( + message="The max value is " + PromptUtil.wrap_text_with_delimiter("0.94", PromptUtil.DELIMITER_TEMPORAL), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + round3.add_post(post5) + round3.add_post(post6) + + memory.conversation.add_round(round1) + memory.conversation.add_round(round2) + memory.conversation.add_round(round3) + + shared_plan = memory.get_shared_memory_entry( + entry_type="plan", + entry_scopes=["conversation"], + entry_scope_ids=[memory.conversation.id], + ) + + assert len(shared_plan) == 1 + assert shared_plan[0].content == "This is my plan: what is the max value?" + + +def test_memory_get_shared2(): + from taskweaver.memory import Memory, Post, Round + from taskweaver.module.prompt_util import PromptUtil + + post1 = Post.create( + message="create a dataframe", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: create a dataframe", + scope="round", + scope_id="round-1", + aggregation_keys=("by", "type", "scope_id"), + by="Planner", + ), + ), + ], + ) + post2 = Post.create( + message="A dataframe `df` with 10 rows and 2 columns: " + + PromptUtil.wrap_text_with_delimiter( + "'DATE' and 'VALUE' has been generated.", + PromptUtil.DELIMITER_TEMPORAL, + ), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + + round1 = Round.create(user_query="hello", id="round-1") + round1.add_post(post1) + round1.add_post(post2) + + round2 = Round.create(user_query="hello again", id="round-2") + post3 = Post.create( + message="what is the data range", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: what is the data range", + scope="round", + scope_id="round-2", + aggregation_keys=("by", "type", "scope_id"), + by="Planner", + ), + ), + ], + ) + post4 = Post.create( + message="The data range for the 'VALUE' column is " + + PromptUtil.wrap_text_with_delimiter("0.94", PromptUtil.DELIMITER_TEMPORAL), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + + round2.add_post(post3) + round2.add_post(post4) + + round3 = Round.create(user_query="hello again", id="round-3") + post5 = Post.create( + message="what is the max value?", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: what is the max value?", + scope="round", + scope_id="round-3", + aggregation_keys=("by", "type", "scope_id"), + by="Planner", + ), + ), + ], + ) + post6 = Post.create( + message="The max value is " + PromptUtil.wrap_text_with_delimiter("0.94", PromptUtil.DELIMITER_TEMPORAL), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + round3.add_post(post5) + round3.add_post(post6) + + memory = Memory(session_id="session-1") + memory.conversation.add_round(round1) + memory.conversation.add_round(round2) + memory.conversation.add_round(round3) + + shared_plan = memory.get_shared_memory_entry( + entry_type="plan", + entry_scopes=["round"], + entry_scope_ids=["round-3"], + ) + + assert len(shared_plan) == 1 + + +def test_memory_get_shared3(): + from taskweaver.memory import Memory, Post, Round + from taskweaver.module.prompt_util import PromptUtil + + memory = Memory(session_id="session-1") + post1 = Post.create( + message="create a dataframe", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: create a dataframe", + scope="conversation", + scope_id=memory.conversation.id, + aggregation_keys=("id",), + by="Planner", + ), + ), + ], + ) + post2 = Post.create( + message="A dataframe `df` with 10 rows and 2 columns: " + + PromptUtil.wrap_text_with_delimiter( + "'DATE' and 'VALUE' has been generated.", + PromptUtil.DELIMITER_TEMPORAL, + ), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + + round1 = Round.create(user_query="hello", id="round-1") + round1.add_post(post1) + round1.add_post(post2) + + round2 = Round.create(user_query="hello again", id="round-2") + post3 = Post.create( + message="what is the data range", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: what is the data range", + scope="conversation", + scope_id=memory.conversation.id, + aggregation_keys=("id",), + by="Planner", + ), + ), + ], + ) + post4 = Post.create( + message="The data range for the 'VALUE' column is " + + PromptUtil.wrap_text_with_delimiter("0.94", PromptUtil.DELIMITER_TEMPORAL), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + + round2.add_post(post3) + round2.add_post(post4) + + round3 = Round.create(user_query="hello again", id="round-3") + post5 = Post.create( + message="what is the max value?", + send_from="Planner", + send_to="CodeInterpreter", + attachment_list=[ + Attachment.create( + type=AttachmentType.shared_memory_entry, + content="shared_memory_entry_1", + extra=SharedMemoryEntry.create( + type="plan", + content="This is my plan: what is the max value?", + scope="conversation", + scope_id=memory.conversation.id, + aggregation_keys=("id",), + by="Planner", + ), + ), + ], + ) + post6 = Post.create( + message="The max value is " + PromptUtil.wrap_text_with_delimiter("0.94", PromptUtil.DELIMITER_TEMPORAL), + send_from="CodeInterpreter", + send_to="Planner", + attachment_list=[], + ) + round3.add_post(post5) + round3.add_post(post6) + + memory.conversation.add_round(round1) + memory.conversation.add_round(round2) + memory.conversation.add_round(round3) + + shared_plan = memory.get_shared_memory_entry( + entry_type="plan", + entry_scopes=["conversation"], + entry_scope_ids=[memory.conversation.id], + ) + + assert len(shared_plan) == 3 diff --git a/tests/unit_tests/test_planner.py b/tests/unit_tests/test_planner.py index 88cd5da9..2ec3657e 100644 --- a/tests/unit_tests/test_planner.py +++ b/tests/unit_tests/test_planner.py @@ -6,6 +6,7 @@ from taskweaver.code_interpreter.code_executor import CodeExecutor from taskweaver.config.config_mgt import AppConfigSource from taskweaver.logging import LoggingModule +from taskweaver.memory import SharedMemoryEntry from taskweaver.memory.attachment import AttachmentType from taskweaver.memory.plugin import PluginModule from taskweaver.module.event_emitter import SessionEventEmitter @@ -87,8 +88,18 @@ def test_compose_prompt(): send_to="CodeInterpreter", attachment_list=[ Attachment.create( - AttachmentType.board, - "1. load the data file\n2. count the rows of the loaded data \n", + AttachmentType.shared_memory_entry, + content="add shared memory entry", + extra=SharedMemoryEntry.create( + type="plan", + scope="round", + scope_id="round-1", + by="Planner", + content=( + "1. load the data file\n2. count the rows of the loaded data \n" + "3. report the result to the user " + ), + ), ), ], ) diff --git a/tests/unit_tests/test_role.py b/tests/unit_tests/test_role.py new file mode 100644 index 00000000..f02772e2 --- /dev/null +++ b/tests/unit_tests/test_role.py @@ -0,0 +1,73 @@ +import os + +import pytest +from injector import Injector + +from taskweaver.config.config_mgt import AppConfigSource +from taskweaver.logging import LoggingModule +from taskweaver.memory.experience import ExperienceGenerator +from taskweaver.memory.plugin import PluginModule +from taskweaver.role import Role + +IN_GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true" + + +@pytest.mark.skipif(IN_GITHUB_ACTIONS, reason="Test doesn't work in Github Actions.") +def test_role_load_experience(): + app_injector = Injector( + [PluginModule, LoggingModule], + ) + app_config = AppConfigSource( + config={ + "app_dir": os.path.dirname(os.path.abspath(__file__)), + "llm.api_key": "this_is_not_a_real_key", # pragma: allowlist secret + "role.use_experience": True, + "role.experience_dir": os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "data/experience", + ), + }, + ) + app_injector.binder.bind(AppConfigSource, to=app_config) + + role = app_injector.create_object(Role, {"role_entry": None}) + + role.experience_generator = app_injector.create_object(ExperienceGenerator) + + role.load_experience("test") + assert len(role.experience_generator.experience_list) == 1 + + +@pytest.mark.skipif(IN_GITHUB_ACTIONS, reason="Test doesn't work in Github Actions.") +def test_role_load_experience_sub_path(): + app_injector = Injector( + [PluginModule, LoggingModule], + ) + app_config = AppConfigSource( + config={ + "app_dir": os.path.dirname(os.path.abspath(__file__)), + "llm.api_key": "this_is_not_a_real_key", # pragma: allowlist secret + "role.use_experience": True, + "role.experience_dir": os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "data/experience", + ), + "role.dynamic_experience_sub_path": True, + }, + ) + app_injector.binder.bind(AppConfigSource, to=app_config) + + role = app_injector.create_object(Role, {"role_entry": None}) + + role.experience_generator = app_injector.create_object(ExperienceGenerator) + + role.load_experience("test") + assert len(role.experience_generator.experience_list) == 0 + + role.load_experience("test", "sub_path") + assert len(role.experience_generator.experience_list) == 1 + + try: + role.load_experience("test") + except AssertionError as e: + assert str(e) == "sub_path is empty when dynamic_experience_sub_path is True" diff --git a/website/blog/evaluation.md b/website/blog/evaluation.md index 7e92cbb0..98eb1b50 100644 --- a/website/blog/evaluation.md +++ b/website/blog/evaluation.md @@ -13,6 +13,8 @@ For example, if the answer is a date or a number, the evaluation method may not Moreover, the evaluation method should be able to act more like a human, who can understand the context and the meaning of the output. For example, when different agents are asked to perform the same task, they may behave differently, but still produce correct outputs. + + The below example illustrates this point: ``` diff --git a/website/blog/experience.md b/website/blog/experience.md index b1c1d33c..7c51360d 100644 --- a/website/blog/experience.md +++ b/website/blog/experience.md @@ -4,6 +4,8 @@ We have introduced the motivation of the `experience` module in [Experience](/do and how to create a handcrafted experience in [Handcrafted Experience](/docs/customization/experience/handcrafted_experience). In this blog post, we discuss more advanced topics about the experience module on experience selection. + + ## Static experience selection Every role in TaskWeaver can configure its own experience directory, which can be configured @@ -31,6 +33,8 @@ to enable the experience selection for the `Planner` role. } ``` + + ## Dynamic experience selection In some cases, you may want to select the experience dynamically based on the input task. diff --git a/website/blog/role.md b/website/blog/role.md index 9f98c290..dd1de91c 100644 --- a/website/blog/role.md +++ b/website/blog/role.md @@ -101,34 +101,6 @@ In other words, they talk to each other by sending messages in natural language. What if a role needs to send some data to another role? If this is the case, we would recommend to implement a new plugin instead of a new role. Otherwise, you may need to store the data in an external storage like a database and let the other role to access it. -There is a challenge in implementing multiple roles that is missing information. -Consider the case in our previous example where the agent is asked to read a manual and follow the instructions to process the data. -When the Planner obtains the instructions from a role called `manual_reader`, it needs to pass the instructions to the CodeInterpreter role to execute the instructions. -Sometimes, the Planner may miss critical information that is needed by the CodeInterpreter role. -Even though we can emphasize the importance of the Planner to pass all the necessary information to the roles in the prompt, -it is still possible that the Planner misses some information. - -To address this challenge, we introduce the concept of `board` in TaskWeaver. -The `board` is a shared memory space that can be accessed by all roles, which is associated with the current [Round](/docs/concepts/round). -The `board` is a dictionary-like object that can store any information that is needed by the roles. -Each role can decide to write or read any information from the `board`. - -```python - def write_board(self, role_alias: str, bulletin: str) -> None: - """Add a bulletin to the round.""" - self.board[role_alias] = bulletin - -def read_board(self, role_alias: Optional[str] = None) -> Union[Dict[str, str], str]: - """Read the bulletin of the round.""" - if role_alias is None: - return self.board - return self.board.get(role_alias, None) -``` - -One concrete example of using the `board` is to pass the user's request to the CodeInterpreter role. -When the Planner receives the user's request, it can write the request and its step-wise plan to the `board`. -The CodeInterpreter role can then read the request and the plan from the `board` to execute the plan. - In summary, the concept of roles in TaskWeaver is to provide a way to extend the agent's capability by implementing new roles. This is especially useful when the task is not naturally represented in code snippets such as acquire text information from a knowledge base or the internet. Implementing a new role is straightforward by inheriting the `Role` class and implementing the `reply` method. diff --git a/website/docs/concepts/attachment.md b/website/docs/concepts/attachment.md index 78f56e0d..2e4e4297 100644 --- a/website/docs/concepts/attachment.md +++ b/website/docs/concepts/attachment.md @@ -21,8 +21,6 @@ class Attachment: `AttachmentType` is an Enum class that contains the types of the attachment, which can be "thought", "code", "markdown", or "execution_result". -Among the types, "board" is used to store the information in the board of the round. -When the type is set to "board", the `content` will be updated to the key of the board. `content` is the content of the response element, which can be the code snippet, the markdown text, or the execution result. diff --git a/website/docs/concepts/round.md b/website/docs/concepts/round.md index 8d29b519..063e998d 100644 --- a/website/docs/concepts/round.md +++ b/website/docs/concepts/round.md @@ -12,30 +12,14 @@ class Round: post_list: a list of posts in the round. user_query: the query of the user. state: the state of the round. - board: a dict to store the bulletin of the round. """ id: str user_query: str state: RoundState post_list: List[Post] - board: Dict[str, str] = field(default_factory=dict) ``` `user_query` is the query of the user, and `post_list` is a list of [posts](post.md) in the round. The `state` is among "finished", "failed", "created". When the round is created, the state is "created". When the round is finished successfully, the state is "finished". When the round is failed, the state is "failed". - -The `board` is a dictionary to store the bulletin of the round, which can be used to store the information of the round. -This may sound confusing, given that different roles already have their messages in the posts. -However, the board is used to store critical information that must be aware of in the round context. -A very simple example would be the original user query. -When the user issues a request to the Planner, the Planner will decompose the task and send a subtask to the CodeInterpreter. -However, the CodeInterpreter needs to know the original user query and the full plan of the Planner to provide a more accurate response. -In this case, the Planner can store the original user query in the board, and the CodeInterpreter can access it when needed. -We provide two methods to access the board: `write_board` and `read_board`. - -:::tip -The `board` is a dictionary, and you can store any information you want in the board for the current round. -This is useful to eliminate the issue of information loss between different roles. -::: From eb7c6a0104fac29f27380712fbc7f6110bd831a0 Mon Sep 17 00:00:00 2001 From: liqun Date: Thu, 12 Sep 2024 17:17:26 +0800 Subject: [PATCH 06/12] fix issues --- taskweaver/memory/__init__.py | 5 +++-- taskweaver/memory/attachment.py | 6 +++--- taskweaver/memory/experience.py | 13 +++---------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/taskweaver/memory/__init__.py b/taskweaver/memory/__init__.py index 6cd182a8..369ddbb2 100644 --- a/taskweaver/memory/__init__.py +++ b/taskweaver/memory/__init__.py @@ -1,9 +1,10 @@ from __future__ import annotations +from .shared_memory_entry import SharedMemoryEntry from .attachment import Attachment -from .compression import RoundCompressor from .conversation import Conversation from .memory import Memory from .post import Post from .round import Round -from .shared_memory_entry import SharedMemoryEntry +from .compression import RoundCompressor + diff --git a/taskweaver/memory/attachment.py b/taskweaver/memory/attachment.py index 10e9882a..c7b5bfd6 100644 --- a/taskweaver/memory/attachment.py +++ b/taskweaver/memory/attachment.py @@ -96,14 +96,14 @@ def __str__(self) -> str: def to_dict(self) -> AttachmentDict: if self.extra is not None and hasattr(self.extra, "to_dict"): - extra_dict = self.extra.to_dict() + extra_content = self.extra.to_dict() else: - extra_dict = self.extra + extra_content = self.extra return { "id": self.id, "type": self.type.value, "content": self.content, - "extra": extra_dict, + "extra": extra_content, } @staticmethod diff --git a/taskweaver/memory/experience.py b/taskweaver/memory/experience.py index d0fcb356..0940362f 100644 --- a/taskweaver/memory/experience.py +++ b/taskweaver/memory/experience.py @@ -74,11 +74,6 @@ def __init__( self.experience_list: List[Experience] = [] - self.exception_message_for_refresh = ( - "Please cd to the `script` directory and " - "run `python -m experience_mgt --refresh` to refresh the experience." - ) - self.experience_dir = None self.sub_path = None @@ -248,8 +243,6 @@ def load_experience(self): if len(exp_ids) == 0: self.logger.warning( "No experience found." - "Please type /save in the chat window to save raw experience or write handcrafted experience." - + self.exception_message_for_refresh, ) return @@ -261,16 +254,16 @@ def load_experience(self): exp_file = f"exp_{exp_id}.yaml" exp_file_path = os.path.join(exp_dir, exp_file) assert os.path.exists(exp_file_path), ( - f"Experience {exp_file} not found. " + self.exception_message_for_refresh + f"Experience {exp_file} not found. " ) experience = read_yaml(exp_file_path) assert len(experience["embedding"]) > 0, ( - f"Experience {exp_file} has no embedding." + self.exception_message_for_refresh + f"Experience {exp_file} has no embedding." ) assert experience["embedding_model"] == self.llm_api.embedding_service.config.embedding_model, ( - f"Experience {exp_file} has different embedding model. " + self.exception_message_for_refresh + f"Experience {exp_file} has different embedding model." ) self.experience_list.append(Experience(**experience)) From 25a9c22f0f36c35260f5ff2f3bbe65710c378814 Mon Sep 17 00:00:00 2001 From: liqun Date: Fri, 13 Sep 2024 15:15:23 +0800 Subject: [PATCH 07/12] update doc --- website/blog/experience.md | 60 +++++++++-------- website/docs/code_execution.md | 4 ++ website/docs/memory.md | 114 +++++++++++++++++++++++++++++++++ website/docs/usage/docker.md | 7 +- website/docs/usage/webui.md | 7 +- website/sidebars.js | 1 + 6 files changed, 160 insertions(+), 33 deletions(-) create mode 100644 website/docs/memory.md diff --git a/website/blog/experience.md b/website/blog/experience.md index 7c51360d..9b42695c 100644 --- a/website/blog/experience.md +++ b/website/blog/experience.md @@ -4,8 +4,6 @@ We have introduced the motivation of the `experience` module in [Experience](/do and how to create a handcrafted experience in [Handcrafted Experience](/docs/customization/experience/handcrafted_experience). In this blog post, we discuss more advanced topics about the experience module on experience selection. - - ## Static experience selection Every role in TaskWeaver can configure its own experience directory, which can be configured @@ -17,7 +15,7 @@ The default experience directory is `experience` in the project directory. :::info -The role name is by default the name of the implementation file of the role unless +The role name is by default the name of the implementation file (without the extension) of the role unless you have specified the role name by calling `_set_name` in the implementation file. ::: @@ -71,6 +69,10 @@ planner_experience When we can identify the task type based on the task ID, we can set the experience subdirectory. This looks straightforward, but how can we set the experience subdirectory in TaskWeaver? As we need to do this in a dynamic way, the only way is to set the experience subdirectory in a [role](/docs/concepts/role). + +TaskWeaver recently introduced the concept of shared memory as discussed in [Shared Memory](/docs/memory). +Shared memory allows a role to share information with other roles, and in this case, we can use shared memory to set the experience subdirectory. + We can add a new role called `TaskTypeIdentifier` to identify the task type based on the task ID. The key part of the `reply` function in `TaskTypeIdentifier` is shown below: @@ -79,49 +81,45 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: # ... # get the task type from the last post message task_type = get_task_type(last_post.message) - # issue a signal to set the experience subdirectory + # create an attachment post_proxy.update_attachment( - type=AttachmentType.signal, - message=f"_signal_exp_sub_path:{task_type}", + type=AttachmentType.shared_memory_entry, + message="Add experience sub path", + extra=SharedMemoryEntry.create( + type="experience_sub_path", + by=self.alias, + scope="conversation", + scope_id=memory.conversation.id, + content="task_type_1", + aggregation_keys=("type", ), + ), ) return post_proxy.end() ``` -In the `reply` method, we first obtain the query from the last round. -Then we identify the task type based on the query content. -The interesting part is that we set the experience subdirectory in the attachment of the response. -We set the attachment type to `signal` and the message to `_signal_exp_sub_path:{task_type}`. - -The `signal` attachment type is a special type in TaskWeaver, which is used to send signals to other roles. -Its content is a string with format `key:value`, where `key` is an attachment type and `value` is the content of the attachment. -In this case, we send a signal to all roles to set the experience subdirectory to the value of `task_type`. -This is done by broadcasting an attachment with type `_signal_exp_sub_path` and its value, which is the task type, -to all the roles in TaskWeaver. Every role can decide whether to use the signal or not. - -A role responds to the signal by setting the experience subdirectory to the value in the signal. -The key part of the `Planner` role implementation is shown below: +In a role that needs to set the experience subdirectory, we can get the experience subdirectory from the shared memory. ```python -# obtain the experience subdirectory from the attachment of the last post -exp_sub_path = last_post.get_attachment(AttachmentType._signal_exp_sub_path) -if exp_sub_path: - self.tracing.set_span_attribute("exp_sub_path", exp_sub_path[0]) - exp_sub_path = exp_sub_path[0] +exp_sub_paths = memory.get_shared_memory_entry( + entry_type="experience_sub_path", + entry_scopes=["conversation"], + entry_scope_ids=[memory.conversation.id], +) + +if exp_sub_paths: + exp_sub_path = exp_sub_paths[0].content else: exp_sub_path = "" selected_experiences = self.load_experience(query=query, sub_path=exp_sub_path) ``` -Other roles that are not responsible for setting the experience subdirectory can ignore the attachment. -In this way, we can set the experience subdirectory dynamically based on the task type. -The signal is maintained at the session level, which means that the signal is valid for the current session. -The value of the signal can be changed by sending another signal with the same attachment type. -Note that after the signal is set, all roles will keep receiving the signal until the session ends. -So, it is each role's responsibility to implement the logic to handle duplicate signals. +:::tip +This is the current experimental feature in TaskWeaver which is subject to change. +::: ## Conclusion In this blog post, we have discussed how to select experiences in TaskWeaver. We have static experience selection by configuring the experience directory for each role. -To enable dynamic experience selection, we have introduced the concept of experience subdirectory and signal attachment. +To enable dynamic experience selection, we have introduced the concept of shared memory to set the experience subdirectory. diff --git a/website/docs/code_execution.md b/website/docs/code_execution.md index e572bd82..d19d8c9a 100644 --- a/website/docs/code_execution.md +++ b/website/docs/code_execution.md @@ -20,6 +20,10 @@ As a result, in the `local` mode, if the user has malicious intent, the user cou instruct TaskWeaver to execute harmful code on the host machine. In addition, the LLM could also generate harmful code, leading to potential security risks. +:::danger +Please be cautious when using the `local` mode, especially when the usage of the agent is open to untrusted users. +::: + ## How to Configure the Code Execution Mode diff --git a/website/docs/memory.md b/website/docs/memory.md new file mode 100644 index 00000000..e9abfa62 --- /dev/null +++ b/website/docs/memory.md @@ -0,0 +1,114 @@ +# Memory + +The primary purpose of the `memory` module is to store the information that is required to maintain the context of the conversation. +You can find the implementation code in `taskweaver/memory/memory.py`. +We have introduced various concepts such as `Round` and `Post` in the [concepts](concepts/) section, +which are the building blocks of the Memory module. + +There are two kinds of information that are stored in the memory: + +1. **Conversation History**: This includes the conversation that has happened so far between the user and various roles in TaskWeaver. +2. **Shared Memory**: This includes the information that is purposefully shared between the roles in TaskWeaver. + +Let's briefly discuss the two types of information. + +## Role-wise Conversation History + +A TaskWeaver agent is composed of one or more roles. Each [role](concepts/role.md) have its own conversation history. +In TaskWeaver, we orchestrate the roles in a star topology, where the Planner is at the center and the roles are at the periphery. +The User only interacts with the Planner, and the Planner interacts with the roles, making planning and instructing other roles to carry out the tasks, +as shown in the figure below. + +```mermaid +graph TD + User --> Planner + Planner --> Role1 + Role1 --> Planner + Planner --> Role2 + Role2 --> Planner + Planner --> Role3 + Role3 --> Planner + Planner --> User +``` + +Though this fixed orchestration is a limitation, it reserves the independence of the roles. Each role does not need to know about the other roles, even their existence. For any peripheral role, the Planner is the only point of contact, i.e., its real "User", +and it only focuses on its own expertise. It is the Planner's responsibility to leverage multiple roles +for complex tasks and orchestrate them to achieve the goal. + +The conversation history of each role is stored in the memory. When a role needs to prepare a response, it can refer to the conversation history +to understand the context of the conversation. Specifically, this typically is the process of preparing a prompt for the LLM, containing all +the previous chat rounds and the current request. A role only cares about the Posts sent or received by itself. + +## Shared Memory + +While we want to maintain the independence of the roles, there are cases where the roles need to share information. +One common case is about information sharing between two peripheral roles. For example, the Planner may ask the Code Interpreter to generate code +based on the guide provided by a Data Scientist role. In this case, the Planner needs to share the guide with the Code Interpreter. +In theory, this can be done by the Planner repeating the guide to the Code Interpreter, shown in the figure below. + +```mermaid +graph TD + User --1--> Planner + Planner --2--> DataScientist + DataScientist --3--> Planner + Planner --4--> CodeInterpreter + CodeInterpreter --5--> Planner + Planner --6--> User +``` +However, we found that the Planner can fail to repeat the guide accurately, leading to miscommunication. + +Another use case is a role needing to store some control state that is shared among all roles. For example, the agent needs to handle multiple types +of tasks. The "type" of the current user request is only determined by one role (e.g., namely `TypeDeterminer`), but all other roles need to know the type to prepare the response. +In this case, the role that determines the type can store the type in the shared memory, and other roles can refer to the shared memory to get the type. + +```mermaid +graph TD + User --1--> Planner + Planner --2--> TypeDeterminer + TypeDeterminer --3--> Planner + TypeDeterminer --3--> SharedMemory + SharedMemory --4--> Worker1 + SharedMemory --6--> Worker2 + Planner --4--> Worker1 + Worker1 --5--> Planner + Planner --6--> Worker2 + Worker2 --7--> Planner + Planner --8--> User +``` + +:::tip +The number in the arrows indicates the order of the information flow. +::: + +For the aforementioned reasons, we introduced the concept of Shared Memory. The Shared Memory is a special [Attachment](concepts/attachment.md) that is appended to the +post of the role who wants to share information. +The attachment has a instance of SharedMemoryEntry in the `extra` field. The SharedMemoryEntry has the following fields: + +```python +class SharedMemoryEntry: + type: Literal[...] # The type of the shared memory entry + by: str # The role that shared the information + content: str # The content of the shared information + scope: Literal["round", "conversation"] # The scope of the shared information + scope_id: str # The id of the scope, such as round_id or conversation_id + aggregation_keys: Tuple[Literal["by", "type", "scope", "scope_id", "id"], ...] # The keys to aggregate the shared memory entries + id: str # The id of the shared memory entry +``` + +One question may be why we do not store the shared information in a separate data structure, instead of the Attachment in Posts. +The reason is that, if a Round fails, we may need to remove the shared information within that Round as well. By storing the shared information in the Attachment, +as a part of the Post, we can easily filter out the shared information based on the Round status. +This is similar with designing the logging system of database operations in a transaction. + +The consumer of the shared information can use `type`, `scope`, and `scope_id` to filter out the shared information that is relevant to it. +The `by` field is not suggested to be used for filtering, as it requires the consumer to know the role that shared the information. +The two fields `scope` and `scope_id` are used to determine the scope of the shared information. The `scope` can be either `round` or `conversation`. +For example, if one piece of information is only effective for the current round, the `scope` is `round` and the `scope_id` is the current `round_id`. +Similarly, if one piece of information is effective for the whole conversation, the `scope` is `conversation` and the `scope_id` is the `conversation_id`. + +The `aggregation_keys` field is used to aggregate the shared information when there are multiple shared information entries with the same `type`, `scope`, and `scope_id`. +If more than one shared information entries have the same aggregation key, only the latest one along the conversation history is kept. +We allow the generator role to define the aggregation keys. We include a unique `id` field in the SharedMemoryEntry to distinguish the shared information entries. +So, if the `aggregation_keys = ("id",)`, the shared information entries are not aggregated. + +A reference implementation of the Shared Memory is provided in the `taskweaver/planner/planner.py`, where the Planner role shares the details of the plan with other roles. diff --git a/website/docs/usage/docker.md b/website/docs/usage/docker.md index 8841a1dc..3252da25 100644 --- a/website/docs/usage/docker.md +++ b/website/docs/usage/docker.md @@ -1,7 +1,12 @@ # All-in-One Docker Image In this document, we will show you how to run TaskWeaver using the All-in-One Docker Image. -Please note that the All-in-One Docker Image is for development and testing purposes only. + +:::danger +Please note that the All-in-One Docker Image is for development and testing purposes only. It is running in +the [local](../code_execution.md) mode, which means that the execution of the code snippets is done in the same container. +Malicious code can be executed in the container, so please be cautious when running the All-in-One Docker Image. +::: ## Prerequisites You need to have Docker installed on your machine. diff --git a/website/docs/usage/webui.md b/website/docs/usage/webui.md index 2839aada..d1c31daa 100644 --- a/website/docs/usage/webui.md +++ b/website/docs/usage/webui.md @@ -1,6 +1,11 @@ # Web UI -Please note that this Web UI is for development and testing purposes only. +:::warning +Please note that this Web UI is a playground for development and testing purposes only. +Be cautious when running the Web UI, as anyone can access it if the port is open to the public. +If you want to deploy a Web UI for production, you need to address security concerns, such as authentication and authorization, +making sure the server is secure. +::: Follow the instruction in [Quick Start](../quickstart.md) to clone the repository and fill in the necessary configurations. diff --git a/website/sidebars.js b/website/sidebars.js index 75d6c830..fe0b5419 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -22,6 +22,7 @@ const sidebars = { 'overview', 'quickstart', 'code_execution', + 'memory', 'FAQ', { type: 'category', From 781366c915f889a51dd1e69c5e43160b1aa4f36d Mon Sep 17 00:00:00 2001 From: liqun Date: Fri, 13 Sep 2024 15:19:55 +0800 Subject: [PATCH 08/12] update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 566dc4f8..b7b8a1c3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Unlike many agent frameworks that only track the chat history with LLMs in text, ## 🆕 News +- 📅2024-09-13: We introduce the shared memory to store information that is shared between the roles in TaskWeaver. Please check the [memory](https://microsoft.github.io/TaskWeaver/docs/memory) for more details.🧠 +- 📅2024-09-13: We have enhanced the experience feature by allowing static and dynamic experience selection. Please check the [experience](https://microsoft.github.io/TaskWeaver/blog/experience) for more details.📚 - 📅2024-07-02: We have optimized TaskWeaver to support not-that-large language models served locally. Please check this [post](https://microsoft.github.io/TaskWeaver/blog/local_llm) for more details.🔗 - 📅2024-05-07: We have added two blog posts on [Evaluating a LLM agent](https://microsoft.github.io/TaskWeaver/blog/evaluation) and [Adding new roles to TaskWeaver](https://microsoft.github.io/TaskWeaver/blog/role) in the documentation.📝 - 📅2024-03-28: TaskWeaver now offers all-in-one Docker image, providing a convenient one-stop experience for users. Please check the [docker](https://microsoft.github.io/TaskWeaver/docs/usage/docker) for more details.🐳 @@ -30,7 +32,7 @@ Unlike many agent frameworks that only track the chat history with LLMs in text, - 📅2024-03-07: TaskWeaver now supports configuration of different LLMs for various components, such as the Planner and CodeInterpreter. Please check the [multi-llm](https://microsoft.github.io/TaskWeaver/docs/llms/multi-llm) for more details.🔗 - 📅2024-03-04: TaskWeaver now supports a [container](https://microsoft.github.io/TaskWeaver/docs/code_execution) mode, which provides a more secure environment for code execution.🐳 - 📅2024-02-28: TaskWeaver now offers a [CLI-only](https://microsoft.github.io/TaskWeaver/docs/advanced/cli_only) mode, enabling users to interact seamlessly with the Command Line Interface (CLI) using natural language.📟 -- 📅2024-02-01: TaskWeaver now has a plugin [document_retriever](https://github.com/microsoft/TaskWeaver/blob/main/project/plugins/README.md#document_retriever) for RAG based on a knowledge base.📚 + From 84533b785800f8fe06c1ef9c22a4db972e95cbbe Mon Sep 17 00:00:00 2001 From: liqun Date: Fri, 13 Sep 2024 15:29:06 +0800 Subject: [PATCH 09/12] update faq --- website/docs/FAQ.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/website/docs/FAQ.md b/website/docs/FAQ.md index 6d24a23f..8ca3a5a1 100644 --- a/website/docs/FAQ.md +++ b/website/docs/FAQ.md @@ -129,4 +129,10 @@ Then, pass the `config` to the plugin constructor. As yaml is type sensitive, yo A: We use a Jupyter Kernel to execute the code in TaskWeaver. The Jupyter Kernel uses an event loop to manage the execution of the code. If you see the error message "RuntimeError: This event loop is already running.", it typically means that the event loop is already running. -This is typically caused by the enviroment where TaskWeaver is running. For example, if you are running TaskWeaver in a Jupyter Notebook. \ No newline at end of file +This is typically caused by the environment where TaskWeaver is running. For example, if you are running TaskWeaver in a Jupyter Notebook. + +### Q: Why I see the error message "Permissions assignment failed for secure file: Got '0o677' instead of '0o0600'." when running TaskWeaver? + +A: This error message typically happens when TaskWeaver is running in the container mode on a Windows machine with WSL. +One can refer to this [issue](https://github.com/jupyter/notebook/issues/5428) for more details. +The fix is to set `JUPYTER_ALLOW_INSECURE_WRITES=true` for the container. \ No newline at end of file From 076c2fe94a3b5ae3798388501125687df2233626 Mon Sep 17 00:00:00 2001 From: liqun Date: Sat, 14 Sep 2024 13:26:21 +0800 Subject: [PATCH 10/12] update shared memory set/retrieve logic --- .../code_interpreter/code_generator.py | 12 +---- taskweaver/memory/memory.py | 30 ++++++------ taskweaver/memory/shared_memory_entry.py | 28 +---------- taskweaver/planner/planner.py | 9 +--- tests/unit_tests/test_memory.py | 47 +++---------------- tests/unit_tests/test_planner.py | 2 - website/blog/experience.md | 9 +--- website/docs/memory.md | 27 +++++------ 8 files changed, 41 insertions(+), 123 deletions(-) diff --git a/taskweaver/code_interpreter/code_interpreter/code_generator.py b/taskweaver/code_interpreter/code_interpreter/code_generator.py index 0917206d..b456b589 100644 --- a/taskweaver/code_interpreter/code_interpreter/code_generator.py +++ b/taskweaver/code_interpreter/code_interpreter/code_generator.py @@ -358,11 +358,7 @@ def reply( if self.config.enable_auto_plugin_selection: self.plugin_pool = self.select_plugins_for_prompt(query) - exp_sub_paths = memory.get_shared_memory_entry( - entry_type="experience_sub_path", - entry_scopes=["conversation"], - entry_scope_ids=[memory.conversation.id], - ) + exp_sub_paths = memory.get_shared_memory_entries(entry_type="experience_sub_path") if exp_sub_paths: self.tracing.set_span_attribute("experience_sub_path", str(exp_sub_paths)) @@ -371,11 +367,7 @@ def reply( exp_sub_path = "" selected_experiences = self.load_experience(query=query, sub_path=exp_sub_path) - planning_enrichments = memory.get_shared_memory_entry( - entry_type="plan", - entry_scopes=["conversation", "round"], - entry_scope_ids=[memory.conversation.id, rounds[-1].id], - ) + planning_enrichments = memory.get_shared_memory_entries(entry_type="plan") prompt = self.compose_prompt( rounds, diff --git a/taskweaver/memory/memory.py b/taskweaver/memory/memory.py index 3a26a38a..305cc401 100644 --- a/taskweaver/memory/memory.py +++ b/taskweaver/memory/memory.py @@ -76,31 +76,33 @@ def save_experience(self, exp_dir: str, thin_mode: bool = True) -> None: else: write_yaml(raw_exp_path, self.conversation.to_dict()) - def get_shared_memory_entry( + def get_shared_memory_entries( self, entry_type: str, - entry_scopes: List[str], - entry_scope_ids: List[str], ) -> List[SharedMemoryEntry]: + """Get the shared memory entries of the given type and scope. + entry_scope: "round" or "conversation" + """ entry_dict = {} order_at = 0 + for round in self.conversation.rounds: + # Check if the round is the last round + is_last_round = round.id == self.conversation.rounds[-1].id for post in round.post_list: for attachment in post.attachment_list: if attachment.type == AttachmentType.shared_memory_entry: - entry = attachment.extra - if ( - entry.type == entry_type - and entry.scope in entry_scopes - and entry.scope_id in entry_scope_ids - ): - entry_dict[entry.get_aggregation_key()] = (entry, order_at) - order_at += 1 + entry: SharedMemoryEntry = attachment.extra + if entry.type == entry_type: + if entry.scope == "conversation" or is_last_round: + # if multiple entries with the same role, only keep the last one + entry_dict[post.send_from] = (entry, order_at) + order_at += 1 # Sort the entries by the order_at - entries = list(entry_dict.values()) - entries.sort(key=lambda x: x[1]) - return [entry[0] for entry in entries] + entries_with_order = list(entry_dict.values()) + entries_with_order.sort(key=lambda x: x[1]) + return [e[0] for e in entries_with_order] def from_yaml(self, session_id: str, path: str) -> Memory: """Load the memory from a yaml file.""" diff --git a/taskweaver/memory/shared_memory_entry.py b/taskweaver/memory/shared_memory_entry.py index b86d42c8..e166f069 100644 --- a/taskweaver/memory/shared_memory_entry.py +++ b/taskweaver/memory/shared_memory_entry.py @@ -1,57 +1,36 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Literal, Optional, Tuple +from typing import Literal -from taskweaver.memory.type_vars import RoleName from taskweaver.utils import create_id @dataclass class SharedMemoryEntry: type: Literal["plan", "experience_sub_path"] - by: str content: str scope: Literal["round", "conversation"] - # The id of the round or conversation - scope_id: str - aggregation_keys: Tuple[Literal["by", "type", "scope", "scope_id", "id"], ...] id: str @staticmethod def create( type: Literal["plan", "experience_sub_path"], - by: RoleName, content: str, scope: Literal["round", "conversation"], - scope_id: str, - aggregation_keys: Optional[Tuple[Literal["by", "type", "scope", "scope_id", "id"], ...]] = None, id: str = None, ) -> SharedMemoryEntry: - if aggregation_keys is None: - aggregation_keys = ("by", "type", "scope", "scope_id") if id is None: id = "sme-" + create_id() return SharedMemoryEntry( type=type, - by=by, content=content, scope=scope, - scope_id=scope_id, - aggregation_keys=aggregation_keys, id=id, ) - def get_aggregation_key(self) -> str: - key = "" - for _field in self.aggregation_keys: - if not hasattr(self, _field): - raise ValueError(f"SharedMemoryEntry does not have the field {_field}") - key += f"{getattr(self, _field)}_" - return key.strip("_") - def __repr__(self): - return f"SharedMemoryEntry: {self.type} by {self.by} in {self.scope} {self.scope_id}\n{self.content}" + return f"SharedMemoryEntry: {self.type} effective in {self.scope}\n{self.content}" def __str__(self): return self.__repr__() @@ -59,10 +38,7 @@ def __str__(self): def to_dict(self) -> dict: return { "type": self.type, - "by": self.by, "content": self.content, "scope": self.scope, - "scope_id": self.scope_id, - "unique_key_fields": self.aggregation_keys, "id": self.id, } diff --git a/taskweaver/planner/planner.py b/taskweaver/planner/planner.py index 7fb305ec..7823393f 100644 --- a/taskweaver/planner/planner.py +++ b/taskweaver/planner/planner.py @@ -266,11 +266,7 @@ def reply( self.tracing.set_span_attribute("user_query", user_query) self.tracing.set_span_attribute("use_experience", self.config.use_experience) - exp_sub_paths = memory.get_shared_memory_entry( - entry_type="experience_sub_path", - entry_scopes=["conversation"], - entry_scope_ids=[memory.conversation.id], - ) + exp_sub_paths = memory.get_shared_memory_entries(entry_type="experience_sub_path") if exp_sub_paths: self.tracing.set_span_attribute("experience_sub_path", str(exp_sub_paths)) @@ -358,11 +354,8 @@ def stream_filter(s: Iterable[ChatMessageType]): message="Add the plan to the shared memory", extra=SharedMemoryEntry.create( type="plan", - by=self.alias, scope="round", - scope_id=rounds[-1].id, content=bulletin_message, - aggregation_keys=("by", "type", "scope_id"), ), ) diff --git a/tests/unit_tests/test_memory.py b/tests/unit_tests/test_memory.py index d0e0e3c6..47caa88b 100644 --- a/tests/unit_tests/test_memory.py +++ b/tests/unit_tests/test_memory.py @@ -99,9 +99,6 @@ def test_memory_get_shared1(): type="plan", content="This is my plan: create a dataframe", scope="conversation", - scope_id=memory.conversation.id, - aggregation_keys=("type",), - by="Planner", ), ), ], @@ -134,9 +131,6 @@ def test_memory_get_shared1(): type="plan", content="This is my plan: what is the data range", scope="conversation", - scope_id=memory.conversation.id, - aggregation_keys=("type",), - by="Planner", ), ), ], @@ -165,9 +159,6 @@ def test_memory_get_shared1(): type="plan", content="This is my plan: what is the max value?", scope="conversation", - scope_id=memory.conversation.id, - aggregation_keys=("type",), - by="Planner", ), ), ], @@ -185,10 +176,8 @@ def test_memory_get_shared1(): memory.conversation.add_round(round2) memory.conversation.add_round(round3) - shared_plan = memory.get_shared_memory_entry( + shared_plan = memory.get_shared_memory_entries( entry_type="plan", - entry_scopes=["conversation"], - entry_scope_ids=[memory.conversation.id], ) assert len(shared_plan) == 1 @@ -211,9 +200,6 @@ def test_memory_get_shared2(): type="plan", content="This is my plan: create a dataframe", scope="round", - scope_id="round-1", - aggregation_keys=("by", "type", "scope_id"), - by="Planner", ), ), ], @@ -246,9 +232,6 @@ def test_memory_get_shared2(): type="plan", content="This is my plan: what is the data range", scope="round", - scope_id="round-2", - aggregation_keys=("by", "type", "scope_id"), - by="Planner", ), ), ], @@ -277,9 +260,6 @@ def test_memory_get_shared2(): type="plan", content="This is my plan: what is the max value?", scope="round", - scope_id="round-3", - aggregation_keys=("by", "type", "scope_id"), - by="Planner", ), ), ], @@ -298,10 +278,8 @@ def test_memory_get_shared2(): memory.conversation.add_round(round2) memory.conversation.add_round(round3) - shared_plan = memory.get_shared_memory_entry( + shared_plan = memory.get_shared_memory_entries( entry_type="plan", - entry_scopes=["round"], - entry_scope_ids=["round-3"], ) assert len(shared_plan) == 1 @@ -324,9 +302,6 @@ def test_memory_get_shared3(): type="plan", content="This is my plan: create a dataframe", scope="conversation", - scope_id=memory.conversation.id, - aggregation_keys=("id",), - by="Planner", ), ), ], @@ -358,10 +333,7 @@ def test_memory_get_shared3(): extra=SharedMemoryEntry.create( type="plan", content="This is my plan: what is the data range", - scope="conversation", - scope_id=memory.conversation.id, - aggregation_keys=("id",), - by="Planner", + scope="round", ), ), ], @@ -380,7 +352,7 @@ def test_memory_get_shared3(): round3 = Round.create(user_query="hello again", id="round-3") post5 = Post.create( message="what is the max value?", - send_from="Planner", + send_from="Dummy", send_to="CodeInterpreter", attachment_list=[ Attachment.create( @@ -389,10 +361,7 @@ def test_memory_get_shared3(): extra=SharedMemoryEntry.create( type="plan", content="This is my plan: what is the max value?", - scope="conversation", - scope_id=memory.conversation.id, - aggregation_keys=("id",), - by="Planner", + scope="round", ), ), ], @@ -410,10 +379,8 @@ def test_memory_get_shared3(): memory.conversation.add_round(round2) memory.conversation.add_round(round3) - shared_plan = memory.get_shared_memory_entry( + shared_plan = memory.get_shared_memory_entries( entry_type="plan", - entry_scopes=["conversation"], - entry_scope_ids=[memory.conversation.id], ) - assert len(shared_plan) == 3 + assert len(shared_plan) == 2 diff --git a/tests/unit_tests/test_planner.py b/tests/unit_tests/test_planner.py index 2ec3657e..447feca0 100644 --- a/tests/unit_tests/test_planner.py +++ b/tests/unit_tests/test_planner.py @@ -93,8 +93,6 @@ def test_compose_prompt(): extra=SharedMemoryEntry.create( type="plan", scope="round", - scope_id="round-1", - by="Planner", content=( "1. load the data file\n2. count the rows of the loaded data \n" "3. report the result to the user " diff --git a/website/blog/experience.md b/website/blog/experience.md index 9b42695c..299b2b81 100644 --- a/website/blog/experience.md +++ b/website/blog/experience.md @@ -87,11 +87,8 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: message="Add experience sub path", extra=SharedMemoryEntry.create( type="experience_sub_path", - by=self.alias, - scope="conversation", - scope_id=memory.conversation.id, + scope="conversation", # define the effective scope of the shared memory entry to be the whole conversation content="task_type_1", - aggregation_keys=("type", ), ), ) @@ -101,10 +98,8 @@ def reply(self, memory: Memory, **kwargs: ...) -> Post: In a role that needs to set the experience subdirectory, we can get the experience subdirectory from the shared memory. ```python -exp_sub_paths = memory.get_shared_memory_entry( +exp_sub_paths = memory.get_shared_memory_entries( entry_type="experience_sub_path", - entry_scopes=["conversation"], - entry_scope_ids=[memory.conversation.id], ) if exp_sub_paths: diff --git a/website/docs/memory.md b/website/docs/memory.md index e9abfa62..e46dc54a 100644 --- a/website/docs/memory.md +++ b/website/docs/memory.md @@ -87,28 +87,23 @@ The attachment has a instance of SharedMemoryEntry in the `extra` field. The Sha ```python class SharedMemoryEntry: type: Literal[...] # The type of the shared memory entry - by: str # The role that shared the information content: str # The content of the shared information scope: Literal["round", "conversation"] # The scope of the shared information - scope_id: str # The id of the scope, such as round_id or conversation_id - aggregation_keys: Tuple[Literal["by", "type", "scope", "scope_id", "id"], ...] # The keys to aggregate the shared memory entries id: str # The id of the shared memory entry ``` +Understanding the `scope` field is crucial to understand the Shared Memory. The `scope` field determines the scope of the shared information. +If the `scope` is `round`, the shared information is only effective for the current round. +Otherwise, if the `scope` is `conversation`, the shared information is effective for the whole conversation. + One question may be why we do not store the shared information in a separate data structure, instead of the Attachment in Posts. -The reason is that, if a Round fails, we may need to remove the shared information within that Round as well. By storing the shared information in the Attachment, -as a part of the Post, we can easily filter out the shared information based on the Round status. +The reason is that, if a Round fails, we need to remove the shared information within that Round as well. +By storing the shared information in the Attachment, as a part of the Post, we can easily filter out the shared information based on the Round status. This is similar with designing the logging system of database operations in a transaction. -The consumer of the shared information can use `type`, `scope`, and `scope_id` to filter out the shared information that is relevant to it. -The `by` field is not suggested to be used for filtering, as it requires the consumer to know the role that shared the information. -The two fields `scope` and `scope_id` are used to determine the scope of the shared information. The `scope` can be either `round` or `conversation`. -For example, if one piece of information is only effective for the current round, the `scope` is `round` and the `scope_id` is the current `round_id`. -Similarly, if one piece of information is effective for the whole conversation, the `scope` is `conversation` and the `scope_id` is the `conversation_id`. - -The `aggregation_keys` field is used to aggregate the shared information when there are multiple shared information entries with the same `type`, `scope`, and `scope_id`. -If more than one shared information entries have the same aggregation key, only the latest one along the conversation history is kept. -We allow the generator role to define the aggregation keys. We include a unique `id` field in the SharedMemoryEntry to distinguish the shared information entries. -So, if the `aggregation_keys = ("id",)`, the shared information entries are not aggregated. +The consumer of the shared information can use `type` to retrieve the shared memory entries that is effective for the current chat round, +including the conversational ones. However, if one role has multiple shared memory entries with the same `type`, +only the latest one is effective. In other words, later shared memory entries overwrite the previous ones with the same `type` from the same role. -A reference implementation of the Shared Memory is provided in the `taskweaver/planner/planner.py`, where the Planner role shares the details of the plan with other roles. +A reference implementation of the Shared Memory is provided in the `taskweaver/planner/planner.py`, +where the Planner role shares the details of the plan with other roles. From 2d4bf274b18e27e17784add38772987fb26e69a9 Mon Sep 17 00:00:00 2001 From: Jack-Q Date: Sat, 14 Sep 2024 14:47:48 +0800 Subject: [PATCH 11/12] add singlton attribute for config class --- taskweaver/config/module_config.py | 3 ++- taskweaver/session/session.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/taskweaver/config/module_config.py b/taskweaver/config/module_config.py index 70173206..dd713415 100644 --- a/taskweaver/config/module_config.py +++ b/taskweaver/config/module_config.py @@ -1,10 +1,11 @@ from typing import Any, List, Optional -from injector import inject +from injector import inject, singleton from taskweaver.config.config_mgt import AppConfigSource +@singleton class ModuleConfig(object): @inject def __init__(self, src: AppConfigSource) -> None: diff --git a/taskweaver/session/session.py b/taskweaver/session/session.py index bc56fd47..9bd00a57 100644 --- a/taskweaver/session/session.py +++ b/taskweaver/session/session.py @@ -105,6 +105,7 @@ def __init__( "role_entry": role_entry, }, ) + self.session_injector.binder.bind(role_entry.module, role_instance) self.worker_instances[role_instance.get_alias()] = role_instance if "planner" in self.config.roles: From 8b39a5f8b8ea7a29dbe2692406556bd41fcea07c Mon Sep 17 00:00:00 2001 From: Jack-Q Date: Sat, 14 Sep 2024 16:02:15 +0800 Subject: [PATCH 12/12] update typings --- taskweaver/memory/memory.py | 9 +++++---- taskweaver/memory/shared_memory_entry.py | 16 +++++++++------- taskweaver/memory/type_vars.py | 2 ++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/taskweaver/memory/memory.py b/taskweaver/memory/memory.py index 305cc401..5d216eed 100644 --- a/taskweaver/memory/memory.py +++ b/taskweaver/memory/memory.py @@ -2,13 +2,13 @@ import copy import os -from typing import List +from typing import Dict, List, Tuple from taskweaver.memory import SharedMemoryEntry from taskweaver.memory.attachment import AttachmentType from taskweaver.memory.conversation import Conversation from taskweaver.memory.round import Round -from taskweaver.memory.type_vars import RoleName +from taskweaver.memory.type_vars import RoleName, SharedMemoryEntryType from taskweaver.module.prompt_util import PromptUtil from taskweaver.utils import write_yaml @@ -78,12 +78,12 @@ def save_experience(self, exp_dir: str, thin_mode: bool = True) -> None: def get_shared_memory_entries( self, - entry_type: str, + entry_type: SharedMemoryEntryType, ) -> List[SharedMemoryEntry]: """Get the shared memory entries of the given type and scope. entry_scope: "round" or "conversation" """ - entry_dict = {} + entry_dict: Dict[str, Tuple[SharedMemoryEntry, int]] = {} order_at = 0 for round in self.conversation.rounds: @@ -92,6 +92,7 @@ def get_shared_memory_entries( for post in round.post_list: for attachment in post.attachment_list: if attachment.type == AttachmentType.shared_memory_entry: + assert attachment.extra is not None entry: SharedMemoryEntry = attachment.extra if entry.type == entry_type: if entry.scope == "conversation" or is_last_round: diff --git a/taskweaver/memory/shared_memory_entry.py b/taskweaver/memory/shared_memory_entry.py index e166f069..4373e70b 100644 --- a/taskweaver/memory/shared_memory_entry.py +++ b/taskweaver/memory/shared_memory_entry.py @@ -1,24 +1,26 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Literal +from typing import Dict, Optional from taskweaver.utils import create_id +from .type_vars import SharedMemoryEntryScope, SharedMemoryEntryType + @dataclass class SharedMemoryEntry: - type: Literal["plan", "experience_sub_path"] + type: SharedMemoryEntryType content: str - scope: Literal["round", "conversation"] + scope: SharedMemoryEntryScope id: str @staticmethod def create( - type: Literal["plan", "experience_sub_path"], + type: SharedMemoryEntryType, content: str, - scope: Literal["round", "conversation"], - id: str = None, + scope: SharedMemoryEntryScope, + id: Optional[str] = None, ) -> SharedMemoryEntry: if id is None: id = "sme-" + create_id() @@ -35,7 +37,7 @@ def __repr__(self): def __str__(self): return self.__repr__() - def to_dict(self) -> dict: + def to_dict(self) -> Dict[str, str]: return { "type": self.type, "content": self.content, diff --git a/taskweaver/memory/type_vars.py b/taskweaver/memory/type_vars.py index 4f67b7df..ffbf31bd 100644 --- a/taskweaver/memory/type_vars.py +++ b/taskweaver/memory/type_vars.py @@ -2,3 +2,5 @@ RoleName = str RoundState = Literal["finished", "failed", "created"] +SharedMemoryEntryType = Literal["plan", "experience_sub_path"] +SharedMemoryEntryScope = Literal["round", "conversation"]