Skip to main content
In this guide we will see how to configure and use the HttpTarget class to interact with any HTTP-based LLM API endpoint.

Basic Configuration

The HttpTarget class requires a few essential parameters to work:

Key Parameters

  • url: The endpoint URL for the LLM API
  • headers: HTTP headers to include in requests
  • payload_config: Configuration for request payload formatting
  • concatenate_field: Path to extract the response content from the JSON response

Validate Configuration

To verify that your HttpTarget is properly configured and working, you can test it with a simple message:
This will:
  1. Send a simple “Hello World” message to your configured endpoint
  2. Print the response if successful
  3. Raise an exception if there are any configuration issues

Advanced Configuration

Token Authentication

For APIs that require token-based authentication on request, you can use the TokenConfig:

Error Handling

Returns the error message instead of raising an exception. Useful for firewall response detection.

Retry Configuration

Add retry logic for failed requests:

Using HttpTarget in an Evaluation Scenario

Here’s how to use the HttpTarget in an evaluation scenario:

Complete Example