langfuse_client/score

GET /api/public/v2/scores — paginated fetch of eval scores from a Langfuse project. Build a Query with query() and the with_* helpers, then pass it to list(client, query).

Types

Pagination metadata returned alongside data.

pub type Page {
  Page(page: Int, limit: Int, total_items: Int, total_pages: Int)
}

Constructors

  • Page(page: Int, limit: Int, total_items: Int, total_pages: Int)

Filters for list. Build with query() and the with_* helpers. All fields default to None, which means “no filter” and lets Langfuse apply its server-side defaults.

pub type Query {
  Query(
    page: option.Option(Int),
    limit: option.Option(Int),
    user_id: option.Option(String),
    name: option.Option(String),
    from_timestamp: option.Option(String),
    to_timestamp: option.Option(String),
    source: option.Option(String),
    trace_id: option.Option(String),
    session_id: option.Option(String),
    dataset_run_id: option.Option(String),
    data_type: option.Option(String),
  )
}

Constructors

A score as returned by GET /api/public/v2/scores. Only the fields common across data types are decoded; inspect data_type to decide whether to read value (numeric/boolean/categorical/correction) or string_value (boolean/categorical/correction/text).

pub type Score {
  Score(
    id: String,
    trace_id: option.Option(String),
    session_id: option.Option(String),
    observation_id: option.Option(String),
    name: String,
    data_type: String,
    source: String,
    value: option.Option(Float),
    string_value: option.Option(String),
    comment: option.Option(String),
    timestamp: String,
    environment: option.Option(String),
  )
}

Constructors

A page of scores plus its pagination metadata.

pub type Scores {
  Scores(data: List(Score), meta: Page)
}

Constructors

Values

pub fn decode(body: String) -> Result(Scores, json.DecodeError)

Parse a GET /api/public/v2/scores response body. Useful if you already have the raw body in hand (e.g. from a cached/recorded response).

pub fn list(
  c: client.Client,
  q: Query,
) -> Result(Scores, client.Error)

Fetch one page of scores from GET /api/public/v2/scores. Erlang-only — the JavaScript target lacks an HTTP transport in this library.

pub fn query() -> Query

Empty query — pass to list to retrieve the first page with the server defaults (page 1, limit 50).

pub fn with_data_type(q: Query, data_type: String) -> Query

Filter to scores of a given data type (NUMERIC, BOOLEAN, CATEGORICAL).

pub fn with_dataset_run_id(
  q: Query,
  dataset_run_id: String,
) -> Query

Filter to scores tied to this dataset run.

pub fn with_from_timestamp(q: Query, from: String) -> Query

Lower bound on timestamp (ISO 8601, inclusive).

pub fn with_limit(q: Query, limit: Int) -> Query

Set the page size (Langfuse defaults to 50).

pub fn with_name(q: Query, name: String) -> Query

Filter to scores with this exact name.

pub fn with_page(q: Query, page: Int) -> Query

Set the page number (1-indexed).

pub fn with_session_id(q: Query, session_id: String) -> Query

Filter to scores attached to this session.

pub fn with_to_timestamp(q: Query, to: String) -> Query

Upper bound on timestamp (ISO 8601, exclusive).

pub fn with_trace_id(q: Query, trace_id: String) -> Query

Filter to scores attached to this trace.

pub fn with_user_id(q: Query, user_id: String) -> Query

Filter to scores whose trace has this user id.

Search Document