Fix one-argument-per-line style in prompt injection guardrail

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-27 12:06:52 +01:00
committed by Sacha Al Himdani
parent ded859d130
commit 2f8674471b

View File

@@ -56,7 +56,9 @@ func (g *PromptInjectionGuardrail) Check(ctx context.Context, messages []llm.Mes
return &agent.GuardrailResult{Tripwire: false}, nil
}
resp, err := g.client.ChatCompletion(ctx, &llm.ChatCompletionRequest{
resp, err := g.client.ChatCompletion(
ctx,
&llm.ChatCompletionRequest{
Model: "gpt-4o-mini",
Messages: []llm.Message{
{
@@ -70,12 +72,15 @@ func (g *PromptInjectionGuardrail) Check(ctx context.Context, messages []llm.Mes
},
MaxTokens: new(10),
Temperature: new(0.0),
})
},
)
if err != nil {
// If the classifier fails, allow the message through rather than
// blocking legitimate users. The system prompt hardening and
// tool-level authorization provide defense in depth.
g.logger.WarnCtx(ctx, "prompt injection classifier failed, allowing message through",
g.logger.WarnCtx(
ctx,
"prompt injection classifier failed, allowing message through",
log.Error(err),
)
return &agent.GuardrailResult{Tripwire: false}, nil