Module: Inquirex::LLM::DSL::FlowBuilderExtension

Defined in:
lib/inquirex/llm/dsl/flow_builder.rb

Overview

Mixin that adds LLM verb methods to Inquirex::DSL::FlowBuilder. Prepended automatically when require "inquirex-llm" is called, so that Inquirex.define gains extract (and its clarify alias) without needing a separate entry point.

All core verbs (ask, say, header, btw, warning, confirm) remain unchanged — LLM verbs are purely additive. The mixin must be prepended (not included) because it overrides #build: LLM steps are built lazily at #build time, once every step in the flow is known, so that schema question references can resolve forward to questions defined after the LLM step.

Instance Method Summary collapse

Instance Method Details

#buildObject

Builds any deferred LLM steps (now that the full node map exists), then produces the frozen Definition via the core builder.



55
56
57
58
# File 'lib/inquirex/llm/dsl/flow_builder.rb', line 55

def build
  resolve_llm_steps!
  super
end

#extract(id) ⇒ Object Also known as: clarify

Defines an LLM extraction step: takes free-text input and produces structured data matching the declared schema.

Parameters:

  • id (Symbol)

    step id



22
23
24
# File 'lib/inquirex/llm/dsl/flow_builder.rb', line 22

def extract(id, &)
  add_llm_step(id, :extract, &)
end