github Effect-TS/effect @effect/ai-openai@4.1.0

Minor Changes

  • #8829 3c42058 Thanks @effect-bot! - Remove AiError.HttpRequestDetails and Response.HttpRequestDetails, so AI errors and response metadata no longer carry request headers or query parameters. AiError.NetworkError records the request as method and url fields instead of request, and the request field is gone from AiError.HttpContext and Response.ResponseMetadataPart.

Patch Changes

  • #8829 7ea1ea2 Thanks @wmaurer! - Add an optional cause to the AI NetworkError. It holds the HttpClientError the request failed with, stored unchanged and not redacted, so the reason a request failed is no longer lost. The new NetworkError.fromHttpClientError sets it, and all AI providers now use it. NetworkError.fromRequestError is unchanged.

  • #8829 3f8f359 Thanks @jem-computer! - Declare decision images as input fields with Decision.Image, and add Decision.locate, which answers with a bounding box around one target in an image field.

    • DecideOptions.images is removed. Add Decision.Image fields to the input schema and refer to each image by its path in instructions:

      // Before
      DecisionModel.decide(Triage, { input: "Checkout error", images: [screenshot] })
      // After
      const Triage = Decision.make({
        input: Schema.Struct({ report: Schema.String, screenshot: Decision.Image }),
        decisions
      })
      DecisionModel.decide(Triage, { input: { report: "Checkout error", screenshot } })
    • Custom providers receive images as { reference, path, image }, with each image replaced by its reference in state and its data as a base64 string or URL.

    • Decision.locate({ image: "photo", instructions }) takes a path that Decision.make checks against the input's image fields. Providers opt in with supportsLocate: true. Decision.Any and DecisionModel.ProviderAnswer gain locate variants, so exhaustive switches over them need a Locate case.

    • TypeSafeDecisionModel supports images, sent as assets keyed by reference, and sends locate decisions as Box questions, which need jev-preview or jev-1.14.0. OpenAI and Cloudflare label each image with its reference.

  • #10087 472c469 Thanks @effect-bot! - Node.js 22.19.0 (required by undici 8) is now the minimum for @effect/platform-node, @effect/platform-node-shared, @effect/opentelemetry and @effect/docgen, up from 18.

    NodeSocket WebSocket clients now use Node's global WebSocket instead of ws, so client-only usage no longer bundles ws.

    Breaking: ws moved to a new NodeWS module.

    • NodeSocket.NodeWS and BunSocket.NodeWS are removed. Import NodeWS from @effect/platform-node or @effect/platform-node-shared (on Bun, import ws directly). Use NodeWS.WebSocket in place of NodeSocket.NodeWS.default.
    • NodeSocket.layerWebSocketConstructorWS is removed. Use NodeWS.layerWebSocketConstructor.

    Behaviour changes for clients that pass handshake headers, which previously used ws. Use NodeWS.layerWebSocketConstructor to keep the old behaviour:

    • Reads cannot be paused. Incoming frames are buffered without limit, and a configured highWaterMark fails the socket with a SocketReadError.
    • Connection errors are a generic ErrorEvent, so SocketOpenError causes lack the underlying error code.
    • The Socket.WebSocket service is a global WebSocket, so ws instanceof checks and ws-only methods such as terminate() and ping() no longer apply.
    • A custom Host header is ignored.
    • Outgoing messages are not compressed. Incoming permessage-deflate messages are still decompressed.
    • Connections use undici's global dispatcher instead of http.globalAgent / https.globalAgent.
  • Updated dependencies [631d4f4, 7ea1ea2, a2ccc14, ed20129, 20795b9, a8e5e6c, c4d298d, fb5dbee, 8309b94, ac10e55, af23904, df8dce5, 0c24a8f, 468c6ee, 2d1fcd4, 8f23668, 3f8f359, fe6b748, 2a03584, 40e145e, 7217410, cf249fe, 4f0fad1, e75708c, 7890077, c4a00fc, f74db37, 069cf72, 9a07ebc, f40dc4e, fa516c6, ffd9237, 93895b9, 8938b19, e5a1479, 89e1e1e, eda0960, 65db606, 7c42335, cb21d14, 89e1e1e, c32eb78, be9895b, 26b4bfe, e19c611, f97711f, 4f16778, d2b6bc7, 8e668fe, ce9e999, 3d88452, 3c42058, 2ae4045, e853fa1, 6dc3f7c, 1513bbd, c065ed7, 1194a4c, 2cb498e, 89e5443, 2a9a425, e710bbb, b0d6e75, 32b3570, 9f93f4f, 27370c7]:

    • effect@4.1.0

Don't miss a new effect release

NewReleases is sending notifications on new releases.