Light Logo
CLI (v0.54.0)Reference

wriftai predictions create

CLI reference for wriftai predictions create

wriftai predictions create

Create a prediction

Synopsis

Create a prediction using either the latest version of a model or a specific model version.

Input data can be provided to --input in four ways:

  • Raw JSON: --input, followed by a JSON object as a single-quoted string
  • A file reference: --input @path/to/file.json (reads and parses a JSON file. Both relative and absolute paths)
  • Standard input: --input @- (reads and parses JSON from stdin)
  • Key-value pairs: --input key=value (string value) and/or --input key:=value (raw JSON value), repeatable for multiple keys

Key-value pairs using "=" and ":=" can be freely mixed with each other, but cannot be mixed with a raw JSON or @file value in the same command.

wriftai predictions create [flags]

Examples

  Create a prediction against the latest version of a model
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input text=hello

  Create a prediction against a specific model version
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer:1 \
    --input text=hello

  Create a prediction using raw JSON input
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input '{"text": "hello"}'

  Create a prediction using a JSON file as input
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input @input.json

  Create a prediction using JSON from stdin
  $ echo '{"text":"hello"}' | wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input @-

  Create a prediction using multiple key=value pairs (string values)
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input text=hello \
    --input language=en

  Create a prediction using key=value pairs with typed/raw JSON values
  (numbers, booleans, arrays, and objects)
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input text=hello \
    --input threshold:=0.8 \
    --input tags:='["a","b"]'

  Create a prediction with input validation enabled against model version's schema before processing
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input text=hello \
    --validate-input

  Create a prediction and send updates to the specified webhook
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input 'text=Good Job' \
    --webhook-url https://example.com/webhook \
    --webhook-secret a7b6e3f1a9d8c4b2

  Create a prediction and wait until it reaches a terminal state, polling at the default interval
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input text=hello \
    --wait

  Create a prediction and wait until it reaches a terminal state, polling at a custom interval
  $ wriftai predictions create \
    --model johndoe/sentiment-analyzer \
    --input text=hello \
    --wait \
    --wait-poll-interval 3s

Options

  -h, --help                          help for create
      --input stringArray             Input data for prediction (required). Supports raw JSON (e.g. '{"text":"hi"} '), file references (e.g. @input.json or @- for stdin), or repeatable key=value pairs with key:=value for JSON values such as numbers, booleans, arrays, or objects. Repeatable keys are allowed; if a key is repeated, the last value wins.
      --model string                  Model reference in either owner/name or owner/name:version-number format (required)
  -o, --output format                 Set output format. Supported formats: json, yaml (default json)
      --validate-input                Enable input validation against the schema before processing
      --wait                          If set, waits until the prediction reaches a terminal state otherwise returns the prediction immediately
      --wait-poll-interval duration   Time duration between polling attempts to check the prediction status. Applies when --wait is enabled (default 1s)
      --webhook-secret string         Secret to generate the signature for the webhook
      --webhook-url string            HTTP URL to POST updates to

Options inherited from parent commands

      --debug   Enable debug mode

SEE ALSO