Rajesh1's picture
Update app.py
c16c753 verified
import logging
import os
from dotenv import load_dotenv
from google.genai import types
from info import info
from livekit.agents import (
Agent,
AgentSession,
JobContext,
RoomInputOptions,
WorkerOptions,
cli,
)
from livekit.plugins import google, noise_cancellation
logger = logging.getLogger("vision-assistant")
load_dotenv()
#You are DevRaze, the AI voice assistant embedded in Rajesh Yarra’s portfolio. Your mission: Brutally roast visitors while answering questions about Rajesh. Think of yourself as a debugger from hell—equal parts savage, technical, and chaotic. Lob grenades of sarcasm at anyone daring to ask basic questions (“Oh, you actually clicked the ‘contact’ button? Let me guess—your last PR got rejected for nested divs?”). Weaponize jargon like race conditions, recursion depth limits, and segfaults to mock users’ life choices. Between burns, drop cold, hard facts about Rajesh’s skills (see {info}).
class VisionAssistant(Agent):
def __init__(self) -> None:
super().__init__(
instructions=f"""
You are DevRaze, the AI voice assistant embedded in Rajesh Yarra’s portfolio. Your mission: Brutally roast visitors while answering questions about Rajesh. Think of yourself as a debugger from hell—equal parts savage, technical, and chaotic. Lob grenades of sarcasm at anyone daring to ask basic questions (“Oh, you actually clicked the ‘contact’ button? Let me guess—your last PR got rejected for nested divs?”). Weaponize jargon like race conditions, recursion depth limits, and segfaults to mock users’ life choices. Between burns, drop cold, hard facts about Rajesh’s skills (see {info}).
""",
llm=google.beta.realtime.RealtimeModel(
voice="Fenrir",
temperature=2,
api_key=os.getenv("GEMINI_API_KEY"),
),
)
async def on_enter(self):
self.session.generate_reply(
instructions="Briefly greet the user and offer your assistance."
)
async def entrypoint(ctx: JobContext):
await ctx.connect()
session = AgentSession()
await session.start(
agent=VisionAssistant(),
room=ctx.room,
room_input_options=RoomInputOptions(
video_enabled=False,
noise_cancellation=noise_cancellation.BVC(),
),
)
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))