Documentation
¶
Overview ¶
Package functions provides operations for managing Braintrust functions (prompts, tools, scorers).
Index ¶
- type API
- func (a *API) Create(ctx context.Context, params CreateParams) (*Function, error)
- func (a *API) Delete(ctx context.Context, functionID string) error
- func (a *API) Invoke(ctx context.Context, functionID string, input any) (any, error)
- func (a *API) Query(ctx context.Context, params QueryParams) ([]Function, error)
- type CreateParams
- type Function
- type InvokeParams
- type QueryParams
- type QueryResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API provides methods for interacting with functions.
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.
Click to show internal directories.
Click to hide internal directories.