Search K
Appearance
Appearance
CONTENT MIGRATION
Documentation for F5 products will soon be moving to docs.f5.com — your new home for all F5 docs.
Use this reference to set up a custom model connection in F5 AI Security Platform. The YAML in YAML template defines the HTTP request and how to read the response. This reference also covers parameters and credentials used by the template. For instructions and examples, see Connect to a model provider and Custom connection use cases.
| Part | Format | Contents | Example |
|---|---|---|---|
| YAML parameters | Name and value pairs | Nonsecret values | url, model, parameters |
| Connection settings | Credential fields | Encrypted credentials | apiKey |
| YAML template | YAML block | The request and its outputs | A request block |
Refer to an input or secret by name inside {{ }}, for example '{{ url }}'. Quote expressions in YAML values, unless you use a block scalar for a multiline expression. If an expression contains single quotes, use double quotes around the value.
The top-level configuration contains one block. You can nest blocks: retry wraps one block, and workflow runs multiple blocks. Select the type with the type field.
| Type | Purpose |
|---|---|
request | Send one HTTP request and read the response. |
retry | Run a block again when a condition is true, such as a 429 status code. |
workflow | Run blocks in order and pass outputs to later blocks. |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | None | Set to request. |
method | string | Yes | None | GET, POST, PUT, PATCH, DELETE, HEAD, or OPTIONS. |
url | string | Yes | None | Full endpoint URL. Only http and https URLs are allowed. |
headers | map | No | {} | HTTP headers to send. |
queryParams | map | No | {} | Query parameters. The platform encodes each value and adds it to the URL. |
json | expression | No | None | JSON request body. If set, the platform ignores body. |
body | string | No | None | Raw request body. Set the Content-Type header yourself. |
timeout | integer | No | 20 | Time in seconds to wait for the whole response. |
awsAuth | map | No | None | AWS Signature Version 4 fields. See AWS signing fields. |
ociAuth | map | No | None | Oracle Cloud Infrastructure signing fields. See OCI signing fields. |
outputs | map | No | {} | Names and expressions to keep after the request. Only these names are available to later blocks. |
In request outputs, use response to read the HTTP response.
| Expression | Result |
|---|---|
response.statusCode | HTTP status code as a number |
response.headers | Response headers |
response.body | Raw response body as bytes. Use String.decode(response.body) for text. |
response.json() | Parsed JSON response body, or null if the body isn't valid JSON |
response.events() | A list of server-sent events. Each event has data, event, id, and json(). |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | None | Set to retry. |
attempts | integer | Yes | None | Maximum number of runs, including the first run. |
block | block | Yes | None | Block to run. |
when | expression | No | None | Retry while this expression is true. It can use outputs from the block, such as statusCode. |
backoff | number or expression | No | 1 | Seconds to wait before the next attempt. attempt is the number of the attempt that just ran, starting at 1. |
A retry block also retries network errors, such as a refused connection. It doesn't retry a blocked or invalid URL, or a certificate error. After the last attempt, its outputs remain available.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | None | Set to workflow. |
stages | list of blocks | Yes | None | Blocks to run in order. Each stage's outputs are available to later stages. |
outputs | map | No | {} | Names and expressions to keep after the workflow ends. |
The awsAuth map signs a request with AWS Signature Version 4. To add the map in the UI, select AWS Sig V4 under Authentication type.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
service | string | Yes | None | AWS service name, such as bedrock. |
region | string | Yes | None | AWS Region, such as us-east-1. |
accessKey | string | No | None | AWS access key ID. |
secretKey | string | No | None | AWS secret access key. |
token | string | No | None | AWS session token for temporary credentials. |
The ociAuth map signs a request for Oracle Cloud Infrastructure. The Authentication type list includes OCI.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
keyId | string | Yes | None | OCI key ID, in the format <TENANCY_OCID>/<USER_OCID>/<KEY_FINGERPRINT>. |
privateKeyPem | string | Yes | None | PEM-encoded private key. |
passphrase | string | No | None | Passphrase for an encrypted private key. |
The top-level block must return these outputs. The platform uses them to test the connection and read replies.
| Name | Type | Description |
|---|---|---|
statusCode | number | HTTP status code of the model call. The connection test passes only when the value is 200. |
content | string | Model reply text. |
error | string or null | Error message, or null when the call succeeds. |
If statusCode is missing, the test reports "No statusCode output from provider". If the value isn't a valid HTTP status code, the test reports "Invalid status code returned from provider". In a workflow, include the required names in the workflow's outputs. See Run two requests in order.
Names are case-sensitive. If a name doesn't exist, the request reports Referenced undefined variable.
| Name | Source | Description |
|---|---|---|
prompt | F5 AI Security Platform | User prompt. Usually a string. OpenAI-compatible proxy requests can use a list of messages. Use Type.type(prompt) == 'array' to check. |
memory | F5 AI Security Platform | Earlier turns as [userMessage, assistantReply] pairs. Empty for the first turn and the connection test. |
| Any parameter name | YAML parameters | Each parameter name. |
| Any secret name | Connection settings | Each secret key, including secrets added by an authentication type. |
accessToken | F5 AI Security Platform | Access token from OAuth 2.0 or JWT authentication. |
attempt | retry block | Number of the attempt that just ran. Available only in backoff. |
response | request block | HTTP response. Available only in request outputs. |
Expressions are the text inside {{ }}. The syntax is similar to JavaScript. When a YAML value is a single expression, it keeps the result type. The result can be an object, a number, or a list. When a value mixes text and expressions, the result is a string. For example, if maxTokens is a number, '{{ maxTokens }}' is a number. The mixed value 'limit: {{ maxTokens }}' is a string.
| Syntax | Example |
|---|---|
Strings, numbers, true, false, null | 'text', "text", 42, 0.7 |
| Lists and objects | [1, 2], {role: 'user', content: prompt} |
| Object shorthand | {model} means {model: model} |
| Spread | [...memoryMessages, last], {...parameters, model} |
| Property and index access | body.choices[0], list[-1] for the last item |
| Optional access | response.json()?.choices?.[0] returns null instead of an error |
| Arithmetic | +, -, *, /. Use + to join strings. |
| Comparison | ==, !=, <, <=, >, >= |
| Logic | &&, ||, ! |
| Null fallback | value ?? 'default' |
| Condition | statusCode == 200 ? content : null |
| Function | (total, item) => total + item, turn => turn[0] |
| Local name | let message = response.json()?.message in message?.content |
| Comment | // text to the end of the line |
The + operator doesn't convert types. To join a string and a number, convert the number first or use Array.concat.
Call a helper by its library name, for example String.decode(response.body).
| Library | Functions |
|---|---|
Array | length(list), index(list, i), slice(list, start, end), reverse(list), sort(list, fn), enumerate(list), range(start, end), contains(list, item), find(list, item), concat(list, separator), map(fn, list), filter(fn, list), flatMap(fn, list), reduce(fn, initial, list) |
Base64 | encode(value), decode(value) |
Date | now(format), timestamp(date), current_second(), current_minute(), current_hour(), current_day(), current_month() |
Json | encode(value), decode(text), getPath(value, path), setPath(value, path, newValue), jwtEncode(payload, privateKey, algorithm) |
Math | number(value), floor(value), ceil(value), min(list), max(list) |
Object | get(object, key, default), keys(object), values(object), merge(list), omit(object, keys) |
Regex | match(pattern, text, options) |
String | encode(text), decode(bytes), split(text, separator, max), random(length), formatChat(prompt, memory, options) |
Type | type(value) returns string, integer, number, boolean, array, object, null, or bytestring |
In map, filter, flatMap, and reduce, the function comes first and the list comes last. The Func library is an older name for Array.map, Array.filter, and Array.reduce. Use Array in new configurations.
When you select API Key, AWS Sig V4, Basic, Bearer, JWT, or OAuth 2.0, the platform changes every request block in YAML template. It first removes these headers: Authorization, authorization, apiKey, api-key, api_key, and x-api-key. Then it adds the header or block for the selected type.
For these types, the platform saves your values as secrets with fixed names. You can't add a secret with one of these names.
| Authentication type | Change to each request block | Secrets added |
|---|---|---|
| API Key | Adds Authorization: '{{ apiKey }}' | apiKey |
| Bearer | Adds an Authorization header using bearerToken | bearerToken |
| Basic | Adds a Basic Authorization header with the Base64-encoded username and password | username, password |
| AWS Sig V4 | Adds Content-Type: application/json and an awsAuth block | accessKey, secretKey, region, service, and token if entered |
| OAuth 2.0 | Adds an Authorization header using accessToken | authUrl, clientId, clientSecret, and scope and audience if entered |
| JWT | Adds an Authorization header using accessToken | tokenUrl, issuer, subject, audience, privateKeyPem, algorithm, and keyId and scope if entered |
| Custom | No change | None. Add secrets under Connection settings. |
| OCI | To be confirmed | To be confirmed |
For Basic, the Authorization header uses this value:
Basic {{Base64.encode(username + ':' + password)}}The rewrite also removes comments and can change YAML formatting.
For example, a request can contain an x-api-key header:
type: request
method: POST
url: '{{ url }}'
headers:
Content-Type: application/json
x-api-key: '{{ apiKey }}'
json: '{{ {input: prompt} }}'
outputs:
statusCode: '{{ response.statusCode }}'
content: '{{ response.json()?.output }}'
error: '{{ response.statusCode == 200 ? null : String.decode(response.body) }}'If you select Bearer, the platform removes x-api-key and adds an Authorization header using bearerToken. The other fields remain in the request. In this example, <BEARER_AUTHORIZATION_EXPRESSION> represents the generated header value.
type: request
method: POST
url: '{{ url }}'
headers:
Content-Type: application/json
Authorization: '<BEARER_AUTHORIZATION_EXPRESSION>'
json: '{{ {input: prompt} }}'
outputs:
statusCode: '{{ response.statusCode }}'
content: '{{ response.json()?.output }}'
error: '{{ response.statusCode == 200 ? null : String.decode(response.body) }}'With OAuth 2.0 or JWT, the platform gets an access token before it calls your model. The token is available as accessToken.
The platform reuses the token until about 90% of its expires_in time passes. If the response has no expires_in, the platform reuses the token for 60 minutes. Token requests retry on status codes 429, 500, 502, 503, and 504.