File size: 2,470 Bytes
5acff9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a1ccaf
5acff9e
 
 
 
 
d4e9638
5a1ccaf
5acff9e
 
 
c16c753
5acff9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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))