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.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
max_body_bytes | integer | no | Maximum request body size to buffer 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."