(layer: Layer.Layer<LLM.Service>, input: LLM.StreamInput)
| 60 | // drainWith builds an isolated runtime so custom replacements fully own LLM and |
| 61 | // its transitive deps. |
| 62 | const drainWith = (layer: Layer.Layer<LLM.Service>, input: LLM.StreamInput) => |
| 63 | Effect.gen(function* () { |
| 64 | const ctx = yield* InstanceRef |
| 65 | if (!ctx) return yield* Effect.die("InstanceRef not provided") |
| 66 | return yield* Effect.promise(() => |
| 67 | Effect.runPromise( |
| 68 | LLM.Service.use((svc) => svc.stream(input).pipe(Stream.runDrain)).pipe( |
| 69 | Effect.provide(layer), |
| 70 | Effect.provideService(InstanceRef, ctx), |
| 71 | ), |
| 72 | ), |
| 73 | ) |
| 74 | }) |
| 75 | |
| 76 | function llmLayerWithExecutor( |
| 77 | options: { |
no test coverage detected