Table of Contents

Class TextOperationContext

Namespace
FoundationaLLM.Gateway.Models
Assembly
FoundationaLLM.Gateway.dll

Provides the context for a text operation.

public class TextOperationContext
Inheritance
TextOperationContext
Inherited Members
Extension Methods

Fields

_syncRoot

protected readonly object _syncRoot

Field Value

object

Properties

InputTextChunks

The list of TextChunk objects which provide the input to the text operation.

public required IList<TextChunk> InputTextChunks { get; set; }

Property Value

IList<TextChunk>

IntermediateErrors

Gets or sets the list of intermediate error messages encountered during the text operation.

public List<string> IntermediateErrors { get; set; }

Property Value

List<string>

ModelParameters

Gets or sets the model parameters.

public Dictionary<string, object> ModelParameters { get; set; }

Property Value

Dictionary<string, object>

Prioritized

Indicates whether the requests associated with the context should be prioritized. Example: Synchronous vectorization and user prompt embedding for completions.

public bool Prioritized { get; set; }

Property Value

bool

ProcessedTextChunksCount

Gets the count of processed text chunks based on the completeness checker function.

public int ProcessedTextChunksCount { get; }

Property Value

int

Result

The TextOperationResult holding the result of the text operation.

public required TextOperationResult Result { get; set; }

Property Value

TextOperationResult

TextChunkCompletenessChecker

The function used to check if a text chunk is complete.

public Func<TextChunk, bool> TextChunkCompletenessChecker { get; set; }

Property Value

Func<TextChunk, bool>

TextChunkUpdater

The action used to update internal text chunks based on incoming text chunks.

public Action<TextChunk, TextChunk> TextChunkUpdater { get; set; }

Property Value

Action<TextChunk, TextChunk>

Methods

SetComplete()

Marks the text operation as complete.

public void SetComplete()

SetIntermediateError(string)

Sets a specified error message on the context of the text operation.

public void SetIntermediateError(string errorMessage)

Parameters

errorMessage string

The error message to be set.

UpdateTextChunks(IList<TextChunk>)

Updates the text chunks using the specified update and completeness check lambdas. If all positions are complete, marks the operation as complete.

public void UpdateTextChunks(IList<TextChunk> textChunks)

Parameters

textChunks IList<TextChunk>

A list of TextChunk objects containing positions and their associated values (embeddings or completions).