Skip to content

Instantly share code, notes, and snippets.

View kwindla's full-sized avatar

Kwindla Hultman Kramer kwindla

View GitHub Profile
@kwindla
kwindla / rtvi-bot-20240804.py
Created August 4, 2024 17:14
RTVI simple bot example, 2024-08-04
import aiohttp
import asyncio
import os
import sys
from pipecat.frames.frames import EndFrame
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineParams, PipelineTask
from pipecat.pipeline.runner import PipelineRunner
from pipecat.processors.frameworks.rtvi import (
@kwindla
kwindla / runner.py
Created August 4, 2024 17:16
RTVI bot helper runner - 2024-08-04
#
# Copyright (c) 2024, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
import aiohttp
import argparse
import os
@kwindla
kwindla / talk.py
Created October 7, 2024 01:59
command-line openai realtime
import asyncio
import base64
import json
import os
import pyaudio
import shutil
import websockets
class AudioStreamer:
@kwindla
kwindla / gemini-talk.py
Created December 11, 2024 16:45
Gemini Multimodal Live API minimal client (use headphones)
# installation:
#
# python3.12 -m venv venv
# source venv/bin/activate
#
# pip install pyaudio websockets
# usage:
#
# export GEMINI_API_KEY=...
@kwindla
kwindla / gemini-lights-repro.py
Created December 15, 2024 03:32
Gemini Multimodal Live compositional function calling test
# usage: gemini-lights-repro.py --initial-message "Make a pretty sequence with the lights. Turn them on and off a few times. Pick nice colors."
import argparse
import asyncio
import base64
import json
import os
import pyaudio
import re
import shutil
@kwindla
kwindla / voice-agent-example.py
Last active February 11, 2025 18:47
Pipeline with lookup example
async def start_query_knowledge_base(function_name, llm, context):
"""Push a frame to the TTS service; this is handy when the LLM response might take a while."""
await llm.push_frame(TTSSpeakFrame("Please hold on while I look that order up for you."))
async def query_knowledge_base(function_name, tool_call_id, args, llm, context, result_callback):
query_result = knowledge_base.get(args["query"])
await result_callback({
"info": json.dumps({
"lookup_success": True,
"order_status": query_result["order_status"],
@kwindla
kwindla / 19b-azure-realtime-beta.py
Created March 1, 2025 23:15
Wrap Pipecat OpenAI Realtime API service to work with Azure WebSocket connection format
#
# Copyright (c) 2024–2025, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
import asyncio
import os
import sys
from datetime import datetime
@kwindla
kwindla / bot.py
Created March 11, 2025 19:45
Cartesia Sonic-2 Language Teacher
import asyncio
import os
import sys
from dataclasses import dataclass
import aiohttp
import google.ai.generativelanguage as glm
from dotenv import load_dotenv
from loguru import logger
from runner import configure
@kwindla
kwindla / bot.py
Created March 13, 2025 21:18
Gemini Multimodal Live French tutor
import asyncio
import os
import sys
from dataclasses import dataclass
import aiohttp
from dotenv import load_dotenv
from loguru import logger
from pipecat.audio.vad.silero import SileroVADAnalyzer
@kwindla
kwindla / logs.txt
Created April 22, 2025 19:30
Startup logs for 07-interruptible
2025-04-22 12:27:57.538 | INFO | 07-interruptible:run_bot:28 - Starting bot
2025-04-22 12:27:57.538 | DEBUG | pipecat.audio.vad.silero:__init__:111 - Loading Silero VAD model...
2025-04-22 12:27:57.564 | DEBUG | pipecat.audio.vad.silero:__init__:133 - Loaded Silero VAD
2025-04-22 12:27:57.583 | DEBUG | pipecat.processors.frame_processor:link:177 - Linking PipelineSource#0 -> SmallWebRTCInputTransport#0
2025-04-22 12:27:57.583 | DEBUG | pipecat.processors.frame_processor:link:177 - Linking SmallWebRTCInputTransport#0 -> DeepgramSTTService#0
2025-04-22 12:27:57.583 | DEBUG | pipecat.processors.frame_processor:link:177 - Linking DeepgramSTTService#0 -> OpenAIUserContextAggregator#0
2025-04-22 12:27:57.583 | DEBUG | pipecat.processors.frame_processor:link:177 - Linking OpenAIUserContextAggregator#0 -> OpenAILLMService#0
2025-04-22 12:27:57.583 | DEBUG | pipecat.processors.frame_processor:link:177 - Linking OpenAILLMService#0 -> CartesiaTTSService#0
2025-04-22 12:27:57.583 | DEBUG | pip