Documentation
¶
Overview ¶
Package experiments provides operations for managing Braintrust experiments.
Index ¶
- type API
- func (a *API) Create(ctx context.Context, params CreateParams) (*Experiment, error)
- func (a *API) Delete(ctx context.Context, experimentID string) error
- func (a *API) Get(ctx context.Context, experimentID string) (*Experiment, error)
- func (a *API) List(ctx context.Context, params ListParams) (*ListResponse, error)
- func (a *API) Register(ctx context.Context, name, projectID string, opts RegisterOpts) (*Experiment, error)
- type CreateParams
- type Experiment
- type ListParams
- type ListResponse
- type RegisterOpts
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 (*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) 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.