Omni.Question.Predicate (Omni v2.0.0)

Copy Markdown View Source

A yes/no question: how likely is a statement about the state to be true.

Answered by Omni.Answer.Predicate. Build one with new/2, or Omni.predicate/2.

Struct fields

  • :instructions - the statement or question, as parts (see Omni.Question)
  • :criteria - optional descriptions of what counts as true and false, [true: "...", false: "..."] (either key may be left out). Sent to System One hosts; OpenAI has no field for them and drops them

Summary

Types

t()

A yes/no question.

Functions

Creates a yes/no question from a keyword list or map of fields, or from instructions as a string.

Creates a yes/no question from instructions and optional criteria.

Types

t()

@type t() :: %Omni.Question.Predicate{
  criteria: [{boolean(), String.t()}] | nil,
  instructions: Omni.Question.instructions()
}

A yes/no question.

Functions

new(instructions)

@spec new(String.t() | Enumerable.t()) :: t()

Creates a yes/no question from a keyword list or map of fields, or from instructions as a string.

Instructions are built into parts (see Omni.Question). Other forms of instructions, such as a map or a list, go through new/2.

Omni.Question.Predicate.new("Is this spam?")
Omni.Question.Predicate.new(instructions: "Is this spam?", criteria: [true: "Advertising"])

new(instructions, criteria)

@spec new(Omni.Question.instructions_input(), [{boolean(), String.t()}] | nil) :: t()

Creates a yes/no question from instructions and optional criteria.

criteria, when given, describes what counts as true and what as false. System One hosts use it; OpenAI has no field for it, so it is dropped there.

Omni.Question.Predicate.new("Is this spam?", nil)

Omni.Question.Predicate.new("Is this spam?",
  true: "Unsolicited advertising",
  false: "A legitimate conversation"
)