from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["COMET_API_KEY"], # or replace with your API key
base_url="https://api.cometapi.com/v1", # one endpoint, multiple models
)
MODELS = [
"gpt-5.5",
"claude-sonnet-4-6",
"gemini-3.1-pro",
]
def run_comparison(prompt: str, temperature: float = 0.3) -> dict[str, str]:
"""
Send the same prompt to all three models and return their responses.
"""
responses = {}
for model in MODELS:
result = client.chat.completions.create(
model=model,
messages=[
{
"role": "user",
"content": prompt,
}
],
temperature=temperature,
)
responses[model] = result.choices[0].message.content
return responses
# Example usage
if __name__ == "__main__":
prompt = "Summarise the key risks in this contract."
outputs = run_comparison(prompt)
for model, response in outputs.items():
print(f"\n--- {model} ---")
print(response)
You are processing customer support emails. Extract the followingseven fields from the email below into a JSON object with exactlythese keys: - customer_name (string)- order_id (string)- issue_type (one of: "shipping", "product_quality", "billing", "returns", "other")- urgency (one of: "low", "medium", "high")- requested_action (string)- affected_product (string)- escalation_history (any prior contact about this issue, if mentioned)
Email:---Hi there, I'm writing about order #FT-2289334 from last Tuesday. The Cascadehiking boots I received are NOT the size 11 I ordered — they'reclearly size 10 (I can see the label inside). I have a guided trekbooked in 5 days and I genuinely don't know what to do. I've beena customer for years and this is the first time something likethis has happened. Can you sort this out urgently? I'd prefer a same-day exchange ifat all possible. I'm in Manchester. Margaret W.--- Return only the JSON object. No commentary, no markdown code fences.
I'm trying to answer this research question for my team: "Is our customer churn rate higher among users who haven't usedfeature X in the last 30 days?" Produce a plan for how to investigate this. The plan should:- Identify the steps required- Sequence them with dependencies- Be actionable for a data analyst on my team Return the plan in clear, structured form.
值得注意的隱含約束:題目並未定義「流失」的意義(帳號關閉?沒有登入?沒有購買?)、沒有指定如何控制混雜變量(低參與用戶流失的原因很多,未必與 feature X 相關),也沒有建立基準比較組。謹慎的規劃者應該在給出步驟前先指出這三點。
Claude Sonnet 4.6。通常產出最「深思」的計劃,字面意義上——Claude 的計劃裡常包含其他兩個模型沒提到的考量。針對這題,Claude 可能會指出「相關 vs 因果」的方法學問題,提醒「未使用 feature X」本身可能是流失的徵兆而非原因,並明確標出未被說出的限制,這些是謹慎的分析師應該注意的。代價是:計劃可能比所需更長,個別步驟有時為實際問題過度設計。這與 Claude 在其他場景的行為一致——專家級謹慎,有時超出任務所需。
Gemini 3.1 Pro。通常產出結構最清晰、依賴關係最明白的計劃。推理品質高——Gemini 能穩定識別隱含約束,把問題拆解為可辯護的序列,並產生實際可執行的步驟說明。缺點是:讀起來略顯機械。它完成任務,但較少提出 Claude 會強調的方法學細節,也不太會像 GPT-5.5 那樣提示平行化。這與 Gemini 更廣泛的模式相符——推理強,周邊判斷更「工匠式」。
Write a Python function that takes a list of timestamped events andreturns the longest gap (in seconds) between consecutive events. Requirements:- Function signature: longest_gap(events: list[datetime]) -> float- Handle these edge cases: 1. Empty list (return 0.0 or raise — your choice, but be consistent) 2. Single event 3. Duplicate timestamps 4. Unsorted input- Use only the standard library- Include type hints- Return just the function. No tests or usage examples.
Claude Sonnet 4.6。通常產出可讀性最好的程式碼。函式精簡,在頂部以整潔的守衛式子句處理邊界情況,型別註記準確而最小化。Claude 常會加上一段思考性註解來說明提示沒講清的判斷——例如對重複時間戳,將其視為零長度間隔並說明理由,這是提示未指定但可辯護的選擇。Claude 遵守「不要測試」的限制,通常比 GPT-5.5 更可靠。就函式本身而言,是三者中最易維護的。這與 Claude 在程式碼品質上的口碑一致:乾淨、慣用、帶有專家手感。