MCPcopy Create free account

hub / github.com/datawhalechina/easy-data-x-ai / functions

Functions230 in github.com/datawhalechina/easy-data-x-ai

↓ 13 callersMethod_ensure_collections
(self)
code/X2/storage/seekdb_storage.py:77
↓ 10 callersMethodadd
(self, content: str, user_id: str, agent_id: str, scope: str = "PRIVATE")
code/X1/part2_namespace/x1_8_promote_and_share.py:40
↓ 9 callersFunctioncreate_storage
Create the default seekdb-backed storage.
code/X2/storage/__init__.py:9
↓ 7 callersFunctioncalculate_retention
计算保留率 R = e^(-t / (24*S)),t 为 created_at 到 current_time 的小时数
code/X1/part3_consolidation/x1_11_consolidation_passive.py:43
↓ 7 callersFunctioncalculate_retention
计算记忆在当前时刻的保留率 R ∈ [0.0, 1.0]。 1.0 = 完全没衰减;< 0.3 = 视为"遗忘"。
code/X1/part1_decay_conflict/x1_1_decay_score_demo.py:76
↓ 7 callersFunctionshow_memory_state
格式化展示记忆库状态
code/X1/part1_decay_conflict/x1_5_conflict_resolve.py:120
↓ 5 callersMethodadd
写入记忆,带完整的命名空间标记
code/X1/part2_namespace/x1_7_namespace_isolation.py:41
↓ 5 callersMethodget_siliconflow_config
获取 SiliconFlow 配置
code/config.py:48
↓ 5 callersFunctionresolve_mode
Pick embedded vs server mode from env and platform capabilities.
code/X2/database/seekdb_client.py:24
↓ 5 callersMethodsearch
检索记忆。关键:user_id + agent_id 在查询构建阶段就注入过滤条件。 这与 PowerMem 的 _build_db_filters 设计一致。
code/X1/part2_namespace/x1_7_namespace_isolation.py:66
↓ 5 callersFunctionserver_endpoint
()
code/X2/database/seekdb_client.py:38
↓ 5 callersFunctionvector_only
纯向量检索:只用语义相似度
code/D3/d3_3_compare.py:44
↓ 4 callersFunction_parse_ts
(value: str | None)
code/X2/storage/seekdb_storage.py:358
↓ 4 callersFunction_utc_now_iso
()
code/X2/storage/seekdb_storage.py:27
↓ 4 callersFunctionchat_with_memory
有记忆的 Agent: 1. 推理前:从记忆库检索相关的用户信息,注入 System Prompt 2. 推理:基于记忆上下文生成个性化回答 3. 推理后:从对话中提炼新事实,存入记忆库
code/D4/d4_3_with_memory.py:155
↓ 4 callersFunctionchat_without_memory
无记忆的 Agent:每次对话都是全新的。 messages 列表只包含当前这一轮的 system prompt 和用户输入, 没有任何历史信息。
code/D4/d4_2_no_memory.py:29
↓ 4 callersFunctioncheck_connection
Return (ok, message). Does not raise.
code/X2/database/seekdb_client.py:100
↓ 4 callersFunctionhybrid_with_keyword
混合检索:向量语义 + 全文关键词,RRF 融合
code/D3/d3_3_compare.py:52
↓ 4 callersMethodlist_skills
( self, category: Optional[str] = None, status: Optional[str] = None, )
code/X2/services/skill_service.py:38
↓ 4 callersFunctionskill_doc_id
(name: str)
code/X2/database/collections.py:10
↓ 3 callersFunction_format_bar
把 [0,1] 数值转成 #.... 进度条
code/X1/part1_decay_conflict/x1_1_decay_score_demo.py:94
↓ 3 callersMethod_metadata_to_skill
(self, meta: dict, doc_id: str)
code/X2/storage/seekdb_storage.py:101
↓ 3 callersFunctionagent_loop
ReAct 推理循环: 推理 → 行动 → 观察 → 推理 → 行动 → 观察 → ... → 最终回答 关键点: - Agent 自主决定是否调用工具、调用哪个工具 - 每次工具调用的结果会反馈给 Agent,进入下一轮推理 - max_step
code/D4/d4_1_react_loop.py:110
↓ 3 callersFunctioncalculate_retention
使用指定的 λ 值计算保留率 R = e^(-t / (24*S))。 与 x1_1 中的同名函数逻辑一致, 但 decay_rate 是参数而非全局常量。
code/X1/part1_decay_conflict/x1_2_decay_param_ablation.py:43
↓ 3 callersFunctioncalculate_strength
计算记忆的「有效强度」S。 S 是艾宾浩斯公式 R = e^(-t / (24*S)) 中控制衰减速度的核心参数。 S 越大 → 分母 24*S 越大 → e^(-t/大数) 衰减越慢。 参数: memory_type: "working" / "s
code/X1/part1_decay_conflict/x1_1_decay_score_demo.py:51
↓ 3 callersFunctioncreate_client
Create a pyseekdb client using the resolved deployment mode.
code/X2/database/seekdb_client.py:44
↓ 3 callersMethodget_rules_by_skill
(self, skill_name: str)
code/X2/services/query_service.py:44
↓ 3 callersFunctionprint_results
格式化打印搜索结果
code/D2/d2_3_hybrid_search.py:32
↓ 3 callersFunctionresolve_conflict
执行冲突裁决,更新记忆库。 返回执行的操作摘要。
code/X1/part1_decay_conflict/x1_5_conflict_resolve.py:31
↓ 3 callersFunctionrun_comparison
对同一个查询分别执行纯向量搜索和混合搜索,并排版对比输出。
code/D2/d2_4_compare.py:31
↓ 3 callersMethodsearch_for_agent
检索时考虑 scope: - PRIVATE: 仅 owner agent 可见 - AGENT_GROUP: owner + 同组 agent 可见 - PUBLIC: 所有 agent 可见
code/X1/part2_namespace/x1_8_promote_and_share.py:91
↓ 3 callersMethodsearch_skills
(self, keyword: str, n_results: int = 5)
code/X2/services/query_service.py:50
↓ 3 callersMethodto_dict
Convert rule to dictionary. Returns: Dictionary representation of the rule
code/X2/models/rule.py:51
↓ 2 callersFunction_bar
(value: float, width: int = 15)
code/X1/part3_consolidation/x1_11_consolidation_passive.py:115
↓ 2 callersMethod_bind_collections
(self)
code/X2/storage/seekdb_storage.py:58
↓ 2 callersFunction_extract_query_keywords
从 query 中提取相关关键词。 返回的 keywords 既包含中文话题词,也包含对应的英文桥接词(用来匹配 profile 的英文 key)。 例如 query 含"编程语言" → 返回 ['编程', '语言', 'language', 'Python', 'Java
code/X1/part3_consolidation/x1_13_profile_vs_facts.py:59
↓ 2 callersMethod_skill_search_document
(self, skill: Skill)
code/X2/storage/seekdb_storage.py:117
↓ 2 callersMethod_skill_to_metadata
(self, skill: Skill, created_at: str | None = None)
code/X2/storage/seekdb_storage.py:85
↓ 2 callersFunctionask_with_tool_desc
用指定的工具描述发起 Agent 调用
code/D3/d3_4_production.py:46
↓ 2 callersFunctionconnection_hint
(mode: SeekdbMode | None = None)
code/X2/database/seekdb_client.py:73
↓ 2 callersFunctioncreate_test_data
生成大规模测试数据
code/X1/part2_namespace/x1_9_cross_agent_query.py:28
↓ 2 callersFunctionensure_database
Create the target database if it does not exist (Server mode).
code/X2/database/seekdb_client.py:125
↓ 2 callersFunctionensure_storage
(db_path: str)
code/X2/tools/migrate.py:22
↓ 2 callersFunctionestimate_tokens
(text: str)
code/X2/x2_1_compare_context.py:21
↓ 2 callersMethodextract
Extract rules from Markdown content. Args: skill_name: Name of the associated skill Returns
code/X2/parsers/rule_extractor.py:58
↓ 2 callersFunctionfilter_after_retrieval
检索后过滤(不推荐的方式)。 先全量搜索,再从结果中过滤不属于当前 namespace 的。
code/X1/part2_namespace/x1_9_cross_agent_query.py:66
↓ 2 callersFunctionfilter_at_query_time
查询构建阶段过滤(PowerMem 的方式)。 WHERE 条件在搜索前已确定,搜索只命中目标子集。
code/X1/part2_namespace/x1_9_cross_agent_query.py:46
↓ 2 callersMethodget_examples_by_skill
(self, skill_name: str)
code/X2/services/query_service.py:47
↓ 2 callersMethodget_skill_by_name
(self, name: str)
code/X2/services/skill_service.py:28
↓ 2 callersFunctionget_top1_snippet
提取 Top-1 结果的前 65 个字符
code/D3/d3_3_compare.py:36
↓ 2 callersMethodinit
Initialize or reset storage collections.
code/X2/storage/base.py:15
↓ 2 callersMethodis_initialized
Return True if storage has been initialized.
code/X2/storage/base.py:19
↓ 2 callersMethodlist_skills
( self, category: str | None = None, status: str | None = None, )
code/X2/storage/seekdb_storage.py:146
↓ 2 callersMethodmigrate_skill_file
(self, skill_file_path: str, force: bool = False)
code/X2/services/migration_service.py:27
↓ 2 callersFunctionprint_results
格式化打印搜索结果
code/D2/d2_2_vector_search.py:31
↓ 2 callersFunctionquery_facts_only
仅从事实库语义搜索(模拟)
code/X1/part3_consolidation/x1_13_profile_vs_facts.py:127
↓ 2 callersFunctionquery_profile_only
仅从画像中查询,返回匹配的字段
code/X1/part3_consolidation/x1_13_profile_vs_facts.py:32
↓ 2 callersFunctionshow_memory_stats
显示当前记忆库状态
code/D4/d4_4_memory_agent.py:147
↓ 2 callersFunctiontwo_stage_retrieval
两阶段检索: 1. 粗筛:过滤 semantic_score < quality_threshold 的记忆 2. 精排:semantic_score × retention(如果 use_decay=True)
code/X1/part1_decay_conflict/x1_3_retrieval_with_decay.py:94
↓ 1 callersMethod_determine_priority
Determine priority for a rule. Args: rule_text: Rule text rule_type: Rule type
code/X2/parsers/rule_extractor.py:222
↓ 1 callersMethod_determine_rule_type
Determine rule type from section title. Args: section_title: Section title (e.g., "### Syntax section")
code/X2/parsers/rule_extractor.py:138
↓ 1 callersMethod_extract_category
Extract category from skill name or frontmatter. Args: name: Skill name frontmatter: Frontmatter dic
code/X2/parsers/markdown_parser.py:79
↓ 1 callersMethod_extract_list_items
Extract list items from content. Args: content: Section content Returns: List o
code/X2/parsers/rule_extractor.py:158
↓ 1 callersMethod_find_code_blocks
Find all code blocks in the content. Returns: List of dictionaries with code block information
code/X2/parsers/example_extractor.py:67
↓ 1 callersMethod_find_description_before_block
Find description before a code block. Args: block_start: Start position of code block in content
code/X2/parsers/example_extractor.py:215
↓ 1 callersMethod_find_result_after_block
Find execution result after a code block. Looks for text or code blocks immediately after the code block. A
code/X2/parsers/example_extractor.py:148
↓ 1 callersMethod_find_rule_sections
Find all rule sections in the content. Returns: List of dictionaries with 'title' and 'content' keys
code/X2/parsers/rule_extractor.py:96
↓ 1 callersMethod_find_title_for_block
Find title for a code block. Looks for text before the code block that might be a title. Args:
code/X2/parsers/example_extractor.py:100
↓ 1 callersMethod_generate_rule_key
Generate a rule key from rule text. Args: rule_text: Rule text rule_type: Rule type
code/X2/parsers/rule_extractor.py:189
↓ 1 callersFunction_group_by_topic
按话题分组(简化实现:用关键词重叠)
code/X1/part1_decay_conflict/x1_6_retrieval_aggregate.py:71
↓ 1 callersFunction_induce_pattern
模拟 LLM 从同类经验中归纳模式
code/X1/part3_consolidation/x1_14_experience_distill.py:70
↓ 1 callersMethod_metadata_to_example
(self, meta: dict, doc_id: str, document: str)
code/X2/storage/seekdb_storage.py:344
↓ 1 callersMethod_metadata_to_rule
(self, meta: dict, doc_id: str, document: str)
code/X2/storage/seekdb_storage.py:332
↓ 1 callersFunction_parse_metadata
(raw: Any)
code/X2/storage/seekdb_storage.py:31
↓ 1 callersFunction_port_open
(host: str, port: int, timeout: float = 2.0)
code/X2/database/seekdb_client.py:65
↓ 1 callersFunction_split_expected_answer
把 expected_answer 切成关键词列表。 中文预期答案常含「,」「、」等标点而无空格,仅用 split() 会得到整句—— 改为先按标点/空格切分,再丢掉过短的片段。
code/X1/part3_consolidation/x1_15_benchmark_runner.py:152
↓ 1 callersFunctionadd_memory
将提炼出的事实存入 seekdb 记忆库
code/D4/d4_3_with_memory.py:99
↓ 1 callersFunctionask_agent
Agentic RAG 主循环: Agent 自主决定是否调用工具,基于检索结果生成回答
code/D3/d3_2_agentic_rag.py:95
↓ 1 callersFunctionbuildWall
(contributors)
scripts/contributor-wall.mjs:1
↓ 1 callersFunctioncalculate_retention
使用指定 λ 计算保留率
code/X1/part3_consolidation/x1_15_benchmark_runner.py:55
↓ 1 callersFunctioncalculate_retention
(created_at: datetime, memory_type: str, access_count: int)
code/X1/part1_decay_conflict/x1_3_retrieval_with_decay.py:37
↓ 1 callersFunctionchat
完整记忆 Agent: - 程序记忆(System Prompt):定义行为规则 - 语义记忆(seekdb):存储用户事实和偏好 - 情景记忆(seekdb):存储过去的成功经验(本示例简化为同一个库)
code/D4/d4_4_memory_agent.py:165
↓ 1 callersFunctionchunk_document
将长文档切分为带重叠的小片段。 overlap(重叠)确保片段边界处的语义不丢失。
code/D2/d2_1_ingest.py:22
↓ 1 callersFunctionclassify_memory_type
模拟 PowerMem _classify_memory_type
code/X1/part3_consolidation/x1_11_consolidation_passive.py:34
↓ 1 callersFunctioncluster_experiences
按领域聚类经验,归纳为经验模式
code/X1/part3_consolidation/x1_14_experience_distill.py:53
↓ 1 callersMethodcreate_skill
(self, skill: Skill)
code/X2/services/skill_service.py:25
↓ 1 callersMethoddelete_examples_by_skill
(self, skill_name: str)
code/X2/storage/seekdb_storage.py:274
↓ 1 callersMethoddelete_examples_by_skill
(self, skill_name: str)
code/X2/storage/base.py:73
↓ 1 callersMethoddelete_rules_by_skill
(self, skill_name: str)
code/X2/storage/seekdb_storage.py:230
↓ 1 callersMethoddelete_rules_by_skill
(self, skill_name: str)
code/X2/storage/base.py:59
↓ 1 callersMethoddelete_skill_by_name
Delete skill and all related rules/examples.
code/X2/storage/base.py:45
↓ 1 callersFunctiondetect_conflict
冲突检测主流程: 1. 向量相似度粗筛,取 ≥ threshold 的候选 2. 规则路由:判断动作类型
code/X1/part1_decay_conflict/x1_4_conflict_detect.py:79
↓ 1 callersFunctiondeterministic_aggregate
确定性聚合策略: - 同一话题只返回最新 active 版本 - 多个话题分别返回各自的 active 版本 - 并存偏好全部返回但标注
code/X1/part1_decay_conflict/x1_6_retrieval_aggregate.py:28
↓ 1 callersFunctionensure_storage
(db_path: str)
code/X2/tools/query_tool.py:25
↓ 1 callersFunctionevaluate_answer
检查返回的记忆中是否包含预期答案的关键词。 判定标准:expected_keywords 中至少有一个长度 ≥ 2 的关键词出现在 top-3 内容里。
code/X1/part3_consolidation/x1_15_benchmark_runner.py:140
↓ 1 callersFunctionexample_doc_id
(skill_name: str, order_index: int)
code/X2/database/collections.py:18
↓ 1 callersFunctionexecute_search
调用 seekdb 混合检索,返回格式化的检索结果
code/D3/d3_2_agentic_rag.py:73
↓ 1 callersFunctionextract_experience_triples
从情景记忆中提取经验三元组:(问题情境, 采取方案, 结果) 实际系统中由 LLM 完成: "从以下交互记录中提取 (问题, 方案, 结果) 三元组"
code/X1/part3_consolidation/x1_14_experience_distill.py:32
↓ 1 callersFunctionextract_facts
用 LLM 从对话中提炼关键事实
code/D4/d4_4_memory_agent.py:68
↓ 1 callersFunctionextract_facts_from_conversation
用 LLM 从一轮对话中提炼关键事实。 只提取关于用户的客观事实和偏好,不提取通用知识。
code/D4/d4_3_with_memory.py:46
next →1–100 of 230, ranked by callers