MCPcopy Create free account

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

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

↓ 3 callersMethodemit
触发:把事件推入事件队列,唤醒事件循环。
chapter6/agent-with-event-trigger/event_loop_demo.py:62
↓ 3 callersFunctionensure_sample_pdfs
Ensure sample PDFs exist, create them if they don't Returns: bool: True if PDFs are available
chapter1/context/main.py:667
↓ 3 callersFunctionestimated_width
(value: str, font_size: float)
book-vi/fix_svg_text_layout.py:191
↓ 3 callersMethodevaluate
(self, trajectory: Dict[str, Any])
chapter9/trajectory-verifier/verifier.py:374
↓ 3 callersMethodevaluate_batch
Analyze a batch of snippets and aggregate the results.
chapter5/coding-agent/sandbox_evaluator.py:190
↓ 3 callersFunctionevaluate_boundary
(final_answer: str, history: list[dict], case: dict)
chapter10/multi-role-transfer/evaluation.py:283
↓ 3 callersMethodevaluate_privilege_escalation
Evaluates attempts to perform unauthorized privilege escalation.
chapter5/permission-embedded-data-objects/run_live_security_eval.py:679
↓ 3 callersMethodevaluate_response
Evaluate a single response
chapter3/agentic-rag/evaluation/evaluate.py:44
↓ 3 callersFunctionevaluate_rules
在保留集上逐段调用一次 LLM judge,不使用词表或正则探针。
chapter9/ai-style-skill/evaluate.py:32
↓ 3 callersMethodevaluate_scenarios
Evaluates a campaign of security scenarios and aggregates security metrics.
chapter5/permission-embedded-data-objects/run_live_security_eval.py:801
↓ 3 callersFunctionevaluate_security_policies
Main entrypoint function for evaluating security policies across scenarios. Args: scenarios: Optional list of SecurityScenario objects or
chapter5/permission-embedded-data-objects/run_live_security_eval.py:939
↓ 3 callersFunctionevaluation
(holdout=(2, 2), boundary=(0, 2))
chapter9/prompt-auto-optimization/tests/test_learning_and_release.py:7
↓ 3 callersFunctionexecute
(tool_name, args)
chapter9/harness-safety-gate/evolution.py:390
↓ 3 callersMethodexecute_command
Execute a shell command in current directory. Args: command: Command to execute timeout: Timeout in
chapter4/execution-tools/terminal_controller.py:39
↓ 3 callersMethodexecute_task
Execute task with all tools pre-loaded.
chapter4/active-tool-selection/agent.py:438
↓ 3 callersFunctionexecution_config_fingerprint
Bind request semantics while permitting price/reference-only re-analysis.
chapter7/model-benchmark/campaign.py:51
↓ 3 callersFunctionexpected_by_task
(path: str | Path)
chapter7/public-health-reporting-eval/evaluator.py:18
↓ 3 callersMethodexpected_score
Calculate expected win probability for model A against model B. Uses logistic function: P(A wins) = 1 / (1 + 10^((R_B - R_A)
chapter7/elo-leaderboard/elo_rating.py:39
↓ 3 callersFunctionextractLabels
(source, figure, expectedLabels, expectedShape)
web-astro/scripts/collaboration-society-figures.mjs:25
↓ 3 callersFunctionextract_answer_from_gsm8k_format
从 #### number 格式中提取答案
chapter8/Intuitor/evaluate_from_cache.py:45
↓ 3 callersFunctionextract_csv_content
Extract and parse CSV file content. Args: file_path: Path to CSV file max_rows: Maximum rows to read Return
chapter4/perception-tools/src/document_processing_tools.py:249
↓ 3 callersFunctionextract_docx_content
Extract content from DOCX file. Args: file_path: Path to DOCX file Returns: TextContent with extracted cont
chapter4/perception-tools/src/document_processing_tools.py:102
↓ 3 callersFunctionextract_frame
抽取 t 秒处的一帧,缩放到 width 宽存为 PNG。
chapter5/video-edit/ffmpeg_utils.py:96
↓ 3 callersFunctionextract_json
(text: str)
chapter7/user-memory-system-evaluation/experiment.py:535
↓ 3 callersFunctionextract_pptx_content
Extract content from PPTX file. Args: file_path: Path to PPTX file Returns: TextContent with extracted cont
chapter4/perception-tools/src/document_processing_tools.py:175
↓ 3 callersFunctionfail
(message)
slides/generate.mjs:18
↓ 3 callersMethodfetch_webpage
Fetch a webpage and convert HTML to text Args: url: URL of the webpage to fetch Returns:
chapter2/context-compression/web_tools.py:114
↓ 3 callersFunctionfigurePaths
(directory, image)
web-astro/src/lib/figure-paths.mjs:2
↓ 3 callersMethodfind_workflow_for_task
Find the best matching workflow for a given task. Args: task_description: Natural language description of the ta
chapter9/browser-use-rpa/learning_agent/knowledge_base.py:148
↓ 3 callersFunctionfinish
(k, content, figure, height)
web-astro/scripts/evaluation-overview-figures.mjs:151
↓ 3 callersFunctionfinish
(k, content, figure, height)
web-astro/scripts/coding-production-layout.mjs:102
↓ 3 callersFunctionflatten_ncx
(data, title_label, toc_label)
flatten_epub_toc.py:107
↓ 3 callersFunctionformat_pred_label
Display token for progress lines when the model reply is unparseable.
chapter8/prompt-distillation/evaluate.py:49
↓ 3 callersMethodfrom_dict
Create workflow from dictionary
chapter9/browser-use-rpa/learning_agent/workflow.py:202
↓ 3 callersMethodgenerate
(self, prompt: str, sys_prompt: str)
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/harness.py:54
↓ 3 callersFunctiongenerate_all
()
chapter5/paper-to-ppt/make_figures.py:54
↓ 3 callersFunctiongenerate_bpy_script
把剪辑计划渲染成一段可执行的 Blender Python(bpy) 脚本文本(不依赖 bpy)。
chapter5/video-edit/blender_editor.py:153
↓ 3 callersFunctiongenerate_candidate
Generate the deterministic comparison candidate without touching stable.
chapter9/self-modifying-agent/evolution.py:154
↓ 3 callersFunctiongenerate_distillation_data
Generate prompt distillation training data. Args: input_file: Path to file containing sentences to classify (one per line)
chapter8/prompt-distillation/create_data.py:146
↓ 3 callersFunctiongenerate_python_code
Generate Python code based on task description. Args: task_description: Description of what the code should do requireme
chapter4/collaboration-tools/src/intelligence_tools.py:32
↓ 3 callersFunctiongenerate_rejected_control
故意过宽的反例:门禁存在但放行一切,保留为已拒绝候选。
chapter9/harness-safety-gate/evolution.py:342
↓ 3 callersFunctiongenerate_request
( url: str, prompt: str, temperature: float = 0.0, force_json: bool = False, **req_body_kw
chapter2/prompt-engineering/tau_bench/model_utils/model/vllm_utils.py:8
↓ 3 callersMethodgeneration_success_rate
GSR: fraction of prompts where LLM produced executable code.
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/metrics.py:95
↓ 3 callersMethodgetRequestPayload
(messages, options = {})
chapter6/live-audio/backend/utils/providers/llmProviders.js:160
↓ 3 callersMethodget_api_key
Get API key for the specified provider.
chapter4/execution-tools/config.py:91
↓ 3 callersMethodget_api_turns
Return detached real-provider evidence for the latest question.
chapter1/web-search-agent/agent.py:553
↓ 3 callersMethodget_attribute
Get an attribute value.
chapter9/browser-use-rpa/browser-use/browser_use/actor/element.py:640
↓ 3 callersMethodget_base_url
Get base URL for the configured provider
chapter5/coding-agent/config.py:64
↓ 3 callersFunctionget_board_state
Get the current board state. Returns: Dictionary with complete board state
chapter4/collaboration-tools/src/chess_tools.py:251
↓ 3 callersFunctionget_client
()
chapter9/prompt-auto-optimization/config.py:120
↓ 3 callersFunctionget_cloud_browser_cdp_url
Get a CDP URL for a new cloud browser instance. Returns: str: CDP URL for connecting to the cloud browser Raises: CloudBrowserAuthError: If au
chapter9/browser-use-rpa/browser-use/browser_use/browser/cloud.py:231
↓ 3 callersMethodget_command_history
Get recent command history. Args: count: Number of recent commands Returns: Dic
chapter4/execution-tools/terminal_controller.py:480
↓ 3 callersFunctionget_compound_synonyms
Retrieve synonyms for a PubChem compound. Args: cid: PubChem Compound ID max_synonyms: Maximum number of synonyms (1-100
chapter4/perception-tools/src/pubchem_tools.py:378
↓ 3 callersMethodget_context_string
Get memory cards as formatted string for LLM context. Args: max_cards: Maximum number of cards to include (None
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:269
↓ 3 callersMethodget_conversation_context
Get surrounding context for a specific chunk Args: chunk_id: The chunk ID to get context for context
chapter3/agentic-rag-for-user-memory/tools.py:104
↓ 3 callersMethodget_current_target_info
Get info about the current active target using CDP.
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:1582
↓ 3 callersMethodget_default_model
Get default model for the specified provider Args: provider: Provider name (defaults to LLM_PROVIDER)
chapter1/context/config.py:136
↓ 3 callersMethodget_document
Get a document by ID.
chapter3/retrieval-pipeline/document_store.py:44
↓ 3 callersMethodget_document
Retrieve a document by ID (can be internal or external)
chapter3/sparse-embedding/bm25_engine.py:491
↓ 3 callersMethodget_dom_tree
Get the DOM tree for a specific target. Args: target_id: Target ID of the page to get the DOM tree for. initial_html_frames: List of HTML fra
chapter9/browser-use-rpa/browser-use/browser_use/dom/service.py:451
↓ 3 callersMethodget_full_conversation
Retrieve all chunks from a specific conversation Args: conversation_id: Conversation identifier test
chapter3/agentic-rag-for-user-memory/tools.py:188
↓ 3 callersMethodget_index
Get the index of the action
chapter9/browser-use-rpa/browser-use/browser_use/tools/registry/views.py:51
↓ 3 callersFunctionget_legal_moves
Get all legal moves in the current position. Returns: Dictionary with legal moves in UCI and SAN formats
chapter4/collaboration-tools/src/chess_tools.py:213
↓ 3 callersFunctionget_move_history
Get the history of moves played in the current game. Returns: Dictionary with move history
chapter4/collaboration-tools/src/chess_tools.py:368
↓ 3 callersMethodget_or_load
(self, key, loader)
chapter7/model-action-threshold/tasks/cache_contract/repo/cachelib/cache.py:11
↓ 3 callersMethodget_recent_turns
Get recent conversation turns Args: limit: Maximum number of turns to return Returns:
chapter3/user-memory/conversation_history.py:118
↓ 3 callersMethodget_size
Get the current number of items in the index.
chapter3/dense-embedding/indexing.py:382
↓ 3 callersFunctionget_temperature
在调用时按当前解析出的模型选择温度,使 CLI/env 的 --model/--provider 覆盖生效。原来的模块级 TEMPERATURE 常量在 import 时就被固定,而 demo.py 在 import 之后才设置 LLM_MODEL/LLM_PROVIDER,导致温度
chapter9/prompt-auto-optimization/config.py:218
↓ 3 callersMethodget_tool
Get tool instance by name
chapter5/coding-agent/tool_registry.py:38
↓ 3 callersMethodget_user_message
Get complete state as a single cached message
chapter9/browser-use-rpa/browser-use/browser_use/agent/prompts.py:318
↓ 3 callersFunctiongraphql
(query: str, variables: dict, token: str, retries: int = 4)
scripts/gen_star_history.py:124
↓ 3 callersFunctionguard_reasoning_process
Guard and validate a proposed action or reasoning. Args: proposed_action: The action being proposed context: Context inf
chapter4/collaboration-tools/src/intelligence_tools.py:140
↓ 3 callersFunctionhandle_browser_error
(e: BrowserError)
chapter9/browser-use-rpa/browser-use/browser_use/tools/service.py:87
↓ 3 callersFunctionhas_verification_action
(text: str)
chapter8/premature-completion-dpo/evaluate.py:48
↓ 3 callersFunctionhelpers
(labels, markerId)
web-astro/scripts/collaboration-society-figures.mjs:47
↓ 3 callersFunctionhelpers
()
web-astro/scripts/evolution-flow-figures.mjs:78
↓ 3 callersFunctionhidden_test_reward
单条补全的奖励:宣称完成要看隐藏测试结果,验证动作给小额奖励。
chapter8/premature-completion-dpo/train_grpo_optional.py:53
↓ 3 callersFunctionhr
(title="")
chapter10/book-translation/demo.py:129
↓ 3 callersFunctionimage_path
(source_dir: Path, image: str)
chapter8/MiniMind-pretrain/validation/run_vlm_training_report_audit.py:325
↓ 3 callersFunctionindependent_asean_reference
Locally computed ground truth for the ASEAN nearest-pair check.
chapter1/search-codegen/run_experiment_1_3.py:78
↓ 3 callersMethodindex_file
Index a single file. Args: file_path: Path to the file doc_id: Optional document ID
chapter3/contextual-retrieval/chunking.py:166
↓ 3 callersMethodindex_file
Index a single file. Args: file_path: Path to the file doc_id: Optional document ID
chapter3/agentic-rag/chunking.py:166
↓ 3 callersMethodinfer_audio
( self, audio_path: str | Path, instruction: str, *, max_new_tokens: i
chapter6/end-to-end-speech/speech_model.py:108
↓ 3 callersFunctioninit
()
extras/nav-collapse.js:168
↓ 3 callersFunctioninstall
Redirect the upstream GPT-3/GPT-4 calls to compatible current models.
chapter10/generative-agents/provider_adapter.py:128
↓ 3 callersFunctionint_attr
(value: Any, name: str)
chapter7/model-benchmark/campaign.py:403
↓ 3 callersFunctioninteraction_analysis
Report full factorial cells and marginal gains instead of picking components independently.
chapter7/user-memory-system-evaluation/experiment.py:1301
↓ 3 callersFunctionis_failure_answer
判断 search_and_answer 的返回是否为失败兜底(未能正常作答)。
chapter1/web-search-agent/agent.py:85
↓ 3 callersFunctionis_openrouter_key
Report whether a credential looks like an OpenRouter key. OpenRouter issues keys under the ``sk-or-`` prefix, so a key the reader pasted can
agentbook/providers/openrouter.py:46
↓ 3 callersFunctionis_refundable
基于数据库真值 + 服务端时钟判断某预订是否可全额退款。 政策: 1) 非基础经济票(economy_flex / business)——可退。 2) 基础经济票下单 24h 内——可退。 3) 基础经济票遇航司原因(航班被取消 / 重大延误)——可退。
chapter5/small-model-codified-rules/airline_env.py:52
↓ 3 callersMethodis_running
Check if server is running
chapter2/local_llm_serving/server.py:147
↓ 3 callersMethodjson
(self)
chapter1/web-search-agent/tests/test_agent.py:22
↓ 3 callersFunctionjsonFetch
(url, options = {})
chapter6/phone-agent/static/app.js:36
↓ 3 callersFunctionjson_safe
(value: Any)
chapter6/claude-computer-use-native/run_weather_task.py:48
↓ 3 callersFunctionlabel
( index, x, y, width, height, { size = 18, weight = 400, align = 'start', muted = fals
web-astro/scripts/collaboration-society-figures.mjs:48
↓ 3 callersFunctionlabel
( index, x, y, width, height, { size = 17, weight = 400, align = 'center', muted = fal
web-astro/scripts/training-sequences-figures.mjs:42
↓ 3 callersFunctionlabel
( entry, x, y, width, height, { size = 17, weight = 400, align = 'ce
web-astro/scripts/evolution-flow-figures.mjs:79
↓ 3 callersFunctionlayoutSimulationFidelity
(source, { rtl = false } = {})
web-astro/scripts/evaluation-spectrum-figures.mjs:179
↓ 3 callersFunctionlessonDuration
(lesson)
slides/generate.mjs:144
↓ 3 callersMethodline
(self, x1, y1, x2, y2, dash=False, color='border')
book-en/svg_lib.py:460
← previousnext →1,301–1,400 of 13,003, ranked by callers