Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bojieli/ai-agent-book
/ functions
Functions
13,003 in github.com/bojieli/ai-agent-book
⨍
Functions
13,003
◇
Types & classes
1,574
↳
Endpoints
161
↓ 2 callers
Function
make_history
(tmp_path, monkeypatch)
chapter3/user-memory/test_search_history_limit_zero.py:18
↓ 2 callers
Function
make_silence
(ms: int, out_path: str | Path)
chapter6/controllable-tts/tts.py:69
↓ 2 callers
Function
map_role_label
(role: str)
chapter2/prompt-engineering/tau_bench/envs/user.py:278
↓ 2 callers
Method
mark_closed
(self)
chapter10/parallel-web-research/agents.py:55
↓ 2 callers
Method
mark_invalid
(self, reason: str)
chapter9/browser-use-rpa/learning_agent/workflow.py:262
↓ 2 callers
Function
markdownToText
(markdown)
chapter6/live-audio/backend/utils/textProcessor.js:10
↓ 2 callers
Function
markdown_fidelity
(source: str, translation: str)
chapter10/book-translation/run_official_experiment.py:143
↓ 2 callers
Function
match_entity
在查询中找出出现的起始实体(按名字最长匹配,确定性)。
chapter3/structured-index/structured_vs_flat_demo.py:165
↓ 2 callers
Function
match_intents
返回任务涉及的 (专用工具名, 能力需求描述) 列表(去重、保序)。
chapter4/active-tool-discovery/offline_backend.py:85
↓ 2 callers
Function
matches_any
Report whether ``value`` equals one of ``candidates`` up to rounding. Args: value: The number to look up. candidates: Numbers the
chapter1/context/grounding.py:79
↓ 2 callers
Function
matches_expected
(response: str, aliases: list[str])
chapter6/end-to-end-speech/demo.py:30
↓ 2 callers
Function
matrix_metrics
(matrix: np.ndarray)
chapter2/attention_visualization/run_attention_experiment.py:57
↓ 2 callers
Function
measure
(text, size, weight)
scripts/book_figures/typography.py:33
↓ 2 callers
Function
measure_anthropic
Measure Anthropic's native streaming Messages API.
chapter7/model-benchmark/campaign.py:615
↓ 2 callers
Function
measure_gemini
Measure Google's native Gemini streaming API, including thought usage.
chapter7/model-benchmark/campaign.py:703
↓ 2 callers
Function
member
(document, href)
scripts/kindle_epub_patcher.py:34
↓ 2 callers
Function
memory_pipeline_example
Demonstrate Mem0 v3's ADD-only extraction and hybrid retrieval. The user first says they live in Beijing and later says they moved to Shangha
chapter3/mem0/quickstart.py:74
↓ 2 callers
Function
memory_text
(memory: dict[str, Any], fmt: str)
chapter7/user-memory-policy-eval/runner.py:90
↓ 2 callers
Function
mergeBackup
( existing: Annotation[], imported: Annotation[], makeId: () => string, )
web-astro/src/lib/annotations.ts:112
↓ 2 callers
Function
merge_rules
把候选规则合并进现有规则集,返回 (规则集, 合并报告)。
chapter9/ai-style-skill/skill_manager.py:23
↓ 2 callers
Function
message_to_action
( message: Dict[str, Any], )
chapter2/prompt-engineering/tau_bench/agents/tool_calling_agent.py:83
↓ 2 callers
Function
mode
()
chapter6/phone-agent/static/app.js:16
↓ 2 callers
Function
monitor_fast_task
Monitor task with optimized polling for fast execution. Args: task_id: The task to monitor Returns: Complete task details with output
chapter9/browser-use-rpa/browser-use/examples/cloud/02_fast_mode_gemini.py:104
↓ 2 callers
Method
mono
Monospace text for code snippets.
book-en/svg_lib.py:356
↓ 2 callers
Method
mono
Monospace text for code snippets.
book-tr/svg_lib.py:356
↓ 2 callers
Method
mono
Monospace text for code snippets.
book-ar/svg_lib.py:382
↓ 2 callers
Method
mono
Monospace text for code snippets.
book-ru/svg_lib.py:356
↓ 2 callers
Method
mono
Monospace text for code snippets.
book-es/svg_lib.py:356
↓ 2 callers
Method
mono
Кодын хэсгийг тогтмол өргөнтэй фонтоор дүрсэлнэ.
book-mn/svg_lib.py:356
↓ 2 callers
Method
mono
Monospace text for code snippets.
book-id/svg_lib.py:356
↓ 2 callers
Function
move
(y)
scripts/book_figures/typography.py:109
↓ 2 callers
Method
move_file
Move or rename a file/directory. Args: source: Source path destination: Destination path
chapter4/execution-tools/filesystem_enhanced.py:437
↓ 2 callers
Function
move_path
Move a file/directory inside the explicit mutation workspace.
chapter4/perception-tools/src/filesystem_tools.py:163
↓ 2 callers
Function
movementFor
(lesson)
slides/generate.mjs:96
↓ 2 callers
Function
multi_hop_paths
从 start 出发沿关系边做 BFS,返回所有 <= max_hops 跳的关系路径。 每条路径是若干 (源实体, 关系, 目标实体) 步骤的列表。这正是扁平检索无法表达的 「沿关系边遍历」——对应书中「知识图谱天然支持沿关系边遍历,使多跳查询高效可靠」。
chapter3/structured-index/structured_vs_flat_demo.py:142
↓ 2 callers
Method
must_get_element_by_prompt
Get an element by a prompt. @dev LLM can still return None, this just raises an error if the element is not found.
chapter9/browser-use-rpa/browser-use/browser_use/actor/page.py:444
↓ 2 callers
Function
ndcg_at_k
(ranked_ids: List[str], gold: Sequence[str], k: int)
chapter3/retrieval-pipeline/evaluate.py:357
↓ 2 callers
Function
nearest_archetype
把一条(可能不完整的)案件匹配到最近的案件原型:先按罪名圈定候选, 再只在**已知维度**上比距离(避免用缺失维=0 误导匹配)。
chapter3/structured-knowledge-extraction/archetypes.py:201
↓ 2 callers
Function
normalize
去掉标点/空白,只保留 CJK / 字母 / 数字,并小写,便于逐字比较。
chapter7/tts-quality-eval/pipeline.py:301
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/training-sequences-figures.test.mjs:23
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/retrieval-structure-layout.test.mjs:7
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/evolution-methods-figures.test.mjs:11
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/collaboration-context-figures.test.mjs:13
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/training-systems-figures.test.mjs:15
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/training-foundations-figures.test.mjs:25
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/collaboration-manager-figures.test.mjs:13
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/evolution-flow-figures.test.mjs:17
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/memory-foundation-layout.test.mjs:16
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/training-workflows-figures.test.mjs:15
↓ 2 callers
Function
normalize
(value)
web-astro/scripts/collaboration-society-figures.test.mjs:12
↓ 2 callers
Function
normalize_findings
(text: str, findings: List[Dict[str, Any]])
chapter3/log-sanitization/campaign.py:88
↓ 2 callers
Function
normalize_for_cer
Normalize width, case, Chinese script, whitespace, and punctuation.
chapter6/streaming-speech/demo.py:28
↓ 2 callers
Function
normalize_task_decomp_response
Keep only parseable duration rows, bounded by the requested total.
chapter10/generative-agents/run_campaign.py:104
↓ 2 callers
Function
numberToWords
(num)
chapter6/live-audio/backend/utils/textProcessor.js:40
↓ 2 callers
Method
observe_scene
(self)
chapter6/gemini-xlerobot-navigation/desktop_planner.py:58
↓ 2 callers
Function
ok
(msg)
chapter6/live-audio/backend/check-setup.js:25
↓ 2 callers
Function
on_page_content
MkDocs hook entry point (see module docstring).
scripts/mkdocs_figure_captions.py:100
↓ 2 callers
Function
on_page_markdown
Expand the homepage template; never rewrite checked-in source files.
scripts/homepage_index.py:98
↓ 2 callers
Function
op_context
(user)
chapter3/memobase/profile_demo.py:169
↓ 2 callers
Function
op_event
(user)
chapter3/memobase/profile_demo.py:157
↓ 2 callers
Function
op_flush
(user)
chapter3/memobase/profile_demo.py:141
↓ 2 callers
Function
op_insert
(user, conversation)
chapter3/memobase/profile_demo.py:132
↓ 2 callers
Function
op_profile
(user)
chapter3/memobase/profile_demo.py:147
↓ 2 callers
Function
open_file
Open file with default system viewer
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:276
↓ 2 callers
Function
openrouter_key
Read the OpenRouter API key from the environment. Returns: The value of ``OPENROUTER_API_KEY``, stripped, or ``""`` when unset.
agentbook/providers/openrouter.py:37
↓ 2 callers
Function
openrouter_model_id
Map a provider-native model name to an OpenRouter model id, used by the universal OpenRouter fallback. An explicit OPENROUTER_MODEL env var wins.
chapter3/user-memory/config.py:22
↓ 2 callers
Function
optimize_prompt
让 Coding Agent 根据 human feedback 改写 prompt_path 指向的文件(原地覆盖)。 返回 {"before": 原文, "after": 新文, "diff": 统一 diff 文本, "rationale": 说明}。
chapter9/prompt-auto-optimization/coding_agent.py:82
↓ 2 callers
Function
original_source_map
Map staged absolute paths to existing source files in the repository.
scripts/site_source_paths.py:50
↓ 2 callers
Function
package_version
(distribution: str)
chapter1/context/run_experiment_1_1.py:70
↓ 2 callers
Function
page_query
One query fetching `pages` stargazer pages, each from its own cursor.
scripts/gen_star_history.py:162
↓ 2 callers
Function
pair
(k, a, b, x, y, w, { fill = '#f0f0f0', h } = {})
web-astro/scripts/coding-core-layout.mjs:24
↓ 2 callers
Function
paired_analysis
(control: list[dict], codified: list[dict])
chapter5/small-model-codified-rules/demo.py:159
↓ 2 callers
Function
paired_statistics
Preregistered paired accuracy analysis (exact McNemar/binomial test).
chapter5/code-for-logic/demo.py:367
↓ 2 callers
Function
parse
解析带控制标记的文本,返回片段列表。 若传入 trace(list),会把「标记 -> 动作」的解析过程逐条记入,便于打印。
chapter6/controllable-tts/markup.py:56
↓ 2 callers
Function
parseBackup
( value: unknown, expectedChapter = chapterKey, )
web-astro/src/lib/annotations.ts:40
↓ 2 callers
Function
parsePcmWav
(filePath)
chapter6/live-audio/backend/run_real_validation.js:34
↓ 2 callers
Function
parsePosition
( raw: string | null, chapter: string, )
web-astro/src/lib/reading-position.ts:12
↓ 2 callers
Method
parse_force
( self, instruction: str, typ: type[T] | dict[str, Any], text: str | None = No
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:336
↓ 2 callers
Function
parse_json
(raw: str)
chapter7/user-memory-policy-eval/runner.py:75
↓ 2 callers
Function
parse_json
(text: str)
chapter3/memory_rag_campaign.py:44
↓ 2 callers
Function
parse_json_object
(text: str)
chapter10/generative-agents/judge_plausibility.py:150
↓ 2 callers
Function
parse_json_or_json_markdown
(text: str)
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:76
↓ 2 callers
Function
parse_label
(text: Optional[str])
chapter8/prompt-distillation/run_experiment_8_8.py:184
↓ 2 callers
Function
parse_sweep_levels
(raw: str)
chapter7/model-benchmark/demo.py:316
↓ 2 callers
Function
parse_time
(value: str)
chapter7/model-benchmark/analysis.py:59
↓ 2 callers
Function
parse_tool_calls
(raw_text: str)
chapter2/local_llm_serving/run_experiment.py:47
↓ 2 callers
Function
parser
()
chapter7/model-benchmark/campaign.py:1021
↓ 2 callers
Function
percentile
(values: Sequence[float], q: float)
chapter7/model-benchmark/analysis.py:30
↓ 2 callers
Function
pipelineArrows
(arrow, y)
web-astro/scripts/evolution-flow-figures.mjs:152
↓ 2 callers
Function
plain
(text)
web-astro/scripts/chapter3-figure-kit.mjs:22
↓ 2 callers
Function
positive_provider_usage
Accept provider usage objects even when they contain nested details.
chapter10/generative-agents/validate_campaign.py:55
↓ 2 callers
Function
prepare
(destination: Path)
chapter2/agent-skills-ppt/prepare_official_skill.py:26
↓ 2 callers
Function
print_comparison_table
Render the cross-strategy comparison table (latency / cache / cost).
chapter2/kv-cache/main.py:95
↓ 2 callers
Function
print_conversation
(conversation: list[dict])
chapter3/memobase/profile_demo.py:74
↓ 2 callers
Method
print_header
Print CLI header
chapter5/coding-agent/main.py:55
↓ 2 callers
Function
print_results_table
Print a formatted table of results
chapter2/prompt-engineering/analyze_results.py:114
↓ 2 callers
Function
print_run_summary
打印一次运行的移交链、分工总览与最终成果。
chapter10/multi-role-transfer/demo.py:178
↓ 2 callers
Function
print_section
Print a section header
chapter3/contextual-retrieval/demo.py:36
↓ 2 callers
Method
print_summary
Print a human-readable summary of metrics
chapter3/log-sanitization/metrics.py:142
↓ 2 callers
Function
print_sweep_table
打印并发压测表:每一行是一个并发档位,展示延迟长尾(p50/p95/p99/std)、 可用性与聚合吞吐(RPS / tokens·s⁻¹)随并发的变化。
chapter7/model-benchmark/demo.py:136
← previous
next →
2,501–2,600 of 13,003, ranked by callers