Table of Contents

Interface IChainStep

Namespace
AiDotNet.Interfaces
Assembly
AiDotNet.dll

Defines a single step within a prompt chain.

public interface IChainStep

Remarks

Each step in a chain processes input and produces output. Steps can be simple prompt executions or complex operations like API calls or transformations.

For Beginners: A step is one operation in the chain.

Examples of steps:

  • "Translate text" - sends to translation API
  • "Summarize document" - sends to summarization prompt
  • "Extract keywords" - parses text for keywords
  • "Format as JSON" - transforms output to JSON

Each step has:

  • A name (for identification)
  • An execute function (what it does)
  • Input/output handling

Properties

Name

Gets the name of this step.

string Name { get; }

Property Value

string

Methods

Execute(string)

Executes this step with the given input.

string Execute(string input)

Parameters

input string

The input to process.

Returns

string

The output from this step.

ExecuteAsync(string, CancellationToken)

Executes this step asynchronously.

Task<string> ExecuteAsync(string input, CancellationToken cancellationToken = default)

Parameters

input string

The input to process.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<string>

A task that resolves to the output from this step.