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

Add environment variable loading in moondream-chatbot demo. #1062

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/moondream-chatbot/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
# # noqa: D100
# Copyright (c) 2024–2025, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
Expand All @@ -10,12 +10,14 @@
from contextlib import asynccontextmanager

import aiohttp
from dotenv import load_dotenv
from fastapi import FastAPI, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse, RedirectResponse

from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper, DailyRoomParams

load_dotenv(override=True)
MAX_BOTS_PER_ROOM = 1

# Bot sub-process dict for status reporting and concurrency control
Expand All @@ -24,7 +26,7 @@
daily_helpers = {}


def cleanup():
def cleanup(): # noqa: D103
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstrings aren't required by the linter. Can you remove the # noqa: D103 comments?

# Clean up function, just to be extra safe
for entry in bot_procs.values():
proc = entry[0]
Expand All @@ -33,7 +35,7 @@ def cleanup():


@asynccontextmanager
async def lifespan(app: FastAPI):
async def lifespan(app: FastAPI): # noqa: D103
aiohttp_session = aiohttp.ClientSession()
daily_helpers["rest"] = DailyRESTHelper(
daily_api_key=os.getenv("DAILY_API_KEY", ""),
Expand Down
10 changes: 10 additions & 0 deletions examples/translation-chatbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
from pipecat.processors.transcript_processor import TranscriptProcessor
from pipecat.services.azure import AzureSTTService, AzureTTSService
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file look like they snuck in. Can you keep the scope to the translation demo?

from pipecat.services.cartesia import CartesiaTTSService
from pipecat.services.deepgram import DeepgramSTTService
from pipecat.services.openai import OpenAILLMService
Expand Down Expand Up @@ -150,6 +151,15 @@ async def main():
voice_id="34dbb662-8e98-413c-a1ef-1a3407675fe7", # Spanish Narrator Man
model="sonic-multilingual",
)
# stt = AzureSTTService(
# api_key = os.getenv("AZURE_SPEECH_API_KEY"),
# region = os.getenv("AZURE_SPEECH_REGION")
# )
# tts = AzureTTSService(
# api_key = os.getenv("AZURE_SPEECH_API_KEY"),
# region = os.getenv("AZURE_SPEECH_REGION"),
# language = "zh"
# )

in_language = "English"
out_language = "Spanish"
Expand Down