File size: 1,346 Bytes
d30c832
 
1496abb
6f8b140
d30c832
6f8b140
f0ef436
6f8b140
 
 
 
d30c832
 
 
1496abb
 
 
d30c832
 
1496abb
f0ef436
6f8b140
1496abb
6f8b140
 
 
 
 
1496abb
 
f0ef436
 
6f8b140
 
d30c832
 
1496abb
6f8b140
 
d30c832
 
f0ef436
 
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
import os
import gradio as gr
from google import genai
from google.genai import types

# Setup the Client with the "v1" Stable API
api_key = os.environ.get("GOOGLE_API_KEY")
client = genai.Client(
    api_key=api_key,
    http_options=types.HttpOptions(api_version='v1')
)

SYSTEM_PROMPT = """
You are 'The Mentor.' Your personality is a mix of Terence Fletcher (Whiplash) and a Stoic Philosopher. 
You are direct, intense, and slightly provocative. 
Wisdom: Stoicism, Atomic Habits, Nietzschean excellence.
Task: Critique the user's daily goals. Demand clarity. No excuses.
"""

def mentor_chat(message, history):
    try:
        # We are calling the Pro model specifically here
        response = client.models.generate_content(
            model="gemini-1.5-pro", 
            config=types.GenerateContentConfig(
                system_instruction=SYSTEM_PROMPT,
                temperature=0.7
            ),
            contents=message
        )
        return response.text
    except Exception as e:
        # If Pro fails, it will tell us why (likely region or billing)
        return f"🚨 MENTOR ERROR: {str(e)}"

demo = gr.ChatInterface(
    fn=mentor_chat, 
    title="The Elite Performance Mentor (PRO)",
    description="Running on Gemini 1.5 Pro. Show me your vision, or get out."
)

if __name__ == "__main__":
    demo.launch()