先懂生態,不急著寫程式
Gemini Chat、NotebookLM、AI Studio、API、Antigravity CLI 各自定位
你是程式初學者時,最重要不是背所有模型名稱,而是知道「哪一種任務該丟給哪個工具」。
深化課程模組
每章都有動手做與驗收標準。
可複製指令
Chat、Gems、NotebookLM、API、CLI、部署、影音。
實務案例導向
商圈查詢、廣告文案、客戶追蹤、案件整理。
點節點會跳到相關區塊;先用大圖建立方向感,再進入每個章節。
每關都設計成「學概念 → 複製指令 → 做一次 → 驗收」,不只是看功能介紹。
Gemini Chat、NotebookLM、AI Studio、API、Antigravity CLI 各自定位
NotebookLM、來源引用、Audio/Video Overview、Mind Maps
Custom Instructions、Saved Info、Gems、房仲任務模板
AI Studio、API Key、generateContent、streaming、JSON schema
Function Calling、Google Search Grounding、Maps/Sheets/API 串接
Context Caching、Batch/Flex、Rate Limits、重試機制
Antigravity CLI、AGENTS.md、計畫模式、人工核准
Flow、Imagen/Nano Banana、Veo、廣告文案檢查
這裡把 Chat、Gems、NotebookLM、AI Studio、API、Antigravity CLI、Cloudflare、房仲影音廣告的常用指令集中整理。可搜尋、可分類、可複製。
日常學習、資料整理、工作拆解先用這段。
你是我的 Gemini 學習教練。
任務:請把我接下來提供的資料,整理成「可執行的工作流程」。
請固定輸出:
1. 三句話摘要
2. 我該用 Gemini Chat / NotebookLM / AI Studio / API / Antigravity CLI 哪一個
3. 逐步操作流程
4. 可直接複製的下一段指令
5. 需要人工查證或不能直接相信的地方
語言:繁體中文,語氣清楚、像教新手。
用於工作郵件整理。寄信、刪除、改資料前都要人工確認。
@Gmail 搜尋最近 7 天與「買方、委託、貸款、斡旋、簽約」相關的郵件。
請輸出:寄件者、主旨、日期、緊急程度、我下一步要做什麼。
若郵件內容不足,不要猜測,請標示「需人工確認」。
適合把雲端硬碟變成案件清單。
@Google Drive 找出資料夾中與「房屋案件、委託書、謄本、合約、廣告素材」相關的文件。
請依照:案件名稱 / 文件類型 / 最近更新日期 / 是否缺少資料 / 建議下一步,整理成表格。
房仲物件頁可用,但公開前要人工核對距離與店名。
@Google Maps 請查詢這個地址周邊 800 公尺:{貼上地址}
分類:捷運/火車、公車、便利商店、超市、醫療、學校、公園、餐廳、停車場。
請輸出成表格,並標出「廣告可寫」與「需再次查證」兩欄。
可貼到 Gemini 的 Saved Info 或 Chat 讓它記住。
請記住:
1. 我偏好繁體中文。
2. 我是房仲,回覆請盡量提供房仲、開發、客戶追蹤、自動化工具的例子。
3. 我是程式初學者,程式碼請分步解釋,並標出我需要複製到哪個檔案。
4. 涉及金錢、寄信、刪除資料、公開廣告前,請提醒我人工確認。
放在 Gemini Custom Instructions。
所有回覆請使用繁體中文(zh-TW)。
先給我「結論與下一步」,再展開詳細教學。
我是程式初學者,請避免只講抽象概念,務必附上操作步驟、範例、常見錯誤。
程式碼請提供完整可執行版本,並用繁體中文註解。
若資料不足,請先問我,不要自行編造。
涉及法規、價格、官方功能或版本時,請提醒需要查官方最新文件。
建立自訂 Gem 時放入 Instructions。
# Role & Goal
You are a senior real-estate operations assistant for Taiwan property agents.
Always reply in Traditional Chinese.
# Tasks
- Convert listing notes into clean property summaries.
- Extract missing information and risk points.
- Generate ad copy, LINE follow-up messages, and owner/buyer checklists.
# Output Format
1. 案件摘要
2. 可公開廣告文案
3. LINE 私訊版本
4. 需查證資訊
5. 下一步行動清單
# Safety Rules
- Do not fabricate distances, prices, legal status, or ownership information.
- Mark uncertain claims as「需查證」.
- Remind the user to verify before publishing advertisements.
適合把固定開發風格封裝成一鍵助理。
# Role
You are a senior Google Apps Script developer.
Always reply in Traditional Chinese.
# Rules
- Provide complete runnable code, not fragments.
- Use SpreadsheetApp / GmailApp / DriveApp only when appropriate.
- Never hardcode API keys; use PropertiesService.
- Add Chinese comments to each important function.
- Explain where to paste each file and how to deploy.
# Output
1. 核心邏輯
2. 完整程式碼
3. 部署步驟
4. 測試方式
5. 常見錯誤與修復
每次改 Gem 後用這段檢查品質。
請用以下測試資料執行一次完整流程:
物件:{地址/坪數/總價/格局/車位/特色}
任務:產生廣告文案、LINE 私訊、短影音腳本、需查證清單。
請同時指出:Gem 的 Instructions 哪裡不夠清楚,應如何修改。
避免 NotebookLM 回答混入外部常識。
請只根據本 Notebook 的來源回答。
若來源沒有明確寫出,請回答「來源不足,無法確認」。
每個重要結論都要附來源引用,並用表格整理:結論 / 依據 / 引用 / 可信度 / 下一步查證。
把 PDF、課程內容變成可學習教材。
請把所有來源整理成一份新手教學講義。
結構:
1. 先學什麼、後學什麼
2. 核心概念樹狀圖
3. 每章重點
4. 10 題測驗
5. 實作任務
6. 容易誤解的地方
請每個章節附來源引用。
貼在 Audio Overview 的 Customize。
請主持人用台灣繁體中文,像兩位輕鬆但專業的老師對談。
聚焦:Gemini API、NotebookLM、AI Studio、Antigravity CLI 的實務用途。
目標聽眾:程式初學者、房仲、自動化工具學習者。
請多用生活化比喻,避免太多英文術語。
先用 NotebookLM 生成,再把心智圖輸出為教學頁面。
請根據所有來源建立心智圖。
第一層:Gemini Chat、NotebookLM、AI Studio/API、Antigravity CLI、Agent、影音生成、成本與快取、故障排除。
每個節點請加:用途、適合誰、常用指令、易錯點。
金鑰不要放進 GitHub 或前端 HTML。
# macOS / Linux
python -m venv .venv
source .venv/bin/activate
pip install -U google-genai
export GEMINI_API_KEY="你的_API_Key"
# Windows PowerShell
py -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -U google-genai
$env:GEMINI_API_KEY="你的_API_Key"
# Node.js
npm init -y
npm install @google/genai
第一支測試程式。
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="請用繁體中文解釋 Gemini API 可以幫房仲做什麼。",
config=types.GenerateContentConfig(
temperature=0.3,
max_output_tokens=2048,
),
)
print(response.text)
比每次在 prompt 裡重複角色更穩。
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="請整理這段物件描述:{貼上資料}",
config=types.GenerateContentConfig(
system_instruction="你是台灣房仲行政助理,只能根據使用者提供資料整理,不可編造。",
temperature=0.1,
),
)
print(response.text)
適合網頁前端做逐字輸出。
from google import genai
client = genai.Client()
stream = client.models.generate_content_stream(
model="gemini-3.5-flash",
contents="請一步一步教我建立房仲物件摘要工具。",
)
for chunk in stream:
if chunk.text:
print(chunk.text, end="")
用在後端資料庫、Excel、Supabase 欄位最重要。
from pydantic import BaseModel
from google import genai
from google.genai import types
class ListingSummary(BaseModel):
title: str
selling_points: list[str]
missing_fields: list[str]
risk_notes: list[str]
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="請整理以下房屋資料成 JSON:{貼上房屋資料}",
config=types.GenerateContentConfig(
response_mime_type="application/json",
response_schema=ListingSummary,
),
)
print(response.text)
即時資訊與來源引用可用,但仍需人工核對官方資料。
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="請查核目前高雄捷運最新路線與房市相關交通建設資訊,附來源。",
config=types.GenerateContentConfig(
tools=[types.Tool(google_search=types.GoogleSearch())]
),
)
print(response.text)
適合謄本、說明書、合約草稿,但法律判斷需專業確認。
from google import genai
client = genai.Client()
uploaded = client.files.upload(file="property_document.pdf")
response = client.models.generate_content(
model="gemini-3.5-flash",
contents=[uploaded, "請摘要這份文件,並列出缺漏、風險、待查證欄位。"],
)
print(response.text)
這是你房仲商圈工具的核心概念:AI 決定何時呼叫工具。
from google import genai
from google.genai import types
def search_places(address: str, radius_m: int, categories: list[str]) -> dict:
"""實務上可串 Google Maps Places API,這裡先回傳示範資料。"""
return {
"address": address,
"radius_m": radius_m,
"categories": categories,
"results": [
{"name": "示範捷運站", "type": "transit", "distance_m": 520},
{"name": "示範超市", "type": "shopping", "distance_m": 310},
],
}
tool = types.Tool(function_declarations=[
types.FunctionDeclaration(
name="search_places",
description="查詢指定地址半徑內的生活機能。",
parameters=types.Schema(
type=types.Type.OBJECT,
properties={
"address": types.Schema(type=types.Type.STRING),
"radius_m": types.Schema(type=types.Type.INTEGER),
"categories": types.Schema(
type=types.Type.ARRAY,
items=types.Schema(type=types.Type.STRING),
),
},
required=["address", "radius_m", "categories"],
),
)
])
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="查詢高雄市某地址 800 公尺內捷運、便利商店、超市。",
config=types.GenerateContentConfig(tools=[tool]),
)
print(response)
重複問大型文件時省成本。任務結束要刪快取避免持續計費。
from google import genai
from google.genai import types
client = genai.Client()
large_context = """
這裡放大型固定資料,例如公司作業規範、合約範本、物件資料庫說明。
內容要超過該模型的快取最低 token 門檻。
"""
cache = client.caches.create(
model="gemini-3.5-flash",
config=types.CreateCachedContentConfig(
contents=[large_context],
system_instruction="你是房仲行政規範助理,只能根據快取資料回答。",
ttl="7200s",
display_name="real_estate_rules_v1",
),
)
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="請根據規範列出委託書檢查清單。",
config=types.GenerateContentConfig(cached_content=cache.name, temperature=0),
)
print(response.text)
快取是會產生成本的資源,養成檢查習慣。
from google import genai
client = genai.Client()
for c in client.caches.list():
print(c.name, c.display_name, c.expire_time)
# 刪除指定快取,停止儲存費
# client.caches.delete(name="cachedContents/xxxxx")
遇到 429 / 503 常用。
import time, random
from google import genai
from google.api_core.exceptions import ResourceExhausted, ServiceUnavailable
client = genai.Client()
def generate_with_retry(prompt, model="gemini-3.5-flash", max_retries=5):
for attempt in range(max_retries):
try:
return client.models.generate_content(model=model, contents=prompt)
except (ResourceExhausted, ServiceUnavailable) as err:
if attempt == max_retries - 1:
raise err
wait = (2 ** attempt) + random.uniform(0, 1)
print(f"第 {attempt + 1} 次遇到限制,等待 {wait:.2f} 秒後重試")
time.sleep(wait)
print(generate_with_retry("請摘要這段資料").text)
適合前後端 JavaScript 專案,但不要把 API Key 放前端。
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const response = await ai.models.generateContent({
model: "gemini-3.5-flash",
contents: "請用繁體中文寫一段房仲物件摘要。",
});
console.log(response.text);
除錯 API Key、模型 ID、網路時很好用。
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash:generateContent?key=$GEMINI_API_KEY" -H "Content-Type: application/json" -X POST -d '{
"contents": [{
"parts": [{"text": "請用繁體中文說明 Gemini API 的三個用途"}]
}]
}'
直接放 AI Studio Build Mode,先產原型。
Build a full-stack web app for Taiwanese real-estate agents.
Goal: enter a property address and show nearby amenities within 400m or 800m.
Frontend:
- Friendly colorful UI, mobile-first.
- Google Map centered on the address.
- Multi-select filters: MRT/LRT/TRA, restaurants, convenience stores, gas stations, malls, department stores.
Backend:
- Use Google Maps Geocoding API and Places API.
- Return structured JSON.
Gemini:
- Generate a Traditional Chinese lifestyle summary.
Safety:
- Do not publish unverified distances. Mark all generated claims as needing verification.
Explain every file and deployment step in Traditional Chinese.
官方建議新 agentic 專案可評估 Interactions API;穩定生產仍可用 generateContent。
我正在建立新專案,請判斷應使用 generateContent API 還是 Interactions API。
專案需求:{貼上需求}
請比較:
1. 是否需要伺服器端對話歷史
2. 是否需要長時間背景任務
3. 是否需要多步驟工具呼叫與可觀察流程
4. 是否需要 Batch API 或 Explicit Caching
5. Beta 風險是否可接受
最後請給:建議 API、理由、最小可行架構。
Windows 以官方 antigravity.google/cli 的 PowerShell 指令為準。
# macOS / Linux
curl -fsSL https://antigravity.google/cli/install.sh | bash
# 啟動互動模式並登入
agy
# 檢查環境、認證、網路、設定檔
agy doctor
GEMINI.md 可保留;AGENTS.md 可並存。
# 匯入舊 Gemini CLI plugins
agy plugin import gemini
# 工作區 Skills 遷移
mv .gemini/skills/ .agents/skills/
# 驗證
agy doctor
避免代理一開始就大改專案。
請先不要修改任何檔案。
你要先完成:
1. 掃描專案結構
2. 找出與需求相關的檔案
3. 提出修改計畫
4. 列出風險與備份方式
5. 等我確認「可以修改」後,才開始動手
需求:{貼上需求}
放在專案根目錄,讓代理長期讀取。
# Project Overview
This project is a web app for Taiwanese real-estate agents.
It helps summarize listings, nearby amenities, client follow-up, and marketing copy.
# Technical Rules
- Use Traditional Chinese for user-facing UI.
- Keep code beginner-friendly and well commented.
- Do not expose API keys in frontend code.
- Use environment variables or platform secrets.
- Prefer small, reversible changes.
# Safety Rules
- Do not fabricate prices, distances, legal status, or ownership information.
- Mark generated marketing claims as requiring human verification.
- Ask for confirmation before sending emails, deleting data, or publishing ads.
# Output Style
- First show a plan.
- Then list files to change.
- Then provide commands.
- Then explain how to test.
@ 讀檔,! 執行指令;高風險 shell 指令先確認。
# 在對話中引用本地檔案
@src/app.ts 請檢查這個檔案的錯誤與可改善處。
@error.log 請根據錯誤訊息找出可能原因。
# 執行 shell 指令並讓代理讀取結果
!npm test
!npm run build
!git status
!clasp push
你目前用 Cloudflare Pages,正式串 Gemini API 建議放後端/Functions。
# 安裝 Wrangler
npm install -g wrangler
# 登入 Cloudflare
wrangler login
# 設定密鑰:不要放在前端程式碼
wrangler secret put GEMINI_API_KEY
# 部署 Pages 專案(依專案框架調整 build output)
npm run build
wrangler pages deploy dist --project-name your-project-name
Flow / Veo / Gemini Chat 都可用。
請製作 20 秒房屋短影音腳本。
目標:吸引自住買方詢問,但不得誇大。
物件資料:{貼上坪數、格局、地點、總價、特色}
風格:溫暖、明亮、像週末看房小旅行。
請輸出:
1. 5 個鏡頭分鏡
2. 每鏡頭畫面描述
3. 旁白
4. 字幕
5. 音樂方向
6. 禁用/需查證用語
生成後再用 Canva/Figma 加文字,避免 AI 亂寫字。
Create a cheerful, warm, modern social media cover for a Taiwanese real-estate listing.
Style: sunny weekend, friendly, clean layout, soft coral and mint colors.
Include empty space for Traditional Chinese headline text.
Do not add fake logos, fake certificates, or unreadable text.
公開前必跑。
請檢查以下房仲廣告文案是否有誇大、不確定、需查證或可能違規用語。
請輸出表格:原句 / 風險類型 / 為什麼 / 建議改寫 / 是否需要資料佐證。
文案:{貼上文案}
| 情境 | 建議 |
|---|---|
| 事實查核 / JSON / 程式 | Temperature 0~0.2,要求來源或 schema。 |
| 廣告文案 / 標題 | Temperature 0.6~0.9,多生成幾版再人工挑。 |
| 長文件多次問答 | 先 NotebookLM;API 大量重複才考慮 Context Caching。 |
| 要自動執行外部操作 | Function Calling + 人工核准高風險動作。 |
一般穩定產品、明確單次回應,先用 generateContent。若是新 agentic 專案、需要伺服器端歷史、背景任務、可觀察工具步驟,再評估 Interactions API Beta。
Beta 功能與語法可能變動,正式產品需留意官方文件。
Deep Research、NotebookLM、Chat:整理資料、做研究、出報告。
Function Calling:查地圖、寫入表格、產生 JSON、串 CRM。
Antigravity CLI / Computer Use:讀檔、改程式、操作網頁;高風險要先確認。
社群封面、物件特色圖、教學插圖。AI 生成文字容易錯,重要文字後製加上。
先寫腳本與分鏡,再進 Flow / Veo 生成與修改。
用於短影音氣氛,但要避免侵權素材與誤導性語句。
| 素材 | 生成內容 | 人工確認 |
|---|---|---|
| 社群貼文 | 標題、內文、Hashtag、CTA | 價格、坪數、屋況、周邊距離 |
| LINE 私訊 | 開場、追蹤、邀約看房 | 客戶意願與個資使用 |
| 短影音 | 腳本、分鏡、字幕、旁白 | 不得誇大、不得保證收益 |
| 錯誤 | 常見原因 | 修復方式 |
|---|---|---|
| 401 UNAUTHORIZED | API Key 無效、環境變數沒設好 | 重建 Key、檢查 GEMINI_API_KEY、不要把 Key 放前端。 |
| 400 INVALID_ARGUMENT | 模型 ID 錯、schema 錯、快取 token 不足 | 先用最小 cURL 測,再檢查模型與 JSON。 |
| 404 NOT_FOUND | 舊模型停用、快取過期 | 換現役模型 ID;快取加入自動重建。 |
| 429 RESOURCE_EXHAUSTED | RPM / TPM / RPD 超限 | 指數退避、降頻、升級方案、改 Batch。 |
| 503 SERVICE_UNAVAILABLE | 服務繁忙或暫時中斷 | 指數退避重試,查 Google Cloud 狀態頁。 |
本頁以你上傳的 PDF 為主體,並依官方文件與公開資料重新整理 UI、學習流程與指令總庫。官方 API、方案、模型、定價、CLI 時程會變動,正式開發前請用下列來源再次確認。
| 來源 | 連結 | 用途 |
|---|---|---|
| 原始 PDF | Google_Gemini_完全指南_2026-05-30_最終版.pdf | 本網頁主要整理自你上傳的 PDF:生態、模型、NotebookLM、AI Studio、Antigravity CLI、Context Caching、Agent、媒體生成、故障排除。 |
| Gemini API Quickstart | https://ai.google.dev/gemini-api/docs/quickstart | generateContent、串流、多輪、工具使用;官方也提示新專案可評估 Interactions API Beta。 |
| Gemini API Pricing | https://ai.google.dev/gemini-api/docs/pricing | API 定價、模型費率、Grounding 與快取相關費用。 |
| NotebookLM Help | https://support.google.com/notebooklm/answer/16213268 | NotebookLM 方案、上限、功能與地區/方案差異。 |
| Interactions API | https://ai.google.dev/gemini-api/docs/interactions/interactions-overview | 伺服器端歷史、背景任務、Agentic workflow 的 Beta API。 |
| Function Calling | https://ai.google.dev/gemini-api/docs/function-calling | Gemini 連接外部工具與 API 的官方教學。 |
| Structured Output | https://ai.google.dev/gemini-api/docs/structured-output | JSON Schema / Pydantic / Zod 結構化輸出。 |
| Rate Limits | https://ai.google.dev/gemini-api/docs/rate-limits | RPM、TPM、RPD、使用層級與限制說明。 |
| Antigravity CLI transition | https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/ | Gemini CLI 到 Antigravity CLI 遷移與 2026-06-18 個人版時程。 |
最後編排日期:2026-06-12。注意:若某些預覽 / Beta / 地區限定功能在你的帳號未出現,通常與方案、地區、rollout 或官方調整有關。