jef.integrations package

Shared JEF invocation logic for integration adapters.

Both garak and PyRIT adapters delegate to the helpers here so that JEF call signatures, percentage normalisation, and metadata extraction live in one place.

The NDAY_PROBES registry is the single source of truth for n-day probe definitions, loaded from config/nday_probes.yaml. Both garak probe classes and PyRIT seed YAML files are derived from it — add a new entry to the config and both integrations pick it up automatically (garak probes are generated dynamically; run python -m jef.integrations.pyrit.seeds to regenerate YAML files).

The registry is self-contained with no network dependencies, so it works in air-gapped environments.

jef.integrations.DEFAULT_NDAY_TAGS: list[str] = ['avid-effect:security:S0403', 'avid-effect:ethics:E0301', 'owasp:llm01', 'quality:Security:PromptStability']

Default garak/AVID tags applied to all n-day probes.

class jef.integrations.JEFResult(value, percentage, raw_score, metadata)

Bases: object

Normalized result from a JEF scoring call.

value

Score in 0.0-1.0 range (percentage / 100).

percentage

Original JEF percentage (0-100).

raw_score

Raw score from JEF (int or float).

metadata

Dict of additional fields for downstream consumption.

metadata: dict[str, Any]
percentage: float
raw_score: float | int
value: float
class jef.integrations.NdayProbeDef(guid, description, goal, authors, harm_categories, prompts, recommended_detector, release_date='', modified_date='')

Bases: object

Definition for a disclosed jailbreak technique (n-day probe).

Loaded from config/nday_probes.yaml. Self-contained — no network dependencies, works in air-gapped environments.

authors: list[str]

Credited researchers.

description: str

Human-readable summary of the technique.

property disclosure_url: str
goal: str

Short goal statement (used by garak).

guid: str

0DIN case GUID (UUID).

harm_categories: list[str]

PyRIT harm category labels.

modified_date: str = ''

Date the probe was last modified (YYYY-MM-DD or empty).

prompts: list[str]

Attack prompt variants.

recommended_detector: list[str]

Garak detector name(s) to pair with this probe.

release_date: str = ''

Date the probe was first published (YYYY-MM-DD or empty).

jef.integrations.ODIN_DISCLOSURES_BASE_URL = 'https://0din.ai/disclosures'

Base URL for 0DIN public disclosure pages.

class jef.integrations.SubstanceScorerDef(module_path, substance, harm_category, description, tags=<factory>)

Bases: object

Metadata for a substance / CBRN JEF scoring module.

description: str
harm_category: str
module_path: str
substance: str
tags: list[str]
jef.integrations.get_score_func(module_path)

Lazily import a JEF module and return its score function.

jef.integrations.nday_to_seed_dict(name, probe)

Convert a NdayProbeDef to a PyRIT seed YAML-compatible dict.

Parameters:
  • name (str) – Registry key (snake_case identifier).

  • probe (NdayProbeDef) – The probe definition.

Return type:

dict[str, Any]

The returned dict can be written to YAML and loaded by pyrit.models.SeedDataset.from_yaml_file(). Uses the PyRIT seeds: format where each seed carries its own metadata.

Invoke the JEF copyright scorer and return a normalized result.

Loads fingerprints on first call via the references module side-effect.

Parameters:
  • text (str) – The text to score.

  • ref (str) – Built-in reference name (e.g. "page_one", "chapter_one").

  • min_ngram_size (int) – Minimum n-gram size for fingerprint overlap.

  • max_ngram_size (int) – Maximum n-gram size for fingerprint overlap.

Return type:

JEFResult

Returns:

JEFResult with normalized value and metadata.

jef.integrations.score_substance(module_path, text, *, show_matches=True)

Invoke a substance/CBRN JEF scorer and return a normalized result.

Parameters:
  • module_path (str) – Dotted module path (e.g. "jef.illicit_substances.meth").

  • text (str) – The text to score.

  • show_matches (bool) – Whether to request matched components from JEF.

Return type:

JEFResult

Returns:

JEFResult with normalized value and metadata.

jef.integrations.snake_to_pascal(name)

Convert a snake_case registry key to PascalCase class name.

Return type:

str

Subpackages