Introducing Confident Voice: Watch the Launch Video Now

Managing Evaluator Collections via Confident AI SDK

Overview

The Confident AI SDK exposes every Evaluator Collection method on the platform. This page documents how to call these methods in all supported languages. See the introduction to install the SDK and set your API key.

Methods

List Evaluator Collections

Lists all the evaluator collections in your Confident AI project, each with the scorers and classifiers inside it.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.evaluator_collections.list()

For async mode, call a_list and await it as shown below:

result = await client.evaluator_collections.a_list(...)

Returns

This method returns an object of type EvaluatorCollectionList.

Create Evaluator Collection

Creates an evaluator collection from the name and metricsSettings you specify and returns it. Each name in metricsSettings is a scorer (a metric that matches multiTurn) or, failing that, a classifier in your project or organization; a classifier only takes activated. A name that matches neither rejects the whole request.

from confident_ai import ConfidentAI
from confident_ai.common import (
    EvalMode,
    MetricRefInput,
    MetricSettingInput,
    ModelProvider,
)

client = ConfidentAI()

result = client.evaluator_collections.create(
    name="RAG Quality",
    multi_turn=False,
    metrics_settings=[
        MetricSettingInput(
            metric=MetricRefInput(
                name="Answer Relevancy"
            ),
            activated=True,
            threshold=0.8,
            include_reason=True,
            strict_mode=False,
            sample_rate=1,
            evaluation_model_provider=ModelProvider.OPEN_AI,
            evaluation_model_name="gpt-4o",
            evaluation_model_credential_id="<MODEL-CREDENTIAL-ID>",
            decision_model_provider=ModelProvider.OPEN_AI,
            decision_model_name="jev-latest",
            eval_mode=EvalMode.LLM
        )
    ],
    sample_rate=1,
    input_transformer_id="<TRANSFORMER-ID>",
    output_transformer_id="<OUTPUT-TRANSFORMER-ID>",
)

For async mode, call a_create and await it as shown below:

result = await client.evaluator_collections.a_create(...)

Parameters

ParameterTypeDescription
namestrRequired. The name of the evaluator collection, which must be unique within your project.
multi_turnOptional[bool]This is true if the collection is multi-turn, which contains only multi-turn evaluators. It cannot be changed once the collection exists.
metrics_settingsOptional[List[MetricSettingInput]]The scorers and classifiers in the collection with their settings. Each must exist in your project and match multiTurn. See MetricSettingInput.
sample_rateOptional[float]The share of eligible entities the whole collection is run against, between 0 and 1. Applied on top of each evaluator's own sampleRate. Defaults to 1 on create; omit it on an update to leave it unchanged.
input_transformer_idOptional[str]The id of a transformer that reshapes the payload before evaluation. Send null to unset it.
output_transformer_idOptional[str]The id of a transformer that reshapes the result after evaluation. Send null to unset it.

Returns

This method returns an object of type EvaluatorCollection.

Get Evaluator Collection

Retrieves an evaluator collection with every scorer inside it and its settings, and every classifier inside it.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.evaluator_collections.get(
    evaluator_collection_id="<EVALUATOR-COLLECTION-ID>",
)

For async mode, call a_get and await it as shown below:

result = await client.evaluator_collections.a_get(...)

Parameters

ParameterTypeDescription
evaluator_collection_idstrRequired. The unique id of the evaluator collection.

Returns

This method returns an object of type EvaluatorCollection.

Update Evaluator Collection

Updates an evaluator collection and returns it. Only the fields you send are changed. Supplying metricsSettings replaces every scorer and classifier in the collection, so resend each classifiers name you want to keep. multiTurn cannot be changed.

from confident_ai import ConfidentAI
from confident_ai.common import (
    EvalMode,
    MetricRefInput,
    MetricSettingInput,
    ModelProvider,
)

client = ConfidentAI()

