MCPcopy Create free account

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

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

↓ 1 callersMethodbuild_system_prompt
(self, instruction: Optional[str])
chapter2/prompt-engineering/tau_bench/envs/user.py:93
↓ 1 callersMethodbuild_tree_level
Build one level of the tree by clustering and summarizing nodes.
chapter3/structured-index/raptor_indexer.py:112
↓ 1 callersMethodcalculate
Evaluate a mathematical expression Args: expression: Mathematical expression to evaluate Re
chapter1/context/agent.py:178
↓ 1 callersFunctioncalculateStats
()
chapter2/attention_visualization/frontend/components/AttentionStats.tsx:15
↓ 1 callersFunctioncalculate_expected_scores_vectorized
Vectorized calculation of expected scores for multiple matches. Args: ratings_a: Array of ratings for model A ratings_b:
chapter6/elo-leaderboard/optimized_elo.py:80
↓ 1 callersMethodcalculate_reward
(self)
chapter2/prompt-engineering/tau_bench/envs/base.py:124
↓ 1 callersMethodcalculate_term_score
Calculate BM25 score for a single term in a document
chapter3/sparse-embedding/bm25_engine.py:270
↓ 1 callersMethodcall_tool
Call an MCP tool by spawning a fresh server connection Args: tool_key: Tool key in format "server.tool_name"
chapter4/agent-with-event-trigger/agent.py:152
↓ 1 callersFunctioncheck_api_key
检查 API Key 配置
chapter1/web-search-agent/quickstart.py:41
↓ 1 callersFunctioncheck_dependencies
Check if all dependencies are available
chapter3/agentic-rag-for-user-memory/test_llm_evaluation.py:128
↓ 1 callersFunctioncheck_dependencies
Check if all dependencies are available
chapter3/contextual-retrieval-for-user-memory/test_llm_evaluation.py:128
↓ 1 callersFunctioncheck_environment
Check if the environment is properly set up
chapter2/prompt-engineering/test_ablation.py:222
↓ 1 callersFunctioncheck_environment
Check if environment is properly configured
chapter2/context-compression/quickstart.py:13
↓ 1 callersFunctioncheck_environment
Check if required environment variables are set
chapter3/agentic-rag-for-user-memory/quickstart.py:17
↓ 1 callersFunctioncheck_environment
Check if environment is properly configured
chapter3/agentic-rag/quickstart.py:10
↓ 1 callersFunctioncheck_environment
Check if required environment variables are set
chapter3/contextual-retrieval-for-user-memory/quickstart.py:17
↓ 1 callersFunctioncheck_retrieval_pipeline
Check if local retrieval pipeline is running
chapter3/agentic-rag/quickstart.py:71
↓ 1 callersFunctioncheck_system
Check system compatibility
chapter2/local_llm_serving/check_compatibility.py:12
↓ 1 callersMethodchoose_action
Choose an action using LLM reasoning with in-context learning.
chapter1/learning-from-experience/llm_agent.py:142
↓ 1 callersMethodchoose_action
Choose action (simplified for demonstration).
chapter1/learning-from-experience/rl_agent.py:351
↓ 1 callersMethodchunk_document_smart
Smart chunking that respects paragraph boundaries with soft and hard limits. Strategy: - Accumulate paragraphs until
chapter3/agentic-rag/index_local_laws.py:139
↓ 1 callersMethodchunk_text
Split text into chunks with overlap.
chapter3/structured-index/raptor_indexer.py:54
↓ 1 callersMethodchunk_text
Split text into chunks with overlap.
chapter3/structured-index/graphrag_indexer.py:78
↓ 1 callersMethodclassify
( self, instruction: str, text: str, options: list[str], examples: lis
chapter2/prompt-engineering/tau_bench/model_utils/model/general_model.py:43
↓ 1 callersFunctionclean_top_level_keys
(d: dict[str, Any])
chapter2/prompt-engineering/tau_bench/model_utils/model/utils.py:69
↓ 1 callersMethodcleanupTempFiles
* Clean up old temporary files
chapter9/live-audio/backend/utils/speechToText.js:81
↓ 1 callersMethodcleanup_existing_index
Clean up existing indexes and document store
chapter3/contextual-retrieval/index_local_laws_contextual.py:80
↓ 1 callersMethodcleanup_existing_index
Clean up existing indexes and document store
chapter3/agentic-rag/index_local_laws.py:66
↓ 1 callersMethodcleanup_test_data
Clean up test knowledge base.
chapter8/browser-use-rpa/test_validation.py:69
↓ 1 callersMethodclear_cache
Clear the page cache
chapter2/context-compression/web_tools.py:294
↓ 1 callersFunctionclear_index
Clear the index before demo
chapter3/sparse-embedding/demo.py:37
↓ 1 callersFunctionclose_browser
Close browser session.
chapter4/collaboration-tools/src/browser_tools.py:54
↓ 1 callersMethodcluster_nodes
Cluster embeddings using Gaussian Mixture Model.
chapter3/structured-index/raptor_indexer.py:91
↓ 1 callersMethodcode_interpreter
Execute Python code for complex calculations and data processing Args: code: Python code to execute
chapter1/context/agent.py:214
↓ 1 callersFunctioncollectStreamingResponse
* Collect streaming response data
chapter9/live-audio/backend/tests/test-llm-providers.js:60
↓ 1 callersMethodcomparative_search
比较搜索 - 搜索并比较多个项目 Args: items: 要比较的项目列表 aspect: 比较的方面 Returns: 比较结果
chapter1/web-search-agent/examples.py:71
↓ 1 callersFunctioncompare_backends
Compare results from different backends for the same query
chapter3/agentic-rag/test_structured_backends.py:89
↓ 1 callersFunctioncompare_extraction_modes
Compare different extraction modes for the same content
chapter3/multimodal-agent/demo.py:14
↓ 1 callersFunctioncompare_implementations
Compare different KV cache implementations Args: api_key: API key for Kimi task: Task to execute root_dir: Root
chapter2/kv-cache/agent.py:788
↓ 1 callersMethodcompare_learning_curves
Create visualization comparing learning curves of both methods.
chapter1/learning-from-experience/experiment.py:204
↓ 1 callersFunctioncompare_models
Compare different models for the same task
chapter3/multimodal-agent/demo.py:121
↓ 1 callersMethodcompare_modes
Compare agentic vs non-agentic performance
chapter3/contextual-retrieval/evaluation/evaluate.py:257
↓ 1 callersMethodcompare_modes
Compare agentic vs non-agentic performance
chapter3/agentic-rag/evaluation/evaluate.py:257
↓ 1 callersFunctioncompare_on_prompt
Compare three models on the same prompt
chapter7/continued-pretraining/compare_models.py:67
↓ 1 callersMethodcompare_retrieval_methods
Compare contextual vs non-contextual retrieval
chapter3/contextual-retrieval/index_local_laws_contextual.py:472
↓ 1 callersFunctioncompare_streaming_vs_regular
Compare streaming vs regular responses
chapter2/local_llm_serving/test_streaming.py:110
↓ 1 callersMethodcompress_for_history
Compress content for message history (used in windowed context strategy) Args: content: Content to compress
chapter2/context-compression/compression_strategies.py:110
↓ 1 callersMethodcompress_search_results
Compress search results based on the selected strategy Args: search_results: Raw search results from web tool
chapter2/context-compression/compression_strategies.py:77
↓ 1 callersMethodcompute_aggregate_metrics
Compute aggregate metrics from results
chapter3/contextual-retrieval/evaluation/evaluate.py:198
↓ 1 callersMethodcompute_aggregate_metrics
Compute aggregate metrics from results
chapter3/agentic-rag/evaluation/evaluate.py:198
↓ 1 callersFunctioncompute_bradley_terry_leaderboard
Compute leaderboard using Bradley-Terry model (official Chatbot Arena method). Args: df: DataFrame with columns 'model_a', 'mode
chapter6/elo-leaderboard/bradley_terry.py:176
↓ 1 callersFunctioncompute_mle_elo
Compute Elo ratings using Bradley-Terry model with Maximum Likelihood Estimation. This is the official method used by Chatbot Arena for
chapter6/elo-leaderboard/bradley_terry.py:12
↓ 1 callersFunctioncompute_online_elo_leaderboard
Compute leaderboard using online Elo updates (K=4, official value). This method updates ratings sequentially as matches are processed.
chapter6/elo-leaderboard/main.py:29
↓ 1 callersMethodconfigure_settings
Configure RAG and evaluation settings
chapter3/agentic-rag-for-user-memory/main.py:199
↓ 1 callersMethodconfigure_settings
Configure system settings
chapter3/contextual-retrieval-for-user-memory/main.py:699
↓ 1 callersMethodconnect_server
Connect to an MCP server with proper error isolation NOTE: This stores tool metadata only. For actual tool execution,
chapter4/agent-with-event-trigger/agent.py:95
↓ 1 callersFunctionconsistent_hash
( value: Hashable, )
chapter2/prompt-engineering/tau_bench/envs/base.py:38
↓ 1 callersMethodcontextualize_chunks
Add contextual information to conversation chunks. Args: chunks: List of basic conversation chunks f
chapter3/contextual-retrieval-for-user-memory/contextual_chunking.py:152
↓ 1 callersFunctionconvertGroup
(n)
chapter9/live-audio/backend/utils/textProcessor.js:47
↓ 1 callersMethodconvert_currency
Convert currency using live exchange rates Args: amount: Amount to convert from_currency: Source cur
chapter1/context/agent.py:120
↓ 1 callersMethodcount_tokens
Estimate token count (rough approximation)
chapter2/log-sanitization/agent.py:54
↓ 1 callersFunctioncreateTestAudioBuffer
* Create a test audio buffer with spoken content * This creates a simple sine wave that simulates audio content
chapter9/live-audio/backend/tests/test-asr-providers.js:33
↓ 1 callersFunctioncreateTestAudioBuffer
* Create a sample audio buffer for testing * This creates a simple sine wave audio buffer
chapter9/live-audio/backend/tests/provider-tests.js:67
↓ 1 callersFunctioncreate_attention_flow_diagram
Create a flow diagram showing attention evolution over generation steps Args: attention_steps: List of attention step dictionari
chapter2/attention_visualization/visualization.py:101
↓ 1 callersFunctioncreate_attention_heatmap
Create a heatmap visualization of attention weights Args: attention_weights: 2D list of attention weights [output_len x total_le
chapter2/attention_visualization/visualization.py:15
↓ 1 callersFunctioncreate_demo_conversation
Create a demo conversation with important information
chapter3/agentic-rag-for-user-memory/demo_agent_logging.py:25
↓ 1 callersFunctioncreate_demo_conversation
Create a demo conversation with important information
chapter3/contextual-retrieval-for-user-memory/demo_agent_logging.py:25
↓ 1 callersFunctioncreate_excel_screenshot
Create a screenshot of Excel file (requires GUI environment). Note: This is a simplified implementation that exports to image. Args:
chapter4/collaboration-tools/src/excel_tools.py:272
↓ 1 callersFunctioncreate_financial_report
Create a sample financial report PDF for testing
chapter1/context/create_sample_pdf.py:15
↓ 1 callersMethodcreate_initial_messages
Create initial messages with proper format for Qwen3
chapter2/attention_visualization/main.py:53
↓ 1 callersMethodcreate_multinational_budget_task
Create a task requiring multiple currency conversions and calculations Returns: Task description
chapter1/context/main.py:67
↓ 1 callersFunctioncreate_sample_files
Create sample files for testing
chapter3/multimodal-agent/quickstart.py:15
↓ 1 callersFunctioncreate_sample_intel_doc
Create a sample Intel architecture documentation for testing.
chapter3/structured-index/download_sample.py:11
↓ 1 callersFunctioncreate_sample_queries
Create sample queries for testing.
chapter3/structured-index/download_sample.py:229
↓ 1 callersFunctioncreate_simple_expense_report
Create a simpler expense report for quick testing
chapter1/context/create_sample_pdf.py:217
↓ 1 callersFunctioncreate_token_attention_summary
Create a summary visualization showing tokens and their attention patterns Args: result: Generation result dictionary sa
chapter2/attention_visualization/visualization.py:193
↓ 1 callersFunctioncreate_visualization_data
Create data for visualization (can be used with plotting libraries)
chapter2/prompt-engineering/analyze_results.py:271
↓ 1 callersFunctiondatapoint_factory
(d: dict[str, Any])
chapter2/prompt-engineering/tau_bench/model_utils/api/datapoint.py:223
↓ 1 callersFunctiondefault_model
()
chapter2/prompt-engineering/tau_bench/model_utils/model/general_model.py:127
↓ 1 callersFunctiondefault_quick_model
()
chapter2/prompt-engineering/tau_bench/model_utils/model/general_model.py:133
↓ 1 callersFunctiondefault_request_router
()
chapter2/prompt-engineering/tau_bench/model_utils/api/router.py:86
↓ 1 callersMethoddelete_card
Delete a memory card. Args: category: Card category card_key: Card key Returns:
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:210
↓ 1 callersMethoddelete_document
Delete a document from the store.
chapter3/retrieval-pipeline/document_store.py:49
↓ 1 callersMethoddelete_document
Delete a document.
chapter3/dense-embedding/test_client.py:40
↓ 1 callersMethoddelete_document
Delete a document from the store. Args: doc_id: Document ID Returns: True if delete
chapter3/dense-embedding/document_store.py:97
↓ 1 callersMethoddelete_file_content
Delete lines from file. Args: file_path: File path start_line: Start line number (1-indexed, inclusi
chapter4/execution-tools/terminal_controller.py:357
↓ 1 callersFunctiondemo
Interactive demo with proper tool calling
chapter2/local_llm_serving/ollama_native.py:496
↓ 1 callersFunctiondemo_basic_elo
Demonstrate basic Elo rating calculation with synthetic data.
chapter6/elo-leaderboard/quickstart.py:7
↓ 1 callersFunctiondemo_basic_features
Demonstrate basic system hint features
chapter2/system-hint/main.py:213
↓ 1 callersFunctiondemo_category_evaluation
Demonstrate the improved category evaluation selection
chapter3/agentic-rag-for-user-memory/demo_ui_improvements.py:93
↓ 1 callersFunctiondemo_category_evaluation
Demonstrate the improved category evaluation selection
chapter3/contextual-retrieval-for-user-memory/demo_ui_improvements.py:93
↓ 1 callersFunctiondemo_code_interpreter
Demonstrate code generation and analysis capability
chapter1/search-codegen/quickstart.py:37
↓ 1 callersFunctiondemo_combined_tools
Demonstrate using both tools together
chapter1/search-codegen/quickstart.py:66
↓ 1 callersFunctiondemo_comparison
Compare with and without system hints
chapter2/system-hint/main.py:286
↓ 1 callersMethoddemo_comparison
Run a side-by-side comparison
chapter3/contextual-retrieval/demo.py:172
↓ 1 callersFunctiondemo_conversation_with_tools
Demonstrate a conversation with multimodal tools
chapter3/multimodal-agent/demo.py:182
↓ 1 callersFunctiondemo_memory_system
Demonstrate the separated memory system architecture
chapter3/user-memory/main.py:258
↓ 1 callersFunctiondemo_mode
Run a quick demo with sample PII-containing text
chapter2/log-sanitization/main.py:88
↓ 1 callersFunctiondemo_ollama_streaming
Demo streaming with Ollama backend
chapter2/local_llm_serving/demo_streaming.py:59
↓ 1 callersMethoddemo_problem
Demonstrate the context loss problem
chapter3/contextual-retrieval/demo.py:89
← previousnext →901–1,000 of 2,925, ranked by callers