3v324v23 commited on
Commit
a407d90
·
1 Parent(s): f4e61f3

加入sytem prompt的正確用法

Browse files
Files changed (1) hide show
  1. gemini.py +6 -1
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
- system_prompt=text_system_prompt,
 
 
 
 
 
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
  # === 初始設定 ===