MCPcopy Create free account

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

Functions2,925 in github.com/bojieli/ai-agent-book

↓ 128 callersMethodexecute
Execute the tool with given parameters Args: params: Tool input parameters Returns:
chapter5/coding-agent/tools/base.py:41
↓ 88 callersMethodtext
(self, x, y, content, size=FS_BODY, bold=False, anchor='middle', fill='text', baseline='central')
book/svg_lib.py:104
↓ 87 callersMethodmodel_dump
(self, **kwargs)
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:45
↓ 76 callersMethodrect
(self, x, y, w, h, fill='light', stroke='border', rx=CORNER_R, dash=False)
book/svg_lib.py:76
↓ 73 callersMethodsave
(self, path)
book/svg_lib.py:254
↓ 61 callersMethodarrow
(self, x1, y1, x2, y2, label=None, dash=False, color='border')
book/svg_lib.py:146
↓ 46 callersMethodwrite
(self, text)
chapter2/context-compression/run_all_strategies.py:125
↓ 44 callersMethodmono
Monospace text for code snippets.
book/svg_lib.py:118
↓ 40 callersMethodload
Load configuration from JSON file
chapter3/agentic-rag-for-user-memory/config.py:225
↓ 39 callersMethodrun
Run agent with streaming output Args: user_message: User's input message max_iterations: Maximum num
chapter5/coding-agent/agent.py:116
↓ 35 callersMethodcopy
Create a deep copy of the current rating system.
chapter6/elo-leaderboard/elo_rating.py:157
↓ 28 callersMethodbox
(self, x, y, w, h, label, fill='light', sublabel=None, bold=False, font_size=FS_BODY)
book/svg_lib.py:85
↓ 27 callersMethodline
(self, x1, y1, x2, y2, dash=False, color='border')
book/svg_lib.py:182
↓ 23 callersMethodfrom_env
Create configuration from environment variables
chapter3/contextual-retrieval-for-user-memory/config.py:167
↓ 18 callersFunctionnew_game
Start a new chess game. Returns: Dictionary with initial board state
chapter4/collaboration-tools/src/chess_tools.py:84
↓ 18 callersMethodrun
Run the learning agent to complete the task. Args: max_steps: Maximum steps for browser-use agent
chapter8/browser-use-rpa/learning_agent/agent.py:271
↓ 17 callersMethodsearch
Search for documents matching the query Returns list of (doc_id, score, debug_info) tuples
chapter3/sparse-embedding/bm25_engine.py:306
↓ 16 callersFunctionmake_move
Make a move on the chess board. Args: move_str: Move in UCI (e.g., 'e2e4') or SAN (e.g., 'Nf3') format Returns:
chapter4/collaboration-tools/src/chess_tools.py:149
↓ 16 callersFunctionvalidate_file_path
Validate and resolve file path. Args: file_path: Path to the file Returns: Resolved Path object
chapter4/perception-tools/src/base.py:50
↓ 14 callersMethodfrom_env
Create configuration from environment variables
chapter3/agentic-rag-for-user-memory/config.py:165
↓ 14 callersMethodload
Load configuration from JSON file
chapter3/contextual-retrieval-for-user-memory/config.py:227
↓ 13 callersMethodexecute_task
Execute a task using available tools Args: task: The task to execute max_iterations: Maximum number
chapter1/context/agent.py:557
↓ 13 callersMethodrun
Run the interactive demo
chapter3/contextual-retrieval/demo.py:52
↓ 12 callersFunctionapprox_cost_for_datapoint
For now, we approximate the cost of a datapoint as the cost of the input (output tokens are priced as input tokens as well).
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:511
↓ 12 callersMethodgenerate
Generate speech from text prompts. Orpheus supports emotion/expression tags in your prompts: - <laugh>, <giggles>, <
chapter7/orpheus/inference.py:260
↓ 12 callersMethodto_text
Convert chunk to text format for indexing
chapter3/contextual-retrieval-for-user-memory/chunker.py:62
↓ 12 callersMethodupdate_ratings
Update ratings after a match between two models. Args: model_a: Identifier for first model model_b:
chapter6/elo-leaderboard/elo_rating.py:54
↓ 11 callersMethodfrom_env
Create config from environment variables
chapter3/agentic-rag/config.py:187
↓ 11 callersMethodprocess_request
Process a user request with optional tool usage (OpenRouter format) Args: user_request: The user's request or qu
chapter1/search-codegen/agent.py:149
↓ 11 callersMethodsearch_and_answer
执行搜索并生成答案 Args: user_question: 用户问题 max_iterations: 最大搜索迭代次数(防止无限循环) Returns:
chapter1/web-search-agent/agent.py:112
↓ 10 callersMethodarrow_curved
Draw a curved arrow using a quadratic bezier.
book/svg_lib.py:161
↓ 10 callersFunctionextract_youtube_transcript
Extract transcript from a YouTube video. Args: video_id: YouTube video ID or URL language_code: Language code for the tr
chapter4/perception-tools/src/multimodal_tools.py:444
↓ 10 callersMethodfrom_env
Create config from environment variables
chapter3/contextual-retrieval/config.py:187
↓ 10 callersMethodget_context_string
Get memory as a formatted string for LLM context
chapter3/user-memory/memory_manager.py:101
↓ 10 callersMethodsave
Save configuration to JSON file
chapter3/agentic-rag-for-user-memory/config.py:184
↓ 9 callersMethod_is_safe_path
Check if path is within allowed directories.
chapter4/execution-tools/filesystem_enhanced.py:29
↓ 9 callersMethod_resolve_path
Resolve path relative to workspace.
chapter4/execution-tools/filesystem_enhanced.py:22
↓ 9 callersMethod_run_command
Run a shell command and return results with proper process management.
chapter4/execution-tools/multilang_executor.py:141
↓ 9 callersMethod_write_files
Write additional files to tmp directory.
chapter4/execution-tools/multilang_executor.py:224
↓ 9 callersMethodexecute_action
Execute an action and return (feedback, reward, done).
chapter1/learning-from-experience/game_environment.py:201
↓ 9 callersMethodexecute_task
Execute a task using ReAct pattern with standard OpenAI tool calling Args: task: The task to execute
chapter2/kv-cache/agent.py:576
↓ 9 callersMethodexecute_tool
Execute a tool by name with given arguments
chapter2/local_llm_serving/tools.py:125
↓ 9 callersMethodget_available_actions
Get list of available actions in current state.
chapter1/learning-from-experience/game_environment.py:169
↓ 9 callersMethodquery
Process a user query using the ReAct pattern. Args: user_query: The user's question stream: Whether
chapter3/agentic-rag/agent.py:206
↓ 8 callersFunctionapprox_num_tokens
(text: str)
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:141
↓ 8 callersMethodget_state_description
Get a natural language description of the current game state.
chapter1/learning-from-experience/game_environment.py:140
↓ 8 callersFunctionload_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:115
↓ 8 callersMethodparse
( self, text: str, typ: type[T] | dict[str, Any], examples: list[ParseDatapoin
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:292
↓ 8 callersFunctionsearch_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:120
↓ 8 callersMethodstart
Start the vLLM server Args: wait_for_ready: Wait for server to be ready timeout: Maximum time to wai
chapter2/local_llm_serving/server.py:65
↓ 7 callersMethod_extract_single_content
Extract a single piece of content to text
chapter3/multimodal-agent/agent.py:542
↓ 7 callersMethod_is_safe_path
Check if path is within workspace.
chapter4/execution-tools/terminal_controller.py:24
↓ 7 callersMethod_print_result
Pretty print test result Args: result: Test result dictionary
chapter1/search-codegen/test_agent.py:213
↓ 7 callersMethod_resolve_path
Resolve path relative to current directory.
chapter4/execution-tools/terminal_controller.py:32
↓ 7 callersFunctionapprox_prompt_str
(dp: Datapoint, include_response: bool = False)
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:506
↓ 7 callersMethodcolor
Apply color to text if colors are enabled
chapter5/coding-agent/main.py:49
↓ 7 callersMethodcreateProvider
(providerName, config, globalConfig)
chapter9/live-audio/backend/utils/providers/asrProviders.js:244
↓ 7 callersMethodexecute_task
Execute a task using available tools with system hints Args: task: The task to execute max_iteration
chapter2/system-hint/agent.py:773
↓ 7 callersMethodget_api_key
获取 API Key Args: api_key: 可选的 API key,如果提供则使用,否则从环境变量获取 Returns: API key
chapter1/web-search-agent/config.py:46
↓ 7 callersMethodget_bytes
Get content as bytes
chapter3/multimodal-agent/agent.py:60
↓ 7 callersFunctionget_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 callersMethodget_leaderboard
Get current leaderboard sorted by rating. Returns: List of tuples (model, rating, matches, wins) sorted by ratin
chapter6/elo-leaderboard/elo_rating.py:98
↓ 7 callersMethodget_test_case
Get a specific test case by ID. Args: test_id: The test case ID Returns: TestCa
chapter3/user-memory-evaluation/framework.py:162
↓ 7 callersMethodquery_non_agentic
Non-agentic RAG mode: Simple retrieval + LLM response. Args: user_query: The user's question stream:
chapter3/agentic-rag/agent.py:346
↓ 7 callersMethodto_text
Convert chunk to text format for indexing
chapter3/agentic-rag-for-user-memory/chunker.py:62
↓ 7 callersMethodwrite_file
Write content to a file with safety checks. Args: path: File path (relative to workspace or absolute)
chapter4/execution-tools/file_tools.py:33
↓ 6 callersMethod_api_call
( self, models: list[AnyModel], datapoint: Datapoint, sampling_strategy: SamplingStrategy )
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:229
↓ 6 callersFunction_escape
(s)
book/svg_lib.py:51
↓ 6 callersFunction_get_current_board_state
Get the current board state in a structured format.
chapter4/collaboration-tools/src/chess_tools.py:52
↓ 6 callersMethodadd_card
Add a new memory card. Args: card: The memory card to add Returns: Memory ID in
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:141
↓ 6 callersMethodbadge
Small rounded badge/tag.
book/svg_lib.py:231
↓ 6 callersMethodchat
Have a conversation with the user Args: message: User message Returns: Assistan
chapter3/user-memory/conversational_agent.py:176
↓ 6 callersMethodevaluate_test_case
Evaluate a single test case Args: test_id: The test case ID to evaluate Returns:
chapter3/agentic-rag-for-user-memory/evaluator.py:290
↓ 6 callersMethodfind
Find files matching a pattern (similar to Unix find command) Args: pattern: File name pattern (supports wildcard
chapter2/kv-cache/agent.py:147
↓ 6 callersMethodget_api_key
Get API key for the specified provider Args: provider: Provider name (defaults to configured provider)
chapter3/user-memory/config.py:74
↓ 6 callersMethodget_base64
Get content as base64 encoded string
chapter3/multimodal-agent/agent.py:72
↓ 6 callersFunctionget_game_status
Get the current game status. Returns: Dictionary with game status information
chapter4/collaboration-tools/src/chess_tools.py:278
↓ 6 callersMethodget_statistics
Get comprehensive index statistics
chapter3/sparse-embedding/bm25_engine.py:192
↓ 6 callersFunctionget_stock_quote
Get current stock quote information. Args: symbol: Stock ticker symbol (e.g., AAPL, MSFT) Returns: TextCont
chapter4/perception-tools/src/yahoo_finance_tools.py:35
↓ 6 callersMethodget_system_hint
Generate system hint message to append to context
chapter5/coding-agent/system_state.py:23
↓ 6 callersMethodget_tool_schemas
Get OpenAI-compatible tool schemas
chapter2/local_llm_serving/tools.py:111
↓ 6 callersMethodgroup_box
A dashed group boundary with a label at top-left.
book/svg_lib.py:226
↓ 6 callersMethodindex_document
Index a new document and return its ID
chapter3/sparse-embedding/bm25_engine.py:378
↓ 6 callersMethodload_test_cases
Load test cases from YAML files Args: category: Optional category filter (layer1, layer2, layer3)
chapter3/contextual-retrieval-for-user-memory/evaluator.py:157
↓ 6 callersFunctionprint_colored
打印彩色文本
chapter1/web-search-agent/quickstart.py:23
↓ 6 callersFunctionprint_header
Print a formatted header
chapter3/contextual-retrieval/demo.py:29
↓ 6 callersMethodprocess
Process a query and return the final answer as a string Args: query: The query to process max_iterat
chapter1/context/agent.py:703
↓ 6 callersMethodprocess_recent_conversations
Process recent conversations and update memories Returns: Processing results with list of operations
chapter3/user-memory/background_memory_processor.py:364
↓ 6 callersMethodquery_non_agentic
Non-agentic RAG mode: Simple retrieval + LLM response. Args: user_query: The user's question stream:
chapter3/contextual-retrieval/agent.py:286
↓ 6 callersMethodreset
Reset the game to initial state.
chapter1/learning-from-experience/game_environment.py:471
↓ 6 callersMethodsearch
Search for relevant experiences. Args: query: The search query top_k: Number of top results to retur
chapter8/gaia-experience/knowledge_base.py:249
↓ 6 callersMethodtrain
'Train' the agent through in-context learning over multiple episodes. Note: Unlike traditional RL, there's no explicit training - jus
chapter1/learning-from-experience/llm_agent.py:350
↓ 6 callersMethodvalidate
Validate the configuration Returns: True if configuration is valid, False otherwise
chapter1/search-codegen/config.py:44
↓ 6 callersFunctionwrap_temperature
(temperature: float)
chapter2/prompt-engineering/tau_bench/model_utils/model/general_model.py:30
↓ 5 callersFunction_pill
(svg, x, y, w, h, label, fill='light', font_size=FS_SMALL, bold=False)
book/gen_ch5_figs.py:30
↓ 5 callersFunction_pipeline
Horizontal stage pipeline with an optional dashed feedback loop.
book/gen_ch8_figs.py:16
↓ 5 callersFunction_save_timers
Save timer state to storage.
chapter4/collaboration-tools/src/timer_tools.py:374
↓ 5 callersMethodadd_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:83
↓ 5 callersMethodadd_chunks
Add conversation chunks to the index Args: chunks: List of conversation chunks to index rebuild: Whe
chapter3/contextual-retrieval-for-user-memory/indexer.py:83
↓ 5 callersMethodadd_message
Add a message to conversation history
chapter3/multimodal-agent/agent.py:372
next →1–100 of 2,925, ranked by callers