runRaw method

Future<RunResult<Output>> runRaw(
  1. dynamic input, {
  2. StreamingCallback<Chunk>? onChunk,
  3. Map<String, dynamic>? context,
  4. Stream<Input>? inputStream,
  5. dynamic init,
  6. TraceStartCallback? onTraceStart,
  7. CancellationToken? cancel,
})

Implementation

Future<RunResult<Output>> runRaw(
  dynamic input, {
  StreamingCallback<Chunk>? onChunk,
  Map<String, dynamic>? context,
  Stream<Input>? inputStream,
  dynamic init,
  TraceStartCallback? onTraceStart,
  CancellationToken? cancel,
}) async {
  return await run(
    inputSchema != null ? inputSchema!.parse(input) : input as Input?,
    onChunk: onChunk,
    context: context,
    inputStream: inputStream,
    cancel: cancel,
    // Skip validation when no init was supplied. `init` is optional on the
    // first request (e.g. an agent's fresh session sends no init), so a null
    // value must pass through untouched rather than be validated against a
    // non-nullable init schema. Mirrors the Go core's `isNilValue(init)`
    // guard and JS's convention of only validating a present init.
    init: (initSchema != null && init != null)
        ? initSchema!.parse(init)
        : init as Init?,
    onTraceStart: onTraceStart,
  );
}