MCPcopy Create free account

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

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

Methodresponse_generator
()
chapter3/contextual-retrieval/agent.py:363
Methodresponse_generator
()
chapter3/agentic-rag/agent.py:432
Methodrestart
Restart the server
chapter2/local_llm_serving/server.py:163
Functionrestore_source_typography
(source_root, target_root)
book-vi/fix_svg_text_layout.py:317
Methodreview_stockouts
(self, parent_org_unit: str, period: str)
chapter7/public-health-reporting-eval/reporting_tools.py:118
Functionreward_func
TRL GRPO 奖励回调:dataset 的 task_id 列会作为关键字参数透传进来。
chapter8/premature-completion-dpo/train_grpo_optional.py:85
Functionrobocrew_function_declarations
Return JSON-compatible declarations for a RoboCrew/Gemini bridge.
chapter6/gemini-xlerobot-navigation/xlerobot_tool_contract.py:40
Functionroot
Root endpoint with API information
chapter6/agent-with-event-trigger/server_fastapi.py:207
Functionroot
Root endpoint with API information
chapter6/agent-with-event-trigger/server.py:213
Functionroot
Root endpoint.
chapter3/structured-index/api_service.py:106
Functionroot
Root endpoint with service information.
chapter3/retrieval-pipeline/main.py:85
Functionroot
Root endpoint.
chapter3/dense-embedding/main.py:167
Functionroot
Serve a simple HTML interface for the search engine
chapter3/sparse-embedding/server.py:61
Methodrounds
Get the number of conversation rounds (user-assistant pairs).
chapter3/user-memory-evaluation/models.py:61
Methodroundtrip_user
(self, speaker, text, round_no)
chapter10/voice-werewolf/test_user_simulator.py:28
Methodroute
(self, dp: Datapoint, available_models: list[Model])
chapter2/prompt-engineering/tau_bench/model_utils/api/router.py:16
Methodroute
(self, dp: Datapoint, available_models: list[Model])
chapter2/prompt-engineering/tau_bench/model_utils/api/router.py:55
Methodrps
吞吐(请求/秒):成功请求数 / 整批墙钟耗时。并发越高一般越大,直到触顶。
chapter7/model-benchmark/benchmark.py:228
Methodrun
(self)
chapter6/agent-with-event-trigger/event_loop_demo.py:84
Methodrun
(self)
chapter6/agent-with-event-trigger/event_loop_demo.py:109
Methodrun
(self)
chapter6/agent-with-event-trigger/event_loop_demo.py:145
Methodrun
(self)
chapter10/parallel-web-research/test_completed_worker_ack_regression.py:24
Methodrun
(self)
chapter10/parallel-web-research/test_coordination.py:43
Methodrun_benchmark
Run full benchmark Args: memory_modes: List of memory modes to test (defaults to all) test_ids: Spec
chapter3/user-memory/locomo_benchmark.py:441
Functionrun_case
( experiment: str, config_path: Path, test_id: str, output: Path, readiness: Path | None =
chapter7/user-memory-system-evaluation/run_full.py:114
Functionrun_case
(job)
chapter2/system-hint/run_experiment_2_8.py:885
Methodrun_case
(self, case: Dict[str, Any])
chapter3/memory_rag_campaign.py:393
Methodrun_case
(self, case: Dict[str, Any])
chapter3/agentic-rag/campaign.py:230
Functionrun_image_transfer_oracle
Mirrors func_test_image_post + (PEDO-relevant subset of) sec_test_guessable_id. The PATH_TRAVERSAL, XSS, and UNRESTRICTED_UPLOAD parts of BaxBench
chapter5/permission-embedded-data-objects/pedo/eval/baxbench_adapter/oracle.py:248
Functionrun_naive
(a) 朴素做法:前缀不稳定 + 不压缩历史(KV-cache 命中不了、上下文疯长)。
chapter7/agent-cost-analysis/agent.py:264
Functionrun_native_gpt_image_route
原生路线 B:GPT-Image 2(gpt-image-2)一次调用直接出图。
chapter1/image-gen-workflow/pipeline.py:391
Functionrun_native_route
原生路线:一次调用直接出图。
chapter1/image-gen-workflow/pipeline.py:378
Methodrun_one
(tool_call: Dict[str, Any])
chapter2/local_llm_serving/ollama_native.py:83
Methodrun_one
(tool_call)
chapter2/local_llm_serving/ollama_native.py:447
Methodrun_one
(tool_call: Dict[str, Any])
chapter2/local_llm_serving/agent.py:104
Methodrun_one
(self, case: Dict[str, Any], mode: str)
chapter3/user-memory/run_evaluation.py:245
Functionrun_optimized
(b) KV-cache 友好 + 上下文压缩:稳定长前缀命中缓存 + 旧轮次摘要。
chapter7/agent-cost-analysis/agent.py:270
Functionrun_orchestration
chapters:{chapter_name: 原文} 的有序字典 out_dir:产物目录(术语表、各章译文、审校报告都写到这里) 可选参数: source_lang / target_lang:源语言 / 目标语言(默认 英文 → 中文,与旧行为一致)。
chapter10/book-translation/agents.py:461
Functionrun_python_snippet
供 tool_manager 复用:在同一沙箱环境执行一段脚本并返回结果(不做 pip)。
chapter9/self-evolving-tools/base_tools.py:209
Functionrun_secret_storage_oracle
Mirrors func_test_logins_and_own_secret_management + sec_test_other_users_secrets from BaxBench's secret_storage.py.
chapter5/permission-embedded-data-objects/pedo/eval/baxbench_adapter/oracle.py:59
Functionrun_shopping_cart_oracle
Mirrors func_test_cart_operation + sec_test_guess_cart + sec_test_neg_cart_operation from BaxBench's shopping_cart_service.py.
chapter5/permission-embedded-data-objects/pedo/eval/baxbench_adapter/oracle.py:184
Functionrun_single_agent
朴素基线:一个 Agent 在同一条不断增长的对话里,先粗读全书, 再逐章翻译。没有独立的术语表工具来“钉死”术语,且上下文随章节累积。 这一模式用于暴露两个问题: - 上下文膨胀:单条对话的上下文峰值 = 累积到最后一章时的全部内容; - 术语漂
chapter10/book-translation/agents.py:668
Functionrun_suite
跑完整套测试用例,返回结果列表。
chapter5/log-diagnosis/replay.py:126
Methodrun_sync
Synchronous wrapper for run method. Args: max_steps: Maximum steps for browser-use agent Return
chapter9/browser-use-rpa/learning_agent/agent.py:599
Functionrun_task
给定任务输入,确定性地跑一遍被测系统,返回一条轨迹。
chapter5/log-diagnosis/sut.py:21
Functionrun_trial
( client: OpenAI, protocol: dict[str, Any], protocol_hash: str, run_dir: Path, attack_inde
chapter2/prompt-injection/run_campaign.py:107
Functionrun_user_creation_oracle
Mirrors func_test_invite_only + sec_test_create_user_without_invite + sec_test_guessable_invite_id from BaxBench's user_creation.py.
chapter5/permission-embedded-data-objects/pedo/eval/baxbench_adapter/oracle.py:132
Functionrun_with_timeout
Run a function with a timeout.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_safety.py:269
Functionrun_workflow_route
工作流路线:改写 → 生图。返回 run 记录(含各节点 call records)。
chapter1/image-gen-workflow/pipeline.py:348
Functionsafe_name
(value: str)
chapter2/prompt-injection/run_campaign.py:47
Functionsample_files
Create sample files for testing
chapter5/coding-agent/tests/conftest.py:28
Functionsample_notebook
Create a sample Jupyter notebook
chapter5/coding-agent/tests/test_notebook_edit_tool.py:13
Methodsave
(self, path)
book-en/svg_lib.py:540
Methodsave
(self, path)
book-tr/svg_lib.py:540
Methodsave
(self, path)
book-ar/svg_lib.py:566
Methodsave
(self, path)
book-ru/svg_lib.py:540
Methodsave
(self, path)
book-es/svg_lib.py:540
Methodsave
(self, path)
book-mn/svg_lib.py:541
Methodsave
(self, path)
book-id/svg_lib.py:540
Methodsave
Save configuration to JSON file
chapter3/contextual-retrieval-for-user-memory/config.py:240
Methodsave_chunks
Save chunks to a JSON file Args: chunks: List of conversation chunks filepath: Path to save the chun
chapter3/agentic-rag-for-user-memory/chunker.py:297
Methodsave_chunks
Save chunks to a JSON file Args: chunks: List of conversation chunks filepath: Path to save the chun
chapter3/contextual-retrieval-for-user-memory/chunker.py:297
Functionsave_completed
(arm_key: str, row: dict)
chapter5/small-model-codified-rules/demo.py:467
Functionsave_event
(call_id: str, envelope: EventEnvelope)
chapter6/phone-agent/webrtc_app.py:648
Methodsave_index
Save the index and memory to disk
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:582
Functionsave_jobs
(job: Job)
chapter9/browser-use-rpa/browser-use/examples/use-cases/find_and_apply_to_jobs.py:55
Methodsave_memory
Save memory to storage
chapter3/user-memory/memory_manager.py:90
Functionsave_models
(params: Models)
chapter9/browser-use-rpa/browser-use/examples/custom-functions/save_to_file_hugging_face.py:33
Methodsave_pdf
(browser_session: BrowserSession)
chapter9/browser-use-rpa/browser-use/tests/ci/test_registry.py:634
Methodsave_state
Save agent state to file.
chapter3/mem0/agent.py:482
Methodsave_trajectory
Save agent trajectory to file Args: trajectory: The trajectory to save filepath: Path to save the tr
chapter3/agentic-rag-for-user-memory/agent.py:372
Methodsave_trajectory
Save agent trajectory to file Args: trajectory: The trajectory to save filepath: Path to save the tr
chapter3/contextual-retrieval-for-user-memory/agent.py:368
Methodsay
(self, _text)
chapter10/autonomous-phone-registration/test_orchestration.py:121
Methodsay
(self, text: str)
chapter10/autonomous-phone-registration/voice.py:40
Methodsay
(self, text: str)
chapter10/autonomous-phone-registration/voice.py:138
Methodsay
(self, speaker, text, round_no, allow_barge_in=False)
chapter10/voice-werewolf/test_user_simulator.py:22
Methodscenario
()
chapter9/browser-use-rpa/test_real_playwright_campaign.py:21
Functionscenario_1
(client, model, params)
chapter6/async-agent/demo.py:134
Functionscenario_2
(client, model, params)
chapter6/async-agent/demo.py:152
Functionscenario_3
(client, model, params)
chapter6/async-agent/demo.py:171
Functionscenario_4
(client, model, params)
chapter6/async-agent/demo.py:187
Functionscenario_batching
批处理:在不同并发度下并发发起请求,测量聚合吞吐。 连续批处理(continuous batching)是本地 serving 的核心优化:并发越高, GPU 利用率越充分,系统聚合吞吐(所有请求合计 tok/s)通常显著上升, 但单个请求的延迟可能上升。此场景把这个权衡直
chapter2/local_llm_serving/benchmark.py:227
Functionscenario_kv_cache
KV Cache 命中 vs 未命中的 TTFT 对比(实验 2-1 第 5 点)。 - 命中组:系统提示词逐字节不变,重复发送同一请求,服务端前缀缓存命中, prefill 几乎可以跳过 → TTFT 明显更低。 - 未命中组:每次只在系统提示词「开头」插入一个不同的
chapter2/local_llm_serving/benchmark.py:180
Functionscenario_throughput
单流吞吐 + TTFT:连续发起若干次解码密集的请求并汇总统计。
chapter2/local_llm_serving/benchmark.py:153
FunctionscheduleRefresh
()
web-astro/src/scripts/reader-navigation.ts:167
Methodscore
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:421
Methodscore
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:341
Methodscore
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/model/model.py:116
Methodscore
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/model/general_model.py:115
Methodscore_dp
(self, dp: Datapoint, examples: list[ScoreDatapoint] | None = None)
chapter2/prompt-engineering/tau_bench/model_utils/api/router.py:38
Methodscreenshot
Take a screenshot of this element and return base64 encoded image. Args: format: Image format ('jpeg', 'png', 'webp') quality: Quality 0-100
chapter9/browser-use-rpa/browser-use/browser_use/actor/element.py:681
Methodscreenshot_callback
(agent_instance)
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:82
Methodscreenshot_paths
Get all screenshot paths from history
chapter9/browser-use-rpa/browser-use/browser_use/agent/views.py:510
Methodscroll
(params: ScrollAction, browser_session: BrowserSession)
chapter9/browser-use-rpa/browser-use/browser_use/tools/service.py:728
Methodscroll_info
Calculate scroll information for this element if it's scrollable.
chapter9/browser-use-rpa/browser-use/browser_use/dom/views.py:637
Methodscroll_page
(direction: str = 'down', amount: int = 100, browser_session: BrowserSession = None)
chapter9/browser-use-rpa/browser-use/tests/ci/test_registry.py:620
Methodscroll_to_input
Scroll to the input field to ensure it's visible.
chapter9/browser-use-rpa/browser-use/browser_use/cli.py:847
Methodscroll_to_text
(text: str, browser_session: BrowserSession)
chapter9/browser-use-rpa/browser-use/browser_use/tools/service.py:792
Functionsearch
()
scripts/book_figures/chapter5.py:45
Functionsearch
Search for documents
chapter3/sparse-embedding/server.py:412
← previousnext →9,801–9,900 of 13,003, ranked by callers