Skip to content

feat: enhance APIADDRequest with custom_tags, info, and is_feedback fields#515

Merged
CaralHsi merged 14 commits intoMemTensor:devfrom
CaralHsi:feat/knowledge_db_api_param_entry
Nov 22, 2025
Merged

feat: enhance APIADDRequest with custom_tags, info, and is_feedback fields#515
CaralHsi merged 14 commits intoMemTensor:devfrom
CaralHsi:feat/knowledge_db_api_param_entry

Conversation

@CaralHsi
Copy link
Copy Markdown
Collaborator

@CaralHsi CaralHsi commented Nov 22, 2025

Description

This PR:
1. Refines API request models
• Restructures APISearchRequest and APIADDRequest (clearer sections, pref_top_k / include_preference, richer custom_tags / info / is_feedback, better backward-compat fields).
2. Polishes router behavior & config
• chat_complete falls back to system_prompt when base_prompt is missing.
• Adds a safe default for MEMRADER_API_BASE to avoid pydantic validation issues in tests/local.
3. Adds clean router I/O tests
• New test_product_router and test_server_router to ensure API satisfies API protocal since API1.0.

1.	梳理对外请求模型
•	重构 APISearchRequest / APIADDRequest 结构,补充 pref_top_k、include_preference、custom_tags、info、is_feedback 等字段,并更清晰地区分兼容字段。
2.	小幅优化路由与配置
•	chat_complete 在没有 base_prompt 时回落到 system_prompt,避免老调用方式受影响。
•	为 MEMRADER_API_BASE 增加默认值,避免本地 / 单测环境下的 pydantic 校验报错。
3.	补充路由层单测
•	新增 test_product_router 和 test_server_router,保证API协议兼容API1.0版本以来接口协议。

Fix: #(issue)

Docs Issue/PR: (docs-issue-or-pr-link)

Reviewer: @(reviewer)

Checklist:

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

CarltonXiang and others added 14 commits November 21, 2025 10:40
## Description

<!--
Please include a summary of the changes below;
Fill in the issue number that this PR addresses (if applicable);
Fill in the related MemOS-Docs repository issue or PR link (if
applicable);
Mention the person who will review this PR (if you know who it is);
Replace (summary), (issue), (docs-issue-or-pr-link), and (reviewer) with
the appropriate information.

请在下方填写更改的摘要;
填写此 PR 解决的问题编号(如果适用);
填写相关的 MemOS-Docs 仓库 issue 或 PR 链接(如果适用);
提及将审查此 PR 的人(如果您知道是谁);
替换 (summary)、(issue)、(docs-issue-or-pr-link) 和 (reviewer) 为适当的信息。
-->

Summary: (summary)

Fix: #(issue)

Docs Issue/PR: (docs-issue-or-pr-link)

Reviewer: @(reviewer)

## Checklist:

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人
## Description

<!--
Please include a summary of the changes below;
Fill in the issue number that this PR addresses (if applicable);
Fill in the related MemOS-Docs repository issue or PR link (if
applicable);
Mention the person who will review this PR (if you know who it is);
Replace (summary), (issue), (docs-issue-or-pr-link), and (reviewer) with
the appropriate information.

请在下方填写更改的摘要;
填写此 PR 解决的问题编号(如果适用);
填写相关的 MemOS-Docs 仓库 issue 或 PR 链接(如果适用);
提及将审查此 PR 的人(如果您知道是谁);
替换 (summary)、(issue)、(docs-issue-or-pr-link) 和 (reviewer) 为适当的信息。
-->

Summary: (summary)

Fix: #(issue)

Docs Issue/PR: (docs-issue-or-pr-link)

Reviewer: @(reviewer)

## Checklist:

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人
…ields

- Add custom_tags field for user-defined tags (e.g., ['Travel', 'family']) that can be used as search filters
- Add info field for additional metadata (agent_id, app_id, source_type, etc.) with all keys usable as search filters
- Add is_feedback field to indicate if the request represents user feedback
- Reorganize fields with category comments for better readability
- Mark async_mode as required with default value 'async'
- Mark mem_cube_id, memory_content, doc_path, and source as deprecated
- Enhance field descriptions for better API documentation
… and documentation

- Reorganize fields with clear section comments (Basic inputs, Cube scoping, Search mode, etc.)
- Add comprehensive field descriptions for better API documentation
- Add new 'filter' field for structured filter conditions with support for logical operators, comparisons, and string operations
- Add 'pref_top_k' and 'include_preference' fields for preference memory handling
- Mark 'mem_cube_id' as deprecated, recommend 'readable_cube_ids' for multi-cube search
- Make 'user_id' required field (was optional)
- Add validation constraints (e.g., top_k >= 1)
- Improve backward compatibility notes and internal field descriptions
- Add 'threshold' field for internal similarity threshold control
…si/MemOSRealPublic into feat/knowledge_db_api_param_entry
@CaralHsi CaralHsi marked this pull request as ready for review November 22, 2025 15:34
@CaralHsi CaralHsi merged commit 8003c2f into MemTensor:dev Nov 22, 2025
20 checks passed
tianxing02 pushed a commit to tianxing02/MemOS that referenced this pull request Feb 24, 2026
…ields (MemTensor#515)

* hotfix:hotfix

* feat: enhance APIADDRequest with custom_tags, info, and is_feedback fields

- Add custom_tags field for user-defined tags (e.g., ['Travel', 'family']) that can be used as search filters
- Add info field for additional metadata (agent_id, app_id, source_type, etc.) with all keys usable as search filters
- Add is_feedback field to indicate if the request represents user feedback
- Reorganize fields with category comments for better readability
- Mark async_mode as required with default value 'async'
- Mark mem_cube_id, memory_content, doc_path, and source as deprecated
- Enhance field descriptions for better API documentation

* refactor(api): enhance APISearchRequest model with improved structure and documentation

- Reorganize fields with clear section comments (Basic inputs, Cube scoping, Search mode, etc.)
- Add comprehensive field descriptions for better API documentation
- Add new 'filter' field for structured filter conditions with support for logical operators, comparisons, and string operations
- Add 'pref_top_k' and 'include_preference' fields for preference memory handling
- Mark 'mem_cube_id' as deprecated, recommend 'readable_cube_ids' for multi-cube search
- Make 'user_id' required field (was optional)
- Add validation constraints (e.g., top_k >= 1)
- Improve backward compatibility notes and internal field descriptions
- Add 'threshold' field for internal similarity threshold control

* test: add routers api

* fix: Fixed the compatibility issue in the product router.

* fix: tests unpass

* fix: test_api bug

---------

Co-authored-by: HarveyXiang <harvey_xiang@163.com>
Co-authored-by: fridayL <lcy081099@gmail.com>
Co-authored-by: chunyu li <78344051+fridayL@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants