MCPcopy Create free account

hub / github.com/bojieli/ai-agent-book / functions

Functions13,003 in github.com/bojieli/ai-agent-book

↓ 1 callersFunctionbuild_annotations
( config: dict[str, Any], run_dir: Path, timeout_action_steps: int, )
chapter7/openvla-robotwin2-eval/annotate_timeouts.py:52
↓ 1 callersFunctionbuild_arg_parser
构造命令行参数解析器(提供中文 --help)。
chapter5/dynamic-form/demo.py:583
↓ 1 callersFunctionbuild_arg_parser
命令行参数:位置参数为中文剪辑需求,另有输入/输出/后端/模型/快速等开关。
chapter5/video-edit/demo.py:48
↓ 1 callersFunctionbuild_arg_parser
构造命令行参数解析器(提供 --help / --quick / --model)。
chapter5/adaptive-log-parser/demo.py:258
↓ 1 callersFunctionbuild_arg_parser
()
chapter3/contextual-retrieval/compare_retrieval.py:243
↓ 1 callersFunctionbuild_arg_parser
()
chapter3/contextual-retrieval-for-user-memory/contextual_compare.py:225
↓ 1 callersFunctionbuild_arms
按 --mode / --big-model 组装本次要跑的对照臂。默认(both、无大模型) 与旧版行为一致:控制组 + 实验组,均在小模型上。
chapter5/small-model-codified-rules/demo.py:84
↓ 1 callersFunctionbuild_classify_prompts
( dps: list[ClassifyDatapoint], suffix_strategy: PromptSuffixStrategy | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:506
↓ 1 callersFunctionbuild_classify_prompts
( dps: list[ClassifyDatapoint], include_response: bool = True, )
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:419
↓ 1 callersFunctionbuild_client
()
chapter9/self-evolving-tools/agent.py:55
↓ 1 callersFunctionbuild_client
构造并连通 Memobase 客户端(联网)。失败时给出可操作的提示。
chapter3/memobase/profile_demo.py:81
↓ 1 callersFunctionbuild_client_and_model
构造 OpenAI 客户端与模型名,含通用 OpenRouter 兜底。
chapter5/dynamic-form/demo.py:79
↓ 1 callersFunctionbuild_client_and_model
根据环境变量构造 OpenAI 客户端与默认模型名。 优先级:OPENAI_API_KEY > MOONSHOT_API_KEY > ARK_API_KEY,均缺失时走 OPENROUTER_API_KEY。 这些服务都兼容 OpenAI 的 chat.completions +
chapter5/code-for-math/demo.py:56
↓ 1 callersFunctionbuild_client_and_model
构造 OpenAI 客户端并返回 (client, model)。 - 有 OPENAI_API_KEY:直连(默认模型 gpt-4o-mini 是普通 gpt id,可直连 OpenAI)。 仅当模型是 gpt-5.x 且同时设置了 OPENROUTER_API_KEY 时才
chapter5/code-for-logic/demo.py:83
↓ 1 callersFunctionbuild_columns
根据 schema + 抽取结果确定有序特征列(列名自描述其含义)。
chapter3/structured-knowledge-extraction/archetypes.py:33
↓ 1 callersFunctionbuild_config
把命令行参数组装成 Config。
chapter5/paper-to-video/demo.py:587
↓ 1 callersFunctionbuild_confusion_matrix
Build confusion matrix and identify problematic languages. Returns: Dict with confusion matrix, per-language stats, and error ex
chapter8/prompt-distillation/evaluate.py:183
↓ 1 callersFunctionbuild_controlled_tau_airline_matrix
()
chapter5/small-model-codified-rules/tasks.py:156
↓ 1 callersFunctionbuild_corpus
(n_docs: int)
chapter3/dense-embedding/benchmark.py:77
↓ 1 callersFunctionbuild_curated
()
chapter5/code-for-logic/build_puzzles.py:161
↓ 1 callersFunctionbuild_dataset
GRPO 数据集:prompt 列给模型,task 列透传给奖励函数。
chapter8/premature-completion-dpo/train_grpo_optional.py:63
↓ 1 callersMethodbuild_dataset
Build and save the complete dataset
chapter3/contextual-retrieval/evaluation/dataset_builder.py:154
↓ 1 callersMethodbuild_dataset
Build and save the complete dataset
chapter3/agentic-rag/evaluation/dataset_builder.py:154
↓ 1 callersFunctionbuild_evidence
(cases, trajectories, reports, client, command)
chapter9/trajectory-verifier/run_experiment_9_1.py:37
↓ 1 callersFunctionbuild_feature_space
(schema: Dict[str, Any], training: List[Dict[str, Any]])
chapter3/structured-knowledge-extraction/campaign.py:357
↓ 1 callersMethodbuild_generate_message_state
( self, messages: list[Message], )
chapter2/prompt-engineering/tau_bench/model_utils/model/claude.py:108
↓ 1 callersFunctionbuild_graph
(pages: list[dict[str, Any]], ark: CachedCalls, model: str, encoder: Encoder)
chapter3/structured-index/campaign.py:236
↓ 1 callersFunctionbuild_graph
(triples: List[Tuple[str, str, str]])
chapter3/structured-index/structured_vs_flat_demo.py:133
↓ 1 callersFunctionbuild_index
Build RAPTOR and/or GraphRAG index from text or file.
chapter3/structured-index/api_service.py:121
↓ 1 callersFunctionbuild_indexes
Build RAPTOR and/or GraphRAG indexes from a document.
chapter3/structured-index/main.py:18
↓ 1 callersMethodbuild_indexes
Build or rebuild indexes by sending all chunks to retrieval pipeline
chapter3/agentic-rag-for-user-memory/indexer.py:345
↓ 1 callersMethodbuild_indexes
Build or rebuild indexes by sending all chunks to retrieval pipeline
chapter3/contextual-retrieval-for-user-memory/indexer.py:244
↓ 1 callersFunctionbuild_input_ids
Tokenize the prompt, optionally via the model's chat template.
chapter2/attention_visualization/attention_cli.py:137
↓ 1 callersFunctionbuild_issue
把一条诊断问题 + 关联回归测试用例,渲染成 GitHub Issue 结构。
chapter5/log-diagnosis/github_mcp.py:29
↓ 1 callersFunctionbuild_leaderboard
Build Elo leaderboard from voting data. Args: df: DataFrame with columns 'model_a', 'model_b', 'winner' initial_rating:
chapter7/elo-leaderboard/leaderboard.py:11
↓ 1 callersFunctionbuild_manifest
(run_dir: Path)
chapter7/openvla-robotwin2-eval/finalize_evidence.py:72
↓ 1 callersFunctionbuild_manifest
(run_id: str, run_dir: Path, summary: dict[str, Any])
chapter8/MiniMind-pretrain/validation/run_training_report_audit.py:626
↓ 1 callersFunctionbuild_manifest
(run_id: str, run_dir: Path, summary: dict[str, Any])
chapter8/MiniMind-pretrain/validation/run_vlm_training_report_audit.py:773
↓ 1 callersFunctionbuild_manifest
(run_id: str, run_dir: Path, summary: dict[str, Any])
chapter8/continued-pretraining/validation/run_report_audit.py:653
↓ 1 callersFunctionbuild_manifest
(campaign_dir: Path, summary: dict[str, Any])
chapter6/agent-with-event-trigger/unipile_mailbox_experiment.py:622
↓ 1 callersFunctionbuild_manifest
(campaign_dir: Path, summary: dict[str, Any])
chapter4/perception-tools/run_experiment_4_2.py:550
↓ 1 callersFunctionbuild_manifest
(campaign_dir: Path)
chapter4/active-tool-discovery/run_exact_experiment.py:1049
↓ 1 callersFunctionbuild_messages
构造第 idx 轮要发给模型的 messages,并返回本轮输入里「工具返回注入」的累计 token。 kv_cache=True → system 用逐字节稳定的长前缀(可被 OpenAI 自动缓存); kv_cache=False → 每轮在 system 最前面塞随机 se
chapter7/agent-cost-analysis/agent.py:198
↓ 1 callersFunctionbuild_pair
(task)
chapter4/active-tool-discovery/compare_candidate_order.py:12
↓ 1 callersFunctionbuild_parser
()
chapter7/agent-cost-analysis/demo.py:205
↓ 1 callersFunctionbuild_parser
()
chapter7/elo-leaderboard/cli.py:284
↓ 1 callersFunctionbuild_parser
()
chapter5/erp-agent/demo.py:315
↓ 1 callersFunctionbuild_parser
()
chapter5/small-model-codified-rules/demo.py:289
↓ 1 callersFunctionbuild_parser
()
chapter5/coding-agent/main.py:403
↓ 1 callersFunctionbuild_parser
()
chapter6/async-agent/demo.py:223
↓ 1 callersFunctionbuild_parser
()
chapter6/agent-with-event-trigger/event_loop_demo.py:288
↓ 1 callersFunctionbuild_parser
构建命令行参数解析器(命令行参数优先级高于环境变量)。
chapter6/agent-with-event-trigger/server.py:396
↓ 1 callersFunctionbuild_parser
构建命令行参数解析器
chapter2/context-compression/run_all_strategies.py:361
↓ 1 callersFunctionbuild_parser
构建命令行参数解析器
chapter2/context-compression/experiment.py:286
↓ 1 callersFunctionbuild_parser
()
chapter2/attention_visualization/attention_cli.py:50
↓ 1 callersFunctionbuild_parser
()
chapter2/local_llm_serving/benchmark.py:337
↓ 1 callersFunctionbuild_parser
()
chapter2/prompt-injection/demo.py:202
↓ 1 callersFunctionbuild_parser
()
chapter9/self-evolving-tools/demo.py:239
↓ 1 callersFunctionbuild_parser
构建命令行参数解析器(RPA 邮件学习/回放演示)。
chapter9/browser-use-rpa/demo_email.py:289
↓ 1 callersFunctionbuild_parser
()
chapter10/voice-werewolf/demo.py:174
↓ 1 callersFunctionbuild_parser
构建命令行参数解析器(中文帮助)
chapter1/web-search-agent/main.py:138
↓ 1 callersFunctionbuild_parser
()
chapter4/active-tool-selection/demo_comparison.py:409
↓ 1 callersFunctionbuild_parser
()
chapter4/collaboration-tools/main.py:267
↓ 1 callersFunctionbuild_parser
()
chapter4/perception-tools/cli.py:463
↓ 1 callersFunctionbuild_parser
()
chapter4/execution-tools/cli.py:325
↓ 1 callersFunctionbuild_parser
()
chapter4/active-tool-discovery/demo.py:54
↓ 1 callersFunctionbuild_parser
构建实验 4-3 的命令行接口。
chapter4/multimodal-agent/demo.py:234
↓ 1 callersFunctionbuild_parser
()
chapter3/agentic-rag-for-user-memory/offline_demo.py:259
↓ 1 callersFunctionbuild_parser
()
chapter3/user-memory/run_evaluation.py:432
↓ 1 callersFunctionbuild_parser
()
chapter3/user-memory/memory_cli.py:225
↓ 1 callersFunctionbuild_parser
()
chapter3/dense-embedding/cli.py:344
↓ 1 callersFunctionbuild_parser
()
chapter3/sparse-embedding/cli.py:270
↓ 1 callersFunctionbuild_parser
()
chapter3/memobase/profile_demo.py:213
↓ 1 callersFunctionbuild_patch
()
chapter9/hermes-self-evolution/finalize_evidence.py:47
↓ 1 callersFunctionbuild_pricing
根据 --model 预设 + --price-* 覆盖,构造本次计费用的单价。
chapter7/agent-cost-analysis/demo.py:44
↓ 1 callersFunctionbuild_prompts
(dps: list[Datapoint], include_response: bool = True)
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:355
↓ 1 callersFunctionbuild_providers
返回 (available, skipped)。 若指定了 --base-url 或 --model,则构造单个自定义提供商(覆盖默认列表)。
chapter7/model-benchmark/demo.py:251
↓ 1 callersFunctionbuild_raptor
(pages: list[dict[str, Any]], ark: CachedCalls, model: str, encoder: Encoder)
chapter3/structured-index/campaign.py:188
↓ 1 callersFunctionbuild_roles
按玩家总数推导身份组成:默认 7 人 = 2 狼人 + 1 预言家 + 1 女巫 + 3 村民。 - wolves 未指定时按 max(1, players // 3) 估算(7 人得 2 狼,与书中默认一致)。 - 4 人及以上配 1 预言家,5 人及以上再配 1 女巫,其余全为
chapter10/voice-werewolf/werewolf/game.py:21
↓ 1 callersFunctionbuild_sample
(archive: Path, sample_path: Path, seed: int, train_per_charge: int, heldout_per_charge: int)
chapter3/structured-knowledge-extraction/campaign.py:82
↓ 1 callersFunctionbuild_segment
把「一页 PNG + 该页音频」合成为一段 mp4。 用 -t 把整段时长精确锁定为该页音频时长,保证“每页展示时间与语音时长精确匹配” (仅靠 -loop + -shortest 会让静态图轨比音频多出约 1~2 秒)。
chapter5/paper-to-video/demo.py:336
↓ 1 callersFunctionbuild_snapshot_lookup
Build a lookup table of backend node ID to enhanced snapshot data with everything calculated upfront.
chapter9/browser-use-rpa/browser-use/browser_use/dom/enhanced_snapshot.py:47
↓ 1 callersMethodbuild_system_prompt
(self, instruction: Optional[str])
chapter2/prompt-engineering/tau_bench/envs/user.py:181
↓ 1 callersMethodbuild_table
Build a Rich comparison table (layers as rows, systems as columns).
chapter3/user-memory-evaluation/comparison.py:115
↓ 1 callersFunctionbuild_token_counter
构造一个 token 计数函数,按优先级回退,保证离线可用。 返回 (counter, method_description): 1) 若指定 --tokenizer,用 HuggingFace 分词器精确计数(GPU 机器上可得到 Qwen 的真实 token 数)
chapter8/prompt-distillation/compare.py:47
↓ 1 callersFunctionbuild_trace
(output: Path, arm: str, persona: str, seed_count: int)
chapter10/generative-agents/judge_plausibility.py:58
↓ 1 callersMethodbuild_tree_level
Build one level of the tree by clustering and summarizing nodes.
chapter3/structured-index/raptor_indexer.py:125
↓ 1 callersFunctionbuild_unique_destination
在分类文件夹中为文件生成不冲突的目标路径。 保留原文件名;若同名文件已存在,则在扩展名前依次追加 _1、_2……, 直到找到不存在的名字为止,保证绝不覆盖已有文件。
chapter10/staged-system-prompt/runs/staged-system-prompt-kimi-k3-20260730-v2/workspace/organize_downloads.py:46
↓ 1 callersFunctionbuild_user_prompt
(case: dict[str, Any], fmt: str)
chapter7/user-memory-policy-eval/runner.py:141
↓ 1 callersFunctioncache_loading
()
scripts/book_figures/chapter4.py:61
↓ 1 callersFunctioncached_json_call
( path: Path, client: OpenAI, *, provider: str, model: str, messages: list[dict[str, A
chapter5/paper-to-video/campaign.py:76
↓ 1 callersFunctioncached_revision
(model_name: str)
chapter3/retrieval-pipeline/campaign.py:25
↓ 1 callersMethodcalculate
Evaluate a mathematical expression Args: expression: Mathematical expression to evaluate Re
chapter1/context/agent.py:252
↓ 1 callersFunctioncalculateStats
()
chapter2/attention_visualization/frontend/components/AttentionStats.tsx:15
↓ 1 callersFunctioncalculate_expected_scores_vectorized
Vectorized calculation of expected scores for multiple matches. Args: ratings_a: Array of ratings for model A ratings_b:
chapter7/elo-leaderboard/optimized_elo.py:80
↓ 1 callersMethodcalculate_overall_metrics
Calculate overall benchmark metrics.
chapter3/mem0/experiment.py:299
↓ 1 callersMethodcalculate_paint_order
(self)
chapter9/browser-use-rpa/browser-use/browser_use/dom/serializer/paint_order.py:139
↓ 1 callersMethodcalculate_reward
(self)
chapter2/prompt-engineering/tau_bench/envs/base.py:126
↓ 1 callersMethodcalculate_scenario_metrics
Calculate overall metrics for a scenario.
chapter3/mem0/experiment.py:243
↓ 1 callersFunctioncall
(tool: str, method: str, path: str, **kwargs: Any)
chapter5/log-diagnosis/campaign.py:224
← previousnext →4,301–4,400 of 13,003, ranked by callers