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
↓ 1 callers
Function
test_text_processor
Test text processing functionality
chapter3/sparse-embedding/test_engine.py:17
↓ 1 callers
Function
test_timer_tools
Test timer functionality.
chapter4/collaboration-tools/test_basic.py:30
↓ 1 callers
Function
test_tool_calling
Test that the agent correctly uses OpenAI tool calling format
chapter2/kv-cache/test_api.py:11
↓ 1 callers
Function
test_tool_definitions
Verify extract_key_information is removed from tool definitions
chapter3/agentic-rag-for-user-memory/test_logging.py:212
↓ 1 callers
Function
test_tool_definitions
Verify extract_key_information is removed from tool definitions
chapter3/contextual-retrieval-for-user-memory/test_logging.py:212
↓ 1 callers
Function
test_tool_usage
Test tool calling capabilities
chapter1/context/test_kimi.py:59
↓ 1 callers
Function
test_tools
Test various perception tools.
chapter4/perception-tools/quickstart.py:22
↓ 1 callers
Function
test_top_k
Test that different top_k values return the correct number of results
chapter3/agentic-rag-for-user-memory/test_top_k.py:18
↓ 1 callers
Function
test_top_k
Test that different top_k values return the correct number of results
chapter3/contextual-retrieval-for-user-memory/test_top_k.py:18
↓ 1 callers
Function
test_ttft_tracking
Test and display TTFT tracking across iterations
chapter2/kv-cache/test_ttft.py:11
↓ 1 callers
Function
test_virtual_terminal
Test virtual terminal functionality.
chapter4/execution-tools/test_execution_tools.py:34
↓ 1 callers
Method
test_workflow_capture
Test 1: Workflow capture functionality.
chapter8/browser-use-rpa/test_validation.py:75
↓ 1 callers
Method
test_workflow_replay
Test 4: Workflow replay mechanism.
chapter8/browser-use-rpa/test_validation.py:205
↓ 1 callers
Function
time_bar
(y, x_start_pct, x_end_pct, fill, label, h_bar=28)
book/gen_ch4_figs.py:285
↓ 1 callers
Method
to_dict
Convert workflow to dictionary for serialization
chapter8/browser-use-rpa/learning_agent/workflow.py:126
↓ 1 callers
Method
to_dict
Convert to dictionary for JSON serialization
chapter2/attention_visualization/agent.py:38
↓ 1 callers
Method
to_dict
(self)
chapter3/agentic-rag-for-user-memory/indexer.py:31
↓ 1 callers
Method
to_dict
(self)
chapter3/agentic-rag-for-user-memory/chunker.py:47
↓ 1 callers
Method
to_dict
Convert to dictionary
chapter3/user-memory/locomo_benchmark.py:32
↓ 1 callers
Method
to_dict
Convert to dictionary
chapter3/user-memory/memory_manager.py:28
↓ 1 callers
Method
to_dict
Convert to dictionary
chapter3/user-memory/conversation_history.py:26
↓ 1 callers
Method
to_dict
(self)
chapter3/contextual-retrieval-for-user-memory/indexer.py:31
↓ 1 callers
Method
to_dict
(self)
chapter3/contextual-retrieval-for-user-memory/contextual_agent.py:48
↓ 1 callers
Method
to_dict
(self)
chapter3/contextual-retrieval-for-user-memory/chunker.py:47
↓ 1 callers
Function
to_hashable
(item: ToHashable)
chapter2/prompt-engineering/tau_bench/envs/base.py:27
↓ 1 callers
Method
to_user_message
Convert event to user message format for the agent
chapter4/agent-with-event-trigger/event_types.py:35
↓ 1 callers
Function
tokenise_audio
(waveform)
chapter7/orpheus/orpheus_sft_unsloth.py:107
↓ 1 callers
Method
train_episode
Train the agent for one episode. Returns: Total reward, number of steps, victory status
chapter1/learning-from-experience/rl_agent.py:124
↓ 1 callers
Function
train_model
使用 SFTTrainer 训练模型 Args: model: 配置了 LoRA 的模型 tokenizer: 分词器 dataset: 训练数据集 output_dir: 输出目录 batc
chapter7/MultilingualReasoning/gpt_oss_20b_sft.py:203
↓ 1 callers
Function
train_model
Train the model using TRL SFTTrainer. Hyperparameters are based on the OpenAI Cookbook gpt-oss-20b example, which provides good defa
chapter8/prompt-distillation/train_sft_trl.py:143
↓ 1 callers
Function
transcribe_audio_whisper
Transcribe audio file using OpenAI Whisper (local). Note: Requires whisper package installed. Args: file_path: Path to audio
chapter4/perception-tools/src/media_processing_tools.py:24
↓ 1 callers
Function
transformValue
(value: number)
chapter2/attention_visualization/frontend/components/AttentionPreview.tsx:54
↓ 1 callers
Function
trim_audio
Trim audio file to specified time range using ffmpeg. Args: audio_path: Path to audio file start_time: Start time in sec
chapter4/perception-tools/src/media_processing_tools.py:574
↓ 1 callers
Function
try_decode
Safely decode bytes to string.
chapter4/execution-tools/multilang_executor.py:18
↓ 1 callers
Method
update_document_embedding
Update the embedding for a document. Args: doc_id: Document ID embedding: Embedding vector
chapter3/dense-embedding/document_store.py:174
↓ 1 callers
Method
update_file_content
Update a specific line in file. Args: file_path: File path line_number: Line number to update (1-ind
chapter4/execution-tools/terminal_controller.py:418
↓ 1 callers
Method
update_workflow_metrics
Update performance metrics for a workflow after execution. Args: workflow_id: ID of the workflow that was execut
chapter8/browser-use-rpa/learning_agent/knowledge_base.py:220
↓ 1 callers
Method
validate
Validate the configuration.
chapter4/execution-tools/config.py:69
↓ 1 callers
Method
validate
Validate the test case structure.
chapter3/user-memory-evaluation/models.py:54
↓ 1 callers
Method
validate
Validate required configuration Args: provider: Provider to validate (defaults to configured provider)
chapter3/user-memory/config.py:98
↓ 1 callers
Method
validate_rounds
Validate that the conversation has at least the minimum required rounds.
chapter3/user-memory-evaluation/models.py:38
↓ 1 callers
Method
verify_indexing
Verify that indexing worked by performing test searches
chapter3/agentic-rag/index_local_laws.py:407
↓ 1 callers
Method
view_results
View evaluation results.
chapter3/user-memory-evaluation/main.py:173
↓ 1 callers
Method
view_results
View evaluation results
chapter3/agentic-rag-for-user-memory/main.py:424
↓ 1 callers
Method
view_test_case
View details of a specific test case.
chapter3/user-memory-evaluation/main.py:66
↓ 1 callers
Method
view_test_cases
View loaded test cases
chapter3/agentic-rag-for-user-memory/main.py:134
↓ 1 callers
Function
view_trajectory
View trajectory file with formatted output
chapter2/system-hint/view_trajectory.py:20
↓ 1 callers
Function
visualize_results
Generate visualizations from saved results Args: results_path: Path to JSON results file output_dir: Directory to save v
chapter2/attention_visualization/visualization.py:322
↓ 1 callers
Method
visualize_results
Create visualizations of ablation study results Args: results: List of test results
chapter1/context/main.py:269
↓ 1 callers
Function
wait_for_server
Wait for server to be ready
chapter3/sparse-embedding/demo.py:22
↓ 1 callers
Function
watch_llm_agent
Watch an LLM agent play with reasoning.
chapter1/learning-from-experience/demo.py:114
↓ 1 callers
Function
watch_rl_agent
Watch a trained RL agent play.
chapter1/learning-from-experience/demo.py:58
↓ 1 callers
Function
wrapper
(*args: Any, **kwargs: Any)
chapter2/prompt-engineering/tau_bench/model_utils/api/cache.py:58
Function
App
({ Component, pageProps }: AppProps)
chapter2/attention_visualization/frontend/pages/_app.tsx:4
Function
App
({ Component, pageProps }: AppProps)
chapter9/live-audio/frontend/pages/_app.tsx:4
Function
AttentionHeatmap
({ tokens, attentionWeights }: AttentionHeatmapProps)
chapter2/attention_visualization/frontend/components/AttentionHeatmap.tsx:9
Function
AttentionModal
({ isOpen, onClose, tokens, attentionWeights }: AttentionModalProps)
chapter2/attention_visualization/frontend/components/AttentionModal.tsx:11
Function
AttentionPreview
({ tokens, attentionWeights, onClick }: AttentionPreviewProps)
chapter2/attention_visualization/frontend/components/AttentionPreview.tsx:10
Function
AttentionStats
({ attentionData }: AttentionStatsProps)
chapter2/attention_visualization/frontend/components/AttentionStats.tsx:13
Function
CodeBlock
({ node, inline, className, children, ...props })
chapter9/live-audio/frontend/pages/index.tsx:28
Function
Home
()
chapter2/attention_visualization/frontend/pages/index.tsx:56
Function
Home
()
chapter9/live-audio/frontend/pages/index.tsx:65
Function
PromptDisplay
({ prompt, tokens, tokenCount }: PromptDisplayProps)
chapter2/attention_visualization/frontend/components/PromptDisplay.tsx:9
Function
ResponseDisplay
({ response, tokens }: ResponseDisplayProps)
chapter2/attention_visualization/frontend/components/ResponseDisplay.tsx:8
Function
TabButton
({ active, onClick, children })
chapter9/live-audio/frontend/pages/index.tsx:52
Function
TestCaseSelector
({ testCases, selectedIndex, onSelect }: TestCaseSelectorProps)
chapter2/attention_visualization/frontend/components/TestCaseSelector.tsx:16
Method
__call__
Called during generation to track tokens
chapter2/attention_visualization/agent.py:102
Method
__call__
(self, chunk_size: int)
chapter3/retrieval-pipeline/reranker.py:60
Method
__del__
Cleanup when agent is destroyed
chapter4/agent-with-event-trigger/agent.py:1199
Method
__init__
(self, width, height)
book/svg_lib.py:71
Method
__init__
Initialize the Orpheus TTS inference engine. Args: model_path: HuggingFace model path or local path
chapter7/orpheus/inference.py:39
Method
__init__
Initialize coding agent Args: api_key: API key for the provider model: Model identifier
chapter5/coding-agent/agent.py:21
Method
__init__
(self)
chapter5/coding-agent/tool_registry.py:18
Method
__init__
(self, use_colors: bool = True)
chapter5/coding-agent/main.py:44
Method
__init__
Initialize coding agent Args: api_key: API key for Anthropic/OpenRouter model: Model identifier
chapter5/coding-agent/agent_new.py:20
Method
__init__
(self, system_state: 'SystemState')
chapter5/coding-agent/tools/base.py:32
Method
__init__
(self, llm_model="gpt-4o-mini")
chapter8/browser-use-rpa/demo_email.py:29
Method
__init__
(self)
chapter8/browser-use-rpa/test_validation.py:37
Method
__init__
Initialize the learning agent. Args: task: The task to be performed llm: Language model to use (brow
chapter8/browser-use-rpa/learning_agent/agent.py:42
Method
__init__
Initialize the workflow replayer. Args: headless: Whether to run browser in headless mode
chapter8/browser-use-rpa/learning_agent/replay.py:31
Method
__init__
Initialize the knowledge base. Args: storage_path: Directory path for storing workflow data
chapter8/browser-use-rpa/learning_agent/knowledge_base.py:41
Method
__init__
Initialize the trajectory summarizer. Args: llm_config: LLM configuration model_name: Model to use f
chapter8/gaia-experience/trajectory_summarizer.py:21
Method
__init__
Initialize the Experience Agent. Args: conf: Agent configuration name: Agent name system
chapter8/gaia-experience/experience_agent.py:26
Method
__init__
Initialize the knowledge base. Args: index_path: Path to store the index files model_name: Name of t
chapter8/gaia-experience/knowledge_base.py:23
Method
__init__
Initialize demo with configuration.
chapter8/gaia-experience/demo.py:36
Method
__init__
(self)
chapter8/gaia-experience/demo.py:174
Method
__init__
Initialize Elo rating system. Args: initial_rating: Starting rating for all models k_factor: Learnin
chapter6/elo-leaderboard/elo_rating.py:17
Method
__init__
Initialize NumPy-based Elo system.
chapter6/elo-leaderboard/optimized_elo.py:106
Method
__init__
Initialize the ablation agent Args: tools_info: Information about available tools wiki: Wiki/system
chapter2/prompt-engineering/ablation_agent.py:22
Method
__init__
( self, model: str | None = None, api_key: str | None = None, temperature: flo
chapter2/prompt-engineering/tau_bench/model_utils/model/claude.py:36
Method
__init__
( self, model: str, base_url: str, endpoint: str = "generate", tempera
chapter2/prompt-engineering/tau_bench/model_utils/model/vllm_completion.py:59
Method
__init__
( self, model: str | None = None, api_key: str | None = None, temperature: float = 0.0 )
chapter2/prompt-engineering/tau_bench/model_utils/model/mistral.py:33
Method
__init__
( self, model: str | None = None, api_key: str | None = None, temperature: flo
chapter2/prompt-engineering/tau_bench/model_utils/model/openai.py:65
Method
__init__
( self, short_message: str, prompt: str | list[dict[str, str]] | None = None,
chapter2/prompt-engineering/tau_bench/model_utils/model/exception.py:8
Method
__init__
( self, model: str, api_key: str | None = None, temperature: float = 0.0,
chapter2/prompt-engineering/tau_bench/model_utils/model/anyscale.py:34
Method
__init__
( self, model: str, base_url: str, api_key: str, temperature: float =
chapter2/prompt-engineering/tau_bench/model_utils/model/vllm_chat.py:51
Method
__init__
( self, parse_models: list[ParseModel], generate_models: list[GenerateModel],
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:45
Method
__init__
(self, n: int = 2)
chapter2/prompt-engineering/tau_bench/model_utils/api/sample.py:47
Method
__init__
(self, max_retries: int = 5)
chapter2/prompt-engineering/tau_bench/model_utils/api/sample.py:63
Method
__init__
( self, n: int = 5, max_concurrency: int | None = None, panic_on_first_model_e
chapter2/prompt-engineering/tau_bench/model_utils/api/sample.py:82
← previous
next →
1,701–1,800 of 2,925, ranked by callers