Custom HTTP Headers#
Note
The time to complete this tutorial is approximately 15 minutes.
Other Custom Headers#
In addition to the X-Model-Authorization
header, you can specify custom headers that start with x
or X
.
The custom headers are passed to the LLM, if it supports custom headers.
The following sample curl
command specifies several custom headers.
curl -v -X 'POST' \
"http://localhost:${GUARDRAILS_PORT}/v1/guardrail/chat/completions" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "X-Model-Authorization: $OPENAI_API_KEY" \
-H "X-Model-Response-Time: 100ms" \
-H "X-Model-Request-ID: 12345" \
-H "X-Model-Client: my-client" \
-H "X-Model-Version: 1.0.0" \
-d '{
"model": "meta/llama-3.1-70b-instruct",
"messages":[{"role": "user", "content": "how does internet work"}],
"max_tokens": 160,
"stream": false,
"temperature": 1,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0
}'
When the microservice receives this request, the microservice passes the custom headers to the LLM, if it supports custom headers.