Spaces:
Sleeping
Sleeping
放上search_tool
Browse files
gemini.py
CHANGED
|
@@ -32,9 +32,15 @@ from linebot.v3.webhooks import (
|
|
| 32 |
|
| 33 |
from PIL import Image
|
| 34 |
|
|
|
|
| 35 |
# === 初始化 Google Gemini ===
|
| 36 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 37 |
client = genai.Client(api_key=GOOGLE_API_KEY)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
chat = client.chats.create(model="gemini-2.5-pro-preview-05-06",
|
| 39 |
config=GenerateContentConfig(
|
| 40 |
system_instruction="你是一個中文的AI助手,請用繁體中文回答",
|
|
|
|
| 32 |
|
| 33 |
from PIL import Image
|
| 34 |
|
| 35 |
+
|
| 36 |
# === 初始化 Google Gemini ===
|
| 37 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 38 |
client = genai.Client(api_key=GOOGLE_API_KEY)
|
| 39 |
+
|
| 40 |
+
google_search_tool = Tool(
|
| 41 |
+
google_search = GoogleSearch()
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
chat = client.chats.create(model="gemini-2.5-pro-preview-05-06",
|
| 45 |
config=GenerateContentConfig(
|
| 46 |
system_instruction="你是一個中文的AI助手,請用繁體中文回答",
|