Merge pull request #1967 from counterleft/unused-http-client-session

Remove instantiation of unused http client session from certain examples
This commit is contained in:
Aleix Conchillo Flaqué
2025-06-05 12:59:01 -07:00
committed by GitHub
3 changed files with 148 additions and 152 deletions

View File

@@ -77,7 +77,6 @@ async def configure_livekit():
async def main(): async def main():
async with aiohttp.ClientSession() as session:
(url, token, room_name) = await configure_livekit() (url, token, room_name) = await configure_livekit()
transport = LiveKitTransport( transport = LiveKitTransport(

View File

@@ -82,8 +82,6 @@ transport_params = {
async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_sigint: bool): async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_sigint: bool):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create an HTTP session for API calls
async with aiohttp.ClientSession() as session:
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY")) llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"))
messages = [ messages = [
@@ -133,6 +131,7 @@ async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_si
"show_video_container": False, "show_video_container": False,
"show_debug_container": False, "show_debug_container": False,
} }
rtvi_frame = RTVIServerMessageFrame(data=messages) rtvi_frame = RTVIServerMessageFrame(data=messages)
await task.queue_frames([rtvi_frame]) await task.queue_frames([rtvi_frame])

View File

@@ -92,8 +92,6 @@ transport_params = {
async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_sigint: bool): async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_sigint: bool):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create an HTTP session for API calls
async with aiohttp.ClientSession() as session:
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY")) llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"))