MCPcopy Create free account

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

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

↓ 2 callersMethodapi_key
Read this provider's API key from the environment. Returns: The first non-empty value among ``key_vars``, stripped of
agentbook/providers/models.py:51
↓ 2 callersMethodappend_file_content
Append content to internal content
chapter9/browser-use-rpa/browser-use/browser_use/filesystem/file_system.py:41
↓ 2 callersFunctionapplyDocumentLocale
(code)
extras/lang-switcher.js:433
↓ 2 callersFunctionapplyZoom
(center = true)
web-astro/src/scripts/figure-viewer.ts:17
↓ 2 callersFunctionapply_excel_formula
Apply formula to Excel cell. Args: file_path: Path to Excel file sheet_name: Worksheet name cell: Cell reference
chapter4/collaboration-tools/src/excel_tools.py:188
↓ 2 callersFunctionapply_tone_modification
Apply tone modification to text (wiki or system prompt) Args: text: Original text tone_style: The tone style to apply
chapter2/prompt-engineering/ablation_utils.py:61
↓ 2 callersFunctionarmStallTimer
(conf)
extras/auto-translate.js:175
↓ 2 callersFunctionarm_outcome
Collapse an arm into the one word the ablation table should show. ``Completed`` cannot distinguish the two ways an ablated arm ends without t
chapter1/context/run_experiment_1_1.py:307
↓ 2 callersFunctionarrow
(path, edge, { muted = false } = {})
web-astro/scripts/training-systems-figures.mjs:53
↓ 2 callersFunctionarrow
(path, { muted = false } = {})
web-astro/scripts/training-workflows-figures.mjs:53
↓ 2 callersFunctionatomic_json
(path: Path, value: Any)
chapter5/conversational-ui/campaign_browser.py:54
↓ 2 callersFunctionatomic_json
(path: Path, value: Any)
chapter2/system-hint/run_experiment_2_8.py:43
↓ 2 callersFunctionatomic_json
(path: Path, payload: Any)
chapter2/prompt-injection/run_campaign.py:40
↓ 2 callersFunctionatomic_json
(path: Path, value: Any)
chapter10/generative-agents/run_campaign.py:60
↓ 2 callersMethodattach
(self, domains: list[str] | None = None)
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:121
↓ 2 callersMethodattach_all_watchdogs
Initialize and attach all watchdogs with explicit handler registration.
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:1086
↓ 2 callersMethodattach_handler_to_session
Attach a single event handler to a browser session. Args: browser_session: The browser session to attach to event_class: The event class to l
chapter9/browser-use-rpa/browser-use/browser_use/browser/watchdog_base.py:55
↓ 2 callersFunctionauthenticate
(store, username, password)
chapter7/model-action-threshold/tasks/crosscutting_identity/repo/accounts/authentication.py:1
↓ 2 callersFunctionavailability_summary
(rows: Sequence[dict[str, Any]])
chapter7/model-benchmark/analysis.py:124
↓ 2 callersFunctionavailable_width
(node, shape, row_regions, root)
book-vi/fix_svg_text_layout.py:273
↓ 2 callersFunctionbanner
(title)
chapter5/video-edit/demo.py:42
↓ 2 callersFunctionbase_messages
(protocol: dict[str, Any])
chapter2/attention_visualization/run_status_bar_experiment.py:78
↓ 2 callersMethodbatch_search
批量搜索多个问题 Args: questions: 问题列表 Returns: 答案列表
chapter1/web-search-agent/examples.py:20
↓ 2 callersFunctionbehavior_flags
(text: str)
chapter8/cot-distillation/evaluate_student.py:33
↓ 2 callersFunctionbehavior_metrics
Measure candidate behavior inside the same locked-down sandbox.
chapter9/self-modifying-agent/evolution.py:246
↓ 2 callersFunctionbenchmark_provider
对单个提供商发起 num_requests 次请求(并发 concurrency)。
chapter7/model-benchmark/benchmark.py:280
↓ 2 callersMethodbinary_classify
( self, instruction: str, text: str, examples: list[BinaryClassifyDatapoint] |
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:264
↓ 2 callersMethodbroadcast
公开信息:进入**所有玩家**(含已出局者)的上下文。
chapter10/voice-werewolf/werewolf/game.py:111
↓ 2 callersFunctionbrowserTranslator
()
web-astro/src/lib/i18n.ts:29
↓ 2 callersFunctionbrowser_list_tabs
List all open browser tabs. Returns: Dictionary with list of tabs
chapter4/collaboration-tools/src/browser_tools.py:252
↓ 2 callersFunctionbrowser_navigate
Navigate to a URL in the browser. Args: url: The URL to navigate to new_tab: Whether to open in a new tab Return
chapter4/collaboration-tools/src/browser_tools.py:67
↓ 2 callersMethodbuild
(self, test_case: TestCase)
chapter7/user-memory-system-evaluation/experiment.py:557
↓ 2 callersFunctionbuild_catalog
Validate all sources and return the compact browser catalog.
scripts/site_i18n.py:168
↓ 2 callersFunctionbuild_classify_state
( instruction: str, text: str, options: list[str], examples: list[ClassifyDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:240
↓ 2 callersFunctionbuild_classify_state
( instruction: str, text: str, options: list[str], examples: list[ClassifyDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:179
↓ 2 callersFunctionbuild_engine
把语料灌进引擎;用给定的 k1/b 重建 BM25。
chapter3/sparse-embedding/cli.py:99
↓ 2 callersFunctionbuild_generate_state
( instruction: str, text: str, examples: list[GenerateDatapoint] | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:68
↓ 2 callersFunctionbuild_generate_state
( instruction: str, text: str, examples: list[GenerateDatapoint] | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:224
↓ 2 callersFunctionbuild_historical_leaderboards
Build leaderboard snapshots at different time points. Args: df: Full voting DataFrame time_slices: List of (end_date, sl
chapter7/elo-leaderboard/leaderboard.py:130
↓ 2 callersMethodbuild_index
Build RAPTOR tree index from text.
chapter3/structured-index/raptor_indexer.py:180
↓ 2 callersMethodbuild_knowledge_graph
Build knowledge graph from text.
chapter3/structured-index/graphrag_indexer.py:171
↓ 2 callersFunctionbuild_leaderboard_optimized
Build Elo leaderboard using highly optimized NumPy + Numba algorithm. This implementation is significantly faster than the basic version
chapter7/elo-leaderboard/optimized_elo.py:278
↓ 2 callersFunctionbuild_manifest
( requirements: List[Dict[str, str]], runs: List[Dict[str, Any]], project_root: Path, notes: L
chapter1/image-gen-workflow/evidence.py:124
↓ 2 callersMethodbuild_messages
把轨迹渲染成 OpenAI chat 消息列表。
chapter6/async-agent/runtime.py:146
↓ 2 callersFunctionbuild_padded_system_prompt
构造一个约含 target_tokens 个 token 的系统提示词(用重复句子填充)。 这里用「4 字符 ≈ 1 token」的粗略估计来控制长度,只需保证前缀足够长、 可复现即可,不追求精确的 token 数。
chapter2/local_llm_serving/benchmark.py:60
↓ 2 callersFunctionbuild_parse_force_state
( instruction: str, typ: type[T] | dict[str, Any], text: str | None = None, examples: list[Par
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:87
↓ 2 callersFunctionbuild_parse_force_state
( instruction: str, typ: type[T] | dict[str, Any], text: str | None = None, examples: list[Par
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:84
↓ 2 callersFunctionbuild_parse_state
( text: str, typ: type[T] | dict[str, Any], examples: list[ParseDatapoint] | None = None, suff
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:191
↓ 2 callersFunctionbuild_parse_state
( text: str, typ: type[T] | dict[str, Any], examples: list[ParseDatapoint] | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:137
↓ 2 callersFunctionbuild_parser
()
chapter3/retrieval-pipeline/evaluate.py:650
↓ 2 callersFunctionbuild_puzzle
求解校验(要求解唯一)并组装成写入 puzzles.json 的一条记录。
chapter5/code-for-logic/build_puzzles.py:98
↓ 2 callersFunctionbuild_reference_library
Use Fish S1 to render 24 same-speaker, different-prosody references.
chapter6/controllable-tts/voice_library.py:54
↓ 2 callersFunctionbuild_score_state
( instruction: str, text: str, min: int, max: int, examples: list[ScoreDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:143
↓ 2 callersFunctionbuild_score_state
( instruction: str, text: str, min: int, max: int, examples: list[ScoreDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:54
↓ 2 callersFunctionbuild_system_prompt
(catalog: dict)
chapter2/agent-skills-ppt/demo.py:85
↓ 2 callersMethodcalculate_summary
Calculate summary statistics across all metrics
chapter3/log-sanitization/metrics.py:60
↓ 2 callersFunctioncall
( client: OpenAI, model: str, purpose: str, messages: list[dict[str, str]], )
chapter5/dynamic-form/campaign.py:98
↓ 2 callersFunctioncall_generated_func
Call the generated function with appropriate arguments based on prompt type.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_safety_final.py:264
↓ 2 callersFunctioncampaign_completion
Separate protocol completion from the observed accuracy hypothesis. A negative paired result is still a completed experiment. Completion is t
chapter5/code-for-math/demo.py:473
↓ 2 callersFunctioncampaign_completion
Check exact protocol execution without requiring a positive result.
chapter5/code-for-logic/demo.py:405
↓ 2 callersFunctioncampaign_fingerprint
( chapters: dict[str, str], translation_units: dict[str, str], provider: str, model: str )
chapter10/book-translation/run_official_experiment.py:482
↓ 2 callersMethodcancel_reservation_codified
实验组:政策事实一律查库、时间取服务端时钟,不采信模型自报参数。 - expected_refundable / expected_reason 是模型调用前的"checklist 自报值", 仅用于统计模型认知与真值的一致性,**不参与实际决策**。
chapter5/small-model-codified-rules/airline_env.py:129
↓ 2 callersMethodcancel_reservation_naive
控制组:只要被调用就取消并**无条件全额退款**。 代表"没有代码化规则"的系统:工具完全信任上游(模型)的判断。 因此政策是否被遵守,完全取决于模型的自然语言推理。
chapter5/small-model-codified-rules/airline_env.py:109
↓ 2 callersFunctioncancel_timer
Cancel an active timer. Args: timer_id: ID of the timer to cancel Returns: Dictionary with cancellation status
chapter4/collaboration-tools/src/timer_tools.py:147
↓ 2 callersFunctioncanonical_answer_correct
Evaluate the known numeric rubric for the canonical Experiment 1-1 task. This is deliberately kept outside ``ContextAwareAgent``. A generic agen
chapter1/context/run_experiment_1_1.py:296
↓ 2 callersFunctioncanonical_bytes
(value: Any)
chapter10/parallel-web-research/run_official_experiment.py:55
↓ 2 callersFunctioncanonical_bytes
(value)
chapter10/multi-role-transfer/test_official_experiment.py:15
↓ 2 callersFunctioncanonical_bytes
(value: Any)
chapter10/multi-role-transfer/run_official_experiment.py:51
↓ 2 callersFunctioncanonical_json
(value: Any)
chapter2/system-hint/run_experiment_2_8.py:27
↓ 2 callersFunctioncanonical_provider_receipt
(path: Path)
chapter10/generative-agents/validate_campaign.py:89
↓ 2 callersFunctioncap_text_length
Cap text length for display.
chapter9/browser-use-rpa/browser-use/browser_use/dom/utils.py:1
↓ 2 callersFunctioncapture_dom_state
Capture DOM state and return analysis
chapter9/browser-use-rpa/browser-use/tests/scripts/debug_iframe_scrolling.py:130
↓ 2 callersFunctioncard
(x, y, width, height, { fill = '#f0f0f0', dash = false } = {})
web-astro/scripts/training-systems-figures.mjs:51
↓ 2 callersFunctioncard
( x, y, width, height, { fill = palette.panel, rx = 8, extra = '' } = {}, )
web-astro/scripts/evolution-methods-figures.mjs:77
↓ 2 callersFunctioncard
(x, y, width, height, { fill = '#f0f0f0', dash = false } = {})
web-astro/scripts/training-workflows-figures.mjs:51
↓ 2 callersFunctioncardLabels
(entries, x, y, width, height)
web-astro/scripts/evolution-flow-figures.mjs:113
↓ 2 callersFunctioncards
(items, colors = ["blue", "green", "orange"])
slides/generate.mjs:39
↓ 2 callersFunctioncase_fixture
()
chapter7/user-memory-policy-eval/test_runner.py:9
↓ 2 callersMethodcdp_client_for_frame
Get a CDP client attached to the target containing the specified frame. Builds a unified frame hierarchy from all targets to find the correct targe
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:2306
↓ 2 callersMethodchangeLanguage
(name: string)
web-astro/src/scripts/machine-translation.ts:17
↓ 2 callersMethodchange_directory
Change the current working directory. Args: directory: Directory to change to Returns:
chapter4/execution-tools/terminal_controller.py:105
↓ 2 callersFunctionchanged_environment
()
chapter9/browser-use-rpa/workflow_validation_demo.py:130
↓ 2 callersFunctionchapterLessonsFor
(lesson)
slides/generate.mjs:102
↓ 2 callersMethodchat
Send a single-turn chat and return the assistant's text reply.
chapter7/elo-leaderboard/llm_judge.py:90
↓ 2 callersMethodchat
(self, **kwargs)
chapter3/log-sanitization/tests/test_sanitize_conversation.py:33
↓ 2 callersFunctionchat_with_receipt
发起一次 Chat Completions 调用,返回(文本内容, 证据回执)。
chapter8/premature-completion-dpo/llm_client.py:52
↓ 2 callersFunctioncheck
(name: str, ok: bool, evidence: Any, required: bool = True)
chapter7/openvla-robotwin2-eval/experiment.py:103
↓ 2 callersFunctioncheck_all_violations
Check DB state for violations.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_application.py:197
↓ 2 callersFunctioncheck_llm_receipt
(receipt: dict[str, Any], prefix: str, failures: list[str])
chapter6/phone-agent/verify_acceptance.py:100
↓ 2 callersFunctioncheck_pm_violations
Check all integrity violations in project management scenario.
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/harness.py:435
↓ 2 callersFunctioncheck_transition_violation
Check if a specific candidate's status transition was valid.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_safety_final.py:246
↓ 2 callersMethodchunk_conversation
Chunk a single conversation into segments Args: conversation_id: Unique conversation identifier test
chapter3/agentic-rag-for-user-memory/chunker.py:105
↓ 2 callersMethodchunk_text
Chunk text into smaller segments. Args: text: Document text to chunk doc_id: Document identifier
chapter3/contextual-retrieval/chunking.py:24
↓ 2 callersFunctionclassify
返回挂起原因;返回 None 表示低风险,可直接执行。
chapter9/harness-safety-gate/validation/real_20260807T160109Z/candidates/deterministic/confirmation_gate.py:29
↓ 2 callersFunctionclassify
故意过宽的反例:放行一切调用,保留为已拒绝候选。
chapter9/harness-safety-gate/validation/real_20260807T160109Z/candidates/rejected_control/confirmation_gate.py:29
↓ 2 callersMethodclassify
( self, instruction: str, text: str, options: list[str], examples: lis
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:239
↓ 2 callersFunctionclassify_status
Classify a run while reserving ``blocked`` for unavailable external gates.
chapter4/collaboration-tools/run_experiment_4_5.py:146
↓ 2 callersFunctionclean
(root: Path)
scripts/clean_site_files.py:81
↓ 2 callersMethodclear_documents
Clear all documents.
chapter3/retrieval-pipeline/test_client.py:43
↓ 2 callersMethodclear_index
Clear all indexed documents
chapter3/sparse-embedding/bm25_engine.py:525
← previousnext →2,001–2,100 of 13,003, ranked by callers