result = client.evaluator_collections.update(
    evaluator_collection_id="<EVALUATOR-COLLECTION-ID>",
    name="RAG Quality v2",
    metrics_settings=[
        MetricSettingInput(
            metric=MetricRefInput(
                name="Answer Relevancy"
            ),
            activated=True,
            threshold=0.8,
            include_reason=True,
            strict_mode=False,
            sample_rate=1,
            evaluation_model_provider=ModelProvider.OPEN_AI,
            evaluation_model_name="gpt-4o",
            evaluation_model_credential_id="<MODEL-CREDENTIAL-ID>",
            decision_model_provider=ModelProvider.OPEN_AI,
            decision_model_name="jev-latest",
            eval_mode=EvalMode.LLM
        )
    ],
    sample_rate=1,
    input_transformer_id="<TRANSFORMER-ID>",
    output_transformer_id="<OUTPUT-TRANSFORMER-ID>",
)

For async mode, call a_update and await it as shown below:

result = await client.evaluator_collections.a_update(...)

Parameters

ParameterTypeDescription
evaluator_collection_idstrRequired. The unique id of the evaluator collection.
nameOptional[str]The new name of the evaluator collection, which must be unique within your project.
metrics_settingsOptional[List[MetricSettingInput]]The settings for every scorer and classifier in the collection. Supplying this field replaces the entire list, so fetch the collection first and resend each evaluator it should keep. See MetricSettingInput.
sample_rateOptional[float]The share of eligible entities the whole collection is run against, between 0 and 1. Applied on top of each evaluator's own sampleRate. Defaults to 1 on create; omit it on an update to leave it unchanged.
input_transformer_idOptional[str]The id of a transformer that reshapes the payload before evaluation. Send null to unset it.
output_transformer_idOptional[str]The id of a transformer that reshapes the result after evaluation. Send null to unset it.

Returns

This method returns an object of type EvaluatorCollection.

Delete Evaluator Collection

Permanently deletes an evaluator collection. Every evaluation rule that runs this collection is deleted with it, and test runs and scheduled tasks stop pointing at it.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.evaluator_collections.delete(
    evaluator_collection_id="<EVALUATOR-COLLECTION-ID>",
)

For async mode, call a_delete and await it as shown below:

result = await client.evaluator_collections.a_delete(...)

Parameters

ParameterTypeDescription
evaluator_collection_idstrRequired. The unique id of the evaluator collection.

Returns

This method returns an object of type EvaluatorCollectionRef.

Types

CollectionClassifier

A classifier in the collection.

class CollectionClassifier:
    id: str
    name: str
    activated: bool

idstrRequired

This is the id of the classifier.

Example: "<EVALUATOR-ID>"

namestrRequired

This is the name of the classifier.

Example: "Refund reason"

activatedboolRequired

Whether this classifier is activated. Only activated evaluators are run during an evaluation.

Example: true

EvalMode

Which model does the work: LLM runs only the evaluation model, DECISION only the decision model, and HYBRID has the decision model decide while the evaluation model assists.

class EvalMode(Enum):
    LLM = "LLM"
    HYBRID = "HYBRID"
    DECISION = "DECISION"

LLM · HYBRID · DECISION

EvaluatorCollection

An evaluator collection: its name, sampling and transformer configuration, the settings for every scorer inside it, and its classifiers.

class EvaluatorCollection:
    id: str
    name: str
    multi_turn: bool = Field(alias="multiTurn")
    sample_rate: float = Field(alias="sampleRate")
    input_transformer_id: Optional[str] = Field(alias="inputTransformerId")
    output_transformer_id: Optional[str] = Field(alias="outputTransformerId")
    metrics_settings: List[MetricSetting] = Field(alias="metricsSettings")
    classifiers: List[CollectionClassifier]

idstrRequired

This is the id of the evaluator collection.

Example: "<EVALUATOR-COLLECTION-ID>"

namestrRequired

This is the name of the evaluator collection, which you supply to the evals API to run evaluations remotely.

Example: "RAG Quality"

multi_turnboolRequired

Whether this is a multi-turn collection. Multi-turn collections contain only multi-turn evaluators and evaluate conversations rather than single test cases.

Example: false

sample_ratefloatRequired

The share of eligible entities this collection is run against, between 0 and 1. Applied on top of each evaluator's own sampleRate.

Example: 1

input_transformer_idOptional[str]Required

The id of the transformer that reshapes the payload before evaluation, or null when the collection does not use one.

Example: "<TRANSFORMER-ID>"

output_transformer_idOptional[str]Required

The id of the transformer that reshapes the result after evaluation, or null when the collection does not use one.

metrics_settingsList[MetricSetting]Required

The scorers in the collection with their settings.

