Ragex.RAG.ContextBuilder (Ragex v0.10.1)

View Source

Formats retrieved code for AI consumption.

Supports multiple output formats:

  • :text - Markdown-formatted context (default)
  • :json - Structured JSON with code metadata
  • :ast - JSON with MetaAST data, purity, and complexity

Options

  • :format - Output format: :text, :json, or :ast (default: :text)
  • :include_code - Include full code snippets (default: true)
  • :max_context_length - Max context size in characters (default: 8000)

Summary

Functions

Build context from retrieval results in the specified format.

Functions

build_context(results, opts \\ [])

@spec build_context(
  [map()],
  keyword()
) :: {:ok, String.t()}

Build context from retrieval results in the specified format.

Parameters

  • results - List of retrieval result maps
  • opts - Keyword list of options

Returns

  • {:ok, context} where context is a string (text/json/ast encoded)