MCPcopy Create free account

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

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

↓ 2 callersMethodprint_summary
Print a human-readable summary of metrics
chapter2/log-sanitization/metrics.py:142
↓ 2 callersFunctionpronounceSpecialCharacters
(text, isCodeBlock = false)
chapter9/live-audio/backend/utils/textProcessor.js:86
↓ 2 callersFunctionread_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 callersFunctionread_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 callersMethodread_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 callersFunctionread_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 callersMethodregister_tool
Register a new tool
chapter2/local_llm_serving/tools.py:103
↓ 2 callersFunctionremove_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 callersMethodreplay_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 callersFunctionrequest_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 callersMethodrerank
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 callersMethodreset
* Reset VAD state
chapter9/live-audio/backend/utils/vad.js:253
↓ 2 callersMethodresetSileroState
* Reset Silero VAD state tensors
chapter9/live-audio/backend/utils/vad.js:74
↓ 2 callersFunctionreset_board
Reset the board to the starting position. Returns: Dictionary with reset board state
chapter4/collaboration-tools/src/chess_tools.py:410
↓ 2 callersMethodreset_conversation
Clear conversation history and current content
chapter3/multimodal-agent/agent.py:1014
↓ 2 callersMethodrun
Main CLI loop
chapter5/coding-agent/main.py:300
↓ 2 callersMethodrun_all_tests
Run all test cases
chapter1/search-codegen/test_agent.py:245
↓ 2 callersFunctionrun_experiment
Run a single ablation experiment Returns: Tuple of (experiment_name, success_rate)
chapter2/prompt-engineering/test_ablation.py:15
↓ 2 callersMethodrun_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 callersFunctionrun_server
Run the API server.
chapter3/structured-index/api_service.py:377
↓ 2 callersFunctionrun_single_test
Run a single test case Args: test_name: Name of test to run
chapter1/search-codegen/test_agent.py:312
↓ 2 callersMethodsanitize_conversation
Sanitize a single conversation and collect metrics Returns: Dictionary with sanitized conversation and metrics
chapter2/log-sanitization/agent.py:191
↓ 2 callersMethodsave
Save the Q-table and parameters.
chapter1/learning-from-experience/rl_agent.py:268
↓ 2 callersMethodsave_experiences
Save experiences to file for analysis.
chapter1/learning-from-experience/llm_agent.py:450
↓ 2 callersMethodsave_history
Save conversation history to storage
chapter3/user-memory/conversation_history.py:76
↓ 2 callersMethodsave_index
Save the RAPTOR tree index to disk.
chapter3/structured-index/raptor_indexer.py:255
↓ 2 callersMethodsave_index
Save the knowledge graph index to disk.
chapter3/structured-index/graphrag_indexer.py:449
↓ 2 callersMethodsave_metrics
Save all metrics and summary to files
chapter2/log-sanitization/metrics.py:127
↓ 2 callersMethodsave_sanitized_log
Save sanitized logs to output directory
chapter2/log-sanitization/agent.py:266
↓ 2 callersMethodscore
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:361
↓ 2 callersMethodscore_document
Calculate total BM25 score for a document given query terms
chapter3/sparse-embedding/bm25_engine.py:291
↓ 2 callersMethodsearch
Search the RAPTOR tree for relevant information.
chapter3/structured-index/raptor_indexer.py:210
↓ 2 callersMethodsearch
Search for documents.
chapter3/retrieval-pipeline/test_client.py:29
↓ 2 callersMethodsearch
Search for documents.
chapter3/retrieval-pipeline/demo.py:29
↓ 2 callersMethodsearch
Search for similar documents.
chapter3/dense-embedding/test_client.py:28
↓ 2 callersMethodsearch_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 callersMethodsearch_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 callersMethodsearch_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 callersFunctionsearch_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 callersFunctionsearch_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 callersFunctionselect_memory_mode_interactive
Interactively prompt the user to select a memory mode Returns: Selected MemoryMode
chapter3/user-memory/main.py:767
↓ 2 callersFunctionselect_mode_interactive
Interactive mode selection menu Returns: Selected mode string or None for all modes
chapter2/kv-cache/main.py:156
↓ 2 callersMethodsend_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 callersFunctionset_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 callersMethodsetup
Initialize Playwright and browser.
chapter8/browser-use-rpa/learning_agent/replay.py:44
↓ 2 callersMethodsolve
( self, env: Env, task_index: Optional[int] = None, max_num_steps: int = 30 )
chapter2/prompt-engineering/tau_bench/agents/base.py:11
↓ 2 callersMethodstart
Start the shell process
chapter5/coding-agent/tools/shell_session.py:21
↓ 2 callersMethodstart_monitoring
Start system monitoring
chapter4/agent-with-event-trigger/client.py:95
↓ 2 callersMethodsummarize
Summarize a successful trajectory into reusable experience. Args: question: The original question re
chapter8/gaia-experience/trajectory_summarizer.py:50
↓ 2 callersMethodsummarize_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 callersMethodsummarize_text
Summarize text using OpenAI API.
chapter3/structured-index/raptor_indexer.py:72
↓ 2 callersMethodsupports_dp
(self, dp: Datapoint)
chapter2/prompt-engineering/tau_bench/model_utils/model/model.py:48
↓ 2 callersMethodsyncChatHistory
()
chapter9/live-audio/backend/server.js:997
↓ 2 callersFunctiontask_prompt
(task: str, text: str)
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:41
↓ 2 callersMethodto_dict
Convert to dictionary for JSON serialization
chapter2/log-sanitization/metrics.py:42
↓ 2 callersMethodto_dict
(self)
chapter3/contextual-retrieval/contextual_tools.py:36
↓ 2 callersMethodto_dict
(self)
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:33
↓ 2 callersMethodto_dict
(self)
chapter3/contextual-retrieval-for-user-memory/contextual_evaluator.py:104
↓ 2 callersMethodtranscribeAudio
* 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 callersFunctiontry_classify_recover
(s: str, decode_map: dict[str, int])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:132
↓ 2 callersFunctiontype_to_json_schema_string
(typ: type[T])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:37
↓ 2 callersMethodupdate_attention
Store attention weights for a position (only for output tokens)
chapter2/attention_visualization/agent.py:124
↓ 2 callersMethodupdate_experience
Store an experience for future in-context learning.
chapter1/learning-from-experience/llm_agent.py:238
↓ 2 callersMethodupdate_memory
Update an existing memory item
chapter3/user-memory/memory_manager.py:91
↓ 2 callersMethodvalidate
验证配置是否有效 Returns: bool: 配置是否有效
chapter1/web-search-agent/config.py:31
↓ 2 callersMethodvalidate_api_keys
Check which API keys are configured
chapter3/multimodal-agent/config.py:95
↓ 2 callersFunctionverify
( model: str, provider: str, response: str, messages: List[Dict[str, Any]] )
chapter2/prompt-engineering/tau_bench/envs/user.py:206
↓ 1 callersMethod__init__
(self, model: str, provider: str)
chapter2/prompt-engineering/tau_bench/envs/user.py:38
↓ 1 callersMethod__init__
Initialize the game environment. Args: seed: Random seed for reproducibility stochastic: If True, ad
chapter1/learning-from-experience/game_environment.py:48
↓ 1 callersMethod__init_subclass__
(cls)
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:75
↓ 1 callersMethod_advance_simulated_time
Advance simulated time for demo purposes
chapter2/system-hint/agent.py:194
↓ 1 callersMethod_advance_simulated_time
Advance simulated time for demo purposes
chapter4/agent-with-event-trigger/agent.py:406
↓ 1 callersMethod_analyze_action_types
Analyze types of actions in trajectory. Args: trajectory: Execution trajectory Returns:
chapter8/gaia-experience/trajectory_summarizer.py:273
↓ 1 callersMethod_analyze_comparison
Analyze comparison results to highlight improvements
chapter3/contextual-retrieval/contextual_tools.py:500
↓ 1 callersMethod_analyze_with_doubao
Use Doubao for content analysis
chapter3/multimodal-agent/agent.py:144
↓ 1 callersMethod_analyze_with_gemini_audio
Use Gemini for audio analysis with thinking mode
chapter3/multimodal-agent/agent.py:172
↓ 1 callersMethod_analyze_with_gemini_pdf
Use Gemini for PDF analysis with thinking mode
chapter3/multimodal-agent/agent.py:225
↓ 1 callersMethod_analyze_with_openai
Use OpenAI for content analysis
chapter3/multimodal-agent/agent.py:119
↓ 1 callersMethod_attack
Attack with a weapon.
chapter1/learning-from-experience/game_environment.py:365
↓ 1 callersMethod_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 callersMethod_build_command
Build vLLM server command with arguments
chapter2/local_llm_serving/server.py:27
↓ 1 callersMethod_build_context
Build context based on the current mode Returns: Context string for the model
chapter1/context/agent.py:472
↓ 1 callersMethod_build_evaluation_prompt
Build the evaluation prompt for the LLM.
chapter3/user-memory-evaluation/evaluator.py:99
↓ 1 callersMethod_build_full_conversation
Build full conversation text from chunks
chapter3/contextual-retrieval-for-user-memory/contextual_chunking.py:248
↓ 1 callersMethod_build_messages
Build messages for the LLM including conversation history
chapter3/contextual-retrieval/agent.py:146
↓ 1 callersMethod_build_messages
Build messages for the LLM including conversation history
chapter3/agentic-rag/agent.py:190
↓ 1 callersMethod_build_openrouter_request
Build the OpenRouter-specific request format matching the Go implementation Args: messages: Conversation message
chapter1/search-codegen/agent.py:95
↓ 1 callersMethod_build_prompt
Build the full prompt for the LLM.
chapter1/learning-from-experience/llm_agent.py:122
↓ 1 callersMethod_build_system_prompt
Build enhanced system prompt with memory cards
chapter3/contextual-retrieval-for-user-memory/contextual_agent.py:142
↓ 1 callersMethod_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 callersMethod_calculate_statistics
Calculate statistics for educational purposes. Args: dense_results: Dense search results sparse_results: Spar
chapter3/retrieval-pipeline/retrieval_pipeline.py:307
↓ 1 callersMethod_call_llm
Call the LLM with retry logic.
chapter3/user-memory-evaluation/evaluator.py:30
↓ 1 callersMethod_capture_step
Capture the current step for workflow learning.
chapter8/browser-use-rpa/learning_agent/agent.py:117
↓ 1 callersMethod_chat
调用 Kimi API 进行对话 Args: messages: 消息列表 Returns: API 响应的 Choice 对象
chapter1/web-search-agent/agent.py:94
↓ 1 callersMethod_chat_stream
Stream chat response (only when tools are disabled) Args: message: User message Returns:
chapter3/user-memory/agent.py:839
↓ 1 callersMethod_check_lint_errors
Check for lint errors
chapter5/coding-agent/tools/multi_edit_tool.py:112
↓ 1 callersMethod_check_lint_errors
Check for lint errors after file modification
chapter5/coding-agent/tools/write_tool.py:54
↓ 1 callersMethod_check_lint_errors
Check for lint errors after file modification
chapter5/coding-agent/tools/edit_tool.py:81
↓ 1 callersMethod_check_retrieval_pipeline
Check if the retrieval pipeline service is available
chapter3/agentic-rag-for-user-memory/indexer.py:70
↓ 1 callersMethod_check_retrieval_pipeline
Check if the retrieval pipeline service is available
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:105
← previousnext →501–600 of 2,925, ranked by callers