Class ExperimentEvent.Builder
-
- All Implemented Interfaces:
public final class ExperimentEvent.BuilderA builder for ExperimentEvent.
-
-
Method Summary
Modifier and Type Method Description final ExperimentEvent.Builderid(String id)A unique identifier for the experiment event. final ExperimentEvent.Builderid(JsonField<String> id)Sets Builder.id to an arbitrary JSON value. final ExperimentEvent.Builder_xactId(String _xactId)The transaction id of an event is unique to the network operation that processed the event insertion. final ExperimentEvent.Builder_xactId(JsonField<String> _xactId)Sets Builder._xactId to an arbitrary JSON value. final ExperimentEvent.Buildercreated(OffsetDateTime created)The timestamp the experiment event was created final ExperimentEvent.Buildercreated(JsonField<OffsetDateTime> created)Sets Builder.created to an arbitrary JSON value. final ExperimentEvent.BuilderexperimentId(String experimentId)Unique identifier for the experiment final ExperimentEvent.BuilderexperimentId(JsonField<String> experimentId)Sets Builder.experimentId to an arbitrary JSON value. final ExperimentEvent.BuilderprojectId(String projectId)Unique identifier for the project that the experiment belongs under final ExperimentEvent.BuilderprojectId(JsonField<String> projectId)Sets Builder.projectId to an arbitrary JSON value. final ExperimentEvent.BuilderrootSpanId(String rootSpanId)A unique identifier for the trace this experiment event belongs to final ExperimentEvent.BuilderrootSpanId(JsonField<String> rootSpanId)Sets Builder.rootSpanId to an arbitrary JSON value. final ExperimentEvent.BuilderspanId(String spanId)A unique identifier used to link different experiment events together as part of a full trace. final ExperimentEvent.BuilderspanId(JsonField<String> spanId)Sets Builder.spanId to an arbitrary JSON value. final ExperimentEvent.Buildercontext(ExperimentEvent.Context context)Context is additional information about the code that produced the experiment event. final ExperimentEvent.Buildercontext(Optional<ExperimentEvent.Context> context)Alias for calling Builder.context with context.orElse(null).final ExperimentEvent.Buildercontext(JsonField<ExperimentEvent.Context> context)Sets Builder.context to an arbitrary JSON value. final ExperimentEvent.Buildererror(JsonValue error)The error that occurred, if any. final ExperimentEvent.Builderexpected(JsonValue expected)The ground truth value (an arbitrary, JSON serializable object) that you'd compare to outputto determine if youroutputvalue is correct or not.final ExperimentEvent.Builderinput(JsonValue input)The arguments that uniquely define a test case (an arbitrary, JSON serializable object). final ExperimentEvent.BuilderisRoot(Boolean isRoot)Whether this span is a root span final ExperimentEvent.BuilderisRoot(Boolean isRoot)Alias for Builder.isRoot. final ExperimentEvent.BuilderisRoot(Optional<Boolean> isRoot)Alias for calling Builder.isRoot with isRoot.orElse(null).final ExperimentEvent.BuilderisRoot(JsonField<Boolean> isRoot)Sets Builder.isRoot to an arbitrary JSON value. final ExperimentEvent.Buildermetadata(ExperimentEvent.Metadata metadata)A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. final ExperimentEvent.Buildermetadata(Optional<ExperimentEvent.Metadata> metadata)Alias for calling Builder.metadata with metadata.orElse(null).final ExperimentEvent.Buildermetadata(JsonField<ExperimentEvent.Metadata> metadata)Sets Builder.metadata to an arbitrary JSON value. final ExperimentEvent.Buildermetrics(ExperimentEvent.Metrics metrics)Metrics are numerical measurements tracking the execution of the code that produced the experiment event. final ExperimentEvent.Buildermetrics(Optional<ExperimentEvent.Metrics> metrics)Alias for calling Builder.metrics with metrics.orElse(null).final ExperimentEvent.Buildermetrics(JsonField<ExperimentEvent.Metrics> metrics)Sets Builder.metrics to an arbitrary JSON value. final ExperimentEvent.Builderorigin(ObjectReference origin)Indicates the event was copied from another object. final ExperimentEvent.Builderorigin(Optional<ObjectReference> origin)Alias for calling Builder.origin with origin.orElse(null).final ExperimentEvent.Builderorigin(JsonField<ObjectReference> origin)Sets Builder.origin to an arbitrary JSON value. final ExperimentEvent.Builderoutput(JsonValue output)The output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. final ExperimentEvent.Builderscores(ExperimentEvent.Scores scores)A dictionary of numeric values (between 0 and 1) to log. final ExperimentEvent.Builderscores(Optional<ExperimentEvent.Scores> scores)Alias for calling Builder.scores with scores.orElse(null).final ExperimentEvent.Builderscores(JsonField<ExperimentEvent.Scores> scores)Sets Builder.scores to an arbitrary JSON value. final ExperimentEvent.BuilderspanAttributes(SpanAttributes spanAttributes)Human-identifying attributes of the span, such as name, type, etc. final ExperimentEvent.BuilderspanAttributes(Optional<SpanAttributes> spanAttributes)Alias for calling Builder.spanAttributes with spanAttributes.orElse(null).final ExperimentEvent.BuilderspanAttributes(JsonField<SpanAttributes> spanAttributes)Sets Builder.spanAttributes to an arbitrary JSON value. final ExperimentEvent.BuilderspanParents(List<String> spanParents)An array of the parent span_idsof this experiment event.final ExperimentEvent.BuilderspanParents(Optional<List<String>> spanParents)Alias for calling Builder.spanParents with spanParents.orElse(null).final ExperimentEvent.BuilderspanParents(JsonField<List<String>> spanParents)Sets Builder.spanParents to an arbitrary JSON value. final ExperimentEvent.BuilderaddSpanParent(String spanParent)Adds a single String to spanParents. final ExperimentEvent.Buildertags(List<String> tags)A list of tags to log final ExperimentEvent.Buildertags(Optional<List<String>> tags)Alias for calling Builder.tags with tags.orElse(null).final ExperimentEvent.Buildertags(JsonField<List<String>> tags)Sets Builder.tags to an arbitrary JSON value. final ExperimentEvent.BuilderaddTag(String tag)Adds a single String to tags. final ExperimentEvent.BuilderadditionalProperties(Map<String, JsonValue> additionalProperties)final ExperimentEvent.BuilderputAdditionalProperty(String key, JsonValue value)final ExperimentEvent.BuilderputAllAdditionalProperties(Map<String, JsonValue> additionalProperties)final ExperimentEvent.BuilderremoveAdditionalProperty(String key)final ExperimentEvent.BuilderremoveAllAdditionalProperties(Set<String> keys)final ExperimentEventbuild()Returns an immutable instance of ExperimentEvent. -
-
Method Detail
-
id
final ExperimentEvent.Builder id(String id)
A unique identifier for the experiment event. If you don't provide one, BrainTrust will generate one for you
-
id
final ExperimentEvent.Builder id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value.
You should usually call Builder.id with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
_xactId
final ExperimentEvent.Builder _xactId(String _xactId)
The transaction id of an event is unique to the network operation that processed the event insertion. Transaction ids are monotonically increasing over time and can be used to retrieve a versioned snapshot of the experiment (see the
versionparameter)
-
_xactId
final ExperimentEvent.Builder _xactId(JsonField<String> _xactId)
Sets Builder._xactId to an arbitrary JSON value.
You should usually call Builder._xactId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
created
final ExperimentEvent.Builder created(OffsetDateTime created)
The timestamp the experiment event was created
-
created
final ExperimentEvent.Builder created(JsonField<OffsetDateTime> created)
Sets Builder.created to an arbitrary JSON value.
You should usually call Builder.created with a well-typed OffsetDateTime value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
experimentId
final ExperimentEvent.Builder experimentId(String experimentId)
Unique identifier for the experiment
-
experimentId
final ExperimentEvent.Builder experimentId(JsonField<String> experimentId)
Sets Builder.experimentId to an arbitrary JSON value.
You should usually call Builder.experimentId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
projectId
final ExperimentEvent.Builder projectId(String projectId)
Unique identifier for the project that the experiment belongs under
-
projectId
final ExperimentEvent.Builder projectId(JsonField<String> projectId)
Sets Builder.projectId to an arbitrary JSON value.
You should usually call Builder.projectId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
rootSpanId
final ExperimentEvent.Builder rootSpanId(String rootSpanId)
A unique identifier for the trace this experiment event belongs to
-
rootSpanId
final ExperimentEvent.Builder rootSpanId(JsonField<String> rootSpanId)
Sets Builder.rootSpanId to an arbitrary JSON value.
You should usually call Builder.rootSpanId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
spanId
final ExperimentEvent.Builder spanId(String spanId)
A unique identifier used to link different experiment events together as part of a full trace. See the tracing guide for full details on tracing
-
spanId
final ExperimentEvent.Builder spanId(JsonField<String> spanId)
Sets Builder.spanId to an arbitrary JSON value.
You should usually call Builder.spanId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
context
final ExperimentEvent.Builder context(ExperimentEvent.Context context)
Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to
metrics. Use thecaller_*attributes to track the location in code which produced the experiment event
-
context
final ExperimentEvent.Builder context(Optional<ExperimentEvent.Context> context)
Alias for calling Builder.context with
context.orElse(null).
-
context
final ExperimentEvent.Builder context(JsonField<ExperimentEvent.Context> context)
Sets Builder.context to an arbitrary JSON value.
You should usually call Builder.context with a well-typed Context value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
error
final ExperimentEvent.Builder error(JsonValue error)
The error that occurred, if any.
-
expected
final ExperimentEvent.Builder expected(JsonValue expected)
The ground truth value (an arbitrary, JSON serializable object) that you'd compare to
outputto determine if youroutputvalue is correct or not. Braintrust currently does not compareoutputtoexpectedfor you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models
-
input
final ExperimentEvent.Builder input(JsonValue input)
The arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the
inputto know whether two test cases are the same between experiments, so they should not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, theinputshould be identical
-
isRoot
final ExperimentEvent.Builder isRoot(Boolean isRoot)
Whether this span is a root span
-
isRoot
final ExperimentEvent.Builder isRoot(Boolean isRoot)
Alias for Builder.isRoot.
This unboxed primitive overload exists for backwards compatibility.
-
isRoot
final ExperimentEvent.Builder isRoot(Optional<Boolean> isRoot)
Alias for calling Builder.isRoot with
isRoot.orElse(null).
-
isRoot
final ExperimentEvent.Builder isRoot(JsonField<Boolean> isRoot)
Sets Builder.isRoot to an arbitrary JSON value.
You should usually call Builder.isRoot with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
metadata
final ExperimentEvent.Builder metadata(ExperimentEvent.Metadata metadata)
A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the
prompt, example'sid, or anything else that would be useful to slice/dice later. The values inmetadatacan be any JSON-serializable type, but its keys must be strings
-
metadata
final ExperimentEvent.Builder metadata(Optional<ExperimentEvent.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null).
-
metadata
final ExperimentEvent.Builder metadata(JsonField<ExperimentEvent.Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value.
You should usually call Builder.metadata with a well-typed Metadata value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
metrics
final ExperimentEvent.Builder metrics(ExperimentEvent.Metrics metrics)
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
-
metrics
final ExperimentEvent.Builder metrics(Optional<ExperimentEvent.Metrics> metrics)
Alias for calling Builder.metrics with
metrics.orElse(null).
-
metrics
final ExperimentEvent.Builder metrics(JsonField<ExperimentEvent.Metrics> metrics)
Sets Builder.metrics to an arbitrary JSON value.
You should usually call Builder.metrics with a well-typed Metrics value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
origin
final ExperimentEvent.Builder origin(ObjectReference origin)
Indicates the event was copied from another object.
-
origin
final ExperimentEvent.Builder origin(Optional<ObjectReference> origin)
Alias for calling Builder.origin with
origin.orElse(null).
-
origin
final ExperimentEvent.Builder origin(JsonField<ObjectReference> origin)
Sets Builder.origin to an arbitrary JSON value.
You should usually call Builder.origin with a well-typed ObjectReference value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
output
final ExperimentEvent.Builder output(JsonValue output)
The output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the
outputshould be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question
-
scores
final ExperimentEvent.Builder scores(ExperimentEvent.Scores scores)
A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety of signals that help you determine how accurate the outputs are compared to what you expect and diagnose failures. For example, a summarization app might have one score that tells you how accurate the summary is, and another that measures the word similarity between the generated and grouth truth summary. The word similarity score could help you determine whether the summarization was covering similar concepts or not. You can use these scores to help you sort, filter, and compare experiments
-
scores
final ExperimentEvent.Builder scores(Optional<ExperimentEvent.Scores> scores)
Alias for calling Builder.scores with
scores.orElse(null).
-
scores
final ExperimentEvent.Builder scores(JsonField<ExperimentEvent.Scores> scores)
Sets Builder.scores to an arbitrary JSON value.
You should usually call Builder.scores with a well-typed Scores value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
spanAttributes
final ExperimentEvent.Builder spanAttributes(SpanAttributes spanAttributes)
Human-identifying attributes of the span, such as name, type, etc.
-
spanAttributes
final ExperimentEvent.Builder spanAttributes(Optional<SpanAttributes> spanAttributes)
Alias for calling Builder.spanAttributes with
spanAttributes.orElse(null).
-
spanAttributes
final ExperimentEvent.Builder spanAttributes(JsonField<SpanAttributes> spanAttributes)
Sets Builder.spanAttributes to an arbitrary JSON value.
You should usually call Builder.spanAttributes with a well-typed SpanAttributes value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
spanParents
final ExperimentEvent.Builder spanParents(List<String> spanParents)
An array of the parent
span_idsof this experiment event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans
-
spanParents
final ExperimentEvent.Builder spanParents(Optional<List<String>> spanParents)
Alias for calling Builder.spanParents with
spanParents.orElse(null).
-
spanParents
final ExperimentEvent.Builder spanParents(JsonField<List<String>> spanParents)
Sets Builder.spanParents to an arbitrary JSON value.
You should usually call Builder.spanParents with a well-typed
List<String>value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addSpanParent
final ExperimentEvent.Builder addSpanParent(String spanParent)
Adds a single String to spanParents.
-
tags
final ExperimentEvent.Builder tags(List<String> tags)
A list of tags to log
-
tags
final ExperimentEvent.Builder tags(Optional<List<String>> tags)
Alias for calling Builder.tags with
tags.orElse(null).
-
tags
final ExperimentEvent.Builder tags(JsonField<List<String>> tags)
Sets Builder.tags to an arbitrary JSON value.
You should usually call Builder.tags with a well-typed
List<String>value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addTag
final ExperimentEvent.Builder addTag(String tag)
-
additionalProperties
final ExperimentEvent.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final ExperimentEvent.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final ExperimentEvent.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final ExperimentEvent.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final ExperimentEvent.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final ExperimentEvent build()
Returns an immutable instance of ExperimentEvent.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.id() ._xactId() .created() .experimentId() .projectId() .rootSpanId() .spanId()
-
-
-
-