Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bojieli/ai-agent-book
/ functions
Functions
2,925 in github.com/bojieli/ai-agent-book
⨍
Functions
2,925
◇
Types & classes
570
↳
Endpoints
80
↓ 2 callers
Method
print_summary
Print a human-readable summary of metrics
chapter2/log-sanitization/metrics.py:142
↓ 2 callers
Function
pronounceSpecialCharacters
(text, isCodeBlock = false)
chapter9/live-audio/backend/utils/textProcessor.js:86
↓ 2 callers
Function
read_excel_data
Read data from Excel file. Args: file_path: Path to Excel file sheet_name: Specific sheet name (None for all sheets)
chapter4/collaboration-tools/src/excel_tools.py:30
↓ 2 callers
Function
read_file
Read a file and return its contents. Args: file_path: Path to the file encoding: File encoding (default: utf-8)
chapter4/perception-tools/src/filesystem_tools.py:22
↓ 2 callers
Method
read_multiple_files
Read multiple files at once. Args: file_paths: List of file paths encoding: File encoding
chapter4/execution-tools/filesystem_enhanced.py:108
↓ 2 callers
Function
read_webpage
Read and extract content from a webpage. Args: url: URL of the webpage extract_text: Whether to extract main text conten
chapter4/perception-tools/src/multimodal_tools.py:24
↓ 2 callers
Method
register_tool
Register a new tool
chapter2/local_llm_serving/tools.py:103
↓ 2 callers
Function
remove_tool_descriptions
Remove descriptions from tools and their parameters (including nested structures) Args: tools_info: Original tools information
chapter2/prompt-engineering/ablation_utils.py:142
↓ 2 callers
Method
replay_workflow
Replay a workflow with the given parameters. Args: workflow: The workflow to replay parameters: Para
chapter8/browser-use-rpa/learning_agent/replay.py:73
↓ 2 callers
Function
request_admin_approval
Request approval from a human administrator. Args: request_message: Message describing what needs approval context: Optional
chapter4/collaboration-tools/src/hitl_tools.py:17
↓ 2 callers
Method
rerank
Rerank documents for a query. Args: query: The search query documents: List of documents with text and metada
chapter3/retrieval-pipeline/reranker.py:124
↓ 2 callers
Method
reset
* Reset VAD state
chapter9/live-audio/backend/utils/vad.js:253
↓ 2 callers
Method
resetSileroState
* Reset Silero VAD state tensors
chapter9/live-audio/backend/utils/vad.js:74
↓ 2 callers
Function
reset_board
Reset the board to the starting position. Returns: Dictionary with reset board state
chapter4/collaboration-tools/src/chess_tools.py:410
↓ 2 callers
Method
reset_conversation
Clear conversation history and current content
chapter3/multimodal-agent/agent.py:1014
↓ 2 callers
Method
run
Main CLI loop
chapter5/coding-agent/main.py:300
↓ 2 callers
Method
run_all_tests
Run all test cases
chapter1/search-codegen/test_agent.py:245
↓ 2 callers
Function
run_experiment
Run a single ablation experiment Returns: Tuple of (experiment_name, success_rate)
chapter2/prompt-engineering/test_ablation.py:15
↓ 2 callers
Method
run_rl_experiment
Run experiment with traditional Q-learning agent. Args: num_training_episodes: Number of episodes to train
chapter1/learning-from-experience/experiment.py:39
↓ 2 callers
Function
run_server
Run the API server.
chapter3/structured-index/api_service.py:377
↓ 2 callers
Function
run_single_test
Run a single test case Args: test_name: Name of test to run
chapter1/search-codegen/test_agent.py:312
↓ 2 callers
Method
sanitize_conversation
Sanitize a single conversation and collect metrics Returns: Dictionary with sanitized conversation and metrics
chapter2/log-sanitization/agent.py:191
↓ 2 callers
Method
save
Save the Q-table and parameters.
chapter1/learning-from-experience/rl_agent.py:268
↓ 2 callers
Method
save_experiences
Save experiences to file for analysis.
chapter1/learning-from-experience/llm_agent.py:450
↓ 2 callers
Method
save_history
Save conversation history to storage
chapter3/user-memory/conversation_history.py:76
↓ 2 callers
Method
save_index
Save the RAPTOR tree index to disk.
chapter3/structured-index/raptor_indexer.py:255
↓ 2 callers
Method
save_index
Save the knowledge graph index to disk.
chapter3/structured-index/graphrag_indexer.py:449
↓ 2 callers
Method
save_metrics
Save all metrics and summary to files
chapter2/log-sanitization/metrics.py:127
↓ 2 callers
Method
save_sanitized_log
Save sanitized logs to output directory
chapter2/log-sanitization/agent.py:266
↓ 2 callers
Method
score
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:361
↓ 2 callers
Method
score_document
Calculate total BM25 score for a document given query terms
chapter3/sparse-embedding/bm25_engine.py:291
↓ 2 callers
Method
search
Search the RAPTOR tree for relevant information.
chapter3/structured-index/raptor_indexer.py:210
↓ 2 callers
Method
search
Search for documents.
chapter3/retrieval-pipeline/test_client.py:29
↓ 2 callers
Method
search
Search for documents.
chapter3/retrieval-pipeline/demo.py:29
↓ 2 callers
Method
search
Search for similar documents.
chapter3/dense-embedding/test_client.py:28
↓ 2 callers
Method
search_cards
Search memory cards by query. Args: query: Search query Returns: List of (memor
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:241
↓ 2 callers
Method
search_memory
Search user memory for relevant information Args: query: Natural language search query top_k: Number
chapter3/agentic-rag-for-user-memory/tools.py:46
↓ 2 callers
Method
search_memory
Search user memory for relevant information Args: query: Natural language search query top_k: Number
chapter3/contextual-retrieval-for-user-memory/tools.py:46
↓ 2 callers
Function
search_web
Search the web using DuckDuckGo (free, no API key required). Args: query: The search query string num_results: Number of
chapter4/perception-tools/src/search_tools.py:45
↓ 2 callers
Function
search_wikipedia
Search Wikipedia and get article summary. Args: query: Search query language: Wikipedia language (en, zh, etc.)
chapter4/perception-tools/src/public_data_tools.py:299
↓ 2 callers
Function
select_memory_mode_interactive
Interactively prompt the user to select a memory mode Returns: Selected MemoryMode
chapter3/user-memory/main.py:767
↓ 2 callers
Function
select_mode_interactive
Interactive mode selection menu Returns: Selected mode string or None for all modes
chapter2/kv-cache/main.py:156
↓ 2 callers
Method
send_event
Send an event to the agent Args: event_type: Type of event (e.g., 'web_message', 'im_message') conte
chapter4/agent-with-event-trigger/client.py:25
↓ 2 callers
Function
set_timer
Set a timer that will notify when completed. Args: duration_seconds: How long to wait before timer expires timer_name: Option
chapter4/collaboration-tools/src/timer_tools.py:18
↓ 2 callers
Method
setup
Initialize Playwright and browser.
chapter8/browser-use-rpa/learning_agent/replay.py:44
↓ 2 callers
Method
solve
( self, env: Env, task_index: Optional[int] = None, max_num_steps: int = 30 )
chapter2/prompt-engineering/tau_bench/agents/base.py:11
↓ 2 callers
Method
start
Start the shell process
chapter5/coding-agent/tools/shell_session.py:21
↓ 2 callers
Method
start_monitoring
Start system monitoring
chapter4/agent-with-event-trigger/client.py:95
↓ 2 callers
Method
summarize
Summarize a successful trajectory into reusable experience. Args: question: The original question re
chapter8/gaia-experience/trajectory_summarizer.py:50
↓ 2 callers
Method
summarize_output
Summarize complex tool output. Args: tool_name: Name of the tool that produced the output output: Th
chapter4/execution-tools/llm_helper.py:81
↓ 2 callers
Method
summarize_text
Summarize text using OpenAI API.
chapter3/structured-index/raptor_indexer.py:72
↓ 2 callers
Method
supports_dp
(self, dp: Datapoint)
chapter2/prompt-engineering/tau_bench/model_utils/model/model.py:48
↓ 2 callers
Method
syncChatHistory
()
chapter9/live-audio/backend/server.js:997
↓ 2 callers
Function
task_prompt
(task: str, text: str)
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:41
↓ 2 callers
Method
to_dict
Convert to dictionary for JSON serialization
chapter2/log-sanitization/metrics.py:42
↓ 2 callers
Method
to_dict
(self)
chapter3/contextual-retrieval/contextual_tools.py:36
↓ 2 callers
Method
to_dict
(self)
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:33
↓ 2 callers
Method
to_dict
(self)
chapter3/contextual-retrieval-for-user-memory/contextual_evaluator.py:104
↓ 2 callers
Method
transcribeAudio
* Transcribe audio using the configured ASR provider * @param {Buffer} audioBuffer - Raw audio data * @param {Object} options - Transcription op
chapter9/live-audio/backend/utils/speechToText.js:58
↓ 2 callers
Function
try_classify_recover
(s: str, decode_map: dict[str, int])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:132
↓ 2 callers
Function
type_to_json_schema_string
(typ: type[T])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:37
↓ 2 callers
Method
update_attention
Store attention weights for a position (only for output tokens)
chapter2/attention_visualization/agent.py:124
↓ 2 callers
Method
update_experience
Store an experience for future in-context learning.
chapter1/learning-from-experience/llm_agent.py:238
↓ 2 callers
Method
update_memory
Update an existing memory item
chapter3/user-memory/memory_manager.py:91
↓ 2 callers
Method
validate
验证配置是否有效 Returns: bool: 配置是否有效
chapter1/web-search-agent/config.py:31
↓ 2 callers
Method
validate_api_keys
Check which API keys are configured
chapter3/multimodal-agent/config.py:95
↓ 2 callers
Function
verify
( model: str, provider: str, response: str, messages: List[Dict[str, Any]] )
chapter2/prompt-engineering/tau_bench/envs/user.py:206
↓ 1 callers
Method
__init__
(self, model: str, provider: str)
chapter2/prompt-engineering/tau_bench/envs/user.py:38
↓ 1 callers
Method
__init__
Initialize the game environment. Args: seed: Random seed for reproducibility stochastic: If True, ad
chapter1/learning-from-experience/game_environment.py:48
↓ 1 callers
Method
__init_subclass__
(cls)
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:75
↓ 1 callers
Method
_advance_simulated_time
Advance simulated time for demo purposes
chapter2/system-hint/agent.py:194
↓ 1 callers
Method
_advance_simulated_time
Advance simulated time for demo purposes
chapter4/agent-with-event-trigger/agent.py:406
↓ 1 callers
Method
_analyze_action_types
Analyze types of actions in trajectory. Args: trajectory: Execution trajectory Returns:
chapter8/gaia-experience/trajectory_summarizer.py:273
↓ 1 callers
Method
_analyze_comparison
Analyze comparison results to highlight improvements
chapter3/contextual-retrieval/contextual_tools.py:500
↓ 1 callers
Method
_analyze_with_doubao
Use Doubao for content analysis
chapter3/multimodal-agent/agent.py:144
↓ 1 callers
Method
_analyze_with_gemini_audio
Use Gemini for audio analysis with thinking mode
chapter3/multimodal-agent/agent.py:172
↓ 1 callers
Method
_analyze_with_gemini_pdf
Use Gemini for PDF analysis with thinking mode
chapter3/multimodal-agent/agent.py:225
↓ 1 callers
Method
_analyze_with_openai
Use OpenAI for content analysis
chapter3/multimodal-agent/agent.py:119
↓ 1 callers
Method
_attack
Attack with a weapon.
chapter1/learning-from-experience/game_environment.py:365
↓ 1 callers
Method
_build_bm25_indexes
Build BM25 indexes for both contextual and non-contextual chunks. Educational Note: BM25 uses TF-IDF with optimizati
chapter3/contextual-retrieval/contextual_tools.py:148
↓ 1 callers
Method
_build_command
Build vLLM server command with arguments
chapter2/local_llm_serving/server.py:27
↓ 1 callers
Method
_build_context
Build context based on the current mode Returns: Context string for the model
chapter1/context/agent.py:472
↓ 1 callers
Method
_build_evaluation_prompt
Build the evaluation prompt for the LLM.
chapter3/user-memory-evaluation/evaluator.py:99
↓ 1 callers
Method
_build_full_conversation
Build full conversation text from chunks
chapter3/contextual-retrieval-for-user-memory/contextual_chunking.py:248
↓ 1 callers
Method
_build_messages
Build messages for the LLM including conversation history
chapter3/contextual-retrieval/agent.py:146
↓ 1 callers
Method
_build_messages
Build messages for the LLM including conversation history
chapter3/agentic-rag/agent.py:190
↓ 1 callers
Method
_build_openrouter_request
Build the OpenRouter-specific request format matching the Go implementation Args: messages: Conversation message
chapter1/search-codegen/agent.py:95
↓ 1 callers
Method
_build_prompt
Build the full prompt for the LLM.
chapter1/learning-from-experience/llm_agent.py:122
↓ 1 callers
Method
_build_system_prompt
Build enhanced system prompt with memory cards
chapter3/contextual-retrieval-for-user-memory/contextual_agent.py:142
↓ 1 callers
Method
_calculate_match_confidence
Calculate how well a workflow matches a task description. Args: task: Normalized task description wo
chapter8/browser-use-rpa/learning_agent/knowledge_base.py:158
↓ 1 callers
Method
_calculate_statistics
Calculate statistics for educational purposes. Args: dense_results: Dense search results sparse_results: Spar
chapter3/retrieval-pipeline/retrieval_pipeline.py:307
↓ 1 callers
Method
_call_llm
Call the LLM with retry logic.
chapter3/user-memory-evaluation/evaluator.py:30
↓ 1 callers
Method
_capture_step
Capture the current step for workflow learning.
chapter8/browser-use-rpa/learning_agent/agent.py:117
↓ 1 callers
Method
_chat
调用 Kimi API 进行对话 Args: messages: 消息列表 Returns: API 响应的 Choice 对象
chapter1/web-search-agent/agent.py:94
↓ 1 callers
Method
_chat_stream
Stream chat response (only when tools are disabled) Args: message: User message Returns:
chapter3/user-memory/agent.py:839
↓ 1 callers
Method
_check_lint_errors
Check for lint errors
chapter5/coding-agent/tools/multi_edit_tool.py:112
↓ 1 callers
Method
_check_lint_errors
Check for lint errors after file modification
chapter5/coding-agent/tools/write_tool.py:54
↓ 1 callers
Method
_check_lint_errors
Check for lint errors after file modification
chapter5/coding-agent/tools/edit_tool.py:81
↓ 1 callers
Method
_check_retrieval_pipeline
Check if the retrieval pipeline service is available
chapter3/agentic-rag-for-user-memory/indexer.py:70
↓ 1 callers
Method
_check_retrieval_pipeline
Check if the retrieval pipeline service is available
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:105
← previous
next →
501–600 of 2,925, ranked by callers