Rag.Pipeline.Context (rag v0.3.4)

View Source

Context passed between pipeline steps.

The context holds all intermediate results and state as a pipeline executes. Steps can read from and write to the context to pass data between stages.

Summary

Functions

Adds an error to the context.

Gets a step result from the context metadata.

Creates a new context with the given input.

Puts a value in the context metadata.

Puts a step result in the context metadata.

Types

t()

@type t() :: %Rag.Pipeline.Context{
  context_text: String.t() | nil,
  errors: [any()],
  input: any(),
  metadata: map(),
  query: String.t() | nil,
  query_embedding: [number()] | nil,
  reranked_results: any(),
  response: String.t() | nil,
  retrieval_results: any()
}

Functions

add_error(context, error)

@spec add_error(t(), error :: any()) :: t()

Adds an error to the context.

get_step_result(context, step_name)

@spec get_step_result(t(), step_name :: atom()) :: any()

Gets a step result from the context metadata.

new(input)

@spec new(input :: any()) :: t()

Creates a new context with the given input.

put_metadata(context, key, value)

@spec put_metadata(t(), key :: atom(), value :: any()) :: t()

Puts a value in the context metadata.

put_step_result(context, step_name, result)

@spec put_step_result(t(), step_name :: atom(), result :: any()) :: t()

Puts a step result in the context metadata.