diff --git a/requirements.in b/requirements.in index 1749df83c..f8803b682 100644 --- a/requirements.in +++ b/requirements.in @@ -77,8 +77,8 @@ pympler~=1.1 smbprotocol~=1.16.1 setproctitle~=1.3.7 httpx[socks,http2]~=0.28.1 -langchain~=1.3.9 -langchain-core~=1.4.7 +langchain~=1.3.15 +langchain-core~=1.5.4 langchain-community~=0.4.2 langchain-anthropic~=1.4.6 langchain-aws~=1.6.2 @@ -86,7 +86,8 @@ boto3~=1.42.42 langchain-openai~=1.3.2 langchain-google-genai~=4.2.5 langchain-deepseek~=1.1.0 -langgraph~=1.2.5 +langgraph~=1.2.11 +langgraph-checkpoint~=4.2.0 anthropic~=0.109.1 openai~=2.41.1 google-genai~=2.8.0 diff --git a/tests/test_agent_tool_policy.py b/tests/test_agent_tool_policy.py index 8882b38ee..15c0930e7 100644 --- a/tests/test_agent_tool_policy.py +++ b/tests/test_agent_tool_policy.py @@ -42,6 +42,18 @@ class _EchoInput(BaseModel): query: str = Field(description="待回显文本") +class _AgentFactoryLLM: + """满足 Agent 构建与摘要中间件所需合同的测试模型。""" + + _llm_type = "openai-chat" + model = "fake" + profile = {"max_input_tokens": 64000} + + def with_retry(self): + """返回可供摘要中间件调用的 Runnable。""" + return self + + class _EchoTool(MoviePilotTool): """返回输入文本的测试工具。""" @@ -769,11 +781,7 @@ def test_agent_middleware_secret_setting_result_stays_out_of_receipt_logs() -> N def test_main_agent_registers_policy_middleware_as_outermost() -> None: """主 Agent 必须把宿主策略中间件放在 middleware 链最外层。""" agent = agent_module.MoviePilotAgent(session_id="session-1", user_id="user-1") - fake_llm = SimpleNamespace( - _llm_type="openai-chat", - model="fake", - profile={"max_input_tokens": 64000}, - ) + fake_llm = _AgentFactoryLLM() captured = {} def _fake_create_agent(**kwargs): @@ -801,11 +809,7 @@ def test_main_agent_preserves_activity_log_middleware_order() -> None: channel=MessageChannel.WebAgent.value, source="web-agent", ) - fake_llm = SimpleNamespace( - _llm_type="openai-chat", - model="fake", - profile={"max_input_tokens": 64000}, - ) + fake_llm = _AgentFactoryLLM() captured = {} def _fake_create_agent(**kwargs): diff --git a/tests/test_llm_helper_testcall.py b/tests/test_llm_helper_testcall.py index 1a9b9fcce..a784f550a 100644 --- a/tests/test_llm_helper_testcall.py +++ b/tests/test_llm_helper_testcall.py @@ -394,6 +394,10 @@ class LlmHelperTestCallTest(unittest.TestCase): self.model = kwargs["model"] self.profile = {"tool_calling": True} + def with_retry(self): + """满足 LangChain 摘要模型的 Runnable 合同。""" + return self + with patch.dict( sys.modules, {"langchain_openai": SimpleNamespace(ChatOpenAI=_FakeChatOpenAI)},