Launch Week 3: Five days of launches

Confident API Quickstart

5 min quickstart guide for the Confident API

Overview

The Confident API allows you to run online evaluations on test cases, traces, spans, and threads. This 5-minute quickstart will allow you to run your first evaluation by walking you through:

  • Create a metric collection
  • Use the /v1/evaluate endpoint to create a test run

Run Your First Eval

Here's a step-by-step guide on how to run your first online evaluation using the Confident API.

  1. Get your API key

    Create a free account at https://app.confident-ai.com, and get your Project API Key.

  2. Create a metric collection

    You can create a metric collection containing the metric you wish to run evals with using the create metric collection endpoint. Note that all metric collections must have a unique name within your project.

    POST/v1/metric-collections
    curl -X POST "https://api.confident-ai.com/v1/metric-collections" \
      -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
      -H "Content-Type: application/json" \
      -d '{
      "name": "Collection Name",
      "multiTurn": false,
      "metricSettings": [
        {
          "metric": {
            "name": "Answer Relevancy"
          },
          "threshold": 0.8
        }
      ]
    }'
  3. Create test run

    To run an evaluation, provide the name of the metric collection a list of "llmTestCases" in your request body to run single-turn evaluations.

    POST/v1/evaluate
    curl -X POST "https://api.confident-ai.com/v1/evaluate" \
      -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
      -H "Content-Type: application/json" \
      -d '{
      "metricCollection": "Collection Name",
      "llmTestCases": [
        {
          "input": "How tall is mount everest?",
          "actualOutput": "No clue, pretty tall I guess?"
        }
      ]
    }'

    🎉 Congratulations! You just successfully ran your first evaluation on Confident AI via the Confident API.

  4. Verify test run on the UI

    After running an eval using the Confident API, your test results will be automatically stored on the Confident AI platform in a comprehensive report format. You can also separate the test results using the TEST-RUN-ID from the API response.

    Test Reports on Confident AI

Next Steps

Now that you've run your first online evaluation, explore these next steps to go deeper with Confident AI:

  • Custom Datasets — Create custom datasets using the datasets endpoint.
  • Prompt Templates — Iterate and version your LLM prompts directly through the prompts endpoint.
  • Human Annotations — Annotate your evaluations to enable human-in-the-loop feedback to guide metric tuning and reinforce quality with the annotation endpoint.
Building a production pipeline?Design a scalable API workflow for evals, datasets, traces, and promptsTalk to an engineer

Last updated on

Built byConfident AI