Skip to content
Merged
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
36 changes: 34 additions & 2 deletions docs/Migrating-v3-to-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This guide helps you migrate from Deepgram Python SDK v3+ (versions 3.0.0 to 4.8
- [Models V1](#models-v1)
- [Manage V1](#manage-v1)
- [Self-Hosted V1](#self-hosted-v1)
- [Keep Alive Functionality](#websocket-keep-alive-functionality)
- [Breaking Changes Summary](#breaking-changes-summary)

## Installation
Expand Down Expand Up @@ -857,15 +858,45 @@ response = client.self_hosted.v1.distribution_credentials.delete(
)
```

## WebSocket Keep Alive Functionality

**v3+ (3.0.0 - 4.8.1)**

```python
# Keep alive was passed as a config option
config = DeepgramClientOptions(
options={"keepalive": "true"}
)
deepgram = DeepgramClient(API_KEY, config)
```

**v5.0.0**

```python
# Keep alive is now manually managed via control messages.
from deepgram.extensions.types.sockets import ListenV1ControlMessage, AgentV1ControlMessage

# For Listen V1 connections
with client.listen.v1.connect(model="nova-3") as connection:
# Send keep alive message
connection.send_control(ListenV1ControlMessage(type="KeepAlive"))

# For Agent V1 connections
with client.agent.v1.connect() as agent:
# Send keep alive message
agent.send_control(AgentV1ControlMessage(type="KeepAlive"))
```

## Breaking Changes Summary

### Major Changes

1. **Authentication**: New access token support with environment variable `DEEPGRAM_TOKEN`
2. **API structure**: Flattened method names and cleaner parameter passing
3. **WebSocket API**: Complete redesign with context managers and typed message objects
4. **Type safety**: Enhanced type annotations and response objects
5. **Error handling**: Improved error types and handling
4. **WebSocket Keep Alive**: Managed via control messages, no longer an automatic thing via config
5. **Type safety**: Enhanced type annotations and response objects
6. **Error handling**: Improved error types and handling

### Removed Features

Expand All @@ -890,5 +921,6 @@ response = client.self_hosted.v1.distribution_credentials.delete(
- [ ] Replace API key configuration with new authentication methods
- [ ] Update all API method calls to new structure
- [ ] Migrate WebSocket connections to new context manager pattern
- [ ] Update WebSocket keep alive implementation
- [ ] Update error handling for new exception types
- [ ] Test all functionality with new API structure