Definition

The total cost test ensures that the total request cost (in USD) for the data is within a given range.

Taxonomy

  • Category: Performance.
  • Task types: LLM.
  • Availability: and .

Why it matters

  • If you use an external API to get the model predictions, you might be charged for each request. This is the case for most third-party LLMs, such as OpenAI GPTs. Setting up tests for the cost of the requests is important to avoid unexpected costs.

Test configuration examples

If you are writing a tests.json, here are a few valid configurations for the character length test:

[
  {
    "name": "Total cost below $ 50",
    "description": "Make sure that the total cost is below $ 50",
    "type": "performance",
    "subtype": "metricThreshold",
    "thresholds": [
      {
        "insightName": "metrics",
        "insightParameters": null,
        "measurement": "totalCost",
        "operator": "<",
        "value": 50.0
      }
    ],
    "subpopulationFilters": null,
    "mode": "development",
    "usesValidationDataset": true, // Apply test to the validation set
    "usesTrainingDataset": false,
    "usesMlModel": false,
    "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689" // Some unique id
  }
]