# Prompt Enrichment
#
# Build:
#   cargo build -p praxis-ai-proxy
#
# Injects system messages into OpenAI-compatible chat completion
# requests before forwarding to the upstream provider. The system
# prompt is defined at the proxy layer and cannot be overridden
# by clients.
#
# Only static configured messages are supported. Prepend accepts
# only system role; append accepts system or user roles.
#
# JSON is reserialized, so byte-for-byte body identity and key
# order are not preserved.
#
# Example request:
#
#   curl -X POST http://localhost:8080/v1/chat/completions \
#     -H "Content-Type: application/json" \
#     -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello"}]}'
#
# The upstream receives the request with the system message
# prepended and the citation reminder appended.

listeners:
  - name: gateway
    address: "0.0.0.0:8080" # dev value; binds all interfaces
    filter_chains:
      - enrich-and-route

filter_chains:
  - name: enrich-and-route
    filters:
      - filter: prompt_enrich
        prepend:
          - role: system
            content: >-
              You are a helpful assistant for Acme Corp.
              Always be concise and professional.
        append:
          - role: user
            content: "Remember to cite your sources."
      - filter: router
        routes:
          - path_prefix: "/"
            cluster: provider
      - filter: load_balancer
        clusters:
          - name: provider
            endpoints:
              - "127.0.0.1:3000"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends
