effect-io-ai

Package: @effect/ai-openai
Module: OpenAiClient

OpenAiClient.layerWebSocketMode

Uses OpenAI’s websocket mode for all responses that use the Layer.

When to use

Use to provide WebSocket mode through layer composition for effects that use OpenAI response streaming.

Gotchas

This only works with the following WebSocket constructor layers:

These constructor layers support the non-standard options needed to set the Authorization header.

See

Signature

declare const layerWebSocketMode: Layer.Layer<OpenAiSocket | ResponseIdTracker.ResponseIdTracker, never, OpenAiClient | Socket.WebSocketConstructor>

Source

Since v4.0.0