diff --git a/.gitignore b/.gitignore index c534ea07..a707d866 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ cookbook/appworld/exp_result/* file_vector_store/* cookbook/appworld/file_vector_store/* /.venv/ -site/* \ No newline at end of file +site/* +docs/_build/* \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml index 73ce4784..927fdff6 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -19,6 +19,9 @@ execute: parse: myst_enable_extensions: - colon_fence + - deflist + - attrs_inline + - dollarmath # Define the name of the latex output file for PDF builds latex: diff --git a/docs/_toc.yml b/docs/_toc.yml index f8fd1e8b..5e2e2e36 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -31,11 +31,6 @@ parts: - file: tool_memory/tool_summary_ops - file: tool_memory/tool_bench - - caption: SOP Memory - maxdepth: 1 - chapters: - - file: sop_memory/making_sop_memories - - caption: Extensions maxdepth: 1 chapters: diff --git a/docs/index.md b/docs/index.md index baf60c70..54e7ede0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ kernelspec:
Python Version - PyPI Version + PyPI Version License GitHub Stars
@@ -41,44 +41,45 @@ Personal memory helps "**understand user preferences**", task memory helps agent ReMe integrates three complementary memory capabilities: -```{admonition} Task Memory/Experience +:::{admonition} Task Memory/Experience +:class: note - Procedural knowledge reused across agents +Procedural knowledge reused across agents - - **Success Pattern Recognition**: Identify effective strategies and understand their underlying principles - - **Failure Analysis Learning**: Learn from mistakes and avoid repeating the same issues - - **Comparative Patterns**: Different sampling trajectories provide more valuable memories through comparison - - **Validation Patterns**: Confirm the effectiveness of extracted memories through validation modules +- **Success Pattern Recognition**: Identify effective strategies and understand their underlying principles +- **Failure Analysis Learning**: Learn from mistakes and avoid repeating the same issues +- **Comparative Patterns**: Different sampling trajectories provide more valuable memories through comparison +- **Validation Patterns**: Confirm the effectiveness of extracted memories through validation modules -``` +::: Learn more about how to use task memory from [task memory](task_memory/task_memory.md) -```{admonition} Personal Memory +:::{admonition} Personal Memory +:class: note +Contextualized memory for specific users - Contextualized memory for specific users +- **Individual Preferences**: User habits, preferences, and interaction styles +- **Contextual Adaptation**: Intelligent memory management based on time and context +- **Progressive Learning**: Gradually build deep understanding through long-term interaction +- **Time Awareness**: Time sensitivity in both retrieval and integration - - - **Individual Preferences**: User habits, preferences, and interaction styles - - **Contextual Adaptation**: Intelligent memory management based on time and context - - **Progressive Learning**: Gradually build deep understanding through long-term interaction - - **Time Awareness**: Time sensitivity in both retrieval and integration - -``` +::: Learn more about how to use personal memory from [personal memory](personal_memory/personal_memory.md) -```{admonition} Tool Memory +:::{admonition} Tool Memory +:class: note - Data-driven tool selection and usage optimization +Data-driven tool selection and usage optimization - - **Historical Performance Tracking**: Success rates, execution times, and token costs from real usage - - **LLM-as-Judge Evaluation**: Qualitative insights on why tools succeed or fail - - **Parameter Optimization**: Learn optimal parameter configurations from successful calls - - **Dynamic Guidelines**: Transform static tool descriptions into living, learned manuals +- **Historical Performance Tracking**: Success rates, execution times, and token costs from real usage +- **LLM-as-Judge Evaluation**: Qualitative insights on why tools succeed or fail +- **Parameter Optimization**: Learn optimal parameter configurations from successful calls +- **Dynamic Guidelines**: Transform static tool descriptions into living, learned manuals -``` +::: Learn more about how to use tool memory from [tool memory](tool_memory/tool_memory.md) diff --git a/docs/quick_start.md b/docs/quick_start.md index 2ef079dc..cbe863d6 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -42,6 +42,27 @@ reme \ `````{tab-set} +````{tab-item} python(http) +```{code-block} +import requests + +# Experience Summarizer: Learn from execution trajectories +response = requests.post("http://localhost:8002/summary_task_memory", json={ + "workspace_id": "task_workspace", + "trajectories": [ + {"messages": [{"role": "user", "content": "Help me create a project plan"}], "score": 1.0} + ] +}) + +# Retriever: Get relevant memories +response = requests.post("http://localhost:8002/retrieve_task_memory", json={ + "workspace_id": "task_workspace", + "query": "How to efficiently manage project progress?", + "top_k": 1 +}) +``` +```` + ````{tab-item} python(import) ```{code-block} import asyncio @@ -82,27 +103,6 @@ if __name__ == "__main__": ``` ```` -````{tab-item} python(http) -```{code-block} -import requests - -# Experience Summarizer: Learn from execution trajectories -response = requests.post("http://localhost:8002/summary_task_memory", json={ - "workspace_id": "task_workspace", - "trajectories": [ - {"messages": [{"role": "user", "content": "Help me create a project plan"}], "score": 1.0} - ] -}) - -# Retriever: Get relevant memories -response = requests.post("http://localhost:8002/retrieve_task_memory", json={ - "workspace_id": "task_workspace", - "query": "How to efficiently manage project progress?", - "top_k": 1 -}) -``` -```` - ````{tab-item} curl ```bash # Experience Summarizer: Learn from execution trajectories @@ -164,11 +164,37 @@ fetch("http://localhost:8002/retrieve_task_memory", { #### Personal Memory Management - import version `````{tab-set} -````{tab-item} Python(import) -```{code-cell} +````{tab-item} python(http) +```{code-block} +import requests + +# Memory Integration: Learn from user interactions +response = requests.post("http://localhost:8002/summary_personal_memory", json={ + "workspace_id": "task_workspace", + "trajectories": [ + {"messages": + [ + {"role": "user", "content": "I like to drink coffee while working in the morning"}, + {"role": "assistant", + "content": "I understand, you prefer to start your workday with coffee to stay energized"} + ] + } + ] +}) + +# Memory Retrieval: Get personal memory fragments +response = requests.post("http://localhost:8002/retrieve_personal_memory", json={ + "workspace_id": "task_workspace", + "query": "What are the user's work habits?", + "top_k": 5 +}) +``` +```` + +````{tab-item} python(import) +```{code-block} import asyncio from reme_ai import ReMeApp @@ -208,32 +234,7 @@ if __name__ == "__main__": ``` ```` - -```{code-cell} -# Memory Integration: Learn from user interactions -response = requests.post("http://localhost:8002/summary_personal_memory", json={ - "workspace_id": "task_workspace", - "trajectories": [ - {"messages": - [ - {"role": "user", "content": "I like to drink coffee while working in the morning"}, - {"role": "assistant", - "content": "I understand, you prefer to start your workday with coffee to stay energized"} - ] - } - ] -}) - -# Memory Retrieval: Get personal memory fragments -response = requests.post("http://localhost:8002/retrieve_personal_memory", json={ - "workspace_id": "task_workspace", - "query": "What are the user's work habits?", - "top_k": 5 -}) -``` - -````{dropdown} curl version - +````{tab-item} curl ```bash # Memory Integration: Learn from user interactions curl -X POST http://localhost:8002/summary_personal_memory \ @@ -259,8 +260,7 @@ curl -X POST http://localhost:8002/retrieve_personal_memory \ ``` ```` -````{dropdown} Node.js version - +````{tab-item} Node.js ```{code-block} javascript // Memory Integration: Learn from user interactions fetch("http://localhost:8002/summary_personal_memory", { @@ -297,11 +297,15 @@ fetch("http://localhost:8002/retrieve_personal_memory", { .then(data => console.log(data)); ``` ```` +````` #### Tool Memory Management -```{code-cell} +`````{tab-set} + +````{tab-item} python(http) +```{code-block} import requests # Record tool execution results @@ -332,10 +336,59 @@ response = requests.post("http://localhost:8002/retrieve_tool_memory", json={ "tool_names": "web_search" }) ``` +```` +````{tab-item} python(import) +```{code-block} +import asyncio +from reme_ai import ReMeApp -````{dropdown} curl version +async def main(): + async with ReMeApp( + "llm.default.model_name=qwen3-30b-a3b-thinking-2507", + "embedding_model.default.model_name=text-embedding-v4", + "vector_store.default.backend=memory" + ) as app: + # Record tool execution results + result = await app.async_execute( + name="add_tool_call_result", + workspace_id="tool_workspace", + tool_call_results=[ + { + "create_time": "2025-10-21 10:30:00", + "tool_name": "web_search", + "input": {"query": "Python asyncio tutorial", "max_results": 10}, + "output": "Found 10 relevant results...", + "token_cost": 150, + "success": True, + "time_cost": 2.3 + } + ] + ) + print(result) + + # Generate usage guidelines from history + result = await app.async_execute( + name="summary_tool_memory", + workspace_id="tool_workspace", + tool_names="web_search" + ) + print(result) + + # Retrieve tool guidelines before use + result = await app.async_execute( + name="retrieve_tool_memory", + workspace_id="tool_workspace", + tool_names="web_search" + ) + print(result) +if __name__ == "__main__": + asyncio.run(main()) +``` +```` + +````{tab-item} curl ```bash # Record tool execution results curl -X POST http://localhost:8002/add_tool_call_result \ @@ -373,8 +426,7 @@ curl -X POST http://localhost:8002/retrieve_tool_memory \ ``` ```` -````{dropdown} Node.js version - +````{tab-item} Node.js ```{code-block} javascript // Record tool execution results fetch("http://localhost:8002/add_tool_call_result", { @@ -428,4 +480,5 @@ fetch("http://localhost:8002/retrieve_tool_memory", { .then(response => response.json()) .then(data => console.log(data)); ``` -```` \ No newline at end of file +```` +````` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7751beae..6144dbf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,11 @@ dependencies = [ "flowllm[reme]>=0.1.11.3", ] +[project.optional-dependencies] +dev = ["jupyter-book", "ghp-import", "myst-nb", "sphinxcontrib-bibtex", "furo", "sphinxcontrib-mermaid"] + +all = ["reme_ai[dev]"] + [tool.setuptools.packages.find] where = ["."] include = ["reme_ai*"]