MCPcopy Create free account

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

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

Method__init__
( self, max_concurrency: int | None = None, panic_on_first_model_error: bool = False )
chapter2/prompt-engineering/tau_bench/model_utils/api/sample.py:144
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:174
Method__init__
(self, short_message: str, report: dict[str, Any] | None = None)
chapter2/prompt-engineering/tau_bench/model_utils/api/exception.py:35
Method__init__
(self, model: Model | None = None)
chapter2/prompt-engineering/tau_bench/model_utils/api/router.py:30
Method__init__
(self, capability_score_model: CapabilityScoreModel)
chapter2/prompt-engineering/tau_bench/model_utils/api/router.py:52
Method__init__
(self, model: str, provider: str)
chapter2/prompt-engineering/tau_bench/envs/user.py:89
Method__init__
(self, model: str, provider: str, max_attempts: int = 3)
chapter2/prompt-engineering/tau_bench/envs/user.py:157
Method__init__
(self, model: str, provider: str, max_attempts: int = 2)
chapter2/prompt-engineering/tau_bench/envs/user.py:271
Method__init__
( self, data_load_func: Callable[[], Dict[str, Any]], tools: List[Type[Tool]],
chapter2/prompt-engineering/tau_bench/envs/base.py:45
Method__init__
( self, user_strategy: Union[str, UserStrategy] = UserStrategy.LLM, user_model: str =
chapter2/prompt-engineering/tau_bench/envs/retail/env.py:13
Method__init__
( self, user_strategy: Union[str, UserStrategy] = UserStrategy.LLM, user_model: str =
chapter2/prompt-engineering/tau_bench/envs/airline/env.py:13
Method__init__
( self, tools_info: List[Dict[str, Any]], wiki: str, model: str, provi
chapter2/prompt-engineering/tau_bench/agents/tool_calling_agent.py:13
Method__init__
( self, tools_info: List[Dict[str, Any]], wiki: str, model: str, provi
chapter2/prompt-engineering/tau_bench/agents/chat_react_agent.py:18
Method__init__
( self, tools_info: List[Dict[str, Any]], wiki: str, model: str, provi
chapter2/prompt-engineering/tau_bench/agents/few_shot_agent.py:14
Method__init__
(self, root_dir: str = ".")
chapter2/kv-cache/agent.py:64
Method__init__
Initialize the agent Args: api_key: API key for Moonshot/Kimi mode: KV cache optimization mode
chapter2/kv-cache/agent.py:323
Method__init__
Initialize the sanitization agent
chapter2/log-sanitization/agent.py:26
Method__init__
(self, output_dir: Path)
chapter2/log-sanitization/metrics.py:50
Method__init__
(self)
chapter2/log-sanitization/test_loader.py:15
Method__init__
Initialize the context compressor Args: strategy: Compression strategy to use api_key: API key for L
chapter2/context-compression/compression_strategies.py:44
Method__init__
Initialize the research agent Args: api_key: API key for Moonshot/Kimi compression_strategy: Strateg
chapter2/context-compression/agent.py:54
Method__init__
Initialize the strategy runner Args: log_dir: Directory to save log files
chapter2/context-compression/run_all_strategies.py:25
Method__init__
(self, logger, original_stdout)
chapter2/context-compression/run_all_strategies.py:119
Method__init__
Initialize the experiment runner Args: api_key: API key for Kimi/Moonshot
chapter2/context-compression/experiment.py:27
Method__init__
Initialize web tools
chapter2/context-compression/web_tools.py:23
Method__init__
(self, tokenizer, context_length: int, verbose: bool = False)
chapter2/attention_visualization/agent.py:87
Method__init__
Initialize the agent with Qwen3 model Args: model_name: Hugging Face model name device: Device to ru
chapter2/attention_visualization/agent.py:158
Method__init__
(self)
chapter2/attention_visualization/tools.py:18
Method__init__
(self, *args, **kwargs)
chapter2/attention_visualization/main.py:47
Method__init__
Initialize with a model that supports tool calling
chapter2/local_llm_serving/ollama_native.py:19
Method__init__
Initialize using Ollama's OpenAI-compatible API This provides better compatibility with tool calling
chapter2/local_llm_serving/ollama_native.py:324
Method__init__
Initialize the agent with vLLM server connection Args: api_base: Base URL for vLLM server api_key: A
chapter2/local_llm_serving/agent.py:22
Method__init__
(self)
chapter2/local_llm_serving/tools.py:19
Method__init__
Initialize server manager with configuration
chapter2/local_llm_serving/server.py:21
Method__init__
Initialize with automatic backend detection Args: backend: Force a specific backend ('vllm', 'ollama', or None f
chapter2/local_llm_serving/main.py:29
Method__init__
Initialize the agent Args: api_key: API key for the LLM provider provider: LLM provider ('kimi' for
chapter2/system-hint/agent.py:78
Method__init__
Initialize LLM agent with Kimi K2 API. Args: api_key: Kimi API key (or set MOONSHOT_API_KEY env var)
chapter1/learning-from-experience/llm_agent.py:31
Method__init__
Initialize experiment runner.
chapter1/learning-from-experience/experiment.py:27
Method__init__
Initialize Q-learning agent. Args: learning_rate: Alpha parameter for Q-value updates discount_facto
chapter1/learning-from-experience/rl_agent.py:20
Method__init__
Initialize DQN agent with neural network. Note: Simplified implementation for demonstration.
chapter1/learning-from-experience/rl_agent.py:313
Method__init__
Initialize the agent Args: api_key: API key for the LLM provider context_mode: Context mode for abla
chapter1/context/agent.py:311
Method__init__
Initialize test suite Args: api_key: API key for the LLM provider provider: LLM provider to use
chapter1/context/main.py:34
Method__init__
初始化 Agent Args: api_key: Kimi API key (如果不提供,从环境变量获取) base_url: API 基础 URL
chapter1/web-search-agent/agent.py:41
Method__init__
Initialize the GPT-5 agent with OpenRouter API Args: api_key: OpenRouter API key base_url: OpenRoute
chapter1/search-codegen/agent.py:48
Method__init__
Initialize the agent chain Args: agent: GPT5NativeAgent instance
chapter1/search-codegen/agent.py:337
Method__init__
Initialize test suite
chapter1/search-codegen/test_agent.py:24
Method__init__
Initialize the CLI
chapter1/search-codegen/main.py:25
Method__init__
(self)
chapter4/collaboration-tools/client_example.py:17
Method__init__
(self)
chapter4/perception-tools/src/pubchem_tools.py:50
Method__init__
Initialize execution tools with LLM helper.
chapter4/execution-tools/execution_tools.py:17
Method__init__
Initialize executor.
chapter4/execution-tools/multilang_executor.py:75
Method__init__
Initialize external tools with LLM helper.
chapter4/execution-tools/external_tools.py:33
Method__init__
Initialize the LLM client based on configuration.
chapter4/execution-tools/llm_helper.py:12
Method__init__
(self)
chapter4/execution-tools/terminal_controller.py:18
Method__init__
Initialize file tools with LLM helper.
chapter4/execution-tools/file_tools.py:13
Method__init__
(self)
chapter4/execution-tools/filesystem_enhanced.py:18
Method__init__
Initialize the client Args: server_url: URL of the event server
chapter4/agent-with-event-trigger/client.py:16
Method__init__
(self)
chapter4/agent-with-event-trigger/agent.py:90
Method__init__
Initialize the event-triggered agent Args: api_key: API key for the LLM provider provider: LLM provi
chapter4/agent-with-event-trigger/agent.py:213
Method__init__
Initialize the evaluator with specified LLM.
chapter3/user-memory-evaluation/evaluator.py:14
Method__init__
Initialize the batch evaluator.
chapter3/user-memory-evaluation/evaluator.py:242
Method__init__
Initialize the framework. Args: test_cases_dir: Directory containing test case YAML files
chapter3/user-memory-evaluation/framework.py:26
Method__init__
(self, framework: UserMemoryEvaluationFramework)
chapter3/user-memory-evaluation/main.py:20
Method__init__
Initialize the indexer Args: config: Index configuration
chapter3/agentic-rag-for-user-memory/indexer.py:46
Method__init__
Initialize the evaluator Args: config: Configuration object
chapter3/agentic-rag-for-user-memory/evaluator.py:122
Method__init__
Initialize the agent Args: indexer: The memory indexer with loaded conversations config: Configurati
chapter3/agentic-rag-for-user-memory/agent.py:61
Method__init__
Initialize memory tools Args: indexer: The memory indexer instance
chapter3/agentic-rag-for-user-memory/tools.py:36
Method__init__
Initialize the chunker Args: config: Chunking configuration
chapter3/agentic-rag-for-user-memory/chunker.py:93
Method__init__
Initialize the interactive evaluator
chapter3/agentic-rag-for-user-memory/main.py:41
Method__init__
(self, config: RaptorConfig)
chapter3/structured-index/raptor_indexer.py:40
Method__init__
(self)
chapter3/structured-index/document_processor.py:21
Method__init__
(self, config: GraphRAGConfig)
chapter3/structured-index/graphrag_indexer.py:61
Method__init__
Initialize LOCOMO benchmark Args: dataset_path: Path to LOCOMO dataset
chapter3/user-memory/locomo_benchmark.py:40
Method__init__
Initialize the background memory processor Args: user_id: Unique user identifier api_key: API key (d
chapter3/user-memory/background_memory_processor.py:51
Method__init__
(self, user_id: str, verbose: bool = False)
chapter3/user-memory/memory_manager.py:114
Method__init__
(self, user_id: str, verbose: bool = False)
chapter3/user-memory/memory_manager.py:260
Method__init__
(self, user_id: str, verbose: bool = False)
chapter3/user-memory/memory_manager.py:438
Method__init__
Initialize the agent Args: user_id: Unique user identifier api_key: API key (defaults to env based o
chapter3/user-memory/agent.py:51
Method__init__
Initialize conversation history manager Args: user_id: User identifier
chapter3/user-memory/conversation_history.py:39
Method__init__
Initialize Dify client
chapter3/user-memory/conversation_history.py:170
Method__init__
Initialize simple embedding search
chapter3/user-memory/conversation_history.py:305
Method__init__
Initialize the conversational agent Args: user_id: Unique user identifier api_key: API key (defaults
chapter3/user-memory/conversational_agent.py:38
Method__init__
(self, config: Optional[PipelineConfig] = None)
chapter3/retrieval-pipeline/retrieval_pipeline.py:19
Method__init__
(self, base_url: str = "http://localhost:4242")
chapter3/retrieval-pipeline/test_client.py:16
Method__init__
(self)
chapter3/retrieval-pipeline/document_store.py:13
Method__init__
(self, dense_url: str, sparse_url: str, timeout: float = 30.0)
chapter3/retrieval-pipeline/retrieval_client.py:25
Method__init__
(self)
chapter3/retrieval-pipeline/reranker.py:55
Method__init__
Initialize the reranker. Args: model_name: HuggingFace model name device: Device to use (mps for Mac, cuda fo
chapter3/retrieval-pipeline/reranker.py:80
Method__init__
(self, pipeline_url: str = "http://localhost:4242")
chapter3/retrieval-pipeline/demo.py:17
Method__init__
(self, laws_dir: Path = LAWS_DIR, pipeline_url: str = RETRIEVAL_PIPELINE_U
chapter3/contextual-retrieval/index_local_laws_contextual.py:47
Method__init__
Initialize the contextual chunker. Args: chunking_config: Configuration for chunking parameters llm_
chapter3/contextual-retrieval/contextual_chunking.py:65
Method__init__
(self, config: Optional[ChunkingConfig] = None)
chapter3/contextual-retrieval/chunking.py:21
Method__init__
(self, kb_config: Optional[KnowledgeBaseConfig] = None, chunking_config: Op
chapter3/contextual-retrieval/chunking.py:153
Method__init__
Initialize the agent
chapter3/contextual-retrieval/agent.py:31
Method__init__
Initialize contextual agent. Args: config: Configuration object kb_tools: Contextual knowledge base
chapter3/contextual-retrieval/contextual_agent.py:29
Method__init__
(self, config: KnowledgeBaseConfig)
chapter3/contextual-retrieval/tools.py:36
Method__init__
Initialize contextual knowledge base tools. Args: config: Knowledge base configuration use_contextua
chapter3/contextual-retrieval/contextual_tools.py:60
Method__init__
(self)
chapter3/contextual-retrieval/demo.py:46
Method__init__
(self)
chapter3/contextual-retrieval/evaluation/dataset_builder.py:16
Method__init__
(self, config: Optional[Config] = None)
chapter3/contextual-retrieval/evaluation/evaluate.py:23
← previousnext →1,801–1,900 of 2,925, ranked by callers