-
[NA] [BE] [FE] [SDK] feat: add LLM judge, prompt injection, and custom trained guardrails (#7602)
发布于
2026-07-24 15:08:23 +00:00 - [NA] [BE] feat: add LLM judge, prompt injection, and custom trained guardrails
Extend the guardrails feature set and restructure the docs:
- Guardrails backend: new prompt injection validator (LoRA classifier),
custom classifier served by name from a shared base with an adapters
directory, shared single-token inference, and an in-server custom guardrail
training endpoint (async subprocess, status polling, progress callback,
concurrency lock, overwrite policy). - Python SDK: LLMJudge (client-side, via configured providers + nested LLM
span), PromptInjection and CustomGuardrail guards, create_custom_guardrail
with progress callback, fail-closed GuardrailValidationError, unit tests. - opik-backend: add LLM_JUDGE, PROMPT_INJECTION, CUSTOM_CLASSIFIER guardrail
types so results log. - Docs: dedicated Guardrails section (overview, guardrails, prompt injection
model, custom guardrails, server), Python SDK reference pages, redirects.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- feat(guardrails): surface new guardrail types in FE and docs
Add LLM_JUDGE, PROMPT_INJECTION, and CUSTOM_CLASSIFIER to the shared
GuardrailTypes enum and label map so they display in traces and are
selectable in alert filters. Keep the in-app "Set a guardrail" dialog
scoped to TOPIC/PII via QuickConfigGuardrailType; the new types are
configured through the SDK. Update docs to disambiguate the trained
custom guardrail from a manual (log-it-yourself) guardrail.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- feat(guardrails): add dialog panels for prompt injection, custom classifier, LLM judge
Extend the "Set a guardrail" dialog to configure all five guardrail
types. Widen the guardrail config/state to carry per-type fields (model
name, LLM judge instructions/model/check name) and switch the reducer to
a generic updateField action. Add TextInput, Instructions, and
ModelSelect (wrapping PromptModelSelect) subcomponents, and wire the
three new panels plus live SDK code generation for PromptInjection,
CustomGuardrail, and LLMJudge.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- test(guardrails): cover new guardrail types in check manufacturer
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
- docs(guardrails): rename prompt injection model to Opik Guard
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
- fix(guardrails): record span output when guardrail fails closed
Fail-closed errors were raised inside the tracked _validate, so the
guardrail span carried only error_info and no output, breaking
dashboards/alerts. Capture the error on the response and raise from
validate() after the span is finalized.Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
- test(guardrails): expect error field in guardrail span output
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com
下载附件