SDK reference · Node SDK

prov.trace.patterns.create

prov.trace.patterns.create in Node SDK.

Signature

prov.trace.patterns.create(params: { name: string; description?: string | null; definition: PatternDefinition }): Promise<TracePattern>

Parameters

params{ name: string; description?: string | null; definition: PatternDefinition }Required

Request fields

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
namestringRequired
The pattern's name.
descriptionstring | null
What it looks for.
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.

Returns

Promise<TracePattern> The pattern.

HTTP operation

POST /v1/trace/patterns: Create a pattern

Errors

Example

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/trace/patterns`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Wire instructions in late layers",
    "description": "A wire-transfer label active past layer 12, with the injection family tripped.",
    "definition": {
      "match": "all",
      "rules": [
        {
          "kind": "family",
          "family": "prompt_injection"
        },
        {
          "kind": "activation",
          "min": 1.5,
          "layers": [
            12,
            23
          ]
        }
      ]
    }
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.