Spaces:
Sleeping
Sleeping
加入sytem prompt的正確用法
Browse files
gemini.py
CHANGED
@@ -30,7 +30,12 @@ google_client = genai.Client(api_key=GOOGLE_API_KEY)
|
|
30 |
text_system_prompt = "你是一個中文的AI助手,請用繁體中文回答"
|
31 |
chat = google_client.chats.create(
|
32 |
model="gemini-2.0-flash",
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
34 |
)
|
35 |
|
36 |
# === 初始設定 ===
|
|
|
30 |
text_system_prompt = "你是一個中文的AI助手,請用繁體中文回答"
|
31 |
chat = google_client.chats.create(
|
32 |
model="gemini-2.0-flash",
|
33 |
+
messages=[
|
34 |
+
{
|
35 |
+
"role": "system",
|
36 |
+
"parts": [text_system_prompt]
|
37 |
+
}
|
38 |
+
]
|
39 |
)
|
40 |
|
41 |
# === 初始設定 ===
|