Class: Omen::Reply

Inherits:
Object
  • Object
show all
Defined in:
app/models/omen/reply.rb

Overview

The one shape a reply may take, which is what makes every reply parse.

Constant Summary collapse

SHAPE =

Both keys required, and no others admitted.

{
  type: 'object', additionalProperties: false, required: %w[ sql note combine ],
  properties: {
    sql: { type: 'string',
           description: 'The one PostgreSQL SELECT that answers the question, or ' \
                        'empty to ask something first.', },
    note: { type: 'string',
            description: 'A sentence or two: what the query returns and any ' \
                         'assumption made. If sql is empty, the question you ' \
                         'need answered first.', },
    combine: Omen::Combination::SCHEMA,
  },
}

Class Method Summary collapse

Class Method Details

.output_config ⇒ Hash

Returns what a reply is constrained to, so that it always parses.

Returns:

  • (Hash) —

    what a reply is constrained to, so that it always parses.



19
# File 'app/models/omen/reply.rb', line 19

def self.output_config = { format_: { type: :json_schema, schema: SHAPE } }