GEPA.Adapters.GenericRAG.Pipeline (GEPA v0.3.0)

Copy Markdown View Source

A small, adapter-local RAG pipeline used by GEPA.Adapters.GenericRAG.

Candidate components are plain text templates. Supported placeholders: {query}, {documents}, {context}, and {metadata}.

Summary

Functions

Deterministic fallback embedding function used when no custom embedding function is supplied.

Execute a RAG pipeline using explicit query, prompt, and config arguments.

Generate an answer from query, context, and a prompt template.

Reformulate a query with a prompt template.

Retrieve documents for a query under the provided config.

Types

t()

@type t() :: %GEPA.Adapters.GenericRAG.Pipeline{
  config: map(),
  embedder: GEPA.Embeddings.provider() | nil,
  embedding_function: (String.t() -> [number()]) | nil,
  embedding_model: String.t(),
  llm: term(),
  llm_client: term(),
  vector_store: term()
}

Functions

default_embedding_function(text)

@spec default_embedding_function(String.t()) :: [float()]

Deterministic fallback embedding function used when no custom embedding function is supplied.

execute_rag(pipeline, query, prompts, config)

@spec execute_rag(t(), String.t(), map(), map()) :: map()

Execute a RAG pipeline using explicit query, prompt, and config arguments.

format_documents(docs)

@spec format_documents([map()]) :: String.t()

generate_answer(pipeline, query, context, prompt)

@spec generate_answer(t(), String.t(), String.t(), String.t()) :: String.t()

Generate an answer from query, context, and a prompt template.

new(opts \\ [])

@spec new(keyword() | map()) :: t()

reformulate_query(pipeline, query, prompt)

@spec reformulate_query(t(), String.t(), String.t()) :: String.t()

Reformulate a query with a prompt template.

render_template(template, vars)

@spec render_template(String.t(), map()) :: String.t()

retrieve_documents(pipeline, query, config)

@spec retrieve_documents(t(), String.t(), map()) :: [map()]

Retrieve documents for a query under the provided config.

run(pipeline, example, candidate)

@spec run(t(), map(), map()) :: map()