Support tool config in yaml
This commit is contained in:
@@ -95,6 +95,7 @@ _AGENT_SETTING_KEYS = {
|
||||
"duplex_system_prompt",
|
||||
"barge_in_min_duration_ms",
|
||||
"barge_in_silence_tolerance_ms",
|
||||
"tools",
|
||||
}
|
||||
_BASE_REQUIRED_AGENT_SETTING_KEYS = {
|
||||
"vad_type",
|
||||
@@ -239,6 +240,11 @@ def _normalize_agent_overrides(raw: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"Section 'siliconflow' is no longer supported. "
|
||||
"Move provider-specific fields into agent.llm / agent.asr / agent.tts."
|
||||
)
|
||||
if key == "tools":
|
||||
if not isinstance(value, list):
|
||||
raise ValueError("Agent config key 'tools' must be a list")
|
||||
normalized["tools"] = value
|
||||
continue
|
||||
section_map = _AGENT_SECTION_KEY_MAP.get(key)
|
||||
if section_map is None:
|
||||
normalized[key] = value
|
||||
@@ -444,6 +450,10 @@ class Settings(BaseSettings):
|
||||
description="How much silence (ms) is tolerated during potential barge-in before reset"
|
||||
)
|
||||
|
||||
# Optional tool declarations from agent YAML.
|
||||
# Supports OpenAI function schema style entries and/or shorthand string names.
|
||||
tools: List[Any] = Field(default_factory=list, description="Default tool definitions for runtime")
|
||||
|
||||
# Logging
|
||||
log_level: str = Field(default="INFO", description="Logging level")
|
||||
log_format: str = Field(default="json", description="Log format (json or text)")
|
||||
|
||||
Reference in New Issue
Block a user