Private
Public Access
0
0

feat(ai_client): add send_result() public API returning Result[str]

This commit is contained in:
2026-06-12 19:01:50 -04:00
parent d4d7d1ab14
commit 9f86b2bee3
6 changed files with 114 additions and 27 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ from src.result_types import Result, ErrorInfo, ErrorKind
def test_send_result_public_api_returns_result() -> None:
with patch.object(ai_client, "set_provider"):
with patch.object(ai_client, "_send_anthropic_result", return_value=Result(data="hello")) as mock_send:
with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="hello")) as mock_send:
r = ai_client.send_result("system", "user")
assert isinstance(r, Result)
assert r.ok
@@ -27,7 +27,7 @@ def test_send_deprecated_emits_warning() -> None:
def test_send_result_preserves_errors() -> None:
err = ErrorInfo(kind=ErrorKind.RATE_LIMIT, message="slow down", source="test")
with patch.object(ai_client, "set_provider"):
with patch.object(ai_client, "_send_anthropic_result", return_value=Result(data="", errors=[err])):
with patch.object(ai_client, "_send_gemini_result", return_value=Result(data="", errors=[err])):
r = ai_client.send_result("system", "user")
assert not r.ok
assert r.errors == [err]