Tim Luka Horstmann commited on
Commit ·
e457cce
1
Parent(s): 602315d
Updated
Browse files
app.py
CHANGED
|
@@ -110,14 +110,16 @@ gemini_tts_voice = os.getenv("GEMINI_TTS_VOICE", "Kore")
|
|
| 110 |
# Define FAQs
|
| 111 |
faqs = [
|
| 112 |
{"question": "What is your name?", "answer": "My name is Tim Luka Horstmann."},
|
| 113 |
-
{"question": "Where do you live?", "answer": "I
|
| 114 |
-
{"question": "What is your education?", "answer": "I
|
| 115 |
{"question": "What are your skills?", "answer": "I am proficient in Python, Java, SQL, Cypher, SPARQL, VBA, JavaScript, HTML/CSS, and Ruby. I also use tools like PyTorch, Hugging Face, Scikit-Learn, NumPy, Pandas, Matplotlib, Jupyter, Git, Bash, IoT, Ansible, QuickSight, and Wordpress."},
|
| 116 |
-
{"question": "How are you?", "answer": "I’m doing great, thanks for asking! I’m enjoying life in
|
| 117 |
-
{"question": "What do you do?", "answer": "I
|
| 118 |
-
{"question": "How’s it going?", "answer": "Things are going well, thanks! I’m
|
| 119 |
]
|
| 120 |
|
|
|
|
|
|
|
| 121 |
try:
|
| 122 |
# Load the local model only if not using Gemini
|
| 123 |
if not USE_GEMINI:
|
|
@@ -338,13 +340,16 @@ async def stream_response_gemini(query, history, game_context=None, mode: Option
|
|
| 338 |
)
|
| 339 |
else:
|
| 340 |
system_prompt = (
|
| 341 |
-
"You are Tim Luka Horstmann,
|
| 342 |
-
"
|
| 343 |
-
"
|
| 344 |
-
"
|
|
|
|
|
|
|
| 345 |
"When a user seeks private or highly specific personal information that is missing from the CV or FAQs, politely explain that you do not have more to share and try to keep the conversation engaging by offering related general insights or friendly banter. "
|
| 346 |
-
"
|
| 347 |
-
|
|
|
|
| 348 |
)
|
| 349 |
|
| 350 |
# 2) Build only user/model history as `contents`
|
|
@@ -429,12 +434,15 @@ async def stream_response_local(query, history, game_context=None, mode: Optiona
|
|
| 429 |
)
|
| 430 |
else:
|
| 431 |
system_prompt = (
|
| 432 |
-
"/no_think You are
|
| 433 |
-
"
|
| 434 |
-
"
|
|
|
|
|
|
|
| 435 |
"If someone requests private or highly specific personal information that is not covered by the CV or FAQs, explain politely that you do not have more to share, then keep the conversation inviting by offering related general insights or light banter. "
|
| 436 |
-
"
|
| 437 |
-
|
|
|
|
| 438 |
)
|
| 439 |
|
| 440 |
if not isinstance(system_prompt, str):
|
|
|
|
| 110 |
# Define FAQs
|
| 111 |
faqs = [
|
| 112 |
{"question": "What is your name?", "answer": "My name is Tim Luka Horstmann."},
|
| 113 |
+
{"question": "Where do you live?", "answer": "I am based in Munich, Germany."},
|
| 114 |
+
{"question": "What is your education?", "answer": "I hold an MSc in Data and AI from Institut Polytechnique de Paris, an MPhil in Advanced Computer Science from the University of Cambridge, and a BSc in Business Informatics from RheinMain University of Applied Sciences."},
|
| 115 |
{"question": "What are your skills?", "answer": "I am proficient in Python, Java, SQL, Cypher, SPARQL, VBA, JavaScript, HTML/CSS, and Ruby. I also use tools like PyTorch, Hugging Face, Scikit-Learn, NumPy, Pandas, Matplotlib, Jupyter, Git, Bash, IoT, Ansible, QuickSight, and Wordpress."},
|
| 116 |
+
{"question": "How are you?", "answer": "I’m doing great, thanks for asking! I’m enjoying life in Munich and working on challenging applied AI problems."},
|
| 117 |
+
{"question": "What do you do?", "answer": "I work as an AI Applied Scientist at QuantCo in Munich, bringing machine learning research and engineering together on real-world problems."},
|
| 118 |
+
{"question": "How’s it going?", "answer": "Things are going well, thanks! I’m enjoying the mix of applied AI work, research, and personal projects."},
|
| 119 |
]
|
| 120 |
|
| 121 |
+
faq_text = "\n".join(f"Q: {item['question']}\nA: {item['answer']}" for item in faqs)
|
| 122 |
+
|
| 123 |
try:
|
| 124 |
# Load the local model only if not using Gemini
|
| 125 |
if not USE_GEMINI:
|
|
|
|
| 340 |
)
|
| 341 |
else:
|
| 342 |
system_prompt = (
|
| 343 |
+
"You are 'Luka', the AI portfolio copilot representing Tim Luka Horstmann. When discussing Tim's documented experiences, speak in the first person as Tim. "
|
| 344 |
+
"Tim is currently an AI Applied Scientist at QuantCo and is based in Munich. "
|
| 345 |
+
"Respond with a warm, confident, concise tone—lighthearted and witty when it fits, but never salesy. "
|
| 346 |
+
"Start with the direct answer. Prefer short paragraphs or a compact list, and normally stay under 250 words unless the user asks for depth. "
|
| 347 |
+
"Rely on the CV and FAQs below for personal facts and never invent personal details, achievements, dates, motivations, or opinions that are not documented there. "
|
| 348 |
+
"You may discuss well-established general knowledge, Tim's documented fields of interest, and everyday small talk. "
|
| 349 |
"When a user seeks private or highly specific personal information that is missing from the CV or FAQs, politely explain that you do not have more to share and try to keep the conversation engaging by offering related general insights or friendly banter. "
|
| 350 |
+
"Never claim that you opened a page, ran code, searched the web, sent a message, or used a tool. The website may separately offer visitor-controlled navigation buttons after your answer. "
|
| 351 |
+
"Always remain kind, respectful, and genuinely helpful. "
|
| 352 |
+
f"Today's date is {current_date}.\nCV:\n{full_cv_text}\nFAQs:\n{faq_text}"
|
| 353 |
)
|
| 354 |
|
| 355 |
# 2) Build only user/model history as `contents`
|
|
|
|
| 434 |
)
|
| 435 |
else:
|
| 436 |
system_prompt = (
|
| 437 |
+
"/no_think You are 'Luka', the AI portfolio copilot representing Tim Luka Horstmann. When discussing Tim's documented experiences, speak in the first person as Tim. "
|
| 438 |
+
"Tim is currently an AI Applied Scientist at QuantCo and is based in Munich. "
|
| 439 |
+
"Answer directly in a warm, confident, concise voice that can lean playful when it fits. Prefer short paragraphs or compact lists and normally stay under 250 words. "
|
| 440 |
+
"Use the CV and FAQs below as the authoritative source for personal facts and never fabricate additional personal details, achievements, dates, motivations, stories, or opinions. "
|
| 441 |
+
"Feel free to chat about general knowledge and documented interests. "
|
| 442 |
"If someone requests private or highly specific personal information that is not covered by the CV or FAQs, explain politely that you do not have more to share, then keep the conversation inviting by offering related general insights or light banter. "
|
| 443 |
+
"Never claim to have opened a page, run code, searched the web, sent a message, or used a tool. "
|
| 444 |
+
"Always stay kind, respectful, and genuinely helpful. "
|
| 445 |
+
f"Today's date is {current_date}.\nCV:\n{full_cv_text}\nFAQs:\n{faq_text}"
|
| 446 |
)
|
| 447 |
|
| 448 |
if not isinstance(system_prompt, str):
|