MCPcopy Create free account

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

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

↓ 2 callersMethodclick
Click the element using the advanced watchdog implementation.
chapter9/browser-use-rpa/browser-use/browser_use/actor/element.py:92
↓ 2 callersFunctioncloseDropdown
(returnFocus)
extras/lang-switcher.js:461
↓ 2 callersFunctioncn
(...inputs: ClassValue[])
chapter6/live-audio/frontend/lib/utils.ts:4
↓ 2 callersFunctioncodeBlock
(k, ids, x, y, width, metrics, attributes = {})
web-astro/scripts/coding-production-layout.mjs:73
↓ 2 callersFunctioncodeMetrics
(k, ids, width)
web-astro/scripts/coding-production-layout.mjs:63
↓ 2 callersMethodcode_interpreter
Execute Python code for complex calculations and data processing Args: code: Python code to execute
chapter1/context/agent.py:285
↓ 2 callersFunctioncollectStats
()
chapter6/phone-agent/static/app.js:78
↓ 2 callersFunctioncollect_kimi_metadata
(events: list[dict], run_dir: Path)
chapter2/agent-skills-ppt/validate_official_run.py:91
↓ 2 callersFunctioncolorScale
(value: number)
chapter2/attention_visualization/frontend/components/AttentionPreview.tsx:61
↓ 2 callersFunctioncommand
(args: list[str], *, cwd: Path = SOURCE)
chapter9/hermes-self-evolution/finalize_evidence.py:26
↓ 2 callersFunctioncompare
( prompt_template: str, texts: List[str], teacher_labels: Dict[str, str], eval_results: Option
chapter8/prompt-distillation/compare.py:110
↓ 2 callersFunctioncompare_binary
(baseline: dict[str, bool], student: dict[str, bool])
chapter8/cot-distillation/evaluate_student.py:47
↓ 2 callersFunctioncompatibility_correction_valid
(row: dict)
chapter10/generative-agents/validate_campaign.py:70
↓ 2 callersFunctioncompile_workflow
(base_url: str, captured: list[dict[str, Any]])
chapter9/browser-use-rpa/run_experiment_9_5.py:253
↓ 2 callersMethodcomplete
(self, *, kind: str, **kwargs: Any)
chapter9/trajectory-verifier/evidence_client.py:47
↓ 2 callersMethodcomplete
(self, purpose: str, **request: Any)
chapter3/structured-index/campaign.py:123
↓ 2 callersFunctioncompleted_calls
(result: Dict[str, Any], kind: str)
chapter1/search-codegen/run_experiment_1_3.py:106
↓ 2 callersFunctioncompletion_and_findings
Separate execution/evidence gates from potentially negative hypotheses.
chapter8/cot-distillation/evaluate_student.py:63
↓ 2 callersFunctioncompletion_audit
( config: dict[str, Any], workload: Sequence[dict[str, Any]], availability: Sequence[dict[str, Any
chapter7/model-benchmark/analysis.py:331
↓ 2 callersFunctioncompletion_token_limit
Return enough output budget for reasoning models to emit an action.
chapter2/prompt-engineering/ablation_agent.py:21
↓ 2 callersMethodcomponent_costs
把总成本拆成三个成本构成要素(对应书「成本的构成要素」): - 未缓存输入 / 缓存输入 / 输出 以及输入侧里「工具返回注入」token 占比(若已知)。
chapter7/agent-cost-analysis/tracer.py:198
↓ 2 callersFunctioncompress_receipt
(path: Path)
chapter10/generative-agents/run_campaign.py:314
↓ 2 callersFunctionconcat_mp3
(parts: list[Path], out_path: str | Path)
chapter6/controllable-tts/tts.py:77
↓ 2 callersFunctioncondition_order
(suite: str, index: int)
chapter2/system-hint/run_experiment_2_8.py:62
↓ 2 callersMethodconsolidate_memories
Consolidate and reorganize memories for efficiency
chapter3/memobase/agent.py:230
↓ 2 callersMethodcontains
True iff r is fully covered by the current union.
chapter9/browser-use-rpa/browser-use/browser_use/dom/serializer/paint_order.py:75
↓ 2 callersFunctioncontext
(results: List[Dict[str, Any]])
chapter3/agentic-rag/campaign.py:53
↓ 2 callersMethodcontinueWithAuth
(self, params: dict, session_id: str | None = None)
chapter9/browser-use-rpa/browser-use/tests/ci/test_browser_session_proxy.py:51
↓ 2 callersFunctionconversation_turn
Use the ASR transcript in one real dialogue/completion call; never fall back.
chapter6/phone-agent/agent.py:288
↓ 2 callersFunctionconvert
(rows)
chapter5/code-for-math/build_aime_2024.py:28
↓ 2 callersMethodconvert_currency
Convert currency using static exchange rates Args: amount: Amount to convert from_currency: Source c
chapter1/context/agent.py:143
↓ 2 callersFunctionconvert_expression
Convert the dataset's published tuple AST into the lab's JSON DSL.
chapter5/code-for-logic/build_hf_puzzles.py:52
↓ 2 callersFunctionconvert_row
( row: dict[str, Any], *, perturbation: str, people: int, source_path: str, source_sha256: str, source
chapter5/code-for-logic/build_hf_puzzles.py:74
↓ 2 callersMethodcopy_file
Copy a file or directory. Args: source: Source path destination: Destination path overwr
chapter4/execution-tools/filesystem_enhanced.py:498
↓ 2 callersFunctioncopy_json
(source: Path, target: Path)
chapter10/generative-agents/package_evidence.py:34
↓ 2 callersMethodcost_distribution
按步骤的单步成本分布(p50/p95/p99)。对应书「成本分布 p50/p95/p99」。
chapter7/agent-cost-analysis/tracer.py:216
↓ 2 callersFunctioncount_characters
统计文本的字符数与中文字符数,帮助控制篇幅。
chapter10/multi-role-transfer/tools.py:199
↓ 2 callersMethodcount_objects
(self, type_name: Optional[str] = None)
chapter5/permission-embedded-data-objects/pedo/core/store.py:736
↓ 2 callersFunctioncount_tokens
Estimate token count for a given text string. Uses tiktoken if available, with a reliable character/word-based fallback.
chapter2/context-compression/benchmark_compression.py:16
↓ 2 callersMethodcount_tokens
Estimate token count (rough approximation)
chapter3/log-sanitization/agent.py:133
↓ 2 callersMethodcreate
(self, **kwargs)
chapter10/book-translation/test_official_experiment.py:163
↓ 2 callersMethodcreate
(cls, **kwargs)
chapter10/generative-agents/tests/test_provider_adapter.py:44
↓ 2 callersFunctioncreateRevealFollower
( reveal: (item: T, behavior: ScrollBehavior) => void, options: RevealFollowerOptions = {}, )
web-astro/src/scripts/reader-navigation.ts:61
↓ 2 callersMethodcreateWavBuffer
* Convert raw audio buffer to WAV format * @param {Buffer} audioBuffer - Raw PCM audio data * @param {Object} options - Audio format options
chapter6/live-audio/backend/utils/providers/asrProviders.js:21
↓ 2 callersMethodcreate_ad_prompt
(self, browser_analysis: str, video_concept: str = '')
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:132
↓ 2 callersFunctioncreate_attention_flow_diagram
Create a flow diagram showing attention evolution over generation steps Args: attention_steps: List of attention step dictionari
chapter2/attention_visualization/visualization.py:129
↓ 2 callersFunctioncreate_attention_heatmap
Create a heatmap visualization of attention weights Args: attention_weights: 2D list of attention weights [output_len x total_le
chapter2/attention_visualization/visualization.py:41
↓ 2 callersMethodcreate_complex_cases
Create complex legal scenario questions
chapter3/contextual-retrieval/evaluation/dataset_builder.py:97
↓ 2 callersMethodcreate_complex_cases
Create complex legal scenario questions
chapter3/agentic-rag/evaluation/dataset_builder.py:97
↓ 2 callersMethodcreate_directories
Create necessary directories if they don't exist
chapter2/context-compression/config.py:99
↓ 2 callersMethodcreate_directory
Create a new directory. Args: directory_path: Path for new directory parents: Create parent director
chapter4/execution-tools/filesystem_enhanced.py:612
↓ 2 callersFunctioncreate_excel_worksheet
Create a new worksheet in Excel file. Args: file_path: Path to Excel file sheet_name: Name for new worksheet
chapter4/collaboration-tools/src/excel_tools.py:149
↓ 2 callersFunctioncreate_fast_task
Create a browser automation task optimized for speed and cost. Args: instructions: Natural language description of what the agent should do
chapter9/browser-use-rpa/browser-use/examples/cloud/02_fast_mode_gemini.py:64
↓ 2 callersMethodcreate_from_template
(self, requirements: str, output: Path)
chapter5/agent-creator/creator.py:1425
↓ 2 callersFunctioncreate_layer_attention_heatmap
Plot a full [seq x seq] self-attention matrix for one layer/head. Rows are Query positions (the token doing the attending) and columns a
chapter2/attention_visualization/visualization.py:500
↓ 2 callersFunctioncreate_legal_documents
Create sample legal documents for the knowledge base
chapter3/contextual-retrieval/evaluation/dataset_builder.py:176
↓ 2 callersFunctioncreate_legal_documents
Create sample legal documents for the knowledge base
chapter3/agentic-rag/evaluation/dataset_builder.py:176
↓ 2 callersFunctioncreate_mock_state_message
Create a mock state message with a single clickable element.
chapter9/browser-use-rpa/browser-use/browser_use/llm/tests/test_single_step.py:23
↓ 2 callersFunctioncreate_sample_cards
Create sample memory cards for testing
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:402
↓ 2 callersMethodcreate_simple_cases
Create simple direct legal questions
chapter3/contextual-retrieval/evaluation/dataset_builder.py:20
↓ 2 callersMethodcreate_simple_cases
Create simple direct legal questions
chapter3/agentic-rag/evaluation/dataset_builder.py:20
↓ 2 callersFunctioncreate_summary_task
Create a task that requires reading multiple files
chapter2/kv-cache/main.py:189
↓ 2 callersMethodcreate_tool
把一个功能封装为标准工具并持久化。 约定:code 里必须定义一个名为 run(**kwargs) 的函数,返回可 JSON 序列化的结果。 parameters 为 OpenAI function-calling 风格的 JSON Schema(
chapter9/self-evolving-tools/tool_manager.py:51
↓ 2 callersMethodcreate_video_concept
Generate a unique creative concept for each video ad
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:109
↓ 2 callersFunctioncss_font_sizes
Return ``.class`` → font-size mappings from SVG ``<style>`` blocks. Recent diagrams use semantic CSS classes (for example ``class="heading"``)
book-vi/fix_svg_text_layout.py:122
↓ 2 callersFunctioncursor_at
A stargazer cursor positioned just before `dt`. GitHub's stargazer cursors are keyset positions -- base64 of ``cursor:v2:`` plus a msgpack ``
scripts/gen_star_history.py:174
↓ 2 callersMethoddecay
Apply time-based decay to importance
chapter3/memobase/agent.py:67
↓ 2 callersFunctiondecode_unicode_escapes_to_utf8
Handle decoding any unicode escape sequences embedded in a string (needed to render non-ASCII languages like chinese or arabic in the GIF overlay text
chapter9/browser-use-rpa/browser-use/browser_use/agent/gif.py:20
↓ 2 callersFunctiondefault_model
(provider: str)
chapter8/premature-completion-dpo/llm_client.py:46
↓ 2 callersMethoddelete_item
Delete an item from the HNSW index.
chapter3/dense-embedding/indexing.py:315
↓ 2 callersMethoddelete_memory
Delete a memory item
chapter3/user-memory/memory_manager.py:105
↓ 2 callersMethoddelta
(before: dict[str, Any], after: dict[str, Any])
chapter7/android-world/run_controlled_experiment.py:746
↓ 2 callersFunctiondemoMinutes
(lesson)
slides/review.mjs:23
↓ 2 callersMethoddemo_mode
Run a quick demo with a simple test case
chapter3/agentic-rag-for-user-memory/main.py:530
↓ 2 callersMethoddemo_mode
Run a quick demo with sample data
chapter3/contextual-retrieval-for-user-memory/main.py:102
↓ 2 callersFunctiondense_rank
向量已 L2 归一化,余弦相似度即点积;返回按相似度降序的文档下标。
chapter3/dense-embedding/cli.py:175
↓ 2 callersFunctiondescribe
(values: list[float])
chapter9/self-evolution-eval/run_experiment_9_9.py:43
↓ 2 callersMethoddetect_communities
Detect communities in the knowledge graph.
chapter3/structured-index/graphrag_indexer.py:234
↓ 2 callersFunctiondeterministic_chosen
离线路径:模板 + missing_verification 合成规范 chosen。
chapter8/premature-completion-dpo/build_preference_data.py:78
↓ 2 callersFunctiondigest
(path)
chapter6/astra-async-steering/validation/runs/pilot-20260905-v1/source/experiment.py:56
↓ 2 callersFunctiondigest
(path)
chapter6/astra-async-steering/validation/runs/exp6-14-20260905-formal/source/experiment.py:56
↓ 2 callersFunctiondigest
(path)
chapter6/astra-async-steering/validation/runs/pilot-20260905-v2/source/experiment.py:56
↓ 2 callersMethoddirectory_tree
Generate a tree structure of directory contents. Args: directory_path: Path to directory max_depth:
chapter4/execution-tools/filesystem_enhanced.py:222
↓ 2 callersFunctiondiscover_tasks
()
chapter7/model-action-threshold/experiment.py:161
↓ 2 callersMethoddisplay
(cls, backend: Optional[str] = None)
chapter1/search-codegen/config.py:76
↓ 2 callersFunctiondisplay_choices
(choices: list[str])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:18
↓ 2 callersMethoddisplay_file
Display file content using file-specific display method
chapter9/browser-use-rpa/browser-use/browser_use/filesystem/file_system.py:245
↓ 2 callersMethoddisplay_metrics
Display performance metrics in a formatted table.
chapter3/mem0/agent.py:456
↓ 2 callersMethoddisplay_overall_results
Display overall benchmark results.
chapter3/mem0/experiment.py:333
↓ 2 callersFunctiondraw
(x: np.ndarray, y: np.ndarray, repo: str, theme_name: str, theme: dict, out: Path)
scripts/gen_star_history.py:528
↓ 2 callersFunctiondumps_json
(evidence: Mapping[str, Any])
chapter7/android-world/experiment_core.py:587
↓ 2 callersFunctionduration
(probe_result: dict[str, Any])
chapter5/paper-to-video/campaign.py:59
↓ 2 callersFunctionedge
(k, name, from, to, d, extra = {})
web-astro/scripts/voice-architecture-layout.mjs:70
↓ 2 callersMethodeffective_provider
Resolve the provider actually used, applying the OpenRouter fallback. Preserves default behavior when the configured provider's key is
chapter4/execution-tools/config.py:108
↓ 2 callersMethodembed
(self, texts: List[str])
chapter4/active-tool-discovery/discovery.py:47
↓ 2 callersMethodencode
(self, texts: Sequence[str], is_query: bool = False, batch_size: int = 16)
chapter3/retrieval-pipeline/evaluate.py:233
↓ 2 callersMethodencode_batch
Encode multiple texts into embeddings. Args: texts: List of input texts to encode return_sparse: Whe
chapter3/dense-embedding/embedding_service.py:127
↓ 2 callersFunctionencode_image
读取 PNG,缩放到统一宽度,编码为 data URL(base64)。
chapter5/paper-to-ppt/agents.py:172
↓ 2 callersFunctionencode_state
(state: DesktopState)
chapter6/gemini-xlerobot-navigation/desktop_planner.py:112
↓ 2 callersMethodencode_text
Encode a single text into embeddings. Args: text: Input text to encode return_sparse: Whether to ret
chapter3/dense-embedding/embedding_service.py:69
← previousnext →2,101–2,200 of 13,003, ranked by callers