prompts

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 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 prompts provides read access to the prompts stored in Braintrust.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API provides methods for reading prompts.

func New

func New(client *https.Client) *API

New creates a new prompts API client.

func (*API) Get

func (a *API) Get(ctx context.Context, id string, params QueryParams) (*Prompt, error)

Get returns a single prompt by ID. Version and Environment are optional; a pinned version wins over an environment.

func (*API) Query

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

Query searches for prompts matching params.

type Prompt

type Prompt struct {
	ID          string          `json:"id"`
	ProjectID   string          `json:"project_id"`
	XactID      string          `json:"_xact_id"`
	Name        string          `json:"name"`
	Slug        string          `json:"slug"`
	Description string          `json:"description,omitempty"`
	PromptData  json.RawMessage `json:"prompt_data"`
	Tags        []string        `json:"tags,omitempty"`
}

Prompt is a prompt row as Braintrust stores it.

PromptData is left as raw JSON so that this package stays pure transport: the prompt package decodes it into a renderable prompt. Keeping the dependency pointing that way means the prompt package can use this one.

type QueryParams

type QueryParams struct {
	// Project identity (either/or).
	ProjectName string
	ProjectID   string

	// Slug filters by prompt slug.
	Slug string

	// Version pins to a specific prompt version.
	Version string

	// Environment loads the prompt deployed to an environment (dev, staging,
	// production). Ignored when Version is set.
	Environment string

	// Limit caps the number of results.
	Limit int
}

QueryParams selects which prompts to return.

Jump to

Keyboard shortcuts

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