Skip to content
SONOEDocs
EspañolESConsole

State

The state is what Sonoe decides about: a support message, a search, a record from your database, the current situation of your app. Every question in a request is answered against the same state.

Shapes

state can be a string, an object or an array.

{ "state": "My card was charged twice for order 4417 and I need the money back today." }

Objects are read as key: value lines, and nested objects are indented under their key. Arrays are read as a list, one item per line. So the object above reaches the model as:

channel: chat
plan: pro
message: My card was charged twice for order 4417.

How much Sonoe reads

Sonoe reads up to 256 tokens for each pair of (state + question, option). That's roughly 150 to 200 English words, shared between the state, the question and one option. Anything beyond that is cut off at the end, so:

  • Put the part that matters first.
  • Send the message, not the whole thread, when the latest message is what you're deciding about.
  • Leave out fields the questions don't need (ids, timestamps, internal flags).

Give it facts, not arithmetic

Sonoe decides; it doesn't calculate. If a question depends on a number, compute it in your code and put the result in the state:

{
  "state": {
    "store": "Farmacia Central",
    "distance": "5 minutes on foot",
    "open_now": "yes"
  }
}

"5 minutes on foot" works better than raw coordinates, and "open_now: yes" better than opening hours and the current time.

Yes/no over a structured state

When the state is an object with short values and you ask a yes/no question, Sonoe first finds the field the question is about and then answers from that field alone. "Can I bring my dog?" over a record with pets_allowed: no reads only that line. You don't need to do anything to get this; just use clear field names.

Language

Sonoe is multilingual. The state, the question and the options can be in different languages: a Spanish message with English options works. See Models for how well each language does.