Skip to Content
模型用法GPT-6 Luna

GPT-6 Luna

OpenAI 的 GPT-6 Luna 既是對話模型,也支援透過 Decisions API 進行類型化判斷。判斷模式的用法與 Jev 相同:請求中提供待判斷的內容與一組問題,模型為每個問題返回結構化答案及其機率。與 Jev 相比,GPT-6 Luna 支援圖片輸入。

本頁介紹 GPT-6 Luna 的判斷用法。對話用法請見 GPT 系列。

與 Jev 的選擇

重點需要對圖片進行判斷時,使用 GPT-6 Luna;僅處理文字或 JSON 且對回應速度要求較高時,使用 Jev。
GPT-6 LunaJev
模型 IDopenai/gpt-6-lunatypesafe/jev-latest
輸入文字、圖片文字、JSON
問題類型predicate、choice、scorepredicate、choice、score
呼叫路徑/v1/decisions、/openai/v1/decisions、/typesafe/v1/systemone同左
單次耗時(實測)約 0.5 秒(首次請求可能需要約 2.5 秒)約 0.3 秒

同一組問題在兩個模型上的判斷結果基本一致:實測同一筆退款工單,兩者均判定為退款申請並分派給 billing。

快速開始

接入資訊
Base URLhttps://api.ofox.ai/v1
模型 IDopenai/gpt-6-luna
介面路徑/v1/decisionsPOST

使用 OpenAI 官方 Python SDK 呼叫時,需安裝包含 client.decisions 的版本(pip install -U openai,實測 3.31.0 可用)。API Key 的建立方式請見 Jev · 快速開始。

luna_text.py
import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) r = client.decisions.create( model="openai/gpt-6-luna", input="Customer message: I was charged twice and need a refund today.", questions=[ {"type": "predicate", "name": "refund", "instructions": "Is the customer asking for a refund?"}, { "type": "choice", "name": "team", "instructions": "Which team should handle this ticket?", "choices": [ {"value": "billing", "description": "Charges, invoices, refunds"}, {"value": "technical", "description": "Outages, errors, integration issues"}, {"value": "other", "description": "None of the above"}, ], }, ], ) refund, team = r.answers print(refund.probability, team.choice, team.confidence)

輸出:

1.0 billing 1.0

圖片判斷

傳入圖片時,input 需使用訊息陣列,在 content 中以 input_image 傳入圖片,圖片使用 base64 data URL。可同時傳入一段 input_text 說明圖片來源。

luna_image.py
import base64 import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) with open("product.jpg", "rb") as f: image = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode() r = client.decisions.create( model="openai/gpt-6-luna", input=[{ "role": "user", "content": [ {"type": "input_text", "text": "Product image uploaded by a user"}, {"type": "input_image", "image_url": image}, ], }], questions=[ {"type": "predicate", "name": "has_text", "instructions": "Does the image contain any text?"}, { "type": "choice", "name": "shape", "instructions": "What shape is on the left side of the image?", "choices": [{"value": "circle"}, {"value": "square"}, {"value": "triangle"}, {"value": "other"}], }, ], ) for a in r.answers: print(a.name, getattr(a, "probability", None) or a.choice) print(r.usage.prompt_tokens)

輸出:

has_text 1.0 shape circle 538

範例圖片為白底上的紅色圓形、藍色方形與一行文字,兩個問題均判斷正確。欄位定義請見 Decisions API · 輸入格式。

問題設計與上線準備

Jev 文件中的以下內容同樣適用於 GPT-6 Luna:

  • 問題設計:選項應涵蓋全部情況、為選項撰寫描述、為問題設定 name,以及返回欄位的含義。
  • 上線準備:使用人工標註樣本設定置信度門檻、將多個問題合併到同一請求。

計費

判斷模式與對話模式分別計費,判斷模式的單價請見模型頁 。實測判斷請求返回的 usage 僅包含 prompt_tokens(含圖片部分),不包含 completion_tokens。

常見錯誤

錯誤訊息與處理方法請見 Jev · 常見錯誤 與 Decisions API · 常見錯誤。其中與 Jev 圖片輸入相關的錯誤不適用於 GPT-6 Luna。

官方文件

常見問題

GPT-6 Luna 的判斷模式與對話模式有何區別?

判斷模式透過 /v1/decisions 呼叫,僅在給定的選項和級別內作答,並返回機率與置信度;對話模式透過 /v1/chat/completions 或 /v1/responses 呼叫,生成文字回答。兩種模式分別計費。

何時選擇 GPT-6 Luna,何時選擇 Jev?

需要對圖片進行判斷時選擇 GPT-6 Luna;僅處理文字或 JSON 且對回應速度要求較高時選擇 Jev。兩者的請求格式與問題類型相同,切換時僅需修改 model。

是否可以使用 TypeSafe SDK 呼叫 GPT-6 Luna?

可以。實測 /typesafe/v1/systemone 與 /openai/v1/decisions 均可呼叫 openai/gpt-6-luna,呼叫方式與 Jev 相同。

最後更新於