Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7432347 commit 9473c78Copy full SHA for 9473c78
examples/voice/streamed/main.py
@@ -13,13 +13,13 @@
13
14
from agents.voice import StreamedAudioInput, VoicePipeline
15
16
-# Use absolute import when running as script directly
17
-try:
18
- # First try relative import (for package use)
+# Use absolute or relative import based on context
+if __name__ == "__main__":
+ # When running as script, use absolute import
19
+ from my_workflow import MyWorkflow # type: ignore
20
+else:
21
+ # When imported as module, use relative import
22
from .my_workflow import MyWorkflow
-except ImportError:
- # Fall back to direct import (for script use)
- from my_workflow import MyWorkflow
23
24
CHUNK_LENGTH_S = 0.05 # 100ms
25
SAMPLE_RATE = 24000
0 commit comments