See MetricSetting.

classifiersList[CollectionClassifier]Required

The classifiers in the collection. To keep one on an update, list its name in metricsSettings with the activated you want.

See CollectionClassifier.

EvaluatorCollectionList

class EvaluatorCollectionList:
    evaluator_collections: List[EvaluatorCollection] = Field(alias="evaluatorCollections")

evaluator_collectionsList[EvaluatorCollection]Required

This is the list of evaluator collections in your project.

See EvaluatorCollection.

EvaluatorCollectionRef

class EvaluatorCollectionRef:
    id: str

idstrRequired

This is the id of the evaluator collection.

Example: "<EVALUATOR-COLLECTION-ID>"

MetricRefInput

An evaluator referenced by its name.

class MetricRefInput:
    name: str

namestrRequired

The name of the evaluator, which must match one in your project or one of Confident AI's built-in scorers.

Example: "Answer Relevancy"

MetricSetting

A scorer in the collection with the settings that decide whether and how it runs.

class MetricSetting:
    metric: MetricSummary
    activated: bool
    threshold: float
    include_reason: bool = Field(alias="includeReason")
    strict_mode: bool = Field(alias="strictMode")
    sample_rate: float = Field(alias="sampleRate")
    evaluation_model_provider: Optional[ModelProvider] = Field(alias="evaluationModelProvider")
    evaluation_model_name: Optional[str] = Field(alias="evaluationModelName")
    evaluation_model_credential_id: Optional[str] = Field(alias="evaluationModelCredentialId")
    decision_model_provider: Optional[ModelProvider] = Field(alias="decisionModelProvider")
    decision_model_name: Optional[str] = Field(alias="decisionModelName")
    eval_mode: Optional[EvalMode] = Field(alias="evalMode")

metricMetricSummaryRequired

activatedboolRequired

Whether this evaluator is activated. Only activated evaluators are run during an evaluation.

Example: true

thresholdfloatRequired

The threshold this scorer is scored against. A scorer passes when its score is equal to or greater than the threshold.

Example: 0.8

include_reasonboolRequired

Whether a written reason explaining the scorer's score is generated during evaluation.

Example: true

strict_modeboolRequired

Whether this scorer runs in strict mode, which outputs a binary score of 0 or 1 instead of a continuous score.

Example: false

sample_ratefloatRequired

The probability that this evaluator is run for any given evaluation, between 0 and 1. Applied on top of the collection's own sampleRate.

Example: 1

evaluation_model_providerOptional[ModelProvider]Required

evaluation_model_nameOptional[str]Required

The name of the model this scorer is evaluated with, or null when the project's default evaluation model is used.

Example: "gpt-4o"

evaluation_model_credential_idOptional[str]Required

For BEDROCK and AZURE, the id of the stored credential this scorer is evaluated with, or null when it uses the provider's default credential.

decision_model_providerOptional[ModelProvider]Required

decision_model_nameOptional[str]Required

The name of the decision model this scorer decides with, or null when the project's default decision model is used.

Example: "jev-latest"

eval_modeOptional[EvalMode]Required

MetricSettingInput

An evaluator to include in the collection with the settings that decide whether and how it runs. A classifier only takes activated. Omit evaluationModelProvider to evaluate with your project's default model, and decisionModelProvider to decide with your project's default decision model.

class MetricSettingInput:
    metric: MetricRefInput
    activated: Optional[bool] = None
    threshold: Optional[float] = None
    include_reason: Optional[bool] = Field(default=None, alias="includeReason")
    strict_mode: Optional[bool] = Field(default=None, alias="strictMode")
    sample_rate: Optional[float] = Field(default=None, alias="sampleRate")
    evaluation_model_provider: Optional[ModelProvider] = Field(default=None, alias="evaluationModelProvider")
    evaluation_model_name: Optional[str] = Field(default=None, alias="evaluationModelName")
    evaluation_model_credential_id: Optional[str] = Field(default=None, alias="evaluationModelCredentialId")
    decision_model_provider: Optional[ModelProvider] = Field(default=None, alias="decisionModelProvider")
    decision_model_name: Optional[str] = Field(default=None, alias="decisionModelName")
    eval_mode: Optional[EvalMode] = Field(default=None, alias="evalMode")

metricMetricRefInputRequired

activatedOptional[bool]

