fix: support vision prompt modes
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from models import AssistantConfig, RuntimeTool
|
||||
from pipecat.flows import FlowManager
|
||||
@@ -1782,7 +1782,7 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
}
|
||||
)
|
||||
scopes = []
|
||||
vision_function = object()
|
||||
vision_function = MagicMock(side_effect=lambda _stage: object())
|
||||
|
||||
async def queue_frame(_frame):
|
||||
pass
|
||||
@@ -1800,13 +1800,18 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
await brain._apply_agent_stage("agent")
|
||||
inherited_config = brain._agent_config("agent")
|
||||
self.assertIn(vision_function, inherited_config["functions"])
|
||||
self.assertEqual(len(inherited_config["functions"]), 1)
|
||||
vision_function.assert_called_once()
|
||||
selected_stage = vision_function.call_args.args[0]
|
||||
self.assertEqual(selected_stage.vision_prompt_mode, "runtime")
|
||||
self.assertIn("fetch_user_image", inherited_config["role_message"])
|
||||
self.assertEqual(
|
||||
scopes[-1],
|
||||
{
|
||||
"enabled": True,
|
||||
"vision_model_resource_id": "vision_global",
|
||||
"vision_prompt_mode": "runtime",
|
||||
"vision_prompt": "",
|
||||
"llm_resource_id": "llm_global",
|
||||
},
|
||||
)
|
||||
@@ -1821,7 +1826,7 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
)
|
||||
await brain._apply_agent_stage("agent")
|
||||
custom_config = brain._agent_config("agent")
|
||||
self.assertNotIn(vision_function, custom_config["functions"])
|
||||
self.assertEqual(custom_config["functions"], [])
|
||||
self.assertNotIn("fetch_user_image", custom_config["role_message"])
|
||||
self.assertFalse(scopes[-1]["enabled"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user