braintrust

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

README

Braintrust Go API Library

Go Reference

The Braintrust Go library provides convenient access to the Braintrust REST API from applications written in Go. The full API of this library can be found in api.md.

It is generated with Stainless.

Installation

import (
	"github.com/braintrustdata/braintrust-go" // imported as braintrust
)

Or to pin the version:

go get -u 'github.com/braintrustdata/braintrust-go@v0.3.0'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/braintrustdata/braintrust-go"
	"github.com/braintrustdata/braintrust-go/option"
)

func main() {
	client := braintrust.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("BRAINTRUST_API_KEY")
	)
	project, err := client.Projects.New(context.TODO(), braintrust.ProjectNewParams{
		Name: braintrust.F("foobar"),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", project.ID)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: braintrust.F("hello"),

	// Explicitly send `"description": null`
	Description: braintrust.Null[string](),

	Point: braintrust.F(braintrust.Point{
		X: braintrust.Int(0),
		Y: braintrust.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: braintrust.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := braintrust.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Projects.New(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Projects.ListAutoPaging(context.TODO(), braintrust.ProjectListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	project := iter.Current()
	fmt.Printf("%+v\n", project)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Projects.List(context.TODO(), braintrust.ProjectListParams{})
for page != nil {
	for _, project := range page.Objects {
		fmt.Printf("%+v\n", project)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *braintrust.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Projects.New(context.TODO(), braintrust.ProjectNewParams{
	Name: braintrust.F("foobar"),
})
if err != nil {
	var apierr *braintrust.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/project": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Projects.New(
	ctx,
	braintrust.ProjectNewParams{
		Name: braintrust.F("foobar"),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper braintrust.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := braintrust.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Projects.New(
	context.TODO(),
	braintrust.ProjectNewParams{
		Name: braintrust.F("foobar"),
	},
	option.WithMaxRetries(5),
)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   braintrust.F("id_xxxx"),
    Data: braintrust.F(FooNewParamsData{
        FirstName: braintrust.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := braintrust.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Documentation

Index

Constants

View Source
const ACLObjectTypeDataset = shared.ACLObjectTypeDataset

This is an alias to an internal value.

View Source
const ACLObjectTypeExperiment = shared.ACLObjectTypeExperiment

This is an alias to an internal value.

View Source
const ACLObjectTypeGroup = shared.ACLObjectTypeGroup

This is an alias to an internal value.

View Source
const ACLObjectTypeOrgMember = shared.ACLObjectTypeOrgMember

This is an alias to an internal value.

View Source
const ACLObjectTypeOrgProject = shared.ACLObjectTypeOrgProject

This is an alias to an internal value.

View Source
const ACLObjectTypeOrganization = shared.ACLObjectTypeOrganization

This is an alias to an internal value.

View Source
const ACLObjectTypeProject = shared.ACLObjectTypeProject

This is an alias to an internal value.

View Source
const ACLObjectTypeProjectLog = shared.ACLObjectTypeProjectLog

This is an alias to an internal value.

View Source
const ACLObjectTypePrompt = shared.ACLObjectTypePrompt

This is an alias to an internal value.

View Source
const ACLObjectTypePromptSession = shared.ACLObjectTypePromptSession

This is an alias to an internal value.

View Source
const ACLObjectTypeRole = shared.ACLObjectTypeRole

This is an alias to an internal value.

View Source
const ACLPermissionCreate = shared.ACLPermissionCreate

This is an alias to an internal value.

View Source
const ACLPermissionCreateACLs = shared.ACLPermissionCreateACLs

This is an alias to an internal value.

View Source
const ACLPermissionDelete = shared.ACLPermissionDelete

This is an alias to an internal value.

View Source
const ACLPermissionDeleteACLs = shared.ACLPermissionDeleteACLs

This is an alias to an internal value.

View Source
const ACLPermissionRead = shared.ACLPermissionRead

This is an alias to an internal value.

View Source
const ACLPermissionReadACLs = shared.ACLPermissionReadACLs

This is an alias to an internal value.

View Source
const ACLPermissionUpdate = shared.ACLPermissionUpdate

This is an alias to an internal value.

View Source
const ACLPermissionUpdateACLs = shared.ACLPermissionUpdateACLs

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeDataset = shared.ACLRestrictObjectTypeDataset

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeExperiment = shared.ACLRestrictObjectTypeExperiment

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeGroup = shared.ACLRestrictObjectTypeGroup

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeOrgMember = shared.ACLRestrictObjectTypeOrgMember

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeOrgProject = shared.ACLRestrictObjectTypeOrgProject

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeOrganization = shared.ACLRestrictObjectTypeOrganization

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeProject = shared.ACLRestrictObjectTypeProject

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeProjectLog = shared.ACLRestrictObjectTypeProjectLog

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypePrompt = shared.ACLRestrictObjectTypePrompt

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypePromptSession = shared.ACLRestrictObjectTypePromptSession

This is an alias to an internal value.

View Source
const ACLRestrictObjectTypeRole = shared.ACLRestrictObjectTypeRole

This is an alias to an internal value.

View Source
const ExperimentEventSpanAttributesTypeEval = shared.ExperimentEventSpanAttributesTypeEval

This is an alias to an internal value.

View Source
const ExperimentEventSpanAttributesTypeFunction = shared.ExperimentEventSpanAttributesTypeFunction

This is an alias to an internal value.

View Source
const ExperimentEventSpanAttributesTypeLlm = shared.ExperimentEventSpanAttributesTypeLlm

This is an alias to an internal value.

View Source
const ExperimentEventSpanAttributesTypeScore = shared.ExperimentEventSpanAttributesTypeScore

This is an alias to an internal value.

View Source
const ExperimentEventSpanAttributesTypeTask = shared.ExperimentEventSpanAttributesTypeTask

This is an alias to an internal value.

View Source
const ExperimentEventSpanAttributesTypeTool = shared.ExperimentEventSpanAttributesTypeTool

This is an alias to an internal value.

View Source
const FeedbackDatasetItemSourceAPI = shared.FeedbackDatasetItemSourceAPI

This is an alias to an internal value.

View Source
const FeedbackDatasetItemSourceApp = shared.FeedbackDatasetItemSourceApp

This is an alias to an internal value.

View Source
const FeedbackDatasetItemSourceExternal = shared.FeedbackDatasetItemSourceExternal

This is an alias to an internal value.

View Source
const FeedbackExperimentItemSourceAPI = shared.FeedbackExperimentItemSourceAPI

This is an alias to an internal value.

View Source
const FeedbackExperimentItemSourceApp = shared.FeedbackExperimentItemSourceApp

This is an alias to an internal value.

View Source
const FeedbackExperimentItemSourceExternal = shared.FeedbackExperimentItemSourceExternal

This is an alias to an internal value.

View Source
const FeedbackProjectLogsItemSourceAPI = shared.FeedbackProjectLogsItemSourceAPI

This is an alias to an internal value.

View Source
const FeedbackProjectLogsItemSourceApp = shared.FeedbackProjectLogsItemSourceApp

This is an alias to an internal value.

View Source
const FeedbackProjectLogsItemSourceExternal = shared.FeedbackProjectLogsItemSourceExternal

This is an alias to an internal value.

View Source
const FunctionFunctionDataCodeDataLocationPositionTaskTask = shared.FunctionFunctionDataCodeDataLocationPositionTaskTask

This is an alias to an internal value.

View Source
const FunctionFunctionDataCodeDataLocationTypeExperiment = shared.FunctionFunctionDataCodeDataLocationTypeExperiment

This is an alias to an internal value.

View Source
const FunctionFunctionDataCodeDataRuntimeContextRuntimeNode = shared.FunctionFunctionDataCodeDataRuntimeContextRuntimeNode

This is an alias to an internal value.

View Source
const FunctionFunctionDataCodeTypeCode = shared.FunctionFunctionDataCodeTypeCode

This is an alias to an internal value.

View Source
const FunctionFunctionDataGlobalTypeGlobal = shared.FunctionFunctionDataGlobalTypeGlobal

This is an alias to an internal value.

View Source
const FunctionFunctionDataPromptTypePrompt = shared.FunctionFunctionDataPromptTypePrompt

This is an alias to an internal value.

View Source
const FunctionFunctionDataTypeCode = shared.FunctionFunctionDataTypeCode

This is an alias to an internal value.

View Source
const FunctionFunctionDataTypeGlobal = shared.FunctionFunctionDataTypeGlobal

This is an alias to an internal value.

View Source
const FunctionFunctionDataTypePrompt = shared.FunctionFunctionDataTypePrompt

This is an alias to an internal value.

View Source
const FunctionLogIDP = shared.FunctionLogIDP

This is an alias to an internal value.

View Source
const InsertExperimentEventMergeSpanAttributesTypeEval = shared.InsertExperimentEventMergeSpanAttributesTypeEval

This is an alias to an internal value.

View Source
const InsertExperimentEventMergeSpanAttributesTypeFunction = shared.InsertExperimentEventMergeSpanAttributesTypeFunction

This is an alias to an internal value.

View Source
const InsertExperimentEventMergeSpanAttributesTypeLlm = shared.InsertExperimentEventMergeSpanAttributesTypeLlm

This is an alias to an internal value.

View Source
const InsertExperimentEventMergeSpanAttributesTypeScore = shared.InsertExperimentEventMergeSpanAttributesTypeScore

This is an alias to an internal value.

View Source
const InsertExperimentEventMergeSpanAttributesTypeTask = shared.InsertExperimentEventMergeSpanAttributesTypeTask

This is an alias to an internal value.

View Source
const InsertExperimentEventMergeSpanAttributesTypeTool = shared.InsertExperimentEventMergeSpanAttributesTypeTool

This is an alias to an internal value.

View Source
const InsertExperimentEventReplaceSpanAttributesTypeEval = shared.InsertExperimentEventReplaceSpanAttributesTypeEval

This is an alias to an internal value.

View Source
const InsertExperimentEventReplaceSpanAttributesTypeFunction = shared.InsertExperimentEventReplaceSpanAttributesTypeFunction

This is an alias to an internal value.

View Source
const InsertExperimentEventReplaceSpanAttributesTypeLlm = shared.InsertExperimentEventReplaceSpanAttributesTypeLlm

This is an alias to an internal value.

View Source
const InsertExperimentEventReplaceSpanAttributesTypeScore = shared.InsertExperimentEventReplaceSpanAttributesTypeScore

This is an alias to an internal value.

View Source
const InsertExperimentEventReplaceSpanAttributesTypeTask = shared.InsertExperimentEventReplaceSpanAttributesTypeTask

This is an alias to an internal value.

View Source
const InsertExperimentEventReplaceSpanAttributesTypeTool = shared.InsertExperimentEventReplaceSpanAttributesTypeTool

This is an alias to an internal value.

View Source
const InsertProjectLogsEventMergeSpanAttributesTypeEval = shared.InsertProjectLogsEventMergeSpanAttributesTypeEval

This is an alias to an internal value.

View Source
const InsertProjectLogsEventMergeSpanAttributesTypeFunction = shared.InsertProjectLogsEventMergeSpanAttributesTypeFunction

This is an alias to an internal value.

View Source
const InsertProjectLogsEventMergeSpanAttributesTypeLlm = shared.InsertProjectLogsEventMergeSpanAttributesTypeLlm

This is an alias to an internal value.

View Source
const InsertProjectLogsEventMergeSpanAttributesTypeScore = shared.InsertProjectLogsEventMergeSpanAttributesTypeScore

This is an alias to an internal value.

View Source
const InsertProjectLogsEventMergeSpanAttributesTypeTask = shared.InsertProjectLogsEventMergeSpanAttributesTypeTask

This is an alias to an internal value.

View Source
const InsertProjectLogsEventMergeSpanAttributesTypeTool = shared.InsertProjectLogsEventMergeSpanAttributesTypeTool

This is an alias to an internal value.

View Source
const InsertProjectLogsEventReplaceSpanAttributesTypeEval = shared.InsertProjectLogsEventReplaceSpanAttributesTypeEval

This is an alias to an internal value.

View Source
const InsertProjectLogsEventReplaceSpanAttributesTypeFunction = shared.InsertProjectLogsEventReplaceSpanAttributesTypeFunction

This is an alias to an internal value.

View Source
const InsertProjectLogsEventReplaceSpanAttributesTypeLlm = shared.InsertProjectLogsEventReplaceSpanAttributesTypeLlm

This is an alias to an internal value.

View Source
const InsertProjectLogsEventReplaceSpanAttributesTypeScore = shared.InsertProjectLogsEventReplaceSpanAttributesTypeScore

This is an alias to an internal value.

View Source
const InsertProjectLogsEventReplaceSpanAttributesTypeTask = shared.InsertProjectLogsEventReplaceSpanAttributesTypeTask

This is an alias to an internal value.

View Source
const InsertProjectLogsEventReplaceSpanAttributesTypeTool = shared.InsertProjectLogsEventReplaceSpanAttributesTypeTool

This is an alias to an internal value.

View Source
const PathLookupFilterTypePathLookup = shared.PathLookupFilterTypePathLookup

This is an alias to an internal value.

View Source
const ProjectLogsEventLogIDG = shared.ProjectLogsEventLogIDG

This is an alias to an internal value.

View Source
const ProjectLogsEventSpanAttributesTypeEval = shared.ProjectLogsEventSpanAttributesTypeEval

This is an alias to an internal value.

View Source
const ProjectLogsEventSpanAttributesTypeFunction = shared.ProjectLogsEventSpanAttributesTypeFunction

This is an alias to an internal value.

View Source
const ProjectLogsEventSpanAttributesTypeLlm = shared.ProjectLogsEventSpanAttributesTypeLlm

This is an alias to an internal value.

View Source
const ProjectLogsEventSpanAttributesTypeScore = shared.ProjectLogsEventSpanAttributesTypeScore

This is an alias to an internal value.

View Source
const ProjectLogsEventSpanAttributesTypeTask = shared.ProjectLogsEventSpanAttributesTypeTask

This is an alias to an internal value.

View Source
const ProjectLogsEventSpanAttributesTypeTool = shared.ProjectLogsEventSpanAttributesTypeTool

This is an alias to an internal value.

View Source
const ProjectScoreConfigDestinationExpected = shared.ProjectScoreConfigDestinationExpected

This is an alias to an internal value.

View Source
const ProjectScoreScoreTypeCategorical = shared.ProjectScoreScoreTypeCategorical

This is an alias to an internal value.

View Source
const ProjectScoreScoreTypeMinimum = shared.ProjectScoreScoreTypeMinimum

This is an alias to an internal value.

View Source
const ProjectScoreScoreTypeSlider = shared.ProjectScoreScoreTypeSlider

This is an alias to an internal value.

View Source
const ProjectScoreScoreTypeWeighted = shared.ProjectScoreScoreTypeWeighted

This is an alias to an internal value.

View Source
const PromptDataOptionsParamsOpenAIModelParamsFunctionCallAutoAuto = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallAutoAuto

This is an alias to an internal value.

View Source
const PromptDataOptionsParamsOpenAIModelParamsFunctionCallNoneNone = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallNoneNone

This is an alias to an internal value.

View Source
const PromptDataOptionsParamsOpenAIModelParamsResponseFormatTypeJsonObject = shared.PromptDataOptionsParamsOpenAIModelParamsResponseFormatTypeJsonObject

This is an alias to an internal value.

View Source
const PromptDataOptionsParamsOpenAIModelParamsToolChoiceAutoAuto = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceAutoAuto

This is an alias to an internal value.

View Source
const PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionTypeFunction = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionTypeFunction

This is an alias to an internal value.

View Source
const PromptDataOptionsParamsOpenAIModelParamsToolChoiceNoneNone = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceNoneNone

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesAssistantRoleAssistant = shared.PromptDataPromptChatMessagesAssistantRoleAssistant

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesAssistantToolCallsTypeFunction = shared.PromptDataPromptChatMessagesAssistantToolCallsTypeFunction

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesFallbackRoleModel = shared.PromptDataPromptChatMessagesFallbackRoleModel

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesFunctionRoleFunction = shared.PromptDataPromptChatMessagesFunctionRoleFunction

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesRoleAssistant = shared.PromptDataPromptChatMessagesRoleAssistant

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesRoleFunction = shared.PromptDataPromptChatMessagesRoleFunction

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesRoleModel = shared.PromptDataPromptChatMessagesRoleModel

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesRoleSystem = shared.PromptDataPromptChatMessagesRoleSystem

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesRoleTool = shared.PromptDataPromptChatMessagesRoleTool

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesRoleUser = shared.PromptDataPromptChatMessagesRoleUser

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesSystemRoleSystem = shared.PromptDataPromptChatMessagesSystemRoleSystem

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesToolRoleTool = shared.PromptDataPromptChatMessagesToolRoleTool

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetailAuto = shared.PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetailAuto

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetailHigh = shared.PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetailHigh

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetailLow = shared.PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetailLow

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayImageURLTypeImageURL = shared.PromptDataPromptChatMessagesUserContentArrayImageURLTypeImageURL

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayTextTypeText = shared.PromptDataPromptChatMessagesUserContentArrayTextTypeText

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayTypeImageURL = shared.PromptDataPromptChatMessagesUserContentArrayTypeImageURL

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserContentArrayTypeText = shared.PromptDataPromptChatMessagesUserContentArrayTypeText

This is an alias to an internal value.

View Source
const PromptDataPromptChatMessagesUserRoleUser = shared.PromptDataPromptChatMessagesUserRoleUser

This is an alias to an internal value.

View Source
const PromptDataPromptChatTypeChat = shared.PromptDataPromptChatTypeChat

This is an alias to an internal value.

View Source
const PromptDataPromptCompletionTypeCompletion = shared.PromptDataPromptCompletionTypeCompletion

This is an alias to an internal value.

View Source
const PromptDataPromptTypeChat = shared.PromptDataPromptTypeChat

This is an alias to an internal value.

View Source
const PromptDataPromptTypeCompletion = shared.PromptDataPromptTypeCompletion

This is an alias to an internal value.

View Source
const PromptLogIDP = shared.PromptLogIDP

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionCreate = shared.RoleMemberPermissionsPermissionCreate

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionCreateACLs = shared.RoleMemberPermissionsPermissionCreateACLs

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionDelete = shared.RoleMemberPermissionsPermissionDelete

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionDeleteACLs = shared.RoleMemberPermissionsPermissionDeleteACLs

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionRead = shared.RoleMemberPermissionsPermissionRead

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionReadACLs = shared.RoleMemberPermissionsPermissionReadACLs

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionUpdate = shared.RoleMemberPermissionsPermissionUpdate

This is an alias to an internal value.

View Source
const RoleMemberPermissionsPermissionUpdateACLs = shared.RoleMemberPermissionsPermissionUpdateACLs

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeDataset = shared.RoleMemberPermissionsRestrictObjectTypeDataset

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeExperiment = shared.RoleMemberPermissionsRestrictObjectTypeExperiment

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeGroup = shared.RoleMemberPermissionsRestrictObjectTypeGroup

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeOrgMember = shared.RoleMemberPermissionsRestrictObjectTypeOrgMember

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeOrgProject = shared.RoleMemberPermissionsRestrictObjectTypeOrgProject

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeOrganization = shared.RoleMemberPermissionsRestrictObjectTypeOrganization

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeProject = shared.RoleMemberPermissionsRestrictObjectTypeProject

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeProjectLog = shared.RoleMemberPermissionsRestrictObjectTypeProjectLog

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypePrompt = shared.RoleMemberPermissionsRestrictObjectTypePrompt

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypePromptSession = shared.RoleMemberPermissionsRestrictObjectTypePromptSession

This is an alias to an internal value.

View Source
const RoleMemberPermissionsRestrictObjectTypeRole = shared.RoleMemberPermissionsRestrictObjectTypeRole

This is an alias to an internal value.

View Source
const ViewObjectTypeDataset = shared.ViewObjectTypeDataset

This is an alias to an internal value.

View Source
const ViewObjectTypeExperiment = shared.ViewObjectTypeExperiment

This is an alias to an internal value.

View Source
const ViewObjectTypeGroup = shared.ViewObjectTypeGroup

This is an alias to an internal value.

View Source
const ViewObjectTypeOrgMember = shared.ViewObjectTypeOrgMember

This is an alias to an internal value.

View Source
const ViewObjectTypeOrgProject = shared.ViewObjectTypeOrgProject

This is an alias to an internal value.

View Source
const ViewObjectTypeOrganization = shared.ViewObjectTypeOrganization

This is an alias to an internal value.

View Source
const ViewObjectTypeProject = shared.ViewObjectTypeProject

This is an alias to an internal value.

View Source
const ViewObjectTypeProjectLog = shared.ViewObjectTypeProjectLog

This is an alias to an internal value.

View Source
const ViewObjectTypePrompt = shared.ViewObjectTypePrompt

This is an alias to an internal value.

View Source
const ViewObjectTypePromptSession = shared.ViewObjectTypePromptSession

This is an alias to an internal value.

View Source
const ViewObjectTypeRole = shared.ViewObjectTypeRole

This is an alias to an internal value.

View Source
const ViewViewTypeDataset = shared.ViewViewTypeDataset

This is an alias to an internal value.

View Source
const ViewViewTypeDatasets = shared.ViewViewTypeDatasets

This is an alias to an internal value.

View Source
const ViewViewTypeExperiment = shared.ViewViewTypeExperiment

This is an alias to an internal value.

View Source
const ViewViewTypeExperiments = shared.ViewViewTypeExperiments

This is an alias to an internal value.

View Source
const ViewViewTypeLogs = shared.ViewViewTypeLogs

This is an alias to an internal value.

View Source
const ViewViewTypePlaygrounds = shared.ViewViewTypePlaygrounds

This is an alias to an internal value.

View Source
const ViewViewTypeProjects = shared.ViewViewTypeProjects

This is an alias to an internal value.

View Source
const ViewViewTypePrompts = shared.ViewViewTypePrompts

This is an alias to an internal value.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam added in v0.2.0

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type ACL added in v0.2.0

type ACL = shared.ACL

An ACL grants a certain permission or role to a certain user or group on an object.

ACLs are inherited across the object hierarchy. So for example, if a user has read permissions on a project, they will also have read permissions on any experiment, dataset, etc. created within that project.

To restrict a grant to a particular sub-object, you may specify `restrict_object_type` in the ACL, as part of a direct permission grant or as part of a role.

This is an alias to an internal type.

type ACLListParams added in v0.2.0

type ACLListParams struct {
	// The id of the object the ACL applies to
	ObjectID param.Field[string] `query:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ACLListParamsObjectType] `query:"object_type,required"`
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[ACLListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (ACLListParams) URLQuery added in v0.2.0

func (r ACLListParams) URLQuery() (v url.Values)

URLQuery serializes ACLListParams's query parameters as `url.Values`.

type ACLListParamsIDsArray added in v0.2.0

type ACLListParamsIDsArray []string

func (ACLListParamsIDsArray) ImplementsACLListParamsIDsUnion added in v0.2.0

func (r ACLListParamsIDsArray) ImplementsACLListParamsIDsUnion()

type ACLListParamsIDsUnion added in v0.2.0

type ACLListParamsIDsUnion interface {
	ImplementsACLListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, ACLListParamsIDsArray.

type ACLListParamsObjectType added in v0.2.0

type ACLListParamsObjectType string

The object type that the ACL applies to

const (
	ACLListParamsObjectTypeOrganization  ACLListParamsObjectType = "organization"
	ACLListParamsObjectTypeProject       ACLListParamsObjectType = "project"
	ACLListParamsObjectTypeExperiment    ACLListParamsObjectType = "experiment"
	ACLListParamsObjectTypeDataset       ACLListParamsObjectType = "dataset"
	ACLListParamsObjectTypePrompt        ACLListParamsObjectType = "prompt"
	ACLListParamsObjectTypePromptSession ACLListParamsObjectType = "prompt_session"
	ACLListParamsObjectTypeGroup         ACLListParamsObjectType = "group"
	ACLListParamsObjectTypeRole          ACLListParamsObjectType = "role"
	ACLListParamsObjectTypeOrgMember     ACLListParamsObjectType = "org_member"
	ACLListParamsObjectTypeProjectLog    ACLListParamsObjectType = "project_log"
	ACLListParamsObjectTypeOrgProject    ACLListParamsObjectType = "org_project"
)

func (ACLListParamsObjectType) IsKnown added in v0.2.0

func (r ACLListParamsObjectType) IsKnown() bool

type ACLNewParams added in v0.2.0

type ACLNewParams struct {
	// The id of the object the ACL applies to
	ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ACLNewParamsObjectType] `json:"object_type,required"`
	// Id of the group the ACL applies to. Exactly one of `user_id` and `group_id` will
	// be provided
	GroupID param.Field[string] `json:"group_id" format:"uuid"`
	// Permission the ACL grants. Exactly one of `permission` and `role_id` will be
	// provided
	Permission param.Field[ACLNewParamsPermission] `json:"permission"`
	// When setting a permission directly, optionally restricts the permission grant to
	// just the specified object type. Cannot be set alongside a `role_id`.
	RestrictObjectType param.Field[ACLNewParamsRestrictObjectType] `json:"restrict_object_type"`
	// Id of the role the ACL grants. Exactly one of `permission` and `role_id` will be
	// provided
	RoleID param.Field[string] `json:"role_id" format:"uuid"`
	// Id of the user the ACL applies to. Exactly one of `user_id` and `group_id` will
	// be provided
	UserID param.Field[string] `json:"user_id" format:"uuid"`
}

func (ACLNewParams) MarshalJSON added in v0.2.0

func (r ACLNewParams) MarshalJSON() (data []byte, err error)

type ACLNewParamsObjectType added in v0.3.0

type ACLNewParamsObjectType string

The object type that the ACL applies to

const (
	ACLNewParamsObjectTypeOrganization  ACLNewParamsObjectType = "organization"
	ACLNewParamsObjectTypeProject       ACLNewParamsObjectType = "project"
	ACLNewParamsObjectTypeExperiment    ACLNewParamsObjectType = "experiment"
	ACLNewParamsObjectTypeDataset       ACLNewParamsObjectType = "dataset"
	ACLNewParamsObjectTypePrompt        ACLNewParamsObjectType = "prompt"
	ACLNewParamsObjectTypePromptSession ACLNewParamsObjectType = "prompt_session"
	ACLNewParamsObjectTypeGroup         ACLNewParamsObjectType = "group"
	ACLNewParamsObjectTypeRole          ACLNewParamsObjectType = "role"
	ACLNewParamsObjectTypeOrgMember     ACLNewParamsObjectType = "org_member"
	ACLNewParamsObjectTypeProjectLog    ACLNewParamsObjectType = "project_log"
	ACLNewParamsObjectTypeOrgProject    ACLNewParamsObjectType = "org_project"
)

func (ACLNewParamsObjectType) IsKnown added in v0.3.0

func (r ACLNewParamsObjectType) IsKnown() bool

type ACLNewParamsPermission added in v0.3.0

type ACLNewParamsPermission string

Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided

const (
	ACLNewParamsPermissionCreate     ACLNewParamsPermission = "create"
	ACLNewParamsPermissionRead       ACLNewParamsPermission = "read"
	ACLNewParamsPermissionUpdate     ACLNewParamsPermission = "update"
	ACLNewParamsPermissionDelete     ACLNewParamsPermission = "delete"
	ACLNewParamsPermissionCreateACLs ACLNewParamsPermission = "create_acls"
	ACLNewParamsPermissionReadACLs   ACLNewParamsPermission = "read_acls"
	ACLNewParamsPermissionUpdateACLs ACLNewParamsPermission = "update_acls"
	ACLNewParamsPermissionDeleteACLs ACLNewParamsPermission = "delete_acls"
)

func (ACLNewParamsPermission) IsKnown added in v0.3.0

func (r ACLNewParamsPermission) IsKnown() bool

type ACLNewParamsRestrictObjectType added in v0.3.0

type ACLNewParamsRestrictObjectType string

When setting a permission directly, optionally restricts the permission grant to just the specified object type. Cannot be set alongside a `role_id`.

const (
	ACLNewParamsRestrictObjectTypeOrganization  ACLNewParamsRestrictObjectType = "organization"
	ACLNewParamsRestrictObjectTypeProject       ACLNewParamsRestrictObjectType = "project"
	ACLNewParamsRestrictObjectTypeExperiment    ACLNewParamsRestrictObjectType = "experiment"
	ACLNewParamsRestrictObjectTypeDataset       ACLNewParamsRestrictObjectType = "dataset"
	ACLNewParamsRestrictObjectTypePrompt        ACLNewParamsRestrictObjectType = "prompt"
	ACLNewParamsRestrictObjectTypePromptSession ACLNewParamsRestrictObjectType = "prompt_session"
	ACLNewParamsRestrictObjectTypeGroup         ACLNewParamsRestrictObjectType = "group"
	ACLNewParamsRestrictObjectTypeRole          ACLNewParamsRestrictObjectType = "role"
	ACLNewParamsRestrictObjectTypeOrgMember     ACLNewParamsRestrictObjectType = "org_member"
	ACLNewParamsRestrictObjectTypeProjectLog    ACLNewParamsRestrictObjectType = "project_log"
	ACLNewParamsRestrictObjectTypeOrgProject    ACLNewParamsRestrictObjectType = "org_project"
)

func (ACLNewParamsRestrictObjectType) IsKnown added in v0.3.0

type ACLObjectType added in v0.2.0

type ACLObjectType = shared.ACLObjectType

The object type that the ACL applies to

This is an alias to an internal type.

type ACLPermission added in v0.2.0

type ACLPermission = shared.ACLPermission

Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided

This is an alias to an internal type.

type ACLRestrictObjectType added in v0.2.0

type ACLRestrictObjectType = shared.ACLRestrictObjectType

When setting a permission directly, optionally restricts the permission grant to just the specified object type. Cannot be set alongside a `role_id`.

This is an alias to an internal type.

type ACLService added in v0.2.0

type ACLService struct {
	Options []option.RequestOption
}

ACLService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewACLService method instead.

func NewACLService added in v0.2.0

func NewACLService(opts ...option.RequestOption) (r *ACLService)

NewACLService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ACLService) Delete added in v0.2.0

func (r *ACLService) Delete(ctx context.Context, aclID string, opts ...option.RequestOption) (res *shared.ACL, err error)

Delete an acl object by its id

func (*ACLService) Get added in v0.2.0

func (r *ACLService) Get(ctx context.Context, aclID string, opts ...option.RequestOption) (res *shared.ACL, err error)

Get an acl object by its id

func (*ACLService) List added in v0.2.0

func (r *ACLService) List(ctx context.Context, query ACLListParams, opts ...option.RequestOption) (res *pagination.ListObjects[shared.ACL], err error)

List out all acls. The acls are sorted by creation date, with the most recently-created acls coming first

func (*ACLService) ListAutoPaging added in v0.2.0

List out all acls. The acls are sorted by creation date, with the most recently-created acls coming first

func (*ACLService) New added in v0.2.0

func (r *ACLService) New(ctx context.Context, body ACLNewParams, opts ...option.RequestOption) (res *shared.ACL, err error)

Create a new acl. If there is an existing acl with the same contents as the one specified in the request, will return the existing acl unmodified

type APIKey added in v0.2.0

type APIKey = shared.APIKey

This is an alias to an internal type.

type APIKeyListParams added in v0.2.0

type APIKeyListParams struct {
	// Name of the api_key to search for
	APIKeyName param.Field[string] `query:"api_key_name"`
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[APIKeyListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (APIKeyListParams) URLQuery added in v0.2.0

func (r APIKeyListParams) URLQuery() (v url.Values)

URLQuery serializes APIKeyListParams's query parameters as `url.Values`.

type APIKeyListParamsIDsArray added in v0.2.0

type APIKeyListParamsIDsArray []string

func (APIKeyListParamsIDsArray) ImplementsAPIKeyListParamsIDsUnion added in v0.2.0

func (r APIKeyListParamsIDsArray) ImplementsAPIKeyListParamsIDsUnion()

type APIKeyListParamsIDsUnion added in v0.2.0

type APIKeyListParamsIDsUnion interface {
	ImplementsAPIKeyListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, APIKeyListParamsIDsArray.

type APIKeyNewParams added in v0.2.0

type APIKeyNewParams struct {
	// Name of the api key. Does not have to be unique
	Name param.Field[string] `json:"name,required"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, you may specify the name of
	// the organization the API key belongs in.
	OrgName param.Field[string] `json:"org_name"`
}

func (APIKeyNewParams) MarshalJSON added in v0.2.0

func (r APIKeyNewParams) MarshalJSON() (data []byte, err error)

type APIKeyService added in v0.2.0

type APIKeyService struct {
	Options []option.RequestOption
}

APIKeyService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIKeyService method instead.

func NewAPIKeyService added in v0.2.0

func NewAPIKeyService(opts ...option.RequestOption) (r *APIKeyService)

NewAPIKeyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIKeyService) Delete added in v0.2.0

func (r *APIKeyService) Delete(ctx context.Context, apiKeyID string, opts ...option.RequestOption) (res *shared.APIKey, err error)

Delete an api_key object by its id

func (*APIKeyService) Get added in v0.2.0

func (r *APIKeyService) Get(ctx context.Context, apiKeyID string, opts ...option.RequestOption) (res *shared.APIKey, err error)

Get an api_key object by its id

func (*APIKeyService) List added in v0.2.0

List out all api_keys. The api_keys are sorted by creation date, with the most recently-created api_keys coming first

func (*APIKeyService) ListAutoPaging added in v0.2.0

List out all api_keys. The api_keys are sorted by creation date, with the most recently-created api_keys coming first

func (*APIKeyService) New added in v0.2.0

Create a new api_key. It is possible to have multiple API keys with the same name. There is no de-duplication

type Client

type Client struct {
	Options       []option.RequestOption
	TopLevel      *TopLevelService
	Projects      *ProjectService
	Experiments   *ExperimentService
	Datasets      *DatasetService
	Prompts       *PromptService
	Roles         *RoleService
	Groups        *GroupService
	ACLs          *ACLService
	Users         *UserService
	ProjectScores *ProjectScoreService
	ProjectTags   *ProjectTagService
	Functions     *FunctionService
	Views         *ViewService
	Organizations *OrganizationService
	APIKeys       *APIKeyService
}

Client creates a struct with services and top level methods that help with interacting with the braintrust API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (BRAINTRUST_API_KEY). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete added in v0.2.0

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute added in v0.2.0

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get added in v0.2.0

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch added in v0.2.0

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post added in v0.2.0

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put added in v0.2.0

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CreateAPIKeyOutput added in v0.2.0

type CreateAPIKeyOutput = shared.CreateAPIKeyOutput

This is an alias to an internal type.

type DataSummary added in v0.2.0

type DataSummary = shared.DataSummary

Summary of a dataset's data

This is an alias to an internal type.

type Dataset

type Dataset = shared.Dataset

This is an alias to an internal type.

type DatasetEvent added in v0.2.0

type DatasetEvent = shared.DatasetEvent

This is an alias to an internal type.

type DatasetFeedbackParams

type DatasetFeedbackParams struct {
	// A list of dataset feedback items
	Feedback param.Field[[]shared.FeedbackDatasetItemParam] `json:"feedback,required"`
}

func (DatasetFeedbackParams) MarshalJSON

func (r DatasetFeedbackParams) MarshalJSON() (data []byte, err error)

type DatasetFetchParams

type DatasetFetchParams struct {
	// limit the number of traces fetched
	//
	// Fetch queries may be paginated if the total result size is expected to be large
	// (e.g. project_logs which accumulate over a long time). Note that fetch queries
	// only support pagination in descending time order (from latest to earliest
	// `_xact_id`. Furthermore, later pages may return rows which showed up in earlier
	// pages, except with an earlier `_xact_id`. This happens because pagination occurs
	// over the whole version history of the event log. You will most likely want to
	// exclude any such duplicate, outdated rows (by `id`) from your combined result
	// set.
	//
	// The `limit` parameter controls the number of full traces to return. So you may
	// end up with more individual rows than the specified limit if you are fetching
	// events containing traces.
	Limit param.Field[int64] `query:"limit"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxRootSpanID param.Field[string] `query:"max_root_span_id"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxXactID param.Field[string] `query:"max_xact_id"`
	// Retrieve a snapshot of events from a past time
	//
	// The version id is essentially a filter on the latest event transaction id. You
	// can use the `max_xact_id` returned by a past fetch as the version to reproduce
	// that exact fetch.
	Version param.Field[string] `query:"version"`
}

func (DatasetFetchParams) URLQuery

func (r DatasetFetchParams) URLQuery() (v url.Values)

URLQuery serializes DatasetFetchParams's query parameters as `url.Values`.

type DatasetFetchPostParams

type DatasetFetchPostParams struct {
	// An opaque string to be used as a cursor for the next page of results, in order
	// from latest to earliest.
	//
	// The string can be obtained directly from the `cursor` property of the previous
	// fetch query
	Cursor param.Field[string] `json:"cursor"`
	// A list of filters on the events to fetch. Currently, only path-lookup type
	// filters are supported, but we may add more in the future
	Filters param.Field[[]shared.PathLookupFilterParam] `json:"filters"`
	// limit the number of traces fetched
	//
	// Fetch queries may be paginated if the total result size is expected to be large
	// (e.g. project_logs which accumulate over a long time). Note that fetch queries
	// only support pagination in descending time order (from latest to earliest
	// `_xact_id`. Furthermore, later pages may return rows which showed up in earlier
	// pages, except with an earlier `_xact_id`. This happens because pagination occurs
	// over the whole version history of the event log. You will most likely want to
	// exclude any such duplicate, outdated rows (by `id`) from your combined result
	// set.
	//
	// The `limit` parameter controls the number of full traces to return. So you may
	// end up with more individual rows than the specified limit if you are fetching
	// events containing traces.
	Limit param.Field[int64] `json:"limit"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxRootSpanID param.Field[string] `json:"max_root_span_id"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxXactID param.Field[string] `json:"max_xact_id"`
	// Retrieve a snapshot of events from a past time
	//
	// The version id is essentially a filter on the latest event transaction id. You
	// can use the `max_xact_id` returned by a past fetch as the version to reproduce
	// that exact fetch.
	Version param.Field[string] `json:"version"`
}

func (DatasetFetchPostParams) MarshalJSON

func (r DatasetFetchPostParams) MarshalJSON() (data []byte, err error)

type DatasetInsertParams

type DatasetInsertParams struct {
	// A list of dataset events to insert
	Events param.Field[[]DatasetInsertParamsEventUnion] `json:"events,required"`
}

func (DatasetInsertParams) MarshalJSON

func (r DatasetInsertParams) MarshalJSON() (data []byte, err error)

type DatasetInsertParamsEvent

type DatasetInsertParamsEvent struct {
	Input    param.Field[interface{}] `json:"input,required"`
	Expected param.Field[interface{}] `json:"expected,required"`
	Metadata param.Field[interface{}] `json:"metadata,required"`
	Tags     param.Field[interface{}] `json:"tags,required"`
	// A unique identifier for the dataset event. If you don't provide one, BrainTrust
	// will generate one for you
	ID param.Field[string] `json:"id"`
	// The timestamp the dataset event was created
	Created param.Field[time.Time] `json:"created" format:"date-time"`
	// Pass `_object_delete=true` to mark the dataset event deleted. Deleted events
	// will not show up in subsequent fetches for this dataset
	ObjectDelete param.Field[bool] `json:"_object_delete"`
	// The `_is_merge` field controls how the row is merged with any existing row with
	// the same id in the DB. By default (or when set to `false`), the existing row is
	// completely replaced by the new row. When set to `true`, the new row is
	// deep-merged into the existing row
	//
	// For example, say there is an existing row in the DB
	// `{"id": "foo", "input": {"a": 5, "b": 10}}`. If we merge a new row as
	// `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}`, the new row
	// will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we replace the
	// new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be
	// `{"id": "foo", "input": {"b": 11, "c": 20}}`
	IsMerge param.Field[bool] `json:"_is_merge"`
	// Use the `_parent_id` field to create this row as a subspan of an existing row.
	// It cannot be specified alongside `_is_merge=true`. Tracking hierarchical
	// relationships are important for tracing (see the
	// [guide](https://www.braintrust.dev/docs/guides/tracing) for full details).
	//
	// For example, say we have logged a row
	// `{"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`.
	// We can create a sub-span of the parent row by logging
	// `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`.
	// In the webapp, only the root span row `"abc"` will show up in the summary view.
	// You can view the full trace hierarchy (in this case, the `"llm_call"` row) by
	// clicking on the "abc" row.
	ParentID   param.Field[string]      `json:"_parent_id"`
	MergePaths param.Field[interface{}] `json:"_merge_paths,required"`
}

A dataset event

func (DatasetInsertParamsEvent) ImplementsDatasetInsertParamsEventUnion added in v0.3.0

func (r DatasetInsertParamsEvent) ImplementsDatasetInsertParamsEventUnion()

func (DatasetInsertParamsEvent) MarshalJSON added in v0.3.0

func (r DatasetInsertParamsEvent) MarshalJSON() (data []byte, err error)

type DatasetInsertParamsEventUnion added in v0.3.0

type DatasetInsertParamsEventUnion interface {
	ImplementsDatasetInsertParamsEventUnion()
}

A dataset event

Satisfied by shared.InsertDatasetEventReplaceParam, shared.InsertDatasetEventMergeParam, DatasetInsertParamsEvent.

type DatasetListParams

type DatasetListParams struct {
	// Name of the dataset to search for
	DatasetName param.Field[string] `query:"dataset_name"`
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[DatasetListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Project id
	ProjectID param.Field[string] `query:"project_id" format:"uuid"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (DatasetListParams) URLQuery

func (r DatasetListParams) URLQuery() (v url.Values)

URLQuery serializes DatasetListParams's query parameters as `url.Values`.

type DatasetListParamsIDsArray added in v0.2.0

type DatasetListParamsIDsArray []string

func (DatasetListParamsIDsArray) ImplementsDatasetListParamsIDsUnion added in v0.2.0

func (r DatasetListParamsIDsArray) ImplementsDatasetListParamsIDsUnion()

type DatasetListParamsIDsUnion added in v0.2.0

type DatasetListParamsIDsUnion interface {
	ImplementsDatasetListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, DatasetListParamsIDsArray.

type DatasetNewParams

type DatasetNewParams struct {
	// Name of the dataset. Within a project, dataset names are unique
	Name param.Field[string] `json:"name,required"`
	// Textual description of the dataset
	Description param.Field[string] `json:"description"`
	// Unique identifier for the project that the dataset belongs under
	ProjectID param.Field[string] `json:"project_id" format:"uuid"`
}

func (DatasetNewParams) MarshalJSON

func (r DatasetNewParams) MarshalJSON() (data []byte, err error)

type DatasetService

type DatasetService struct {
	Options []option.RequestOption
}

DatasetService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDatasetService method instead.

func NewDatasetService

func NewDatasetService(opts ...option.RequestOption) (r *DatasetService)

NewDatasetService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DatasetService) Delete

func (r *DatasetService) Delete(ctx context.Context, datasetID string, opts ...option.RequestOption) (res *shared.Dataset, err error)

Delete a dataset object by its id

func (*DatasetService) Feedback

func (r *DatasetService) Feedback(ctx context.Context, datasetID string, body DatasetFeedbackParams, opts ...option.RequestOption) (err error)

Log feedback for a set of dataset events

func (*DatasetService) Fetch

Fetch the events in a dataset. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body

func (*DatasetService) FetchPost

Fetch the events in a dataset. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query

func (*DatasetService) Get

func (r *DatasetService) Get(ctx context.Context, datasetID string, opts ...option.RequestOption) (res *shared.Dataset, err error)

Get a dataset object by its id

func (*DatasetService) Insert

func (r *DatasetService) Insert(ctx context.Context, datasetID string, body DatasetInsertParams, opts ...option.RequestOption) (res *shared.InsertEventsResponse, err error)

Insert a set of events into the dataset

func (*DatasetService) List

List out all datasets. The datasets are sorted by creation date, with the most recently-created datasets coming first

func (*DatasetService) ListAutoPaging

List out all datasets. The datasets are sorted by creation date, with the most recently-created datasets coming first

func (*DatasetService) New

func (r *DatasetService) New(ctx context.Context, body DatasetNewParams, opts ...option.RequestOption) (res *shared.Dataset, err error)

Create a new dataset. If there is an existing dataset in the project with the same name as the one specified in the request, will return the existing dataset unmodified

func (*DatasetService) Summarize added in v0.2.0

func (r *DatasetService) Summarize(ctx context.Context, datasetID string, query DatasetSummarizeParams, opts ...option.RequestOption) (res *shared.SummarizeDatasetResponse, err error)

Summarize dataset

func (*DatasetService) Update

func (r *DatasetService) Update(ctx context.Context, datasetID string, body DatasetUpdateParams, opts ...option.RequestOption) (res *shared.Dataset, err error)

Partially update a dataset object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type DatasetSummarizeParams added in v0.2.0

type DatasetSummarizeParams struct {
	// Whether to summarize the data. If false (or omitted), only the metadata will be
	// returned.
	SummarizeData param.Field[bool] `query:"summarize_data"`
}

func (DatasetSummarizeParams) URLQuery added in v0.2.0

func (r DatasetSummarizeParams) URLQuery() (v url.Values)

URLQuery serializes DatasetSummarizeParams's query parameters as `url.Values`.

type DatasetUpdateParams

type DatasetUpdateParams struct {
	// Textual description of the dataset
	Description param.Field[string] `json:"description"`
	// User-controlled metadata about the dataset
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
	// Name of the dataset. Within a project, dataset names are unique
	Name param.Field[string] `json:"name"`
}

func (DatasetUpdateParams) MarshalJSON

func (r DatasetUpdateParams) MarshalJSON() (data []byte, err error)

type Error

type Error = apierror.Error

type Experiment

type Experiment = shared.Experiment

This is an alias to an internal type.

type ExperimentEvent added in v0.2.0

type ExperimentEvent = shared.ExperimentEvent

This is an alias to an internal type.

type ExperimentEventContext added in v0.2.0

type ExperimentEventContext = shared.ExperimentEventContext

Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event

This is an alias to an internal type.

type ExperimentEventMetrics added in v0.2.0

type ExperimentEventMetrics = shared.ExperimentEventMetrics

Metrics are numerical measurements tracking the execution of the code that produced the experiment event. Use "start" and "end" to track the time span over which the experiment event was produced

This is an alias to an internal type.

type ExperimentEventSpanAttributes added in v0.2.0

type ExperimentEventSpanAttributes = shared.ExperimentEventSpanAttributes

Human-identifying attributes of the span, such as name, type, etc.

This is an alias to an internal type.

type ExperimentEventSpanAttributesType added in v0.2.0

type ExperimentEventSpanAttributesType = shared.ExperimentEventSpanAttributesType

Type of the span, for display purposes only

This is an alias to an internal type.

type ExperimentFeedbackParams

type ExperimentFeedbackParams struct {
	// A list of experiment feedback items
	Feedback param.Field[[]shared.FeedbackExperimentItemParam] `json:"feedback,required"`
}

func (ExperimentFeedbackParams) MarshalJSON

func (r ExperimentFeedbackParams) MarshalJSON() (data []byte, err error)

type ExperimentFetchParams

type ExperimentFetchParams struct {
	// limit the number of traces fetched
	//
	// Fetch queries may be paginated if the total result size is expected to be large
	// (e.g. project_logs which accumulate over a long time). Note that fetch queries
	// only support pagination in descending time order (from latest to earliest
	// `_xact_id`. Furthermore, later pages may return rows which showed up in earlier
	// pages, except with an earlier `_xact_id`. This happens because pagination occurs
	// over the whole version history of the event log. You will most likely want to
	// exclude any such duplicate, outdated rows (by `id`) from your combined result
	// set.
	//
	// The `limit` parameter controls the number of full traces to return. So you may
	// end up with more individual rows than the specified limit if you are fetching
	// events containing traces.
	Limit param.Field[int64] `query:"limit"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxRootSpanID param.Field[string] `query:"max_root_span_id"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxXactID param.Field[string] `query:"max_xact_id"`
	// Retrieve a snapshot of events from a past time
	//
	// The version id is essentially a filter on the latest event transaction id. You
	// can use the `max_xact_id` returned by a past fetch as the version to reproduce
	// that exact fetch.
	Version param.Field[string] `query:"version"`
}

func (ExperimentFetchParams) URLQuery

func (r ExperimentFetchParams) URLQuery() (v url.Values)

URLQuery serializes ExperimentFetchParams's query parameters as `url.Values`.

type ExperimentFetchPostParams

type ExperimentFetchPostParams struct {
	// An opaque string to be used as a cursor for the next page of results, in order
	// from latest to earliest.
	//
	// The string can be obtained directly from the `cursor` property of the previous
	// fetch query
	Cursor param.Field[string] `json:"cursor"`
	// A list of filters on the events to fetch. Currently, only path-lookup type
	// filters are supported, but we may add more in the future
	Filters param.Field[[]shared.PathLookupFilterParam] `json:"filters"`
	// limit the number of traces fetched
	//
	// Fetch queries may be paginated if the total result size is expected to be large
	// (e.g. project_logs which accumulate over a long time). Note that fetch queries
	// only support pagination in descending time order (from latest to earliest
	// `_xact_id`. Furthermore, later pages may return rows which showed up in earlier
	// pages, except with an earlier `_xact_id`. This happens because pagination occurs
	// over the whole version history of the event log. You will most likely want to
	// exclude any such duplicate, outdated rows (by `id`) from your combined result
	// set.
	//
	// The `limit` parameter controls the number of full traces to return. So you may
	// end up with more individual rows than the specified limit if you are fetching
	// events containing traces.
	Limit param.Field[int64] `json:"limit"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxRootSpanID param.Field[string] `json:"max_root_span_id"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxXactID param.Field[string] `json:"max_xact_id"`
	// Retrieve a snapshot of events from a past time
	//
	// The version id is essentially a filter on the latest event transaction id. You
	// can use the `max_xact_id` returned by a past fetch as the version to reproduce
	// that exact fetch.
	Version param.Field[string] `json:"version"`
}

func (ExperimentFetchPostParams) MarshalJSON

func (r ExperimentFetchPostParams) MarshalJSON() (data []byte, err error)

type ExperimentInsertParams

type ExperimentInsertParams struct {
	// A list of experiment events to insert
	Events param.Field[[]ExperimentInsertParamsEventUnion] `json:"events,required"`
}

func (ExperimentInsertParams) MarshalJSON

func (r ExperimentInsertParams) MarshalJSON() (data []byte, err error)

type ExperimentInsertParamsEvent

type ExperimentInsertParamsEvent struct {
	Input          param.Field[interface{}] `json:"input,required"`
	Output         param.Field[interface{}] `json:"output,required"`
	Expected       param.Field[interface{}] `json:"expected,required"`
	Error          param.Field[interface{}] `json:"error,required"`
	Scores         param.Field[interface{}] `json:"scores,required"`
	Metadata       param.Field[interface{}] `json:"metadata,required"`
	Tags           param.Field[interface{}] `json:"tags,required"`
	Metrics        param.Field[interface{}] `json:"metrics,required"`
	Context        param.Field[interface{}] `json:"context,required"`
	SpanAttributes param.Field[interface{}] `json:"span_attributes,required"`
	// A unique identifier for the experiment event. If you don't provide one,
	// BrainTrust will generate one for you
	ID param.Field[string] `json:"id"`
	// If the experiment is associated to a dataset, this is the event-level dataset id
	// this experiment event is tied to
	DatasetRecordID param.Field[string] `json:"dataset_record_id"`
	// The timestamp the experiment event was created
	Created param.Field[time.Time] `json:"created" format:"date-time"`
	// Pass `_object_delete=true` to mark the experiment event deleted. Deleted events
	// will not show up in subsequent fetches for this experiment
	ObjectDelete param.Field[bool] `json:"_object_delete"`
	// The `_is_merge` field controls how the row is merged with any existing row with
	// the same id in the DB. By default (or when set to `false`), the existing row is
	// completely replaced by the new row. When set to `true`, the new row is
	// deep-merged into the existing row
	//
	// For example, say there is an existing row in the DB
	// `{"id": "foo", "input": {"a": 5, "b": 10}}`. If we merge a new row as
	// `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}`, the new row
	// will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we replace the
	// new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be
	// `{"id": "foo", "input": {"b": 11, "c": 20}}`
	IsMerge param.Field[bool] `json:"_is_merge"`
	// Use the `_parent_id` field to create this row as a subspan of an existing row.
	// It cannot be specified alongside `_is_merge=true`. Tracking hierarchical
	// relationships are important for tracing (see the
	// [guide](https://www.braintrust.dev/docs/guides/tracing) for full details).
	//
	// For example, say we have logged a row
	// `{"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`.
	// We can create a sub-span of the parent row by logging
	// `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`.
	// In the webapp, only the root span row `"abc"` will show up in the summary view.
	// You can view the full trace hierarchy (in this case, the `"llm_call"` row) by
	// clicking on the "abc" row.
	ParentID   param.Field[string]      `json:"_parent_id"`
	MergePaths param.Field[interface{}] `json:"_merge_paths,required"`
}

An experiment event

func (ExperimentInsertParamsEvent) ImplementsExperimentInsertParamsEventUnion added in v0.3.0

func (r ExperimentInsertParamsEvent) ImplementsExperimentInsertParamsEventUnion()

func (ExperimentInsertParamsEvent) MarshalJSON added in v0.3.0

func (r ExperimentInsertParamsEvent) MarshalJSON() (data []byte, err error)

type ExperimentInsertParamsEventUnion added in v0.3.0

type ExperimentInsertParamsEventUnion interface {
	ImplementsExperimentInsertParamsEventUnion()
}

An experiment event

Satisfied by shared.InsertExperimentEventReplaceParam, shared.InsertExperimentEventMergeParam, ExperimentInsertParamsEvent.

type ExperimentListParams

type ExperimentListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Name of the experiment to search for
	ExperimentName param.Field[string] `query:"experiment_name"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[ExperimentListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Project id
	ProjectID param.Field[string] `query:"project_id" format:"uuid"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (ExperimentListParams) URLQuery

func (r ExperimentListParams) URLQuery() (v url.Values)

URLQuery serializes ExperimentListParams's query parameters as `url.Values`.

type ExperimentListParamsIDsArray added in v0.2.0

type ExperimentListParamsIDsArray []string

func (ExperimentListParamsIDsArray) ImplementsExperimentListParamsIDsUnion added in v0.2.0

func (r ExperimentListParamsIDsArray) ImplementsExperimentListParamsIDsUnion()

type ExperimentListParamsIDsUnion added in v0.2.0

type ExperimentListParamsIDsUnion interface {
	ImplementsExperimentListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, ExperimentListParamsIDsArray.

type ExperimentNewParams

type ExperimentNewParams struct {
	// Unique identifier for the project that the experiment belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Id of default base experiment to compare against when viewing this experiment
	BaseExpID param.Field[string] `json:"base_exp_id" format:"uuid"`
	// Identifier of the linked dataset, or null if the experiment is not linked to a
	// dataset
	DatasetID param.Field[string] `json:"dataset_id" format:"uuid"`
	// Version number of the linked dataset the experiment was run against. This can be
	// used to reproduce the experiment after the dataset has been modified.
	DatasetVersion param.Field[string] `json:"dataset_version"`
	// Textual description of the experiment
	Description param.Field[string] `json:"description"`
	// Normally, creating an experiment with the same name as an existing experiment
	// will return the existing one un-modified. But if `ensure_new` is true,
	// registration will generate a new experiment with a unique name in case of a
	// conflict.
	EnsureNew param.Field[bool] `json:"ensure_new"`
	// User-controlled metadata about the experiment
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
	// Name of the experiment. Within a project, experiment names are unique
	Name param.Field[string] `json:"name"`
	// Whether or not the experiment is public. Public experiments can be viewed by
	// anybody inside or outside the organization
	Public param.Field[bool] `json:"public"`
	// Metadata about the state of the repo when the experiment was created
	RepoInfo param.Field[shared.RepoInfoParam] `json:"repo_info"`
}

func (ExperimentNewParams) MarshalJSON

func (r ExperimentNewParams) MarshalJSON() (data []byte, err error)

type ExperimentService

type ExperimentService struct {
	Options []option.RequestOption
}

ExperimentService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewExperimentService method instead.

func NewExperimentService

func NewExperimentService(opts ...option.RequestOption) (r *ExperimentService)

NewExperimentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ExperimentService) Delete

func (r *ExperimentService) Delete(ctx context.Context, experimentID string, opts ...option.RequestOption) (res *shared.Experiment, err error)

Delete an experiment object by its id

func (*ExperimentService) Feedback

func (r *ExperimentService) Feedback(ctx context.Context, experimentID string, body ExperimentFeedbackParams, opts ...option.RequestOption) (err error)

Log feedback for a set of experiment events

func (*ExperimentService) Fetch

Fetch the events in an experiment. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body

func (*ExperimentService) FetchPost

Fetch the events in an experiment. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query

func (*ExperimentService) Get

func (r *ExperimentService) Get(ctx context.Context, experimentID string, opts ...option.RequestOption) (res *shared.Experiment, err error)

Get an experiment object by its id

func (*ExperimentService) Insert

func (r *ExperimentService) Insert(ctx context.Context, experimentID string, body ExperimentInsertParams, opts ...option.RequestOption) (res *shared.InsertEventsResponse, err error)

Insert a set of events into the experiment

func (*ExperimentService) List

List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first

func (*ExperimentService) ListAutoPaging

List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first

func (*ExperimentService) New

Create 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

func (*ExperimentService) Summarize added in v0.2.0

Summarize experiment

func (*ExperimentService) Update

func (r *ExperimentService) Update(ctx context.Context, experimentID string, body ExperimentUpdateParams, opts ...option.RequestOption) (res *shared.Experiment, err error)

Partially update an experiment object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type ExperimentSummarizeParams added in v0.2.0

type ExperimentSummarizeParams struct {
	// The experiment to compare against, if summarizing scores and metrics. If
	// omitted, will fall back to the `base_exp_id` stored in the experiment metadata,
	// and then to the most recent experiment run in the same project. Must pass
	// `summarize_scores=true` for this id to be used
	ComparisonExperimentID param.Field[string] `query:"comparison_experiment_id" format:"uuid"`
	// Whether to summarize the scores and metrics. If false (or omitted), only the
	// metadata will be returned.
	SummarizeScores param.Field[bool] `query:"summarize_scores"`
}

func (ExperimentSummarizeParams) URLQuery added in v0.2.0

func (r ExperimentSummarizeParams) URLQuery() (v url.Values)

URLQuery serializes ExperimentSummarizeParams's query parameters as `url.Values`.

type ExperimentUpdateParams

type ExperimentUpdateParams struct {
	// Id of default base experiment to compare against when viewing this experiment
	BaseExpID param.Field[string] `json:"base_exp_id" format:"uuid"`
	// Identifier of the linked dataset, or null if the experiment is not linked to a
	// dataset
	DatasetID param.Field[string] `json:"dataset_id" format:"uuid"`
	// Version number of the linked dataset the experiment was run against. This can be
	// used to reproduce the experiment after the dataset has been modified.
	DatasetVersion param.Field[string] `json:"dataset_version"`
	// Textual description of the experiment
	Description param.Field[string] `json:"description"`
	// User-controlled metadata about the experiment
	Metadata param.Field[map[string]interface{}] `json:"metadata"`
	// Name of the experiment. Within a project, experiment names are unique
	Name param.Field[string] `json:"name"`
	// Whether or not the experiment is public. Public experiments can be viewed by
	// anybody inside or outside the organization
	Public param.Field[bool] `json:"public"`
	// Metadata about the state of the repo when the experiment was created
	RepoInfo param.Field[shared.RepoInfoParam] `json:"repo_info"`
}

func (ExperimentUpdateParams) MarshalJSON

func (r ExperimentUpdateParams) MarshalJSON() (data []byte, err error)

type FeedbackDatasetItemParam added in v0.2.0

type FeedbackDatasetItemParam = shared.FeedbackDatasetItemParam

This is an alias to an internal type.

type FeedbackDatasetItemSource added in v0.2.0

type FeedbackDatasetItemSource = shared.FeedbackDatasetItemSource

The source of the feedback. Must be one of "external" (default), "app", or "api"

This is an alias to an internal type.

type FeedbackExperimentItemParam added in v0.2.0

type FeedbackExperimentItemParam = shared.FeedbackExperimentItemParam

This is an alias to an internal type.

type FeedbackExperimentItemSource added in v0.2.0

type FeedbackExperimentItemSource = shared.FeedbackExperimentItemSource

The source of the feedback. Must be one of "external" (default), "app", or "api"

This is an alias to an internal type.

type FeedbackProjectLogsItemParam added in v0.2.0

type FeedbackProjectLogsItemParam = shared.FeedbackProjectLogsItemParam

This is an alias to an internal type.

type FeedbackProjectLogsItemSource added in v0.2.0

type FeedbackProjectLogsItemSource = shared.FeedbackProjectLogsItemSource

The source of the feedback. Must be one of "external" (default), "app", or "api"

This is an alias to an internal type.

type FetchDatasetEventsResponse added in v0.2.0

type FetchDatasetEventsResponse = shared.FetchDatasetEventsResponse

This is an alias to an internal type.

type FetchExperimentEventsResponse added in v0.2.0

type FetchExperimentEventsResponse = shared.FetchExperimentEventsResponse

This is an alias to an internal type.

type FetchProjectLogsEventsResponse added in v0.2.0

type FetchProjectLogsEventsResponse = shared.FetchProjectLogsEventsResponse

This is an alias to an internal type.

type Function added in v0.2.0

type Function = shared.Function

This is an alias to an internal type.

type FunctionFunctionData added in v0.2.0

type FunctionFunctionData = shared.FunctionFunctionData

This is an alias to an internal type.

type FunctionFunctionDataCode added in v0.2.0

type FunctionFunctionDataCode = shared.FunctionFunctionDataCode

This is an alias to an internal type.

type FunctionFunctionDataCodeData added in v0.2.0

type FunctionFunctionDataCodeData = shared.FunctionFunctionDataCodeData

This is an alias to an internal type.

type FunctionFunctionDataCodeDataLocation added in v0.2.0

type FunctionFunctionDataCodeDataLocation = shared.FunctionFunctionDataCodeDataLocation

This is an alias to an internal type.

type FunctionFunctionDataCodeDataLocationPositionScore added in v0.2.0

type FunctionFunctionDataCodeDataLocationPositionScore = shared.FunctionFunctionDataCodeDataLocationPositionScore

This is an alias to an internal type.

type FunctionFunctionDataCodeDataLocationPositionTask added in v0.2.0

type FunctionFunctionDataCodeDataLocationPositionTask = shared.FunctionFunctionDataCodeDataLocationPositionTask

This is an alias to an internal type.

type FunctionFunctionDataCodeDataLocationPositionUnion added in v0.2.0

type FunctionFunctionDataCodeDataLocationPositionUnion = shared.FunctionFunctionDataCodeDataLocationPositionUnion

This is an alias to an internal type.

type FunctionFunctionDataCodeDataLocationType added in v0.2.0

type FunctionFunctionDataCodeDataLocationType = shared.FunctionFunctionDataCodeDataLocationType

This is an alias to an internal type.

type FunctionFunctionDataCodeDataRuntimeContext added in v0.2.0

type FunctionFunctionDataCodeDataRuntimeContext = shared.FunctionFunctionDataCodeDataRuntimeContext

This is an alias to an internal type.

type FunctionFunctionDataCodeDataRuntimeContextRuntime added in v0.2.0

type FunctionFunctionDataCodeDataRuntimeContextRuntime = shared.FunctionFunctionDataCodeDataRuntimeContextRuntime

This is an alias to an internal type.

type FunctionFunctionDataCodeType added in v0.2.0

type FunctionFunctionDataCodeType = shared.FunctionFunctionDataCodeType

This is an alias to an internal type.

type FunctionFunctionDataGlobal added in v0.2.0

type FunctionFunctionDataGlobal = shared.FunctionFunctionDataGlobal

This is an alias to an internal type.

type FunctionFunctionDataGlobalType added in v0.2.0

type FunctionFunctionDataGlobalType = shared.FunctionFunctionDataGlobalType

This is an alias to an internal type.

type FunctionFunctionDataPrompt added in v0.2.0

type FunctionFunctionDataPrompt = shared.FunctionFunctionDataPrompt

This is an alias to an internal type.

type FunctionFunctionDataPromptType added in v0.2.0

type FunctionFunctionDataPromptType = shared.FunctionFunctionDataPromptType

This is an alias to an internal type.

type FunctionFunctionDataType added in v0.2.0

type FunctionFunctionDataType = shared.FunctionFunctionDataType

This is an alias to an internal type.

type FunctionListParams added in v0.2.0

type FunctionListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Name of the function to search for
	FunctionName param.Field[string] `query:"function_name"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[FunctionListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Project id
	ProjectID param.Field[string] `query:"project_id" format:"uuid"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Retrieve prompt with a specific slug
	Slug param.Field[string] `query:"slug"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
	// Retrieve prompt at a specific version.
	//
	// The version id can either be a transaction id (e.g. '1000192656880881099') or a
	// version identifier (e.g. '81cd05ee665fdfb3').
	Version param.Field[string] `query:"version"`
}

func (FunctionListParams) URLQuery added in v0.2.0

func (r FunctionListParams) URLQuery() (v url.Values)

URLQuery serializes FunctionListParams's query parameters as `url.Values`.

type FunctionListParamsIDsArray added in v0.2.0

type FunctionListParamsIDsArray []string

func (FunctionListParamsIDsArray) ImplementsFunctionListParamsIDsUnion added in v0.2.0

func (r FunctionListParamsIDsArray) ImplementsFunctionListParamsIDsUnion()

type FunctionListParamsIDsUnion added in v0.2.0

type FunctionListParamsIDsUnion interface {
	ImplementsFunctionListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, FunctionListParamsIDsArray.

type FunctionLogID added in v0.2.0

type FunctionLogID = shared.FunctionLogID

A literal 'p' which identifies the object as a project prompt

This is an alias to an internal type.

type FunctionNewParams added in v0.2.0

type FunctionNewParams struct {
	FunctionData param.Field[FunctionNewParamsFunctionDataUnion] `json:"function_data,required"`
	// Name of the prompt
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the prompt belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Unique identifier for the prompt
	Slug param.Field[string] `json:"slug,required"`
	// Textual description of the prompt
	Description param.Field[string] `json:"description"`
	// The prompt, model, and its parameters
	PromptData param.Field[shared.PromptDataParam] `json:"prompt_data"`
	// A list of tags for the prompt
	Tags param.Field[[]string] `json:"tags"`
}

func (FunctionNewParams) MarshalJSON added in v0.2.0

func (r FunctionNewParams) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionData added in v0.3.0

type FunctionNewParamsFunctionData struct {
	Type param.Field[FunctionNewParamsFunctionDataType] `json:"type,required"`
	Data param.Field[interface{}]                       `json:"data,required"`
	Name param.Field[string]                            `json:"name"`
}

func (FunctionNewParamsFunctionData) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionData) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataCode added in v0.3.0

type FunctionNewParamsFunctionDataCode struct {
	Data param.Field[FunctionNewParamsFunctionDataCodeData] `json:"data,required"`
	Type param.Field[FunctionNewParamsFunctionDataCodeType] `json:"type,required"`
}

func (FunctionNewParamsFunctionDataCode) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionDataCode) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataCodeData added in v0.3.0

type FunctionNewParamsFunctionDataCodeData struct {
	BundleID       param.Field[string]                                              `json:"bundle_id,required"`
	Location       param.Field[FunctionNewParamsFunctionDataCodeDataLocation]       `json:"location,required"`
	RuntimeContext param.Field[FunctionNewParamsFunctionDataCodeDataRuntimeContext] `json:"runtime_context,required"`
}

func (FunctionNewParamsFunctionDataCodeData) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionDataCodeData) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataCodeDataLocation added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocation struct {
	EvalName param.Field[string]                                                     `json:"eval_name,required"`
	Position param.Field[FunctionNewParamsFunctionDataCodeDataLocationPositionUnion] `json:"position,required"`
	Type     param.Field[FunctionNewParamsFunctionDataCodeDataLocationType]          `json:"type,required"`
}

func (FunctionNewParamsFunctionDataCodeDataLocation) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionDataCodeDataLocation) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataCodeDataLocationPositionScore added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocationPositionScore struct {
	Score param.Field[float64] `json:"score,required"`
}

func (FunctionNewParamsFunctionDataCodeDataLocationPositionScore) MarshalJSON added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocationPositionTask added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocationPositionTask string
const (
	FunctionNewParamsFunctionDataCodeDataLocationPositionTaskTask FunctionNewParamsFunctionDataCodeDataLocationPositionTask = "task"
)

func (FunctionNewParamsFunctionDataCodeDataLocationPositionTask) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocationPositionUnion added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocationPositionUnion interface {
	// contains filtered or unexported methods
}

Satisfied by FunctionNewParamsFunctionDataCodeDataLocationPositionTask, FunctionNewParamsFunctionDataCodeDataLocationPositionScore.

type FunctionNewParamsFunctionDataCodeDataLocationType added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataLocationType string
const (
	FunctionNewParamsFunctionDataCodeDataLocationTypeExperiment FunctionNewParamsFunctionDataCodeDataLocationType = "experiment"
)

func (FunctionNewParamsFunctionDataCodeDataLocationType) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataRuntimeContext added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataRuntimeContext struct {
	Runtime param.Field[FunctionNewParamsFunctionDataCodeDataRuntimeContextRuntime] `json:"runtime,required"`
	Version param.Field[string]                                                     `json:"version,required"`
}

func (FunctionNewParamsFunctionDataCodeDataRuntimeContext) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionDataCodeDataRuntimeContext) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataCodeDataRuntimeContextRuntime added in v0.3.0

type FunctionNewParamsFunctionDataCodeDataRuntimeContextRuntime string
const (
	FunctionNewParamsFunctionDataCodeDataRuntimeContextRuntimeNode FunctionNewParamsFunctionDataCodeDataRuntimeContextRuntime = "node"
)

func (FunctionNewParamsFunctionDataCodeDataRuntimeContextRuntime) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataCodeType added in v0.3.0

type FunctionNewParamsFunctionDataCodeType string
const (
	FunctionNewParamsFunctionDataCodeTypeCode FunctionNewParamsFunctionDataCodeType = "code"
)

func (FunctionNewParamsFunctionDataCodeType) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataGlobal added in v0.3.0

type FunctionNewParamsFunctionDataGlobal struct {
	Name param.Field[string]                                  `json:"name,required"`
	Type param.Field[FunctionNewParamsFunctionDataGlobalType] `json:"type,required"`
}

func (FunctionNewParamsFunctionDataGlobal) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionDataGlobal) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataGlobalType added in v0.3.0

type FunctionNewParamsFunctionDataGlobalType string
const (
	FunctionNewParamsFunctionDataGlobalTypeGlobal FunctionNewParamsFunctionDataGlobalType = "global"
)

func (FunctionNewParamsFunctionDataGlobalType) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataPrompt added in v0.3.0

type FunctionNewParamsFunctionDataPrompt struct {
	Type param.Field[FunctionNewParamsFunctionDataPromptType] `json:"type,required"`
}

func (FunctionNewParamsFunctionDataPrompt) MarshalJSON added in v0.3.0

func (r FunctionNewParamsFunctionDataPrompt) MarshalJSON() (data []byte, err error)

type FunctionNewParamsFunctionDataPromptType added in v0.3.0

type FunctionNewParamsFunctionDataPromptType string
const (
	FunctionNewParamsFunctionDataPromptTypePrompt FunctionNewParamsFunctionDataPromptType = "prompt"
)

func (FunctionNewParamsFunctionDataPromptType) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataType added in v0.3.0

type FunctionNewParamsFunctionDataType string
const (
	FunctionNewParamsFunctionDataTypePrompt FunctionNewParamsFunctionDataType = "prompt"
	FunctionNewParamsFunctionDataTypeCode   FunctionNewParamsFunctionDataType = "code"
	FunctionNewParamsFunctionDataTypeGlobal FunctionNewParamsFunctionDataType = "global"
)

func (FunctionNewParamsFunctionDataType) IsKnown added in v0.3.0

type FunctionNewParamsFunctionDataUnion added in v0.3.0

type FunctionNewParamsFunctionDataUnion interface {
	// contains filtered or unexported methods
}

Satisfied by FunctionNewParamsFunctionDataPrompt, FunctionNewParamsFunctionDataCode, FunctionNewParamsFunctionDataGlobal, FunctionNewParamsFunctionData.

type FunctionReplaceParams added in v0.2.0

type FunctionReplaceParams struct {
	FunctionData param.Field[FunctionReplaceParamsFunctionDataUnion] `json:"function_data,required"`
	// Name of the prompt
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the prompt belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Unique identifier for the prompt
	Slug param.Field[string] `json:"slug,required"`
	// Textual description of the prompt
	Description param.Field[string] `json:"description"`
	// The prompt, model, and its parameters
	PromptData param.Field[shared.PromptDataParam] `json:"prompt_data"`
	// A list of tags for the prompt
	Tags param.Field[[]string] `json:"tags"`
}

func (FunctionReplaceParams) MarshalJSON added in v0.2.0

func (r FunctionReplaceParams) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionData added in v0.3.0

type FunctionReplaceParamsFunctionData struct {
	Type param.Field[FunctionReplaceParamsFunctionDataType] `json:"type,required"`
	Data param.Field[interface{}]                           `json:"data,required"`
	Name param.Field[string]                                `json:"name"`
}

func (FunctionReplaceParamsFunctionData) MarshalJSON added in v0.3.0

func (r FunctionReplaceParamsFunctionData) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionDataCode added in v0.3.0

type FunctionReplaceParamsFunctionDataCode struct {
	Data param.Field[FunctionReplaceParamsFunctionDataCodeData] `json:"data,required"`
	Type param.Field[FunctionReplaceParamsFunctionDataCodeType] `json:"type,required"`
}

func (FunctionReplaceParamsFunctionDataCode) MarshalJSON added in v0.3.0

func (r FunctionReplaceParamsFunctionDataCode) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionDataCodeData added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeData struct {
	BundleID       param.Field[string]                                                  `json:"bundle_id,required"`
	Location       param.Field[FunctionReplaceParamsFunctionDataCodeDataLocation]       `json:"location,required"`
	RuntimeContext param.Field[FunctionReplaceParamsFunctionDataCodeDataRuntimeContext] `json:"runtime_context,required"`
}

func (FunctionReplaceParamsFunctionDataCodeData) MarshalJSON added in v0.3.0

func (r FunctionReplaceParamsFunctionDataCodeData) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionDataCodeDataLocation added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocation struct {
	EvalName param.Field[string]                                                         `json:"eval_name,required"`
	Position param.Field[FunctionReplaceParamsFunctionDataCodeDataLocationPositionUnion] `json:"position,required"`
	Type     param.Field[FunctionReplaceParamsFunctionDataCodeDataLocationType]          `json:"type,required"`
}

func (FunctionReplaceParamsFunctionDataCodeDataLocation) MarshalJSON added in v0.3.0

func (r FunctionReplaceParamsFunctionDataCodeDataLocation) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionDataCodeDataLocationPositionScore added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocationPositionScore struct {
	Score param.Field[float64] `json:"score,required"`
}

func (FunctionReplaceParamsFunctionDataCodeDataLocationPositionScore) MarshalJSON added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocationPositionTask added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocationPositionTask string
const (
	FunctionReplaceParamsFunctionDataCodeDataLocationPositionTaskTask FunctionReplaceParamsFunctionDataCodeDataLocationPositionTask = "task"
)

func (FunctionReplaceParamsFunctionDataCodeDataLocationPositionTask) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocationPositionUnion added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocationPositionUnion interface {
	// contains filtered or unexported methods
}

Satisfied by FunctionReplaceParamsFunctionDataCodeDataLocationPositionTask, FunctionReplaceParamsFunctionDataCodeDataLocationPositionScore.

type FunctionReplaceParamsFunctionDataCodeDataLocationType added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataLocationType string
const (
	FunctionReplaceParamsFunctionDataCodeDataLocationTypeExperiment FunctionReplaceParamsFunctionDataCodeDataLocationType = "experiment"
)

func (FunctionReplaceParamsFunctionDataCodeDataLocationType) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataRuntimeContext added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataRuntimeContext struct {
	Runtime param.Field[FunctionReplaceParamsFunctionDataCodeDataRuntimeContextRuntime] `json:"runtime,required"`
	Version param.Field[string]                                                         `json:"version,required"`
}

func (FunctionReplaceParamsFunctionDataCodeDataRuntimeContext) MarshalJSON added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataRuntimeContextRuntime added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeDataRuntimeContextRuntime string
const (
	FunctionReplaceParamsFunctionDataCodeDataRuntimeContextRuntimeNode FunctionReplaceParamsFunctionDataCodeDataRuntimeContextRuntime = "node"
)

func (FunctionReplaceParamsFunctionDataCodeDataRuntimeContextRuntime) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeType added in v0.3.0

type FunctionReplaceParamsFunctionDataCodeType string
const (
	FunctionReplaceParamsFunctionDataCodeTypeCode FunctionReplaceParamsFunctionDataCodeType = "code"
)

func (FunctionReplaceParamsFunctionDataCodeType) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataGlobal added in v0.3.0

type FunctionReplaceParamsFunctionDataGlobal struct {
	Name param.Field[string]                                      `json:"name,required"`
	Type param.Field[FunctionReplaceParamsFunctionDataGlobalType] `json:"type,required"`
}

func (FunctionReplaceParamsFunctionDataGlobal) MarshalJSON added in v0.3.0

func (r FunctionReplaceParamsFunctionDataGlobal) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionDataGlobalType added in v0.3.0

type FunctionReplaceParamsFunctionDataGlobalType string
const (
	FunctionReplaceParamsFunctionDataGlobalTypeGlobal FunctionReplaceParamsFunctionDataGlobalType = "global"
)

func (FunctionReplaceParamsFunctionDataGlobalType) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataPrompt added in v0.3.0

type FunctionReplaceParamsFunctionDataPrompt struct {
	Type param.Field[FunctionReplaceParamsFunctionDataPromptType] `json:"type,required"`
}

func (FunctionReplaceParamsFunctionDataPrompt) MarshalJSON added in v0.3.0

func (r FunctionReplaceParamsFunctionDataPrompt) MarshalJSON() (data []byte, err error)

type FunctionReplaceParamsFunctionDataPromptType added in v0.3.0

type FunctionReplaceParamsFunctionDataPromptType string
const (
	FunctionReplaceParamsFunctionDataPromptTypePrompt FunctionReplaceParamsFunctionDataPromptType = "prompt"
)

func (FunctionReplaceParamsFunctionDataPromptType) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataType added in v0.3.0

type FunctionReplaceParamsFunctionDataType string
const (
	FunctionReplaceParamsFunctionDataTypePrompt FunctionReplaceParamsFunctionDataType = "prompt"
	FunctionReplaceParamsFunctionDataTypeCode   FunctionReplaceParamsFunctionDataType = "code"
	FunctionReplaceParamsFunctionDataTypeGlobal FunctionReplaceParamsFunctionDataType = "global"
)

func (FunctionReplaceParamsFunctionDataType) IsKnown added in v0.3.0

type FunctionReplaceParamsFunctionDataUnion added in v0.3.0

type FunctionReplaceParamsFunctionDataUnion interface {
	// contains filtered or unexported methods
}

Satisfied by FunctionReplaceParamsFunctionDataPrompt, FunctionReplaceParamsFunctionDataCode, FunctionReplaceParamsFunctionDataGlobal, FunctionReplaceParamsFunctionData.

type FunctionService added in v0.2.0

type FunctionService struct {
	Options []option.RequestOption
}

FunctionService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFunctionService method instead.

func NewFunctionService added in v0.2.0

func NewFunctionService(opts ...option.RequestOption) (r *FunctionService)

NewFunctionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FunctionService) Delete added in v0.2.0

func (r *FunctionService) Delete(ctx context.Context, functionID string, opts ...option.RequestOption) (res *shared.Function, err error)

Delete a function object by its id

func (*FunctionService) Get added in v0.2.0

func (r *FunctionService) Get(ctx context.Context, functionID string, opts ...option.RequestOption) (res *shared.Function, err error)

Get a function object by its id

func (*FunctionService) List added in v0.2.0

List out all functions. The functions are sorted by creation date, with the most recently-created functions coming first

func (*FunctionService) ListAutoPaging added in v0.2.0

List out all functions. The functions are sorted by creation date, with the most recently-created functions coming first

func (*FunctionService) New added in v0.2.0

func (r *FunctionService) New(ctx context.Context, body FunctionNewParams, opts ...option.RequestOption) (res *shared.Function, err error)

Create a new function. If there is an existing function in the project with the same slug as the one specified in the request, will return the existing function unmodified

func (*FunctionService) Replace added in v0.2.0

func (r *FunctionService) Replace(ctx context.Context, body FunctionReplaceParams, opts ...option.RequestOption) (res *shared.Function, err error)

Create or replace function. If there is an existing function in the project with the same slug as the one specified in the request, will replace the existing function with the provided fields

func (*FunctionService) Update added in v0.2.0

func (r *FunctionService) Update(ctx context.Context, functionID string, body FunctionUpdateParams, opts ...option.RequestOption) (res *shared.Function, err error)

Partially update a function object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type FunctionUpdateParams added in v0.2.0

type FunctionUpdateParams struct {
	// Textual description of the prompt
	Description  param.Field[string]                                `json:"description"`
	FunctionData param.Field[FunctionUpdateParamsFunctionDataUnion] `json:"function_data"`
	// Name of the prompt
	Name param.Field[string] `json:"name"`
	// The prompt, model, and its parameters
	PromptData param.Field[shared.PromptDataParam] `json:"prompt_data"`
	// A list of tags for the prompt
	Tags param.Field[[]string] `json:"tags"`
}

func (FunctionUpdateParams) MarshalJSON added in v0.2.0

func (r FunctionUpdateParams) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionData added in v0.3.0

type FunctionUpdateParamsFunctionData struct {
	Type param.Field[FunctionUpdateParamsFunctionDataType] `json:"type"`
	Data param.Field[interface{}]                          `json:"data,required"`
	Name param.Field[string]                               `json:"name"`
}

func (FunctionUpdateParamsFunctionData) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionData) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataCode added in v0.3.0

type FunctionUpdateParamsFunctionDataCode struct {
	Data param.Field[FunctionUpdateParamsFunctionDataCodeData] `json:"data,required"`
	Type param.Field[FunctionUpdateParamsFunctionDataCodeType] `json:"type,required"`
}

func (FunctionUpdateParamsFunctionDataCode) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionDataCode) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataCodeData added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeData struct {
	BundleID       param.Field[string]                                                 `json:"bundle_id,required"`
	Location       param.Field[FunctionUpdateParamsFunctionDataCodeDataLocation]       `json:"location,required"`
	RuntimeContext param.Field[FunctionUpdateParamsFunctionDataCodeDataRuntimeContext] `json:"runtime_context,required"`
}

func (FunctionUpdateParamsFunctionDataCodeData) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionDataCodeData) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataCodeDataLocation added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocation struct {
	EvalName param.Field[string]                                                        `json:"eval_name,required"`
	Position param.Field[FunctionUpdateParamsFunctionDataCodeDataLocationPositionUnion] `json:"position,required"`
	Type     param.Field[FunctionUpdateParamsFunctionDataCodeDataLocationType]          `json:"type,required"`
}

func (FunctionUpdateParamsFunctionDataCodeDataLocation) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionDataCodeDataLocation) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataCodeDataLocationPositionScore added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocationPositionScore struct {
	Score param.Field[float64] `json:"score,required"`
}

func (FunctionUpdateParamsFunctionDataCodeDataLocationPositionScore) MarshalJSON added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocationPositionTask added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocationPositionTask string
const (
	FunctionUpdateParamsFunctionDataCodeDataLocationPositionTaskTask FunctionUpdateParamsFunctionDataCodeDataLocationPositionTask = "task"
)

func (FunctionUpdateParamsFunctionDataCodeDataLocationPositionTask) IsKnown added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocationPositionUnion added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocationPositionUnion interface {
	// contains filtered or unexported methods
}

Satisfied by FunctionUpdateParamsFunctionDataCodeDataLocationPositionTask, FunctionUpdateParamsFunctionDataCodeDataLocationPositionScore.

type FunctionUpdateParamsFunctionDataCodeDataLocationType added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataLocationType string
const (
	FunctionUpdateParamsFunctionDataCodeDataLocationTypeExperiment FunctionUpdateParamsFunctionDataCodeDataLocationType = "experiment"
)

func (FunctionUpdateParamsFunctionDataCodeDataLocationType) IsKnown added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataRuntimeContext added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataRuntimeContext struct {
	Runtime param.Field[FunctionUpdateParamsFunctionDataCodeDataRuntimeContextRuntime] `json:"runtime,required"`
	Version param.Field[string]                                                        `json:"version,required"`
}

func (FunctionUpdateParamsFunctionDataCodeDataRuntimeContext) MarshalJSON added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataRuntimeContextRuntime added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeDataRuntimeContextRuntime string
const (
	FunctionUpdateParamsFunctionDataCodeDataRuntimeContextRuntimeNode FunctionUpdateParamsFunctionDataCodeDataRuntimeContextRuntime = "node"
)

func (FunctionUpdateParamsFunctionDataCodeDataRuntimeContextRuntime) IsKnown added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeType added in v0.3.0

type FunctionUpdateParamsFunctionDataCodeType string
const (
	FunctionUpdateParamsFunctionDataCodeTypeCode FunctionUpdateParamsFunctionDataCodeType = "code"
)

func (FunctionUpdateParamsFunctionDataCodeType) IsKnown added in v0.3.0

type FunctionUpdateParamsFunctionDataGlobal added in v0.3.0

type FunctionUpdateParamsFunctionDataGlobal struct {
	Name param.Field[string]                                     `json:"name,required"`
	Type param.Field[FunctionUpdateParamsFunctionDataGlobalType] `json:"type,required"`
}

func (FunctionUpdateParamsFunctionDataGlobal) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionDataGlobal) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataGlobalType added in v0.3.0

type FunctionUpdateParamsFunctionDataGlobalType string
const (
	FunctionUpdateParamsFunctionDataGlobalTypeGlobal FunctionUpdateParamsFunctionDataGlobalType = "global"
)

func (FunctionUpdateParamsFunctionDataGlobalType) IsKnown added in v0.3.0

type FunctionUpdateParamsFunctionDataNullableVariant added in v0.3.0

type FunctionUpdateParamsFunctionDataNullableVariant struct {
}

func (FunctionUpdateParamsFunctionDataNullableVariant) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionDataNullableVariant) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataPrompt added in v0.3.0

type FunctionUpdateParamsFunctionDataPrompt struct {
	Type param.Field[FunctionUpdateParamsFunctionDataPromptType] `json:"type,required"`
}

func (FunctionUpdateParamsFunctionDataPrompt) MarshalJSON added in v0.3.0

func (r FunctionUpdateParamsFunctionDataPrompt) MarshalJSON() (data []byte, err error)

type FunctionUpdateParamsFunctionDataPromptType added in v0.3.0

type FunctionUpdateParamsFunctionDataPromptType string
const (
	FunctionUpdateParamsFunctionDataPromptTypePrompt FunctionUpdateParamsFunctionDataPromptType = "prompt"
)

func (FunctionUpdateParamsFunctionDataPromptType) IsKnown added in v0.3.0

type FunctionUpdateParamsFunctionDataType added in v0.3.0

type FunctionUpdateParamsFunctionDataType string
const (
	FunctionUpdateParamsFunctionDataTypePrompt FunctionUpdateParamsFunctionDataType = "prompt"
	FunctionUpdateParamsFunctionDataTypeCode   FunctionUpdateParamsFunctionDataType = "code"
	FunctionUpdateParamsFunctionDataTypeGlobal FunctionUpdateParamsFunctionDataType = "global"
)

func (FunctionUpdateParamsFunctionDataType) IsKnown added in v0.3.0

type Group added in v0.2.0

type Group = shared.Group

A group is a collection of users which can be assigned an ACL

Groups can consist of individual users, as well as a set of groups they inherit from

This is an alias to an internal type.

type GroupListParams added in v0.2.0

type GroupListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Name of the group to search for
	GroupName param.Field[string] `query:"group_name"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[GroupListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (GroupListParams) URLQuery added in v0.2.0

func (r GroupListParams) URLQuery() (v url.Values)

URLQuery serializes GroupListParams's query parameters as `url.Values`.

type GroupListParamsIDsArray added in v0.2.0

type GroupListParamsIDsArray []string

func (GroupListParamsIDsArray) ImplementsGroupListParamsIDsUnion added in v0.2.0

func (r GroupListParamsIDsArray) ImplementsGroupListParamsIDsUnion()

type GroupListParamsIDsUnion added in v0.2.0

type GroupListParamsIDsUnion interface {
	ImplementsGroupListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, GroupListParamsIDsArray.

type GroupNewParams added in v0.2.0

type GroupNewParams struct {
	// Name of the group
	Name param.Field[string] `json:"name,required"`
	// Textual description of the group
	Description param.Field[string] `json:"description"`
	// Ids of the groups this group inherits from
	//
	// An inheriting group has all the users contained in its member groups, as well as
	// all of their inherited users
	MemberGroups param.Field[[]string] `json:"member_groups" format:"uuid"`
	// Ids of users which belong to this group
	MemberUsers param.Field[[]string] `json:"member_users" format:"uuid"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, you may specify the name of
	// the organization the group belongs in.
	OrgName param.Field[string] `json:"org_name"`
}

func (GroupNewParams) MarshalJSON added in v0.2.0

func (r GroupNewParams) MarshalJSON() (data []byte, err error)

type GroupReplaceParams added in v0.2.0

type GroupReplaceParams struct {
	// Name of the group
	Name param.Field[string] `json:"name,required"`
	// Textual description of the group
	Description param.Field[string] `json:"description"`
	// Ids of the groups this group inherits from
	//
	// An inheriting group has all the users contained in its member groups, as well as
	// all of their inherited users
	MemberGroups param.Field[[]string] `json:"member_groups" format:"uuid"`
	// Ids of users which belong to this group
	MemberUsers param.Field[[]string] `json:"member_users" format:"uuid"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, you may specify the name of
	// the organization the group belongs in.
	OrgName param.Field[string] `json:"org_name"`
}

func (GroupReplaceParams) MarshalJSON added in v0.2.0

func (r GroupReplaceParams) MarshalJSON() (data []byte, err error)

type GroupService added in v0.2.0

type GroupService struct {
	Options []option.RequestOption
}

GroupService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGroupService method instead.

func NewGroupService added in v0.2.0

func NewGroupService(opts ...option.RequestOption) (r *GroupService)

NewGroupService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GroupService) Delete added in v0.2.0

func (r *GroupService) Delete(ctx context.Context, groupID string, opts ...option.RequestOption) (res *shared.Group, err error)

Delete a group object by its id

func (*GroupService) Get added in v0.2.0

func (r *GroupService) Get(ctx context.Context, groupID string, opts ...option.RequestOption) (res *shared.Group, err error)

Get a group object by its id

func (*GroupService) List added in v0.2.0

List out all groups. The groups are sorted by creation date, with the most recently-created groups coming first

func (*GroupService) ListAutoPaging added in v0.2.0

List out all groups. The groups are sorted by creation date, with the most recently-created groups coming first

func (*GroupService) New added in v0.2.0

func (r *GroupService) New(ctx context.Context, body GroupNewParams, opts ...option.RequestOption) (res *shared.Group, err error)

Create a new group. If there is an existing group with the same name as the one specified in the request, will return the existing group unmodified

func (*GroupService) Replace added in v0.2.0

func (r *GroupService) Replace(ctx context.Context, body GroupReplaceParams, opts ...option.RequestOption) (res *shared.Group, err error)

Create or replace group. If there is an existing group with the same name as the one specified in the request, will replace the existing group with the provided fields

func (*GroupService) Update added in v0.2.0

func (r *GroupService) Update(ctx context.Context, groupID string, body GroupUpdateParams, opts ...option.RequestOption) (res *shared.Group, err error)

Partially update a group object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type GroupUpdateParams added in v0.2.0

type GroupUpdateParams struct {
	// A list of group IDs to add to the group's inheriting-from set
	AddMemberGroups param.Field[[]string] `json:"add_member_groups" format:"uuid"`
	// A list of user IDs to add to the group
	AddMemberUsers param.Field[[]string] `json:"add_member_users" format:"uuid"`
	// Textual description of the group
	Description param.Field[string] `json:"description"`
	// Name of the group
	Name param.Field[string] `json:"name"`
	// A list of group IDs to remove from the group's inheriting-from set
	RemoveMemberGroups param.Field[[]string] `json:"remove_member_groups" format:"uuid"`
	// A list of user IDs to remove from the group
	RemoveMemberUsers param.Field[[]string] `json:"remove_member_users" format:"uuid"`
}

func (GroupUpdateParams) MarshalJSON added in v0.2.0

func (r GroupUpdateParams) MarshalJSON() (data []byte, err error)

type InsertDatasetEventMergeParam added in v0.2.0

type InsertDatasetEventMergeParam = shared.InsertDatasetEventMergeParam

This is an alias to an internal type.

type InsertDatasetEventReplaceParam added in v0.2.0

type InsertDatasetEventReplaceParam = shared.InsertDatasetEventReplaceParam

This is an alias to an internal type.

type InsertEventsResponse added in v0.2.0

type InsertEventsResponse = shared.InsertEventsResponse

This is an alias to an internal type.

type InsertExperimentEventMergeContextParam added in v0.2.0

type InsertExperimentEventMergeContextParam = shared.InsertExperimentEventMergeContextParam

Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event

This is an alias to an internal type.

type InsertExperimentEventMergeMetricsParam added in v0.2.0

type InsertExperimentEventMergeMetricsParam = shared.InsertExperimentEventMergeMetricsParam

Metrics are numerical measurements tracking the execution of the code that produced the experiment event. Use "start" and "end" to track the time span over which the experiment event was produced

This is an alias to an internal type.

type InsertExperimentEventMergeParam added in v0.2.0

type InsertExperimentEventMergeParam = shared.InsertExperimentEventMergeParam

This is an alias to an internal type.

type InsertExperimentEventMergeSpanAttributesParam added in v0.2.0

type InsertExperimentEventMergeSpanAttributesParam = shared.InsertExperimentEventMergeSpanAttributesParam

Human-identifying attributes of the span, such as name, type, etc.

This is an alias to an internal type.

type InsertExperimentEventMergeSpanAttributesType added in v0.2.0

type InsertExperimentEventMergeSpanAttributesType = shared.InsertExperimentEventMergeSpanAttributesType

Type of the span, for display purposes only

This is an alias to an internal type.

type InsertExperimentEventReplaceContextParam added in v0.2.0

type InsertExperimentEventReplaceContextParam = shared.InsertExperimentEventReplaceContextParam

Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event

This is an alias to an internal type.

type InsertExperimentEventReplaceMetricsParam added in v0.2.0

type InsertExperimentEventReplaceMetricsParam = shared.InsertExperimentEventReplaceMetricsParam

Metrics are numerical measurements tracking the execution of the code that produced the experiment event. Use "start" and "end" to track the time span over which the experiment event was produced

This is an alias to an internal type.

type InsertExperimentEventReplaceParam added in v0.2.0

type InsertExperimentEventReplaceParam = shared.InsertExperimentEventReplaceParam

This is an alias to an internal type.

type InsertExperimentEventReplaceSpanAttributesParam added in v0.2.0

type InsertExperimentEventReplaceSpanAttributesParam = shared.InsertExperimentEventReplaceSpanAttributesParam

Human-identifying attributes of the span, such as name, type, etc.

This is an alias to an internal type.

type InsertExperimentEventReplaceSpanAttributesType added in v0.2.0

type InsertExperimentEventReplaceSpanAttributesType = shared.InsertExperimentEventReplaceSpanAttributesType

Type of the span, for display purposes only

This is an alias to an internal type.

type InsertProjectLogsEventMergeContextParam added in v0.2.0

type InsertProjectLogsEventMergeContextParam = shared.InsertProjectLogsEventMergeContextParam

Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event

This is an alias to an internal type.

type InsertProjectLogsEventMergeMetricsParam added in v0.2.0

type InsertProjectLogsEventMergeMetricsParam = shared.InsertProjectLogsEventMergeMetricsParam

Metrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced

This is an alias to an internal type.

type InsertProjectLogsEventMergeParam added in v0.2.0

type InsertProjectLogsEventMergeParam = shared.InsertProjectLogsEventMergeParam

This is an alias to an internal type.

type InsertProjectLogsEventMergeSpanAttributesParam added in v0.2.0

type InsertProjectLogsEventMergeSpanAttributesParam = shared.InsertProjectLogsEventMergeSpanAttributesParam

Human-identifying attributes of the span, such as name, type, etc.

This is an alias to an internal type.

type InsertProjectLogsEventMergeSpanAttributesType added in v0.2.0

type InsertProjectLogsEventMergeSpanAttributesType = shared.InsertProjectLogsEventMergeSpanAttributesType

Type of the span, for display purposes only

This is an alias to an internal type.

type InsertProjectLogsEventReplaceContextParam added in v0.2.0

type InsertProjectLogsEventReplaceContextParam = shared.InsertProjectLogsEventReplaceContextParam

Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event

This is an alias to an internal type.

type InsertProjectLogsEventReplaceMetricsParam added in v0.2.0

type InsertProjectLogsEventReplaceMetricsParam = shared.InsertProjectLogsEventReplaceMetricsParam

Metrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced

This is an alias to an internal type.

type InsertProjectLogsEventReplaceParam added in v0.2.0

type InsertProjectLogsEventReplaceParam = shared.InsertProjectLogsEventReplaceParam

This is an alias to an internal type.

type InsertProjectLogsEventReplaceSpanAttributesParam added in v0.2.0

type InsertProjectLogsEventReplaceSpanAttributesParam = shared.InsertProjectLogsEventReplaceSpanAttributesParam

Human-identifying attributes of the span, such as name, type, etc.

This is an alias to an internal type.

type InsertProjectLogsEventReplaceSpanAttributesType added in v0.2.0

type InsertProjectLogsEventReplaceSpanAttributesType = shared.InsertProjectLogsEventReplaceSpanAttributesType

Type of the span, for display purposes only

This is an alias to an internal type.

type MetricSummary added in v0.2.0

type MetricSummary = shared.MetricSummary

Summary of a metric's performance

This is an alias to an internal type.

type Organization added in v0.2.0

type Organization = shared.Organization

This is an alias to an internal type.

type OrganizationListParams added in v0.2.0

type OrganizationListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[OrganizationListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Name of the organization to search for
	OrganizationName param.Field[string] `query:"organization_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (OrganizationListParams) URLQuery added in v0.2.0

func (r OrganizationListParams) URLQuery() (v url.Values)

URLQuery serializes OrganizationListParams's query parameters as `url.Values`.

type OrganizationListParamsIDsArray added in v0.2.0

type OrganizationListParamsIDsArray []string

func (OrganizationListParamsIDsArray) ImplementsOrganizationListParamsIDsUnion added in v0.2.0

func (r OrganizationListParamsIDsArray) ImplementsOrganizationListParamsIDsUnion()

type OrganizationListParamsIDsUnion added in v0.2.0

type OrganizationListParamsIDsUnion interface {
	ImplementsOrganizationListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, OrganizationListParamsIDsArray.

type OrganizationMemberService added in v0.2.0

type OrganizationMemberService struct {
	Options []option.RequestOption
}

OrganizationMemberService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationMemberService method instead.

func NewOrganizationMemberService added in v0.2.0

func NewOrganizationMemberService(opts ...option.RequestOption) (r *OrganizationMemberService)

NewOrganizationMemberService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationMemberService) Update added in v0.2.0

Modify organization membership

type OrganizationMemberUpdateParams added in v0.2.0

type OrganizationMemberUpdateParams struct {
	// Users to invite to the organization
	InviteUsers param.Field[OrganizationMemberUpdateParamsInviteUsers] `json:"invite_users"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, or in case you want to
	// explicitly assert the organization you are modifying, you may specify the id of
	// the organization.
	OrgID param.Field[string] `json:"org_id"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, or in case you want to
	// explicitly assert the organization you are modifying, you may specify the name
	// of the organization.
	OrgName param.Field[string] `json:"org_name"`
	// Users to remove from the organization
	RemoveUsers param.Field[OrganizationMemberUpdateParamsRemoveUsers] `json:"remove_users"`
}

func (OrganizationMemberUpdateParams) MarshalJSON added in v0.2.0

func (r OrganizationMemberUpdateParams) MarshalJSON() (data []byte, err error)

type OrganizationMemberUpdateParamsInviteUsers added in v0.3.0

type OrganizationMemberUpdateParamsInviteUsers struct {
	// Emails of users to invite
	Emails param.Field[[]string] `json:"emails"`
	// Optional id of a group to add newly-invited users to. Cannot specify both a
	// group id and a group name.
	GroupID param.Field[string] `json:"group_id" format:"uuid"`
	// Optional name of a group to add newly-invited users to. Cannot specify both a
	// group id and a group name.
	GroupName param.Field[string] `json:"group_name"`
	// Ids of existing users to invite
	IDs param.Field[[]string] `json:"ids" format:"uuid"`
	// If true, send invite emails to the users who wore actually added
	SendInviteEmails param.Field[bool] `json:"send_invite_emails"`
}

Users to invite to the organization

func (OrganizationMemberUpdateParamsInviteUsers) MarshalJSON added in v0.3.0

func (r OrganizationMemberUpdateParamsInviteUsers) MarshalJSON() (data []byte, err error)

type OrganizationMemberUpdateParamsRemoveUsers added in v0.3.0

type OrganizationMemberUpdateParamsRemoveUsers struct {
	// Emails of users to remove
	Emails param.Field[[]string] `json:"emails"`
	// Ids of users to remove
	IDs param.Field[[]string] `json:"ids" format:"uuid"`
}

Users to remove from the organization

func (OrganizationMemberUpdateParamsRemoveUsers) MarshalJSON added in v0.3.0

func (r OrganizationMemberUpdateParamsRemoveUsers) MarshalJSON() (data []byte, err error)

type OrganizationMemberUpdateResponse added in v0.2.0

type OrganizationMemberUpdateResponse struct {
	Status OrganizationMemberUpdateResponseStatus `json:"status,required"`
	// If invite emails failed to send for some reason, the patch operation will still
	// complete, but we will return an error message here
	SendEmailError string                               `json:"send_email_error,nullable"`
	JSON           organizationMemberUpdateResponseJSON `json:"-"`
}

func (*OrganizationMemberUpdateResponse) UnmarshalJSON added in v0.2.0

func (r *OrganizationMemberUpdateResponse) UnmarshalJSON(data []byte) (err error)

type OrganizationMemberUpdateResponseStatus added in v0.2.0

type OrganizationMemberUpdateResponseStatus string
const (
	OrganizationMemberUpdateResponseStatusSuccess OrganizationMemberUpdateResponseStatus = "success"
)

func (OrganizationMemberUpdateResponseStatus) IsKnown added in v0.2.0

type OrganizationService added in v0.2.0

type OrganizationService struct {
	Options []option.RequestOption
	Members *OrganizationMemberService
}

OrganizationService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationService method instead.

func NewOrganizationService added in v0.2.0

func NewOrganizationService(opts ...option.RequestOption) (r *OrganizationService)

NewOrganizationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationService) Delete added in v0.2.0

func (r *OrganizationService) Delete(ctx context.Context, organizationID string, opts ...option.RequestOption) (res *shared.Organization, err error)

Delete a organization object by its id

func (*OrganizationService) Get added in v0.2.0

func (r *OrganizationService) Get(ctx context.Context, organizationID string, opts ...option.RequestOption) (res *shared.Organization, err error)

Get a organization object by its id

func (*OrganizationService) List added in v0.2.0

List out all organizations. The organizations are sorted by creation date, with the most recently-created organizations coming first

func (*OrganizationService) ListAutoPaging added in v0.2.0

List out all organizations. The organizations are sorted by creation date, with the most recently-created organizations coming first

func (*OrganizationService) Update added in v0.2.0

func (r *OrganizationService) Update(ctx context.Context, organizationID string, body OrganizationUpdateParams, opts ...option.RequestOption) (res *shared.Organization, err error)

Partially update a organization object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type OrganizationUpdateParams added in v0.2.0

type OrganizationUpdateParams struct {
	APIURL         param.Field[string] `json:"api_url"`
	IsUniversalAPI param.Field[bool]   `json:"is_universal_api"`
	// Name of the organization
	Name        param.Field[string] `json:"name"`
	ProxyURL    param.Field[string] `json:"proxy_url"`
	RealtimeURL param.Field[string] `json:"realtime_url"`
}

func (OrganizationUpdateParams) MarshalJSON added in v0.2.0

func (r OrganizationUpdateParams) MarshalJSON() (data []byte, err error)

type PathLookupFilterParam added in v0.2.0

type PathLookupFilterParam = shared.PathLookupFilterParam

A path-lookup filter describes an equality comparison against a specific sub-field in the event row. For instance, if you wish to filter on the value of `c` in `{"input": {"a": {"b": {"c": "hello"}}}}`, pass `path=["input", "a", "b", "c"]` and `value="hello"`

This is an alias to an internal type.

type PathLookupFilterType added in v0.2.0

type PathLookupFilterType = shared.PathLookupFilterType

Denotes the type of filter as a path-lookup filter

This is an alias to an internal type.

type Project

type Project = shared.Project

This is an alias to an internal type.

type ProjectListParams

type ProjectListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[ProjectListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (ProjectListParams) URLQuery

func (r ProjectListParams) URLQuery() (v url.Values)

URLQuery serializes ProjectListParams's query parameters as `url.Values`.

type ProjectListParamsIDsArray added in v0.2.0

type ProjectListParamsIDsArray []string

func (ProjectListParamsIDsArray) ImplementsProjectListParamsIDsUnion added in v0.2.0

func (r ProjectListParamsIDsArray) ImplementsProjectListParamsIDsUnion()

type ProjectListParamsIDsUnion added in v0.2.0

type ProjectListParamsIDsUnion interface {
	ImplementsProjectListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, ProjectListParamsIDsArray.

type ProjectLogFeedbackParams

type ProjectLogFeedbackParams struct {
	// A list of project logs feedback items
	Feedback param.Field[[]shared.FeedbackProjectLogsItemParam] `json:"feedback,required"`
}

func (ProjectLogFeedbackParams) MarshalJSON

func (r ProjectLogFeedbackParams) MarshalJSON() (data []byte, err error)

type ProjectLogFetchParams

type ProjectLogFetchParams struct {
	// limit the number of traces fetched
	//
	// Fetch queries may be paginated if the total result size is expected to be large
	// (e.g. project_logs which accumulate over a long time). Note that fetch queries
	// only support pagination in descending time order (from latest to earliest
	// `_xact_id`. Furthermore, later pages may return rows which showed up in earlier
	// pages, except with an earlier `_xact_id`. This happens because pagination occurs
	// over the whole version history of the event log. You will most likely want to
	// exclude any such duplicate, outdated rows (by `id`) from your combined result
	// set.
	//
	// The `limit` parameter controls the number of full traces to return. So you may
	// end up with more individual rows than the specified limit if you are fetching
	// events containing traces.
	Limit param.Field[int64] `query:"limit"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxRootSpanID param.Field[string] `query:"max_root_span_id"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxXactID param.Field[string] `query:"max_xact_id"`
	// Retrieve a snapshot of events from a past time
	//
	// The version id is essentially a filter on the latest event transaction id. You
	// can use the `max_xact_id` returned by a past fetch as the version to reproduce
	// that exact fetch.
	Version param.Field[string] `query:"version"`
}

func (ProjectLogFetchParams) URLQuery

func (r ProjectLogFetchParams) URLQuery() (v url.Values)

URLQuery serializes ProjectLogFetchParams's query parameters as `url.Values`.

type ProjectLogFetchPostParams

type ProjectLogFetchPostParams struct {
	// An opaque string to be used as a cursor for the next page of results, in order
	// from latest to earliest.
	//
	// The string can be obtained directly from the `cursor` property of the previous
	// fetch query
	Cursor param.Field[string] `json:"cursor"`
	// A list of filters on the events to fetch. Currently, only path-lookup type
	// filters are supported, but we may add more in the future
	Filters param.Field[[]shared.PathLookupFilterParam] `json:"filters"`
	// limit the number of traces fetched
	//
	// Fetch queries may be paginated if the total result size is expected to be large
	// (e.g. project_logs which accumulate over a long time). Note that fetch queries
	// only support pagination in descending time order (from latest to earliest
	// `_xact_id`. Furthermore, later pages may return rows which showed up in earlier
	// pages, except with an earlier `_xact_id`. This happens because pagination occurs
	// over the whole version history of the event log. You will most likely want to
	// exclude any such duplicate, outdated rows (by `id`) from your combined result
	// set.
	//
	// The `limit` parameter controls the number of full traces to return. So you may
	// end up with more individual rows than the specified limit if you are fetching
	// events containing traces.
	Limit param.Field[int64] `json:"limit"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxRootSpanID param.Field[string] `json:"max_root_span_id"`
	// DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in
	// favor of the explicit 'cursor' returned by object fetch requests. Please prefer
	// the 'cursor' argument going forwards.
	//
	// Together, `max_xact_id` and `max_root_span_id` form a pagination cursor
	//
	// Since a paginated fetch query returns results in order from latest to earliest,
	// the cursor for the next page can be found as the row with the minimum (earliest)
	// value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit`
	// for an overview of paginating fetch queries.
	MaxXactID param.Field[string] `json:"max_xact_id"`
	// Retrieve a snapshot of events from a past time
	//
	// The version id is essentially a filter on the latest event transaction id. You
	// can use the `max_xact_id` returned by a past fetch as the version to reproduce
	// that exact fetch.
	Version param.Field[string] `json:"version"`
}

func (ProjectLogFetchPostParams) MarshalJSON

func (r ProjectLogFetchPostParams) MarshalJSON() (data []byte, err error)

type ProjectLogInsertParams

type ProjectLogInsertParams struct {
	// A list of project logs events to insert
	Events param.Field[[]ProjectLogInsertParamsEventUnion] `json:"events,required"`
}

func (ProjectLogInsertParams) MarshalJSON

func (r ProjectLogInsertParams) MarshalJSON() (data []byte, err error)

type ProjectLogInsertParamsEvent

type ProjectLogInsertParamsEvent struct {
	Input          param.Field[interface{}] `json:"input,required"`
	Output         param.Field[interface{}] `json:"output,required"`
	Expected       param.Field[interface{}] `json:"expected,required"`
	Error          param.Field[interface{}] `json:"error,required"`
	Scores         param.Field[interface{}] `json:"scores,required"`
	Metadata       param.Field[interface{}] `json:"metadata,required"`
	Tags           param.Field[interface{}] `json:"tags,required"`
	Metrics        param.Field[interface{}] `json:"metrics,required"`
	Context        param.Field[interface{}] `json:"context,required"`
	SpanAttributes param.Field[interface{}] `json:"span_attributes,required"`
	// A unique identifier for the project logs event. If you don't provide one,
	// BrainTrust will generate one for you
	ID param.Field[string] `json:"id"`
	// The timestamp the project logs event was created
	Created param.Field[time.Time] `json:"created" format:"date-time"`
	// Pass `_object_delete=true` to mark the project logs event deleted. Deleted
	// events will not show up in subsequent fetches for this project logs
	ObjectDelete param.Field[bool] `json:"_object_delete"`
	// The `_is_merge` field controls how the row is merged with any existing row with
	// the same id in the DB. By default (or when set to `false`), the existing row is
	// completely replaced by the new row. When set to `true`, the new row is
	// deep-merged into the existing row
	//
	// For example, say there is an existing row in the DB
	// `{"id": "foo", "input": {"a": 5, "b": 10}}`. If we merge a new row as
	// `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}`, the new row
	// will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we replace the
	// new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be
	// `{"id": "foo", "input": {"b": 11, "c": 20}}`
	IsMerge param.Field[bool] `json:"_is_merge"`
	// Use the `_parent_id` field to create this row as a subspan of an existing row.
	// It cannot be specified alongside `_is_merge=true`. Tracking hierarchical
	// relationships are important for tracing (see the
	// [guide](https://www.braintrust.dev/docs/guides/tracing) for full details).
	//
	// For example, say we have logged a row
	// `{"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`.
	// We can create a sub-span of the parent row by logging
	// `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`.
	// In the webapp, only the root span row `"abc"` will show up in the summary view.
	// You can view the full trace hierarchy (in this case, the `"llm_call"` row) by
	// clicking on the "abc" row.
	ParentID   param.Field[string]      `json:"_parent_id"`
	MergePaths param.Field[interface{}] `json:"_merge_paths,required"`
}

A project logs event

func (ProjectLogInsertParamsEvent) ImplementsProjectLogInsertParamsEventUnion added in v0.3.0

func (r ProjectLogInsertParamsEvent) ImplementsProjectLogInsertParamsEventUnion()

func (ProjectLogInsertParamsEvent) MarshalJSON added in v0.3.0

func (r ProjectLogInsertParamsEvent) MarshalJSON() (data []byte, err error)

type ProjectLogInsertParamsEventUnion added in v0.3.0

type ProjectLogInsertParamsEventUnion interface {
	ImplementsProjectLogInsertParamsEventUnion()
}

A project logs event

Satisfied by shared.InsertProjectLogsEventReplaceParam, shared.InsertProjectLogsEventMergeParam, ProjectLogInsertParamsEvent.

type ProjectLogService

type ProjectLogService struct {
	Options []option.RequestOption
}

ProjectLogService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectLogService method instead.

func NewProjectLogService

func NewProjectLogService(opts ...option.RequestOption) (r *ProjectLogService)

NewProjectLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectLogService) Feedback

func (r *ProjectLogService) Feedback(ctx context.Context, projectID string, body ProjectLogFeedbackParams, opts ...option.RequestOption) (err error)

Log feedback for a set of project logs events

func (*ProjectLogService) Fetch

Fetch the events in a project logs. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body

func (*ProjectLogService) FetchPost

Fetch the events in a project logs. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query

func (*ProjectLogService) Insert

Insert a set of events into the project logs

type ProjectLogsEvent added in v0.2.0

type ProjectLogsEvent = shared.ProjectLogsEvent

This is an alias to an internal type.

type ProjectLogsEventContext added in v0.2.0

type ProjectLogsEventContext = shared.ProjectLogsEventContext

Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event

This is an alias to an internal type.

type ProjectLogsEventLogID added in v0.2.0

type ProjectLogsEventLogID = shared.ProjectLogsEventLogID

A literal 'g' which identifies the log as a project log

This is an alias to an internal type.

type ProjectLogsEventMetrics added in v0.2.0

type ProjectLogsEventMetrics = shared.ProjectLogsEventMetrics

Metrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced

This is an alias to an internal type.

type ProjectLogsEventSpanAttributes added in v0.2.0

type ProjectLogsEventSpanAttributes = shared.ProjectLogsEventSpanAttributes

Human-identifying attributes of the span, such as name, type, etc.

This is an alias to an internal type.

type ProjectLogsEventSpanAttributesType added in v0.2.0

type ProjectLogsEventSpanAttributesType = shared.ProjectLogsEventSpanAttributesType

Type of the span, for display purposes only

This is an alias to an internal type.

type ProjectNewParams

type ProjectNewParams struct {
	// Name of the project
	Name param.Field[string] `json:"name,required"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, you may specify the name of
	// the organization the project belongs in.
	OrgName param.Field[string] `json:"org_name"`
}

func (ProjectNewParams) MarshalJSON

func (r ProjectNewParams) MarshalJSON() (data []byte, err error)

type ProjectScore added in v0.2.0

type ProjectScore = shared.ProjectScore

A project score is a user-configured score, which can be manually-labeled through the UI

This is an alias to an internal type.

type ProjectScoreCategoriesCategorical added in v0.2.0

type ProjectScoreCategoriesCategorical = shared.ProjectScoreCategoriesCategorical

For categorical-type project scores, the list of all categories

This is an alias to an internal type.

type ProjectScoreCategoriesMinimum added in v0.2.0

type ProjectScoreCategoriesMinimum = shared.ProjectScoreCategoriesMinimum

For minimum-type project scores, the list of included scores

This is an alias to an internal type.

type ProjectScoreCategoriesNullableVariant added in v0.2.0

type ProjectScoreCategoriesNullableVariant = shared.ProjectScoreCategoriesNullableVariant

This is an alias to an internal type.

type ProjectScoreCategoriesUnion added in v0.2.0

type ProjectScoreCategoriesUnion = shared.ProjectScoreCategoriesUnion

For categorical-type project scores, the list of all categories

This is an alias to an internal type.

type ProjectScoreCategory added in v0.2.0

type ProjectScoreCategory = shared.ProjectScoreCategory

For categorical-type project scores, defines a single category

This is an alias to an internal type.

type ProjectScoreCategoryParam added in v0.2.0

type ProjectScoreCategoryParam = shared.ProjectScoreCategoryParam

For categorical-type project scores, defines a single category

This is an alias to an internal type.

type ProjectScoreConfig added in v0.2.0

type ProjectScoreConfig = shared.ProjectScoreConfig

This is an alias to an internal type.

type ProjectScoreConfigDestination added in v0.2.0

type ProjectScoreConfigDestination = shared.ProjectScoreConfigDestination

This is an alias to an internal type.

type ProjectScoreListParams added in v0.2.0

type ProjectScoreListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[ProjectScoreListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Project id
	ProjectID param.Field[string] `query:"project_id" format:"uuid"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Name of the project_score to search for
	ProjectScoreName param.Field[string] `query:"project_score_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (ProjectScoreListParams) URLQuery added in v0.2.0

func (r ProjectScoreListParams) URLQuery() (v url.Values)

URLQuery serializes ProjectScoreListParams's query parameters as `url.Values`.

type ProjectScoreListParamsIDsArray added in v0.2.0

type ProjectScoreListParamsIDsArray []string

func (ProjectScoreListParamsIDsArray) ImplementsProjectScoreListParamsIDsUnion added in v0.2.0

func (r ProjectScoreListParamsIDsArray) ImplementsProjectScoreListParamsIDsUnion()

type ProjectScoreListParamsIDsUnion added in v0.2.0

type ProjectScoreListParamsIDsUnion interface {
	ImplementsProjectScoreListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, ProjectScoreListParamsIDsArray.

type ProjectScoreNewParams added in v0.2.0

type ProjectScoreNewParams struct {
	// Name of the project score
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the project score belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// The type of the configured score
	ScoreType param.Field[ProjectScoreNewParamsScoreType] `json:"score_type,required"`
	// For categorical-type project scores, the list of all categories
	Categories param.Field[ProjectScoreNewParamsCategoriesUnion] `json:"categories"`
	// Textual description of the project score
	Description param.Field[string] `json:"description"`
}

func (ProjectScoreNewParams) MarshalJSON added in v0.2.0

func (r ProjectScoreNewParams) MarshalJSON() (data []byte, err error)

type ProjectScoreNewParamsCategoriesCategorical added in v0.3.0

type ProjectScoreNewParamsCategoriesCategorical []shared.ProjectScoreCategoryParam

type ProjectScoreNewParamsCategoriesMinimum added in v0.3.0

type ProjectScoreNewParamsCategoriesMinimum []string

type ProjectScoreNewParamsCategoriesNullableVariant added in v0.3.0

type ProjectScoreNewParamsCategoriesNullableVariant struct {
}

func (ProjectScoreNewParamsCategoriesNullableVariant) MarshalJSON added in v0.3.0

func (r ProjectScoreNewParamsCategoriesNullableVariant) MarshalJSON() (data []byte, err error)

type ProjectScoreNewParamsCategoriesUnion added in v0.3.0

type ProjectScoreNewParamsCategoriesUnion interface {
	// contains filtered or unexported methods
}

For categorical-type project scores, the list of all categories

Satisfied by ProjectScoreNewParamsCategoriesCategorical, ProjectScoreNewParamsCategoriesMinimum, ProjectScoreNewParamsCategoriesNullableVariant.

type ProjectScoreNewParamsScoreType added in v0.3.0

type ProjectScoreNewParamsScoreType string

The type of the configured score

const (
	ProjectScoreNewParamsScoreTypeSlider      ProjectScoreNewParamsScoreType = "slider"
	ProjectScoreNewParamsScoreTypeCategorical ProjectScoreNewParamsScoreType = "categorical"
	ProjectScoreNewParamsScoreTypeWeighted    ProjectScoreNewParamsScoreType = "weighted"
	ProjectScoreNewParamsScoreTypeMinimum     ProjectScoreNewParamsScoreType = "minimum"
)

func (ProjectScoreNewParamsScoreType) IsKnown added in v0.3.0

type ProjectScoreReplaceParams added in v0.2.0

type ProjectScoreReplaceParams struct {
	// Name of the project score
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the project score belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// The type of the configured score
	ScoreType param.Field[ProjectScoreReplaceParamsScoreType] `json:"score_type,required"`
	// For categorical-type project scores, the list of all categories
	Categories param.Field[ProjectScoreReplaceParamsCategoriesUnion] `json:"categories"`
	// Textual description of the project score
	Description param.Field[string] `json:"description"`
}

func (ProjectScoreReplaceParams) MarshalJSON added in v0.2.0

func (r ProjectScoreReplaceParams) MarshalJSON() (data []byte, err error)

type ProjectScoreReplaceParamsCategoriesCategorical added in v0.3.0

type ProjectScoreReplaceParamsCategoriesCategorical []shared.ProjectScoreCategoryParam

type ProjectScoreReplaceParamsCategoriesMinimum added in v0.3.0

type ProjectScoreReplaceParamsCategoriesMinimum []string

type ProjectScoreReplaceParamsCategoriesNullableVariant added in v0.3.0

type ProjectScoreReplaceParamsCategoriesNullableVariant struct {
}

func (ProjectScoreReplaceParamsCategoriesNullableVariant) MarshalJSON added in v0.3.0

func (r ProjectScoreReplaceParamsCategoriesNullableVariant) MarshalJSON() (data []byte, err error)

type ProjectScoreReplaceParamsCategoriesUnion added in v0.3.0

type ProjectScoreReplaceParamsCategoriesUnion interface {
	// contains filtered or unexported methods
}

For categorical-type project scores, the list of all categories

Satisfied by ProjectScoreReplaceParamsCategoriesCategorical, ProjectScoreReplaceParamsCategoriesMinimum, ProjectScoreReplaceParamsCategoriesNullableVariant.

type ProjectScoreReplaceParamsScoreType added in v0.3.0

type ProjectScoreReplaceParamsScoreType string

The type of the configured score

const (
	ProjectScoreReplaceParamsScoreTypeSlider      ProjectScoreReplaceParamsScoreType = "slider"
	ProjectScoreReplaceParamsScoreTypeCategorical ProjectScoreReplaceParamsScoreType = "categorical"
	ProjectScoreReplaceParamsScoreTypeWeighted    ProjectScoreReplaceParamsScoreType = "weighted"
	ProjectScoreReplaceParamsScoreTypeMinimum     ProjectScoreReplaceParamsScoreType = "minimum"
)

func (ProjectScoreReplaceParamsScoreType) IsKnown added in v0.3.0

type ProjectScoreScoreType added in v0.2.0

type ProjectScoreScoreType = shared.ProjectScoreScoreType

The type of the configured score

This is an alias to an internal type.

type ProjectScoreService added in v0.2.0

type ProjectScoreService struct {
	Options []option.RequestOption
}

ProjectScoreService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectScoreService method instead.

func NewProjectScoreService added in v0.2.0

func NewProjectScoreService(opts ...option.RequestOption) (r *ProjectScoreService)

NewProjectScoreService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectScoreService) Delete added in v0.2.0

func (r *ProjectScoreService) Delete(ctx context.Context, projectScoreID string, opts ...option.RequestOption) (res *shared.ProjectScore, err error)

Delete a project_score object by its id

func (*ProjectScoreService) Get added in v0.2.0

func (r *ProjectScoreService) Get(ctx context.Context, projectScoreID string, opts ...option.RequestOption) (res *shared.ProjectScore, err error)

Get a project_score object by its id

func (*ProjectScoreService) List added in v0.2.0

List out all project_scores. The project_scores are sorted by creation date, with the most recently-created project_scores coming first

func (*ProjectScoreService) ListAutoPaging added in v0.2.0

List out all project_scores. The project_scores are sorted by creation date, with the most recently-created project_scores coming first

func (*ProjectScoreService) New added in v0.2.0

Create a new project_score. If there is an existing project_score in the project with the same name as the one specified in the request, will return the existing project_score unmodified

func (*ProjectScoreService) Replace added in v0.2.0

Create or replace project_score. If there is an existing project_score in the project with the same name as the one specified in the request, will replace the existing project_score with the provided fields

func (*ProjectScoreService) Update added in v0.2.0

func (r *ProjectScoreService) Update(ctx context.Context, projectScoreID string, body ProjectScoreUpdateParams, opts ...option.RequestOption) (res *shared.ProjectScore, err error)

Partially update a project_score object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type ProjectScoreUpdateParams added in v0.2.0

type ProjectScoreUpdateParams struct {
	// For categorical-type project scores, the list of all categories
	Categories param.Field[ProjectScoreUpdateParamsCategoriesUnion] `json:"categories"`
	// Textual description of the project score
	Description param.Field[string] `json:"description"`
	// Name of the project score
	Name param.Field[string] `json:"name"`
	// The type of the configured score
	ScoreType param.Field[ProjectScoreUpdateParamsScoreType] `json:"score_type"`
}

func (ProjectScoreUpdateParams) MarshalJSON added in v0.2.0

func (r ProjectScoreUpdateParams) MarshalJSON() (data []byte, err error)

type ProjectScoreUpdateParamsCategoriesCategorical added in v0.3.0

type ProjectScoreUpdateParamsCategoriesCategorical []shared.ProjectScoreCategoryParam

type ProjectScoreUpdateParamsCategoriesMinimum added in v0.3.0

type ProjectScoreUpdateParamsCategoriesMinimum []string

type ProjectScoreUpdateParamsCategoriesNullableVariant added in v0.3.0

type ProjectScoreUpdateParamsCategoriesNullableVariant struct {
}

func (ProjectScoreUpdateParamsCategoriesNullableVariant) MarshalJSON added in v0.3.0

func (r ProjectScoreUpdateParamsCategoriesNullableVariant) MarshalJSON() (data []byte, err error)

type ProjectScoreUpdateParamsCategoriesUnion added in v0.3.0

type ProjectScoreUpdateParamsCategoriesUnion interface {
	// contains filtered or unexported methods
}

For categorical-type project scores, the list of all categories

Satisfied by ProjectScoreUpdateParamsCategoriesCategorical, ProjectScoreUpdateParamsCategoriesMinimum, ProjectScoreUpdateParamsCategoriesNullableVariant.

type ProjectScoreUpdateParamsScoreType added in v0.3.0

type ProjectScoreUpdateParamsScoreType string

The type of the configured score

const (
	ProjectScoreUpdateParamsScoreTypeSlider      ProjectScoreUpdateParamsScoreType = "slider"
	ProjectScoreUpdateParamsScoreTypeCategorical ProjectScoreUpdateParamsScoreType = "categorical"
	ProjectScoreUpdateParamsScoreTypeWeighted    ProjectScoreUpdateParamsScoreType = "weighted"
	ProjectScoreUpdateParamsScoreTypeMinimum     ProjectScoreUpdateParamsScoreType = "minimum"
)

func (ProjectScoreUpdateParamsScoreType) IsKnown added in v0.3.0

type ProjectService

type ProjectService struct {
	Options []option.RequestOption
	Logs    *ProjectLogService
}

ProjectService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectService method instead.

func NewProjectService

func NewProjectService(opts ...option.RequestOption) (r *ProjectService)

NewProjectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectService) Delete

func (r *ProjectService) Delete(ctx context.Context, projectID string, opts ...option.RequestOption) (res *shared.Project, err error)

Delete a project object by its id

func (*ProjectService) Get

func (r *ProjectService) Get(ctx context.Context, projectID string, opts ...option.RequestOption) (res *shared.Project, err error)

Get a project object by its id

func (*ProjectService) List

List out all projects. The projects are sorted by creation date, with the most recently-created projects coming first

func (*ProjectService) ListAutoPaging

List out all projects. The projects are sorted by creation date, with the most recently-created projects coming first

func (*ProjectService) New

func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts ...option.RequestOption) (res *shared.Project, err error)

Create a new project. If there is an existing project with the same name as the one specified in the request, will return the existing project unmodified

func (*ProjectService) Update

func (r *ProjectService) Update(ctx context.Context, projectID string, body ProjectUpdateParams, opts ...option.RequestOption) (res *shared.Project, err error)

Partially update a project object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type ProjectSettings added in v0.2.0

type ProjectSettings = shared.ProjectSettings

This is an alias to an internal type.

type ProjectTag added in v0.2.0

type ProjectTag = shared.ProjectTag

A project tag is a user-configured tag for tracking and filtering your experiments, logs, and other data

This is an alias to an internal type.

type ProjectTagListParams added in v0.2.0

type ProjectTagListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[ProjectTagListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Project id
	ProjectID param.Field[string] `query:"project_id" format:"uuid"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Name of the project_tag to search for
	ProjectTagName param.Field[string] `query:"project_tag_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (ProjectTagListParams) URLQuery added in v0.2.0

func (r ProjectTagListParams) URLQuery() (v url.Values)

URLQuery serializes ProjectTagListParams's query parameters as `url.Values`.

type ProjectTagListParamsIDsArray added in v0.2.0

type ProjectTagListParamsIDsArray []string

func (ProjectTagListParamsIDsArray) ImplementsProjectTagListParamsIDsUnion added in v0.2.0

func (r ProjectTagListParamsIDsArray) ImplementsProjectTagListParamsIDsUnion()

type ProjectTagListParamsIDsUnion added in v0.2.0

type ProjectTagListParamsIDsUnion interface {
	ImplementsProjectTagListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, ProjectTagListParamsIDsArray.

type ProjectTagNewParams added in v0.2.0

type ProjectTagNewParams struct {
	// Name of the project tag
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the project tag belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Color of the tag for the UI
	Color param.Field[string] `json:"color"`
	// Textual description of the project tag
	Description param.Field[string] `json:"description"`
}

func (ProjectTagNewParams) MarshalJSON added in v0.2.0

func (r ProjectTagNewParams) MarshalJSON() (data []byte, err error)

type ProjectTagReplaceParams added in v0.2.0

type ProjectTagReplaceParams struct {
	// Name of the project tag
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the project tag belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Color of the tag for the UI
	Color param.Field[string] `json:"color"`
	// Textual description of the project tag
	Description param.Field[string] `json:"description"`
}

func (ProjectTagReplaceParams) MarshalJSON added in v0.2.0

func (r ProjectTagReplaceParams) MarshalJSON() (data []byte, err error)

type ProjectTagService added in v0.2.0

type ProjectTagService struct {
	Options []option.RequestOption
}

ProjectTagService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectTagService method instead.

func NewProjectTagService added in v0.2.0

func NewProjectTagService(opts ...option.RequestOption) (r *ProjectTagService)

NewProjectTagService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectTagService) Delete added in v0.2.0

func (r *ProjectTagService) Delete(ctx context.Context, projectTagID string, opts ...option.RequestOption) (res *shared.ProjectTag, err error)

Delete a project_tag object by its id

func (*ProjectTagService) Get added in v0.2.0

func (r *ProjectTagService) Get(ctx context.Context, projectTagID string, opts ...option.RequestOption) (res *shared.ProjectTag, err error)

Get a project_tag object by its id

func (*ProjectTagService) List added in v0.2.0

List out all project_tags. The project_tags are sorted by creation date, with the most recently-created project_tags coming first

func (*ProjectTagService) ListAutoPaging added in v0.2.0

List out all project_tags. The project_tags are sorted by creation date, with the most recently-created project_tags coming first

func (*ProjectTagService) New added in v0.2.0

Create a new project_tag. If there is an existing project_tag in the project with the same name as the one specified in the request, will return the existing project_tag unmodified

func (*ProjectTagService) Replace added in v0.2.0

Create or replace project_tag. If there is an existing project_tag in the project with the same name as the one specified in the request, will replace the existing project_tag with the provided fields

func (*ProjectTagService) Update added in v0.2.0

func (r *ProjectTagService) Update(ctx context.Context, projectTagID string, body ProjectTagUpdateParams, opts ...option.RequestOption) (res *shared.ProjectTag, err error)

Partially update a project_tag object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type ProjectTagUpdateParams added in v0.2.0

type ProjectTagUpdateParams struct {
	// Color of the tag for the UI
	Color param.Field[string] `json:"color"`
	// Textual description of the project tag
	Description param.Field[string] `json:"description"`
	// Name of the project tag
	Name param.Field[string] `json:"name"`
}

func (ProjectTagUpdateParams) MarshalJSON added in v0.2.0

func (r ProjectTagUpdateParams) MarshalJSON() (data []byte, err error)

type ProjectUpdateParams

type ProjectUpdateParams struct {
	// Name of the project
	Name param.Field[string] `json:"name"`
	// Project settings. Patch operations replace all settings, so make sure you
	// include all settings you want to keep.
	Settings param.Field[ProjectUpdateParamsSettings] `json:"settings"`
}

func (ProjectUpdateParams) MarshalJSON

func (r ProjectUpdateParams) MarshalJSON() (data []byte, err error)

type ProjectUpdateParamsSettings added in v0.3.0

type ProjectUpdateParamsSettings struct {
	// The key used to join two experiments (defaults to `input`).
	ComparisonKey param.Field[string] `json:"comparison_key"`
}

Project settings. Patch operations replace all settings, so make sure you include all settings you want to keep.

func (ProjectUpdateParamsSettings) MarshalJSON added in v0.3.0

func (r ProjectUpdateParamsSettings) MarshalJSON() (data []byte, err error)

type Prompt added in v0.2.0

type Prompt = shared.Prompt

This is an alias to an internal type.

type PromptData added in v0.2.0

type PromptData = shared.PromptData

The prompt, model, and its parameters

This is an alias to an internal type.

type PromptDataOptions added in v0.2.0

type PromptDataOptions = shared.PromptDataOptions

This is an alias to an internal type.

type PromptDataOptionsParam added in v0.2.0

type PromptDataOptionsParam = shared.PromptDataOptionsParam

This is an alias to an internal type.

type PromptDataOptionsParamsAnthropicModelParams added in v0.2.0

type PromptDataOptionsParamsAnthropicModelParams = shared.PromptDataOptionsParamsAnthropicModelParams

This is an alias to an internal type.

type PromptDataOptionsParamsAnthropicModelParamsParam added in v0.2.0

type PromptDataOptionsParamsAnthropicModelParamsParam = shared.PromptDataOptionsParamsAnthropicModelParamsParam

This is an alias to an internal type.

type PromptDataOptionsParamsGoogleModelParams added in v0.2.0

type PromptDataOptionsParamsGoogleModelParams = shared.PromptDataOptionsParamsGoogleModelParams

This is an alias to an internal type.

type PromptDataOptionsParamsGoogleModelParamsParam added in v0.2.0

type PromptDataOptionsParamsGoogleModelParamsParam = shared.PromptDataOptionsParamsGoogleModelParamsParam

This is an alias to an internal type.

type PromptDataOptionsParamsJsCompletionParams added in v0.2.0

type PromptDataOptionsParamsJsCompletionParams = shared.PromptDataOptionsParamsJsCompletionParams

This is an alias to an internal type.

type PromptDataOptionsParamsJsCompletionParamsParam added in v0.2.0

type PromptDataOptionsParamsJsCompletionParamsParam = shared.PromptDataOptionsParamsJsCompletionParamsParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParams added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParams = shared.PromptDataOptionsParamsOpenAIModelParams

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallAuto added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallAuto = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallAuto

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallFunction added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallFunction = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallFunction

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallFunctionParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallFunctionParam = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallFunctionParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallNone added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallNone = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallNone

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallUnion added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallUnion = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallUnion

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallUnionParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsFunctionCallUnionParam = shared.PromptDataOptionsParamsOpenAIModelParamsFunctionCallUnionParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsParam = shared.PromptDataOptionsParamsOpenAIModelParamsParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsResponseFormat added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsResponseFormat = shared.PromptDataOptionsParamsOpenAIModelParamsResponseFormat

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsResponseFormatParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsResponseFormatParam = shared.PromptDataOptionsParamsOpenAIModelParamsResponseFormatParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsResponseFormatType added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsResponseFormatType = shared.PromptDataOptionsParamsOpenAIModelParamsResponseFormatType

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceAuto added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceAuto = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceAuto

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunction added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunction = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunction

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionFunction added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionFunction = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionFunction

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionFunctionParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionFunctionParam = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionFunctionParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionParam = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionParam

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionType added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionType = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceFunctionType

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceNone added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceNone = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceNone

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceUnion added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceUnion = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceUnion

This is an alias to an internal type.

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceUnionParam added in v0.2.0

type PromptDataOptionsParamsOpenAIModelParamsToolChoiceUnionParam = shared.PromptDataOptionsParamsOpenAIModelParamsToolChoiceUnionParam

This is an alias to an internal type.

type PromptDataOptionsParamsUnion added in v0.2.0

type PromptDataOptionsParamsUnion = shared.PromptDataOptionsParamsUnion

This is an alias to an internal type.

type PromptDataOptionsParamsUnionParam added in v0.2.0

type PromptDataOptionsParamsUnionParam = shared.PromptDataOptionsParamsUnionParam

This is an alias to an internal type.

type PromptDataOptionsParamsWindowAIModelParams added in v0.2.0

type PromptDataOptionsParamsWindowAIModelParams = shared.PromptDataOptionsParamsWindowAIModelParams

This is an alias to an internal type.

type PromptDataOptionsParamsWindowAIModelParamsParam added in v0.2.0

type PromptDataOptionsParamsWindowAIModelParamsParam = shared.PromptDataOptionsParamsWindowAIModelParamsParam

This is an alias to an internal type.

type PromptDataOrigin added in v0.2.0

type PromptDataOrigin = shared.PromptDataOrigin

This is an alias to an internal type.

type PromptDataOriginParam added in v0.2.0

type PromptDataOriginParam = shared.PromptDataOriginParam

This is an alias to an internal type.

type PromptDataParam added in v0.2.0

type PromptDataParam = shared.PromptDataParam

The prompt, model, and its parameters

This is an alias to an internal type.

type PromptDataPrompt added in v0.2.0

type PromptDataPrompt = shared.PromptDataPrompt

This is an alias to an internal type.

type PromptDataPromptChat added in v0.2.0

type PromptDataPromptChat = shared.PromptDataPromptChat

This is an alias to an internal type.

type PromptDataPromptChatMessage added in v0.2.0

type PromptDataPromptChatMessage = shared.PromptDataPromptChatMessage

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistant added in v0.2.0

type PromptDataPromptChatMessagesAssistant = shared.PromptDataPromptChatMessagesAssistant

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantFunctionCall added in v0.2.0

type PromptDataPromptChatMessagesAssistantFunctionCall = shared.PromptDataPromptChatMessagesAssistantFunctionCall

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantFunctionCallParam added in v0.2.0

type PromptDataPromptChatMessagesAssistantFunctionCallParam = shared.PromptDataPromptChatMessagesAssistantFunctionCallParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantParam added in v0.2.0

type PromptDataPromptChatMessagesAssistantParam = shared.PromptDataPromptChatMessagesAssistantParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantRole added in v0.2.0

type PromptDataPromptChatMessagesAssistantRole = shared.PromptDataPromptChatMessagesAssistantRole

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantToolCall added in v0.2.0

type PromptDataPromptChatMessagesAssistantToolCall = shared.PromptDataPromptChatMessagesAssistantToolCall

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantToolCallParam added in v0.2.0

type PromptDataPromptChatMessagesAssistantToolCallParam = shared.PromptDataPromptChatMessagesAssistantToolCallParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantToolCallsFunction added in v0.2.0

type PromptDataPromptChatMessagesAssistantToolCallsFunction = shared.PromptDataPromptChatMessagesAssistantToolCallsFunction

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantToolCallsFunctionParam added in v0.2.0

type PromptDataPromptChatMessagesAssistantToolCallsFunctionParam = shared.PromptDataPromptChatMessagesAssistantToolCallsFunctionParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesAssistantToolCallsType added in v0.2.0

type PromptDataPromptChatMessagesAssistantToolCallsType = shared.PromptDataPromptChatMessagesAssistantToolCallsType

This is an alias to an internal type.

type PromptDataPromptChatMessagesFallback added in v0.2.0

type PromptDataPromptChatMessagesFallback = shared.PromptDataPromptChatMessagesFallback

This is an alias to an internal type.

type PromptDataPromptChatMessagesFallbackParam added in v0.2.0

type PromptDataPromptChatMessagesFallbackParam = shared.PromptDataPromptChatMessagesFallbackParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesFallbackRole added in v0.2.0

type PromptDataPromptChatMessagesFallbackRole = shared.PromptDataPromptChatMessagesFallbackRole

This is an alias to an internal type.

type PromptDataPromptChatMessagesFunction added in v0.2.0

type PromptDataPromptChatMessagesFunction = shared.PromptDataPromptChatMessagesFunction

This is an alias to an internal type.

type PromptDataPromptChatMessagesFunctionParam added in v0.2.0

type PromptDataPromptChatMessagesFunctionParam = shared.PromptDataPromptChatMessagesFunctionParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesFunctionRole added in v0.2.0

type PromptDataPromptChatMessagesFunctionRole = shared.PromptDataPromptChatMessagesFunctionRole

This is an alias to an internal type.

type PromptDataPromptChatMessagesRole added in v0.2.0

type PromptDataPromptChatMessagesRole = shared.PromptDataPromptChatMessagesRole

This is an alias to an internal type.

type PromptDataPromptChatMessagesSystem added in v0.2.0

type PromptDataPromptChatMessagesSystem = shared.PromptDataPromptChatMessagesSystem

This is an alias to an internal type.

type PromptDataPromptChatMessagesSystemParam added in v0.2.0

type PromptDataPromptChatMessagesSystemParam = shared.PromptDataPromptChatMessagesSystemParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesSystemRole added in v0.2.0

type PromptDataPromptChatMessagesSystemRole = shared.PromptDataPromptChatMessagesSystemRole

This is an alias to an internal type.

type PromptDataPromptChatMessagesTool added in v0.2.0

type PromptDataPromptChatMessagesTool = shared.PromptDataPromptChatMessagesTool

This is an alias to an internal type.

type PromptDataPromptChatMessagesToolParam added in v0.2.0

type PromptDataPromptChatMessagesToolParam = shared.PromptDataPromptChatMessagesToolParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesToolRole added in v0.2.0

type PromptDataPromptChatMessagesToolRole = shared.PromptDataPromptChatMessagesToolRole

This is an alias to an internal type.

type PromptDataPromptChatMessagesUnionParam added in v0.2.0

type PromptDataPromptChatMessagesUnionParam = shared.PromptDataPromptChatMessagesUnionParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUser added in v0.2.0

type PromptDataPromptChatMessagesUser = shared.PromptDataPromptChatMessagesUser

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArray added in v0.2.0

type PromptDataPromptChatMessagesUserContentArray = shared.PromptDataPromptChatMessagesUserContentArray

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayImageURL added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayImageURL = shared.PromptDataPromptChatMessagesUserContentArrayImageURL

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayImageURLImageURL added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayImageURLImageURL = shared.PromptDataPromptChatMessagesUserContentArrayImageURLImageURL

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetail added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetail = shared.PromptDataPromptChatMessagesUserContentArrayImageURLImageURLDetail

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayImageURLImageURLParam added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayImageURLImageURLParam = shared.PromptDataPromptChatMessagesUserContentArrayImageURLImageURLParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayImageURLParam added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayImageURLParam = shared.PromptDataPromptChatMessagesUserContentArrayImageURLParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayImageURLType added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayImageURLType = shared.PromptDataPromptChatMessagesUserContentArrayImageURLType

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayItem added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayItem = shared.PromptDataPromptChatMessagesUserContentArrayItem

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayParam added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayParam = shared.PromptDataPromptChatMessagesUserContentArrayParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayText added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayText = shared.PromptDataPromptChatMessagesUserContentArrayText

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayTextParam added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayTextParam = shared.PromptDataPromptChatMessagesUserContentArrayTextParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayTextType added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayTextType = shared.PromptDataPromptChatMessagesUserContentArrayTextType

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayType added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayType = shared.PromptDataPromptChatMessagesUserContentArrayType

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentArrayUnionItemParam added in v0.2.0

type PromptDataPromptChatMessagesUserContentArrayUnionItemParam = shared.PromptDataPromptChatMessagesUserContentArrayUnionItemParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentUnion added in v0.2.0

type PromptDataPromptChatMessagesUserContentUnion = shared.PromptDataPromptChatMessagesUserContentUnion

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserContentUnionParam added in v0.2.0

type PromptDataPromptChatMessagesUserContentUnionParam = shared.PromptDataPromptChatMessagesUserContentUnionParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserParam added in v0.2.0

type PromptDataPromptChatMessagesUserParam = shared.PromptDataPromptChatMessagesUserParam

This is an alias to an internal type.

type PromptDataPromptChatMessagesUserRole added in v0.2.0

type PromptDataPromptChatMessagesUserRole = shared.PromptDataPromptChatMessagesUserRole

This is an alias to an internal type.

type PromptDataPromptChatParam added in v0.2.0

type PromptDataPromptChatParam = shared.PromptDataPromptChatParam

This is an alias to an internal type.

type PromptDataPromptChatType added in v0.2.0

type PromptDataPromptChatType = shared.PromptDataPromptChatType

This is an alias to an internal type.

type PromptDataPromptCompletion added in v0.2.0

type PromptDataPromptCompletion = shared.PromptDataPromptCompletion

This is an alias to an internal type.

type PromptDataPromptCompletionParam added in v0.2.0

type PromptDataPromptCompletionParam = shared.PromptDataPromptCompletionParam

This is an alias to an internal type.

type PromptDataPromptCompletionType added in v0.2.0

type PromptDataPromptCompletionType = shared.PromptDataPromptCompletionType

This is an alias to an internal type.

type PromptDataPromptNullableVariant added in v0.2.0

type PromptDataPromptNullableVariant = shared.PromptDataPromptNullableVariant

This is an alias to an internal type.

type PromptDataPromptNullableVariantParam added in v0.2.0

type PromptDataPromptNullableVariantParam = shared.PromptDataPromptNullableVariantParam

This is an alias to an internal type.

type PromptDataPromptType added in v0.2.0

type PromptDataPromptType = shared.PromptDataPromptType

This is an alias to an internal type.

type PromptDataPromptUnionParam added in v0.2.0

type PromptDataPromptUnionParam = shared.PromptDataPromptUnionParam

This is an alias to an internal type.

type PromptListParams added in v0.2.0

type PromptListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[PromptListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Project id
	ProjectID param.Field[string] `query:"project_id" format:"uuid"`
	// Name of the project to search for
	ProjectName param.Field[string] `query:"project_name"`
	// Name of the prompt to search for
	PromptName param.Field[string] `query:"prompt_name"`
	// Retrieve prompt with a specific slug
	Slug param.Field[string] `query:"slug"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
	// Retrieve prompt at a specific version.
	//
	// The version id can either be a transaction id (e.g. '1000192656880881099') or a
	// version identifier (e.g. '81cd05ee665fdfb3').
	Version param.Field[string] `query:"version"`
}

func (PromptListParams) URLQuery added in v0.2.0

func (r PromptListParams) URLQuery() (v url.Values)

URLQuery serializes PromptListParams's query parameters as `url.Values`.

type PromptListParamsIDsArray added in v0.2.0

type PromptListParamsIDsArray []string

func (PromptListParamsIDsArray) ImplementsPromptListParamsIDsUnion added in v0.2.0

func (r PromptListParamsIDsArray) ImplementsPromptListParamsIDsUnion()

type PromptListParamsIDsUnion added in v0.2.0

type PromptListParamsIDsUnion interface {
	ImplementsPromptListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, PromptListParamsIDsArray.

type PromptLogID added in v0.2.0

type PromptLogID = shared.PromptLogID

A literal 'p' which identifies the object as a project prompt

This is an alias to an internal type.

type PromptNewParams added in v0.2.0

type PromptNewParams struct {
	// Name of the prompt
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the prompt belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Unique identifier for the prompt
	Slug param.Field[string] `json:"slug,required"`
	// Textual description of the prompt
	Description param.Field[string] `json:"description"`
	// The prompt, model, and its parameters
	PromptData param.Field[shared.PromptDataParam] `json:"prompt_data"`
	// A list of tags for the prompt
	Tags param.Field[[]string] `json:"tags"`
}

func (PromptNewParams) MarshalJSON added in v0.2.0

func (r PromptNewParams) MarshalJSON() (data []byte, err error)

type PromptReplaceParams added in v0.2.0

type PromptReplaceParams struct {
	// Name of the prompt
	Name param.Field[string] `json:"name,required"`
	// Unique identifier for the project that the prompt belongs under
	ProjectID param.Field[string] `json:"project_id,required" format:"uuid"`
	// Unique identifier for the prompt
	Slug param.Field[string] `json:"slug,required"`
	// Textual description of the prompt
	Description param.Field[string] `json:"description"`
	// The prompt, model, and its parameters
	PromptData param.Field[shared.PromptDataParam] `json:"prompt_data"`
	// A list of tags for the prompt
	Tags param.Field[[]string] `json:"tags"`
}

func (PromptReplaceParams) MarshalJSON added in v0.2.0

func (r PromptReplaceParams) MarshalJSON() (data []byte, err error)

type PromptService added in v0.2.0

type PromptService struct {
	Options []option.RequestOption
}

PromptService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPromptService method instead.

func NewPromptService added in v0.2.0

func NewPromptService(opts ...option.RequestOption) (r *PromptService)

NewPromptService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PromptService) Delete added in v0.2.0

func (r *PromptService) Delete(ctx context.Context, promptID string, opts ...option.RequestOption) (res *shared.Prompt, err error)

Delete a prompt object by its id

func (*PromptService) Get added in v0.2.0

func (r *PromptService) Get(ctx context.Context, promptID string, opts ...option.RequestOption) (res *shared.Prompt, err error)

Get a prompt object by its id

func (*PromptService) List added in v0.2.0

List out all prompts. The prompts are sorted by creation date, with the most recently-created prompts coming first

func (*PromptService) ListAutoPaging added in v0.2.0

List out all prompts. The prompts are sorted by creation date, with the most recently-created prompts coming first

func (*PromptService) New added in v0.2.0

func (r *PromptService) New(ctx context.Context, body PromptNewParams, opts ...option.RequestOption) (res *shared.Prompt, err error)

Create a new prompt. If there is an existing prompt in the project with the same slug as the one specified in the request, will return the existing prompt unmodified

func (*PromptService) Replace added in v0.2.0

func (r *PromptService) Replace(ctx context.Context, body PromptReplaceParams, opts ...option.RequestOption) (res *shared.Prompt, err error)

Create or replace prompt. If there is an existing prompt in the project with the same slug as the one specified in the request, will replace the existing prompt with the provided fields

func (*PromptService) Update added in v0.2.0

func (r *PromptService) Update(ctx context.Context, promptID string, body PromptUpdateParams, opts ...option.RequestOption) (res *shared.Prompt, err error)

Partially update a prompt object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type PromptUpdateParams added in v0.2.0

type PromptUpdateParams struct {
	// Textual description of the prompt
	Description param.Field[string] `json:"description"`
	// Name of the prompt
	Name param.Field[string] `json:"name"`
	// The prompt, model, and its parameters
	PromptData param.Field[shared.PromptDataParam] `json:"prompt_data"`
	// A list of tags for the prompt
	Tags param.Field[[]string] `json:"tags"`
}

func (PromptUpdateParams) MarshalJSON added in v0.2.0

func (r PromptUpdateParams) MarshalJSON() (data []byte, err error)

type RepoInfo added in v0.2.0

type RepoInfo = shared.RepoInfo

Metadata about the state of the repo when the experiment was created

This is an alias to an internal type.

type RepoInfoParam added in v0.2.0

type RepoInfoParam = shared.RepoInfoParam

Metadata about the state of the repo when the experiment was created

This is an alias to an internal type.

type Role added in v0.2.0

type Role = shared.Role

A role is a collection of permissions which can be granted as part of an ACL

Roles can consist of individual permissions, as well as a set of roles they inherit from

This is an alias to an internal type.

type RoleListParams added in v0.2.0

type RoleListParams struct {
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[RoleListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Name of the role to search for
	RoleName param.Field[string] `query:"role_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (RoleListParams) URLQuery added in v0.2.0

func (r RoleListParams) URLQuery() (v url.Values)

URLQuery serializes RoleListParams's query parameters as `url.Values`.

type RoleListParamsIDsArray added in v0.2.0

type RoleListParamsIDsArray []string

func (RoleListParamsIDsArray) ImplementsRoleListParamsIDsUnion added in v0.2.0

func (r RoleListParamsIDsArray) ImplementsRoleListParamsIDsUnion()

type RoleListParamsIDsUnion added in v0.2.0

type RoleListParamsIDsUnion interface {
	ImplementsRoleListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, RoleListParamsIDsArray.

type RoleMemberPermission added in v0.2.0

type RoleMemberPermission = shared.RoleMemberPermission

This is an alias to an internal type.

type RoleMemberPermissionsPermission added in v0.2.0

type RoleMemberPermissionsPermission = shared.RoleMemberPermissionsPermission

Each permission permits a certain type of operation on an object in the system

Permissions can be assigned to to objects on an individual basis, or grouped into roles

This is an alias to an internal type.

type RoleMemberPermissionsRestrictObjectType added in v0.2.0

type RoleMemberPermissionsRestrictObjectType = shared.RoleMemberPermissionsRestrictObjectType

The object type that the ACL applies to

This is an alias to an internal type.

type RoleNewParams added in v0.2.0

type RoleNewParams struct {
	// Name of the role
	Name param.Field[string] `json:"name,required"`
	// Textual description of the role
	Description param.Field[string] `json:"description"`
	// (permission, restrict_object_type) tuples which belong to this role
	MemberPermissions param.Field[[]RoleNewParamsMemberPermission] `json:"member_permissions"`
	// Ids of the roles this role inherits from
	//
	// An inheriting role has all the permissions contained in its member roles, as
	// well as all of their inherited permissions
	MemberRoles param.Field[[]string] `json:"member_roles" format:"uuid"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, you may specify the name of
	// the organization the role belongs in.
	OrgName param.Field[string] `json:"org_name"`
}

func (RoleNewParams) MarshalJSON added in v0.2.0

func (r RoleNewParams) MarshalJSON() (data []byte, err error)

type RoleNewParamsMemberPermission added in v0.3.0

type RoleNewParamsMemberPermission struct {
	// Each permission permits a certain type of operation on an object in the system
	//
	// Permissions can be assigned to to objects on an individual basis, or grouped
	// into roles
	Permission param.Field[RoleNewParamsMemberPermissionsPermission] `json:"permission,required"`
	// The object type that the ACL applies to
	RestrictObjectType param.Field[RoleNewParamsMemberPermissionsRestrictObjectType] `json:"restrict_object_type"`
}

func (RoleNewParamsMemberPermission) MarshalJSON added in v0.3.0

func (r RoleNewParamsMemberPermission) MarshalJSON() (data []byte, err error)

type RoleNewParamsMemberPermissionsPermission added in v0.3.0

type RoleNewParamsMemberPermissionsPermission string

Each permission permits a certain type of operation on an object in the system

Permissions can be assigned to to objects on an individual basis, or grouped into roles

const (
	RoleNewParamsMemberPermissionsPermissionCreate     RoleNewParamsMemberPermissionsPermission = "create"
	RoleNewParamsMemberPermissionsPermissionRead       RoleNewParamsMemberPermissionsPermission = "read"
	RoleNewParamsMemberPermissionsPermissionUpdate     RoleNewParamsMemberPermissionsPermission = "update"
	RoleNewParamsMemberPermissionsPermissionDelete     RoleNewParamsMemberPermissionsPermission = "delete"
	RoleNewParamsMemberPermissionsPermissionCreateACLs RoleNewParamsMemberPermissionsPermission = "create_acls"
	RoleNewParamsMemberPermissionsPermissionReadACLs   RoleNewParamsMemberPermissionsPermission = "read_acls"
	RoleNewParamsMemberPermissionsPermissionUpdateACLs RoleNewParamsMemberPermissionsPermission = "update_acls"
	RoleNewParamsMemberPermissionsPermissionDeleteACLs RoleNewParamsMemberPermissionsPermission = "delete_acls"
)

func (RoleNewParamsMemberPermissionsPermission) IsKnown added in v0.3.0

type RoleNewParamsMemberPermissionsRestrictObjectType added in v0.3.0

type RoleNewParamsMemberPermissionsRestrictObjectType string

The object type that the ACL applies to

const (
	RoleNewParamsMemberPermissionsRestrictObjectTypeOrganization  RoleNewParamsMemberPermissionsRestrictObjectType = "organization"
	RoleNewParamsMemberPermissionsRestrictObjectTypeProject       RoleNewParamsMemberPermissionsRestrictObjectType = "project"
	RoleNewParamsMemberPermissionsRestrictObjectTypeExperiment    RoleNewParamsMemberPermissionsRestrictObjectType = "experiment"
	RoleNewParamsMemberPermissionsRestrictObjectTypeDataset       RoleNewParamsMemberPermissionsRestrictObjectType = "dataset"
	RoleNewParamsMemberPermissionsRestrictObjectTypePrompt        RoleNewParamsMemberPermissionsRestrictObjectType = "prompt"
	RoleNewParamsMemberPermissionsRestrictObjectTypePromptSession RoleNewParamsMemberPermissionsRestrictObjectType = "prompt_session"
	RoleNewParamsMemberPermissionsRestrictObjectTypeGroup         RoleNewParamsMemberPermissionsRestrictObjectType = "group"
	RoleNewParamsMemberPermissionsRestrictObjectTypeRole          RoleNewParamsMemberPermissionsRestrictObjectType = "role"
	RoleNewParamsMemberPermissionsRestrictObjectTypeOrgMember     RoleNewParamsMemberPermissionsRestrictObjectType = "org_member"
	RoleNewParamsMemberPermissionsRestrictObjectTypeProjectLog    RoleNewParamsMemberPermissionsRestrictObjectType = "project_log"
	RoleNewParamsMemberPermissionsRestrictObjectTypeOrgProject    RoleNewParamsMemberPermissionsRestrictObjectType = "org_project"
)

func (RoleNewParamsMemberPermissionsRestrictObjectType) IsKnown added in v0.3.0

type RoleReplaceParams added in v0.2.0

type RoleReplaceParams struct {
	// Name of the role
	Name param.Field[string] `json:"name,required"`
	// Textual description of the role
	Description param.Field[string] `json:"description"`
	// (permission, restrict_object_type) tuples which belong to this role
	MemberPermissions param.Field[[]RoleReplaceParamsMemberPermission] `json:"member_permissions"`
	// Ids of the roles this role inherits from
	//
	// An inheriting role has all the permissions contained in its member roles, as
	// well as all of their inherited permissions
	MemberRoles param.Field[[]string] `json:"member_roles" format:"uuid"`
	// For nearly all users, this parameter should be unnecessary. But in the rare case
	// that your API key belongs to multiple organizations, you may specify the name of
	// the organization the role belongs in.
	OrgName param.Field[string] `json:"org_name"`
}

func (RoleReplaceParams) MarshalJSON added in v0.2.0

func (r RoleReplaceParams) MarshalJSON() (data []byte, err error)

type RoleReplaceParamsMemberPermission added in v0.3.0

type RoleReplaceParamsMemberPermission struct {
	// Each permission permits a certain type of operation on an object in the system
	//
	// Permissions can be assigned to to objects on an individual basis, or grouped
	// into roles
	Permission param.Field[RoleReplaceParamsMemberPermissionsPermission] `json:"permission,required"`
	// The object type that the ACL applies to
	RestrictObjectType param.Field[RoleReplaceParamsMemberPermissionsRestrictObjectType] `json:"restrict_object_type"`
}

func (RoleReplaceParamsMemberPermission) MarshalJSON added in v0.3.0

func (r RoleReplaceParamsMemberPermission) MarshalJSON() (data []byte, err error)

type RoleReplaceParamsMemberPermissionsPermission added in v0.3.0

type RoleReplaceParamsMemberPermissionsPermission string

Each permission permits a certain type of operation on an object in the system

Permissions can be assigned to to objects on an individual basis, or grouped into roles

const (
	RoleReplaceParamsMemberPermissionsPermissionCreate     RoleReplaceParamsMemberPermissionsPermission = "create"
	RoleReplaceParamsMemberPermissionsPermissionRead       RoleReplaceParamsMemberPermissionsPermission = "read"
	RoleReplaceParamsMemberPermissionsPermissionUpdate     RoleReplaceParamsMemberPermissionsPermission = "update"
	RoleReplaceParamsMemberPermissionsPermissionDelete     RoleReplaceParamsMemberPermissionsPermission = "delete"
	RoleReplaceParamsMemberPermissionsPermissionCreateACLs RoleReplaceParamsMemberPermissionsPermission = "create_acls"
	RoleReplaceParamsMemberPermissionsPermissionReadACLs   RoleReplaceParamsMemberPermissionsPermission = "read_acls"
	RoleReplaceParamsMemberPermissionsPermissionUpdateACLs RoleReplaceParamsMemberPermissionsPermission = "update_acls"
	RoleReplaceParamsMemberPermissionsPermissionDeleteACLs RoleReplaceParamsMemberPermissionsPermission = "delete_acls"
)

func (RoleReplaceParamsMemberPermissionsPermission) IsKnown added in v0.3.0

type RoleReplaceParamsMemberPermissionsRestrictObjectType added in v0.3.0

type RoleReplaceParamsMemberPermissionsRestrictObjectType string

The object type that the ACL applies to

const (
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeOrganization  RoleReplaceParamsMemberPermissionsRestrictObjectType = "organization"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeProject       RoleReplaceParamsMemberPermissionsRestrictObjectType = "project"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeExperiment    RoleReplaceParamsMemberPermissionsRestrictObjectType = "experiment"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeDataset       RoleReplaceParamsMemberPermissionsRestrictObjectType = "dataset"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypePrompt        RoleReplaceParamsMemberPermissionsRestrictObjectType = "prompt"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypePromptSession RoleReplaceParamsMemberPermissionsRestrictObjectType = "prompt_session"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeGroup         RoleReplaceParamsMemberPermissionsRestrictObjectType = "group"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeRole          RoleReplaceParamsMemberPermissionsRestrictObjectType = "role"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeOrgMember     RoleReplaceParamsMemberPermissionsRestrictObjectType = "org_member"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeProjectLog    RoleReplaceParamsMemberPermissionsRestrictObjectType = "project_log"
	RoleReplaceParamsMemberPermissionsRestrictObjectTypeOrgProject    RoleReplaceParamsMemberPermissionsRestrictObjectType = "org_project"
)

func (RoleReplaceParamsMemberPermissionsRestrictObjectType) IsKnown added in v0.3.0

type RoleService added in v0.2.0

type RoleService struct {
	Options []option.RequestOption
}

RoleService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRoleService method instead.

func NewRoleService added in v0.2.0

func NewRoleService(opts ...option.RequestOption) (r *RoleService)

NewRoleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RoleService) Delete added in v0.2.0

func (r *RoleService) Delete(ctx context.Context, roleID string, opts ...option.RequestOption) (res *shared.Role, err error)

Delete a role object by its id

func (*RoleService) Get added in v0.2.0

func (r *RoleService) Get(ctx context.Context, roleID string, opts ...option.RequestOption) (res *shared.Role, err error)

Get a role object by its id

func (*RoleService) List added in v0.2.0

List out all roles. The roles are sorted by creation date, with the most recently-created roles coming first

func (*RoleService) ListAutoPaging added in v0.2.0

List out all roles. The roles are sorted by creation date, with the most recently-created roles coming first

func (*RoleService) New added in v0.2.0

func (r *RoleService) New(ctx context.Context, body RoleNewParams, opts ...option.RequestOption) (res *shared.Role, err error)

Create a new role. If there is an existing role with the same name as the one specified in the request, will return the existing role unmodified

func (*RoleService) Replace added in v0.2.0

func (r *RoleService) Replace(ctx context.Context, body RoleReplaceParams, opts ...option.RequestOption) (res *shared.Role, err error)

Create or replace role. If there is an existing role with the same name as the one specified in the request, will replace the existing role with the provided fields

func (*RoleService) Update added in v0.2.0

func (r *RoleService) Update(ctx context.Context, roleID string, body RoleUpdateParams, opts ...option.RequestOption) (res *shared.Role, err error)

Partially update a role object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type RoleUpdateParams added in v0.2.0

type RoleUpdateParams struct {
	// A list of permissions to add to the role
	AddMemberPermissions param.Field[[]RoleUpdateParamsAddMemberPermission] `json:"add_member_permissions"`
	// A list of role IDs to add to the role's inheriting-from set
	AddMemberRoles param.Field[[]string] `json:"add_member_roles" format:"uuid"`
	// Textual description of the role
	Description param.Field[string] `json:"description"`
	// Name of the role
	Name param.Field[string] `json:"name"`
	// A list of permissions to remove from the role
	RemoveMemberPermissions param.Field[[]RoleUpdateParamsRemoveMemberPermission] `json:"remove_member_permissions"`
	// A list of role IDs to remove from the role's inheriting-from set
	RemoveMemberRoles param.Field[[]string] `json:"remove_member_roles" format:"uuid"`
}

func (RoleUpdateParams) MarshalJSON added in v0.2.0

func (r RoleUpdateParams) MarshalJSON() (data []byte, err error)

type RoleUpdateParamsAddMemberPermission added in v0.3.0

type RoleUpdateParamsAddMemberPermission struct {
	// Each permission permits a certain type of operation on an object in the system
	//
	// Permissions can be assigned to to objects on an individual basis, or grouped
	// into roles
	Permission param.Field[RoleUpdateParamsAddMemberPermissionsPermission] `json:"permission,required"`
	// The object type that the ACL applies to
	RestrictObjectType param.Field[RoleUpdateParamsAddMemberPermissionsRestrictObjectType] `json:"restrict_object_type"`
}

func (RoleUpdateParamsAddMemberPermission) MarshalJSON added in v0.3.0

func (r RoleUpdateParamsAddMemberPermission) MarshalJSON() (data []byte, err error)

type RoleUpdateParamsAddMemberPermissionsPermission added in v0.3.0

type RoleUpdateParamsAddMemberPermissionsPermission string

Each permission permits a certain type of operation on an object in the system

Permissions can be assigned to to objects on an individual basis, or grouped into roles

const (
	RoleUpdateParamsAddMemberPermissionsPermissionCreate     RoleUpdateParamsAddMemberPermissionsPermission = "create"
	RoleUpdateParamsAddMemberPermissionsPermissionRead       RoleUpdateParamsAddMemberPermissionsPermission = "read"
	RoleUpdateParamsAddMemberPermissionsPermissionUpdate     RoleUpdateParamsAddMemberPermissionsPermission = "update"
	RoleUpdateParamsAddMemberPermissionsPermissionDelete     RoleUpdateParamsAddMemberPermissionsPermission = "delete"
	RoleUpdateParamsAddMemberPermissionsPermissionCreateACLs RoleUpdateParamsAddMemberPermissionsPermission = "create_acls"
	RoleUpdateParamsAddMemberPermissionsPermissionReadACLs   RoleUpdateParamsAddMemberPermissionsPermission = "read_acls"
	RoleUpdateParamsAddMemberPermissionsPermissionUpdateACLs RoleUpdateParamsAddMemberPermissionsPermission = "update_acls"
	RoleUpdateParamsAddMemberPermissionsPermissionDeleteACLs RoleUpdateParamsAddMemberPermissionsPermission = "delete_acls"
)

func (RoleUpdateParamsAddMemberPermissionsPermission) IsKnown added in v0.3.0

type RoleUpdateParamsAddMemberPermissionsRestrictObjectType added in v0.3.0

type RoleUpdateParamsAddMemberPermissionsRestrictObjectType string

The object type that the ACL applies to

const (
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeOrganization  RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "organization"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeProject       RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "project"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeExperiment    RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "experiment"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeDataset       RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "dataset"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypePrompt        RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "prompt"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypePromptSession RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "prompt_session"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeGroup         RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "group"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeRole          RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "role"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeOrgMember     RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "org_member"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeProjectLog    RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "project_log"
	RoleUpdateParamsAddMemberPermissionsRestrictObjectTypeOrgProject    RoleUpdateParamsAddMemberPermissionsRestrictObjectType = "org_project"
)

func (RoleUpdateParamsAddMemberPermissionsRestrictObjectType) IsKnown added in v0.3.0

type RoleUpdateParamsRemoveMemberPermission added in v0.3.0

type RoleUpdateParamsRemoveMemberPermission struct {
	// Each permission permits a certain type of operation on an object in the system
	//
	// Permissions can be assigned to to objects on an individual basis, or grouped
	// into roles
	Permission param.Field[RoleUpdateParamsRemoveMemberPermissionsPermission] `json:"permission,required"`
	// The object type that the ACL applies to
	RestrictObjectType param.Field[RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType] `json:"restrict_object_type"`
}

func (RoleUpdateParamsRemoveMemberPermission) MarshalJSON added in v0.3.0

func (r RoleUpdateParamsRemoveMemberPermission) MarshalJSON() (data []byte, err error)

type RoleUpdateParamsRemoveMemberPermissionsPermission added in v0.3.0

type RoleUpdateParamsRemoveMemberPermissionsPermission string

Each permission permits a certain type of operation on an object in the system

Permissions can be assigned to to objects on an individual basis, or grouped into roles

const (
	RoleUpdateParamsRemoveMemberPermissionsPermissionCreate     RoleUpdateParamsRemoveMemberPermissionsPermission = "create"
	RoleUpdateParamsRemoveMemberPermissionsPermissionRead       RoleUpdateParamsRemoveMemberPermissionsPermission = "read"
	RoleUpdateParamsRemoveMemberPermissionsPermissionUpdate     RoleUpdateParamsRemoveMemberPermissionsPermission = "update"
	RoleUpdateParamsRemoveMemberPermissionsPermissionDelete     RoleUpdateParamsRemoveMemberPermissionsPermission = "delete"
	RoleUpdateParamsRemoveMemberPermissionsPermissionCreateACLs RoleUpdateParamsRemoveMemberPermissionsPermission = "create_acls"
	RoleUpdateParamsRemoveMemberPermissionsPermissionReadACLs   RoleUpdateParamsRemoveMemberPermissionsPermission = "read_acls"
	RoleUpdateParamsRemoveMemberPermissionsPermissionUpdateACLs RoleUpdateParamsRemoveMemberPermissionsPermission = "update_acls"
	RoleUpdateParamsRemoveMemberPermissionsPermissionDeleteACLs RoleUpdateParamsRemoveMemberPermissionsPermission = "delete_acls"
)

func (RoleUpdateParamsRemoveMemberPermissionsPermission) IsKnown added in v0.3.0

type RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType added in v0.3.0

type RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType string

The object type that the ACL applies to

const (
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeOrganization  RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "organization"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeProject       RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "project"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeExperiment    RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "experiment"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeDataset       RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "dataset"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypePrompt        RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "prompt"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypePromptSession RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "prompt_session"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeGroup         RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "group"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeRole          RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "role"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeOrgMember     RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "org_member"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeProjectLog    RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "project_log"
	RoleUpdateParamsRemoveMemberPermissionsRestrictObjectTypeOrgProject    RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType = "org_project"
)

func (RoleUpdateParamsRemoveMemberPermissionsRestrictObjectType) IsKnown added in v0.3.0

type ScoreSummary added in v0.2.0

type ScoreSummary = shared.ScoreSummary

Summary of a score's performance

This is an alias to an internal type.

type SummarizeDatasetResponse added in v0.2.0

type SummarizeDatasetResponse = shared.SummarizeDatasetResponse

Summary of a dataset

This is an alias to an internal type.

type SummarizeExperimentResponse added in v0.2.0

type SummarizeExperimentResponse = shared.SummarizeExperimentResponse

Summary of an experiment

This is an alias to an internal type.

type TopLevelService

type TopLevelService struct {
	Options []option.RequestOption
}

TopLevelService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTopLevelService method instead.

func NewTopLevelService

func NewTopLevelService(opts ...option.RequestOption) (r *TopLevelService)

NewTopLevelService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TopLevelService) HelloWorld

func (r *TopLevelService) HelloWorld(ctx context.Context, opts ...option.RequestOption) (res *string, err error)

Default endpoint. Simply replies with 'Hello, World!'. Authorization is not required

type User added in v0.2.0

type User = shared.User

This is an alias to an internal type.

type UserListParams added in v0.2.0

type UserListParams struct {
	// Email of the user to search for. You may pass the param multiple times to filter
	// for more than one email
	Email param.Field[UserListParamsEmailUnion] `query:"email"`
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Family name of the user to search for. You may pass the param multiple times to
	// filter for more than one family name
	FamilyName param.Field[UserListParamsFamilyNameUnion] `query:"family_name"`
	// Given name of the user to search for. You may pass the param multiple times to
	// filter for more than one given name
	GivenName param.Field[UserListParamsGivenNameUnion] `query:"given_name"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[UserListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Filter search results to within a particular organization
	OrgName param.Field[string] `query:"org_name"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
}

func (UserListParams) URLQuery added in v0.2.0

func (r UserListParams) URLQuery() (v url.Values)

URLQuery serializes UserListParams's query parameters as `url.Values`.

type UserListParamsEmailArray added in v0.2.0

type UserListParamsEmailArray []string

func (UserListParamsEmailArray) ImplementsUserListParamsEmailUnion added in v0.2.0

func (r UserListParamsEmailArray) ImplementsUserListParamsEmailUnion()

type UserListParamsEmailUnion added in v0.2.0

type UserListParamsEmailUnion interface {
	ImplementsUserListParamsEmailUnion()
}

Email of the user to search for. You may pass the param multiple times to filter for more than one email

Satisfied by shared.UnionString, UserListParamsEmailArray.

type UserListParamsFamilyNameArray added in v0.2.0

type UserListParamsFamilyNameArray []string

func (UserListParamsFamilyNameArray) ImplementsUserListParamsFamilyNameUnion added in v0.2.0

func (r UserListParamsFamilyNameArray) ImplementsUserListParamsFamilyNameUnion()

type UserListParamsFamilyNameUnion added in v0.2.0

type UserListParamsFamilyNameUnion interface {
	ImplementsUserListParamsFamilyNameUnion()
}

Family name of the user to search for. You may pass the param multiple times to filter for more than one family name

Satisfied by shared.UnionString, UserListParamsFamilyNameArray.

type UserListParamsGivenNameArray added in v0.2.0

type UserListParamsGivenNameArray []string

func (UserListParamsGivenNameArray) ImplementsUserListParamsGivenNameUnion added in v0.2.0

func (r UserListParamsGivenNameArray) ImplementsUserListParamsGivenNameUnion()

type UserListParamsGivenNameUnion added in v0.2.0

type UserListParamsGivenNameUnion interface {
	ImplementsUserListParamsGivenNameUnion()
}

Given name of the user to search for. You may pass the param multiple times to filter for more than one given name

Satisfied by shared.UnionString, UserListParamsGivenNameArray.

type UserListParamsIDsArray added in v0.2.0

type UserListParamsIDsArray []string

func (UserListParamsIDsArray) ImplementsUserListParamsIDsUnion added in v0.2.0

func (r UserListParamsIDsArray) ImplementsUserListParamsIDsUnion()

type UserListParamsIDsUnion added in v0.2.0

type UserListParamsIDsUnion interface {
	ImplementsUserListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, UserListParamsIDsArray.

type UserService added in v0.2.0

type UserService struct {
	Options []option.RequestOption
}

UserService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUserService method instead.

func NewUserService added in v0.2.0

func NewUserService(opts ...option.RequestOption) (r *UserService)

NewUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*UserService) Get added in v0.2.0

func (r *UserService) Get(ctx context.Context, userID string, opts ...option.RequestOption) (res *shared.User, err error)

Get a user object by its id

func (*UserService) List added in v0.2.0

List out all users. The users are sorted by creation date, with the most recently-created users coming first

func (*UserService) ListAutoPaging added in v0.2.0

List out all users. The users are sorted by creation date, with the most recently-created users coming first

type View added in v0.2.0

type View = shared.View

This is an alias to an internal type.

type ViewData added in v0.2.0

type ViewData = shared.ViewData

The view definition

This is an alias to an internal type.

type ViewDataParam added in v0.2.0

type ViewDataParam = shared.ViewDataParam

The view definition

This is an alias to an internal type.

type ViewDataSearch added in v0.2.0

type ViewDataSearch = shared.ViewDataSearch

This is an alias to an internal type.

type ViewDataSearchParam added in v0.2.0

type ViewDataSearchParam = shared.ViewDataSearchParam

This is an alias to an internal type.

type ViewDeleteParams added in v0.2.0

type ViewDeleteParams struct {
	// The id of the object the view applies to
	ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ViewDeleteParamsObjectType] `json:"object_type,required"`
}

func (ViewDeleteParams) MarshalJSON added in v0.2.0

func (r ViewDeleteParams) MarshalJSON() (data []byte, err error)

type ViewDeleteParamsObjectType added in v0.3.0

type ViewDeleteParamsObjectType string

The object type that the ACL applies to

const (
	ViewDeleteParamsObjectTypeOrganization  ViewDeleteParamsObjectType = "organization"
	ViewDeleteParamsObjectTypeProject       ViewDeleteParamsObjectType = "project"
	ViewDeleteParamsObjectTypeExperiment    ViewDeleteParamsObjectType = "experiment"
	ViewDeleteParamsObjectTypeDataset       ViewDeleteParamsObjectType = "dataset"
	ViewDeleteParamsObjectTypePrompt        ViewDeleteParamsObjectType = "prompt"
	ViewDeleteParamsObjectTypePromptSession ViewDeleteParamsObjectType = "prompt_session"
	ViewDeleteParamsObjectTypeGroup         ViewDeleteParamsObjectType = "group"
	ViewDeleteParamsObjectTypeRole          ViewDeleteParamsObjectType = "role"
	ViewDeleteParamsObjectTypeOrgMember     ViewDeleteParamsObjectType = "org_member"
	ViewDeleteParamsObjectTypeProjectLog    ViewDeleteParamsObjectType = "project_log"
	ViewDeleteParamsObjectTypeOrgProject    ViewDeleteParamsObjectType = "org_project"
)

func (ViewDeleteParamsObjectType) IsKnown added in v0.3.0

func (r ViewDeleteParamsObjectType) IsKnown() bool

type ViewGetParams added in v0.2.0

type ViewGetParams struct {
	// The id of the object the ACL applies to
	ObjectID param.Field[string] `query:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ViewGetParamsObjectType] `query:"object_type,required"`
}

func (ViewGetParams) URLQuery added in v0.2.0

func (r ViewGetParams) URLQuery() (v url.Values)

URLQuery serializes ViewGetParams's query parameters as `url.Values`.

type ViewGetParamsObjectType added in v0.2.0

type ViewGetParamsObjectType string

The object type that the ACL applies to

const (
	ViewGetParamsObjectTypeOrganization  ViewGetParamsObjectType = "organization"
	ViewGetParamsObjectTypeProject       ViewGetParamsObjectType = "project"
	ViewGetParamsObjectTypeExperiment    ViewGetParamsObjectType = "experiment"
	ViewGetParamsObjectTypeDataset       ViewGetParamsObjectType = "dataset"
	ViewGetParamsObjectTypePrompt        ViewGetParamsObjectType = "prompt"
	ViewGetParamsObjectTypePromptSession ViewGetParamsObjectType = "prompt_session"
	ViewGetParamsObjectTypeGroup         ViewGetParamsObjectType = "group"
	ViewGetParamsObjectTypeRole          ViewGetParamsObjectType = "role"
	ViewGetParamsObjectTypeOrgMember     ViewGetParamsObjectType = "org_member"
	ViewGetParamsObjectTypeProjectLog    ViewGetParamsObjectType = "project_log"
	ViewGetParamsObjectTypeOrgProject    ViewGetParamsObjectType = "org_project"
)

func (ViewGetParamsObjectType) IsKnown added in v0.2.0

func (r ViewGetParamsObjectType) IsKnown() bool

type ViewListParams added in v0.2.0

type ViewListParams struct {
	// The id of the object the ACL applies to
	ObjectID param.Field[string] `query:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ViewListParamsObjectType] `query:"object_type,required"`
	// Pagination cursor id.
	//
	// For example, if the initial item in the last page you fetched had an id of
	// `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only
	// pass one of `starting_after` and `ending_before`
	EndingBefore param.Field[string] `query:"ending_before" format:"uuid"`
	// Filter search results to a particular set of object IDs. To specify a list of
	// IDs, include the query param multiple times
	IDs param.Field[ViewListParamsIDsUnion] `query:"ids" format:"uuid"`
	// Limit the number of objects to return
	Limit param.Field[int64] `query:"limit"`
	// Pagination cursor id.
	//
	// For example, if the final item in the last page you fetched had an id of `foo`,
	// pass `starting_after=foo` to fetch the next page. Note: you may only pass one of
	// `starting_after` and `ending_before`
	StartingAfter param.Field[string] `query:"starting_after" format:"uuid"`
	// Name of the view to search for
	ViewName param.Field[string] `query:"view_name"`
	// Type of table that the view corresponds to.
	ViewType param.Field[ViewListParamsViewType] `query:"view_type"`
}

func (ViewListParams) URLQuery added in v0.2.0

func (r ViewListParams) URLQuery() (v url.Values)

URLQuery serializes ViewListParams's query parameters as `url.Values`.

type ViewListParamsIDsArray added in v0.2.0

type ViewListParamsIDsArray []string

func (ViewListParamsIDsArray) ImplementsViewListParamsIDsUnion added in v0.2.0

func (r ViewListParamsIDsArray) ImplementsViewListParamsIDsUnion()

type ViewListParamsIDsUnion added in v0.2.0

type ViewListParamsIDsUnion interface {
	ImplementsViewListParamsIDsUnion()
}

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Satisfied by shared.UnionString, ViewListParamsIDsArray.

type ViewListParamsObjectType added in v0.2.0

type ViewListParamsObjectType string

The object type that the ACL applies to

const (
	ViewListParamsObjectTypeOrganization  ViewListParamsObjectType = "organization"
	ViewListParamsObjectTypeProject       ViewListParamsObjectType = "project"
	ViewListParamsObjectTypeExperiment    ViewListParamsObjectType = "experiment"
	ViewListParamsObjectTypeDataset       ViewListParamsObjectType = "dataset"
	ViewListParamsObjectTypePrompt        ViewListParamsObjectType = "prompt"
	ViewListParamsObjectTypePromptSession ViewListParamsObjectType = "prompt_session"
	ViewListParamsObjectTypeGroup         ViewListParamsObjectType = "group"
	ViewListParamsObjectTypeRole          ViewListParamsObjectType = "role"
	ViewListParamsObjectTypeOrgMember     ViewListParamsObjectType = "org_member"
	ViewListParamsObjectTypeProjectLog    ViewListParamsObjectType = "project_log"
	ViewListParamsObjectTypeOrgProject    ViewListParamsObjectType = "org_project"
)

func (ViewListParamsObjectType) IsKnown added in v0.2.0

func (r ViewListParamsObjectType) IsKnown() bool

type ViewListParamsViewType added in v0.2.0

type ViewListParamsViewType string

Type of table that the view corresponds to.

const (
	ViewListParamsViewTypeProjects    ViewListParamsViewType = "projects"
	ViewListParamsViewTypeLogs        ViewListParamsViewType = "logs"
	ViewListParamsViewTypeExperiments ViewListParamsViewType = "experiments"
	ViewListParamsViewTypeDatasets    ViewListParamsViewType = "datasets"
	ViewListParamsViewTypePrompts     ViewListParamsViewType = "prompts"
	ViewListParamsViewTypePlaygrounds ViewListParamsViewType = "playgrounds"
	ViewListParamsViewTypeExperiment  ViewListParamsViewType = "experiment"
	ViewListParamsViewTypeDataset     ViewListParamsViewType = "dataset"
)

func (ViewListParamsViewType) IsKnown added in v0.2.0

func (r ViewListParamsViewType) IsKnown() bool

type ViewNewParams added in v0.2.0

type ViewNewParams struct {
	// Name of the view
	Name param.Field[string] `json:"name,required"`
	// The id of the object the view applies to
	ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ViewNewParamsObjectType] `json:"object_type,required"`
	// Type of table that the view corresponds to.
	ViewType param.Field[ViewNewParamsViewType] `json:"view_type,required"`
	// Date of role deletion, or null if the role is still active
	DeletedAt param.Field[time.Time] `json:"deleted_at" format:"date-time"`
	// Options for the view in the app
	Options param.Field[shared.ViewOptionsParam] `json:"options"`
	// Identifies the user who created the view
	UserID param.Field[string] `json:"user_id" format:"uuid"`
	// The view definition
	ViewData param.Field[shared.ViewDataParam] `json:"view_data"`
}

func (ViewNewParams) MarshalJSON added in v0.2.0

func (r ViewNewParams) MarshalJSON() (data []byte, err error)

type ViewNewParamsObjectType added in v0.3.0

type ViewNewParamsObjectType string

The object type that the ACL applies to

const (
	ViewNewParamsObjectTypeOrganization  ViewNewParamsObjectType = "organization"
	ViewNewParamsObjectTypeProject       ViewNewParamsObjectType = "project"
	ViewNewParamsObjectTypeExperiment    ViewNewParamsObjectType = "experiment"
	ViewNewParamsObjectTypeDataset       ViewNewParamsObjectType = "dataset"
	ViewNewParamsObjectTypePrompt        ViewNewParamsObjectType = "prompt"
	ViewNewParamsObjectTypePromptSession ViewNewParamsObjectType = "prompt_session"
	ViewNewParamsObjectTypeGroup         ViewNewParamsObjectType = "group"
	ViewNewParamsObjectTypeRole          ViewNewParamsObjectType = "role"
	ViewNewParamsObjectTypeOrgMember     ViewNewParamsObjectType = "org_member"
	ViewNewParamsObjectTypeProjectLog    ViewNewParamsObjectType = "project_log"
	ViewNewParamsObjectTypeOrgProject    ViewNewParamsObjectType = "org_project"
)

func (ViewNewParamsObjectType) IsKnown added in v0.3.0

func (r ViewNewParamsObjectType) IsKnown() bool

type ViewNewParamsViewType added in v0.3.0

type ViewNewParamsViewType string

Type of table that the view corresponds to.

const (
	ViewNewParamsViewTypeProjects    ViewNewParamsViewType = "projects"
	ViewNewParamsViewTypeLogs        ViewNewParamsViewType = "logs"
	ViewNewParamsViewTypeExperiments ViewNewParamsViewType = "experiments"
	ViewNewParamsViewTypeDatasets    ViewNewParamsViewType = "datasets"
	ViewNewParamsViewTypePrompts     ViewNewParamsViewType = "prompts"
	ViewNewParamsViewTypePlaygrounds ViewNewParamsViewType = "playgrounds"
	ViewNewParamsViewTypeExperiment  ViewNewParamsViewType = "experiment"
	ViewNewParamsViewTypeDataset     ViewNewParamsViewType = "dataset"
)

func (ViewNewParamsViewType) IsKnown added in v0.3.0

func (r ViewNewParamsViewType) IsKnown() bool

type ViewObjectType added in v0.2.0

type ViewObjectType = shared.ViewObjectType

The object type that the ACL applies to

This is an alias to an internal type.

type ViewOptions added in v0.2.0

type ViewOptions = shared.ViewOptions

Options for the view in the app

This is an alias to an internal type.

type ViewOptionsParam added in v0.2.0

type ViewOptionsParam = shared.ViewOptionsParam

Options for the view in the app

This is an alias to an internal type.

type ViewReplaceParams added in v0.2.0

type ViewReplaceParams struct {
	// Name of the view
	Name param.Field[string] `json:"name,required"`
	// The id of the object the view applies to
	ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ViewReplaceParamsObjectType] `json:"object_type,required"`
	// Type of table that the view corresponds to.
	ViewType param.Field[ViewReplaceParamsViewType] `json:"view_type,required"`
	// Date of role deletion, or null if the role is still active
	DeletedAt param.Field[time.Time] `json:"deleted_at" format:"date-time"`
	// Options for the view in the app
	Options param.Field[shared.ViewOptionsParam] `json:"options"`
	// Identifies the user who created the view
	UserID param.Field[string] `json:"user_id" format:"uuid"`
	// The view definition
	ViewData param.Field[shared.ViewDataParam] `json:"view_data"`
}

func (ViewReplaceParams) MarshalJSON added in v0.2.0

func (r ViewReplaceParams) MarshalJSON() (data []byte, err error)

type ViewReplaceParamsObjectType added in v0.3.0

type ViewReplaceParamsObjectType string

The object type that the ACL applies to

const (
	ViewReplaceParamsObjectTypeOrganization  ViewReplaceParamsObjectType = "organization"
	ViewReplaceParamsObjectTypeProject       ViewReplaceParamsObjectType = "project"
	ViewReplaceParamsObjectTypeExperiment    ViewReplaceParamsObjectType = "experiment"
	ViewReplaceParamsObjectTypeDataset       ViewReplaceParamsObjectType = "dataset"
	ViewReplaceParamsObjectTypePrompt        ViewReplaceParamsObjectType = "prompt"
	ViewReplaceParamsObjectTypePromptSession ViewReplaceParamsObjectType = "prompt_session"
	ViewReplaceParamsObjectTypeGroup         ViewReplaceParamsObjectType = "group"
	ViewReplaceParamsObjectTypeRole          ViewReplaceParamsObjectType = "role"
	ViewReplaceParamsObjectTypeOrgMember     ViewReplaceParamsObjectType = "org_member"
	ViewReplaceParamsObjectTypeProjectLog    ViewReplaceParamsObjectType = "project_log"
	ViewReplaceParamsObjectTypeOrgProject    ViewReplaceParamsObjectType = "org_project"
)

func (ViewReplaceParamsObjectType) IsKnown added in v0.3.0

func (r ViewReplaceParamsObjectType) IsKnown() bool

type ViewReplaceParamsViewType added in v0.3.0

type ViewReplaceParamsViewType string

Type of table that the view corresponds to.

const (
	ViewReplaceParamsViewTypeProjects    ViewReplaceParamsViewType = "projects"
	ViewReplaceParamsViewTypeLogs        ViewReplaceParamsViewType = "logs"
	ViewReplaceParamsViewTypeExperiments ViewReplaceParamsViewType = "experiments"
	ViewReplaceParamsViewTypeDatasets    ViewReplaceParamsViewType = "datasets"
	ViewReplaceParamsViewTypePrompts     ViewReplaceParamsViewType = "prompts"
	ViewReplaceParamsViewTypePlaygrounds ViewReplaceParamsViewType = "playgrounds"
	ViewReplaceParamsViewTypeExperiment  ViewReplaceParamsViewType = "experiment"
	ViewReplaceParamsViewTypeDataset     ViewReplaceParamsViewType = "dataset"
)

func (ViewReplaceParamsViewType) IsKnown added in v0.3.0

func (r ViewReplaceParamsViewType) IsKnown() bool

type ViewService added in v0.2.0

type ViewService struct {
	Options []option.RequestOption
}

ViewService contains methods and other services that help with interacting with the braintrust API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewViewService method instead.

func NewViewService added in v0.2.0

func NewViewService(opts ...option.RequestOption) (r *ViewService)

NewViewService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ViewService) Delete added in v0.2.0

func (r *ViewService) Delete(ctx context.Context, viewID string, body ViewDeleteParams, opts ...option.RequestOption) (res *shared.View, err error)

Delete a view object by its id

func (*ViewService) Get added in v0.2.0

func (r *ViewService) Get(ctx context.Context, viewID string, query ViewGetParams, opts ...option.RequestOption) (res *shared.View, err error)

Get a view object by its id

func (*ViewService) List added in v0.2.0

List out all views. The views are sorted by creation date, with the most recently-created views coming first

func (*ViewService) ListAutoPaging added in v0.2.0

List out all views. The views are sorted by creation date, with the most recently-created views coming first

func (*ViewService) New added in v0.2.0

func (r *ViewService) New(ctx context.Context, body ViewNewParams, opts ...option.RequestOption) (res *shared.View, err error)

Create a new view. If there is an existing view with the same name as the one specified in the request, will return the existing view unmodified

func (*ViewService) Replace added in v0.2.0

func (r *ViewService) Replace(ctx context.Context, body ViewReplaceParams, opts ...option.RequestOption) (res *shared.View, err error)

Create or replace view. If there is an existing view with the same name as the one specified in the request, will replace the existing view with the provided fields

func (*ViewService) Update added in v0.2.0

func (r *ViewService) Update(ctx context.Context, viewID string, body ViewUpdateParams, opts ...option.RequestOption) (res *shared.View, err error)

Partially update a view object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.

type ViewUpdateParams added in v0.2.0

type ViewUpdateParams struct {
	// The id of the object the view applies to
	ObjectID param.Field[string] `json:"object_id,required" format:"uuid"`
	// The object type that the ACL applies to
	ObjectType param.Field[ViewUpdateParamsObjectType] `json:"object_type,required"`
	// Name of the view
	Name param.Field[string] `json:"name"`
	// Options for the view in the app
	Options param.Field[shared.ViewOptionsParam] `json:"options"`
	// Identifies the user who created the view
	UserID param.Field[string] `json:"user_id" format:"uuid"`
	// The view definition
	ViewData param.Field[shared.ViewDataParam] `json:"view_data"`
	// Type of table that the view corresponds to.
	ViewType param.Field[ViewUpdateParamsViewType] `json:"view_type"`
}

func (ViewUpdateParams) MarshalJSON added in v0.2.0

func (r ViewUpdateParams) MarshalJSON() (data []byte, err error)

type ViewUpdateParamsObjectType added in v0.3.0

type ViewUpdateParamsObjectType string

The object type that the ACL applies to

const (
	ViewUpdateParamsObjectTypeOrganization  ViewUpdateParamsObjectType = "organization"
	ViewUpdateParamsObjectTypeProject       ViewUpdateParamsObjectType = "project"
	ViewUpdateParamsObjectTypeExperiment    ViewUpdateParamsObjectType = "experiment"
	ViewUpdateParamsObjectTypeDataset       ViewUpdateParamsObjectType = "dataset"
	ViewUpdateParamsObjectTypePrompt        ViewUpdateParamsObjectType = "prompt"
	ViewUpdateParamsObjectTypePromptSession ViewUpdateParamsObjectType = "prompt_session"
	ViewUpdateParamsObjectTypeGroup         ViewUpdateParamsObjectType = "group"
	ViewUpdateParamsObjectTypeRole          ViewUpdateParamsObjectType = "role"
	ViewUpdateParamsObjectTypeOrgMember     ViewUpdateParamsObjectType = "org_member"
	ViewUpdateParamsObjectTypeProjectLog    ViewUpdateParamsObjectType = "project_log"
	ViewUpdateParamsObjectTypeOrgProject    ViewUpdateParamsObjectType = "org_project"
)

func (ViewUpdateParamsObjectType) IsKnown added in v0.3.0

func (r ViewUpdateParamsObjectType) IsKnown() bool

type ViewUpdateParamsViewType added in v0.3.0

type ViewUpdateParamsViewType string

Type of table that the view corresponds to.

const (
	ViewUpdateParamsViewTypeProjects    ViewUpdateParamsViewType = "projects"
	ViewUpdateParamsViewTypeLogs        ViewUpdateParamsViewType = "logs"
	ViewUpdateParamsViewTypeExperiments ViewUpdateParamsViewType = "experiments"
	ViewUpdateParamsViewTypeDatasets    ViewUpdateParamsViewType = "datasets"
	ViewUpdateParamsViewTypePrompts     ViewUpdateParamsViewType = "prompts"
	ViewUpdateParamsViewTypePlaygrounds ViewUpdateParamsViewType = "playgrounds"
	ViewUpdateParamsViewTypeExperiment  ViewUpdateParamsViewType = "experiment"
	ViewUpdateParamsViewTypeDataset     ViewUpdateParamsViewType = "dataset"
)

func (ViewUpdateParamsViewType) IsKnown added in v0.3.0

func (r ViewUpdateParamsViewType) IsKnown() bool

type ViewViewType added in v0.2.0

type ViewViewType = shared.ViewViewType

Type of table that the view corresponds to.

This is an alias to an internal type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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