gateway.ts 454 B

123456789101112131415
  1. import { Effect } from "effect"
  2. import { PluginV2 } from "../../plugin"
  3. export const GatewayPlugin = PluginV2.define({
  4. id: PluginV2.ID.make("gateway"),
  5. effect: Effect.gen(function* () {
  6. return {
  7. "aisdk.sdk": Effect.fn(function* (evt) {
  8. if (evt.package !== "@ai-sdk/gateway") return
  9. const mod = yield* Effect.promise(() => import("@ai-sdk/gateway"))
  10. evt.sdk = mod.createGateway(evt.options)
  11. }),
  12. }
  13. }),
  14. })