Kong / Kong/developer.konghq.com

(ai-gateway): Create how-to for guarding LLM responses using the OpenAI Moderation API

Open
#4,684 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

internal product:ai-gateway
Dominant language
Ruby
Stars
28
Forks
121
Avg merge
1d 4h
Merged PRs (30d)
313

Description

The AI Custom Guardrail plugin currently has one how-to guide covering the Mistral AI Moderation API. The plugin supports any HTTP-based guardrail service, single-direction guarding, and metrics logging, none of which are covered by a dedicated guide. This issue tracks three guides to fill that gap.

What it covers:

  • Configure the AI Custom Guardrail plugin with guarding_mode: OUTPUT to inspect only LLM responses - this might need some testing or changing, as guarding for responses proved to be not fully reliable for other guardrail plkugins
  • Use the OpenAI Moderation API (/v1/moderations) as the guardrail service
  • Write a check_response function that evaluates results[0].flagged and uses results[0].category_scores to identify which categories triggered
  • Validate that a clean request passes and a response containing harmful content is blocked
  • Add logging plugin to the how-to to show how blocked responses are logged

Size: S

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Mistral AI Moderation API how-to and the AI Custom Guardrail plugin documentation. Test OUTPUT guarding with a clean request and harmful response, then document the OpenAI /v1/moderations call, check_response behavior, category logging, and blocked-response logging. Done means the three guides cover configuration, validation, and logging.

Written by the indexing model from the issue text.

Assessment

Domain
api, documentation, security
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.