Package: @effect/ai-openai
Module: OpenAiClient
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:
NodeSocket.layerWebSocketConstructorWSBunSocket.layerWebSocketConstructorThese constructor layers support the non-standard options needed to set the Authorization header.
See
layerWebSocketMode for providing WebSocket mode through a layerOpenAiSocket for direct access to the WebSocket-backed streaming serviceSignature
declare const withWebSocketMode: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, OpenAiSocket | ResponseIdTracker.ResponseIdTracker> | OpenAiClient | Socket.WebSocketConstructor>
Since v4.0.0