nexus-e-commerce / runner.py
sadaqatyar's picture
Update runner.py
cdafe00 verified
raw
history blame contribute delete
485 Bytes
from agents import Runner
from openai.types.responses import ResponseTextDeltaEvent
# This takes the query and brings the answer
async def run_query(agent, query: str):
"""
Run a streamed query on the agent and yield response chunks.
"""
response = Runner.run_streamed(agent, query)
async for event in response.stream_events():
if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent):
yield event.data.delta