from retab import Retab
client = Retab()
summary = client.workflows.experiments.metrics.get(
"exprun_2",
view="summary",
)
target_view = client.workflows.experiments.metrics.get(
"exprun_2",
view="by_target",
target_path="line_items.*.unit_price",
)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const summary = await client.workflows.experiments.metrics.get({
runId: "exprun_2",
view: "summary",
});
const targetView = await client.workflows.experiments.metrics.get({
runId: "exprun_2",
view: "by_target",
targetPath: "line_items.*.unit_price",
});
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
summary, err := client.Workflows.Experiments.Metrics.Get(
ctx,
&retab.ExperimentRunMetricsGetParams{
RunID: "exprun_2",
View: ptr(retab.ExperimentRunMetricsViewSummary),
},
)
if err != nil {
log.Fatal(err)
}
targetView, err := client.Workflows.Experiments.Metrics.Get(
ctx,
&retab.ExperimentRunMetricsGetParams{
RunID: "exprun_2",
View: ptr(retab.ExperimentRunMetricsViewByTarget),
TargetPath: ptr("line_items.*.unit_price"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Println(summary, targetView)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
summary = client.workflows.experiments.metrics.get(
run_id: 'exprun_2',
view: 'summary',
)
target_view = client.workflows.experiments.metrics.get(
run_id: 'exprun_2',
view: 'by_target',
target_path: 'line_items.*.unit_price',
)
use retab::enums::ExperimentRunMetricsView;
use retab::resources::experiment_run_metrics::GetParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let mut summary_params = GetParams::new("exprun_2");
summary_params.view = Some(ExperimentRunMetricsView::Summary);
let _summary = client.workflows().experiments().metrics().get(summary_params).await?;
let mut target_params = GetParams::new("exprun_2");
target_params.view = Some(ExperimentRunMetricsView::ByTarget);
target_params.target_path = Some("line_items.*.unit_price".into());
let _target_view = client.workflows().experiments().metrics().get(target_params).await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->workflows()->experiments()->metrics()->get(
runId: 'run_abc123',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Workflows.Experiments.Metrics.GetAsync(new ExperimentRunMetricsGetOptions());
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.workflows().experiments().metrics().get("run_abc123", null, null, null, null, null);
System.out.println(result);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/workflows/experiments/metrics?run_id=exprun_2&view=summary' \
-H 'Authorization: Bearer <your-api-key>'
curl -X 'GET' \
'https://api.retab.com/v1/workflows/experiments/metrics?run_id=exprun_2&view=by_target&target_path=total' \
-H 'Authorization: Bearer <your-api-key>'
{
"experiment_id": "exp_abc",
"run_id": "exprun_2",
"kind": "summary",
"view": "summary",
"block_execution_fingerprint": "deadbeef",
"block_kind": "extract",
"score": 0.83,
"prior_score": 0.79,
"prior_run_id": "exprun_1",
"documents": [
{
"id": "expdoc_1",
"filename": "a.pdf",
"score": 0.91,
"prior_score": 0.85
}
],
"aggregate": {
"likelihoods": { "total": 0.92, "vendor.name": 0.78 }
}
}
Get Experiment Run Metrics
Get metrics for an experiment run.
Requires the run_id query parameter. Use view to choose the breakdown
(summary, by_document, by_target, or votes), and narrow with
document_id or target_path. By default each score-bearing row also
carries a prior_score from the previous completed run; pass
include_prior=false to omit it or prior_run_id to compare against a
specific run.
from retab import Retab
client = Retab()
summary = client.workflows.experiments.metrics.get(
"exprun_2",
view="summary",
)
target_view = client.workflows.experiments.metrics.get(
"exprun_2",
view="by_target",
target_path="line_items.*.unit_price",
)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const summary = await client.workflows.experiments.metrics.get({
runId: "exprun_2",
view: "summary",
});
const targetView = await client.workflows.experiments.metrics.get({
runId: "exprun_2",
view: "by_target",
targetPath: "line_items.*.unit_price",
});
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
summary, err := client.Workflows.Experiments.Metrics.Get(
ctx,
&retab.ExperimentRunMetricsGetParams{
RunID: "exprun_2",
View: ptr(retab.ExperimentRunMetricsViewSummary),
},
)
if err != nil {
log.Fatal(err)
}
targetView, err := client.Workflows.Experiments.Metrics.Get(
ctx,
&retab.ExperimentRunMetricsGetParams{
RunID: "exprun_2",
View: ptr(retab.ExperimentRunMetricsViewByTarget),
TargetPath: ptr("line_items.*.unit_price"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Println(summary, targetView)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
summary = client.workflows.experiments.metrics.get(
run_id: 'exprun_2',
view: 'summary',
)
target_view = client.workflows.experiments.metrics.get(
run_id: 'exprun_2',
view: 'by_target',
target_path: 'line_items.*.unit_price',
)
use retab::enums::ExperimentRunMetricsView;
use retab::resources::experiment_run_metrics::GetParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let mut summary_params = GetParams::new("exprun_2");
summary_params.view = Some(ExperimentRunMetricsView::Summary);
let _summary = client.workflows().experiments().metrics().get(summary_params).await?;
let mut target_params = GetParams::new("exprun_2");
target_params.view = Some(ExperimentRunMetricsView::ByTarget);
target_params.target_path = Some("line_items.*.unit_price".into());
let _target_view = client.workflows().experiments().metrics().get(target_params).await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->workflows()->experiments()->metrics()->get(
runId: 'run_abc123',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Workflows.Experiments.Metrics.GetAsync(new ExperimentRunMetricsGetOptions());
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.workflows().experiments().metrics().get("run_abc123", null, null, null, null, null);
System.out.println(result);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/workflows/experiments/metrics?run_id=exprun_2&view=summary' \
-H 'Authorization: Bearer <your-api-key>'
curl -X 'GET' \
'https://api.retab.com/v1/workflows/experiments/metrics?run_id=exprun_2&view=by_target&target_path=total' \
-H 'Authorization: Bearer <your-api-key>'
{
"experiment_id": "exp_abc",
"run_id": "exprun_2",
"kind": "summary",
"view": "summary",
"block_execution_fingerprint": "deadbeef",
"block_kind": "extract",
"score": 0.83,
"prior_score": 0.79,
"prior_run_id": "exprun_1",
"documents": [
{
"id": "expdoc_1",
"filename": "a.pdf",
"score": 0.91,
"prior_score": 0.85
}
],
"aggregate": {
"likelihoods": { "total": 0.92, "vendor.name": 0.78 }
}
}
[0.0, 1.0] scale where 0.0 is low agreement and 1.0 is total
agreement.
The view query parameter selects one of four successful response shapes. In
responses, branch on kind; it is the shared discriminator for the response
shape. Because this endpoint is scoped to a concrete run_id, it returns
historical metrics for that run even if the experiment definition has since
changed. Use the experiment’s freshness / run_plan_mode fields from
experiments.get or experiments.list to decide whether to create a newer run.
| View | Use it to |
|---|---|
summary | Read the overall score plus block-specific aggregates. Start here. |
by_document | Drill into one document and see all its targets, sorted ascending. Requires document_id. |
by_target | Drill into one target and see its score across every document. Requires target_path. |
votes | See the per-voter consensus rows for one document/target cell. Requires both document_id and target_path. |
include_prior=false to omit prior-run comparison fields, or
prior_run_id=... to override which run is treated as the prior.
from retab import Retab
client = Retab()
summary = client.workflows.experiments.metrics.get(
"exprun_2",
view="summary",
)
target_view = client.workflows.experiments.metrics.get(
"exprun_2",
view="by_target",
target_path="line_items.*.unit_price",
)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const summary = await client.workflows.experiments.metrics.get({
runId: "exprun_2",
view: "summary",
});
const targetView = await client.workflows.experiments.metrics.get({
runId: "exprun_2",
view: "by_target",
targetPath: "line_items.*.unit_price",
});
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
summary, err := client.Workflows.Experiments.Metrics.Get(
ctx,
&retab.ExperimentRunMetricsGetParams{
RunID: "exprun_2",
View: ptr(retab.ExperimentRunMetricsViewSummary),
},
)
if err != nil {
log.Fatal(err)
}
targetView, err := client.Workflows.Experiments.Metrics.Get(
ctx,
&retab.ExperimentRunMetricsGetParams{
RunID: "exprun_2",
View: ptr(retab.ExperimentRunMetricsViewByTarget),
TargetPath: ptr("line_items.*.unit_price"),
},
)
if err != nil {
log.Fatal(err)
}
fmt.Println(summary, targetView)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
summary = client.workflows.experiments.metrics.get(
run_id: 'exprun_2',
view: 'summary',
)
target_view = client.workflows.experiments.metrics.get(
run_id: 'exprun_2',
view: 'by_target',
target_path: 'line_items.*.unit_price',
)
use retab::enums::ExperimentRunMetricsView;
use retab::resources::experiment_run_metrics::GetParams;
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let mut summary_params = GetParams::new("exprun_2");
summary_params.view = Some(ExperimentRunMetricsView::Summary);
let _summary = client.workflows().experiments().metrics().get(summary_params).await?;
let mut target_params = GetParams::new("exprun_2");
target_params.view = Some(ExperimentRunMetricsView::ByTarget);
target_params.target_path = Some("line_items.*.unit_price".into());
let _target_view = client.workflows().experiments().metrics().get(target_params).await?;
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->workflows()->experiments()->metrics()->get(
runId: 'run_abc123',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Workflows.Experiments.Metrics.GetAsync(new ExperimentRunMetricsGetOptions());
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.workflows().experiments().metrics().get("run_abc123", null, null, null, null, null);
System.out.println(result);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/workflows/experiments/metrics?run_id=exprun_2&view=summary' \
-H 'Authorization: Bearer <your-api-key>'
curl -X 'GET' \
'https://api.retab.com/v1/workflows/experiments/metrics?run_id=exprun_2&view=by_target&target_path=total' \
-H 'Authorization: Bearer <your-api-key>'
{
"experiment_id": "exp_abc",
"run_id": "exprun_2",
"kind": "summary",
"view": "summary",
"block_execution_fingerprint": "deadbeef",
"block_kind": "extract",
"score": 0.83,
"prior_score": 0.79,
"prior_run_id": "exprun_1",
"documents": [
{
"id": "expdoc_1",
"filename": "a.pdf",
"score": 0.91,
"prior_score": 0.85
}
],
"aggregate": {
"likelihoods": { "total": 0.92, "vendor.name": 0.78 }
}
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
summary, by_document, by_target, votes Response
Successful Response
- ExperimentSummaryMetricsResponse
- ExperimentByDocumentMetricsResponse
- ExperimentByTargetMetricsResponse
- ExperimentVotesMetricsResponse
- ExperimentMetricsStaleError
- ExperimentMetricsMissingError
Run-level summary plus block-specific diagnostics.
prior_run_id + prior_score populate when the request opts into
prior-comparison and a completed prior run exists.
score and documents cover only the documents that produced a result.
Compare scored_document_count against total_document_count to see
whether any of the run's documents failed and were left out.
extract, classifier, split, for_each "summary""summary"Show child attributes
Show child attributes
Extract-only diagnostics attached to the summary response.
- ExperimentExtractSummaryAggregate
- ExperimentConfusionSummaryAggregate
Show child attributes
Show child attributes