Help us shape the future of Go! Take the 2026 Go Developer Survey

experiments

package
v0.2.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package experiments provides operations for managing Braintrust experiments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API provides methods for experiment operations

func New

func New(client *https.Client) *API

New creates a new Experiments API client

func (*API) Create

func (a *API) Create(ctx context.Context, params CreateParams) (*Experiment, error)

Create creates a new experiment. If there is an existing experiment in the project with the same name as the one specified in the request, will return the existing experiment unmodified (unless EnsureNew is true).

func (*API) Delete

func (a *API) Delete(ctx context.Context, experimentID string) error

Delete deletes an experiment by its ID.

func (*API) Get

func (a *API) Get(ctx context.Context, experimentID string) (*Experiment, error)

Get retrieves an experiment by its ID.

func (*API) List

func (a *API) List(ctx context.Context, params ListParams) (*ListResponse, error)

List returns a list of experiments filtered by the given parameters.

func (*API) Register

func (a *API) Register(ctx context.Context, name, projectID string, opts RegisterOpts) (*Experiment, error)

Register creates or gets an experiment by name within a project. This is a convenience wrapper around Create for backward compatibility. If an experiment with the given name already exists and Update is true, it returns that experiment. If Update is false (or via EnsureNew), it creates a new experiment.

type CreateParams

type CreateParams struct {
	ProjectID      string                 `json:"project_id"`
	Name           string                 `json:"name,omitempty"`
	Description    string                 `json:"description,omitempty"`
	BaseExpID      string                 `json:"base_exp_id,omitempty"`
	DatasetID      string                 `json:"dataset_id,omitempty"`
	DatasetVersion string                 `json:"dataset_version,omitempty"`
	Public         bool                   `json:"public,omitempty"`
	EnsureNew      bool                   `json:"ensure_new,omitempty"`
	Tags           []string               `json:"tags,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
}

CreateParams represents parameters for creating an experiment

type Experiment

type Experiment struct {
	ID             string                 `json:"id"`
	Name           string                 `json:"name"`
	ProjectID      string                 `json:"project_id"`
	Description    string                 `json:"description,omitempty"`
	BaseExpID      string                 `json:"base_exp_id,omitempty"`
	DatasetID      string                 `json:"dataset_id,omitempty"`
	DatasetVersion string                 `json:"dataset_version,omitempty"`
	Public         bool                   `json:"public,omitempty"`
	Tags           []string               `json:"tags,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
}

Experiment represents an experiment from the API

type ListParams

type ListParams struct {
	// ProjectID filters experiments by project
	ProjectID string
	// ExperimentName filters by specific experiment name
	ExperimentName string
	// OrgName filters by organization name
	OrgName string
	// Limit maximum number of objects to return (default 25, max 1000)
	Limit int
}

ListParams represents parameters for listing experiments

type ListResponse

type ListResponse struct {
	Objects []Experiment `json:"objects"`
}

ListResponse represents a paginated list of experiments

type RegisterOpts

type RegisterOpts struct {
	Tags           []string
	Metadata       map[string]interface{}
	Update         bool   // If true, allow reusing existing experiment instead of creating new one
	DatasetID      string // Optional dataset ID to link to this experiment
	DatasetVersion string // Optional dataset version
}

RegisterOpts contains optional parameters for registering an experiment. This is a convenience wrapper that provides backward compatibility.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL