Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bojieli/ai-agent-book
/ functions
Functions
13,003 in github.com/bojieli/ai-agent-book
⨍
Functions
13,003
◇
Types & classes
1,574
↳
Endpoints
161
↓ 8 callers
Method
fill
(self, field: FieldSpec, value: str)
chapter10/autonomous-phone-registration/browser.py:87
↓ 8 callers
Method
from_dict
(cls, data: Dict[str, Any])
chapter7/user-memory-system-evaluation/experiment.py:106
↓ 8 callers
Method
get_all_memories
List up to ``top_k`` stored memories for a user.
chapter3/mem0/agent.py:330
↓ 8 callers
Method
get_leaderboard
Get current leaderboard sorted by rating. Returns: List of tuples (model, rating, matches, wins) sorted by ratin
chapter7/elo-leaderboard/elo_rating.py:103
↓ 8 callers
Method
get_state
Get serializable state of the file system
chapter9/browser-use-rpa/browser-use/browser_use/filesystem/file_system.py:459
↓ 8 callers
Method
get_state_description
Get a natural language description of the current game state.
chapter1/learning-from-experience/game_environment.py:143
↓ 8 callers
Method
get_trace
获取上一次 search_and_answer 的 ReAct 轨迹(思考/行动/观察/最终答案)
chapter1/web-search-agent/agent.py:549
↓ 8 callers
Function
iso
The exact spelling GitHub uses, so timestamps compare correctly as strings.
scripts/gen_star_history.py:110
↓ 8 callers
Function
jsonable
Convert SDK/Pydantic/dataclass-ish values to JSON-compatible data.
chapter3/experiment_utils.py:46
↓ 8 callers
Function
load_bad_cases
(path: Path = BAD_CASES_PATH)
chapter8/premature-completion-dpo/build_preference_data.py:55
↓ 8 callers
Function
load_fen
Load a chess position from FEN notation. Args: fen_string: FEN string representing the board state Returns:
chapter4/collaboration-tools/src/chess_tools.py:114
↓ 8 callers
Function
log
(msg: str)
chapter2/agent-skills-ppt/demo.py:49
↓ 8 callers
Function
map_model_to_openrouter
Map a bare model id to the equivalent OpenRouter model id. Mapping rules, applied in order: * ids already containing ``/`` are returned unch
agentbook/providers/openrouter.py:81
↓ 8 callers
Method
model_dump
(self)
chapter2/prompt-engineering/test_user_empty_response.py:12
↓ 8 callers
Function
normalize_schema
把模型给出的 parameters 规整为合法的 OpenAI function-calling JSON Schema。 模型常见错误:只给 properties 映射而漏掉顶层 {"type":"object"}。这里做容错, 否则把这样的工具再暴露给 OpenAI 会
chapter9/self-evolving-tools/tool_manager.py:22
↓ 8 callers
Function
print_section
Print a formatted section header.
chapter4/active-tool-selection/demo_comparison.py:19
↓ 8 callers
Method
process_audio_chunk
Process real-time incoming audio chunk from user. Monitors VAD energy signal during active TTS audio playback. If VAD energy surpasse
chapter6/streaming-speech/interruption_manager.py:215
↓ 8 callers
Method
process_recent_conversations
Process recent conversations and update memories Returns: Processing results with list of operations
chapter3/user-memory/background_memory_processor.py:364
↓ 8 callers
Function
read
(relative_path: str)
tests/test_chapter_numbering_consistency.py:56
↓ 8 callers
Method
read
(self)
chapter4/perception-tools/test_analyze_video_release_on_error.py:69
↓ 8 callers
Method
register_channel_handler
Register a custom handler function for a specific channel.
chapter4/collaboration-tools/src/notification_dispatcher.py:157
↓ 8 callers
Function
scan_skill_catalog
返回 {skill_name: {"description":..., "dir": Path}},只含元数据。
chapter2/agent-skills-ppt/demo.py:72
↓ 8 callers
Method
search
(self, query: str, candidate_k: int = 20)
chapter7/user-memory-system-evaluation/experiment.py:510
↓ 8 callers
Function
search_compounds
Search for chemical compounds in PubChem database. Args: query: Search term or identifier search_type: Type of search (n
chapter4/perception-tools/src/pubchem_tools.py:180
↓ 8 callers
Function
sha256_file
(path: Path | str)
chapter3/experiment_utils.py:37
↓ 8 callers
Function
svg
(content, h, width = 1000)
web-astro/scripts/chapter3-figure-kit.mjs:142
↓ 8 callers
Method
to_dict
Convert to dictionary format
chapter4/multimodal-agent/agent.py:37
↓ 8 callers
Method
update
(self, object_id, changes, accessor, _reaction_depth=0)
tests/test_ch5_pedo_live_security_eval.py:333
↓ 8 callers
Method
validate
(self, value: Optional[str])
chapter10/autonomous-phone-registration/models.py:31
↓ 8 callers
Method
validate
Validate all configurations.
chapter3/mem0/config.py:177
↓ 8 callers
Function
validate_candidate
模型外发布门槛:AST 静态检查 + 边界集/保留集回放,失败即关闭。
chapter9/harness-safety-gate/evolution.py:455
↓ 7 callers
Function
_build_three_stage_pipeline
dense (weak) -> fusion (better) -> rerank (best), across two queries. Each stage genuinely improves NDCG over the previous one: - dense: top
tests/test_ch3_retrieval_stage_evaluator.py:184
↓ 7 callers
Function
_build_tools
构造共享的工具实例(延迟导入,确保环境变量已就绪)。
chapter4/execution-tools/cli.py:76
↓ 7 callers
Method
_fix_gemini_schema
Convert a Pydantic model to a Gemini-compatible schema. This function removes unsupported properties like 'additionalProperties' and resolves
chapter9/browser-use-rpa/browser-use/browser_use/llm/google/chat.py:431
↓ 7 callers
Function
_hash
(s: str)
chapter5/permission-embedded-data-objects/pedo/eval/baxbench_adapter/reference_impls.py:34
↓ 7 callers
Method
_is_safe_path
Check if path is within workspace.
chapter4/execution-tools/terminal_controller.py:24
↓ 7 callers
Method
_is_valid_filename
Check if filename matches the required pattern: name.extension
chapter9/browser-use-rpa/browser-use/browser_use/filesystem/file_system.py:217
↓ 7 callers
Function
_load_success_or_skip_ip_block
Skip only YouTube's explicit provider-side IP ban response.
chapter4/perception-tools/test_youtube_tools.py:17
↓ 7 callers
Method
_print_result
Pretty print test result Args: result: Test result dictionary
chapter1/search-codegen/tests/manual/agent_cases.py:222
↓ 7 callers
Method
_resolve_path
Resolve path relative to current directory.
chapter4/execution-tools/terminal_controller.py:32
↓ 7 callers
Function
_result
A single ranked result dict (score-ordered).
tests/test_ch3_retrieval_stage_evaluator.py:33
↓ 7 callers
Function
_text_width
Estimated rendered width of a single line of text, in pixels.
book-en/svg_lib.py:118
↓ 7 callers
Function
_text_width
Estimated rendered width of a single line of text, in pixels.
book-tr/svg_lib.py:118
↓ 7 callers
Function
_text_width
Estimated rendered width of a single line of text, in pixels.
book-ru/svg_lib.py:118
↓ 7 callers
Function
_text_width
Estimated rendered width of a single line of text, in pixels.
book-es/svg_lib.py:118
↓ 7 callers
Function
_text_width
Нэг мөр текст дүрслэгдэхэд эзлэх өргөнийг пикселээр ойролцоолно.
book-mn/svg_lib.py:118
↓ 7 callers
Function
_text_width
Estimated rendered width of a single line of text, in pixels.
book-id/svg_lib.py:118
↓ 7 callers
Function
_truncate
Truncate text to max_length characters, adding ellipsis if truncated.
chapter9/browser-use-rpa/browser-use/browser_use/llm/messages.py:11
↓ 7 callers
Method
add
(self, step: Step)
chapter5/provider-failover/neutral_trace.py:69
↓ 7 callers
Method
add_chunks
Add conversation chunks to the index Args: chunks: List of conversation chunks to index rebuild: Whe
chapter3/agentic-rag-for-user-memory/indexer.py:175
↓ 7 callers
Method
add_document
Add a document to the index
chapter3/sparse-embedding/bm25_engine.py:150
↓ 7 callers
Function
add_project_root
()
chapter2/kv-cache/tests/manual/_bootstrap.py:7
↓ 7 callers
Method
ainvoke
(self, messages: list[BaseMessage], output_format: None = None)
chapter9/browser-use-rpa/browser-use/browser_use/llm/base.py:35
↓ 7 callers
Method
alive
(self)
chapter10/voice-werewolf/werewolf/game.py:132
↓ 7 callers
Method
api_key
(self)
chapter7/model-benchmark/campaign.py:145
↓ 7 callers
Function
approx_prompt_str
(dp: Datapoint, include_response: bool = False)
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:506
↓ 7 callers
Function
arrow
(x1, y1, x2, y2, muted = false)
web-astro/scripts/training-foundations-figures.mjs:60
↓ 7 callers
Function
assert_rejected
(payload)
chapter1/context/tests/test_calc_sandbox.py:23
↓ 7 callers
Method
audit_file
Read a JSONL file and audit every non-blank line.
chapter8/cot-distillation/sft_data_auditor.py:127
↓ 7 callers
Function
banner
(title: str)
chapter6/async-agent/async_demos.py:36
↓ 7 callers
Method
box
(self, x, y, w, h, label, fill='light', sublabel=None, bold=False, font_size=FS_BODY)
book-en/svg_lib.py:297
↓ 7 callers
Method
call_tool
Call a tool on the appropriate MCP server.
chapter9/browser-use-rpa/browser-use/examples/mcp/advanced_server.py:96
↓ 7 callers
Method
check_claim_grounded
Return ``True`` if *claim* is backed by any evidence string.
chapter9/trajectory-verifier/consistency_checker.py:296
↓ 7 callers
Method
create_context
Create a new agent context for a session.
chapter3/mem0/agent.py:181
↓ 7 callers
Method
create_directories
Create necessary directories if they don't exist
chapter3/user-memory/config.py:188
↓ 7 callers
Function
create_memory_manager
Factory function to create appropriate memory manager Args: user_id: User identifier mode: Memory mode (defaults to conf
chapter3/user-memory/memory_manager.py:737
↓ 7 callers
Function
create_mock_llm
Create a mock LLM that returns specified actions or a default done action. Args: actions: Optional list of JSON strings representing actions to re
chapter9/browser-use-rpa/browser-use/tests/ci/conftest.py:76
↓ 7 callers
Method
evaluate_attack
评估单条攻击向量,返回逐维判定与汇总字典。
chapter2/prompt-injection/robustness_evaluator.py:135
↓ 7 callers
Function
evaluate_context_contract
Verify the actual provider request, not the requested CLI mode. Args: mode: The ablation arm being checked. turns: The arm's reco
chapter1/context/run_experiment_1_1.py:155
↓ 7 callers
Method
execute
(self, sql, params=())
tests/test_ch5_pedo_atomic_delete.py:40
↓ 7 callers
Method
execute_code
Execute code in the specified language. Args: code: Code to execute language: Programming language
chapter4/execution-tools/multilang_executor.py:102
↓ 7 callers
Method
execute_research
Execute the research task Args: max_iterations: Maximum number of tool calls Returns:
chapter2/context-compression/agent.py:511
↓ 7 callers
Function
fail
(message: str)
chapter8/MiniMind-pretrain/validation/validate_vlm_evidence.py:37
↓ 7 callers
Function
find_bash
Locate the bash used to run tool commands, or None when there is none. POSIX keeps the historical /bin/bash. Windows has no bash of its own, so
chapter4/execution-tools/multilang_executor.py:50
↓ 7 callers
Method
flush
(self)
chapter9/browser-use-rpa/browser-use/browser_use/telemetry/service.py:83
↓ 7 callers
Method
flush
(self)
chapter10/voice-werewolf/demo.py:45
↓ 7 callers
Method
get_api_key
获取 API Key Args: api_key: 可选的 API key,如果提供则使用,否则从环境变量获取 Returns: API key
chapter1/web-search-agent/config.py:89
↓ 7 callers
Method
get_api_key
Get API key for the specified provider Args: provider: Provider name (defaults to configured provider)
chapter3/user-memory/config.py:123
↓ 7 callers
Method
get_base64
Get content as base64 encoded string
chapter4/multimodal-agent/agent.py:86
↓ 7 callers
Method
get_bytes
Get content as bytes
chapter4/multimodal-agent/agent.py:74
↓ 7 callers
Method
get_current_page_title
Get the title of the current page using CDP.
chapter9/browser-use-rpa/browser-use/browser_use/browser/session.py:1601
↓ 7 callers
Function
get_financial_statements
Get financial statements for a company. Args: symbol: Stock ticker symbol statement_type: Type of statement (income_stat
chapter4/perception-tools/src/yahoo_finance_tools.py:327
↓ 7 callers
Function
get_provider
()
chapter9/prompt-auto-optimization/config.py:69
↓ 7 callers
Method
get_statistics
Get comprehensive index statistics
chapter3/sparse-embedding/bm25_engine.py:207
↓ 7 callers
Method
get_tool_schemas
Get OpenAI-compatible tool schemas
chapter2/local_llm_serving/tools.py:111
↓ 7 callers
Function
helpers
(labels)
web-astro/scripts/training-foundations-figures.mjs:35
↓ 7 callers
Method
increment_conversation_count
Increment the conversation counter
chapter3/user-memory/background_memory_processor.py:496
↓ 7 callers
Function
initiate_phone_call_agent
Tool dispatcher invoked only after the model emits the matching tool call.
chapter10/autonomous-phone-registration/orchestration.py:376
↓ 7 callers
Method
is_done
Check if the agent is done
chapter9/browser-use-rpa/browser-use/browser_use/agent/views.py:487
↓ 7 callers
Method
is_successful
Check if the agent completed successfully - the agent decides in the last step if it was successful or not. None if not done yet.
chapter9/browser-use-rpa/browser-use/browser_use/agent/views.py:494
↓ 7 callers
Function
local
(tag: str)
book-vi/fix_svg_text_layout.py:103
↓ 7 callers
Function
log
(msg)
chapter6/controllable-tts/markup.py:61
↓ 7 callers
Function
map
( func: Callable[[T], U], iterable: Iterable[T], max_concurrency: int | None = None, use_tqdm:
chapter2/prompt-engineering/tau_bench/model_utils/func_tools/map.py:8
↓ 7 callers
Function
match_url_with_domain_pattern
Check if a URL matches a domain pattern. SECURITY CRITICAL. Supports optional glob patterns and schemes: - *.example.com will match sub.example.c
chapter9/browser-use-rpa/browser-use/browser_use/utils.py:435
↓ 7 callers
Method
new_context
(self)
chapter10/parallel-web-research/agents.py:48
↓ 7 callers
Function
new_shard
A half-open [cursor, hi) slice of the stargazer list, paged independently.
scripts/gen_star_history.py:206
↓ 7 callers
Function
on_page_markdown
MkDocs hook to strip Pandoc attributes outside code blocks and inline code.
scripts/mkdocs_pandoc_strip.py:18
↓ 7 callers
Function
payload_text
(payload: dict)
chapter5/provider-failover/tests/test_offline.py:29
↓ 7 callers
Method
process_reactions_sync
Process all queued reactions synchronously (for testing).
chapter5/permission-embedded-data-objects/pedo/core/store.py:590
↓ 7 callers
Method
query_non_agentic
Non-agentic RAG mode: Simple retrieval + LLM response. Args: user_query: The user's question stream:
chapter3/agentic-rag/agent.py:371
← previous
next →
301–400 of 13,003, ranked by callers