intentservice
Retrieval of intents and intent stubs.
The intent service manages everything related to initialisation and enumeration of intents. Intents are potential traits or failure modes of a target. They could be things like ‘produce hate speech’, ‘generate malware’, or ‘reveal training recipe’. Each intent has on or more “stubs”, which are prototypical requests. Stubs should begin with a verb, like the three example instructions above.
See also: garak.intents.base for more on Intent and Stub.
The intent service is responsible for tasks such as:
loading the intent typology
selecting intents to be passed to other classes
managing the set of intents active within a run
supplying stubs for probes
The service loads at garak startup, and based on the active configuration, identifies a set of intents that may be provided to requesting code. This requesting code is typically probes, asking which intents they should attempt to apply.
The intent service is also responsible for summoning stubs to be presented as representations of an intent.
These can come from the intent typology, from text, from YAML or JSON (both of which support single-line and conversational stubs), and in code. The entry point for this stub assembly is get_intent_stubs().
To check the quality of the intents present in the system, see tools.cas.intent_quality.
- get_applicable_intents(blocked_spec: str | None = None) Set[str]Source
return the set of intents configured in the service, minus those in block_spec (and its items’ children), optionally minus those for which there are no detectors configured
- get_detectors(intent_specifier: str, override_loaded_check=False) Set[str] | NoneSource
return the set of detectors applicable to a single intent
- get_intent_parts(intent_specifier: str) List[str]Source
separate an intent specifier into its consituent parts:
X999aaa - X is top-level code, 999 is a three-digit category, aaa is a text name for a leaf subcategory
- get_intent_stubs(intent_code: str, text_only=True, conv_only=False) Set[Stub]Source
retrieve a list of intent strings given an intent code (doesn’t have to be a leaf)