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:
commit
136e2b49ba
2 changed files with 13 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sounddevice as sd
|
import sounddevice as sd
|
||||||
|
|
@ -13,7 +14,18 @@ from typing_extensions import override
|
||||||
|
|
||||||
from agents.voice import StreamedAudioInput, VoicePipeline
|
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
|
CHUNK_LENGTH_S = 0.05 # 100ms
|
||||||
SAMPLE_RATE = 24000
|
SAMPLE_RATE = 24000
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue