Manage Audit Targets¶
An AuditTarget identifies the model under test. It pairs a garak generator class (type) with a model identifier (model) and a generator-specific options dict (options). Targets are persisted in the NeMo Platform entity store and referenced by name from client.auditor.run(...).
What an AuditTarget Holds¶
| Field | Description |
|---|---|
type |
A fully-qualified garak generator class, such as nim.NVOpenAIChat, openai.OpenAIGenerator, rest.RestGenerator, or test.Blank. |
model |
The provider's model identifier passed through to garak (for example, meta/llama-3.1-8b-instruct). |
options |
A nested dict whose top-level key is the generator namespace (nim, openai, rest, ...). Contents are passed through to garak unchanged, with one exception: the nmp_uri_spec sentinel is resolved to a concrete uri at run time. |
description |
Optional free-form description shown in listings. |
See Target Schema for the full field reference.
Common Target Types¶
NIM via Inference Gateway¶
Audit a NIM (or any OpenAI-compatible chat endpoint) routed through a NeMo Platform provider:
target = client.auditor.targets.create(
workspace="default",
name="llama-31-8b",
type="nim.NVOpenAIChat",
model="meta/llama-3.1-8b-instruct",
options={
"nim": {
"max_tokens": 1024,
"nmp_uri_spec": {
"inference_gateway": {
"workspace": "default",
"provider": "build",
},
},
},
},
)
The nmp_uri_spec block resolves to a concrete uri at run time. See Inference Gateway for details.
OpenAI-compatible Endpoint¶
For a vanilla OpenAI-compatible endpoint routed through a provider:
target = client.auditor.targets.create(
workspace="default",
name="gpt-4o-audit",
type="openai.OpenAIGenerator",
model="gpt-4o",
options={
"openai": {
"max_tokens": 1024,
"seed": 42,
"nmp_uri_spec": {
"inference_gateway": {
"workspace": "default",
"provider": "openai-provider",
},
},
},
},
)
Blank Target (Smoke Test)¶
test.Blank returns the empty string for every request — useful for verifying that an audit configuration is well-formed without making network calls:
target = client.auditor.targets.create(
workspace="default",
name="smoke",
type="test.Blank",
model="ignored",
)
test.Blank ignores model, but the field is still required by the schema.
List Targets¶
listing = client.auditor.targets.list(workspace="default")
for entry in listing["data"]:
print(entry["name"], entry["type"], entry["model"])
list() returns the standard envelope (data, pagination, sort); pass page, page_size, and sort keyword arguments for pagination.
Retrieve a Target¶
Update a Target¶
update() replaces every field — pass the fields you want to keep alongside the ones you are changing.
updated = client.auditor.targets.update(
workspace="default",
name="llama-31-8b",
type="nim.NVOpenAIChat",
model="meta/llama-3.3-70b-instruct",
options={
"nim": {
"max_tokens": 2048,
"nmp_uri_spec": {
"inference_gateway": {"workspace": "default", "provider": "build"},
},
},
},
)