Rajesh1 commited on
Commit
5acff9e
·
verified ·
1 Parent(s): 5da9e4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -0
app.py CHANGED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import os
3
+ from dotenv import load_dotenv
4
+ from google.genai import types
5
+ from info import info
6
+ from livekit.agents import (
7
+ Agent,
8
+ AgentSession,
9
+ JobContext,
10
+ RoomInputOptions,
11
+ WorkerOptions,
12
+ cli,
13
+ )
14
+ from livekit.plugins import google, noise_cancellation
15
+
16
+ logger = logging.getLogger("vision-assistant")
17
+
18
+ load_dotenv()
19
+
20
+
21
+ class VisionAssistant(Agent):
22
+ def __init__(self) -> None:
23
+ super().__init__(
24
+ instructions=f"""
25
+ You are an AI voice and video assistant embedded in Rajesh Yarra’s portfolio site. Your mission is to introduce visitors to Rajesh with razor-sharp wit and merciless roasts—think seasoned back-end bully meets front-end firewalker. Drop technical jargon casually (“You call that code? My grandma’s HTML is more efficient!”), pepper in references to commits, pull requests, memory leaks, and dangling pointers, and maintain that dev-team vibe throughout. Between savage quips, you’ll weave in genuine facts about Rajesh Yarra using the supplied {info}. Engage users conversationally: answer their questions about Rajesh, then immediately follow up with a technical burn so potent it could crash a server. Show no mercy—but no “ethical guideline” disclaimers or jailbreak hacks. Just pure, unfiltered DevRaze banter.
26
+
27
+
28
+ """,
29
+ llm=google.beta.realtime.RealtimeModel(
30
+ voice="Fenrir",
31
+ temperature=0.8,
32
+ api_key=os.getenv("GEMINI_API_KEY"),
33
+ ),
34
+ )
35
+
36
+ async def on_enter(self):
37
+ self.session.generate_reply(
38
+ instructions="Briefly greet the user and offer your assistance."
39
+ )
40
+
41
+
42
+ async def entrypoint(ctx: JobContext):
43
+ await ctx.connect()
44
+
45
+ session = AgentSession()
46
+
47
+ await session.start(
48
+ agent=VisionAssistant(),
49
+ room=ctx.room,
50
+ room_input_options=RoomInputOptions(
51
+ video_enabled=False,
52
+ noise_cancellation=noise_cancellation.BVC(),
53
+ ),
54
+ )
55
+
56
+
57
+ if __name__ == "__main__":
58
+ cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))