Fix voice pipeline code examples in quickstart docs
This commit is contained in:
parent
65032208f2
commit
3da3b51b87
1 changed files with 4 additions and 1 deletions
|
|
@ -91,7 +91,7 @@ agent = Agent(
|
||||||
We'll set up a simple voice pipeline, using [`SingleAgentVoiceWorkflow`][agents.voice.workflow.SingleAgentVoiceWorkflow] as the workflow.
|
We'll set up a simple voice pipeline, using [`SingleAgentVoiceWorkflow`][agents.voice.workflow.SingleAgentVoiceWorkflow] as the workflow.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from agents.voice import SingleAgentVoiceWorkflow, VoicePipeline,
|
from agents.voice import SingleAgentVoiceWorkflow, VoicePipeline
|
||||||
pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent))
|
pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -100,10 +100,13 @@ pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent))
|
||||||
```python
|
```python
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sounddevice as sd
|
import sounddevice as sd
|
||||||
|
from agents.voice import AudioInput
|
||||||
|
|
||||||
# For simplicity, we'll just create 3 seconds of silence
|
# For simplicity, we'll just create 3 seconds of silence
|
||||||
# In reality, you'd get microphone data
|
# In reality, you'd get microphone data
|
||||||
audio = np.zeros(24000 * 3, dtype=np.int16)
|
audio = np.zeros(24000 * 3, dtype=np.int16)
|
||||||
|
audio_input = AudioInput(buffer=buffer)
|
||||||
|
|
||||||
result = await pipeline.run(audio_input)
|
result = await pipeline.run(audio_input)
|
||||||
|
|
||||||
# Create an audio player using `sounddevice`
|
# Create an audio player using `sounddevice`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue