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
anyorall.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. familystringfamily: the canary family.min_scorenumberfamily: match at or above this score. Default: when it tripped.refsarray of stringsneurons: neuron refs,L<layer>.<idx>.<pos|neg>.querystringlabel: a case-insensitive part of a registry label.minnumberactivation: the activation to reach.layersarray of integersactivation: an inclusive [from, to] layer range.poleenumactivation: one pole only. One ofpos,neg.min_activationnumberneuronsandlabel: 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();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/trace/patterns", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"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()