mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
feat: ensure essential tools are always included in LLM tool selection and update tests
- Add mechanism to always include core tools (e.g., file operations, command execution) in LLMToolSelectorMiddleware - Update MoviePilotToolFactory to provide filtered always-include tool names based on loaded tools - Set default LLM_MAX_TOOLS to 30 in config - Refactor agent initialization to support always_include parameter - Enhance tests to cover always_include logic and async agent creation
This commit is contained in:
@@ -407,6 +407,10 @@ class MoviePilotAgent:
|
||||
|
||||
# 工具列表
|
||||
tools = self._initialize_tools()
|
||||
max_tools = settings.LLM_MAX_TOOLS
|
||||
always_include_tools = (
|
||||
MoviePilotToolFactory.get_tool_selector_always_include_names(tools)
|
||||
)
|
||||
|
||||
# 中间件
|
||||
middlewares = [
|
||||
@@ -438,11 +442,12 @@ class MoviePilotAgent:
|
||||
]
|
||||
|
||||
# 工具选择
|
||||
if settings.LLM_MAX_TOOLS > 0:
|
||||
if max_tools > 0:
|
||||
middlewares.append(
|
||||
LLMToolSelectorMiddleware(
|
||||
model=non_streaming_llm,
|
||||
max_tools=settings.LLM_MAX_TOOLS,
|
||||
max_tools=max_tools,
|
||||
always_include=always_include_tools,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user