diff --git a/examples/voice/streamed/main.py b/examples/voice/streamed/main.py index aef3b36e..95e93791 100644 --- a/examples/voice/streamed/main.py +++ b/examples/voice/streamed/main.py @@ -1,6 +1,7 @@ from __future__ import annotations import asyncio +from typing import TYPE_CHECKING import numpy as np import sounddevice as sd @@ -13,7 +14,18 @@ from agents.voice import StreamedAudioInput, VoicePipeline -from .agents import MyWorkflow +# Import MyWorkflow class - handle both module and package use cases +if TYPE_CHECKING: + # For type checking, use the relative import + from .my_workflow import MyWorkflow +else: + # At runtime, try both import styles + try: + # Try relative import first (when used as a package) + from .my_workflow import MyWorkflow + except ImportError: + # Fall back to direct import (when run as a script) + from my_workflow import MyWorkflow CHUNK_LENGTH_S = 0.05 # 100ms SAMPLE_RATE = 24000 diff --git a/examples/voice/streamed/agents.py b/examples/voice/streamed/my_workflow.py similarity index 100% rename from examples/voice/streamed/agents.py rename to examples/voice/streamed/my_workflow.py