openapi: 3.1.1 info: version: 1.0.0 title: Braintrust Acls Experiments API description: 'API specification for the backend data server. The API is hosted globally at https://api.braintrust.dev or in your own environment. You can access the OpenAPI spec for this API at https://github.com/braintrustdata/braintrust-openapi.' license: name: Apache 2.0 servers: - url: https://api.braintrust.dev security: - bearerAuth: [] - {} tags: - name: Experiments paths: /v1/experiment: post: tags: - Experiments security: - bearerAuth: [] - {} operationId: postExperiment description: Create a new experiment. If there is an existing experiment in the project with the same name as the one specified in the request, will return the existing experiment unmodified summary: Create experiment requestBody: description: Any desired information about the new experiment object required: false content: application/json: schema: $ref: '#/components/schemas/CreateExperiment' responses: '200': description: Returns the new experiment object content: application/json: schema: $ref: '#/components/schemas/Experiment' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true get: operationId: getExperiment tags: - Experiments description: List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first summary: List experiments security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/AppLimitWithDefaultParam' - $ref: '#/components/parameters/StartingAfter' - $ref: '#/components/parameters/EndingBefore' - $ref: '#/components/parameters/Ids' - $ref: '#/components/parameters/ExperimentName' - $ref: '#/components/parameters/ProjectName' - $ref: '#/components/parameters/ProjectIdQuery' - $ref: '#/components/parameters/OrgName' responses: '200': description: Returns a list of experiment objects content: application/json: schema: type: object properties: objects: type: array items: $ref: '#/components/schemas/Experiment' description: A list of experiment objects required: - objects additionalProperties: false '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/experiment/{experiment_id}: get: operationId: getExperimentId tags: - Experiments description: Get an experiment object by its id summary: Get experiment security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' responses: '200': description: Returns the experiment object content: application/json: schema: $ref: '#/components/schemas/Experiment' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true patch: operationId: patchExperimentId tags: - Experiments description: Partially update an experiment object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null. summary: Partially update experiment security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' requestBody: description: Fields to update required: false content: application/json: schema: $ref: '#/components/schemas/PatchExperiment' responses: '200': description: Returns the experiment object content: application/json: schema: $ref: '#/components/schemas/Experiment' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true delete: operationId: deleteExperimentId tags: - Experiments description: Delete an experiment object by its id summary: Delete experiment security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' responses: '200': description: Returns the deleted experiment object content: application/json: schema: $ref: '#/components/schemas/Experiment' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/experiment/{experiment_id}/insert: post: operationId: postExperimentIdInsert tags: - Experiments description: Insert a set of events into the experiment summary: Insert experiment events security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' requestBody: description: An array of experiment events to insert required: false content: application/json: schema: $ref: '#/components/schemas/InsertExperimentEventRequest' responses: '200': description: Returns the inserted row ids content: application/json: schema: $ref: '#/components/schemas/InsertEventsResponse' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/experiment/{experiment_id}/fetch: post: operationId: postExperimentIdFetch tags: - Experiments description: Fetch the events in an experiment. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query. For more complex queries, use the `POST /btql` endpoint. summary: Fetch experiment (POST form) security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' requestBody: description: Filters for the fetch query required: false content: application/json: schema: $ref: '#/components/schemas/FetchEventsRequest' responses: '200': description: Returns the fetched rows content: application/json: schema: $ref: '#/components/schemas/FetchExperimentEventsResponse' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true get: operationId: getExperimentIdFetch tags: - Experiments description: Fetch the events in an experiment. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body. For more complex queries, use the `POST /btql` endpoint. summary: Fetch experiment (GET form) security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' - $ref: '#/components/parameters/FetchLimitParam' - $ref: '#/components/parameters/MaxXactId' - $ref: '#/components/parameters/MaxRootSpanId' - $ref: '#/components/parameters/Version' responses: '200': description: Returns the fetched rows content: application/json: schema: $ref: '#/components/schemas/FetchExperimentEventsResponse' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/experiment/{experiment_id}/feedback: post: operationId: postExperimentIdFeedback tags: - Experiments description: Log feedback for a set of experiment events summary: Feedback for experiment events security: - bearerAuth: [] - {} parameters: - $ref: '#/components/parameters/ExperimentIdParam' requestBody: description: An array of feedback objects required: false content: application/json: schema: $ref: '#/components/schemas/FeedbackExperimentEventRequest' responses: '200': description: Returns a success status content: application/json: schema: $ref: '#/components/schemas/FeedbackResponseSchema' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true /v1/experiment/{experiment_id}/summarize: get: operationId: getExperimentIdSummarize tags: - Experiments description: Summarize experiment summary: Summarize experiment security: - bearerAuth: [] parameters: - $ref: '#/components/parameters/ExperimentIdParam' - $ref: '#/components/parameters/SummarizeScores' - $ref: '#/components/parameters/ComparisonExperimentId' responses: '200': description: Experiment summary content: application/json: schema: $ref: '#/components/schemas/SummarizeExperimentResponse' '400': description: The request was unacceptable, often due to missing a required parameter content: text/plain: schema: type: string application/json: schema: nullable: true '401': description: No valid API key provided content: text/plain: schema: type: string application/json: schema: nullable: true '403': description: The API key doesn’t have permissions to perform the request content: text/plain: schema: type: string application/json: schema: nullable: true '429': description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests headers: Retry-After: schema: type: string content: text/plain: schema: type: string application/json: schema: nullable: true '500': description: Something went wrong on Braintrust's end. (These are rare.) content: text/plain: schema: type: string application/json: schema: nullable: true components: parameters: EndingBefore: schema: $ref: '#/components/schemas/EndingBefore' required: false description: 'Pagination cursor id. For example, if the initial item in the last page you fetched had an id of `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only pass one of `starting_after` and `ending_before`' name: ending_before in: query ExperimentIdParam: schema: $ref: '#/components/schemas/ExperimentIdParam' required: true description: Experiment id name: experiment_id in: path StartingAfter: schema: $ref: '#/components/schemas/StartingAfter' required: false description: 'Pagination cursor id. For example, if the final item in the last page you fetched had an id of `foo`, pass `starting_after=foo` to fetch the next page. Note: you may only pass one of `starting_after` and `ending_before`' name: starting_after in: query FetchLimitParam: schema: $ref: '#/components/schemas/FetchLimitParam' required: false description: 'limit the number of traces fetched Fetch queries may be paginated if the total result size is expected to be large (e.g. project_logs which accumulate over a long time). Note that fetch queries only support pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. This happens because pagination occurs over the whole version history of the event log. You will most likely want to exclude any such duplicate, outdated rows (by `id`) from your combined result set. The `limit` parameter controls the number of full traces to return. So you may end up with more individual rows than the specified limit if you are fetching events containing traces.' name: limit in: query ExperimentName: schema: $ref: '#/components/schemas/ExperimentName' required: false description: Name of the experiment to search for name: experiment_name in: query allowReserved: true Version: schema: $ref: '#/components/schemas/Version' required: false description: 'Retrieve a snapshot of events from a past time The version id is essentially a filter on the latest event transaction id. You can use the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch.' name: version in: query AppLimitWithDefaultParam: schema: $ref: '#/components/schemas/AppLimitWithDefaultParam' required: false description: Limit the number of objects to return name: limit in: query Ids: schema: $ref: '#/components/schemas/Ids' required: false description: Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times name: ids in: query ComparisonExperimentId: schema: $ref: '#/components/schemas/ComparisonExperimentId' required: false description: The experiment to compare against, if summarizing scores and metrics. If omitted, will fall back to the `base_exp_id` stored in the experiment metadata, and then to the most recent experiment run in the same project. Must pass `summarize_scores=true` for this id to be used name: comparison_experiment_id in: query SummarizeScores: schema: $ref: '#/components/schemas/SummarizeScores' required: false description: Whether to summarize the scores and metrics. If false (or omitted), only the metadata will be returned. name: summarize_scores in: query MaxXactId: schema: $ref: '#/components/schemas/MaxXactId' required: false description: 'DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the explicit ''cursor'' returned by object fetch requests. Please prefer the ''cursor'' argument going forwards. Together, `max_xact_id` and `max_root_span_id` form a pagination cursor Since a paginated fetch query returns results in order from latest to earliest, the cursor for the next page can be found as the row with the minimum (earliest) value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating fetch queries.' name: max_xact_id in: query ProjectIdQuery: schema: $ref: '#/components/schemas/ProjectIdQuery' required: false description: Project id name: project_id in: query OrgName: schema: $ref: '#/components/schemas/OrgName' required: false description: Filter search results to within a particular organization name: org_name in: query allowReserved: true ProjectName: schema: $ref: '#/components/schemas/ProjectName' required: false description: Name of the project to search for name: project_name in: query allowReserved: true MaxRootSpanId: schema: $ref: '#/components/schemas/MaxRootSpanId' required: false description: 'DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the explicit ''cursor'' returned by object fetch requests. Please prefer the ''cursor'' argument going forwards. Together, `max_xact_id` and `max_root_span_id` form a pagination cursor Since a paginated fetch query returns results in order from latest to earliest, the cursor for the next page can be found as the row with the minimum (earliest) value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating fetch queries.' name: max_root_span_id in: query schemas: MetricSummary: type: object properties: name: type: string description: Name of the metric metric: type: number description: Average metric across all examples unit: type: string description: Unit label for the metric diff: type: number description: Difference in metric between the current and comparison experiment improvements: type: integer minimum: 0 description: Number of improvements in the metric regressions: type: integer minimum: 0 description: Number of regressions in the metric required: - name - metric - unit - improvements - regressions description: Summary of a metric's performance InsertExperimentEventRequest: type: object properties: events: type: array items: $ref: '#/components/schemas/InsertExperimentEvent' description: A list of experiment events to insert required: - events OrgName: type: string description: Filter search results to within a particular organization Experiment: type: object properties: id: type: string format: uuid description: Unique identifier for the experiment project_id: type: string format: uuid description: Unique identifier for the project that the experiment belongs under name: type: string description: Name of the experiment. Within a project, experiment names are unique description: type: string nullable: true description: Textual description of the experiment created: type: string nullable: true format: date-time description: Date of experiment creation repo_info: $ref: '#/components/schemas/RepoInfo' commit: type: string nullable: true description: Commit, taken directly from `repo_info.commit` base_exp_id: type: string nullable: true format: uuid description: Id of default base experiment to compare against when viewing this experiment deleted_at: type: string nullable: true format: date-time description: Date of experiment deletion, or null if the experiment is still active dataset_id: type: string nullable: true format: uuid description: Identifier of the linked dataset, or null if the experiment is not linked to a dataset dataset_version: type: string nullable: true description: Version number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified. internal_metadata: type: object nullable: true properties: dataset_filter: type: object nullable: true additionalProperties: nullable: true description: BTQL filter payload used to evaluate a subset of a linked dataset. additionalProperties: nullable: true description: Braintrust-controlled metadata about the experiment. parameters_id: type: string nullable: true format: uuid description: Identifier of the linked saved parameters object, or null if the experiment is not linked to saved parameters parameters_version: type: string nullable: true description: Version number of the linked saved parameters object the experiment was run against. public: type: boolean description: Whether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization user_id: type: string nullable: true format: uuid description: Identifies the user who created the experiment metadata: type: object nullable: true additionalProperties: nullable: true description: User-controlled metadata about the experiment tags: type: array nullable: true items: type: string description: A list of tags for the experiment required: - id - project_id - name - public PatchExperiment: type: object properties: name: type: string nullable: true description: Name of the experiment. Within a project, experiment names are unique description: type: string nullable: true description: Textual description of the experiment repo_info: $ref: '#/components/schemas/RepoInfo' base_exp_id: type: string nullable: true format: uuid description: Id of default base experiment to compare against when viewing this experiment dataset_id: type: string nullable: true format: uuid description: Identifier of the linked dataset, or null if the experiment is not linked to a dataset dataset_version: type: string nullable: true description: Version number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified. internal_metadata: type: object nullable: true properties: dataset_filter: type: object nullable: true additionalProperties: nullable: true description: BTQL filter payload used to evaluate a subset of a linked dataset. additionalProperties: nullable: true description: Braintrust-controlled metadata about the experiment. parameters_id: type: string nullable: true format: uuid description: Identifier of the linked saved parameters object, or null if the experiment is not linked to saved parameters parameters_version: type: string nullable: true description: Version number of the linked saved parameters object the experiment was run against. public: type: boolean nullable: true description: Whether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization metadata: type: object nullable: true additionalProperties: nullable: true description: User-controlled metadata about the experiment tags: type: array nullable: true items: type: string description: A list of tags for the experiment SummarizeExperimentResponse: type: object properties: project_name: type: string description: Name of the project that the experiment belongs to experiment_name: type: string description: Name of the experiment project_url: type: string format: uri description: URL to the project's page in the Braintrust app experiment_url: type: string format: uri description: URL to the experiment's page in the Braintrust app comparison_experiment_name: type: string nullable: true description: The experiment which scores are baselined against scores: type: object nullable: true additionalProperties: $ref: '#/components/schemas/ScoreSummary' description: Summary of the experiment's scores metrics: type: object nullable: true additionalProperties: $ref: '#/components/schemas/MetricSummary' description: Summary of the experiment's metrics required: - project_name - experiment_name - project_url - experiment_url description: Summary of an experiment FetchEventsRequest: type: object properties: limit: $ref: '#/components/schemas/FetchLimit' cursor: $ref: '#/components/schemas/FetchPaginationCursor' max_xact_id: $ref: '#/components/schemas/MaxXactId' nullable: true max_root_span_id: $ref: '#/components/schemas/MaxRootSpanId' nullable: true version: $ref: '#/components/schemas/Version' nullable: true FetchPaginationCursor: type: string nullable: true description: 'An opaque string to be used as a cursor for the next page of results, in order from latest to earliest. The string can be obtained directly from the `cursor` property of the previous fetch query' FeedbackResponseSchema: type: object properties: status: type: string enum: - success required: - status FetchLimitParam: type: integer nullable: true minimum: 0 description: 'limit the number of traces fetched Fetch queries may be paginated if the total result size is expected to be large (e.g. project_logs which accumulate over a long time). Note that fetch queries only support pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. This happens because pagination occurs over the whole version history of the event log. You will most likely want to exclude any such duplicate, outdated rows (by `id`) from your combined result set. The `limit` parameter controls the number of full traces to return. So you may end up with more individual rows than the specified limit if you are fetching events containing traces.' MaxRootSpanId: type: string description: 'DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the explicit ''cursor'' returned by object fetch requests. Please prefer the ''cursor'' argument going forwards. Together, `max_xact_id` and `max_root_span_id` form a pagination cursor Since a paginated fetch query returns results in order from latest to earliest, the cursor for the next page can be found as the row with the minimum (earliest) value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating fetch queries.' FetchLimit: type: integer nullable: true minimum: 0 description: 'limit the number of traces fetched Fetch queries may be paginated if the total result size is expected to be large (e.g. project_logs which accumulate over a long time). Note that fetch queries only support pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. This happens because pagination occurs over the whole version history of the event log. You will most likely want to exclude any such duplicate, outdated rows (by `id`) from your combined result set. The `limit` parameter controls the number of full traces to return. So you may end up with more individual rows than the specified limit if you are fetching events containing traces.' RepoInfo: type: object nullable: true properties: commit: type: string nullable: true description: SHA of most recent commit branch: type: string nullable: true description: Name of the branch the most recent commit belongs to tag: type: string nullable: true description: Name of the tag on the most recent commit dirty: type: boolean nullable: true description: Whether or not the repo had uncommitted changes when snapshotted author_name: type: string nullable: true description: Name of the author of the most recent commit author_email: type: string nullable: true description: Email of the author of the most recent commit commit_message: type: string nullable: true description: Most recent commit message commit_time: type: string nullable: true description: Time of the most recent commit git_diff: type: string nullable: true description: If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. description: Metadata about the state of the repo when the experiment was created FeedbackExperimentItem: type: object properties: id: type: string description: The id of the experiment event to log feedback for. This is the row `id` returned by `POST /v1/experiment/{experiment_id}/insert` scores: type: object nullable: true additionalProperties: type: number nullable: true minimum: 0 maximum: 1 description: A dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the existing scores for the experiment event expected: nullable: true description: The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to determine if your `output` value is correct or not comment: type: string nullable: true description: An optional comment string to log about the experiment event metadata: type: object nullable: true additionalProperties: nullable: true description: A dictionary with additional data about the feedback. If you have a `user_id`, you can log it here and access it in the Braintrust UI. Note, this metadata does not correspond to the main event itself, but rather the audit log attached to the event. source: type: string nullable: true enum: - app - api - external - null description: The source of the feedback. Must be one of "external" (default), "app", or "api" tags: type: array nullable: true items: type: string description: A list of tags to log required: - id Ids: anyOf: - type: string format: uuid - type: array items: type: string format: uuid description: Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times ProjectName: type: string description: Name of the project to search for FunctionTypeEnum: type: string enum: - llm - scorer - task - tool - custom_view - preprocessor - facet - classifier - tag - parameters - sandbox - null default: scorer description: The type of global function. Defaults to 'scorer'. SpanAttributes: type: object nullable: true properties: name: type: string nullable: true description: Name of the span, for display purposes only type: $ref: '#/components/schemas/SpanType' purpose: type: string nullable: true enum: - scorer - null description: A special value that indicates the span was generated by a scoring automation additionalProperties: nullable: true description: Human-identifying attributes of the span, such as name, type, etc. Version: type: string description: 'Retrieve a snapshot of events from a past time The version id is essentially a filter on the latest event transaction id. You can use the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch.' StartingAfter: type: string format: uuid description: 'Pagination cursor id. For example, if the final item in the last page you fetched had an id of `foo`, pass `starting_after=foo` to fetch the next page. Note: you may only pass one of `starting_after` and `ending_before`' ComparisonExperimentId: type: string format: uuid description: The experiment to compare against, if summarizing scores and metrics. If omitted, will fall back to the `base_exp_id` stored in the experiment metadata, and then to the most recent experiment run in the same project. Must pass `summarize_scores=true` for this id to be used ObjectReferenceNullish: type: object nullable: true properties: object_type: type: string enum: - project_logs - experiment - dataset - prompt - function - prompt_session description: Type of the object the event is originating from. object_id: type: string format: uuid description: ID of the object the event is originating from. id: type: string description: ID of the original event. _xact_id: type: string nullable: true description: Transaction ID of the original event. created: type: string nullable: true description: Created timestamp of the original event. Used to help sort in the UI required: - object_type - object_id - id description: Indicates the event was copied from another object. ProjectIdQuery: type: string format: uuid description: Project id ExperimentIdParam: type: string format: uuid description: Experiment id ExperimentName: type: string description: Name of the experiment to search for ExperimentEvent: type: object properties: id: type: string description: A unique identifier for the experiment event. If you don't provide one, Braintrust will generate one for you _xact_id: type: string description: 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 `version` parameter) created: type: string format: date-time description: The timestamp the experiment event was created _pagination_key: type: string nullable: true description: A stable, time-ordered key that can be used to paginate over experiment events. This field is auto-generated by Braintrust and only exists in Brainstore. project_id: type: string format: uuid description: Unique identifier for the project that the experiment belongs under experiment_id: type: string format: uuid description: Unique identifier for the experiment input: nullable: true description: The arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the `input` to 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, the `input` should be identical output: nullable: true description: 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 `output` should 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 expected: nullable: true description: The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to determine if your `output` value is correct or not. Braintrust currently does not compare `output` to `expected` for 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 error: nullable: true description: The error that occurred, if any. scores: type: object nullable: true additionalProperties: type: number nullable: true minimum: 0 maximum: 1 description: 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 metadata: type: object nullable: true properties: model: type: string nullable: true description: The model used for this example additionalProperties: nullable: true description: 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's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings tags: type: array nullable: true items: type: string description: A list of tags to log metrics: type: object nullable: true properties: start: type: number nullable: true description: A unix timestamp recording when the section of code which produced the experiment event started end: type: number nullable: true description: A unix timestamp recording when the section of code which produced the experiment event finished prompt_tokens: type: integer nullable: true description: The number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span) completion_tokens: type: integer nullable: true description: The number of tokens in the completion generated by the model (only set if this is an LLM span) tokens: type: integer nullable: true description: The total number of tokens in the input and output of the experiment event. caller_functionname: nullable: true description: This metric is deprecated caller_filename: nullable: true description: This metric is deprecated caller_lineno: nullable: true description: This metric is deprecated additionalProperties: type: number description: 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 context: type: object nullable: true properties: caller_functionname: type: string nullable: true description: The function in code which created the experiment event caller_filename: type: string nullable: true description: Name of the file in code where the experiment event was created caller_lineno: type: integer nullable: true description: Line of code where the experiment event was created additionalProperties: nullable: true description: Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event span_id: type: string description: A unique identifier used to link different experiment events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing span_parents: type: array nullable: true items: type: string description: An array of the parent `span_ids` of 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 root_span_id: type: string description: A unique identifier for the trace this experiment event belongs to span_attributes: $ref: '#/components/schemas/SpanAttributes' is_root: type: boolean nullable: true description: Whether this span is a root span origin: $ref: '#/components/schemas/ObjectReferenceNullish' comments: type: array nullable: true items: nullable: true description: Optional list of comments attached to this event audit_data: type: array nullable: true items: nullable: true description: Optional list of audit entries attached to this event facets: type: object nullable: true additionalProperties: nullable: true description: Facets for categorization (dictionary from facet id to value) classifications: type: object nullable: true additionalProperties: type: array items: type: object properties: id: type: string description: Stable classification identifier label: type: string description: Original label of the classification item, which is useful for search and indexing purposes confidence: type: number nullable: true description: Optional confidence score for the classification metadata: type: object nullable: true additionalProperties: nullable: true description: Optional metadata associated with the classification source: $ref: '#/components/schemas/SavedFunctionId' required: - id description: Classifications for this event (dictionary from classification name to items) required: - id - _xact_id - created - project_id - experiment_id - span_id - root_span_id MaxXactId: type: string description: 'DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the explicit ''cursor'' returned by object fetch requests. Please prefer the ''cursor'' argument going forwards. Together, `max_xact_id` and `max_root_span_id` form a pagination cursor Since a paginated fetch query returns results in order from latest to earliest, the cursor for the next page can be found as the row with the minimum (earliest) value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating fetch queries.' ScoreSummary: type: object properties: name: type: string description: Name of the score score: type: number minimum: 0 maximum: 1 description: Average score across all examples diff: type: number minimum: -1 maximum: 1 description: Difference in score between the current and comparison experiment improvements: type: integer minimum: 0 description: Number of improvements in the score regressions: type: integer minimum: 0 description: Number of regressions in the score required: - name - score - improvements - regressions description: Summary of a score's performance CreateExperiment: type: object properties: project_id: type: string format: uuid description: Unique identifier for the project that the experiment belongs under name: type: string nullable: true minLength: 1 description: Name of the experiment. Within a project, experiment names are unique description: type: string nullable: true description: Textual description of the experiment repo_info: $ref: '#/components/schemas/RepoInfo' base_exp_id: type: string nullable: true format: uuid description: Id of default base experiment to compare against when viewing this experiment dataset_id: type: string nullable: true format: uuid description: Identifier of the linked dataset, or null if the experiment is not linked to a dataset dataset_version: type: string nullable: true description: Version number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified. internal_metadata: type: object nullable: true properties: dataset_filter: type: object nullable: true additionalProperties: nullable: true description: BTQL filter payload used to evaluate a subset of a linked dataset. additionalProperties: nullable: true description: Braintrust-controlled metadata about the experiment. parameters_id: type: string nullable: true format: uuid description: Identifier of the linked saved parameters object, or null if the experiment is not linked to saved parameters parameters_version: type: string nullable: true description: Version number of the linked saved parameters object the experiment was run against. public: type: boolean nullable: true description: Whether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization metadata: type: object nullable: true additionalProperties: nullable: true description: User-controlled metadata about the experiment tags: type: array nullable: true items: type: string description: A list of tags for the experiment ensure_new: type: boolean nullable: true description: Normally, creating an experiment with the same name as an existing experiment will return the existing one un-modified. But if `ensure_new` is true, registration will generate a new experiment with a unique name in case of a conflict. required: - project_id FeedbackExperimentEventRequest: type: object properties: feedback: type: array items: $ref: '#/components/schemas/FeedbackExperimentItem' description: A list of experiment feedback items required: - feedback AppLimitWithDefaultParam: type: integer nullable: true minimum: 0 default: 1000 description: Limit the number of objects to return SummarizeScores: type: boolean nullable: true description: Whether to summarize the scores and metrics. If false (or omitted), only the metadata will be returned. InsertExperimentEvent: type: object properties: input: nullable: true description: The arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the `input` to 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, the `input` should be identical output: nullable: true description: 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 `output` should 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 expected: nullable: true description: The ground truth value (an arbitrary, JSON serializable object) that you'd compare to `output` to determine if your `output` value is correct or not. Braintrust currently does not compare `output` to `expected` for 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 error: nullable: true description: The error that occurred, if any. scores: type: object nullable: true additionalProperties: type: number nullable: true minimum: 0 maximum: 1 description: 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 metadata: type: object nullable: true properties: model: type: string nullable: true description: The model used for this example additionalProperties: nullable: true description: 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's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings tags: type: array nullable: true items: type: string description: A list of tags to log metrics: type: object nullable: true properties: start: type: number nullable: true description: A unix timestamp recording when the section of code which produced the experiment event started end: type: number nullable: true description: A unix timestamp recording when the section of code which produced the experiment event finished prompt_tokens: type: integer nullable: true description: The number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span) completion_tokens: type: integer nullable: true description: The number of tokens in the completion generated by the model (only set if this is an LLM span) tokens: type: integer nullable: true description: The total number of tokens in the input and output of the experiment event. caller_functionname: nullable: true description: This metric is deprecated caller_filename: nullable: true description: This metric is deprecated caller_lineno: nullable: true description: This metric is deprecated additionalProperties: type: number description: 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 context: type: object nullable: true properties: caller_functionname: type: string nullable: true description: The function in code which created the experiment event caller_filename: type: string nullable: true description: Name of the file in code where the experiment event was created caller_lineno: type: integer nullable: true description: Line of code where the experiment event was created additionalProperties: nullable: true description: Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event span_attributes: $ref: '#/components/schemas/SpanAttributes' id: type: string nullable: true description: A unique identifier for the experiment event. If you don't provide one, Braintrust will generate one for you created: type: string nullable: true format: date-time description: The timestamp the experiment event was created origin: $ref: '#/components/schemas/ObjectReferenceNullish' facets: type: object nullable: true additionalProperties: nullable: true description: Facets for categorization (dictionary from facet id to value) _object_delete: type: boolean nullable: true description: Pass `_object_delete=true` to mark the experiment event deleted. Deleted events will not show up in subsequent fetches for this experiment _is_merge: type: boolean nullable: true description: 'The `_is_merge` field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to `false`), the existing row is completely replaced by the new row. When set to `true`, the new row is deep-merged into the existing row, if one is found. If no existing row is found, the new row is inserted as is. For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": 5, "b": 10}}`. If we merge a new row as `{"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be `{"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}`. If we replace the new row as `{"id": "foo", "input": {"b": 11, "c": 20}}`, the new row will be `{"id": "foo", "input": {"b": 11, "c": 20}}`' _merge_paths: type: array nullable: true items: type: array items: type: string description: 'The `_merge_paths` field allows controlling the depth of the merge, when `_is_merge=true`. `_merge_paths` is a list of paths, where each path is a list of field names. The deep merge will not descend below any of the specified merge paths. For example, say there is an existing row in the DB `{"id": "foo", "input": {"a": {"b": 10}, "c": {"d": 20}}, "output": {"a": 20}}`. If we merge a new row as `{"_is_merge": true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, "bar": "baz"}, "output": {"d": 40}}`, the new row will be `{"id": "foo": "input": {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}`. In this case, due to the merge paths, we have replaced `input.a` and `output`, but have still deep-merged `input` and `input.c`.' _array_delete: type: array nullable: true items: type: object properties: path: type: array items: type: string delete: type: array items: nullable: true required: - path - delete description: 'The `_array_delete` field allows removing specific values from array fields. It is an array of objects with `path` and `delete` properties. For example, to remove tags "foo" and "bar" from an existing row: `{"_is_merge": true, "_array_delete": [{"path": ["tags"], "delete": ["foo", "bar"]}]}`. For nested fields like `metadata.categories`, use `[{"path": ["metadata", "categories"], "delete": ["value"]}]`. This will remove those specific values from the array while preserving others.' _parent_id: type: string nullable: true description: 'DEPRECATED: The `_parent_id` field is deprecated and should not be used. Support for `_parent_id` will be dropped in a future version of Braintrust. Log `span_id`, `root_span_id`, and `span_parents` explicitly instead. Use the `_parent_id` field to create this row as a subspan of an existing row. Tracking hierarchical relationships are important for tracing (see the [guide](https://www.braintrust.dev/docs/instrument) for full details). For example, say we have logged a row `{"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. If the row is being merged into an existing row, this field will be ignored.' span_id: type: string nullable: true description: 'Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now deprecated. The span_id is a unique identifier describing the row''s place in the a trace, and the root_span_id is a unique identifier for the whole trace. See the [guide](https://www.braintrust.dev/docs/instrument) for full details. For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. If the row is being merged into an existing row, this field will be ignored.' root_span_id: type: string nullable: true description: 'Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now deprecated. The span_id is a unique identifier describing the row''s place in the a trace, and the root_span_id is a unique identifier for the whole trace. See the [guide](https://www.braintrust.dev/docs/instrument) for full details. For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. If the row is being merged into an existing row, this field will be ignored.' span_parents: type: array nullable: true items: type: string description: 'Use `span_id`, `root_span_id`, and `span_parents` instead of `_parent_id`, which is now deprecated. The span_id is a unique identifier describing the row''s place in the a trace, and the root_span_id is a unique identifier for the whole trace. See the [guide](https://www.braintrust.dev/docs/instrument) for full details. For example, say we have logged a row `{"id": "abc", "span_id": "span0", "root_span_id": "root_span0", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}`. We can create a sub-span of the parent row by logging `{"id": "llm_call", "span_id": "span1", "root_span_id": "root_span0", "span_parents": ["span0"], "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}`. In the webapp, only the root span row `"abc"` will show up in the summary view. You can view the full trace hierarchy (in this case, the `"llm_call"` row) by clicking on the "abc" row. If the row is being merged into an existing row, this field will be ignored.' description: An experiment event FetchExperimentEventsResponse: type: object properties: events: type: array items: $ref: '#/components/schemas/ExperimentEvent' description: A list of fetched events cursor: type: string nullable: true description: 'Pagination cursor Pass this string directly as the `cursor` param to your next fetch request to get the next page of results. Not provided if the returned result set is empty.' required: - events SavedFunctionId: anyOf: - type: object properties: type: type: string enum: - function id: type: string version: type: string description: The version of the function required: - type - id title: function - type: object properties: type: type: string enum: - global name: type: string function_type: $ref: '#/components/schemas/FunctionTypeEnum' required: - type - name title: global - type: 'null' description: Optional function identifier that produced the classification SpanType: type: string nullable: true enum: - llm - score - function - eval - task - tool - automation - facet - preprocessor - classifier - review - null description: Type of the span, for display purposes only EndingBefore: type: string format: uuid description: 'Pagination cursor id. For example, if the initial item in the last page you fetched had an id of `foo`, pass `ending_before=foo` to fetch the previous page. Note: you may only pass one of `starting_after` and `ending_before`' InsertEventsResponse: type: object properties: row_ids: type: array items: type: string description: The ids of all rows that were inserted, aligning one-to-one with the rows provided as input required: - row_ids securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: API key or JWT description: 'Most Braintrust endpoints are authenticated by providing your API key as a header `Authorization: Bearer [api_key]` to your HTTP request. You can create an API key in the Braintrust [organization settings page](https://www.braintrustdata.com/app/settings?subroute=api-keys).'