feat(workflow): add per-agent vision configuration
This commit is contained in:
@@ -18,6 +18,8 @@ class AgentStageConfig:
|
||||
llm_resource_id: str
|
||||
asr_resource_id: str
|
||||
tts_resource_id: str
|
||||
vision_enabled: bool
|
||||
vision_model_resource_id: str | None
|
||||
tool_ids: tuple[str, ...]
|
||||
knowledge_base_id: str | None
|
||||
knowledge_mode: str
|
||||
@@ -119,6 +121,10 @@ class WorkflowEngine:
|
||||
llm_resource_id=str(source.get(llm_key) or ""),
|
||||
asr_resource_id=str(source.get(asr_key) or ""),
|
||||
tts_resource_id=str(source.get(tts_key) or ""),
|
||||
vision_enabled=bool(source.get("visionEnabled", False)),
|
||||
vision_model_resource_id=(
|
||||
str(source.get("visionModelResourceId") or "") or None
|
||||
),
|
||||
tool_ids=tuple(str(tool_id) for tool_id in source.get("toolIds") or []),
|
||||
knowledge_base_id=knowledge_base_id or None,
|
||||
knowledge_mode=(
|
||||
@@ -139,6 +145,14 @@ class WorkflowEngine:
|
||||
turn_config=dict(turn_config),
|
||||
)
|
||||
|
||||
def uses_vision(self) -> bool:
|
||||
"""Return whether any effective Agent stage needs a camera stream."""
|
||||
return any(
|
||||
self.agent_stage_config(node_id).vision_enabled
|
||||
for node_id, node in self.nodes.items()
|
||||
if node.get("type") == "agent"
|
||||
)
|
||||
|
||||
def prompt_for(self, node_id: str, store: DynamicVariableStore) -> str:
|
||||
"""Build the Agent system prompt according to its inheritance setting."""
|
||||
prompt = store.render(str(self.data(node_id).get("prompt") or "").strip())
|
||||
|
||||
Reference in New Issue
Block a user