Add RuntimeTool model and enhance AssistantConfig for tool management
- Introduce a new `RuntimeTool` model to encapsulate tool data for runtime sessions, including attributes like `id`, `name`, `function_name`, `type`, and `description`. - Update the `AssistantConfig` model to include a list of reusable tools, allowing for better management of tools within assistant configurations. - Modify the `config_resolver` service to fetch and resolve tools associated with assistants, ensuring they are available during runtime. - Refactor tool-related CRUD operations in the `tools` route to support the new runtime execution model, enhancing the overall tool management system. - Update documentation and comments to reflect changes in tool execution and configuration handling, improving clarity for future development.
This commit is contained in:
@@ -15,6 +15,17 @@ from pydantic import BaseModel, Field
|
||||
RuntimeMode = Literal["pipeline", "realtime"]
|
||||
|
||||
|
||||
class RuntimeTool(BaseModel):
|
||||
"""Tool data resolved from an assistant binding for one runtime session."""
|
||||
|
||||
id: str
|
||||
name: str
|
||||
function_name: str
|
||||
type: str
|
||||
description: str = ""
|
||||
definition: dict = Field(default_factory=dict)
|
||||
|
||||
|
||||
class AssistantConfig(BaseModel):
|
||||
"""运行时配置:前端可见部分(name/prompt/...) + 服务端注入部分(*_api_key/*_base_url)。"""
|
||||
|
||||
@@ -61,6 +72,9 @@ class AssistantConfig(BaseModel):
|
||||
|
||||
enableInterrupt: bool = True
|
||||
|
||||
# Prompt assistant reusable tools. Execution remains type-specific in the pipeline.
|
||||
tools: list[RuntimeTool] = Field(default_factory=list)
|
||||
|
||||
# workflow 类型:节点图(nodes/edges)。非 workflow 为空,引擎据此决定是否启用。
|
||||
graph: dict = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user