mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-31 17:32:30 +08:00
add LLMToolSelectorMiddleware
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Dict, List
|
||||
|
||||
from langchain.agents import create_agent
|
||||
from langchain.agents.middleware import (
|
||||
SummarizationMiddleware,
|
||||
SummarizationMiddleware, LLMToolSelectorMiddleware,
|
||||
)
|
||||
from langchain_core.messages import (
|
||||
HumanMessage,
|
||||
@@ -92,6 +92,11 @@ class MoviePilotAgent:
|
||||
|
||||
# 中间件
|
||||
middlewares = [
|
||||
# 工具选择
|
||||
LLMToolSelectorMiddleware(
|
||||
model=llm,
|
||||
max_tools=20
|
||||
),
|
||||
# 记忆管理
|
||||
MemoryMiddleware(
|
||||
sources=[str(settings.CONFIG_PATH / "agent" / "MEMORY.md")]
|
||||
|
||||
@@ -89,6 +89,7 @@ langchain-openai~=1.1.11
|
||||
langchain-google-genai~=4.2.1
|
||||
langchain-deepseek~=1.0.1
|
||||
langchain-experimental~=0.4.1
|
||||
langgraph~=1.1.3
|
||||
openai~=2.29.0
|
||||
ddgs~=9.10.0
|
||||
websocket-client~=1.8.0
|
||||
|
||||
Reference in New Issue
Block a user