ReMe/doc/operations_documentation.md
2025-07-25 16:08:58 +08:00

19 KiB

Operations Documentation

This document provides an overview of all operations in the ExperienceMaker framework.

Operations Overview

Op Class Registered Backend Description Parameters
BuildQueryOp build_query_op Constructs retrieval queries from user requests. If request.query exists, uses it directly. If only messages are provided, can either use LLM-based query construction or create a simple summary from the last 3 messages (200 chars each). Sets search query and messages in context for downstream operations. op.build_query_op.params.enable_llm_build = true/false - Enable LLM-based query construction from messages. When false, creates simple summary from last 3 messages
RerankExperienceOp rerank_experience_op Performs two-stage experience reranking: (1) LLM-based intelligent reranking using relevance evaluation, (2) Score-based filtering using confidence and validation scores. Returns top-k results after filtering. Handles parsing of LLM reranking responses in JSON format with fallback to text parsing. op.rerank_experience_op.params.enable_llm_rerank = true - Enable LLM-based reranking
op.rerank_experience_op.params.enable_score_filter = false - Enable score-based filtering
op.rerank_experience_op.params.min_score_threshold = 0.3 - Minimum combined score threshold for filtering
op.rerank_experience_op.params.top_k = 5 - Number of top experiences to return after reranking
RewriteExperienceOp rewrite_experience_op Intelligently rewrites experience context for better task relevance. Extracts current context from recent messages (last 3), formats experiences, and optionally uses LLM to rewrite context based on current query and conversation history. Handles JSON response parsing with fallback to original content. Generates structured context messages with "When to use" and "Content" sections. op.rewrite_experience_op.params.enable_llm_rewrite = true - Enable LLM-based context rewriting to make experiences more relevant and actionable for current task
MergeExperienceOp merge_experience_op Formats multiple experiences into a single structured context message. Creates "Previous Experience" header followed by bullet-pointed list of experiences with "when_to_use" and "content" fields. Adds guidance text encouraging comprehensive response using helpful parts from experiences. Simple concatenation-based approach without LLM processing. No configurable parameters
TrajectoryPreprocessOp trajectory_preprocess_op Validates and classifies trajectories based on success threshold scoring. Separates trajectories into success/failure categories and sets up context variables (success_trajectories, failure_trajectories, all_trajectories) for downstream extraction operations. Essential preprocessing step for all summarizer operations. op.trajectory_preprocess_op.params.success_threshold = 1.0 - Score threshold to classify trajectories as successful. Trajectories with scores >= threshold are classified as success
TrajectorySegmentationOp trajectory_segmentation_op Uses LLM to segment trajectories into meaningful step sequences based on logical breakpoints. Supports selective segmentation of success, failure, or all trajectories. Parses LLM responses in JSON format with fallback to number extraction. Stores segmentation information in trajectory metadata for downstream operations. Formats trajectory content with step numbers and role information. op.trajectory_segmentation_op.params.segment_target = "all" - Which trajectories to segment ("all", "success", "failure")
ExperienceValidationOp experience_validation_op Validates extracted experiences using LLM-based quality assessment. Evaluates experiences for actionability, accuracy, relevance, clarity, and uniqueness. Uses parallel processing for efficiency. Parses JSON validation responses with score and validity flags. Filters experiences based on validation threshold and removes invalid ones with detailed logging of rejection reasons. op.experience_validation_op.params.validation_threshold = 0.5 - Minimum validation score threshold for experience acceptance. Experiences with scores below this threshold are filtered out
ExperienceDeduplicationOp experience_deduplication_op Removes duplicate experiences using embedding-based similarity analysis. Compares against both existing vector store experiences and current batch experiences. Calculates cosine similarity between experience embeddings and filters duplicates above similarity threshold. Handles embedding generation failures gracefully and provides detailed logging of deduplication decisions. op.experience_deduplication_op.params.similarity_threshold = 0.5 - Cosine similarity threshold for duplicate detection
op.experience_deduplication_op.params.max_existing_experiences = 1000 - Maximum number of existing experiences to retrieve and compare against for deduplication
ComparativeExtractionOp comparative_extraction_op Extracts insights by comparing different trajectory outcomes. Supports two comparison modes: (1) Soft comparison between highest and lowest scoring trajectories, (2) Hard comparison between similar success/failure step sequences using embedding-based similarity matching. Uses parallel processing and handles trajectory segmentation data when available. op.comparative_extraction_op.params.enable_soft_comparison = true - Enable highest vs lowest score comparison
op.comparative_extraction_op.params.enable_similarity_comparison = false - Enable success vs failure similarity comparison
op.comparative_extraction_op.params.max_similarity_sequences = 5 - Maximum sequences to compare for similarity
op.comparative_extraction_op.params.similarity_threshold = 0.3 - Similarity threshold for step sequence matching
op.comparative_extraction_op.params.max_similarity_pairs = 3 - Maximum similar pairs to extract experiences from
SimpleSummaryOp simple_summary_op Generates basic experiences from individual trajectories using LLM-based analysis. Classifies trajectories as success/failure based on score threshold and creates structured experiences with when_to_use conditions and content. Parses JSON responses with robust error handling and validation. Uses parallel processing for multiple trajectories. op.simple_summary_op.params.success_score_threshold = 0.9 - Score threshold to classify trajectory as successful for experience extraction
SuccessExtractionOp success_extraction_op Extracts actionable experiences from successful trajectories and their segments. Processes both segmented step sequences (when available) and entire trajectories. Uses parallel processing for efficiency. Merges message content and extracts trajectory context for rich experience generation. Creates TextExperience objects with proper metadata including workspace and author information. No configurable parameters
FailureExtractionOp failure_extraction_op Extracts learning experiences from failed trajectories to identify failure patterns and pitfalls. Similar to SuccessExtractionOp but focuses on failure analysis. Processes segmented sequences when available or entire trajectories. Uses parallel processing and creates structured experiences with proper metadata. Helps identify common failure modes and prevention strategies. No configurable parameters
UpdateVectorStoreOp update_vector_store_op Manages vector store updates through insert and delete operations. Handles deletion of experiences by ID list and insertion of new experience lists. Converts BaseExperience objects to VectorNode format for storage. Operates on workspace-specific vector databases with detailed logging of operation sizes and IDs. Supports batch operations for efficiency. No configurable parameters - operations controlled by experience_list and deleted_experience_ids in response context
RecallVectorStoreOp recall_vector_store_op Retrieves relevant experiences from vector store using semantic search. Performs content-based deduplication to avoid returning identical experiences. Supports optional score-based filtering to ensure quality results. Converts VectorNode results back to BaseExperience objects. Uses search query from context set by BuildQueryOp. op.recall_vector_store_op.params.threshold_score = <float> - Optional minimum similarity score threshold for filtering search results. Results below this score are excluded
VectorStoreActionOp vector_store_action_op Performs administrative operations on vector store workspaces. Supports four actions: (1) copy - duplicates workspace content, (2) delete - removes entire workspace, (3) dump - exports workspace to file with experience conversion, (4) load - imports workspace from file with node conversion. Handles callback functions for data transformation during dump/load operations. Action-specific parameters: request.action ("copy"/"delete"/"dump"/"load"), request.workspace_id (target workspace), request.src_workspace_id (source workspace for copy), request.path (file path for dump/load)
ReactV1Op react_v1_op Implements ReAct (Reasoning and Acting) agent framework for interactive problem-solving. Manages iterative reasoning-action cycles with configurable tools and step limits. Handles tool execution with parallel processing and result collection. Supports terminate tool for early stopping. Formats conversations with role prompts, tool responses, and final prompts. Includes built-in safeguards for missing tools and infinite loops. op.react_v1_op.params.max_steps = 10 - Maximum number of reasoning/action steps before termination
op.react_v1_op.params.tool_names = "code_tool,dashscope_search_tool,terminate_tool" - Comma-separated list of available tools from the tool registry