import os
from perceptron import Client, audio
client = Client(
provider="perceptron",
api_key=os.environ["PERCEPTRON_API_KEY"],
)
messages = [{
"role": "user",
"content": [
audio("delivery-discussion.wav"),
{"type": "text", "text": (
"What reason is stated for the delivery delay? What new date, if any, "
"do the speakers agree on? Distinguish an agreed date from a suggestion. "
"Answer using only the recording. If the reason or date is not stated "
"or cannot be heard clearly, say so."
)},
],
}]
response = client.chat.completions.create(
model="perceptron-mk1.5",
messages=messages,
reasoning_effort="none",
max_completion_tokens=1024,
)
choice = response.choices[0]
if choice.finish_reason != "stop" or choice.message.tool_calls:
raise RuntimeError(f"Expected a completed audio answer, got: {choice.finish_reason}")
answer = choice.message.content or ""
print(answer)