MCPcopy Create free account

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

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

↓ 5 callersFunctionwrite_json
(path: Path, value)
chapter8/MiniMind-pretrain/validation/test_vlm_training_report_audit.py:18
↓ 4 callersMethod__init__
(self, dispatch: Callable[[Event], None])
chapter6/agent-with-event-trigger/event_loop_demo.py:179
↓ 4 callersMethod_answer_with_context
Answer a query given extracted text context
chapter4/multimodal-agent/agent.py:780
↓ 4 callersFunction_as_memory_list
Normalize a mem0 return value to a plain list of memory dicts. Current mem0 OSS returns ``{"results": [...]}``; accepting a bare list as well
chapter3/mem0/agent.py:30
↓ 4 callersMethod_banner
(self, text: str)
chapter10/staged-system-prompt/agent.py:185
↓ 4 callersFunction_build_db
按固定种子生成数据并灌入指定的 SQLite 库(':memory:' 或文件路径)。 每次都重新灌入,保证与 reference.py 的期望答案严格对齐、结果可复现。
chapter5/erp-agent/demo.py:169
↓ 4 callersFunction_catalog
()
chapter4/perception-tools/test_experiment_4_2.py:47
↓ 4 callersMethod_chat
组装 system + user 消息并调用 LLM;user 消息里只拼接本 Agent 自己的 私有上下文(`_context_block`),绝不包含其他玩家的私密信息。
chapter10/voice-werewolf/werewolf/agent.py:140
↓ 4 callersMethod_check_winner
判定当前是否已分出胜负:狼人全灭则好人胜;狼人数≥好人数则狼人胜; 否则返回 None(继续游戏)。
chapter10/voice-werewolf/werewolf/game.py:419
↓ 4 callersMethod_citations
(response: Dict[str, Any])
chapter1/search-codegen/agent.py:148
↓ 4 callersMethod_completion
Call the real user model and retain a credential-free receipt.
chapter2/prompt-engineering/tau_bench/envs/user.py:51
↓ 4 callersMethod_configure_shell
(self)
chapter5/coding-agent/tools/shell_session.py:70
↓ 4 callersFunction_copy_run
(tmp_path: Path)
chapter10/autonomous-phone-registration/test_validate_acceptance.py:24
↓ 4 callersMethod_detect_best_backend
Detect the best backend for current platform
chapter2/local_llm_serving/main.py:42
↓ 4 callersMethod_dimension_scores
Score each sandbox dimension on a 0.0-1.0 scale.
chapter5/coding-agent/sandbox_evaluator.py:314
↓ 4 callersMethod_ensure_client
Create the LLM client on first use (raises if no API key).
chapter4/execution-tools/llm_helper.py:95
↓ 4 callersMethod_ensure_dirs
Create directories if they don't exist (only once)
chapter9/browser-use-rpa/browser-use/browser_use/config.py:114
↓ 4 callersFunction_episode
(arm: str, task: str, success: bool, latency: float)
chapter7/android-world/test_experiment.py:30
↓ 4 callersMethod_event
(self, type_: str, **data)
chapter10/voice-werewolf/werewolf/simulator.py:107
↓ 4 callersMethod_explicit_none
(text: str)
chapter10/voice-werewolf/werewolf/human.py:188
↓ 4 callersFunction_fake_client
(arguments)
chapter5/conversational-ui/test_customize_malformed_args.py:10
↓ 4 callersFunction_finish
(record: Dict[str, Any], t0: float)
chapter1/image-gen-workflow/pipeline.py:104
↓ 4 callersFunction_fit_font
Shrink font_size until the (unwrapped) string fits avail_w.
book-en/svg_lib.py:167
↓ 4 callersFunction_fit_font
Shrink font_size until the (unwrapped) string fits avail_w.
book-tr/svg_lib.py:167
↓ 4 callersFunction_fit_font
Shrink font_size until the (unwrapped) string fits avail_w.
book-ar/svg_lib.py:183
↓ 4 callersFunction_fit_font
Shrink font_size until the (unwrapped) string fits avail_w.
book-ru/svg_lib.py:167
↓ 4 callersFunction_fit_font
Shrink font_size until the (unwrapped) string fits avail_w.
book-es/svg_lib.py:167
↓ 4 callersFunction_fit_font
Мөр таслахгүй текст avail_w-д багтах хүртэл font_size-ийг багасгана.
book-mn/svg_lib.py:167
↓ 4 callersFunction_fit_font
Shrink font_size until the (unwrapped) string fits avail_w.
book-id/svg_lib.py:167
↓ 4 callersMethod_get_element
Get element using stable selectors with fallback. Args: step: The step containing selector information
chapter9/browser-use-rpa/learning_agent/replay.py:249
↓ 4 callersMethod_get_state_hash
Create a hashable representation of the game state. This is crucial for tabular Q-learning.
chapter1/learning-from-experience/rl_agent.py:53
↓ 4 callersFunction_is_caught_by_pipeline
(e: Exception)
chapter5/permission-embedded-data-objects/pedo/eval/case_studies.py:47
↓ 4 callersFunction_loads_lenient
容错解析 JSON:兼容代码围栏;非法/空内容返回 None(不抛)。
chapter10/book-translation/agents.py:124
↓ 4 callersMethod_log
(self, action: str, detail: str)
chapter10/staged-system-prompt/agent.py:174
↓ 4 callersFunction_memory_filters
Build the entity filter required by mem0 v3 search/get_all.
chapter3/mem0/agent.py:54
↓ 4 callersFunction_new_call_record
(provider: str, model: str, endpoint: str)
chapter1/image-gen-workflow/pipeline.py:87
↓ 4 callersMethod_parse_filename
Parse filename into name and extension. Always check _is_valid_filename first.
chapter9/browser-use-rpa/browser-use/browser_use/filesystem/file_system.py:224
↓ 4 callersFunction_plain
(value: Any)
chapter10/generative-agents/provider_adapter.py:44
↓ 4 callersFunction_plan_fields
从剪辑计划里抽出 bpy 脚本需要的字段。
chapter5/video-edit/blender_editor.py:129
↓ 4 callersMethod_prepare_data
Prepare NumPy arrays from DataFrame for fast processing. Args: df: DataFrame with columns 'model_a', 'model_b',
chapter7/elo-leaderboard/optimized_elo.py:122
↓ 4 callersFunction_print
统一以带缩进的 JSON 打印工具返回结果。
chapter4/collaboration-tools/main.py:42
↓ 4 callersMethod_print_private
Prevent private night logs leaking through the live player's terminal.
chapter10/voice-werewolf/werewolf/game.py:145
↓ 4 callersMethod_process_messsages_and_replace_long_urls_shorter_ones
Replace long URLs with shorter ones ? @dev edits input_messages in place returns: tuple[filtered_input_messages, urls we replaced {shorter_url
chapter9/browser-use-rpa/browser-use/browser_use/agent/service.py:1063
↓ 4 callersFunction_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
chapter4/execution-tools/llm_helper.py:14
↓ 4 callersFunction_record
(call_id: str)
chapter6/phone-agent/webrtc_app.py:162
↓ 4 callersFunction_require_env
(name: str)
chapter7/tts-quality-eval/pipeline.py:124
↓ 4 callersFunction_run_batch
Run generate_speech_batch over texts, returning the sf.write call paths.
chapter8/sesame/test_batch_inference.py:48
↓ 4 callersMethod_run_record
按「工具记录(含 code)」在沙箱子进程里执行 run(**arguments)。 直接吃 record 而不读磁盘,因此可在工具**尚未落盘时**用于「存前验证」。
chapter9/self-evolving-tools/tool_manager.py:165
↓ 4 callersFunction_run_tool
执行工具,返回给模型的字符串结果。
chapter9/prompt-auto-optimization/airline_env.py:118
↓ 4 callersFunction_run_with_bad_tool_args
(tool_name, arguments)
chapter10/multi-role-transfer/tests/test_tool_dispatch_errors.py:37
↓ 4 callersFunction_safe_error
(exc: BaseException)
chapter6/phone-agent/webrtc_app.py:50
↓ 4 callersFunction_safe_output
(path: str)
chapter4/execution-tools/extended_tools.py:25
↓ 4 callersMethod_save_memories
Save memories to persistent storage
chapter3/memobase/agent.py:121
↓ 4 callersMethod_serialize_cache_control
Serialize cache control.
chapter9/browser-use-rpa/browser-use/browser_use/llm/anthropic/serializer.py:54
↓ 4 callersMethod_set_message_with_type
Replace a specific state message slot with a new message
chapter9/browser-use-rpa/browser-use/browser_use/agent/message_manager/service.py:367
↓ 4 callersFunction_sha
(path: Path)
chapter4/execution-tools/extended_tools.py:21
↓ 4 callersFunction_span
(**overrides)
chapter7/agent-cost-analysis/tests/test_trace_offline.py:17
↓ 4 callersFunction_temp_for
推理模型(gpt-5 / o 系列等)不接受 temperature=0。
chapter5/video-edit/agents.py:46
↓ 4 callersMethod_terminate_process
(process: Optional[Union[subprocess.Popen, int]])
chapter5/coding-agent/tools/shell_session.py:239
↓ 4 callersFunction_tool_calls
(history: Iterable[dict])
chapter10/multi-role-transfer/evaluation.py:15
↓ 4 callersMethod_tool_read_file
Read file contents with optional line-based reading
chapter2/system-hint/agent.py:556
↓ 4 callersMethod_tool_write_file
Write content to file
chapter2/system-hint/agent.py:670
↓ 4 callersFunction_unwrap
(result)
chapter4/perception-tools/test_filesystem_mutations.py:18
↓ 4 callersFunction_valid_examples
Return ``n`` valid, diverse, non-duplicate examples.
tests/test_ch8_sft_data_auditor.py:50
↓ 4 callersFunction_valid_examples
Return ``n`` valid, diverse, non-duplicate examples.
tests/test_ch7_sft_data_auditor.py:50
↓ 4 callersFunction_write
(path: Path, value: dict)
chapter10/autonomous-phone-registration/test_validate_acceptance.py:13
↓ 4 callersFunction_write_csv
(path: Path, tests_value: str)
chapter7/public-health-reporting-eval/tests/test_excel_float_int.py:8
↓ 4 callersFunction_write_csv
(path: Path, tests_value: str)
chapter7/public-health-reporting-eval/tests/test_blank_csv_int.py:8
↓ 4 callersMethod_write_files
(output: Path, files: dict[str, str])
chapter5/agent-creator/creator.py:410
↓ 4 callersFunctionabsorb
(shard: dict, conn: dict)
scripts/gen_star_history.py:211
↓ 4 callersMethodaccess
Update access statistics
chapter3/memobase/agent.py:60
↓ 4 callersMethodadd
(self, direction, event)
chapter6/astra-async-steering/experiment.py:88
↓ 4 callersMethodadd
(self, direction, event)
chapter6/astra-async-steering/validation/runs/pilot-20260905-v1/source/experiment.py:88
↓ 4 callersMethodadd
(self, direction, event)
chapter6/astra-async-steering/validation/runs/exp6-14-20260905-formal/source/experiment.py:88
↓ 4 callersMethodadd
(self, direction, event)
chapter6/astra-async-steering/validation/runs/pilot-20260905-v2/source/experiment.py:88
↓ 4 callersMethodadd_document
Add a document to the store. Args: text: Document text doc_id: Optional document ID (will be generat
chapter3/dense-embedding/document_store.py:36
↓ 4 callersMethodadd_graphrag_community
Add a GraphRAG community summary node to the index.
chapter3/structured-index/hybrid_retriever.py:167
↓ 4 callersMethodadd_graphrag_entity
Add a GraphRAG entity node to the index.
chapter3/structured-index/hybrid_retriever.py:123
↓ 4 callersMethodadd_graphrag_relationship
Add a GraphRAG relationship summary node to the index.
chapter3/structured-index/hybrid_retriever.py:145
↓ 4 callersMethodadd_item
Add an item to the ANNOY index.
chapter3/dense-embedding/indexing.py:76
↓ 4 callersMethodadd_item
Add an item to the HNSW index.
chapter3/dense-embedding/indexing.py:283
↓ 4 callersFunctionadd_md_close_tag
(prompt: str)
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:145
↓ 4 callersMethodadd_memory
Add a new memory item
chapter3/user-memory/memory_manager.py:95
↓ 4 callersMethodadd_node
(self, node)
chapter3/structured-index/test_graphrag_search_top_k.py:48
↓ 4 callersMethodadd_step
Add a step to the workflow
chapter9/browser-use-rpa/learning_agent/workflow.py:176
↓ 4 callersMethodainvoke
(self, messages: list[BaseMessage], output_format: None = None)
chapter9/browser-use-rpa/browser-use/browser_use/llm/anthropic/chat.py:128
↓ 4 callersFunctionapply_suffix_strategy
(response: str, suffix_strategy: PromptSuffixStrategy)
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:602
↓ 4 callersFunctionarrow
(edge, path, { dash = false } = {})
web-astro/scripts/evolution-flow-figures.mjs:111
↓ 4 callersFunctionarrow
(x1, y1, x2, y2, options)
web-astro/scripts/chapter3-figure-kit.mjs:140
↓ 4 callersMethodbuild_generate_message_state
(self, messages: list[Message])
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:324
↓ 4 callersMethodby_name
(self, name: str)
chapter10/voice-werewolf/werewolf/game.py:139
↓ 4 callersMethodcalculate_idf
Return RSJ IDF with a small floor for corpus-ubiquitous terms. Raw RSJ IDF is negative when a term occurs in more than half of a tiny
chapter3/sparse-embedding/bm25_engine.py:285
↓ 4 callersMethodcalculate_term_score
Calculate BM25 score for a single term in a document
chapter3/sparse-embedding/bm25_engine.py:307
↓ 4 callersFunctioncalculate_total_tokens
Calculate total tokens required to inject all tool schemas.
chapter4/active-tool-selection/tool_knowledge_base.py:619
↓ 4 callersFunctioncalibration_report
( trajectories: Iterable[Dict[str, Any]], reports: Iterable[Dict[str, Any]] )
chapter9/trajectory-verifier/calibration.py:10
↓ 4 callersMethodcall_tool
Call an MCP tool by spawning a fresh server connection Args: tool_key: Tool key in format "server.tool_name"
chapter6/agent-with-event-trigger/agent.py:201
↓ 4 callersFunctioncandidate_workflow
()
chapter9/browser-use-rpa/workflow_validation_demo.py:80
↓ 4 callersFunctioncanonical_nav_labels
Discover the named entries in the canonical MkDocs nav tree.
scripts/site_i18n.py:100
↓ 4 callersFunctioncard
(k, x, y, width, height, options, attributes = {})
web-astro/scripts/evaluation-overview-figures.mjs:78
↓ 4 callersFunctioncard
( x, y, width, height, { fill = palette.panel, rx = 8, extra = '' } = {}, )
web-astro/scripts/collaboration-manager-figures.mjs:80
← previousnext →701–800 of 13,003, ranked by callers