Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"cliVersion": "3.37.5",
"cliVersion": "3.51.3",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "4.46.14",
"generatorVersion": "4.53.0",
"generatorConfig": {
"client": {
"class_name": "BaseClient",
Expand All @@ -13,5 +13,5 @@
"should_generate_websocket_clients": true,
"enable_wire_tests": true
},
"sdkVersion": "6.0.0-beta.3"
"sdkVersion": "5.3.2"
}
57 changes: 0 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Power your apps with world-class speech and Language AI models
- [Async Client](#async-client)
- [Exception Handling](#exception-handling)
- [Advanced Features](#advanced-features)
- [Websockets](#websockets)
- [Advanced](#advanced)
- [Access Raw Response Data](#access-raw-response-data)
- [Retries](#retries)
Expand Down Expand Up @@ -206,62 +205,6 @@ response = client.listen.v1.media.transcribe_file(
)
```

## Websockets

The SDK supports both sync and async websocket connections for real-time, low-latency communication. Sockets can be created using the `connect` method, which returns a context manager.
You can either iterate through the returned `SocketClient` to process messages as they arrive, or attach handlers to respond to specific events.

```python

# Connect to the websocket (Sync)
import threading

from deepgram import DeepgramClient

client = DeepgramClient(...)

with client.v1.connect() as socket:
# Iterate over the messages as they arrive
for message in socket
print(message)

# Or, attach handlers to specific events
socket.on(EventType.OPEN, lambda _: print("open"))
socket.on(EventType.MESSAGE, lambda message: print("received message", message))
socket.on(EventType.CLOSE, lambda _: print("close"))
socket.on(EventType.ERROR, lambda error: print("error", error))


# Start the listening loop in a background thread
listener_thread = threading.Thread(target=socket.start_listening, daemon=True)
listener_thread.start()
```

```python

# Connect to the websocket (Async)
import asyncio

from deepgram import AsyncDeepgramClient

client = AsyncDeepgramClient(...)

async with client.v1.connect() as socket:
# Iterate over the messages as they arrive
async for message in socket
print(message)

# Or, attach handlers to specific events
socket.on(EventType.OPEN, lambda _: print("open"))
socket.on(EventType.MESSAGE, lambda message: print("received message", message))
socket.on(EventType.CLOSE, lambda _: print("close"))
socket.on(EventType.ERROR, lambda error: print("error", error))


# Start listening for events in an asyncio task
listen_task = asyncio.create_task(socket.start_listening())
```

## Advanced

### Access Raw Response Data
Expand Down
31 changes: 31 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Proxy Feature — Required Changes to Existing Files

These changes are needed in Fern-generated or config files that aren't modified
by the proxy implementation itself.

## pyproject.toml

Add PyJWT as an optional dependency and create the `proxy` extra:

```toml
[tool.poetry.dependencies]
# ... existing deps ...
PyJWT = {version = ">=2.0.0", optional = true}

[tool.poetry.extras]
proxy = ["PyJWT"]
```

This allows users to install with:
```
pip install "deepgram-sdk[proxy]"
```

## Optional runtime dependencies (not in pyproject.toml)

These are NOT added as project dependencies — users install them directly:

- **websockets** — required for WebSocket proxying
- **fastapi** — for the FastAPI adapter
- **flask** / **flask-sock** — for the Flask adapter (flask-sock for WS)
- **django** / **channels** — for the Django adapter (channels for WS)
103 changes: 4 additions & 99 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]

[tool.poetry]
name = "deepgram-sdk"
version = "6.0.0-beta.3"
version = "5.3.2"
description = ""
readme = "README.md"
authors = []
Expand Down Expand Up @@ -41,7 +41,6 @@ httpx = ">=0.21.2"
pydantic = ">= 1.9.2"
pydantic-core = ">=2.18.2"
typing_extensions = ">= 4.0.0"
websockets = ">=12.0"

[tool.poetry.group.dev.dependencies]
mypy = "==1.13.0"
Expand Down
Loading
Loading