laya

package
v2.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package laya is a Decider backed by Laya, an open decision model, run as a sidecar beside Cartograph (deploy/laya): the model needs a runtime the static binary does not carry, so it is reached over HTTP on the same host or network. The protocol is Laya's own systemOne call as JSON:

POST <url>/decide
{"state": "...", "questions": {"name": {"type": "choice"|"noul",
  "instructions": "...", "criteria": {"key": "description"}}}}
-> {"answers": {"name": {"choice": "key", "probabilities": {...},
  "noul": 0.82}}}

A sidecar that cannot be reached, or answers with an error, is decide.ErrUnavailable, so the engine answers as it would without one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decider

type Decider struct {
	// contains filtered or unexported fields
}

Decider is the Laya sidecar's client.

func New

func New(url string, timeout time.Duration) *Decider

New returns a client for the sidecar at url (http://host:port), each call given at most timeout.

func (*Decider) Decide

func (d *Decider) Decide(ctx context.Context, state string, questions map[string]decide.Question) (map[string]decide.Answer, error)

func (*Decider) Ready

func (d *Decider) Ready(ctx context.Context) error

Decide asks the sidecar every question in one call. Ready asks the sidecar's GET /ready, which answers 200 once its model is loaded.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL