Filter settings

prompt_enrich

Injects statically configured messages into the messages array of OpenAI-compatible chat completion request bodies.

Praxis AI v0.12.1 (alpha) 2 min read
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

FieldTypeRequiredDescription
max_body_bytesintegernoOptional 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_invalidcontinue | rejectnoBehavior when the body is not valid JSON or lacks a messages array.
prependobject[]noMessages to prepend at the beginning of the messages array.
prepend[].rolesystem | useryesRole for the injected message.
prepend[].contentstringyesText content of the injected message.
appendobject[]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."