Filter settings
prompt_enrich
Injects statically configured messages into the messages array of OpenAI-compatible chat completion request bodies.
Switching projects opens that project’s default documentation release.
Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.
On this page
Injects statically configured messages into the messages array of OpenAI-compatible chat completion request bodies.
Configuration Notes
Messages are pre-serialized at construction time. At request time, the filter parses the JSON body, splices prepend messages at the beginning and appends messages at the end, then re-serializes the modified body.
At least one of prepend or append must be non-empty. JSON is re-serialized, so byte-for-byte body identity is not preserved.
In chains that also use json_body_field or model_to_header, place prompt_enrich first.
Request buffering inherits the pipeline’s max_request_bytes and max_buffer_bytes. Optional max_body_bytes is a hard processing limit: bodies larger than it return HTTP 413 before parsing, independently of other filters’ buffer declarations. The limit applies to the body received by this filter, before its own rewriting or enrichment.
Omitting the limit removes the former implicit 10 MiB filter cap; pipeline limits still apply. Existing positive values remain valid and are now enforced even when another filter requests a larger shared buffer. Zero remains invalid; YAML null behaves like omission.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
max_body_bytes | integer | no | Optional hard request-body processing limit in bytes. Omit to inherit pipeline max_request_bytes and max_buffer_bytes; oversize bodies return HTTP 413 before parsing. |
on_invalid | continue | reject | no | Behavior when the body is not valid JSON or lacks a messages array. |
prepend | object[] | no | Messages to prepend at the beginning of the messages array. |
prepend[].role | system | user | yes | Role for the injected message. |
prepend[].content | string | yes | Text content of the injected message. |
append | object[] | no | Messages to append at the end of the messages array. |
append[].role | system | user | yes | Role for the injected message. |
append[].content | string | yes | Text content of the injected message. |
Example
filter: prompt_enrich
max_body_bytes: 10485760
on_invalid: continue
prepend:
- role: system
content: "You are a helpful assistant."
append:
- role: user
content: "Remember to cite your sources."