diff --git a/pkg/agent/guardrail/prompt_injection.go b/pkg/agent/guardrail/prompt_injection.go index d100934ff..1ed0a0dc9 100644 --- a/pkg/agent/guardrail/prompt_injection.go +++ b/pkg/agent/guardrail/prompt_injection.go @@ -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