@effect/ai-openai-compat 4.0.0-beta.102 → 4.0.0-beta.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ import * as SchemaTransformation from "effect/SchemaTransformation"
10
10
  import * as String from "effect/String"
11
11
  import * as AiError from "effect/unstable/ai/AiError"
12
12
  import type * as Response from "effect/unstable/ai/Response"
13
+ import type * as Sse from "effect/unstable/encoding/Sse"
13
14
  import type * as HttpClientError from "effect/unstable/http/HttpClientError"
14
15
  import type * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
15
16
  import type * as HttpClientResponse from "effect/unstable/http/HttpClientResponse"
@@ -49,6 +50,17 @@ export const mapSchemaError = dual<
49
50
  reason: AiError.InvalidOutputError.fromSchemaError(error)
50
51
  }))
51
52
 
53
+ /** @internal */
54
+ export const mapSseError = dual<
55
+ (method: string) => (error: Sse.SseError) => AiError.AiError,
56
+ (error: Sse.SseError, method: string) => AiError.AiError
57
+ >(2, (error, method) =>
58
+ AiError.make({
59
+ module: "OpenAiClient",
60
+ method,
61
+ reason: new AiError.InvalidOutputError({ description: error.message })
62
+ }))
63
+
52
64
  /** @internal */
53
65
  export const mapHttpClientError = dual<
54
66
  (method: string) => (error: HttpClientError.HttpClientError) => Effect.Effect<never, AiError.AiError>,