Class: Inquirex::LLM::NullAdapter
- Defined in:
- lib/inquirex/llm/null_adapter.rb
Overview
Test adapter that returns schema-conformant placeholder values without calling any LLM API. Useful for testing flows that include LLM steps.
For extract steps with a schema, returns a hash of default values matching each field's declared type. Fields constrained to a list of allowed values (enum/multi_enum resolved from questions) return the first allowed value, so placeholders stay valid answers for the downstream question. Without a schema, returns a placeholder string.
Constant Summary collapse
- TYPE_DEFAULTS =
{ string: "", text: "", integer: 0, decimal: 0.0, currency: 0.0, boolean: false, enum: "", multi_enum: [], date: "", email: "", phone: "", array: [], hash: {} }.freeze
Instance Method Summary collapse
-
#call(node, _answers = {}) ⇒ Hash, String
Returns placeholder output matching the node's schema or verb.
Methods inherited from Adapter
#source_answers, #validate_output!
Instance Method Details
#call(node, _answers = {}) ⇒ Hash, String
Returns placeholder output matching the node's schema or verb.
40 41 42 43 44 45 46 47 48 |
# File 'lib/inquirex/llm/null_adapter.rb', line 40 def call(node, _answers = {}) if node.schema node.schema.fields.each_with_object({}) do |(name, type), acc| acc[name] = placeholder_for(node.schema, name, type) end else "(placeholder #{node.verb} output for #{node.id})" end end |