forked from github/copilot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (20 loc) · 753 Bytes
/
Copy pathmain.py
File metadata and controls
28 lines (20 loc) · 753 Bytes
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
import asyncio
import os
from copilot import CopilotClient
async def main():
opts = {"github_token": os.environ.get("GITHUB_TOKEN")}
if os.environ.get("COPILOT_CLI_PATH"):
opts["cli_path"] = os.environ["COPILOT_CLI_PATH"]
client = CopilotClient(opts)
try:
session = await client.create_session({
"model": "claude-haiku-4.5",
})
response = await session.send_and_wait({"prompt": "Use the grep tool to search for the word 'SDK' in README.md and show the matching lines."})
if response:
print(f"Response: {response.data.content}")
print("Default mode test complete")
await session.destroy()
finally:
await client.stop()
asyncio.run(main())