effect-io-ai

Package: @effect/ai-openai
Module: OpenAiClient

OpenAiClient.withWebSocketMode

Uses OpenAI’s WebSocket mode for response streams within the provided effect.

When to use

Use to enable WebSocket mode around one effect that creates OpenAI response streams.

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 withWebSocketMode: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, OpenAiSocket | ResponseIdTracker.ResponseIdTracker> | OpenAiClient | Socket.WebSocketConstructor>

Source

Since v4.0.0