Kong / Kong/developer.konghq.com

Expose AI LLM Judge Score in Response Headers via Post Function Plugin

Open
#3,224 0 comments 0 reactions 0 assignees View on GitHub
internal product:ai-gateway
Dominant language
Ruby
Stars
28
Forks
121
Avg merge
1d 4h
Merged PRs (30d)
313

Description

## Jobs to be done

Users want to see the AI LLM judge score in the HTTP response headers, not just in plugin or AI logs. This will help with observability and debugging without needing to access plugin logs directly.

## Definition of done

* Add how-to for using the post-function plugin using the `header_filter` phase that reads the `llm_accuracy` metric from `kong.llm.plugin.observability` and sets it in the `X-Kong-LLM-Accuracy` response header.
* Verify that the header value matches the score logged by the AI plugin.

## Information

* Code snippet that works in the `header_filter` phase:

```lua
local ai_plugin_o11y = require("kong.llm.plugin.observability")
local llm_accuracy

if ai_plugin_o11y then
llm_accuracy = ai_plugin_o11y.metrics_get("llm_accuracy")
else
llm_accuracy = "undefined"
end

kong.response.set_header("X-Kong-LLM-Accuracy", llm_accuracy)
```

## Size

M (Medium)

Contributor guide

No contributing guide indexed for this repository

Research direction

Search the documentation for the post-function plugin and its header_filter phase, then review the Kong LLM observability usage shown in the issue. Add a how-to that reads the llm_accuracy metric and sets X-Kong-LLM-Accuracy, and verify that the response header matches the AI plugin's logged score.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.