tool-runtime.ts 454 B

123456789
  1. import { Stream } from "effect"
  2. import { LLMClient } from "../../src/route"
  3. import type { Tools } from "../../src/tool"
  4. import type { RunOptions } from "../../src/tool-runtime"
  5. type CompatRunOptions<T extends Tools> = RunOptions<T> & { readonly maxSteps?: number }
  6. export const runTools = <T extends Tools>(options: CompatRunOptions<T>) =>
  7. LLMClient.stream({ ...options, stopWhen: options.stopWhen ?? LLMClient.stepCountIs(options.maxSteps ?? 10) })