Skip to content

Commit 136e2b4

Browse files
authored
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
2 parents 2439032 + fdf3404 commit 136e2b4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

examples/voice/streamed/main.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4+
from typing import TYPE_CHECKING
45

56
import numpy as np
67
import sounddevice as sd
@@ -13,7 +14,18 @@
1314

1415
from agents.voice import StreamedAudioInput, VoicePipeline
1516

16-
from .agents import MyWorkflow
17+
# Import MyWorkflow class - handle both module and package use cases
18+
if TYPE_CHECKING:
19+
# For type checking, use the relative import
20+
from .my_workflow import MyWorkflow
21+
else:
22+
# At runtime, try both import styles
23+
try:
24+
# Try relative import first (when used as a package)
25+
from .my_workflow import MyWorkflow
26+
except ImportError:
27+
# Fall back to direct import (when run as a script)
28+
from my_workflow import MyWorkflow
1729

1830
CHUNK_LENGTH_S = 0.05 # 100ms
1931
SAMPLE_RATE = 24000
File renamed without changes.

0 commit comments

Comments
 (0)