[feature] Watermarked generation and detection (Gumbel-max algorithm) (#54053)

Signed-off-by: Raphael Rialland <raphael.rialland@mistral.ai>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Raphaël Rialland
2026-09-09 21:00:15 -07:00
committed by GitHub
co-authored by OpenAI Codex mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 8c34a37232
commit ea40bb9e90
32 changed files with 1693 additions and 15 deletions
@@ -120,17 +120,24 @@ class TestRedactSensitiveArgs:
API_KEY = "sk-test-secret-12345"
def test_redact_replaces_sensitive_values_only(self):
args = {"api_key": self.API_KEY, "hf_token": "hf_secret", "other": "visible"}
args = {
"api_key": self.API_KEY,
"hf_token": "hf_secret",
"watermark_config": {"algorithm": "gumbel", "key": 42},
"other": "visible",
}
redacted = redact_sensitive_args(args)
assert redacted == {
"api_key": "***",
"hf_token": "***",
"watermark_config": "***",
"other": "visible",
}
# original dict must not be mutated
assert args == {
"api_key": self.API_KEY,
"hf_token": "hf_secret",
"watermark_config": {"algorithm": "gumbel", "key": 42},
"other": "visible",
}