HttpTarget
provides a flexible way to connect to any LLM API accessible through HTTP.
HttpTarget
class allows you to:
HttpTarget
accepts several configuration options:
url
: The API endpoint URLpayload_config
: Configures how messages are formatted in the request payloadheaders
: HTTP headers to include in the requesttoken_config
: Configuration for authentication token generationerror_config
: How to handle error responsesresponse_regex
: Extract specific content from responsesconcatenate_field
: Extract nested fields from JSON responsesretry_config
: Configure automatic retries for failed requestsPayloadConfig
class configures how messages are formatted in requests:
format
: The structure of your payload, with placeholders for message contentmessage_regex
: Pattern to replace with the actual message (default: {{ message }}
)date_regex
: Pattern to replace with the current date (default: {{ date }}
)params
: URL query parameters to include in the requesttimeout
: Request timeout in secondsrate_limit
: Rate limit for the request in requests per second.proxy
: Proxy to use for the request.ssl_verify
: Whether to verify the SSL certificate of the request.concatenate_field
: Extract a specific field from JSON responses using dot notationresponse_regex
: Apply a regex pattern to extract specific contentHttpTarget
is the only model type that can be used to run tests through the TrustTest web UI. This makes it an essential component for teams looking to set up continuous evaluation of their LLM APIs.
When configuring your model through the web UI, you’ll define the same HttpTarget configuration but in YAML format in the Target section. Here’s an example of how your configuration should look: