Documentation
¶
Index ¶
- Variables
- type AppendRunsRequest
- type Client
- func (c *Client) AppendRuns(ctx context.Context, req AppendRunsRequest) (*ExperimentWithRunIds, error)
- func (c *Client) Create(ctx context.Context, req CreateRequest) (*Experiment, error)
- func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
- func (c *Client) Get(ctx context.Context, req GetRequest) (*Experiment, error)
- func (c *Client) List(ctx context.Context, req ListRequest) (*ListExperiments, error)
- func (c *Client) ListRuns(ctx context.Context, req ListRunsRequest) (*ListExperimentRuns, error)
- type CreateRequest
- type DeleteRequest
- type EvaluatorFields
- type Experiment
- type ExperimentRun
- type ExperimentRunInput
- type ExperimentWithRunIds
- type GetRequest
- type ListExperimentRuns
- type ListExperiments
- type ListRequest
- type ListRunsRequest
- type TaskFields
Constants ¶
This section is empty.
Variables ¶
var ErrNoDatasetOrSpace = errors.New("experiments: either Dataset or Space is required")
ErrNoDatasetOrSpace is returned by Create when neither Dataset nor Space is set. An experiment is created either against a dataset or directly in a space, so exactly one of them is required.
var ErrNoRuns = errors.New("experiments: cannot create an experiment without runs")
ErrNoRuns is returned by Create when the request carries no runs. An experiment must have at least one run.
Functions ¶
This section is empty.
Types ¶
type AppendRunsRequest ¶ added in v0.11.0
type AppendRunsRequest struct {
// ExperimentID is the ID of the experiment to append runs to. Required.
ExperimentID string
// ExperimentRuns is the list of runs to append. Between 1 and 1000 runs
// per request. Each run must include Output. ExampleId is required only
// when the target experiment is associated with a dataset; leave it nil
// for an experiment that has none. The server rejects the mismatch.
ExperimentRuns []ExperimentRunInput
}
AppendRunsRequest is the request shape for Client.AppendRuns.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to the Arize Experiments API.
func New ¶
func New(gen *generated.ClientWithResponses) *Client
New constructs a Client from a generated ClientWithResponses.
func (*Client) AppendRuns ¶ added in v0.11.0
func (c *Client) AppendRuns(ctx context.Context, req AppendRunsRequest) (*ExperimentWithRunIds, error)
AppendRuns appends new runs to an existing experiment.
Between 1 and 1000 runs may be appended per request. Each run must include Output; ExampleId is required only when the target experiment is associated with a dataset, and must be left nil when it has none. Additional user-defined fields can be set via AdditionalProperties. The response includes the updated experiment and the generated IDs for the inserted runs in input order.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, req CreateRequest) (*Experiment, error)
Create creates a new experiment, either against a dataset or directly in a space. Exactly one of req.Dataset or req.Space is required; both are accepted as a name or an ID, and passing neither returns ErrNoDatasetOrSpace. Runs are transformed from user-named columns (per TaskFields and EvaluatorColumns) into the wire format the API expects. An empty req.Runs returns ErrNoRuns.
TaskFields.ExampleID is required only for a dataset-backed experiment, whose runs reference that dataset's examples. An experiment created in a space has no examples to reference, so its runs carry only an output.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
Delete removes an experiment, resolving by name or ID. Either Dataset or Space is required when Experiment is a name; Space is also required when Dataset is passed as a name. Resolving by Space alone returns AmbiguousNameError when the name matches more than one experiment in that space — pass Dataset or an experiment ID to disambiguate.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, req GetRequest) (*Experiment, error)
Get returns a single experiment, resolving by name or ID. Either Dataset or Space is required when Experiment is a name; Space is also required when Dataset is passed as a name. Resolving by Space alone returns AmbiguousNameError when the name matches more than one experiment in that space — pass Dataset or an experiment ID to disambiguate.
func (*Client) List ¶
func (c *Client) List(ctx context.Context, req ListRequest) (*ListExperiments, error)
List returns a paginated list of experiments, narrowed by whichever scope is given:
- req.Dataset — only experiments run on that dataset.
- req.Space — every experiment in that space, both those associated with a dataset and those without one.
- neither — every experiment across all spaces the caller can read.
Both accept a name or an ID. Passing both applies the narrower dataset scope, with req.Space used only to resolve a dataset name.
func (*Client) ListRuns ¶
func (c *Client) ListRuns(ctx context.Context, req ListRunsRequest) (*ListExperimentRuns, error)
ListRuns returns a paginated list of an experiment's runs, optionally narrowed by an SQL-like filter, resolving the experiment by name or ID. Either Dataset or Space is required when Experiment is a name. Runs come back in stable id ascending order; runs of an experiment with no dataset carry no example ID.
Filter can reference id, output, example_id, custom run columns, and eval.<name>.score/label/explanation/metadata.* or annotation.<name>.* fields; leave it empty to return all runs. Limit defaults to 50 (max 500); Cursor is opaque, so keep Filter unchanged while paging.
type CreateRequest ¶
type CreateRequest struct {
// Dataset accepts either a dataset name or ID, and associates the
// experiment with that dataset. Provide Space instead to create the
// experiment directly in a space with no dataset; passing neither returns
// ErrNoDatasetOrSpace.
Dataset string
// Space accepts either a space name or ID. When Dataset is empty, this is
// the space to create the experiment in. When Dataset is a name, this
// resolves it; ignored when Dataset is an ID.
Space string
// Name is the experiment's name. Required. Must be unique within the
// dataset, or within the space when there is no dataset.
Name string
// Runs is the list of raw experiment run records. Required (one or more);
// an empty Runs returns ErrNoRuns.
Runs []map[string]any
// TaskFields names the example_id and output columns in Runs. Required.
// TaskFields.ExampleID itself is required only when Dataset is set.
TaskFields TaskFields
// EvaluatorColumns optionally maps evaluator name → its result column
// names in Runs. Mapped columns are renamed to `eval.<evaluator>.score`
// and friends in the wire payload. Optional.
EvaluatorColumns map[string]EvaluatorFields
}
CreateRequest describes a new experiment. Each entry of Runs is a row of user data; TaskFields tells the SDK which columns hold the per-run example_id and output. EvaluatorColumns optionally remaps evaluator result columns to the wire format (e.g. `eval.<name>.score`).
type DeleteRequest ¶
type DeleteRequest struct {
// Experiment accepts either an experiment name or ID.
Experiment string
// Dataset accepts either a dataset name or ID and scopes the search for
// Experiment to that dataset. Provide Dataset or Space when Experiment is a
// name; both are ignored when Experiment is an ID.
Dataset string
// Space accepts either a space name or ID. When Dataset is empty, it scopes
// the search for Experiment to that space — the only way to resolve the name
// of an experiment with no dataset. A name matching more than one experiment
// in the space yields AmbiguousNameError, since names are unique per dataset
// and, separately, per space among experiments with no dataset. Also
// required when Dataset is passed as a name.
Space string
}
DeleteRequest identifies the experiment to delete.
type EvaluatorFields ¶
type EvaluatorFields struct {
// Score is the column name holding the evaluator score. Optional; silently
// skipped for any run record that lacks the named column.
Score string
// Label is the column name holding the evaluator label. Optional; silently
// skipped for any run record that lacks the named column.
Label string
// Explanation is the column name holding the evaluator explanation. Optional;
// silently skipped for any run record that lacks the named column.
Explanation string
// Metadata maps a result metadata key to the column name in each run record
// holding its value. An empty value means "use the metadata key as the
// column name". Optional, but each named metadata column must be present in
// every run record or Create returns an error.
Metadata map[string]string
}
EvaluatorFields names the columns in each Run map that hold an evaluator's results. At least one of Score or Label must be set.
Score, Label, and Explanation are best-effort: when a named column is absent from a given run record, that field is silently omitted for that run (not an error). Metadata columns, by contrast, are required — a named metadata column missing from any run record makes Create return an error.
type Experiment ¶
type Experiment = generated.Experiment
Response and nested types are aliases to generated wire shapes so callers can construct/assert on them without importing internal/generated.
type ExperimentRun ¶
type ExperimentRun = generated.ExperimentRun
Response and nested types are aliases to generated wire shapes so callers can construct/assert on them without importing internal/generated.
type ExperimentRunInput ¶ added in v0.17.0
type ExperimentRunInput = generated.ExperimentRunInput
Response and nested types are aliases to generated wire shapes so callers can construct/assert on them without importing internal/generated.
type ExperimentWithRunIds ¶ added in v0.11.0
type ExperimentWithRunIds = generated.ExperimentWithRunIds
Response and nested types are aliases to generated wire shapes so callers can construct/assert on them without importing internal/generated.
type GetRequest ¶
type GetRequest struct {
// Experiment accepts either an experiment name or ID.
Experiment string
// Dataset accepts either a dataset name or ID and scopes the search for
// Experiment to that dataset. Provide Dataset or Space when Experiment is a
// name; both are ignored when Experiment is an ID.
Dataset string
// Space accepts either a space name or ID. When Dataset is empty, it scopes
// the search for Experiment to that space — the only way to resolve the name
// of an experiment with no dataset. A name matching more than one experiment
// in the space yields AmbiguousNameError, since names are unique per dataset
// and, separately, per space among experiments with no dataset. Also
// required when Dataset is passed as a name.
Space string
}
GetRequest identifies the experiment to fetch.
type ListExperimentRuns ¶ added in v0.18.0
type ListExperimentRuns = generated.ListExperimentRunsResponse
Response and nested types are aliases to generated wire shapes so callers can construct/assert on them without importing internal/generated.
type ListExperiments ¶ added in v0.18.0
type ListExperiments = generated.ListExperimentsResponse
Response and nested types are aliases to generated wire shapes so callers can construct/assert on them without importing internal/generated.
type ListRequest ¶
type ListRequest struct {
// Dataset is an optional name-or-ID filter. When non-empty, only
// experiments belonging to this dataset are returned.
Dataset string
// Space is an optional name-or-ID filter. When non-empty and Dataset is
// empty, only experiments in this space are returned — both those
// associated with a dataset and those without one. When Dataset is also
// set, Space only resolves Dataset when Dataset is a name. When both are
// empty, experiments across all accessible spaces are returned.
Space string
// Name is an optional case-insensitive substring filter on the experiment
// name. When empty, results are not filtered by name.
Name string
// Limit is the optional maximum number of items to return (max 100). When
// zero, the server applies its default page size.
Limit int
// Cursor is the optional opaque pagination cursor from a previous
// response's pagination.next_cursor. When empty, results start from the
// first page.
Cursor string
}
ListRequest holds optional filters for listing experiments.
type ListRunsRequest ¶
type ListRunsRequest struct {
// Experiment accepts either an experiment name or ID.
Experiment string
// Dataset accepts either a dataset name or ID and scopes the search for
// Experiment to that dataset. Provide Dataset or Space when Experiment is a
// name; both are ignored when Experiment is an ID.
Dataset string
// Space accepts either a space name or ID. When Dataset is empty, it scopes
// the search for Experiment to that space — the only way to resolve the name
// of an experiment with no dataset. A name matching more than one experiment
// in the space yields AmbiguousNameError, since names are unique per dataset
// and, separately, per space among experiments with no dataset. Also
// required when Dataset is passed as a name.
Space string
// Filter is an optional SQL-like filter expression. When empty, no filter
// is applied. Whitespace-only values are rejected with 400; malformed
// expressions are rejected with 422.
Filter string
// Limit is the optional maximum number of runs to return (1-500). When
// zero, the server applies its default of 50.
Limit int
// Cursor is the optional opaque pagination cursor from a previous
// response's pagination.next_cursor. When empty, results start from the
// first page. Keep Filter unchanged while paging with a cursor.
Cursor string
}
ListRunsRequest identifies the experiment (resolved by name or ID) and the filter and pagination options for listing its runs.
type TaskFields ¶
type TaskFields struct {
// ExampleID is the column name in each run record holding the dataset
// example ID (a string matching an example in the dataset/version).
// Required when the experiment is associated with a dataset. Leave empty
// for an experiment created in a space, whose runs reference no example;
// no example_id is then sent.
ExampleID string
// Output is the column name in each run record holding the task output.
// String values are sent as-is; any other type is JSON-encoded.
Output string
}
TaskFields names the columns in each Run map that hold the dataset example ID and the task output. Output is always required; ExampleID is required only for a dataset-backed experiment.