Prompt<Input, Output> class
final
A defined prompt that can render, generate, and stream.
It acts as a callable that invokes generate with the rendered prompt
template, and also provides .render() and .stream() methods.
Output is the parsed structured output type: (await prompt(input)).output
is an Output?. It is inferred from outputSchema at definition, and is
dynamic for a prompt defined without one.
Properties
Methods
-
call<
CustomOptions> (Input? input, {List< Message> ? messages, ModelRef<CustomOptions> ? model, CustomOptions? config, List<Tool> ? tools, List<String> ? toolNames, ToolChoice? toolChoice, bool? returnToolRequests, int? maxTurns, GenerateActionOutputConfig? output, Map<String, dynamic> ? context, List<GenerateMiddlewareRef> ? use, CancellationToken? cancel}) → Future<GenerateResult< Output> > - Generates a response by rendering the prompt and calling the model.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render<
CustomOptions> (Input? input, {List< Message> ? messages, ModelRef<CustomOptions> ? model, CustomOptions? config, List<Tool> ? tools, List<String> ? toolNames, ToolChoice? toolChoice, bool? returnToolRequests, int? maxTurns, GenerateActionOutputConfig? output, List<GenerateMiddlewareRef> ? use}) → Future<GenerateActionOptions> -
Renders the prompt template with the given input, producing
GenerateActionOptions suitable for the
generateaction. -
stream<
CustomOptions> (Input? input, {List< Message> ? messages, ModelRef<CustomOptions> ? model, CustomOptions? config, List<Tool> ? tools, List<String> ? toolNames, ToolChoice? toolChoice, bool? returnToolRequests, int? maxTurns, GenerateActionOutputConfig? output, Map<String, dynamic> ? context, List<GenerateMiddlewareRef> ? use, CancellationToken? cancel}) → ActionStream<GenerateResponseChunk< Output> , GenerateResult<Output> > - Streams a response by rendering the prompt and calling the model.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited