Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion examples/voice/streamed/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import asyncio
from typing import TYPE_CHECKING

import numpy as np
import sounddevice as sd
Expand All @@ -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
Expand Down