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 clarify/detour steps with a schema, returns a hash of default values matching each field’s declared type. For describe/summarize steps, 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.
38 39 40 41 42 43 44 45 46 |
# File 'lib/inquirex/llm/null_adapter.rb', line 38 def call(node, _answers = {}) if node.schema node.schema.fields.each_with_object({}) do |(name, type), acc| acc[name] = TYPE_DEFAULTS.fetch(type, "") end else "(placeholder #{node.verb} output for #{node.id})" end end |