from obiguard import AsyncObiguard as Obiguard, OBIGUARD_GATEWAY_URL
import asyncio
async def main():
client = Obiguard(
virtual_key="vk-obg-***", # Your Obiguard virtual key here
base_url=OBIGUARD_GATEWAY_URL,
)
async with client.beta.realtime.connect(
model="gpt-4o-realtime-preview-2024-10-01" # Replace with the model you want to use
) as connection:
await connection.session.update(session={'modalities': ['text']})
await connection.conversation.item.create(
item={
"type": "message",
"role": "user",
"content": [{"type": "input_text", "text": "Say hello!"}],
}
)
await connection.response.create()
async for event in connection:
if event.type == 'response.text.delta':
print(event.delta, flush=True, end="")
elif event.type == 'response.text.done':
print()
elif event.type == "response.done":
break
asyncio.run(main())