Introduction
orq.ai exposes an API to manipulate Evaluators. These APIs are used to manage Evaluators programmatically. In this page we’ll see the common use cases for creating, and fetching Evaluators through the API.Prerequisite
To get started, an API key is needed to use within SDKs or HTTP API.To get an API key ready, see Authentication.
SDKs
Creating an Evaluator
To create an Evaluator we’ll use the Create an Evaluator API call. We then need to decide what type of Evaluator we’ll create:HTTP Evaluator
Here is a valid payload to create an HTTP evaluator:To learn more about building HTTP Evaluators, see Creating an HTTP Evaluator.
JSON Evaluator
Here is a valid payload to create a JSON evaluator:Make sure to correctly escape the JSON Schema payload.
To learn more about building JSON Evaluators, see Creating a JSON Evaluator.
LLM Evaluator
Here is a valid payload to create an LLM evaluator:To learn more about building LLM Evaluators, see Creating an LLM Evaluator.
Python Evaluator
Here’s a valid Python Evaluator:
Use \n to indicate newlines in code.
To learn more about building Python Evaluators, see Creating a Python Evaluator.
Guardrail Configuration
For each Evaluator payload you can also define a guardrail payload looking as follows and add it into the creation payloadCalling the API
Here’s an example end-to-end API call and response:Listing Evaluators
To list evaluators we’re using the Listing Evaluators API. We’re making the following call:Using Evaluators
Calling an Evaluator from the Library
We’ll be calling the Tone of Voice endpoint: Here is an example call:The query defines the way the evaluator runs on the given output.
The value here holds result of the evaluator call following the query
Calling a custom evaluator
It is also possible to call a custom-made Evaluator made on orq using the API. You can fetch the Evaluator ID to send to this call by searching for Evaluators using the Get all Evaluators API. Then you can run the following API call:
Evaluator code is available directly to use.
Using EvaluatorQ
EvaluatorQ is a dedicated SDK for using Evaluators within your application. It features the following capabilities:- Parallel Execution: Run multiple evaluation jobs concurrently with progress tracking
- Flexible Data Sources: Support for inline data, promises, and Orq platform datasets
- Type-safe: Fully written in TypeScript
Learn more, see the Python EvaluatorQ and TypeScript EvaluatorQ repositories.