functions

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package functions provides operations for managing Braintrust functions (prompts, tools, scorers).

New REST integrations should use github.com/braintrustdata/braintrust-sdk-go/openapi instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API deprecated

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

API provides methods for interacting with functions.

Deprecated: Use the openapi package's Client or ClientWithResponses.

func New deprecated

func New(client *https.Client) *API

New creates a new functions API client.

Deprecated: Use openapi.NewClientWithResponses.

func (*API) Create deprecated

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

Create creates a new function.

Deprecated: Use openapi.ClientWithResponses.PostFunctionWithResponse.

func (*API) Delete deprecated

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

Delete deletes a function by ID.

Deprecated: Use openapi.ClientWithResponses.DeleteFunctionIdWithResponse.

func (*API) Invoke deprecated

func (a *API) Invoke(ctx context.Context, functionID string, input any) (any, error)

Invoke calls a function with the given input and returns the output.

Deprecated: Use openapi.ClientWithResponses.PostFunctionIdInvokeWithResponse for direct REST calls. For SDK-managed task/scorer conversion and tracing, use the Functions API on braintrust.NewEvaluator instead.

func (*API) Query deprecated

func (a *API) Query(ctx context.Context, params QueryParams) ([]Function, error)

Query searches for functions matching the given options. Returns a list of functions that match the criteria.

Deprecated: Use openapi.ClientWithResponses.GetFunctionWithResponse.

type CreateParams

type CreateParams struct {
	ProjectID    string         `json:"project_id"`
	Name         string         `json:"name"`
	Slug         string         `json:"slug"`
	FunctionType string         `json:"function_type,omitempty"`
	FunctionData map[string]any `json:"function_data"`
	PromptData   map[string]any `json:"prompt_data,omitempty"`
	Description  string         `json:"description,omitempty"`
}

CreateParams represents the request payload for creating a function.

type Function

type Function struct {
	ID           string `json:"id"`
	ProjectID    string `json:"project_id"`
	Name         string `json:"name"`
	Slug         string `json:"slug"`
	FunctionType string `json:"function_type"`
	Description  string `json:"description,omitempty"`
}

Function represents a Braintrust function (prompt, tool, or scorer).

type InvokeParams

type InvokeParams struct {
	Input any `json:"input"`
}

InvokeParams represents the request payload for invoking a function.

type QueryParams

type QueryParams struct {
	// Project identity (either/or)
	ProjectName string // Filter by project name
	ProjectID   string // Filter by specific project ID

	// Function identity (either/or)
	Slug         string // Filter by function slug
	FunctionName string // Filter by function name

	// Query modifiers
	Version     string // Specific function version
	Environment string // Environment to load (dev/staging/production)
	Limit       int    // Max results (default: no limit)
}

QueryParams contains options for querying functions.

type QueryResponse

type QueryResponse struct {
	Objects []Function `json:"objects"`
}

QueryResponse represents the response from querying functions.

Jump to

Keyboard shortcuts

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