Skip to main content

my-mental-assistant · 心理误区澄清 Agent

基于 ACPs 智能体互联协议(AIP v2) 的心理误区澄清 Agent。用户提出心理相关问题后,由科普检索 Agent 检索权威科普,再由误区澄清 Agent 识别网络心理学谣言(伪心理学、性格决定一切、星座性格、左右脑开发等),生成通俗、权威、不误导的回复。

核心特点

  • 双 Agent 互联:使用官方 acps-sdk==2.1.0 的 AIP RPC,检索端(Leader)与澄清端(Partner)通过 JSON-RPC 互联。
  • 辟谣导向:内置权威科普库与误区规则库,先识别谣言再给出权威澄清,避免简单化误导。
  • 隐私友好:数据模型不含任何用户身份字段。
  • 精简可运行:基于关键词规则,无需外部大模型/网络,可离线运行;一条命令即可演示。
  • 专业边界:回复附带免责声明,明确不构成诊断或治疗建议。

架构

用户提问 ──▶ [科普检索 Agent / Leader]
                  │  检索内置权威科普 (RetrievalBundle)
                  │  ACPs AIP RPC (start_task)
                  ▼
            [误区澄清 Agent / Partner]
                  │  识别谣言 + 生成通俗澄清
                  ▼
            通俗权威回复 (Product) ──▶ 用户

安装

pip install acps-sdk==2.1.0
pip install my-mental-assistant

从源码本地运行:

cd my-mental-assistant
pip install -e .

快速开始

一键演示(本机启动澄清 Agent 并发送示例问题):

my-mental-assistant demo

分别启动服务端与提问端:

# 终端 1:启动误区澄清 Agent
my-mental-assistant serve --host 0.0.0.0 --port 8766

# 终端 2:提问
my-mental-assistant ask \
  --url http://127.0.0.1:8766/aip/rpc \
  --question "星座真的决定性格吗?"

Python API

import asyncio
from my_mental_assistant import RetrieverAgent

async def main():
    agent = RetrieverAgent(partner_url="http://127.0.0.1:8766/aip/rpc")
    report = await agent.ask("左脑理性右脑感性是真的吗?")
    print(report.answer)
    await agent.close()

asyncio.run(main())

澄清 Agent 服务也可嵌入任意 FastAPI 应用:

from my_mental_assistant import build_clarifier_app
app = build_clarifier_app()   # 已挂载 /aip/rpc

扩展

内置知识库位于 knowledge.py,可按需扩展 KNOWLEDGE_BASE(权威科普)与 MYTH_RULES(误区规则),或将 search_knowledge() 替换为在线权威检索源。

构建 whl

pip install build
python -m build --wheel
twine upload dist/*

版本

1.0.0 · 依赖 acps-sdk==2.1.0 · Python >= 3.10

免责声明:本项目输出仅为心理学科普,不构成诊断或治疗建议。如有严重心理困扰,请及时寻求专业心理咨询师或精神科医生帮助。

Metadata

Release files for my-mental-assistant 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for my-mental-assistant 1.0.0
File Interpreter ABI Platform Actions
my_mental_assistant-1.0.0-py3-none-any.whl Python 3 none any Details for my_mental_assistant-1.0.0-py3-none-any.whl

Release files / my_mental_assistant-1.0.0-py3-none-any.whl

Download URL my_mental_assistant-1.0.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bc3f5040ce21de3b5651ea3190c12bb892a42869ef2335f32ca92c63540f60a
BLAKE2b-256 checksum
How to use checksums
f48a6444c09f8daca3e251c88fee2f743ac74ea144bcc776b874870aa33d49a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.1

Security for my-mental-assistant 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page