generated from john/python-template
V3 step 1 update models.py and step 2 implement service/worker, and raw API response persistence
This commit is contained in:
@@ -73,6 +73,27 @@ class TestOpenRouterProviderTranscribe:
|
||||
assert send_call["x_open_router_title"] == "Transcription App"
|
||||
assert result.text == "Transcript text"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_includes_temperature_and_top_p_when_provided(self):
|
||||
"""Transcribe passes configured sampling parameters through to OpenRouter."""
|
||||
response = {"model": "vendor/model-a", "choices": [{"message": {"content": "Transcript text"}}]}
|
||||
client = _FakeClient(response=response)
|
||||
provider = OpenRouterTranscriptionProvider(settings=Settings(openrouter_api_key="test-key"), client=client)
|
||||
|
||||
result = await provider.transcribe(
|
||||
prompt_text="Prompt body",
|
||||
image_bytes=b"img-bytes",
|
||||
mime_type="image/png",
|
||||
temperature=0.2,
|
||||
top_p=0.85,
|
||||
)
|
||||
|
||||
send_call = client.chat.calls[0]
|
||||
assert send_call["temperature"] == 0.2
|
||||
assert send_call["top_p"] == 0.85
|
||||
assert result.temperature == 0.2
|
||||
assert result.top_p == 0.85
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_parses_successful_response_text(self):
|
||||
"""Transcribe returns normalized text from a valid response payload."""
|
||||
|
||||
Reference in New Issue
Block a user