fix(tests): join live text deltas without separators, test a selectable Anthropic model
Browse fileslive_answer_text inserted a newline between text-delta parts, which
corrupts providers that stream fine-grained chunks (DeepSeek can split
mid-word: "Lo" + "RA"). The Anthropic tool-catalog test now uses
claude-haiku-4-5, the model actually offered in AVAILABLE_MODELS.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- tests/test_api.py +5 -2
tests/test_api.py
CHANGED
|
@@ -98,7 +98,7 @@ class ApiTestCase(unittest.TestCase):
|
|
| 98 |
def test_list_tools_for_anthropic_model(self) -> None:
|
| 99 |
with TestClient(app) as client:
|
| 100 |
response = client.get(
|
| 101 |
-
"/api/tools", params={"model": "anthropic:claude-
|
| 102 |
)
|
| 103 |
|
| 104 |
self.assertEqual(response.status_code, 200)
|
|
@@ -1027,7 +1027,10 @@ def live_tool_names(parts: list[dict]) -> set[str]:
|
|
| 1027 |
|
| 1028 |
|
| 1029 |
def live_answer_text(parts: list[dict]) -> str:
|
| 1030 |
-
|
|
|
|
|
|
|
|
|
|
| 1031 |
part.get("delta", "") for part in parts if part["type"] == "text-delta"
|
| 1032 |
)
|
| 1033 |
|
|
|
|
| 98 |
def test_list_tools_for_anthropic_model(self) -> None:
|
| 99 |
with TestClient(app) as client:
|
| 100 |
response = client.get(
|
| 101 |
+
"/api/tools", params={"model": "anthropic:claude-haiku-4-5"}
|
| 102 |
)
|
| 103 |
|
| 104 |
self.assertEqual(response.status_code, 200)
|
|
|
|
| 1027 |
|
| 1028 |
|
| 1029 |
def live_answer_text(parts: list[dict]) -> str:
|
| 1030 |
+
# The AI SDK appends deltas directly to each text block. Inserting a
|
| 1031 |
+
# separator here corrupts providers such as DeepSeek that stream very
|
| 1032 |
+
# fine-grained chunks (for example, "Lo" + "RA").
|
| 1033 |
+
return "".join(
|
| 1034 |
part.get("delta", "") for part in parts if part["type"] == "text-delta"
|
| 1035 |
)
|
| 1036 |
|