Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

Promptfoo

cetra reads the spans Promptfoo exports for an eval: the test cases, the provider calls and the graders of each assertion. Its model calls are llm spans, and its graders are evaluator spans.

Install Promptfoo from npm. The fixture was captured with Promptfoo 0.125.1.

Terminal window
npm install promptfoo@0.125.1

Promptfoo exports its spans when it is switched on by its own variables. Set them, with the full traces URL, then run the eval.

Terminal window
export PROMPTFOO_OTEL_ENABLED=true
export PROMPTFOO_OTEL_ENDPOINT=http://localhost:8080/v1/traces
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <SK_CETRA_KEY>"
export PROMPTFOO_DISABLE_TELEMETRY=1
export PROMPTFOO_DISABLE_UPDATE=1
export PROMPTFOO_DISABLE_SHARING=1
npx promptfoo eval -c promptfooconfig.yaml --max-concurrency 1

Replace <SK_CETRA_KEY> with your sk-cetra-… API key. See Send OpenTelemetry.

The config file needs tracing: { enabled: true }. Promptfoo starts its tracing only when the config enables it.

The fixture’s eval has one prompt, one provider, a contains assertion and an llm-rubric assertion. The llm-rubric assertion asks a model to grade the answer, so the eval makes a second model call. The fixture used --max-concurrency 1, which keeps the spans in a fixed order.

PROMPTFOO_OTEL_ENDPOINT is passed to the exporter as it is given, so it must be the full /v1/traces URL.

The header was checked with Promptfoo 0.125.1 and a local stand-in for cetra, not with cetra itself. With OTEL_EXPORTER_OTLP_HEADERS set, the trace POST carried Authorization: Bearer sk-test. With OTEL_EXPORTER_OTLP_TRACES_HEADERS set, it carried the same header. With neither, no Authorization header was sent. The fixture’s own capture sent no key.

Each test case of the eval is a trace with these spans:

  • a span for the test case, promptfoo.test_case;
  • a span for the provider call, openai:chat:gpt-4o-mini, and an llm span for the model call inside it, chat gpt-4o-mini, with the token counts and the cost, which cetra computes from its price table;
  • an evaluator span for the contains assertion, grader contains. It makes no model call;
  • an evaluator span for the llm-rubric assertion, grader llm-rubric, with a span for the grader’s provider call and an llm span for the grader’s model call, with its own token counts and cost.
  • PROMPTFOO_DISABLE_TELEMETRY=1 did not stop every request in version 0.125.1. Promptfoo still posts a feature_used event to its own servers.
  • No span has an input or an output, including the model calls. The messages and the answers of the eval are not in cetra.
  • The span names are Promptfoo’s. The test case and the provider calls are plain spans.
  • The fixture covers one provider and two assertions. Other assertion types and other providers were not captured.
  • The fixture was captured with Promptfoo 0.125.1.
  • If a field is missing, look at the span’s Attributes tab and compare it with Span attributes.
  • Traces: read the trace as a tree and a timeline.
  • Cost and tokens: how cost is computed from the token counts.