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.
注目すべき暗黙の制約は次の3点だ。質問では「チャーン」の定義がない(アカウント閉鎖か?ログインなし?購入なし?)。機能 X に無関心であること以外の交絡をどう制御するかが指定されていない(低エンゲージメントのユーザーは機能 X と無関係な理由でチャーンする)。そしてベースライン比較群が確立されていない。慎重なプランナーなら、ステップを列挙する前にこれら3点を表面化させるはずだ。
Claude Sonnet 4.6。 文字通り「最も思慮深い」計画を出力することが多い——他の2モデルが挙げない配慮が盛り込まれる。この種の問いでは、Claude は相関と因果の方法論的な問題を指摘し、「機能 X を使っていない」こと自体がチャーンの結果であって原因ではない可能性に言及し、明示されていないが慎重なアナリストなら気づくべき制約を明確にする。一方で、計画が必要以上に長くなったり、個々のステップが実際の問いに対して過剰設計になることがある。このパターンは他でも一貫しており——専門家レベルの配慮、時にタスクに必要な以上の丁寧さ——という Claude の振る舞いに一致する。
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.
GPT-5.5。 最も入念に作り込まれたコードになることが多い。4つのエッジケースに明示的な分岐で対応し、型ヒントは精密(返り値のエッジケースに Optional や Union を用いることも)で、例示を含む docstring が付く。実装は概ね当然のアルゴリズム——ソート、走査、最大ギャップの追跡——を選び、正しい。知っておくべき点として、プロンプトで関数のみを求めていても、GPT-5.5 はユニットテストや使用例を付けがちだ。オペレーション実務志向のモデルのトレードオフで、頼んでいなくても必要そうなものを足してくる。
Claude Sonnet 4.6。 最も可読性の高いコードになることが多い。関数は簡潔で、エッジケースは先頭のガード節パターンで処理し、型ヒントは正確かつ最小限。プロンプトが判断を委ねた点について、思慮深いコメントを添えることがある——例えば重複タイムスタンプは長さゼロのギャップとして扱う、といった説明。これはプロンプトに明示されていないが妥当な判断だ。Claude は GPT-5.5 よりも「テスト不要」という制約を守る傾向が強い。関数自体は最も保守しやすい。コード品質の評価における Claude の評判——クリーン、慣用的、熟練者らしい——と一致する。