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
↓ 5 callers
Method
answer_question
Answer a question about user conversation history using RAG Args: question: The question to answer t
chapter3/contextual-retrieval-for-user-memory/agent.py:186
↓ 5 callers
Method
chat
Send a message to the agent Args: message: User message use_tools: Whether to enable tool calling
chapter2/local_llm_serving/main.py:158
↓ 5 callers
Method
choose_action
Choose an action using epsilon-greedy strategy.
chapter1/learning-from-experience/rl_agent.py:67
↓ 5 callers
Method
clear_history
Clear conversation history
chapter3/agentic-rag/agent.py:431
↓ 5 callers
Method
code_interpreter
Execute code in a sandboxed environment with multi-language support. Args: code: Code to execute lan
chapter4/execution-tools/execution_tools.py:22
↓ 5 callers
Method
count_tokens
Count the number of tokens in a text string.
chapter2/context-compression/compression_strategies.py:69
↓ 5 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:621
↓ 5 callers
Function
display_sample
(instr: str, t: str, min: int, max: int, response: int | None = None)
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:61
↓ 5 callers
Method
evaluate
Evaluate an agent's response against the test case criteria. Args: test_case: The test case being evaluated
chapter3/user-memory-evaluation/evaluator.py:40
↓ 5 callers
Method
evaluate_test_case
Evaluate a single test case Args: test_id: The test case ID to evaluate Returns:
chapter3/contextual-retrieval-for-user-memory/evaluator.py:290
↓ 5 callers
Method
generate_message
( self, messages: list[Message], force_json: bool, temperature: float | None = None )
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:297
↓ 5 callers
Method
get_api_key
Get API key for specified provider (or configured provider if not specified)
chapter5/coding-agent/config.py:43
↓ 5 callers
Method
get_client_config
Get OpenAI client configuration
chapter3/contextual-retrieval-for-user-memory/config.py:87
↓ 5 callers
Function
get_company_info
Get company information and business details. Args: symbol: Stock ticker symbol Returns: TextContent with c
chapter4/perception-tools/src/yahoo_finance_tools.py:234
↓ 5 callers
Function
get_historical_data
Retrieve historical stock data. Args: symbol: Stock ticker symbol start: Start date (YYYY-MM-DD) end: End date (
chapter4/perception-tools/src/yahoo_finance_tools.py:135
↓ 5 callers
Method
get_model_config
Get configuration for a specific model
chapter3/multimodal-agent/config.py:89
↓ 5 callers
Method
get_provider
Get the configured provider
chapter5/coding-agent/config.py:38
↓ 5 callers
Method
handle_generate_message_response
( self, prompt: list[dict[str, str] | Message], content: str, force_json: bool )
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:302
↓ 5 callers
Method
increment_conversation_count
Increment the conversation counter
chapter3/user-memory/background_memory_processor.py:488
↓ 5 callers
Function
init_browser
Initialize browser session.
chapter4/collaboration-tools/src/browser_tools.py:15
↓ 5 callers
Method
logEvent
(type, details = {})
chapter9/live-audio/backend/server.js:208
↓ 5 callers
Method
query
Process a user query using the ReAct pattern. Args: user_query: The user's question stream: Whether
chapter3/contextual-retrieval/agent.py:162
↓ 5 callers
Method
request_approval
Request LLM approval for a dangerous operation. Args: operation: The operation name details: Details
chapter4/execution-tools/llm_helper.py:24
↓ 5 callers
Method
step
(self, action: Action)
chapter2/prompt-engineering/tau_bench/envs/base.py:90
↓ 4 callers
Method
_answer_with_context
Answer a query given extracted text context
chapter3/multimodal-agent/agent.py:703
↓ 4 callers
Method
_get_element
Get element using stable selectors with fallback. Args: step: The step containing selector information
chapter8/browser-use-rpa/learning_agent/replay.py:176
↓ 4 callers
Method
_get_state_hash
Create a hashable representation of the game state. This is crucial for tabular Q-learning.
chapter1/learning-from-experience/rl_agent.py:51
↓ 4 callers
Function
add_md_close_tag
(prompt: str)
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:145
↓ 4 callers
Method
add_turn
Add a conversation turn Args: session_id: Session identifier user_message: User's message
chapter3/user-memory/conversation_history.py:91
↓ 4 callers
Function
apply_suffix_strategy
(response: str, suffix_strategy: PromptSuffixStrategy)
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:602
↓ 4 callers
Method
build_generate_message_state
(self, messages: list[Message])
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:324
↓ 4 callers
Function
calculate_statistics
Calculate statistics for a list of rewards
chapter2/prompt-engineering/analyze_results.py:80
↓ 4 callers
Method
calculate_win_probability
Calculate win probability of model_a against model_b based on current ratings. Args: model_a: First model identi
chapter6/elo-leaderboard/elo_rating.py:118
↓ 4 callers
Method
chat
Main chat interface with streaming support
chapter3/multimodal-agent/agent.py:755
↓ 4 callers
Method
chunk_conversation
Chunk a single conversation into segments Args: conversation_id: Unique conversation identifier test
chapter3/contextual-retrieval-for-user-memory/chunker.py:105
↓ 4 callers
Method
chunk_document
Chunk a document with optional contextual enhancement. Educational Note: This is the core innovation - each chunk ge
chapter3/contextual-retrieval/contextual_chunking.py:113
↓ 4 callers
Method
circle
(self, cx, cy, r, fill='light', label=None, font_size=FS_SMALL)
book/svg_lib.py:190
↓ 4 callers
Method
clear
Clear the chain results
chapter1/search-codegen/agent.py:374
↓ 4 callers
Method
clear
Clear all documents.
chapter3/retrieval-pipeline/demo.py:38
↓ 4 callers
Method
contextual_search
Perform contextual search using specified method. Args: query: Search query method: Search method -
chapter3/contextual-retrieval/contextual_tools.py:224
↓ 4 callers
Method
disconnect_all
Cleanup MCP manager (no persistent connections to close) Since we spawn fresh connections for each tool call, there'
chapter4/agent-with-event-trigger/agent.py:194
↓ 4 callers
Function
display_sample
( instr: str, ty: type[T] | dict[str, Any], t: str | None = None, response: T
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:94
↓ 4 callers
Function
download_file_from_url
Download file from URL to temporary location. Args: url: URL to download from timeout: Request timeout in seconds
chapter4/perception-tools/src/base.py:74
↓ 4 callers
Method
evaluate_test_case
Evaluate a single test case with dual memory system Args: test_id: Test case ID Returns:
chapter3/contextual-retrieval-for-user-memory/contextual_evaluator.py:261
↓ 4 callers
Function
execute_and_filter_model_errors
( funcs: list[Callable[[], T]], max_concurrency: int | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/api/exception.py:46
↓ 4 callers
Method
execute_research
Execute the research task Args: max_iterations: Maximum number of tool calls Returns:
chapter2/context-compression/agent.py:473
↓ 4 callers
Method
getHeaders
()
chapter9/live-audio/backend/utils/providers/llmProviders.js:141
↓ 4 callers
Method
get_base_url
Get base URL for the configured provider
chapter5/coding-agent/config.py:64
↓ 4 callers
Function
get_client
Get or create the global PubChem client.
chapter4/perception-tools/src/pubchem_tools.py:112
↓ 4 callers
Function
get_compound_properties
Retrieve detailed chemical properties for a PubChem compound. Args: cid: PubChem Compound ID properties: List of propert
chapter4/perception-tools/src/pubchem_tools.py:239
↓ 4 callers
Function
get_env
( env_name: str, user_strategy: Union[str, UserStrategy], user_model: str, task_split: str,
chapter2/prompt-engineering/tau_bench/envs/__init__.py:8
↓ 4 callers
Method
get_graph_statistics
Get statistics about the knowledge graph.
chapter3/structured-index/graphrag_indexer.py:505
↓ 4 callers
Function
get_graphrag_config
Get GraphRAG configuration from environment.
chapter3/structured-index/config.py:70
↓ 4 callers
Method
get_hidden_rules
Return the hidden game rules (for debugging/analysis).
chapter1/learning-from-experience/game_environment.py:478
↓ 4 callers
Function
get_raptor_config
Get RAPTOR configuration from environment.
chapter3/structured-index/config.py:55
↓ 4 callers
Method
get_rating
Get current rating for a model, initializing if necessary.
chapter6/elo-leaderboard/elo_rating.py:31
↓ 4 callers
Method
get_statistics
Get chunking statistics
chapter3/contextual-retrieval/contextual_chunking.py:455
↓ 4 callers
Method
get_statistics
Get comprehensive statistics
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:649
↓ 4 callers
Method
get_tree_statistics
Get statistics about the RAPTOR tree.
chapter3/structured-index/raptor_indexer.py:297
↓ 4 callers
Method
google_calendar_add
Add event to Google Calendar. Args: summary: Event title start_time: Start time (ISO 8601 format or
chapter4/execution-tools/external_tools.py:87
↓ 4 callers
Method
handle_event
Handle an incoming event and generate a response Args: event: The event to handle max_iterations: Ma
chapter4/agent-with-event-trigger/agent.py:995
↓ 4 callers
Function
is_url
Check if the given string is a URL. Args: path_or_url: String to check Returns: True if the string is a URL
chapter4/perception-tools/src/base.py:36
↓ 4 callers
Function
json_response_to_obj_or_partial_obj
( response: dict[str, Any], typ: type[T] | dict[str, Any] )
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:54
↓ 4 callers
Method
kill
Terminate the shell session
chapter5/coding-agent/tools/shell_session.py:82
↓ 4 callers
Method
load_test_cases
Load test cases from the evaluation framework
chapter3/agentic-rag-for-user-memory/main.py:100
↓ 4 callers
Method
make_request
Make a rate-limited request to PubChem API with retry for async operations.
chapter4/perception-tools/src/pubchem_tools.py:76
↓ 4 callers
Method
parse_force_from_prompt
( self, prompt: str, typ: BaseModel | dict[str, Any], temperature: float | None = None )
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:249
↓ 4 callers
Method
play_episode
Play one episode of the game.
chapter1/learning-from-experience/llm_agent.py:267
↓ 4 callers
Function
print_result
Print formatted result
chapter2/system-hint/main.py:30
↓ 4 callers
Function
print_section
Print a formatted section header
chapter2/system-hint/main.py:23
↓ 4 callers
Method
process_conversation_history
Process conversation history with both contextual chunking and memory cards. Args: chunks: Basic conversation ch
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:118
↓ 4 callers
Method
read_text_file
Read a text file with size limits. Args: file_path: Path to the file encoding: File encoding
chapter4/execution-tools/filesystem_enhanced.py:43
↓ 4 callers
Method
reset
(self, task_index: Optional[int] = None)
chapter2/prompt-engineering/tau_bench/envs/base.py:78
↓ 4 callers
Method
reset_conversation
Reset conversation history
chapter2/local_llm_serving/main.py:176
↓ 4 callers
Method
run
Run the interactive CLI
chapter1/search-codegen/main.py:236
↓ 4 callers
Function
run_and_catch_api_error
( callable: Callable[..., Any], response: Any, datapoint: dict[str, Any] )
chapter2/prompt-engineering/tau_bench/model_utils/api/datapoint.py:265
↓ 4 callers
Method
save_memory
Save notes to storage
chapter3/user-memory/memory_manager.py:133
↓ 4 callers
Method
save_memory
Save JSON memory cards to storage
chapter3/user-memory/memory_manager.py:279
↓ 4 callers
Method
save_memory
Save advanced JSON memory cards to storage
chapter3/user-memory/memory_manager.py:457
↓ 4 callers
Method
save_memory
Save memory cards to storage
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:118
↓ 4 callers
Method
save_workflow
Save a workflow to persistent storage. Args: workflow: The workflow to save
chapter8/browser-use-rpa/learning_agent/knowledge_base.py:60
↓ 4 callers
Method
search
Search the index for relevant chunks using retrieval pipeline Args: query: Search query top_k: Numbe
chapter3/agentic-rag-for-user-memory/indexer.py:272
↓ 4 callers
Method
search
Search for documents matching the query
chapter3/sparse-embedding/bm25_engine.py:417
↓ 4 callers
Function
send_slack_message
Send a Slack message via webhook. Args: message: Message text to send webhook_url: Optional Slack webhook URL (uses default i
chapter4/collaboration-tools/src/notification_tools.py:264
↓ 4 callers
Method
size
Get the number of documents.
chapter3/retrieval-pipeline/document_store.py:78
↓ 4 callers
Method
stop
Stop the vLLM server
chapter2/local_llm_serving/server.py:132
↓ 4 callers
Method
to_dict
Convert event to dictionary for JSON serialization
chapter4/agent-with-event-trigger/event_types.py:74
↓ 4 callers
Method
to_dict
(self)
chapter3/contextual-retrieval/tools.py:23
↓ 4 callers
Method
to_dict
(self)
chapter3/agentic-rag/tools.py:23
↓ 4 callers
Method
transcribe
(audioBuffer, options = {})
chapter9/live-audio/backend/utils/providers/asrProviders.js:55
↓ 4 callers
Function
undo_move
Undo the last move. Returns: Dictionary with board state after undo
chapter4/collaboration-tools/src/chess_tools.py:329
↓ 4 callers
Method
validate
Validate configuration
chapter5/coding-agent/config.py:71
↓ 4 callers
Method
virtual_terminal
Execute shell command in a virtual terminal. Args: command: Shell command to execute timeout: Timeou
chapter4/execution-tools/execution_tools.py:127
↓ 4 callers
Function
write_excel_data
Write data to Excel file. Args: file_path: Path to Excel file data: Dictionary of {sheet_name: [rows]} overwrite
chapter4/collaboration-tools/src/excel_tools.py:77
↓ 3 callers
Method
__init__
Initialize memory manager Args: user_id: Unique identifier for the user verbose: Whether to print de
chapter3/user-memory/memory_manager.py:62
↓ 3 callers
Method
_extract_pdf_to_text
Extract PDF to text using OCR with thinking mode
chapter3/multimodal-agent/agent.py:553
↓ 3 callers
Method
_extract_tools_from_trajectory
Extract unique tools used from trajectory. Args: trajectory: Execution trajectory Returns:
chapter8/gaia-experience/trajectory_summarizer.py:250
↓ 3 callers
Method
_format_size
Format file size in human-readable format.
chapter4/execution-tools/filesystem_enhanced.py:670
↓ 3 callers
Method
_init_system_prompt
Initialize the system prompt
chapter3/user-memory/conversational_agent.py:120
↓ 3 callers
Function
_is_trace
(obj: dict[str, Any])
chapter2/prompt-engineering/tau_bench/model_utils/api/datapoint.py:18
← previous
next →
101–200 of 2,925, ranked by callers