Skip to content

PrepareStepContext

Namespace: Vercel.AI

public sealed class PrepareStepContext

Context passed to prepareStep.

Inheritance: object

View source

PrepareStepContext(int, IReadOnlyList<StepResult>)

Section titled “PrepareStepContext(int, IReadOnlyList<StepResult>)”
public PrepareStepContext(int stepNumber, IReadOnlyList<StepResult> steps)

Creates context.

Parameters

Name Type Description
stepNumber int
steps IReadOnlyList<StepResult>

View source

PrepareStepContext(int, IReadOnlyList<StepResult>, IReadOnlyList<ModelMessage>, ILanguageModel)

Section titled “PrepareStepContext(int, IReadOnlyList<StepResult>, IReadOnlyList<ModelMessage>, ILanguageModel)”
public PrepareStepContext(int stepNumber, IReadOnlyList<StepResult> steps, IReadOnlyList<ModelMessage> messages, ILanguageModel model)

Creates context with the prompt and model the step is about to use.

Parameters

Name Type Description
stepNumber int
steps IReadOnlyList<StepResult>
messages IReadOnlyList<ModelMessage>
model ILanguageModel

View source

PrepareStepContext(int, IReadOnlyList<StepResult>, IReadOnlyList<ModelMessage>, ILanguageModel, Instructions?, Instructions?, IReadOnlyList<ModelMessage>, IReadOnlyList<ModelMessage>)

Section titled “PrepareStepContext(int, IReadOnlyList<StepResult>, IReadOnlyList<ModelMessage>, ILanguageModel, Instructions?, Instructions?, IReadOnlyList<ModelMessage>, IReadOnlyList<ModelMessage>)”
public PrepareStepContext(int stepNumber, IReadOnlyList<StepResult> steps, IReadOnlyList<ModelMessage> messages, ILanguageModel model, Instructions? instructions, Instructions? initialInstructions, IReadOnlyList<ModelMessage> initialMessages, IReadOnlyList<ModelMessage> responseMessages)

Creates context with the instructions and the initial and response messages of the call.

Parameters

Name Type Description
stepNumber int
steps IReadOnlyList<StepResult>
messages IReadOnlyList<ModelMessage>
model ILanguageModel
instructions Instructions
initialInstructions Instructions
initialMessages IReadOnlyList<ModelMessage>
responseMessages IReadOnlyList<ModelMessage>

View source

public Instructions? InitialInstructions { get; }

The instructions the call started with. Null when there are none.

Value: Instructions

View source

public IReadOnlyList<ModelMessage> InitialMessages { get; }

The messages the call started with, without the instructions. Empty when the caller built the context without them.

Value: IReadOnlyList<ModelMessage>

View source

public Instructions? Instructions { get; }

The instructions the step is about to send. A Instructions override carries forward to later steps. Null when there are none.

Value: Instructions

View source

public IReadOnlyList<ModelMessage> Messages { get; }

The messages the step is about to send, without the instructions: the prompt plus the responses of the earlier steps. A Messages override carries forward to later steps. Empty when the caller built the context without them.

Value: IReadOnlyList<ModelMessage>

View source

public ILanguageModel? Model { get; }

The model the step is about to use, or null when the caller built the context without it.

Value: ILanguageModel

View source

public IReadOnlyList<ModelMessage> ResponseMessages { get; }

The response messages the earlier steps added. Empty when the caller built the context without them.

Value: IReadOnlyList<ModelMessage>

View source

public int StepNumber { get; }

Zero-based step index about to run.

Value: int

View source

public IReadOnlyList<StepResult> Steps { get; }

Steps already completed.

Value: IReadOnlyList<StepResult>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product