-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti_model.py
More file actions
47 lines (36 loc) · 1.31 KB
/
multi_model.py
File metadata and controls
47 lines (36 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
"""
Multi-model comparison - compare responses from different models.
Demonstrates how to query multiple models with the same prompt.
"""
import asyncio
from copilot import CopilotClient
async def query_model(client: CopilotClient, model: str, prompt: str) -> str:
"""Query a single model and return the complete response."""
session = await client.create_session({"model": model})
response = await session.send_and_wait({"prompt": prompt})
result = response.data.content
await session.destroy()
return result
async def main():
"""Compare responses from different models."""
models = ["gpt-4.1", "gpt-5-mini"]
prompt = "Explain the single responsibility principle in software design in 2-3 sentences."
print("🔄 Multi-Model Comparison\n")
print(f"📝 Prompt: {prompt}\n")
print("=" * 80 + "\n")
client = CopilotClient()
await client.start()
try:
# Query each model
for model in models:
print(f"🤖 Model: {model}")
print("-" * 80)
response = await query_model(client, model, prompt)
print(response)
print("\n" + "=" * 80 + "\n")
finally:
await client.stop()
print("✅ Comparison complete!")
if __name__ == "__main__":
asyncio.run(main())