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
Method
_log_reaction
(self, item: dict, success: bool, error: Optional[str] = None)
chapter5/permission-embedded-data-objects/pedo/core/store.py:610
↓ 2 callers
Function
_make_agent
()
chapter2/attention_visualization/test_save_trajectory.py:15
↓ 2 callers
Function
_make_battles
(args)
chapter7/elo-leaderboard/cli.py:149
↓ 2 callers
Function
_make_clip
(path, frames=20)
chapter4/perception-tools/test_video_keyframes_num_frames.py:38
↓ 2 callers
Function
_make_executor
注入给候选的执行器:在内存模拟环境上回放稳定版调度。
chapter9/harness-safety-gate/evolution.py:388
↓ 2 callers
Function
_make_indexer
(graphrag_module)
chapter3/structured-index/test_graphrag_search_top_k.py:97
↓ 2 callers
Function
_make_indexer
Build an indexer without __init__; force the retrieval-pipeline call to fail so the local-search fallback runs.
chapter3/contextual-retrieval-for-user-memory/test_fallback_search_empty_query.py:14
↓ 2 callers
Method
_make_processor
(self)
chapter3/user-memory/test_background_processor_loop.py:44
↓ 2 callers
Function
_make_result
()
chapter2/attention_visualization/test_save_trajectory.py:24
↓ 2 callers
Function
_make_vision_client
Build an OpenAI-compatible vision client with a universal fallback. Preferred path uses OPENAI_API_KEY directly. When it is absent but an OPE
chapter4/perception-tools/src/media_processing_tools.py:38
↓ 2 callers
Method
_match_domains
Match a list of domain glob patterns against a URL. Args: domains: A list of domain patterns that can include glob patterns (* wildcard) u
chapter9/browser-use-rpa/browser-use/browser_use/tools/registry/views.py:80
↓ 2 callers
Function
_matches
(text: str, patterns: list[str])
chapter8/premature-completion-dpo/evaluate.py:39
↓ 2 callers
Function
_message_text
Extract text from OpenAI-compatible string or chunk-list content.
chapter7/tts-quality-eval/pipeline.py:491
↓ 2 callers
Function
_mint
(target: str, index: int)
chapter5/provider-failover/renderers.py:37
↓ 2 callers
Function
_namespace
(source: str)
chapter9/self-modifying-agent/sandbox_runner.py:32
↓ 2 callers
Method
_no_compression
Strategy 1: No compression - return all original content
chapter2/context-compression/compression_strategies.py:230
↓ 2 callers
Method
_non_streaming_response
Get non-streaming response from the model Args: messages: Conversation messages Returns:
chapter2/context-compression/agent.py:450
↓ 2 callers
Function
_normalize
Lowercase and collapse whitespace for tolerant substring matching.
chapter3/user-memory-evaluation/metrics.py:30
↓ 2 callers
Method
_normalize_fallback
(self, action: Union[str, Enum])
chapter4/collaboration-tools/src/notification_dispatcher.py:161
↓ 2 callers
Function
_num
把 LLM 返回的数值字段转成 float;字段缺失、为 null 或非法时回退 default。
chapter5/video-edit/agents.py:102
↓ 2 callers
Function
_offline
离线模式:既无 OPENAI_API_KEY 也无 OPENROUTER_API_KEY 时启用确定性模拟。
chapter4/collaboration-tools/src/subagent_tools.py:72
↓ 2 callers
Method
_openrouter_key
(self)
chapter7/model-benchmark/benchmark.py:69
↓ 2 callers
Method
_output_text
(response: Dict[str, Any])
chapter1/search-codegen/agent.py:120
↓ 2 callers
Method
_overall_score
Average the four protection dimensions (excluding the overall key).
chapter5/coding-agent/sandbox_evaluator.py:324
↓ 2 callers
Function
_pad
按显示宽度左对齐(一个中文字符按两个宽度计)。
chapter3/agentic-rag/compare_offline.py:82
↓ 2 callers
Function
_paired_comparison
(runs: list[dict], args: argparse.Namespace)
chapter10/multi-role-transfer/run_comparison.py:405
↓ 2 callers
Function
_paper_title
(paper_md: str)
chapter5/paper-to-ppt/demo.py:220
↓ 2 callers
Method
_parse_config
(self, config: dict[str, Any])
chapter7/model-benchmark/rate_ramp_benchmark.py:55
↓ 2 callers
Function
_parse_json_response
Parse a JSON object out of an LLM reply, tolerating markdown fences. Reasoning models (notably kimi-k3) reliably return valid JSON but wrap it
chapter4/execution-tools/llm_helper.py:22
↓ 2 callers
Method
_parse_protocol_output
Remove internal markers and apply shell state from command output.
chapter5/coding-agent/tools/shell_session.py:183
↓ 2 callers
Method
_parse_reason
(raw: str)
chapter10/voice-werewolf/werewolf/agent.py:300
↓ 2 callers
Function
_pct
(cn)
chapter9/prompt-auto-optimization/demo.py:50
↓ 2 callers
Function
_percentile
(values: list[float], percentile: float)
chapter10/multi-role-transfer/run_comparison.py:94
↓ 2 callers
Function
_precedes
Return whether both records have numeric turns and the call came first.
chapter9/trajectory-verifier/verifier.py:51
↓ 2 callers
Function
_priced_cost
(usage: dict, input_price: float | None, output_price: float | None, cached_input_price: floa
chapter10/multi-role-transfer/run_comparison.py:138
↓ 2 callers
Function
_print_errors
打印失败明细,便于定位可用性问题。
chapter7/model-benchmark/demo.py:86
↓ 2 callers
Function
_probe
(path: Path)
chapter5/video-edit/campaign.py:56
↓ 2 callers
Function
_probe
(interval)
chapter4/collaboration-tools/test_recurring_interval_positive.py:10
↓ 2 callers
Method
_process_native_gemini
Process using Gemini's native multimodal API with thinking mode
chapter4/multimodal-agent/agent.py:475
↓ 2 callers
Function
_public
(record: dict[str, Any])
chapter6/phone-agent/webrtc_app.py:169
↓ 2 callers
Function
_random_stmt
为 speaker 随机生成一句合法的结构化陈述。
chapter5/code-for-logic/build_puzzles.py:119
↓ 2 callers
Function
_read_nonempty_with_retry
Polls an asynchronously populated Android content provider.
chapter7/android-world/run_controlled_experiment.py:432
↓ 2 callers
Method
_read_text
Read text file
chapter5/coding-agent/tools/read_tool.py:56
↓ 2 callers
Function
_real_json_completion
Make one real completion and retain a credential-free raw receipt.
chapter6/phone-agent/agent.py:126
↓ 2 callers
Function
_reasoning_safe_max_tokens
Reasoning models spend part of their budget on hidden reasoning tokens, so a small ``max_tokens`` (e.g. 1024) silently truncates the visible answe
chapter3/agentic-rag/agent.py:27
↓ 2 callers
Function
_reasoning_safe_temperature
Reasoning models (Kimi K3, GPT-5, ...) only accept temperature=1. Return 1 for those; otherwise the requested value so non-reasoning providers
chapter2/context-compression/agent.py:22
↓ 2 callers
Function
_reasoning_safe_temperature
Reasoning models (Kimi K3, GPT-5, ...) only accept temperature=1. Return 1 for those; otherwise the requested value so non-reasoning providers
chapter1/web-search-agent/agent.py:22
↓ 2 callers
Function
_reasoning_safe_temperature
Reasoning models (Kimi K3, GPT-5, ...) only accept temperature=1. Return 1 for those; otherwise the requested value so non-reasoning providers
chapter3/user-memory/agent.py:20
↓ 2 callers
Function
_reasoning_safe_temperature
Reasoning models (Kimi K3, GPT-5, ...) only accept temperature=1. Return 1 for those; otherwise the requested value so non-reasoning providers
chapter3/mem0/agent.py:22
↓ 2 callers
Function
_reasoning_safe_temperature
Reasoning models (Kimi K3, GPT-5, ...) only accept temperature=1. Return 1 for those; otherwise the requested value so non-reasoning providers
chapter3/contextual-retrieval/agent.py:14
↓ 2 callers
Function
_reasoning_safe_temperature
Reasoning models (Kimi K3, GPT-5, ...) only accept temperature=1. Return 1 for those; otherwise the requested value so non-reasoning providers
chapter3/agentic-rag/agent.py:20
↓ 2 callers
Function
_receipt
(case: str, *, success: bool = True)
chapter4/perception-tools/test_experiment_4_2.py:23
↓ 2 callers
Method
_record
( self, experiment: str, test_case: TestCase, system: str, main_name:
chapter7/user-memory-system-evaluation/experiment.py:879
↓ 2 callers
Function
_record_call
Atomically checkpoint credential-free raw model evidence.
chapter4/collaboration-tools/src/subagent_tools.py:90
↓ 2 callers
Method
_recursive_process_dict
Helper method to process dictionaries.
chapter9/browser-use-rpa/browser-use/browser_use/agent/service.py:1111
↓ 2 callers
Method
_recursive_process_list_or_tuple
Helper method to process lists and tuples.
chapter9/browser-use-rpa/browser-use/browser_use/agent/service.py:1124
↓ 2 callers
Method
_register_done_action
(self, output_model: type[T] | None, display_files_in_done_text: bool = True)
chapter9/browser-use-rpa/browser-use/browser_use/tools/service.py:1156
↓ 2 callers
Function
_register_sleep_tools
(registry)
chapter2/local_llm_serving/test_parallel_tools.py:50
↓ 2 callers
Function
_rehash_artifact
(run_dir: Path, name: str)
chapter10/autonomous-phone-registration/test_validate_acceptance.py:17
↓ 2 callers
Function
_relative_evidence_path
(path: Path | None)
chapter6/phone-agent/webrtc_app.py:313
↓ 2 callers
Function
_render_table
按中文宽度对齐打印一张表。
chapter7/model-benchmark/demo.py:63
↓ 2 callers
Method
_renumber_calls
(calls: list[dict[str, Any]])
chapter5/agent-creator/creator.py:746
↓ 2 callers
Function
_replace_once
(source: str, old: str, new: str)
chapter9/self-modifying-agent/evolution.py:121
↓ 2 callers
Method
_replace_urls_in_text
Replace URLs in a text string
chapter9/browser-use-rpa/browser-use/browser_use/agent/service.py:1016
↓ 2 callers
Function
_replay_and_issues
步骤 3/4:对同一输入重放被测系统并断言,再生成 GitHub Issue(默认 mock)。 对 fixed=False / fixed=True 各重放一次,演示同一条回归用例的 『失败(复现bug)』与『通过(验证修复)』。返回 (复现数, 验证数)。
chapter5/log-diagnosis/demo.py:82
↓ 2 callers
Function
_replay_case
回放单条用例:挂起/拒绝时执行器绝不允许被调用。
chapter9/harness-safety-gate/evolution.py:396
↓ 2 callers
Function
_request_with_retry
Make HTTP request with timeout and retry logic.
chapter9/browser-use-rpa/browser-use/examples/cloud/04_proxy_usage.py:43
↓ 2 callers
Function
_request_with_retry
Make HTTP request with timeout and retry logic.
chapter9/browser-use-rpa/browser-use/examples/cloud/03_structured_output.py:44
↓ 2 callers
Function
_request_with_retry
Make HTTP request with timeout and retry logic.
chapter9/browser-use-rpa/browser-use/examples/cloud/02_fast_mode_gemini.py:45
↓ 2 callers
Function
_require_api
()
chapter5/erp-agent/demo.py:228
↓ 2 callers
Method
_require_model
(self)
chapter6/end-to-end-speech/speech_model.py:96
↓ 2 callers
Function
_res
(**kw)
chapter5/small-model-codified-rules/tasks.py:34
↓ 2 callers
Function
_resolve_gemini_model
探测当前可用的 Gemini 模型,避免默认名过期。
chapter7/tts-quality-eval/pipeline.py:449
↓ 2 callers
Function
_resolve_llm
Return (api_key, base_url, *mapped_models). When the OpenAI key is absent but OPENROUTER_API_KEY is present, route the chat LLM (used for RAPT
chapter3/structured-index/config.py:37
↓ 2 callers
Method
_resolve_path
Resolve path relative to workspace.
chapter4/execution-tools/file_tools.py:19
↓ 2 callers
Function
_resolved_base_url
Read ``Config.KIMI_BASE_URL`` in a fresh interpreter. It is a class attribute evaluated at import time, so probing it without a module reload
chapter1/web-search-agent/tests/test_config.py:86
↓ 2 callers
Function
_response
(content="Reasoning\n **ACTION**: take rusty sword ")
chapter1/learning-from-experience/test_experiment_8_2_evidence.py:17
↓ 2 callers
Function
_retained_media_path
(record: dict[str, Any], filename: str)
chapter6/phone-agent/webrtc_app.py:302
↓ 2 callers
Method
_retrieve_relevant_memories
Retrieve memories relevant to current query
chapter3/memobase/agent.py:312
↓ 2 callers
Method
_round_no
(self)
chapter10/voice-werewolf/werewolf/simulator.py:379
↓ 2 callers
Function
_rtp_is_bidirectional
(receipt: dict)
chapter10/autonomous-phone-registration/demo.py:112
↓ 2 callers
Function
_run
(command: list[str], *, cwd: Path | None = None)
chapter7/android-world/run_controlled_experiment.py:171
↓ 2 callers
Function
_run_commands
(agent, *commands)
chapter4/multimodal-agent/test_interactive_tools_toggle.py:14
↓ 2 callers
Method
_run_one_llm_turn
执行一次「模型调用 + 工具处理」。 返回值: - None 表示还要继续循环(发生了工具调用/移交) - str 表示这是最终回复(模型没有再调用工具),流程结束
chapter10/multi-role-transfer/orchestrator.py:108
↓ 2 callers
Function
_run_python
执行源码,返回 (合并后的输出, 退出码);超时时退出码为 None。
chapter10/staged-system-prompt/tools.py:177
↓ 2 callers
Method
_run_python
Execute Python code.
chapter4/execution-tools/multilang_executor.py:319
↓ 2 callers
Function
_run_recurring_timer
Internal function to run a recurring timer.
chapter4/collaboration-tools/src/timer_tools.py:345
↓ 2 callers
Function
_run_timer
Internal function to run a timer.
chapter4/collaboration-tools/src/timer_tools.py:85
↓ 2 callers
Function
_send_agent
( runtime: CallRuntime, text: str, *, purpose: str, )
chapter6/phone-agent/webrtc_app.py:447
↓ 2 callers
Method
_serialize_content_to_str
Serialize content to a string.
chapter9/browser-use-rpa/browser-use/browser_use/llm/anthropic/serializer.py:88
↓ 2 callers
Function
_session
()
chapter6/controllable-tts/tts.py:16
↓ 2 callers
Function
_set_slide_bg
给整页填充一个纯色背景。
chapter2/agent-skills-ppt/skills/pptx/scripts/generate_pptx.py:38
↓ 2 callers
Method
_settle
(self, worker_id: str, profile: dict)
chapter10/parallel-web-research/agents.py:240
↓ 2 callers
Method
_setup_proxy_auth
Enable CDP Fetch auth handling for authenticated proxy, if credentials provided. Handles HTTP proxy authentication challenges (Basic/Proxy) by prov
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:1369
↓ 2 callers
Function
_sha256
(path: Path)
chapter10/autonomous-phone-registration/validate_acceptance.py:62
↓ 2 callers
Function
_sha256
(path: Path)
chapter1/learning-from-experience/run_experiment_8_2.py:32
↓ 2 callers
Function
_sha_file
(path: Path)
chapter9/harness-safety-gate/run_experiment_9_7.py:33
↓ 2 callers
Function
_significant_tokens
Tokens that carry semantic weight (stopwords and negations removed).
chapter9/trajectory-verifier/consistency_checker.py:111
↓ 2 callers
Function
_slug
把章节名转成干净的文件名前缀,如 'Chapter 1: ...' -> 'chapter1'。
chapter10/book-translation/agents.py:114
↓ 2 callers
Function
_small_model
()
chapter3/structured-knowledge-extraction/test_advise_zero_archetypes.py:16
← previous
next →
1,801–1,900 of 13,003, ranked by callers