Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,18 @@ Create `main.py`:

```python
import asyncio
from copilot import CopilotClient
from copilot import CopilotClient, PermissionHandler

async def main():
client = CopilotClient()
await client.start()

session = await client.create_session({"model": "gpt-4.1"})
response = await session.send_and_wait({"prompt": "What is 2 + 2?"})
session = await client.create_session({
"model": "gpt-4.1",
"on_permission_request": PermissionHandler.approve_all,
})

response = await session.send_and_wait({"prompt": "What is 2 + 2?"})
print(response.data.content)

await client.stop()
Expand Down Expand Up @@ -274,7 +277,7 @@ Update `main.py`:
```python
import asyncio
import sys
from copilot import CopilotClient
from copilot import CopilotClient, PermissionHandler
from copilot.generated.session_events import SessionEventType

async def main():
Expand All @@ -283,6 +286,7 @@ async def main():

session = await client.create_session({
"model": "gpt-4.1",
"on_permission_request": PermissionHandler.approve_all,
"streaming": True,
})

Expand Down Expand Up @@ -653,7 +657,7 @@ Update `main.py`:
import asyncio
import random
import sys
from copilot import CopilotClient
from copilot import CopilotClient, PermissionHandler
from copilot.tools import define_tool
from copilot.generated.session_events import SessionEventType
from pydantic import BaseModel, Field
Expand All @@ -678,6 +682,7 @@ async def main():

session = await client.create_session({
"model": "gpt-4.1",
"on_permission_request": PermissionHandler.approve_all,
"streaming": True,
"tools": [get_weather],
})
Expand Down Expand Up @@ -925,7 +930,7 @@ Create `weather_assistant.py`:
import asyncio
import random
import sys
from copilot import CopilotClient
from copilot import CopilotClient, PermissionHandler
from copilot.tools import define_tool
from copilot.generated.session_events import SessionEventType
from pydantic import BaseModel, Field
Expand All @@ -947,6 +952,7 @@ async def main():

session = await client.create_session({
"model": "gpt-4.1",
"on_permission_request": PermissionHandler.approve_all,
"streaming": True,
"tools": [get_weather],
})
Expand Down