Unify db api
This commit is contained in:
@@ -92,16 +92,44 @@ def _build_pipeline(monkeypatch, llm_rounds: List[List[LLMStreamEvent]]) -> tupl
|
||||
return pipeline, events
|
||||
|
||||
|
||||
def test_pipeline_uses_default_tools_from_settings(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
"core.duplex_pipeline.settings.tools",
|
||||
[
|
||||
"current_time",
|
||||
{
|
||||
"name": "weather",
|
||||
"description": "Get weather by city",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {"city": {"type": "string"}},
|
||||
"required": ["city"],
|
||||
},
|
||||
"executor": "server",
|
||||
},
|
||||
],
|
||||
)
|
||||
pipeline, _events = _build_pipeline(monkeypatch, [[LLMStreamEvent(type="done")]])
|
||||
|
||||
cfg = pipeline.resolved_runtime_config()
|
||||
assert cfg["tools"]["allowlist"] == ["current_time", "weather"]
|
||||
|
||||
schemas = pipeline._resolved_tool_schemas()
|
||||
names = [s.get("function", {}).get("name") for s in schemas if isinstance(s, dict)]
|
||||
assert "current_time" in names
|
||||
assert "weather" in names
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ws_message_parses_tool_call_results():
|
||||
msg = parse_client_message(
|
||||
{
|
||||
"type": "tool_call.results",
|
||||
"results": [{"tool_call_id": "call_1", "status": {"code": 200, "message": "ok"}}],
|
||||
"results": [{"tool_call_id": "call_1", "name": "weather", "status": {"code": 200, "message": "ok"}}],
|
||||
}
|
||||
)
|
||||
assert isinstance(msg, ToolCallResultsMessage)
|
||||
assert msg.results[0]["tool_call_id"] == "call_1"
|
||||
assert msg.results[0].tool_call_id == "call_1"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user