Interface BraintrustClient
-
- All Implemented Interfaces:
public interface BraintrustClientA client for interacting with the Braintrust REST API synchronously. You can also switch to asynchronous execution via the async method.
This client performs best when you create a single instance and reuse it for all interactions with the REST API. This is because each client holds its own connection pool and thread pools. Reusing connections and threads reduces latency and saves memory. The client also handles rate limiting per client. This means that creating and using multiple instances at the same time will not respect rate limits.
The threads and connections that are held will be released automatically if they remain idle. But if you are writing an application that needs to aggressively release unused resources, then you may call close.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBraintrustClient.WithRawResponseA view of BraintrustClient that provides access to raw HTTP responses for each method.
-
Method Summary
Modifier and Type Method Description abstract BraintrustClientAsyncasync()Returns a version of this client that uses asynchronous execution. abstract BraintrustClient.WithRawResponsewithRawResponse()Returns a view of this service that provides access to raw HTTP responses for each method. abstract TopLevelServicetopLevel()abstract ProjectServiceprojects()abstract ExperimentServiceexperiments()abstract DatasetServicedatasets()abstract PromptServiceprompts()abstract RoleServiceroles()abstract GroupServicegroups()abstract AclServiceacls()abstract UserServiceusers()abstract ProjectScoreServiceprojectScores()abstract ProjectTagServiceprojectTags()abstract SpanIframeServicespanIframes()abstract FunctionServicefunctions()abstract ViewServiceviews()abstract OrganizationServiceorganizations()abstract ApiKeyServiceapiKeys()abstract AiSecretServiceaiSecrets()abstract EnvVarServiceenvVars()abstract EvalServiceevals()abstract Unitclose()Closes this client, relinquishing any underlying resources. -
-
Method Detail
-
async
abstract BraintrustClientAsync async()
Returns a version of this client that uses asynchronous execution.
The returned client shares its resources, like its connection pool and thread pools, with this client.
-
withRawResponse
abstract BraintrustClient.WithRawResponse withRawResponse()
Returns a view of this service that provides access to raw HTTP responses for each method.
-
topLevel
abstract TopLevelService topLevel()
-
projects
abstract ProjectService projects()
-
experiments
abstract ExperimentService experiments()
-
datasets
abstract DatasetService datasets()
-
prompts
abstract PromptService prompts()
-
roles
abstract RoleService roles()
-
groups
abstract GroupService groups()
-
acls
abstract AclService acls()
-
users
abstract UserService users()
-
projectScores
abstract ProjectScoreService projectScores()
-
projectTags
abstract ProjectTagService projectTags()
-
spanIframes
abstract SpanIframeService spanIframes()
-
functions
abstract FunctionService functions()
-
views
abstract ViewService views()
-
organizations
abstract OrganizationService organizations()
-
apiKeys
abstract ApiKeyService apiKeys()
-
aiSecrets
abstract AiSecretService aiSecrets()
-
envVars
abstract EnvVarService envVars()
-
evals
abstract EvalService evals()
-
close
abstract Unit close()
Closes this client, relinquishing any underlying resources.
This is purposefully not inherited from AutoCloseable because the client is long-lived and usually should not be synchronously closed via try-with-resources.
It's also usually not necessary to call this method at all. the default HTTP client automatically releases threads and connections if they remain idle, but if you are writing an application that needs to aggressively release unused resources, then you may call this method.
-
-
-
-