Whether this evaluator is activated. Only activated evaluators are run during an evaluation.

Example: true

thresholdOptional[float]

The threshold this scorer is scored against. A scorer passes when its score is equal to or greater than the threshold.

Example: 0.8

include_reasonOptional[bool]

Whether a written reason explaining the scorer's score is generated during evaluation.

Example: true

strict_modeOptional[bool]

Whether this scorer runs in strict mode, which outputs a binary score of 0 or 1 instead of a continuous score.

Example: false

sample_rateOptional[float]

The probability that this evaluator is run for any given evaluation, between 0 and 1. Applied on top of the collection's own sampleRate.

Example: 1

evaluation_model_providerOptional[ModelProvider]

evaluation_model_nameOptional[str]

The name of the model this scorer is evaluated with. Required whenever evaluationModelProvider is set to anything other than CONFIDENT_AI, and has no effect without a provider.

Example: "gpt-4o"

evaluation_model_credential_idOptional[str]

For BEDROCK and AZURE, the id of the stored credential this scorer is evaluated with. Omit it or send null to use the provider's default credential.

Example: "<MODEL-CREDENTIAL-ID>"

decision_model_providerOptional[ModelProvider]

decision_model_nameOptional[str]

The name of the decision model this scorer decides with, used in the HYBRID and DECISION eval modes. Required whenever decisionModelProvider is set, and has no effect without a provider. Agent Interruption, User Interruption, Turn-Taking Naturalness, Echo, Abrupt Cut-off and Background Noise take an audio model instead, in the HYBRID eval mode only: audio-decisions (HUME), or gpt-audio or gpt-audio-mini (OPEN_AI). It listens to each flagged event and drops the ones it judges not real. Reprompt, Agent Responsiveness and Voice Reliability always judge whether a caller who spoke again was repeating themselves with a decision model: this one in the DECISION eval mode, or the project's decision model when none is set.

Example: "jev-latest"

eval_modeOptional[EvalMode]

MetricSummary

A scorer as it appears inside a collection, by id and name.

class MetricSummary:
    id: str
    name: str

idstrRequired

This is the id of the scorer.

Example: "<METRIC-ID>"

namestrRequired

This is the name of the scorer.

Example: "Answer Relevancy"

ModelProvider

This is the provider of the model.

class ModelProvider(Enum):
    OPEN_AI = "OPEN_AI"
    CUSTOM = "CUSTOM"
    CONFIDENT_AI = "CONFIDENT_AI"
    BEDROCK = "BEDROCK"
    ANTHROPIC = "ANTHROPIC"
    GEMINI = "GEMINI"
    X_AI = "X_AI"
    DEEPSEEK = "DEEPSEEK"
    MOONSHOT_AI = "MOONSHOT_AI"
    VERTEX_AI = "VERTEX_AI"
    AZURE = "AZURE"
    MISTRAL = "MISTRAL"
    PERPLEXITY = "PERPLEXITY"
    OPEN_ROUTER = "OPEN_ROUTER"
    PORTKEY = "PORTKEY"
    LITE_LLM = "LITE_LLM"
    TRUE_FOUNDRY = "TRUE_FOUNDRY"
    HUGGING_FACE = "HUGGING_FACE"
    TYPE_SAFE = "TYPE_SAFE"
    FAL = "FAL"
    Z_AI = "Z_AI"
    DEEPGRAM = "DEEPGRAM"
    ASSEMBLY_AI = "ASSEMBLY_AI"
    ELEVEN_LABS = "ELEVEN_LABS"
    CARTESIA = "CARTESIA"
    HUME = "HUME"

OPEN_AI · CUSTOM · CONFIDENT_AI · BEDROCK · ANTHROPIC · GEMINI · X_AI · DEEPSEEK · MOONSHOT_AI · VERTEX_AI · AZURE · MISTRAL · PERPLEXITY · OPEN_ROUTER · PORTKEY · LITE_LLM · TRUE_FOUNDRY · HUGGING_FACE · TYPE_SAFE · FAL · Z_AI · DEEPGRAM · ASSEMBLY_AI · ELEVEN_LABS · CARTESIA · HUME

Building a production pipeline?Design a scalable API workflow for evals, datasets, traces, and promptsTalk to an engineer

Last updated on

Built byConfident AI