The Qualifire Proxy is a lightweight server that sits between your application and the Qualifire API. Its primary purpose is to provide a secure and reliable connection for your application to interact with the Qualifire API.

How to Use the Proxy

To use the Qualifire Proxy, follow these steps:

  1. Install the Qualifire Proxy package using npm or yarn:
npm install @qualifire/proxy
  1. Import the Qualifire Proxy in your application:
import { QualifireProxy } from "@qualifire/proxy";
  1. Create an instance of the Qualifire Proxy:
const proxy = new QualifireProxy({
  apiKey: "YOUR_API_KEY",
  baseUrl: "https://proxy.qualifire.ai",
});
  1. Use the proxy to make API requests:
const response = await proxy.post("/evaluation/evaluate", {
  evaluationId: "YOUR_EVALUATION_ID",
  input: "Hello, world!",
});
  1. Handle the response as needed:
if (response.status === 200) {
  console.log("Evaluation successful:", response.data);
} else {
  console.error("Evaluation failed:", response.error);
}

Advanced Usage

The Qualifire Proxy provides several advanced features to enhance your application’s functionality. Here are some examples:

Authentication

You can configure the Qualifire Proxy to use different authentication methods, such as API keys, OAuth, or JWT. This allows you to secure your application and control access to the Qualifire API.

Rate Limiting

The Qualifire Proxy supports rate limiting to prevent abuse and ensure fair usage of the API. You can set limits on the number of requests per minute, hour, or day, depending on your needs.

Caching

The Qualifire Proxy can cache responses to improve performance and reduce API calls. You can configure caching options, such as TTL (time-to-live) and cache key generation.

Error Handling

The Qualifire Proxy provides detailed error handling to help you troubleshoot issues and troubleshoot your application. It can handle errors such as network errors, API errors, and authentication errors.