tool-runtime.ts 422 B

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