prompt_enrich

Injects statically configured messages into the messages array of OpenAI-compatible chat completion request bodies.
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

FieldTypeRequiredDescription
max_body_bytesintegernoMaximum request body size to buffer before parsing.
on_invalidcontinue | rejectnoBehavior when the body is not valid JSON or lacks a messages array.
prependMessageConfig[]noMessages to prepend at the beginning of the messages array.
prepend[].rolesystem | useryesRole for the injected message.
prepend[].contentstringyesText content of the injected message.
appendMessageConfig[]noMessages to append at the end of the messages array.
append[].rolesystem | useryesRole for the injected message.
append[].contentstringyesText 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."