AI metadata and api prompt results data capture now fixed

This commit is contained in:
Jim Lancaster
2026-08-08 14:59:45 -05:00
parent 89cac3c378
commit 58faa00d7b
7 changed files with 172 additions and 10 deletions
+12 -1
View File
@@ -78,7 +78,13 @@ class TestOpenRouterProviderTranscribe:
"""Transcribe returns normalized text from a valid response payload."""
response = {
"model": "vendor/model-b",
"choices": [{"message": {"content": [{"text": "Line 1"}, {"text": "Line 2"}]}}],
"choices": [
{
"message": {"content": [{"text": "Line 1"}, {"text": "Line 2"}]},
"finish_reason": "stop",
}
],
"usage": {"prompt_tokens": 10, "completion_tokens": 25, "total_tokens": 35},
}
provider = OpenRouterTranscriptionProvider(
settings=Settings(openrouter_api_key="test-key"),
@@ -94,6 +100,11 @@ class TestOpenRouterProviderTranscribe:
assert result.text == "Line 1\nLine 2"
assert result.provider == "openrouter"
assert result.model == "vendor/model-b"
assert result.ai_metadata == {
"finish_reason": "stop",
"usage": {"input_tokens": 10, "output_tokens": 25, "total_tokens": 35},
}
assert result.raw_api_response == response
@pytest.mark.asyncio
async def test_maps_sdk_exception_to_provider_error(self):