Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with example #443

Open
sadimoodi opened this issue Sep 4, 2024 · 1 comment
Open

Issue with example #443

sadimoodi opened this issue Sep 4, 2024 · 1 comment

Comments

@sadimoodi
Copy link

Hello,
Thank you very much for the winderful library.
I am reading this example from your Docs but the code is not running because you are using:
daily_rest_helper = DailyRESTHelper( os.getenv("DAILY_API_KEY", ""), os.getenv("DAILY_API_URL", 'https://api.daily.co/v1'))

but DailyRESTHelper constructor takes an additional argument which is aiohttp_session of type aiohttp.ClientSession
so your code isnt running using pipecat version 0.0.39 not 0.0.41

the below code uses FastAPI and receives http post requests so an aiohttp.ClientSession isnt available, how to run this code? thanks

MAX_SESSION_TIME = 5 * 60 # 5 minutes

List of require env vars our bot requires

REQUIRED_ENV_VARS = [
'DAILY_API_KEY',
'OPENAI_API_KEY',
'ELEVENLABS_API_KEY',
'ELEVENLABS_VOICE_ID']

daily_rest_helper = DailyRESTHelper(
os.getenv("DAILY_API_KEY", ""),
os.getenv("DAILY_API_URL", 'https://api.daily.co/v1'))

----------------- API -----------------

app = FastAPI()

app.add_middleware(
CORSMiddleware,
allow_origins=[""],
allow_credentials=True,
allow_methods=["
"],
allow_headers=["*"]
)

----------------- Main -----------------

@app.post("/start_bot")
async def start_bot(request: Request) -> JSONResponse:
try:
# Grab any data included in the post request
data = await request.json()
except Exception as e:
pass

# Create a new Daily WebRTC room for the session to take place in
try:
    params = DailyRoomParams(
        properties=DailyRoomProperties()
    )
    room: DailyRoomObject = daily_rest_helper.create_room(params=params)
except Exception as e:
    raise HTTPException(
        status_code=500,
        detail=f"Unable to provision room {e}")
@jamsea
Copy link
Contributor

jamsea commented Sep 11, 2024

Hi @sadimoodi, could you try adding this line back to the demo and re-running it? Looks like there's a small bug in the demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants