Class: Woods::Formatting::GenericAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/woods/formatting/generic_adapter.rb

Overview

Formats assembled context as plain text for generic LLM consumption.

Produces plain text with:

  • ‘=== CODEBASE CONTEXT ===` header

  • Token usage line

  • Content separated by ‘—` dividers

  • Sources in bracket notation

Examples:

adapter = GenericAdapter.new
text = adapter.format(assembled_context)
# => "=== CODEBASE CONTEXT ===\nTokens: 42 / 8000\n..."

Instance Method Summary collapse

Instance Method Details

#format(assembled_context) ⇒ String

Format assembled context as plain text.

Parameters:

Returns:

  • (String)

    Plain text formatted context



25
26
27
28
29
30
31
32
33
# File 'lib/woods/formatting/generic_adapter.rb', line 25

def format(assembled_context)
  parts = []
  parts << '=== CODEBASE CONTEXT ==='
  parts << "Tokens: #{assembled_context.tokens_used} / #{assembled_context.budget}"
  parts << '---'
  parts << assembled_context.context
  parts.concat(format_sources(assembled_context.sources))
  parts.join("\n")
end