Skip to content

Commit 5a8c79e

Browse files
feat: mention keep alive in migration guide (deepgram#594)
* feat: mention keep alive in migration guide * Update Migrating-v3-to-v5.md --------- Co-authored-by: Luke Oliff <luke@lukeoliff.com>
1 parent 09550c7 commit 5a8c79e

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

docs/Migrating-v3-to-v5.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This guide helps you migrate from Deepgram Python SDK v3+ (versions 3.0.0 to 4.8
1616
- [Models V1](#models-v1)
1717
- [Manage V1](#manage-v1)
1818
- [Self-Hosted V1](#self-hosted-v1)
19+
- [Keep Alive Functionality](#websocket-keep-alive-functionality)
1920
- [Breaking Changes Summary](#breaking-changes-summary)
2021

2122
## Installation
@@ -860,15 +861,45 @@ response = client.self_hosted.v1.distribution_credentials.delete(
860861
)
861862
```
862863

864+
## WebSocket Keep Alive Functionality
865+
866+
**v3+ (3.0.0 - 4.8.1)**
867+
868+
```python
869+
# Keep alive was passed as a config option
870+
config = DeepgramClientOptions(
871+
options={"keepalive": "true"}
872+
)
873+
deepgram = DeepgramClient(API_KEY, config)
874+
```
875+
876+
**v5.0.0**
877+
878+
```python
879+
# Keep alive is now manually managed via control messages.
880+
from deepgram.extensions.types.sockets import ListenV1ControlMessage, AgentV1ControlMessage
881+
882+
# For Listen V1 connections
883+
with client.listen.v1.connect(model="nova-3") as connection:
884+
# Send keep alive message
885+
connection.send_control(ListenV1ControlMessage(type="KeepAlive"))
886+
887+
# For Agent V1 connections
888+
with client.agent.v1.connect() as agent:
889+
# Send keep alive message
890+
agent.send_control(AgentV1ControlMessage(type="KeepAlive"))
891+
```
892+
863893
## Breaking Changes Summary
864894

865895
### Major Changes
866896

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

873904
### Removed Features
874905

@@ -893,5 +924,6 @@ response = client.self_hosted.v1.distribution_credentials.delete(
893924
- [ ] Replace API key configuration with new authentication methods
894925
- [ ] Update all API method calls to new structure
895926
- [ ] Migrate WebSocket connections to new context manager pattern
927+
- [ ] Update WebSocket keep alive implementation
896928
- [ ] Update error handling for new exception types
897929
- [ ] Test all functionality with new API structure

0 commit comments

Comments
 (0)