Skip to main content
Import and configure the evaluator of your choice.
example.py
Credentials are always passed in explicitly. The SDK never reads them from environment variables.

Options

Our evaluators are validated against a particular provider and model during development. Evaluators default to that same provider and model at runtime – for example, Grade Level Appropriateness will always use Google Gemini out of the box, because it was validated against Google Gemini during development. As a result, each evaluator requires specific API keys when being configured (e.g., google_api_key, openai_api_key, etc.).We recommend using the validated provider and model, but you can override that default with the model_override option.
Evaluators are validated and tested against their default models. Results with other models (using model_override) may vary.

Model override

model_override overrides the evaluator’s default provider and model. Both provider and model are required.
Provider is a closed set: Provider.OPENAI, Provider.GOOGLE, and Provider.ANTHROPIC. An override replaces the evaluator’s own LLM key requirement with the override provider’s. The example above needs anthropic_api_key, not google_api_key. It does not skip credentials for a non-LLM service the evaluator still calls. A model id the provider rejects surfaces as a ConfigurationError when the provider answers.

Logging

Customize how your evaluator logs information. The SDK uses Python’s standard logging module, attaches a NullHandler to its own logger, and never calls logging.basicConfig() or configures the root logger. Each evaluator logs to a child of learning_commons_evaluators named for its registry id — for example, learning_commons_evaluators.text_complexity.ela_reading.grade_level_appropriateness.
Coming from the TypeScript SDK? There, logger and logLevel are constructor options. In Python you configure the standard library logger instead.

Log level

Control logging verbosity:

Custom logger

Instead of injecting a logger, point the SDK’s logger at your handlers:
create_logger attaches a StreamHandler only when the target logger has none of its own, but a handler you pass is always added.

Telemetry

We collect limited usage and performance telemetry by default. This may include performance metrics (latency, token usage), technical metadata (such as SDK version and evaluator type) and related diagnostic information. This telemetry helps us improve evaluator quality, identify edge cases, and optimize performance. Telemetry never carries the text being evaluated. You can disable telemetry collection through the configuration options.

What you’ll need

While telemetry data collection is not required, we recommend enabling it so that we can better support your team’s use cases.
Telemetry is on by default. Events are anonymous unless you set learning_commons_api_key on the telemetry option. To attribute events to your Learning Commons user, generate an API key ↗ and include it in your evaluator’s configuration options:
We don’t collect your API keys or any user identifiers through the SDK.

What we collect

When telemetry is disabled, nothing is sent.

Quickstart

Install the SDK and run your first evaluator.

Evaluation

Understand evaluator output fields and types.

Error handling

Handle configuration, validation, and API errors.