MCPcopy Create free account

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

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

↓ 3 callersFunctionvalidate_response
(payload: dict[str, Any])
chapter6/controllable-tts/evaluate_audio_quality.py:149
↓ 3 callersFunctionvalidate_strategy_result
Turn a model grade into a strict, machine-checkable acceptance record. This function is deliberately fail-closed. Provider SDKs occasionally ret
chapter10/voice-werewolf/werewolf/strategy_audit.py:18
↓ 3 callersMethodverify_code_syntax
Verify code syntax and provide feedback. Args: code: The code to verify language: Programming langua
chapter4/execution-tools/llm_helper.py:270
↓ 3 callersMethodviolation_rate
VR: fraction of prompts producing integrity violations.
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/metrics.py:77
↓ 3 callersFunctionwait_for_structured_completion
Wait for task completion and return the result.
chapter9/browser-use-rpa/browser-use/examples/cloud/03_structured_output.py:137
↓ 3 callersMethodwrite_file
(self, path: str, content: str)
chapter10/staged-system-prompt/tools.py:50
↓ 3 callersFunctionwrite_json
(path: Path, value: dict[str, Any])
chapter6/robotics_lab_common.py:64
↓ 3 callersFunctionwrite_json
(path, value)
chapter6/astra-async-steering/experiment.py:52
↓ 3 callersFunctionwrite_json
(path: Path, value: Any)
chapter4/active-tool-discovery/run_exact_experiment.py:128
↓ 3 callersFunctionwrite_json_atomic
Persist a restart checkpoint without exposing half-written JSON.
chapter10/book-translation/run_official_experiment.py:458
↓ 3 callersFunctionwrite_manifest
Hash every retained artifact except the manifest itself.
chapter6/computer-use-open-model/evidence.py:59
↓ 3 callersMethodwrite_timers
(self, timers)
chapter4/collaboration-tools/test_timer_tools.py:74
↓ 2 callersMethod__init__
(self, config: dict[str, Any], *args, **kwargs)
chapter9/browser-use-rpa/browser-use/browser_use/cli.py:463
↓ 2 callersMethod__init__
(self)
chapter10/autonomous-phone-registration/test_orchestration.py:20
↓ 2 callersFunction_acceptance
(record: dict[str, Any])
chapter6/phone-agent/webrtc_app.py:201
↓ 2 callersFunction_adb
(adb_path: str, console_port: int, *args: str)
chapter7/android-world/run_controlled_experiment.py:182
↓ 2 callersMethod_add_context_message
Add a contextual message specific to this step (e.g., validation errors, retry instructions, timeout warnings)
chapter9/browser-use-rpa/browser-use/browser_use/agent/message_manager/service.py:377
↓ 2 callersFunction_agent_with_streams
(*streams)
chapter2/local_llm_serving/test_vllm_structured_streaming.py:23
↓ 2 callersFunction_aggregate
(runs: list[dict], args: argparse.Namespace)
chapter10/multi-role-transfer/run_comparison.py:347
↓ 2 callersMethod_all_tools
(self)
chapter10/multi-role-transfer/skill_orchestrator.py:165
↓ 2 callersFunction_apply_edit_ffmpeg
ffmpeg 后端:与 bpy 脚本等价的裁剪/字幕/慢动作,产出 H.264+AAC 的 mp4。
chapter5/video-edit/video_editor.py:71
↓ 2 callersFunction_apply_store_path
若指定了 --store-path,则重定向记忆存储目录(不影响默认数据)。
chapter3/user-memory/memory_cli.py:47
↓ 2 callersMethod_assistant_content
(example: dict[str, Any])
chapter8/cot-distillation/sft_data_auditor.py:595
↓ 2 callersFunction_audit_case
( case: dict[str, Any], *, process_ok: bool, result: dict[str, Any], elapsed_s: float,
chapter5/agent-creator/validator.py:277
↓ 2 callersMethod_audit_latex_formulas
Audit LaTeX formula syntax preservation.
chapter10/book-translation/consistency_auditor.py:342
↓ 2 callersFunction_auto_responder
模拟管理员:轮询待处理请求并作答,用于离线演示 HITL 闭环。
chapter4/collaboration-tools/main.py:126
↓ 2 callersMethod_avg
(self, results: Dict[str, EvaluationResult], layer: Optional[str] = None)
chapter3/user-memory-evaluation/comparison.py:104
↓ 2 callersFunction_await_cancelled
(state: TaskState)
chapter6/async-agent/run_real_experiment.py:80
↓ 2 callersMethod_await_interruptibly
(self, awaitable)
chapter10/parallel-web-research/agents.py:94
↓ 2 callersFunction_bare_agent
()
chapter10/staged-system-prompt/tests/test_null_question.py:8
↓ 2 callersFunction_base_payload
(provider: str, trace: Trace, with_tools: bool = True)
chapter5/provider-failover/run_continuation.py:53
↓ 2 callersFunction_basic_functionality
Test basic functionality of the system
chapter3/contextual-retrieval/test_simple.py:12
↓ 2 callersFunction_basic_functionality
Test basic functionality of the system
chapter3/agentic-rag/test_simple.py:12
↓ 2 callersFunction_bounds
(value: dict[str, Any], duration: float)
chapter5/video-edit/campaign.py:226
↓ 2 callersFunction_build_agent
Instantiate the agent for a strategy (needs a valid API key).
chapter4/active-tool-selection/demo_comparison.py:317
↓ 2 callersMethod_build_context
Build context for the LLM including task description and past experiences. This is the key to in-context learning.
chapter1/learning-from-experience/llm_agent.py:144
↓ 2 callersMethod_build_dom_tree_without_highlights
Build DOM tree without injecting JavaScript highlights (for parallel execution).
chapter9/browser-use-rpa/browser-use/browser_use/browser/watchdogs/dom_watchdog.py:353
↓ 2 callersMethod_build_evaluation_prompt
Build the evaluation prompt for the LLM.
chapter3/user-memory-evaluation/evaluator.py:133
↓ 2 callersFunction_build_user_prompt
( samples: List[str], required_keys: List[str], error_report: str, feedback: Optional[str], )
chapter5/adaptive-log-parser/agent.py:42
↓ 2 callersMethod_calculate_metrics
Calculate benchmark metrics from results
chapter3/memobase/locomo_benchmark.py:485
↓ 2 callersFunction_call
( backend: Backend, *, purpose: str, messages: list[dict[str, Any]], receipt_messages: lis
chapter5/video-edit/campaign.py:133
↓ 2 callersMethod_call_llm
Call LLM with current context and available tools.
chapter4/active-tool-selection/agent.py:137
↓ 2 callersMethod_call_llm
Call LLM with only the retrieved tools injected.
chapter4/active-tool-selection/agent.py:339
↓ 2 callersMethod_call_llm
Call LLM with ALL tools injected.
chapter4/active-tool-selection/agent.py:468
↓ 2 callersFunction_canonical_json
(value: Any)
chapter6/phone-agent/agent.py:63
↓ 2 callersFunction_catalog
()
chapter4/active-tool-selection/tests/test_usage_none.py:21
↓ 2 callersMethod_cdp_set_cookies
Set cookies using CDP Storage.setCookies.
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:1867
↓ 2 callersFunction_chat_model
当前回复模式:返回模型名则走真实 LLM,返回空串则为默认 echo 模式。 从环境变量 CHAT_MODEL 读取(而非模块级常量),这样即使 `--reload` 触发的 子进程重新 import 本模块,也能透过环境变量拿到命令行传入的模型设置。
chapter5/conversational-ui/backend/main.py:47
↓ 2 callersFunction_chat_model
当前回复模式:返回模型名则走真实 LLM,返回空串则为默认 echo 模式。 从环境变量 CHAT_MODEL 读取(而非模块级常量),这样即使 `--reload` 触发的 子进程重新 import 本模块,也能透过环境变量拿到命令行传入的模型设置。
chapter5/conversational-ui/validation/runs/20260729T212616Z-5_11-hmr/app/backend/main.py:47
↓ 2 callersFunction_chat_model
当前回复模式:返回模型名则走真实 LLM,返回空串则为默认 echo 模式。 从环境变量 CHAT_MODEL 读取(而非模块级常量),这样即使 `--reload` 触发的 子进程重新 import 本模块,也能透过环境变量拿到命令行传入的模型设置。
chapter5/conversational-ui/validation/runs/20260729T212933Z-5_11-hmr/app/backend/main.py:47
↓ 2 callersFunction_chat_model
当前回复模式:返回模型名则走真实 LLM,返回空串则为默认 echo 模式。 从环境变量 CHAT_MODEL 读取(而非模块级常量),这样即使 `--reload` 触发的 子进程重新 import 本模块,也能透过环境变量拿到命令行传入的模型设置。
chapter5/conversational-ui/validation/runs/20260729T212727Z-5_11-hmr/app/backend/main.py:47
↓ 2 callersMethod_chat_stream
Stream chat response (only when tools are disabled) Args: message: User message Returns:
chapter3/user-memory/agent.py:892
↓ 2 callersMethod_chat_with_think_fallback
Call client.chat with think=True when supported, falling back gracefully. Models without thinking support (qwen2.5, llama3.2, gemma, etc.) re
chapter2/local_llm_serving/ollama_native.py:47
↓ 2 callersMethod_check_and_update_downloads
Check for new downloads and update available file paths.
chapter9/browser-use-rpa/browser-use/browser_use/agent/service.py:478
↓ 2 callersMethod_check_answer_criteria
Simple check if answer meets criteria
chapter3/contextual-retrieval-for-user-memory/contextual_evaluator.py:530
↓ 2 callersFunction_check_parallel
(label, elapsed, n=2)
chapter2/local_llm_serving/test_parallel_tools.py:55
↓ 2 callersMethod_check_related_tenant
Allow shared global targets, but forbid links into another tenant.
chapter5/permission-embedded-data-objects/pedo/core/store.py:364
↓ 2 callersMethod_check_tenant
Global objects use their rules; tenant objects require a matching org.
chapter5/permission-embedded-data-objects/pedo/core/store.py:358
↓ 2 callersMethod_check_url_for_pdf
Check if URL indicates a PDF file.
chapter9/browser-use-rpa/browser-use/browser_use/browser/watchdogs/downloads_watchdog.py:663
↓ 2 callersFunction_checkpoint_identity
(args, tasks, arms, protocol_sha256: str)
chapter5/small-model-codified-rules/demo.py:336
↓ 2 callersFunction_choice
(*, content=None, tool_calls=None)
chapter1/context/tests/test_malformed_tool_json.py:8
↓ 2 callersMethod_choose
(self, *, prompt: str, candidates: List[str], players: List[str], allow_none: bool, action: st
chapter10/voice-werewolf/werewolf/simulator.py:388
↓ 2 callersFunction_chunk
(content=None, tool_calls=None)
chapter2/local_llm_serving/test_vllm_structured_streaming.py:9
↓ 2 callersFunction_chunk
(chunk_id, contextualized_text)
chapter3/contextual-retrieval-for-user-memory/test_fallback_search_empty_query.py:24
↓ 2 callersMethod_clean_pdf_text
Clean extracted PDF text.
chapter3/structured-index/document_processor.py:113
↓ 2 callersMethod_cleanup_expired_tokens
Remove expired pending confirmation tokens.
chapter9/harness-safety-gate/safety_policy_gate.py:153
↓ 2 callersMethod_click_element_node_impl
Click an element using pure CDP with multiple fallback methods for getting element geometry. Args: element_node: The DOM element to click
chapter9/browser-use-rpa/browser-use/browser_use/browser/watchdogs/default_action_watchdog.py:246
↓ 2 callersFunction_client_with_usage
Fake OpenAI client; response mimics the SDK object (usage attr always present).
chapter4/active-tool-selection/tests/test_usage_none.py:31
↓ 2 callersFunction_coerce_metrics
Normalize a stored metrics value into a plain dict. Handles both formats found in result files: - dict: produced by --compare (asdict) and
chapter2/kv-cache/main.py:50
↓ 2 callersMethod_compress_memories
Compress old memories to save space
chapter3/memobase/agent.py:196
↓ 2 callersFunction_configure_cjk_font
Best-effort: pick a CJK-capable font so Chinese token labels (e.g. the '北京 的 天气 怎么样' example from Chapter 2) render as glyphs instead of
chapter2/attention_visualization/visualization.py:15
↓ 2 callersFunction_contains_in_order
(observed: list[str], required: list[str])
chapter10/multi-role-transfer/run_comparison.py:150
↓ 2 callersMethod_context_block
把私有上下文拼成给 LLM 的一段文字。
chapter10/voice-werewolf/werewolf/agent.py:134
↓ 2 callersMethod_context_for_update
(self, object_id: str, accessor: AccessContext)
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/agentspec_wrap.py:217
↓ 2 callersFunction_context_safe_output_cap
Returns a one-token-headroom cap from an OpenAI-style context error.
chapter7/android-world/run_controlled_experiment.py:303
↓ 2 callersMethod_convert_tools_to_ollama_format
Convert tool registry to Ollama's expected format
chapter2/local_llm_serving/ollama_native.py:39
↓ 2 callersMethod_count
(self, results: Dict[str, EvaluationResult], layer: Optional[str] = None)
chapter3/user-memory-evaluation/comparison.py:112
↓ 2 callersFunction_count_tokens
Best-effort token count for inspecting how much context is handed off.
chapter4/collaboration-tools/src/subagent_tools.py:123
↓ 2 callersMethod_create_basic_chunk
Create a basic chunk dictionary
chapter3/contextual-retrieval/contextual_chunking.py:283
↓ 2 callersMethod_create_chunk
Create a chunk with metadata
chapter3/contextual-retrieval/chunking.py:142
↓ 2 callersMethod_create_chunk
Create a chunk with metadata
chapter3/agentic-rag/chunking.py:142
↓ 2 callersFunction_create_no_op_decorator
Create a no-op decorator that accepts all lmnr observe parameters but does nothing.
chapter9/browser-use-rpa/browser-use/browser_use/observability.py:58
↓ 2 callersFunction_deliverable
Prefer the text passed to count_characters; otherwise strip a wrap-up label.
chapter10/multi-role-transfer/evaluation.py:28
↓ 2 callersMethod_display_result
Display the result of a request Args: result: Result dictionary from agent
chapter1/search-codegen/main.py:203
↓ 2 callersMethod_display_result
Display a single evaluation result.
chapter3/user-memory-evaluation/main.py:221
↓ 2 callersFunction_docker_command
(image: str, name: str)
chapter9/self-modifying-agent/candidate_sandbox.py:74
↓ 2 callersMethod_drain_pending
(self)
chapter6/async-agent/runtime.py:194
↓ 2 callersFunction_drift
变更请求前后,其余尺寸的漂移量(键为测量字段名)。
chapter5/cad-vs-diffusion/run_experiment.py:42
↓ 2 callersMethod_embed
(self, texts: list[str])
chapter4/active-tool-discovery/run_exact_experiment.py:248
↓ 2 callersMethod_enter_stage
(self, stage: str)
chapter10/staged-system-prompt/agent.py:288
↓ 2 callersMethod_error_record
( self, experiment: str, test_case: TestCase, system: str, main_name:
chapter7/user-memory-system-evaluation/experiment.py:982
↓ 2 callersFunction_evaluation_dataset
Test evaluation dataset generation
chapter3/contextual-retrieval/test_simple.py:134
↓ 2 callersFunction_evaluation_dataset
Test evaluation dataset generation
chapter3/agentic-rag/test_simple.py:134
↓ 2 callersMethod_example_token_count
Approximate token count as the total word count across all messages.
chapter8/cot-distillation/sft_data_auditor.py:568
↓ 2 callersMethod_execute_formula
Execute one Kimi Formula Fiber exactly as the model requested.
chapter1/web-search-agent/agent.py:227
↓ 2 callersMethod_execute_initial_actions
(self)
chapter9/browser-use-rpa/browser-use/browser_use/agent/service.py:1841
↓ 2 callersMethod_execute_tool
Execute a tool and return the result Args: tool_name: Name of the tool to execute arguments: Argumen
chapter1/context/agent.py:639
↓ 2 callersMethod_execute_tool
Execute a tool call
chapter4/multimodal-agent/agent.py:1071
↓ 2 callersMethod_execute_tool
Execute a tool and return the result
chapter3/agentic-rag-for-user-memory/agent.py:136
↓ 2 callersMethod_execute_tool
Execute a tool and return the result
chapter3/contextual-retrieval-for-user-memory/agent.py:136
← previousnext →1,601–1,700 of 13,003, ranked by callers