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
_execute_tool
Execute a tool and return the result Args: tool_name: Name of the tool to execute arguments: Argumen
chapter1/context/agent.py:534
↓ 2 callers
Method
_execute_tool
Execute a tool and return the result
chapter3/agentic-rag-for-user-memory/agent.py:128
↓ 2 callers
Method
_execute_tool
Execute a tool and return the result
chapter3/contextual-retrieval-for-user-memory/agent.py:128
↓ 2 callers
Method
_extract_image_to_text
Extract image to text description
chapter3/multimodal-agent/agent.py:607
↓ 2 callers
Method
_format_system_prompt_with_tools
Format the system prompt with available tools in Qwen3 format
chapter2/local_llm_serving/agent.py:38
↓ 2 callers
Method
_generate_session_id
Generate a unique session ID
chapter3/user-memory/conversational_agent.py:116
↓ 2 callers
Method
_get_detailed_error
Get detailed error information for debugging
chapter2/system-hint/agent.py:483
↓ 2 callers
Method
_get_llm
Get LLM instance based on configuration.
chapter8/browser-use-rpa/demo_email.py:217
↓ 2 callers
Method
_get_memory_context
Get current memory context as a string
chapter3/user-memory/agent.py:271
↓ 2 callers
Method
_get_relevant_experiences
Retrieve relevant experiences for a given question. Args: question: The current question Re
chapter8/gaia-experience/experience_agent.py:126
↓ 2 callers
Method
_get_system_state
Get current system state information
chapter2/system-hint/agent.py:163
↓ 2 callers
Method
_get_timestamp
Get formatted timestamp
chapter2/system-hint/agent.py:187
↓ 2 callers
Method
_get_timestamp
Get formatted timestamp
chapter4/agent-with-event-trigger/agent.py:400
↓ 2 callers
Method
_get_tools_description
Get tool descriptions for the model
chapter2/context-compression/agent.py:126
↓ 2 callers
Method
_index_contextual_chunks
Index contextual chunks in the retrieval pipeline
chapter3/contextual-retrieval-for-user-memory/contextual_indexer.py:188
↓ 2 callers
Method
_index_documents
Send documents to the retrieval pipeline for indexing
chapter3/agentic-rag-for-user-memory/indexer.py:201
↓ 2 callers
Method
_index_documents
Send documents to the retrieval pipeline for indexing
chapter3/contextual-retrieval-for-user-memory/indexer.py:201
↓ 2 callers
Method
_init_llm_client
Initialize the LLM client based on provider
chapter3/contextual-retrieval/agent.py:49
↓ 2 callers
Method
_init_ollama
Initialize Ollama backend
chapter2/local_llm_serving/main.py:103
↓ 2 callers
Method
_init_system_prompt
Initialize the system prompt for OpenAI co-founders research
chapter2/context-compression/agent.py:92
↓ 2 callers
Method
_init_system_prompt
Initialize the system prompt for the conversation
chapter2/system-hint/agent.py:124
↓ 2 callers
Method
_init_system_prompt
Initialize the system prompt for the conversation
chapter1/context/agent.py:359
↓ 2 callers
Method
_init_system_prompt
Initialize the system prompt for the conversation
chapter4/agent-with-event-trigger/agent.py:321
↓ 2 callers
Method
_init_system_prompt
Initialize the system prompt with memory context based on memory mode
chapter3/user-memory/agent.py:134
↓ 2 callers
Method
_is_safe_path
Check if path is within workspace.
chapter4/execution-tools/file_tools.py:25
↓ 2 callers
Method
_non_streaming_response
Get non-streaming response from the model Args: messages: Conversation messages Returns:
chapter2/context-compression/agent.py:413
↓ 2 callers
Method
_process_native_gemini
Process using Gemini's native multimodal API with thinking mode
chapter3/multimodal-agent/agent.py:406
↓ 2 callers
Method
_resolve_path
Resolve path relative to workspace.
chapter4/execution-tools/file_tools.py:18
↓ 2 callers
Function
_run_timer
Internal function to run a timer.
chapter4/collaboration-tools/src/timer_tools.py:85
↓ 2 callers
Method
_start_session
Start a new session
chapter3/user-memory/agent.py:130
↓ 2 callers
Method
_stream_response
Stream response from the model Args: messages: Conversation messages Returns: C
chapter2/context-compression/agent.py:317
↓ 2 callers
Method
_stream_response
Stream response content
chapter3/contextual-retrieval/agent.py:280
↓ 2 callers
Method
_stream_response
Stream response content
chapter3/agentic-rag/agent.py:340
↓ 2 callers
Method
_stream_response
Stream response from the model
chapter3/multimodal-agent/agent.py:786
↓ 2 callers
Method
_tool_code_interpreter
Execute Python code in restricted environment
chapter2/system-hint/agent.py:650
↓ 2 callers
Method
_tool_execute_command
Execute shell command
chapter2/system-hint/agent.py:675
↓ 2 callers
Method
_tool_read_file
Read file contents with optional line-based reading
chapter2/system-hint/agent.py:529
↓ 2 callers
Method
_tool_rewrite_todo_list
Rewrite TODO list with new pending items
chapter2/system-hint/agent.py:724
↓ 2 callers
Method
_tool_update_todo_status
Update status of TODO items
chapter2/system-hint/agent.py:752
↓ 2 callers
Method
_tool_write_file
Write content to file
chapter2/system-hint/agent.py:628
↓ 2 callers
Function
_trigger_timer_callback
Trigger callback actions when timer expires.
chapter4/collaboration-tools/src/timer_tools.py:117
↓ 2 callers
Function
addLog
(message: string, type: LogEntry['type'] = 'info')
chapter9/live-audio/frontend/pages/index.tsx:96
↓ 2 callers
Method
add_experience
Add an experience to the knowledge base. Args: query: The query/question for indexing experience: Th
chapter8/gaia-experience/knowledge_base.py:225
↓ 2 callers
Method
add_item
Add an item to the HNSW index.
chapter3/dense-embedding/indexing.py:275
↓ 2 callers
Method
add_memory
Add a new memory item
chapter3/user-memory/memory_manager.py:86
↓ 2 callers
Method
analyze_conversation
Analyze conversation context and determine memory updates Args: conversation_context: List of conversation messa
chapter3/user-memory/background_memory_processor.py:110
↓ 2 callers
Method
analyze_image
Analyze an image with a specific query
chapter3/multimodal-agent/agent.py:83
↓ 2 callers
Method
answer_question
Answer a question about user conversation history using RAG Args: question: The question to answer t
chapter3/agentic-rag-for-user-memory/agent.py:186
↓ 2 callers
Method
answer_question
Answer a question using dual memory system Args: question: The question to answer test_id: Test case
chapter3/contextual-retrieval-for-user-memory/contextual_agent.py:259
↓ 2 callers
Function
apply_excel_formula
Apply formula to Excel cell. Args: file_path: Path to Excel file sheet_name: Worksheet name cell: Cell reference
chapter4/collaboration-tools/src/excel_tools.py:186
↓ 2 callers
Function
apply_tone_modification
Apply tone modification to text (wiki or system prompt) Args: text: Original text tone_style: The tone style to apply
chapter2/prompt-engineering/ablation_utils.py:61
↓ 2 callers
Method
binary_classify
( self, instruction: str, text: str, examples: list[BinaryClassifyDatapoint] |
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:264
↓ 2 callers
Method
brace_right
(self, x, y1, y2, label=None)
book/svg_lib.py:216
↓ 2 callers
Function
build_classify_state
( instruction: str, text: str, options: list[str], examples: list[ClassifyDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:240
↓ 2 callers
Function
build_classify_state
( instruction: str, text: str, options: list[str], examples: list[ClassifyDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:179
↓ 2 callers
Function
build_generate_state
( instruction: str, text: str, examples: list[GenerateDatapoint] | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:68
↓ 2 callers
Function
build_generate_state
( instruction: str, text: str, examples: list[GenerateDatapoint] | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:224
↓ 2 callers
Method
build_index
Build RAPTOR tree index from text.
chapter3/structured-index/raptor_indexer.py:167
↓ 2 callers
Method
build_indexes
Build or rebuild indexes by sending all chunks to retrieval pipeline
chapter3/agentic-rag-for-user-memory/indexer.py:244
↓ 2 callers
Method
build_indexes
Build or rebuild indexes by sending all chunks to retrieval pipeline
chapter3/contextual-retrieval-for-user-memory/indexer.py:244
↓ 2 callers
Method
build_knowledge_graph
Build knowledge graph from text.
chapter3/structured-index/graphrag_indexer.py:161
↓ 2 callers
Function
build_leaderboard_optimized
Build Elo leaderboard using highly optimized NumPy + Numba algorithm. This implementation is significantly faster than the basic version
chapter6/elo-leaderboard/optimized_elo.py:274
↓ 2 callers
Function
build_parse_force_state
( instruction: str, typ: type[T] | dict[str, Any], text: str | None = None, examples: list[Par
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:87
↓ 2 callers
Function
build_parse_force_state
( instruction: str, typ: type[T] | dict[str, Any], text: str | None = None, examples: list[Par
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:84
↓ 2 callers
Function
build_parse_state
( text: str, typ: type[T] | dict[str, Any], examples: list[ParseDatapoint] | None = None, suff
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:191
↓ 2 callers
Function
build_parse_state
( text: str, typ: type[T] | dict[str, Any], examples: list[ParseDatapoint] | None = None, )
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:137
↓ 2 callers
Function
build_score_state
( instruction: str, text: str, min: int, max: int, examples: list[ScoreDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/chat.py:143
↓ 2 callers
Function
build_score_state
( instruction: str, text: str, min: int, max: int, examples: list[ScoreDatapoint] | None =
chapter2/prompt-engineering/tau_bench/model_utils/model/completion.py:54
↓ 2 callers
Method
calculate_idf
Calculate Inverse Document Frequency for a term
chapter3/sparse-embedding/bm25_engine.py:256
↓ 2 callers
Method
calculate_summary
Calculate summary statistics across all metrics
chapter2/log-sanitization/metrics.py:60
↓ 2 callers
Function
cancel_timer
Cancel an active timer. Args: timer_id: ID of the timer to cancel Returns: Dictionary with cancellation status
chapter4/collaboration-tools/src/timer_tools.py:147
↓ 2 callers
Method
change_directory
Change the current working directory. Args: directory: Directory to change to Returns:
chapter4/execution-tools/terminal_controller.py:105
↓ 2 callers
Method
chat
Simple chat interface (wraps execute_task for compatibility) Args: message: User message stream: Whe
chapter3/user-memory/agent.py:820
↓ 2 callers
Method
chat_stream
Stream a message to the model and handle tool calls in a ReAct loop Yields chunks that include: - type: 'thinking',
chapter2/local_llm_serving/ollama_native.py:154
↓ 2 callers
Method
chat_stream
Stream a message to the model and handle tool calls in a ReAct loop Yields chunks that include: - type: 'thinking',
chapter2/local_llm_serving/agent.py:271
↓ 2 callers
Method
chunk_conversation
Chunk a single conversation into segments Args: conversation_id: Unique conversation identifier test
chapter3/agentic-rag-for-user-memory/chunker.py:105
↓ 2 callers
Method
chunk_text
Chunk text into smaller segments. Args: text: Document text to chunk doc_id: Document identifier
chapter3/contextual-retrieval/chunking.py:24
↓ 2 callers
Method
chunk_text
Chunk text into smaller segments. Args: text: Document text to chunk doc_id: Document identifier
chapter3/agentic-rag/chunking.py:24
↓ 2 callers
Method
classify
( self, instruction: str, text: str, options: list[str], examples: lis
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:239
↓ 2 callers
Method
cleanup
Clean up browser resources.
chapter8/browser-use-rpa/learning_agent/replay.py:62
↓ 2 callers
Method
cleanup
()
chapter9/live-audio/backend/server.js:174
↓ 2 callers
Method
clear_documents
Clear all documents.
chapter3/retrieval-pipeline/test_client.py:43
↓ 2 callers
Method
clear_index
Clear all indexed documents
chapter3/sparse-embedding/bm25_engine.py:477
↓ 2 callers
Function
cn
(...inputs: ClassValue[])
chapter9/live-audio/frontend/lib/utils.ts:4
↓ 2 callers
Function
colorScale
(value: number)
chapter2/attention_visualization/frontend/components/AttentionPreview.tsx:61
↓ 2 callers
Function
convert_currency
Convert between currencies. Args: amount: Amount to convert from_currency: Source currency code (e.g., USD) to_c
chapter4/perception-tools/src/public_data_tools.py:228
↓ 2 callers
Method
copy_file
Copy a file or directory. Args: source: Source path destination: Destination path overwr
chapter4/execution-tools/filesystem_enhanced.py:498
↓ 2 callers
Method
createWavBuffer
* Convert raw audio buffer to WAV format * @param {Buffer} audioBuffer - Raw PCM audio data * @param {Object} options - Audio format options
chapter9/live-audio/backend/utils/providers/asrProviders.js:21
↓ 2 callers
Method
create_complex_cases
Create complex legal scenario questions
chapter3/contextual-retrieval/evaluation/dataset_builder.py:97
↓ 2 callers
Method
create_complex_cases
Create complex legal scenario questions
chapter3/agentic-rag/evaluation/dataset_builder.py:97
↓ 2 callers
Method
create_directories
Create necessary directories if they don't exist
chapter2/context-compression/config.py:68
↓ 2 callers
Method
create_directory
Create a new directory. Args: directory_path: Path for new directory parents: Create parent director
chapter4/execution-tools/filesystem_enhanced.py:612
↓ 2 callers
Function
create_excel_worksheet
Create a new worksheet in Excel file. Args: file_path: Path to Excel file sheet_name: Name for new worksheet
chapter4/collaboration-tools/src/excel_tools.py:147
↓ 2 callers
Function
create_legal_documents
Create sample legal documents for the knowledge base
chapter3/contextual-retrieval/evaluation/dataset_builder.py:176
↓ 2 callers
Function
create_legal_documents
Create sample legal documents for the knowledge base
chapter3/agentic-rag/evaluation/dataset_builder.py:176
↓ 2 callers
Function
create_sample_cards
Create sample memory cards for testing
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:402
↓ 2 callers
Method
create_simple_cases
Create simple direct legal questions
chapter3/contextual-retrieval/evaluation/dataset_builder.py:20
↓ 2 callers
Method
create_simple_cases
Create simple direct legal questions
chapter3/agentic-rag/evaluation/dataset_builder.py:20
↓ 2 callers
Function
create_summary_task
Create a task that requires reading multiple files
chapter2/kv-cache/main.py:27
↓ 2 callers
Method
delete_item
Delete an item from the HNSW index.
chapter3/dense-embedding/indexing.py:307
← previous
next →
301–400 of 2,925, ranked by callers