fix(relay): serialize rewritten tool results
Signed-off-by: Alex Fournier <afournier@nvidia.com>
This commit is contained in:
parent
1c6a96032c
commit
c16f86dc4c
|
|
@ -72,7 +72,9 @@ def execute(
|
|||
|
||||
if "value" in raw_result and _json_equal(managed, raw_result["json"]):
|
||||
return raw_result["value"], observed_args
|
||||
return managed, observed_args
|
||||
if isinstance(managed, str):
|
||||
return managed, observed_args
|
||||
return json.dumps(_jsonable(managed), ensure_ascii=False), observed_args
|
||||
|
||||
|
||||
def _jsonable(value: Any) -> Any:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("nemo_relay")
|
||||
|
|
@ -118,7 +120,8 @@ def test_request_rewrite_reaches_authorized_callback_once(relay_turn):
|
|||
|
||||
assert callback_args == [{"path": "/approved/path"}]
|
||||
assert observed_args == {"path": "/approved/path"}
|
||||
assert result == {"ok": True, "wrapped": True}
|
||||
assert isinstance(result, str)
|
||||
assert json.loads(result) == {"ok": True, "wrapped": True}
|
||||
|
||||
|
||||
def test_provider_error_identity_is_preserved(relay_turn):
|
||||
|
|
|
|||
Loading…
Reference in New Issue