MCPcopy Create free account

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

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

↓ 3 callersFunction_pill
(svg, x, y, w, h, label, fill='light', font_size=FS_SMALL, bold=False)
book/gen_ch4_figs.py:31
↓ 3 callersMethod_prepare_chunk_text
Prepare chunk text for indexing with contextual enrichment Args: chunk: Conversation chunk
chapter3/agentic-rag-for-user-memory/indexer.py:124
↓ 3 callersMethod_prepare_chunk_text
Prepare chunk text for indexing with contextual enrichment Args: chunk: Conversation chunk
chapter3/contextual-retrieval-for-user-memory/indexer.py:124
↓ 3 callersMethod_process_request
Process a user request Args: request: User request force_tools: Force tool usage regardless of setti
chapter1/search-codegen/main.py:181
↓ 3 callersMethodadd_document
Add a document to the index
chapter3/sparse-embedding/bm25_engine.py:145
↓ 3 callersMethodadd_step
Add a step to the workflow
chapter8/browser-use-rpa/learning_agent/workflow.py:122
↓ 3 callersMethodbuild_system_prompt
(self, instruction: Optional[str])
chapter2/prompt-engineering/tau_bench/envs/user.py:55
↓ 3 callersMethodcall_tool
Call a tool and return the result.
chapter4/collaboration-tools/client_example.py:42
↓ 3 callersMethodchat
Send a message using Ollama's native tool calling Args: message: User message use_tools: Whether to
chapter2/local_llm_serving/ollama_native.py:44
↓ 3 callersMethodchat
Send a message to the model and handle tool calls in a ReAct loop Args: message: User message use_to
chapter2/local_llm_serving/agent.py:143
↓ 3 callersMethodclear_all_memories
Clear all memories for this user - useful for testing
chapter3/user-memory/memory_manager.py:395
↓ 3 callersMethodclear_history
清空对话历史
chapter1/web-search-agent/agent.py:198
↓ 3 callersMethodclear_history
Clear conversation history
chapter3/contextual-retrieval/agent.py:377
↓ 3 callersMethodcode_block
Render a block of monospace code lines with background.
book/svg_lib.py:127
↓ 3 callersFunctioncomplex_problem_reasoning
Perform complex problem reasoning with step-by-step thinking. Args: problem: Problem statement context: Optional context
chapter4/collaboration-tools/src/intelligence_tools.py:73
↓ 3 callersMethodconnect
Connect to the MCP server.
chapter4/collaboration-tools/client_example.py:20
↓ 3 callersMethodcreateChatCompletion
(messages, options = {})
chapter9/live-audio/backend/utils/providers/llmProviders.js:160
↓ 3 callersMethodcreate_directories
Create necessary directories if they don't exist
chapter3/user-memory/config.py:133
↓ 3 callersFunctioncreate_excel_workbook
Create a new Excel workbook. Args: file_path: Path for new workbook Returns: Dictionary with result
chapter4/collaboration-tools/src/excel_tools.py:116
↓ 3 callersFunctioncreate_test_chunks
Create test conversation chunks with substantial content
chapter3/agentic-rag-for-user-memory/test_logging.py:18
↓ 3 callersFunctioncreate_test_chunks
Create test conversation chunks with substantial content
chapter3/contextual-retrieval-for-user-memory/test_logging.py:18
↓ 3 callersMethoddelete_file
Delete a file or directory. Args: file_path: Path to delete recursive: For directories, delete recur
chapter4/execution-tools/filesystem_enhanced.py:559
↓ 3 callersMethoddemo_experience_agent
Demonstrate the experience agent.
chapter8/gaia-experience/demo.py:196
↓ 3 callersMethoddemo_knowledge_base_indexing
Demonstrate knowledge base indexing.
chapter8/gaia-experience/demo.py:62
↓ 3 callersMethoddemo_trajectory_summarization
Demonstrate trajectory summarization.
chapter8/gaia-experience/demo.py:125
↓ 3 callersFunctiondict_equal
(d1: dict, d2: dict)
chapter2/prompt-engineering/tau_bench/model_utils/api/datapoint.py:28
↓ 3 callersMethoddisconnect
Disconnect from the server.
chapter4/collaboration-tools/client_example.py:36
↓ 3 callersMethodedit_file
Edit a file by searching and replacing content. Args: path: File path search: Text to search for
chapter4/execution-tools/file_tools.py:107
↓ 3 callersFunctionensure_sample_pdfs
Ensure sample PDFs exist, create them if they don't Returns: bool: True if PDFs are available
chapter1/context/main.py:493
↓ 3 callersMethodexecute_command
Execute a shell command in current directory. Args: command: Command to execute timeout: Timeout in
chapter4/execution-tools/terminal_controller.py:39
↓ 3 callersMethodexpected_score
Calculate expected win probability for model A against model B. Uses logistic function: P(A wins) = 1 / (1 + 10^((R_B - R_A)
chapter6/elo-leaderboard/elo_rating.py:39
↓ 3 callersFunctionextract_pdf_text
Extract text from PDF file. Args: file_path: Path to PDF file page_range: Optional page range (e.g., "1-5" or "1,3,5")
chapter4/perception-tools/src/document_processing_tools.py:24
↓ 3 callersMethodgenerate_next_message
(self, messages: List[Dict[str, Any]])
chapter2/prompt-engineering/tau_bench/envs/user.py:46
↓ 3 callersFunctiongenerate_python_code
Generate Python code based on task description. Args: task_description: Description of what the code should do requireme
chapter4/collaboration-tools/src/intelligence_tools.py:18
↓ 3 callersFunctiongenerate_request
( url: str, prompt: str, temperature: float = 0.0, force_json: bool = False, **req_body_kw
chapter2/prompt-engineering/tau_bench/model_utils/model/vllm_utils.py:8
↓ 3 callersMethodgetRequestPayload
(messages, options = {})
chapter9/live-audio/backend/utils/providers/llmProviders.js:148
↓ 3 callersFunctionget_board_state
Get the current board state. Returns: Dictionary with complete board state
chapter4/collaboration-tools/src/chess_tools.py:253
↓ 3 callersFunctionget_compound_synonyms
Retrieve synonyms for a PubChem compound. Args: cid: PubChem Compound ID max_synonyms: Maximum number of synonyms (1-100
chapter4/perception-tools/src/pubchem_tools.py:318
↓ 3 callersMethodget_context_string
Get memory cards as formatted string for LLM context. Args: max_cards: Maximum number of cards to include (None
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:269
↓ 3 callersMethodget_document
Get a document by ID.
chapter3/retrieval-pipeline/document_store.py:36
↓ 3 callersMethodget_document
Retrieve a document by ID (can be internal or external)
chapter3/sparse-embedding/bm25_engine.py:443
↓ 3 callersFunctionget_legal_moves
Get all legal moves in the current position. Returns: Dictionary with legal moves in UCI and SAN formats
chapter4/collaboration-tools/src/chess_tools.py:215
↓ 3 callersFunctionget_move_history
Get the history of moves played in the current game. Returns: Dictionary with move history
chapter4/collaboration-tools/src/chess_tools.py:367
↓ 3 callersMethodget_posting_list
Get document IDs containing the term
chapter3/sparse-embedding/bm25_engine.py:188
↓ 3 callersFunctionget_sample_tasks
Get sample tasks for testing Returns: list: List of sample task dictionaries
chapter1/context/main.py:525
↓ 3 callersMethodget_size
Get the current number of items in the index.
chapter3/dense-embedding/indexing.py:374
↓ 3 callersMethodget_statistics
Get statistics about the knowledge base. Returns: Dictionary containing knowledge base statistics
chapter8/browser-use-rpa/learning_agent/knowledge_base.py:263
↓ 3 callersMethodget_statistics
Get statistics about the knowledge base. Returns: Dictionary with statistics
chapter8/gaia-experience/knowledge_base.py:309
↓ 3 callersMethodget_tool
Get tool instance by name
chapter5/coding-agent/tool_registry.py:38
↓ 3 callersMethodgithub_create_pr
Create a GitHub Pull Request. Args: repo_name: Repository name (format: owner/repo) title: PR title
chapter4/execution-tools/external_tools.py:189
↓ 3 callersFunctionguard_reasoning_process
Guard and validate a proposed action or reasoning. Args: proposed_action: The action being proposed context: Context inf
chapter4/collaboration-tools/src/intelligence_tools.py:128
↓ 3 callersMethodindex_file
Index a single file. Args: file_path: Path to the file doc_id: Optional document ID
chapter3/contextual-retrieval/chunking.py:160
↓ 3 callersMethodindex_file
Index a single file. Args: file_path: Path to the file doc_id: Optional document ID
chapter3/agentic-rag/chunking.py:160
↓ 3 callersMethodlist_test_cases
List all available test cases.
chapter3/user-memory-evaluation/main.py:60
↓ 3 callersFunctionload_config
Load configuration from environment variables.
chapter4/collaboration-tools/src/config.py:61
↓ 3 callersMethodload_mcp_tools
Load tools from MCP servers This must be called in an async context after agent initialization.
chapter4/agent-with-event-trigger/agent.py:285
↓ 3 callersMethodload_test_cases
Load test cases from the evaluation framework Args: category: Optional category filter (layer1, layer2, layer3)
chapter3/contextual-retrieval-for-user-memory/contextual_evaluator.py:166
↓ 3 callersMethodlog_banner
Log a banner message
chapter2/context-compression/run_all_strategies.py:75
↓ 3 callersMethodlog_error
Log errors with context.
chapter3/dense-embedding/logger.py:148
↓ 3 callersFunctionmap
( 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
↓ 3 callersFunctionoptionalize_type
(typ: type[T])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:42
↓ 3 callersFunctionprint_section
Print a colored section header
chapter7/continued-pretraining/evaluate_model.py:25
↓ 3 callersFunctionprint_section
Print a formatted section header
chapter3/user-memory/main.py:33
↓ 3 callersMethodprocess_file
Process a file based on its extension.
chapter3/structured-index/document_processor.py:30
↓ 3 callersMethodprocess_multimodal_content
Process multimodal content based on extraction mode
chapter3/multimodal-agent/agent.py:376
↓ 3 callersMethodread_file
Read contents of a file Args: file_path: Path to the file relative to root directory offset: Line nu
chapter2/kv-cache/agent.py:68
↓ 3 callersMethodreset
Reset the agent's trajectory and conversation history
chapter1/context/agent.py:697
↓ 3 callersMethodreset
Reset the agent's state
chapter4/agent-with-event-trigger/agent.py:1186
↓ 3 callersMethodreset_session
Start a new conversation session
chapter3/user-memory/conversational_agent.py:253
↓ 3 callersMethodsearch
Search the knowledge graph. Args: query: Search query top_k: Number of results to return
chapter3/structured-index/graphrag_indexer.py:374
↓ 3 callersMethodsearch
Search the index for relevant chunks using retrieval pipeline Args: query: Search query top_k: Numbe
chapter3/contextual-retrieval-for-user-memory/indexer.py:272
↓ 3 callersMethodsearch_and_analyze
Combine web search with code analysis This method demonstrates using both native tools together: 1. Search for infor
chapter1/search-codegen/agent.py:275
↓ 3 callersMethodsearch_files
Search for files matching a pattern. Args: pattern: Glob pattern (e.g., "*.py", "test_*.txt") direct
chapter4/execution-tools/filesystem_enhanced.py:297
↓ 3 callersFunctionsearch_similar_compounds
Find structurally similar compounds. Args: cid: Reference compound CID similarity_threshold: Minimum similarity (0.0-1.0
chapter4/perception-tools/src/pubchem_tools.py:394
↓ 3 callersFunctionsend_email
Send an email notification. Args: to_email: Recipient email address subject: Email subject body: Email body content
chapter4/collaboration-tools/src/notification_tools.py:12
↓ 3 callersFunctionsend_telegram_message
Send a Telegram message. Args: message: Message text to send chat_id: Optional Telegram chat ID (uses default if not provided
chapter4/collaboration-tools/src/notification_tools.py:199
↓ 3 callersMethodshould_process
Check if memory processing should be triggered based on conversation count Returns: True if processing should oc
chapter3/user-memory/background_memory_processor.py:468
↓ 3 callersFunctionstr_equal
(s1: str, s2: str)
chapter2/prompt-engineering/tau_bench/model_utils/api/datapoint.py:93
↓ 3 callersMethodsubmit_and_evaluate
Submit an agent's response and get evaluation result. Args: test_id: The test case ID agent_response
chapter3/user-memory-evaluation/framework.py:206
↓ 3 callersMethodto_dict
Convert to dictionary
chapter5/coding-agent/tools/base.py:19
↓ 3 callersMethodto_dict
(self)
chapter2/attention_visualization/main.py:31
↓ 3 callersMethodto_dict
(self)
chapter3/agentic-rag-for-user-memory/agent.py:44
↓ 3 callersMethodto_dict
Convert to dictionary format
chapter3/multimodal-agent/agent.py:37
↓ 3 callersMethodto_dict
Convert to dictionary for storage
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:40
↓ 3 callersMethodto_dict
(self)
chapter3/contextual-retrieval-for-user-memory/agent.py:44
↓ 3 callersMethodto_json
Serialize workflow to JSON string
chapter8/browser-use-rpa/learning_agent/workflow.py:153
↓ 3 callersMethodtokenize
Tokenize text into words, numbers, and codes. Handles: - Words (preserving case for acronyms) - Numbers (404, 500, 3.
chapter3/sparse-embedding/bm25_engine.py:37
↓ 3 callersMethodtrain
Train the agent for multiple episodes. Args: num_episodes: Number of episodes to train verbose: Whet
chapter1/learning-from-experience/rl_agent.py:170
↓ 3 callersMethodupdate_q_value
Update Q-value using the Q-learning update rule. Q(s,a) <- Q(s,a) + α[r + γ max Q(s',a') - Q(s,a)]
chapter1/learning-from-experience/rl_agent.py:97
↓ 3 callersMethodvalidate
Validate required configuration Returns: True if configuration is valid
chapter2/context-compression/config.py:48
↓ 3 callersMethodverify_code_syntax
Verify code syntax and provide feedback. Args: code: The code to verify language: Programming langua
chapter4/execution-tools/llm_helper.py:180
↓ 2 callersMethod_build_context
Build context for the LLM including task description and past experiences. This is the key to in-context learning.
chapter1/learning-from-experience/llm_agent.py:71
↓ 2 callersMethod_check_answer_criteria
Simple check if answer meets criteria
chapter3/contextual-retrieval-for-user-memory/contextual_evaluator.py:522
↓ 2 callersMethod_clean_pdf_text
Clean extracted PDF text.
chapter3/structured-index/document_processor.py:113
↓ 2 callersMethod_convert_tools_to_ollama_format
Convert tool registry to Ollama's expected format
chapter2/local_llm_serving/ollama_native.py:36
↓ 2 callersMethod_create_basic_chunk
Create a basic chunk dictionary
chapter3/contextual-retrieval/contextual_chunking.py:269
↓ 2 callersMethod_create_chunk
Create a chunk with metadata
chapter3/contextual-retrieval/chunking.py:136
↓ 2 callersMethod_create_chunk
Create a chunk with metadata
chapter3/agentic-rag/chunking.py:136
↓ 2 callersMethod_display_result
Display the result of a request Args: result: Result dictionary from agent
chapter1/search-codegen/main.py:202
↓ 2 callersMethod_display_result
Display a single evaluation result.
chapter3/user-memory-evaluation/main.py:221
← previousnext →201–300 of 2,925, ranked by callers