SDK reference · Python SDK

prov.trace.patterns.preview

prov.trace.patterns.preview in Python SDK. How many of your latest runs an unsaved definition matches.

Signature

prov.trace.patterns.preview(definition: dict, limit: Optional[int] = …) -> Any

Parameters

definitiondictRequired
limitOptional[int]

Request fields

definitionobjectRequired
Rules combined with any or all.
Show child attributes
matchenum
Whether one rule is enough or all must match. One of any, all.
rulesarray of objectsRequired
The rules.
Show child attributes
kindenumRequired
The rule kind. One of family, neurons, label, activation.
familystring
family: the canary family.
min_scorenumber
family: match at or above this score. Default: when it tripped.
refsarray of strings
neurons: neuron refs, L<layer>.<idx>.<pos|neg>.
querystring
label: a case-insensitive part of a registry label.
minnumber
activation: the activation to reach.
layersarray of integers
activation: an inclusive [from, to] layer range.
poleenum
activation: one pole only. One of pos, neg.
min_activationnumber
neurons and label: the activation to reach.
min_countinteger
Neuron rules: how many neurons must match. Default 1.
limitinteger
Latest runs to scan.

Returns

Any The preview.

HTTP operation

POST /v1/trace/patterns/preview: Preview a pattern

Errors

Example

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/patterns/preview`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "definition": {
      "rules": [
        {
          "kind": "family",
          "family": "prompt_injection"
        }
      ]
    },
    "limit": 1
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.