MCPcopy Create free account

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

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

↓ 2 callersFunctionensure_ffmpeg
启动前自检:ffmpeg / ffprobe 是否可用,给出清晰中文报错。
chapter5/video-edit/ffmpeg_utils.py:29
↓ 2 callersFunctionesc
(value)
chapter1/context/vis_validation.py:20
↓ 2 callersFunctionescapeRe
(s)
extras/lang-switcher.js:182
↓ 2 callersFunctionescapeXml
(value)
web-astro/scripts/grpo-rollouts-figure.mjs:454
↓ 2 callersFunctionevaluate
( predictions: list[dict[str, Any]], expected_items: dict[str, dict[str, Any]], tolerance: float =
chapter7/public-health-reporting-eval/evaluator.py:92
↓ 2 callersMethodevaluate
(self, test_case: TestCase, answer: str, extracted_memory: Optional[str] = None)
chapter7/user-memory-system-evaluation/experiment.py:743
↓ 2 callersMethodevaluate
(self, trajectory: Dict[str, Any])
chapter9/trajectory-verifier/verifier.py:204
↓ 2 callersMethodevaluate
(self, trajectory: Dict[str, Any])
chapter9/trajectory-verifier/verifier.py:323
↓ 2 callersMethodevaluate
Evaluate the trained agent without learning. Args: num_episodes: Number of episodes to evaluate verb
chapter1/learning-from-experience/rl_agent.py:236
↓ 2 callersMethodevaluate_access
Evaluates whether an access context is allowed a privilege on a data object.
chapter5/permission-embedded-data-objects/run_live_security_eval.py:409
↓ 2 callersMethodevaluate_batch
Evaluate multiple test cases in batch. Args: agent_responses: Dictionary mapping test_id to agent response e
chapter3/user-memory-evaluation/framework.py:241
↓ 2 callersMethodevaluate_batch
Evaluate multiple test cases Args: test_ids: List of test IDs to evaluate (evaluates all if None) ca
chapter3/agentic-rag-for-user-memory/evaluator.py:472
↓ 2 callersMethodevaluate_coherence
Evaluate coherence of the conversation.
chapter3/mem0/agent.py:376
↓ 2 callersMethodevaluate_consistency
Evaluate consistency of responses in a session.
chapter3/mem0/agent.py:349
↓ 2 callersMethodevaluate_overhead_metrics
Measures policy evaluation latency vs raw un-checked execution.
chapter5/permission-embedded-data-objects/run_live_security_eval.py:725
↓ 2 callersFunctionevaluate_policy_records
(records: list[dict[str, Any]])
chapter5/agent-creator/reference_agent/domain_tools.py:21
↓ 2 callersMethodevaluate_response
Evaluate agent response for a task Args: task: The benchmark task response: Agent's response
chapter3/memobase/locomo_benchmark.py:228
↓ 2 callersMethodevaluate_scenario
Evaluates a single scenario across all security dimensions.
chapter5/permission-embedded-data-objects/run_live_security_eval.py:765
↓ 2 callersFunctionevaluate_strategy
(judge)
chapter10/voice-werewolf/werewolf/strategy_audit.py:91
↓ 2 callersFunctionevenly_sample
(rows: list[Any], maximum: int)
chapter10/generative-agents/judge_plausibility.py:32
↓ 2 callersFunctionexact_two_sided_sign_p_value
Exact two-sided paired sign test over discordant binary outcomes.
chapter8/cot-distillation/evaluate_student.py:37
↓ 2 callersMethodexecute
(name, call_args)
chapter9/harness-safety-gate/test_evolution.py:149
↓ 2 callersMethodexecute_code
在含当前工作区文件的临时目录里真实执行代码(带超时)。
chapter10/staged-system-prompt/tools.py:59
↓ 2 callersFunctionexecute_python
把源码写到临时文件并用子进程执行,返回 stdout(带超时)。
chapter10/multi-role-transfer/tools.py:118
↓ 2 callersMethodexecute_task
Execute a task using React pattern with tool calls and streaming support Args: task: The task/message from user
chapter3/user-memory/agent.py:614
↓ 2 callersMethodexecute_task
Execute a LOCOMO benchmark task Args: task: Task dictionary with 'id', 'type', 'query', and optional 'context'
chapter3/memobase/agent.py:454
↓ 2 callersFunctionexecute_test_case
Execute a test case against generated code.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_spec_errors_v2.py:257
↓ 2 callersMethodexecute_tool
在子进程沙箱中执行已封装的工具:注入代码 + run(**args),捕获 JSON 结果。 PYTHONPATH 指向 .sandbox_packages,使 create 时 pip 安装的依赖可用。
chapter9/self-evolving-tools/tool_manager.py:155
↓ 2 callersFunctionextensionChunks
(lesson)
slides/generate.mjs:86
↓ 2 callersFunctionextractLabels
(source, figure, expectedLabels, expectedShape)
web-astro/scripts/training-systems-figures.mjs:4
↓ 2 callersFunctionextractLabels
(source, figure, expectedLabels, expectedShape)
web-astro/scripts/training-sequences-figures.mjs:9
↓ 2 callersFunctionextractLabels
(source, figure, expectedLabels, expectedShape)
web-astro/scripts/evolution-methods-figures.mjs:44
↓ 2 callersFunctionextractLabels
(source, figure, expectedLabels, expectedShape)
web-astro/scripts/training-workflows-figures.mjs:4
↓ 2 callersFunctionextract_answer
从模型输出中解析整数答案。优先匹配 FINAL ANSWER,退化到最后一个整数。
chapter5/code-for-math/demo.py:149
↓ 2 callersFunctionextract_keywords
Extract relevant keywords from a requirement for matching.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_spec_errors.py:232
↓ 2 callersFunctionextract_latest_article
Open site_url, navigate to the newest article and return structured JSON.
chapter9/browser-use-rpa/browser-use/examples/apps/news-use/news_monitor.py:66
↓ 2 callersFunctionextract_one
从单条判例文本抽取 {charge, factors...}。缺失因子取 null。 charge 已知时(数据集抽取)直接沿用,省一次调用;未知时(对话新案情)先让 LLM 判定。
chapter3/structured-knowledge-extraction/extractor.py:39
↓ 2 callersFunctionextract_predicted_number
从模型输出中解析最终答案数值。优先匹配 Final Answer 标记,否则取最后一个数字。
chapter8/cot-distillation/generate_data.py:71
↓ 2 callersFunctionextract_profile
Extract only facts visible in the browser observation. The deterministic name-presence gate prevents a model from supplying a profile from pa
chapter10/parallel-web-research/llm.py:32
↓ 2 callersFunctionextract_text_ocr
Extract text from image using OCR. Args: image_path: Path to image file language: OCR language (eng, chi_sim, etc.)
chapter4/perception-tools/src/media_processing_tools.py:295
↓ 2 callersFunctionextract_video_keyframes
Extract keyframes from video. Args: video_path: Path to video file num_frames: Number of keyframes to extract
chapter4/perception-tools/src/media_processing_tools.py:461
↓ 2 callersFunctionfail
(msg)
chapter6/live-audio/backend/check-setup.js:27
↓ 2 callersFunctionfake_client
(payload)
chapter5/agent-creator/test_creator.py:46
↓ 2 callersFunctionfenced_code_payloads
(text: str)
chapter10/book-translation/run_official_experiment.py:131
↓ 2 callersFunctionfetch_forward
Every star after `cursor` (None for the whole history). Paging is sequential -- plain, documented cursor following -- unless there is enough
scripts/gen_star_history.py:287
↓ 2 callersFunctionfiber_ids
Return only real, succeeded Formula Fiber receipts.
chapter1/web-search-agent/run_experiment_1_2.py:49
↓ 2 callersFunctionfile_receipt
(path: Path)
chapter4/perception-tools/run_experiment_4_2.py:112
↓ 2 callersFunctionfind_font
()
chapter5/video-edit/ffmpeg_utils.py:22
↓ 2 callersFunctionfind_training_member
(archive: Path)
chapter3/structured-knowledge-extraction/campaign.py:53
↓ 2 callersFunctionfit_overflow
Return svg with over-wide text runs shrunk to fit their box/canvas.
book-en/svg_lib.py:199
↓ 2 callersFunctionfit_overflow
Return svg with over-wide text runs shrunk to fit their box/canvas.
book-tr/svg_lib.py:199
↓ 2 callersFunctionfit_overflow
Return svg with over-wide text runs shrunk to fit their box/canvas.
book-ar/svg_lib.py:215
↓ 2 callersFunctionfit_overflow
Return svg with over-wide text runs shrunk to fit their box/canvas.
book-ru/svg_lib.py:199
↓ 2 callersFunctionfit_overflow
Return svg with over-wide text runs shrunk to fit their box/canvas.
book-es/svg_lib.py:199
↓ 2 callersFunctionfit_overflow
Хайрцаг эсвэл зургийн хүрээнээс хальсан текстийн хэмжээг багасгасан svg буцаана.
book-mn/svg_lib.py:199
↓ 2 callersFunctionfit_overflow
Return svg with over-wide text runs shrunk to fit their box/canvas.
book-id/svg_lib.py:199
↓ 2 callersMethodflush
(self)
chapter2/context-compression/run_all_strategies.py:161
↓ 2 callersFunctionfmt
(value)
chapter1/context/vis_validation.py:24
↓ 2 callersMethodfor_target
Create a CDP session for a target. Args: cdp_client: Existing CDP client to use (or just for reference if creating own) target_id: Target ID
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:76
↓ 2 callersMethodformat
(self, record)
chapter9/browser-use-rpa/browser-use/browser_use/cli.py:497
↓ 2 callersFunctionformat_chat_template
格式化对话模板 将数据集中的消息格式化为模型可以理解的对话格式 Args: example: 数据集中的一个样本 tokenizer: 分词器 Returns: dict: 格式化
chapter8/MultilingualReasoning/gpt_oss_20b_sft.py:73
↓ 2 callersFunctionformat_history
(history: Dict[str, Any])
chapter3/user-memory/run_evaluation.py:94
↓ 2 callersFunctionformat_learning_signal
(report: Dict[str, Any])
chapter9/prompt-auto-optimization/learning_signal.py:101
↓ 2 callersFunctionformat_log
把一条日志渲染成「[相对秒] 来源 | 文本」的彩色字符串。
chapter6/async-agent/runtime.py:109
↓ 2 callersFunctionformat_memory_operations
Format memory operations for display Args: operations: List of memory operations verbose: Whether to show detailed outpu
chapter3/user-memory/memory_operation_formatter.py:10
↓ 2 callersFunctionformat_path
(path: List[Tuple[str, str, str]])
chapter3/structured-index/structured_vs_flat_demo.py:172
↓ 2 callersFunctionformat_probe
把成片信息格式化成一行行的人类可读文本(用于验证输出)。
chapter5/video-edit/ffmpeg_utils.py:72
↓ 2 callersFunctionformat_prompt
与训练数据一致的 prompt:任务 + 轨迹前缀 + 请给出下一步动作。
chapter8/premature-completion-dpo/evaluate.py:139
↓ 2 callersFunctionformula_tool
()
chapter1/web-search-agent/tests/test_experiment_1_2.py:4
↓ 2 callersMethodfrom_basic_chunk
Create from a basic ConversationChunk
chapter3/contextual-retrieval-for-user-memory/contextual_chunking.py:74
↓ 2 callersMethodfrom_dict
(cls, data: dict[str, Any])
chapter7/model-benchmark/campaign.py:141
↓ 2 callersMethodfrom_dict
Create event from dictionary
chapter6/agent-with-event-trigger/event_types.py:91
↓ 2 callersMethodfrom_json
Deserialize workflow from JSON string
chapter9/browser-use-rpa/learning_agent/workflow.py:222
↓ 2 callersFunctionfrontmatter
(lesson, chapterLesson, title, subtitle, minutes, body)
slides/chapter1-pilot.mjs:21
↓ 2 callersFunctionfull_description
(spec: ExpandedToolSpec)
chapter4/perception-tools/src/expanded_catalog.py:463
↓ 2 callersFunctionfuse
Dispatch helper: fuse ranked lists with the named method. Args: ranked_lists: Mapping from source name to ``(doc_id, score)`` tuples.
chapter3/retrieval-pipeline/fusion.py:126
↓ 2 callersFunctiongen
(client, prompt, sys_prompt, model="gemini-3-flash-preview", retries=2)
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_final_comprehensive.py:44
↓ 2 callersFunctiongen_with_retry
(client, prompt, sys_prompt, retries=3)
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_application.py:180
↓ 2 callersMethodgenerate_ad_image
Generate ad image bytes using Gemini. Returns None on failure.
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:180
↓ 2 callersMethodgenerate_ad_video
Generate ad video using Veo3.
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:209
↓ 2 callersFunctiongenerate_default_scenarios
Generates a default suite of security scenarios for PEDO evaluation.
chapter5/permission-embedded-data-objects/run_live_security_eval.py:880
↓ 2 callersMethodgenerate_document_id
Generate a semantically meaningful document ID from file name. Examples: - "宪法.md" -> "宪法" - "劳动法(2018-12-29
chapter3/contextual-retrieval/index_local_laws_contextual.py:153
↓ 2 callersMethodgenerate_next_message
(self, messages: List[Dict[str, Any]])
chapter2/prompt-engineering/tau_bench/envs/user.py:205
↓ 2 callersMethodgenerate_next_message
(self, messages: List[Dict[str, Any]])
chapter2/prompt-engineering/tau_bench/envs/user.py:247
↓ 2 callersMethodgenerate_next_message
(self, messages: List[Dict[str, Any]])
chapter2/prompt-engineering/tau_bench/envs/user.py:357
↓ 2 callersFunctiongenerate_rejected_control
Historical-looking bad patch: fixes the incident by disabling all retries.
chapter9/self-modifying-agent/evolution.py:173
↓ 2 callersMethodgenerate_report
Generate evaluation report. Args: results: Dictionary of evaluation results output_file: Optional fi
chapter3/user-memory-evaluation/framework.py:271
↓ 2 callersMethodgenerate_report
Generate and save evaluation report
chapter3/agentic-rag-for-user-memory/main.py:508
↓ 2 callersMethodgenerate_sql
(self, nl_question: str, hint: str)
chapter5/erp-agent/agent.py:61
↓ 2 callersMethodgenerate_with_attention
Generate text while tracking attention weights Args: prompt: Input prompt text max_new_tokens: Maxim
chapter2/attention_visualization/agent.py:343
↓ 2 callersFunctiongenerate_with_openai
( stable_source: str, diagnosis: Dict[str, Any], model: str | None = None, *, provider: st
chapter9/self-modifying-agent/llm_generator.py:53
↓ 2 callersFunctiongenerate_with_openai
( stable_source: str, diagnosis: Dict[str, Any], model: str | None = None, *, provider: st
chapter9/harness-safety-gate/llm_generator.py:106
↓ 2 callersMethodgenerate_with_streaming
Generate text with token-by-token streaming and stop at EOS Args: prompt: Input prompt max_new_token
chapter2/attention_visualization/main.py:86
↓ 2 callersMethodgenerated_agent_env
Expose this endpoint through the standard environment contract. Scratch-mode output is model-generated and may only understand the co
chapter5/agent-creator/creator.py:51
↓ 2 callersFunctionget
(id: string)
web-astro/src/scripts/note-editor.ts:12
↓ 2 callersFunctionget_all_output
Read stream until EOF. Call after the process has exited or been killed.
chapter4/execution-tools/multilang_executor.py:31
↓ 2 callersMethodget_all_test_cases
Get all available test cases
chapter3/log-sanitization/test_loader.py:20
↓ 2 callersMethodget_api_key
Get API key from environment
chapter3/contextual-retrieval/config.py:116
↓ 2 callersMethodget_api_key
Get API key from environment
chapter3/agentic-rag/config.py:117
↓ 2 callersMethodget_api_records
(self)
chapter2/prompt-engineering/tau_bench/envs/user.py:141
← previousnext →2,201–2,300 of 13,003, ranked by callers