Fix circular dependency in voice streamed example by renaming agents #291 (#292)

Fix circular dependency in voice streamed example by renaming agents.py
to my_workflow.py

Fix circular dependency in voice streamed example by renaming agents
#291
This commit is contained in:
Rohan Mehta 2025-03-21 19:33:12 -04:00 committed by GitHub
commit 136e2b49ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -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 typing_extensions import override
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