Spaces:
Running
Running
Alina Lozovskaya commited on
Commit ·
f8f07bd
1
Parent(s): 17f679e
Read OPENAI_API_KEY in openai_realtime.py
Browse files
src/reachy_mini_conversation_demo/openai_realtime.py
CHANGED
|
@@ -9,6 +9,7 @@ import numpy as np
|
|
| 9 |
from fastrtc import AdditionalOutputs, AsyncStreamHandler, wait_for_item
|
| 10 |
from openai import AsyncOpenAI
|
| 11 |
|
|
|
|
| 12 |
from reachy_mini_conversation_demo.tools import (
|
| 13 |
ALL_TOOL_SPECS,
|
| 14 |
ToolDependencies,
|
|
@@ -45,7 +46,7 @@ class OpenaiRealtimeHandler(AsyncStreamHandler):
|
|
| 45 |
|
| 46 |
async def start_up(self):
|
| 47 |
"""Start the handler."""
|
| 48 |
-
self.client = AsyncOpenAI()
|
| 49 |
async with self.client.beta.realtime.connect(model="gpt-realtime") as conn:
|
| 50 |
await conn.session.update(
|
| 51 |
session={
|
|
|
|
| 9 |
from fastrtc import AdditionalOutputs, AsyncStreamHandler, wait_for_item
|
| 10 |
from openai import AsyncOpenAI
|
| 11 |
|
| 12 |
+
from reachy_mini_conversation_demo.config import config
|
| 13 |
from reachy_mini_conversation_demo.tools import (
|
| 14 |
ALL_TOOL_SPECS,
|
| 15 |
ToolDependencies,
|
|
|
|
| 46 |
|
| 47 |
async def start_up(self):
|
| 48 |
"""Start the handler."""
|
| 49 |
+
self.client = AsyncOpenAI(api_key=config.OPENAI_API_KEY)
|
| 50 |
async with self.client.beta.realtime.connect(model="gpt-realtime") as conn:
|
| 51 |
await conn.session.update(
|
| 52 |
session={
|