From 63f6796a0b4c8a4c624e599ca295b8a171b30770 Mon Sep 17 00:00:00 2001 From: "jinli.yl" Date: Thu, 23 Oct 2025 17:25:36 +0800 Subject: [PATCH] refactor(app): simplify ReMeApp initialization and config loading - Removed load_default_config parameter from ReMeApp.__init__ - Removed backend configuration examples from docstring - Updated super().__init__ call to always load default config - Reordered and simplified configuration parameter passing - Updated docstring to reference default.yaml for config examples - Removed redundant HTTP backend configuration comments - Ensured config_path parameter properly passed to parent class --- reme_ai/app.py | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/reme_ai/app.py b/reme_ai/app.py index 76f2c312..cded3e8b 100644 --- a/reme_ai/app.py +++ b/reme_ai/app.py @@ -25,20 +25,6 @@ class ReMeApp(FlowLLMApp): ReMeApp extends FlowLLMApp to provide enhanced memory capabilities for AI agents. It manages multiple types of memories and provides both synchronous and asynchronous execution interfaces for memory-enhanced workflows. - - Example: - Basic usage: - >>> app = ReMeApp() - >>> result = app.execute("task_memory_flow", query="What tasks did I complete yesterday?") - - With custom configuration: - >>> app = ReMeApp( - ... llm_api_key="your-api-key", - ... config_path="config/custom.yaml", - ... "llm.default.model_name=gpt-4" - ... ) - >>> async with app: - ... result = await app.async_execute("tool_memory_flow", tool_name="search") """ def __init__(self, @@ -47,7 +33,6 @@ class ReMeApp(FlowLLMApp): embedding_api_key: str = None, embedding_api_base: str = None, config_path: str = None, - load_default_config: bool = False, *args, **kwargs): """ @@ -66,8 +51,6 @@ class ReMeApp(FlowLLMApp): Python API equivalent: >>> app = ReMeApp( - ... "backend=http", - ... "http.port=8002", ... "llm.default.model_name=qwen3-30b-a3b-thinking-2507", ... "embedding_model.default.model_name=text-embedding-v4", ... "vector_store.default.backend=memory" @@ -93,19 +76,11 @@ class ReMeApp(FlowLLMApp): config_path: Path to custom configuration YAML file. If provided, loads configuration from this file. Example: "path/to/my_config.yaml" This overrides the default configuration with your custom settings. - load_default_config: Whether to load default configuration (default.yaml). - If True and config_path is not provided, loads the default ReMe configuration. - Default: False *args: Additional command-line style arguments passed to parser. These parameters are identical to the command-line startup parameters in README. - Common configuration examples (see README for more): - - Backend Configuration: - - "backend=http" - Start as HTTP service - - "backend=mcp" - Start as MCP server - - "http.port=8002" - Set HTTP port - - "mcp.transport=stdio" - Set MCP transport + Common configuration examples: + For complete configuration reference, see: reme_ai/config/default.yaml LLM Configuration: - "llm.default.model_name=qwen3-30b-a3b-thinking-2507" - Set LLM model @@ -143,7 +118,16 @@ class ReMeApp(FlowLLMApp): - README.md "Environment Configuration" for environment variable setup - example.env for all available environment variables """ - super().__init__(args=args, parser=ConfigParser) + super().__init__(llm_api_key=llm_api_key, + llm_api_base=llm_api_base, + embedding_api_key=embedding_api_key, + embedding_api_base=embedding_api_base, + service_config=None, + parser=ConfigParser, + config_path=config_path, + load_default_config=True, + args=args, + **kwargs) async def async_execute(self, name: str, **kwargs) -> dict: """