From f9993a73a214fea3decc0d3eb9f5d24e76f736bd Mon Sep 17 00:00:00 2001 From: "braintrust-bot[bot]" <215900051+braintrust-bot[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 01:21:08 +0000 Subject: [PATCH] chore: Update platform types --- generated_types.json | 1274 +++++++++-- js/src/generated_plain_types.ts | 3497 ++++++++++++++++++------------ js/src/generated_types.ts | 438 +++- js/util/generated_plain_types.ts | 3497 ++++++++++++++++++------------ js/util/generated_types.ts | 438 +++- 5 files changed, 6206 insertions(+), 2938 deletions(-) diff --git a/generated_types.json b/generated_types.json index b8c224046..9a6f63903 100644 --- a/generated_types.json +++ b/generated_types.json @@ -119,6 +119,11 @@ "format": "date-time", "description": "Date of agent creation" }, + "deleted_at": { + "type": ["string", "null"], + "format": "date-time", + "description": "Date of agent deletion, or null if the agent is still active" + }, "name": { "type": "string", "description": "Name of the agent. Within a project, agent names are unique" @@ -308,6 +313,9 @@ "type": "string", "enum": ["low", "medium", "high"] }, + "service_tier": { + "type": "string" + }, "top_k": { "type": "number" }, @@ -360,7 +368,8 @@ "description": "Name of the api key" }, "preview_name": { - "type": "string" + "type": "string", + "description": "Masked preview showing the key prefix and last four characters, e.g. sk-…AbCd." }, "user_id": { "type": ["string", "null"], @@ -384,6 +393,11 @@ "format": "uuid", "description": "Unique identifier for the organization" }, + "last_used_at": { + "type": ["string", "null"], + "format": "date-time", + "description": "Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded." + }, "expires_at": { "type": ["string", "null"], "format": "date-time", @@ -403,6 +417,9 @@ }, "token": { "type": "string" + }, + "triggered_xact_id": { + "type": "string" } }, "required": ["kind"] @@ -1669,7 +1686,7 @@ }, "snapshot_ref": { "type": "string", - "description": "sandbox snapshot ref" + "description": "The Modal snapshot to start the sandbox from" } }, "required": ["provider", "snapshot_ref"] @@ -1816,6 +1833,14 @@ "model": { "type": ["string", "null"], "description": "The model used for this example" + }, + "requested_service_tier": { + "type": ["string", "null"], + "description": "The service tier requested for this LLM call" + }, + "served_service_tier": { + "type": ["string", "null"], + "description": "The service tier that served this LLM call" } }, "additionalProperties": {}, @@ -1830,7 +1855,7 @@ }, "span_id": { "type": "string", - "description": "A unique identifier used to link different dataset events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing" + "description": "A unique identifier used to link different dataset events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing" }, "root_span_id": { "type": "string", @@ -1973,7 +1998,7 @@ }, "xact_id": { "type": "string", - "description": "Transaction id of the brainstore version at the time of the snapshot" + "description": "Transaction ID of the dataset version at the time of the snapshot" }, "created": { "type": ["string", "null"], @@ -2054,7 +2079,7 @@ "automation_integration" ], "default": "env_var", - "description": "The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys" + "description": "The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys, sandbox_provider for sandbox provider credentials, automation_integration for automation delivery credentials" } }, "required": ["id", "object_type", "object_id", "name"] @@ -2205,7 +2230,7 @@ "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" + "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 ground 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", "null"], @@ -2213,6 +2238,14 @@ "model": { "type": ["string", "null"], "description": "The model used for this example" + }, + "requested_service_tier": { + "type": ["string", "null"], + "description": "The service tier requested for this LLM call" + }, + "served_service_tier": { + "type": ["string", "null"], + "description": "The service tier that served this LLM call" } }, "additionalProperties": {}, @@ -2249,13 +2282,13 @@ "description": "The total number of tokens in the input and output of the experiment event." }, "caller_functionname": { - "description": "This metric is deprecated" + "description": "Deprecated. Use `context.caller_functionname` instead." }, "caller_filename": { - "description": "This metric is deprecated" + "description": "Deprecated. Use `context.caller_filename` instead." }, "caller_lineno": { - "description": "This metric is deprecated" + "description": "Deprecated. Use `context.caller_lineno` instead." } }, "additionalProperties": { @@ -2284,7 +2317,7 @@ }, "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" + "description": "A unique identifier used to link different experiment events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing" }, "span_parents": { "type": ["array", "null"], @@ -2670,7 +2703,7 @@ }, "internal": { "type": ["boolean", "null"], - "description": "The function exists for internal purposes and should not be displayed in the list of functions." + "description": "If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI." } }, "required": ["object_type", "object_id"] @@ -2881,12 +2914,193 @@ "title": "topic_map" } ] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["conversation"] + }, + "config": { + "anyOf": [ + { + "type": "object", + "properties": { + "initiator": { + "type": "string", + "enum": ["agent", "simulated_user"], + "default": "agent", + "description": "Who speaks first in the conversation" + }, + "timeout_seconds": { + "type": "integer", + "minimum": 15, + "maximum": 3600, + "default": 600, + "description": "Maximum conversation duration in seconds" + }, + "modality": { + "type": "string", + "enum": ["voice"], + "default": "voice" + }, + "agent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["livekit"] + }, + "server_url": { + "type": "string", + "minLength": 1, + "description": "The WebSocket URL of the LiveKit project hosting the agent" + }, + "agent_name": { + "type": "string", + "minLength": 1, + "description": "The name of the LiveKit agent to dispatch" + } + }, + "required": ["type", "server_url", "agent_name"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["phone"] + }, + "phone_number": { + "type": "string", + "pattern": "^\\+[1-9]\\d{7,14}$" + } + }, + "required": ["type", "phone_number"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["sip"] + }, + "uri": { + "type": "string", + "pattern": "^sips?:[^\\s]+$" + } + }, + "required": ["type", "uri"], + "additionalProperties": false + } + ] + } + }, + "required": ["agent"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "initiator": { + "type": "string", + "enum": ["agent", "simulated_user"], + "default": "agent", + "description": "Who speaks first in the conversation" + }, + "timeout_seconds": { + "type": "integer", + "minimum": 15, + "maximum": 3600, + "default": 600, + "description": "Maximum conversation duration in seconds" + }, + "modality": { + "type": "string", + "enum": ["text"] + }, + "agent": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["livekit"] + }, + "server_url": { + "type": "string", + "minLength": 1, + "description": "The WebSocket URL of the LiveKit project hosting the agent" + }, + "agent_name": { + "type": "string", + "minLength": 1, + "description": "The name of the LiveKit agent to dispatch" + } + }, + "required": ["type", "server_url", "agent_name"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["acp"] + }, + "command": { + "type": "string", + "minLength": 1, + "description": "Executable for the ACP agent subprocess, communicating over stdio" + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "Arguments passed to the executable without shell interpretation" + }, + "cwd": { + "type": "string", + "pattern": "^(?:[/]|[A-Za-z]:[\\\\/]|\\\\\\\\)", + "description": "Absolute working directory for the ACP session on the execution host" + }, + "permissions": { + "type": "string", + "enum": ["deny"], + "default": "deny", + "description": "Deny ACP permission requests; this does not sandbox the subprocess" + } + }, + "required": ["type", "command", "cwd"], + "additionalProperties": false + } + ] + } + }, + "required": ["modality", "agent"], + "additionalProperties": false + } + ] + } + }, + "required": ["type", "config"], + "additionalProperties": false, + "description": "A task function that runs a conversation between an agent and a simulated user.", + "title": "conversation" } ] }, "FunctionFormat": { "type": "string", - "enum": ["llm", "code", "global", "graph", "topic_map"] + "enum": ["llm", "code", "global", "graph", "topic_map", "conversation"] }, "FunctionId": { "anyOf": [ @@ -3557,6 +3771,10 @@ { "type": "object", "properties": { + "request_source": { + "type": "string", + "description": "A label identifying the caller, used to attribute usage" + }, "input": { "description": "Argument to the function, which can be any JSON serializable value" }, @@ -3566,7 +3784,7 @@ "metadata": { "type": ["object", "null"], "additionalProperties": {}, - "description": "Any relevant metadata. This will be logged and available as the `metadata` argument." + "description": "Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`." }, "tags": { "type": ["array", "null"], @@ -3653,7 +3871,7 @@ } }, "required": ["id", "span_id", "root_span_id"], - "description": "Identifiers for the row to to log a subspan under" + "description": "Identifiers for the row to log a subspan under" }, "propagated_event": { "type": ["object", "null"], @@ -3851,6 +4069,9 @@ "verbosity": { "type": "string", "enum": ["low", "medium", "high"] + }, + "service_tier": { + "type": "string" } }, "additionalProperties": {}, @@ -4112,6 +4333,11 @@ "status": { "$ref": "#/components/schemas/AutomationStatus" }, + "service_tier": { + "type": "string", + "enum": ["standard", "flex"], + "description": "Service tier for online scoring. If omitted, prompt-level service tiers are preserved." + }, "sampling_rate": { "type": "number", "minimum": 0, @@ -4177,19 +4403,24 @@ "description": "Name of the organization" }, "api_url": { - "type": ["string", "null"] + "type": ["string", "null"], + "description": "URL of the organization's data plane API. If unset, the Braintrust-hosted API is used." }, "is_universal_api": { - "type": ["boolean", "null"] + "type": ["boolean", "null"], + "description": "Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended" }, "is_dataplane_private": { - "type": ["boolean", "null"] + "type": ["boolean", "null"], + "description": "Whether the organization's data plane is only reachable from a private network" }, "proxy_url": { - "type": ["string", "null"] + "type": ["string", "null"], + "description": "URL of the organization's AI proxy" }, "realtime_url": { - "type": ["string", "null"] + "type": ["string", "null"], + "description": "URL of the organization's realtime service" }, "created": { "type": ["string", "null"], @@ -4198,11 +4429,13 @@ }, "archived_at": { "type": ["string", "null"], - "format": "date-time" + "format": "date-time", + "description": "Date the organization was archived" }, "deleted_at": { "type": ["string", "null"], - "format": "date-time" + "format": "date-time", + "description": "Date the organization was deleted" }, "image_rendering_mode": { "$ref": "#/components/schemas/ImageRenderingMode" @@ -4276,7 +4509,7 @@ "update_acls", "delete_acls" ], - "description": "Each permission permits a certain type of operation on an object in the system\n\nPermissions can be assigned to to objects on an individual basis, or grouped into roles" + "description": "Each permission permits a certain type of operation on an object in the system\n\nPermissions can be assigned to objects on an individual basis, or grouped into roles" }, "PreprocessorId": { "anyOf": [ @@ -4450,6 +4683,54 @@ "type": "string", "description": "The webhook URL to send the request to" }, + "headers": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "value": { + "type": "string", + "maxLength": 8192, + "pattern": "^[\\t\\x20-\\x7e\\x80-\\xff]*$", + "description": "The HTTP header value" + } + }, + "required": ["name", "value"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "secret_name": { + "type": "string", + "format": "uuid", + "description": "The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for." + } + }, + "required": ["name", "secret_name"], + "additionalProperties": false + } + ] + }, + "maxItems": 20, + "description": "Custom HTTP headers to send with the webhook request" + }, "formatting_prompt": { "type": "string", "minLength": 1, @@ -4483,7 +4764,7 @@ "type": "string", "minLength": 1, "maxLength": 10000, - "description": "Publish a Slack mrkdwn digest.\n\nPattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say \"No current pattern outcomes.\" This requirement overrides conflicting formatting guidance.\n\nInclude a complete \"*Pattern outcomes*\" section with one row for every included Pattern.\n\nUse this row format exactly:\n• — `outcome`\n\nIf a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern.\n\nAfter the outcome list, include a \"*Highlights*\" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report." + "description": "Instructions for Loop to format content sent to this destination" } }, "required": ["type", "workspace_id", "channel"] @@ -4772,6 +5053,54 @@ "type": "string", "description": "The webhook URL to send the request to" }, + "headers": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "value": { + "type": "string", + "maxLength": 8192, + "pattern": "^[\\t\\x20-\\x7e\\x80-\\xff]*$", + "description": "The HTTP header value" + } + }, + "required": ["name", "value"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "secret_name": { + "type": "string", + "format": "uuid", + "description": "The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for." + } + }, + "required": ["name", "secret_name"], + "additionalProperties": false + } + ] + }, + "maxItems": 20, + "description": "Custom HTTP headers to send with the webhook request" + }, "formatting_prompt": { "type": "string", "minLength": 1, @@ -4805,7 +5134,7 @@ "type": "string", "minLength": 1, "maxLength": 10000, - "description": "Publish a Slack mrkdwn digest.\n\nPattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say \"No current pattern outcomes.\" This requirement overrides conflicting formatting guidance.\n\nInclude a complete \"*Pattern outcomes*\" section with one row for every included Pattern.\n\nUse this row format exactly:\n• — `outcome`\n\nIf a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern.\n\nAfter the outcome list, include a \"*Highlights*\" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report." + "description": "Instructions for Loop to format content sent to this destination" } }, "required": ["type", "workspace_id", "channel"] @@ -4915,11 +5244,11 @@ "type": "string", "format": "uuid" }, - "description": "Sorted ids of active projects in this project group" + "description": "Sorted ids of active projects in this project group. Modifying membership requires project_group:update on the group." } }, "required": ["id", "org_id", "name", "member_projects"], - "description": "A project group is a collection of projects which can inherit access from project-group ACLs" + "description": "A project group is a collection of projects which inherit access from project_group_projects ACLs. The group's definition and membership are governed separately by project_group ACLs." }, "ProjectLogsEvent": { "type": "object", @@ -4975,7 +5304,7 @@ "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 logs." + "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 ground 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 logs." }, "metadata": { "type": ["object", "null"], @@ -4983,6 +5312,14 @@ "model": { "type": ["string", "null"], "description": "The model used for this example" + }, + "requested_service_tier": { + "type": ["string", "null"], + "description": "The service tier requested for this LLM call" + }, + "served_service_tier": { + "type": ["string", "null"], + "description": "The service tier that served this LLM call" } }, "additionalProperties": {}, @@ -5019,13 +5356,13 @@ "description": "The total number of tokens in the input and output of the project logs event." }, "caller_functionname": { - "description": "This metric is deprecated" + "description": "Deprecated. Use `context.caller_functionname` instead." }, "caller_filename": { - "description": "This metric is deprecated" + "description": "Deprecated. Use `context.caller_filename` instead." }, "caller_lineno": { - "description": "This metric is deprecated" + "description": "Deprecated. Use `context.caller_lineno` instead." } }, "additionalProperties": { @@ -5054,7 +5391,7 @@ }, "span_id": { "type": "string", - "description": "A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing" + "description": "A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing" }, "span_parents": { "type": ["array", "null"], @@ -5455,113 +5792,347 @@ "type": ["boolean", "null"], "description": "If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them." }, - "default_preprocessor": { - "$ref": "#/components/schemas/NullableSavedFunctionId" - } - } - }, - "ProjectTag": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid", - "description": "Unique identifier for the project tag" - }, - "project_id": { - "type": "string", - "format": "uuid", - "description": "Unique identifier for the project that the project tag belongs under" - }, - "user_id": { - "type": "string", - "format": "uuid" - }, - "created": { - "type": ["string", "null"], - "format": "date-time", - "description": "Date of project tag creation" - }, - "name": { - "type": "string", - "description": "Name of the project tag" - }, - "description": { - "type": ["string", "null"], - "description": "Textual description of the project tag" - }, - "color": { - "type": ["string", "null"], - "description": "Color of the tag for the UI" - }, - "position": { - "type": ["string", "null"], - "description": "An optional LexoRank-based string that sets the sort position for the tag in the UI" - } - }, - "required": ["id", "project_id", "user_id", "name"], - "description": "A project tag is a user-configured tag for tracking and filtering your experiments, logs, and other data" - }, - "Prompt": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid", - "description": "Unique identifier for the prompt" - }, - "_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 prompt (see the `version` parameter)" - }, - "project_id": { - "type": "string", - "format": "uuid", - "description": "Unique identifier for the project that the prompt belongs under" - }, - "log_id": { - "type": "string", - "enum": ["p"], - "description": "A literal 'p' which identifies the object as a project prompt" - }, - "org_id": { - "type": "string", - "format": "uuid", - "description": "Unique identifier for the organization" - }, - "name": { - "type": "string", - "description": "Name of the prompt" - }, - "slug": { - "type": "string", - "description": "Unique identifier for the prompt" - }, - "description": { - "type": ["string", "null"], - "description": "Textual description of the prompt" - }, - "created": { - "type": ["string", "null"], - "format": "date-time", - "description": "Date of prompt creation" - }, - "prompt_data": { - "$ref": "#/components/schemas/PromptDataNullish" - }, - "tags": { + "user_id_fields": { "type": ["array", "null"], "items": { - "type": "string" - }, - "description": "A list of tags for the prompt" + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minItems": 2, + "maxItems": 32, + "description": "Path to the application's end-user identifier in metadata or span_attributes, for example [\"metadata\", \"customer_id\"]. This identifies an end user, not a session, request, organization, or the Braintrust user who created the project." + } }, - "metadata": { + "pattern_alert_mention": { "type": ["object", "null"], - "additionalProperties": {}, - "description": "User-controlled metadata about the prompt" - }, - "function_type": { + "properties": { + "workspace_id": { + "type": "string", + "minLength": 1 + }, + "mention_user_id": { + "type": "string", + "pattern": "^[UW][A-Z0-9]+$", + "description": "Slack member ID of the user or agent to mention in a Pattern alert's thread to investigate the pattern." + }, + "mention_handle": { + "type": "string", + "maxLength": 80, + "description": "Username shown for the selected user or agent. Mentions use mention_user_id." + }, + "mention_prompt": { + "type": "string", + "maxLength": 2000, + "pattern": "\\{\\{pattern\\}\\}", + "description": "Message posted after the mention in a Pattern alert's thread. {{pattern}} is replaced with a link to the pattern. Defaults to \"Please investigate this pattern: {{pattern}}. Review the evidence, identify the root cause, and suggest a fix.\"" + } + }, + "required": ["workspace_id", "mention_user_id"], + "description": "Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions." + }, + "pattern_alert_destinations": { + "type": ["array", "null"], + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["webhook"], + "description": "The type of action to take" + }, + "url": { + "type": "string", + "description": "The webhook URL to send the request to" + }, + "headers": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "value": { + "type": "string", + "maxLength": 8192, + "pattern": "^[\\t\\x20-\\x7e\\x80-\\xff]*$", + "description": "The HTTP header value" + } + }, + "required": ["name", "value"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "secret_name": { + "type": "string", + "format": "uuid", + "description": "The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for." + } + }, + "required": ["name", "secret_name"], + "additionalProperties": false + } + ] + }, + "maxItems": 20, + "description": "Custom HTTP headers to send with the webhook request" + }, + "formatting_prompt": { + "type": "string", + "minLength": 1, + "maxLength": 10000, + "description": "Instructions for Loop to format content sent to this destination" + } + }, + "required": ["type", "url"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["slack"], + "description": "The type of action to take" + }, + "workspace_id": { + "type": "string", + "description": "The Slack workspace ID to post to" + }, + "channel": { + "type": "string", + "description": "The Slack channel ID to post to" + }, + "message_template": { + "type": "string", + "description": "Custom message template for the alert" + }, + "formatting_prompt": { + "type": "string", + "minLength": 1, + "maxLength": 10000, + "description": "Instructions for Loop to format content sent to this destination" + } + }, + "required": ["type", "workspace_id", "channel"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["pagerduty"], + "description": "The type of action to take" + }, + "routing_key_secret_name": { + "type": "string", + "format": "uuid", + "description": "The data-plane secret containing the PagerDuty routing key" + }, + "severity": { + "type": "string", + "enum": ["critical", "error", "warning", "info"] + }, + "formatting_prompt": { + "type": "string", + "minLength": 1, + "maxLength": 10000, + "description": "Instructions for Loop to format content sent to this destination" + } + }, + "required": ["type", "routing_key_secret_name", "severity"] + } + ], + "description": "A delivery action available to an automation" + }, + "maxItems": 20, + "description": "Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts." + }, + "pattern_alert_min_severity": { + "type": ["string", "null"], + "enum": ["high", "medium", "low"], + "description": "Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium." + }, + "pattern_alert_informational": { + "type": ["boolean", "null"], + "description": "Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns." + }, + "pattern_sources": { + "type": ["array", "null"], + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "mcp_server_id": { + "type": "string", + "format": "uuid", + "description": "The project MCP server that reads this source." + }, + "instructions": { + "type": ["string", "null"], + "maxLength": 4000, + "description": "What the user wants Patterns to look for in this source, in their own words." + } + }, + "required": ["type", "mcp_server_id"] + }, + "maxItems": 10, + "description": "Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server." + }, + "pattern_excluded_categories": { + "type": ["array", "null"], + "items": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "maxItems": 64, + "description": "Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them." + }, + "session_id_fields": { + "type": ["array", "null"], + "items": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 256 + }, + "minItems": 2, + "maxItems": 32, + "description": "Path to the application's session or conversation identifier in metadata or span_attributes, for example [\"metadata\", \"conversation_id\"]. This links turns of one conversation across traces, rather than identifying a user, request, trace, organization, or service account." + } + }, + "default_preprocessor": { + "$ref": "#/components/schemas/NullableSavedFunctionId" + } + } + }, + "ProjectTag": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "Unique identifier for the project tag" + }, + "project_id": { + "type": "string", + "format": "uuid", + "description": "Unique identifier for the project that the project tag belongs under" + }, + "user_id": { + "type": "string", + "format": "uuid" + }, + "created": { + "type": ["string", "null"], + "format": "date-time", + "description": "Date of project tag creation" + }, + "name": { + "type": "string", + "description": "Name of the project tag" + }, + "description": { + "type": ["string", "null"], + "description": "Textual description of the project tag" + }, + "color": { + "type": ["string", "null"], + "description": "Color of the tag for the UI" + }, + "position": { + "type": ["string", "null"], + "description": "An optional LexoRank-based string that sets the sort position for the tag in the UI" + } + }, + "required": ["id", "project_id", "user_id", "name"], + "description": "A project tag is a user-configured tag for tracking and filtering your experiments, logs, and other data" + }, + "Prompt": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "Unique identifier for the prompt" + }, + "_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 prompt (see the `version` parameter)" + }, + "project_id": { + "type": "string", + "format": "uuid", + "description": "Unique identifier for the project that the prompt belongs under" + }, + "log_id": { + "type": "string", + "enum": ["p"], + "description": "A literal 'p' which identifies the object as a project prompt" + }, + "org_id": { + "type": "string", + "format": "uuid", + "description": "Unique identifier for the organization" + }, + "name": { + "type": "string", + "description": "Name of the prompt" + }, + "slug": { + "type": "string", + "description": "Unique identifier for the prompt" + }, + "description": { + "type": ["string", "null"], + "description": "Textual description of the prompt" + }, + "created": { + "type": ["string", "null"], + "format": "date-time", + "description": "Date of prompt creation" + }, + "prompt_data": { + "$ref": "#/components/schemas/PromptDataNullish" + }, + "tags": { + "type": ["array", "null"], + "items": { + "type": "string" + }, + "description": "A list of tags for the prompt" + }, + "metadata": { + "type": ["object", "null"], + "additionalProperties": {}, + "description": "User-controlled metadata about the prompt" + }, + "function_type": { "$ref": "#/components/schemas/FunctionTypeEnumNullish" } }, @@ -5610,6 +6181,140 @@ }, "required": ["type", "content"], "title": "completion" + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["decisions"] + }, + "input": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": ["system", "developer", "user", "assistant"] + }, + "content": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionContentPartText" + } + } + ] + } + }, + "required": ["role", "content"] + } + } + ] + }, + "questions": { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "instructions": { + "type": "string" + } + }, + "required": ["instructions"] + }, + { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["predicate"] + } + }, + "required": ["type"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["choice"] + }, + "choices": { + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ] + }, + "description": { + "type": "string" + } + }, + "required": ["value"] + } + } + }, + "required": ["type", "choices"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["score"] + }, + "levels": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": ["label"] + } + } + }, + "required": ["type", "levels"] + } + ] + } + ] + } + } + }, + "required": ["type", "input", "questions"], + "title": "decisions" } ] }, @@ -5649,6 +6354,140 @@ "required": ["type", "content"], "title": "completion" }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["decisions"] + }, + "input": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string", + "enum": ["system", "developer", "user", "assistant"] + }, + "content": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ChatCompletionContentPartText" + } + } + ] + } + }, + "required": ["role", "content"] + } + } + ] + }, + "questions": { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "instructions": { + "type": "string" + } + }, + "required": ["instructions"] + }, + { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["predicate"] + } + }, + "required": ["type"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["choice"] + }, + "choices": { + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "boolean" + } + ] + }, + "description": { + "type": "string" + } + }, + "required": ["value"] + } + } + }, + "required": ["type", "choices"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["score"] + }, + "levels": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": ["label"] + } + } + }, + "required": ["type", "levels"] + } + ] + } + ] + } + } + }, + "required": ["type", "input", "questions"], + "title": "decisions" + }, { "type": "null" } @@ -6231,7 +7070,8 @@ }, "_internal_btql": { "type": ["object", "null"], - "additionalProperties": {} + "additionalProperties": {}, + "description": "Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer." } }, "required": ["dataset_id"], @@ -6257,7 +7097,8 @@ }, "_internal_btql": { "type": ["object", "null"], - "additionalProperties": {} + "additionalProperties": {}, + "description": "Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer." } }, "required": ["project_name", "dataset_name"], @@ -6270,6 +7111,10 @@ "data": { "type": "array", "items": {} + }, + "source_dataset_id": { + "type": "string", + "description": "The saved dataset these rows came from. Its project scopes saved simulated-user references; the caller must have read access to the dataset and source project." } }, "required": ["data"], @@ -6349,7 +7194,7 @@ }, "timeout": { "type": ["number", "null"], - "description": "The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout." + "description": "The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default." }, "max_concurrency": { "type": ["number", "null"], @@ -6462,6 +7307,49 @@ } ] }, + "SavedPreprocessorId": { + "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": { + "type": "string", + "enum": ["preprocessor"], + "default": "preprocessor", + "description": "The type of global function. Defaults to 'preprocessor'." + } + }, + "required": ["type", "name"], + "title": "preprocessor_global" + } + ], + "description": "Saved preprocessor that renders traces for the project's pattern questions. The project default when unset." + }, "ScoreObject": { "type": "object", "properties": { @@ -6542,7 +7430,8 @@ "description": "Name of the service token" }, "preview_name": { - "type": "string" + "type": "string", + "description": "Masked preview showing the token prefix and last four characters, e.g. bt-st-…AbCd." }, "service_account_id": { "type": ["string", "null"], @@ -6562,6 +7451,11 @@ "format": "uuid", "description": "Unique identifier for the organization" }, + "last_used_at": { + "type": ["string", "null"], + "format": "date-time", + "description": "Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded." + }, "expires_at": { "type": ["string", "null"], "format": "date-time", @@ -6666,6 +7560,7 @@ "preprocessor", "classifier", "review", + "decision", "question", "log" ], @@ -6967,7 +7862,7 @@ "type": "string", "minLength": 1, "maxLength": 10000, - "description": "Publish a Slack mrkdwn digest.\n\nPattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say \"No current pattern outcomes.\" This requirement overrides conflicting formatting guidance.\n\nInclude a complete \"*Pattern outcomes*\" section with one row for every included Pattern.\n\nUse this row format exactly:\n• — `outcome`\n\nIf a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern.\n\nAfter the outcome list, include a \"*Highlights*\" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report." + "description": "Instructions for Loop to format content sent to this destination" } }, "required": ["type", "workspace_id", "channel"], @@ -7264,6 +8159,7 @@ "scorers", "classifiers", "logs", + "patterns", "monitor", "for_review_project_log", "for_review_experiments", @@ -7355,6 +8251,10 @@ "options": { "type": "object", "properties": { + "filterScope": { + "type": "string", + "enum": ["span", "trace"] + }, "spanType": { "type": ["string", "null"], "enum": ["range", "frame"] @@ -7573,12 +8473,16 @@ }, "product_origin": { "type": ["string", "null"], - "enum": ["patterns"], + "enum": ["patterns", "dashboard", "digest", "pattern_alerts"], "description": "The product surface that created and manages the automation" }, "status": { "$ref": "#/components/schemas/AutomationStatus" }, + "continuous": { + "type": "boolean", + "description": "Between scheduled runs, check for accumulated new work. The executor decides how to process it." + }, "threshold": { "type": "object", "properties": { @@ -7743,6 +8647,16 @@ "maxLength": 10000, "description": "Instructions for the Loop agent" }, + "digest": { + "type": "object", + "properties": { + "writing_style": { + "type": "string", + "enum": ["compact", "detailed"] + } + }, + "required": ["writing_style"] + }, "include_trigger_input": { "type": "boolean", "default": false, @@ -7764,13 +8678,13 @@ }, "harness": { "type": "string", - "enum": ["codex", "native", "claude-code"], - "description": "Required when saving a Loop automation. Currently only Codex is supported." + "enum": ["native", "codex", "claude-code", "pi"], + "description": "Required for an explicit model selection. Currently only Codex is supported." }, "model": { "type": "string", "minLength": 1, - "description": "Required when saving a Loop automation." + "description": "Omit harness, model, and endpoint_name to inherit the organization default provider and its recommended execution settings." }, "endpoint_name": { "type": "string", @@ -7787,11 +8701,35 @@ "xhigh", "max" ] + }, + "target": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["dashboard"] + }, + "id": { + "type": "string", + "enum": ["overview"] + } + }, + "required": ["type", "id"], + "description": "The object this automation writes to or maintains" } }, "required": ["prompt", "agent_slug"], "description": "Optional Loop agent to run for each triggered window" }, + "patterns": { + "type": "object", + "properties": { + "preprocessor": { + "$ref": "#/components/schemas/SavedPreprocessorId" + } + }, + "description": "Settings of the Patterns automation" + }, "actions": { "type": "array", "items": { @@ -7808,6 +8746,54 @@ "type": "string", "description": "The webhook URL to send the request to" }, + "headers": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "value": { + "type": "string", + "maxLength": 8192, + "pattern": "^[\\t\\x20-\\x7e\\x80-\\xff]*$", + "description": "The HTTP header value" + } + }, + "required": ["name", "value"], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$", + "description": "The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used." + }, + "secret_name": { + "type": "string", + "format": "uuid", + "description": "The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for." + } + }, + "required": ["name", "secret_name"], + "additionalProperties": false + } + ] + }, + "maxItems": 20, + "description": "Custom HTTP headers to send with the webhook request" + }, "formatting_prompt": { "type": "string", "minLength": 1, @@ -7841,7 +8827,7 @@ "type": "string", "minLength": 1, "maxLength": 10000, - "description": "Publish a Slack mrkdwn digest.\n\nPattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say \"No current pattern outcomes.\" This requirement overrides conflicting formatting guidance.\n\nInclude a complete \"*Pattern outcomes*\" section with one row for every included Pattern.\n\nUse this row format exactly:\n• — `outcome`\n\nIf a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern.\n\nAfter the outcome list, include a \"*Highlights*\" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report." + "description": "Instructions for Loop to format content sent to this destination" } }, "required": ["type", "workspace_id", "channel"] diff --git a/js/src/generated_plain_types.ts b/js/src/generated_plain_types.ts index 708be55a2..d8e09d397 100644 --- a/js/src/generated_plain_types.ts +++ b/js/src/generated_plain_types.ts @@ -1,4 +1,4 @@ -// Auto-generated file (content hash 387034529ea006a9) -- do not modify +// Auto-generated file (content hash 10e789e597c8e600) -- do not modify export type AclObjectTypeType = /** @@ -39,7 +39,7 @@ export type PermissionType = /** * Each permission permits a certain type of operation on an object in the system -Permissions can be assigned to to objects on an individual basis, or grouped into roles +Permissions can be assigned to objects on an individual basis, or grouped into roles * * @enum create, read, update, delete, create_acls, read_acls, update_acls, delete_acls */ @@ -90,10 +90,11 @@ export type AclType = { ) | undefined; permission?: - | (PermissionType & + | (PermissionType + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + */ & /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ /** * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ (| string @@ -104,10 +105,11 @@ export type AclType = { )) | undefined; restrict_object_type?: - | (AclObjectTypeType & - /** - * When setting a permission directly, optionally restricts the permission grant to just the specified object type. Cannot be set alongside a `role_id`. - */ unknown) + | (AclObjectTypeType + /** + * When setting a permission directly, optionally restricts the permission grant to just the specified object type. Cannot be set alongside a `role_id`. + */ & + unknown) | undefined; role_id?: | /** @@ -166,6 +168,20 @@ export type AgentType = { | null ) | undefined; + deleted_at?: + | /** + * Date of agent deletion, or null if the agent is still active + */ + /** + * Date of agent deletion, or null if the agent is still active + */ + (| string + /** + * Date of agent deletion, or null if the agent is still active + */ + | null + ) + | undefined; /** * Name of the agent. Within a project, agent names are unique */ @@ -199,12 +215,10 @@ export type AgentType = { /** * User-controlled metadata about the agent */ - (| {} - /** - * User-controlled metadata about the agent - */ - | null - ) + ({} + /** + * User-controlled metadata about the agent + */ | null) | undefined; }; export type AISecretType = { @@ -312,9 +326,9 @@ export type AnyModelParamsType = { top_p?: number | undefined; max_tokens: number; max_completion_tokens?: /** - * The successor to max_tokens - */ - number | undefined; + * The successor to max_tokens + */ + number | undefined; frequency_penalty?: number | undefined; presence_penalty?: number | undefined; response_format?: ResponseFormatNullishType | undefined; @@ -381,14 +395,15 @@ export type AnyModelParamsType = { */ ("low" | "medium" | "high") | undefined; + service_tier?: string | undefined; top_k?: number | undefined; stop_sequences?: Array | undefined; reasoning_enabled?: boolean | undefined; reasoning_budget?: number | undefined; max_tokens_to_sample?: /** - * This is a legacy parameter that should not be used. - */ - number | undefined; + * This is a legacy parameter that should not be used. + */ + number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; topK?: number | undefined; @@ -417,6 +432,9 @@ export type ApiKeyType = { * Name of the api key */ name: string; + /** + * Masked preview showing the key prefix and last four characters, e.g. sk-…AbCd. + */ preview_name: string; user_id?: | /** @@ -488,6 +506,20 @@ export type ApiKeyType = { | null ) | undefined; + last_used_at?: + | /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + (| string + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + | null + ) + | undefined; expires_at?: | /** * Date at which the API key expires. If null, the key never expires. @@ -600,6 +632,7 @@ export type AsyncScoringControlType = */ kind: "score_update"; token?: string | undefined; + triggered_xact_id?: string | undefined; } | { /** @@ -722,9 +755,9 @@ export type UploadStatusType = export type AttachmentStatusType = { upload_status: UploadStatusType; error_message?: /** - * Describes the error encountered while uploading. - */ - string | undefined; + * Describes the error encountered while uploading. + */ + string | undefined; }; export type AutomationStatusType = /** @@ -762,9 +795,9 @@ export type FacetPreprocessorIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -795,9 +828,9 @@ export type SavedFunctionIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -833,32 +866,33 @@ export type TopicMapDataType = { */ source_facet: string; source_facet_function?: - | (SavedFunctionIdType & - /** - * The stable function reference for the source facet - */ unknown) + | (SavedFunctionIdType + /** + * The stable function reference for the source facet + */ & + unknown) | undefined; /** * The embedding model to use for embedding facet values */ embedding_model: string; bundle_key?: /** - * Key of the topic map bundle in code_bundles bucket - */ - string | undefined; + * Key of the topic map bundle in code_bundles bucket + */ + string | undefined; report_key?: /** - * Key of the clustering report in code_bundles bucket - */ - string | undefined; + * Key of the clustering report in code_bundles bucket + */ + string | undefined; topic_names?: /** - * Mapping from topic_id to topic name - */ - {} | undefined; + * Mapping from topic_id to topic name + */ + {} | undefined; generation_settings?: TopicMapGenerationSettingsType | undefined; disable_reconciliation?: /** - * Whether new topic generation should ignore the previously saved report during reconciliation. Defaults to false when omitted. - */ - boolean | undefined; + * Whether new topic generation should ignore the previously saved report during reconciliation. Defaults to false when omitted. + */ + boolean | undefined; reconcile_mode?: | /** * How reconciliation carries the previous map forward: "evolve" re-routes new samples into the previous topics before naming; "names_only" keeps the fresh clustering and carries only topic ids/names. Defaults to "names_only" when omitted. @@ -868,17 +902,17 @@ export type TopicMapDataType = { ("evolve" | "names_only") | undefined; distance_threshold?: /** - * Maximum distance to nearest centroid. If exceeded, returns no_match. - */ - number | undefined; + * Maximum distance to nearest centroid. If exceeded, returns no_match. + */ + number | undefined; btql_filter?: /** - * Per-topic-map BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. - */ - string | undefined; + * Per-topic-map BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. + */ + string | undefined; automation_btql_filter?: /** - * Automation-level BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. - */ - string | undefined; + * Automation-level BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. + */ + string | undefined; }; export type BatchedFacetDataType = { /** @@ -896,22 +930,22 @@ export type BatchedFacetDataType = { */ prompt: string; model?: /** - * The model to use for facet extraction - */ - string | undefined; + * The model to use for facet extraction + */ + string | undefined; embedding_model?: /** - * The embedding model to use for vectorizing facet results. - */ - string | undefined; + * The embedding model to use for vectorizing facet results. + */ + string | undefined; no_match_pattern?: /** - * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' - */ - string | undefined; + * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' + */ + string | undefined; }>; topic_maps?: /** - * Topic maps that depend on facets in this batch, keyed by source facet name. Each source facet can have multiple topic maps. - */ - {} | undefined; + * Topic maps that depend on facets in this batch, keyed by source facet name. Each source facet can have multiple topic maps. + */ + {} | undefined; }; export type BraintrustModelParamsType = Partial<{ use_cache: boolean; @@ -1152,9 +1186,9 @@ export type ChatCompletionMessageReasoningType = Partial<{ export type ChatCompletionMessageParamType = | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum system */ @@ -1163,9 +1197,9 @@ export type ChatCompletionMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum user */ @@ -1193,9 +1227,9 @@ export type ChatCompletionMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum tool */ @@ -1215,9 +1249,9 @@ export type ChatCompletionMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum developer */ @@ -1234,9 +1268,9 @@ export type ChatCompletionMessageParamType = export type ChatCompletionOpenAIMessageParamType = | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum system */ @@ -1245,9 +1279,9 @@ export type ChatCompletionOpenAIMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum user */ @@ -1275,9 +1309,9 @@ export type ChatCompletionOpenAIMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum tool */ @@ -1297,9 +1331,9 @@ export type ChatCompletionOpenAIMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum developer */ @@ -1382,7 +1416,7 @@ export type CodeBundleType = { */ provider: "modal"; /** - * sandbox snapshot ref + * The Modal snapshot to start the sandbox from */ snapshot_ref: string; } @@ -1393,18 +1427,18 @@ export type CodeBundleType = { provider: "lambda"; }; entrypoints?: /** - * Which entrypoints to execute in the sandbox - */ - Array | undefined; + * Which entrypoints to execute in the sandbox + */ + Array | undefined; eval_name: string; parameters?: /** - * Parameter values for sandbox eval execution - */ - {} | undefined; + * Parameter values for sandbox eval execution + */ + {} | undefined; evaluator_definition?: /** - * Definition of current evaluator with parameters - */ - unknown | undefined; + * Definition of current evaluator with parameters + */ + unknown | undefined; }; bundle_id?: (string | null) | undefined; preview?: @@ -1498,12 +1532,10 @@ export type DatasetType = { /** * A list of tags for the dataset */ - (| Array - /** - * A list of tags for the dataset - */ - | null - ) + (Array + /** + * A list of tags for the dataset + */ | null) | undefined; metadata?: | /** @@ -1512,12 +1544,10 @@ export type DatasetType = { /** * User-controlled metadata about the dataset */ - (| {} - /** - * User-controlled metadata about the dataset - */ - | null - ) + ({} + /** + * User-controlled metadata about the dataset + */ | null) | undefined; /** * URL slug for the dataset. used to construct dataset URLs @@ -1531,60 +1561,59 @@ export type ObjectReferenceNullishType = /** * Indicates the event was copied from another object. */ - | { - /** - * Type of the object the event is originating from. - * - * @enum project_logs, experiment, dataset, prompt, function, prompt_session + { + /** + * Type of the object the event is originating from. + * + * @enum project_logs, experiment, dataset, prompt, function, prompt_session + */ + object_type: + | "project_logs" + | "experiment" + | "dataset" + | "prompt" + | "function" + | "prompt_session"; + /** + * ID of the object the event is originating from. + */ + object_id: string; + /** + * ID of the original event. + */ + id: string; + _xact_id?: + | /** + * Transaction ID of the original event. */ - object_type: - | "project_logs" - | "experiment" - | "dataset" - | "prompt" - | "function" - | "prompt_session"; /** - * ID of the object the event is originating from. + * Transaction ID of the original event. + */ + (| string + /** + * Transaction ID of the original event. + */ + | null + ) + | undefined; + created?: + | /** + * Created timestamp of the original event. Used to help sort in the UI */ - object_id: string; /** - * ID of the original event. + * Created timestamp of the original event. Used to help sort in the UI */ - id: string; - _xact_id?: - | /** - * Transaction ID of the original event. - */ - /** - * Transaction ID of the original event. - */ - (| string - /** - * Transaction ID of the original event. - */ - | null - ) - | undefined; - created?: - | /** - * Created timestamp of the original event. Used to help sort in the UI - */ - /** - * Created timestamp of the original event. Used to help sort in the UI - */ - (| string - /** - * Created timestamp of the original event. Used to help sort in the UI - */ - | null - ) - | undefined; - } + (| string + /** + * Created timestamp of the original event. Used to help sort in the UI + */ + | null + ) + | undefined; + } /** * Indicates the event was copied from another object. - */ - | null; + */ | null; export type DatasetEventType = { /** * A unique identifier for the dataset event. If you don't provide one, Braintrust will generate one for you @@ -1621,13 +1650,13 @@ export type DatasetEventType = { */ dataset_id: string; input?: /** - * The argument that uniquely define an input case (an arbitrary, JSON serializable object) - */ - unknown | undefined; + * The argument that uniquely define an input case (an arbitrary, JSON serializable object) + */ + unknown | undefined; expected?: /** - * The output of your application, including post-processing (an arbitrary, JSON serializable object) - */ - unknown | undefined; + * The output of your application, including post-processing (an arbitrary, JSON serializable object) + */ + unknown | undefined; 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'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 @@ -1635,28 +1664,48 @@ export type DatasetEventType = { /** * 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 */ - (| Partial< - { - /** - * The model used for this example - */ - model: /** - * The model used for this example - */ - | string - /** - * The model used for this example - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) + (Partial< + { + /** + * The model used for this example + */ + model: /** + * The model used for this example + */ + | string + /** + * The model used for this example + */ + | null; + /** + * The service tier requested for this LLM call + */ + requested_service_tier: /** + * The service tier requested for this LLM call + */ + | string + /** + * The service tier requested for this LLM call + */ + | null; + /** + * The service tier that served this LLM call + */ + served_service_tier: /** + * The service tier that served this LLM call + */ + | string + /** + * The service tier that served this LLM call + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) | undefined; tags?: | /** @@ -1665,15 +1714,13 @@ export type DatasetEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; /** - * A unique identifier used to link different dataset events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing + * A unique identifier used to link different dataset events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing */ span_id: string; /** @@ -1702,12 +1749,10 @@ export type DatasetEventType = { /** * Optional list of comments attached to this event */ - (| Array - /** - * Optional list of comments attached to this event - */ - | null - ) + (Array + /** + * Optional list of comments attached to this event + */ | null) | undefined; audit_data?: | /** @@ -1716,12 +1761,10 @@ export type DatasetEventType = { /** * Optional list of audit entries attached to this event */ - (| Array - /** - * Optional list of audit entries attached to this event - */ - | null - ) + (Array + /** + * Optional list of audit entries attached to this event + */ | null) | undefined; facets?: | /** @@ -1730,12 +1773,10 @@ export type DatasetEventType = { /** * Facets for categorization (dictionary from facet id to value) */ - (| {} - /** - * Facets for categorization (dictionary from facet id to value) - */ - | null - ) + ({} + /** + * Facets for categorization (dictionary from facet id to value) + */ | null) | undefined; classifications?: | /** @@ -1744,12 +1785,10 @@ export type DatasetEventType = { /** * Classifications for this event (dictionary from classification name to items) */ - (| {} - /** - * Classifications for this event (dictionary from classification name to items) - */ - | null - ) + ({} + /** + * Classifications for this event (dictionary from classification name to items) + */ | null) | undefined; }; export type DatasetSnapshotType = { @@ -1767,16 +1806,16 @@ export type DatasetSnapshotType = { name: string; description: string | null; /** - * Transaction id of the brainstore version at the time of the snapshot + * Transaction ID of the dataset version at the time of the snapshot */ xact_id: string; /** * Date of dataset snapshot creation */ created: /** - * Date of dataset snapshot creation - */ - | string + * Date of dataset snapshot creation + */ + | string /** * Date of dataset snapshot creation */ @@ -1864,12 +1903,10 @@ export type EnvVarType = { /** * Optional metadata associated with the environment variable when managed via the function secrets API */ - (| {} - /** - * Optional metadata associated with the environment variable when managed via the function secrets API - */ - | null - ) + ({} + /** + * Optional metadata associated with the environment variable when managed via the function secrets API + */ | null) | undefined; preview_secret?: | /** @@ -1900,7 +1937,7 @@ export type EnvVarType = { ) | undefined; /** - * The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys + * The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys, sandbox_provider for sandbox provider credentials, automation_integration for automation delivery credentials * * @default "env_var" * @enum env_var, ai_provider, sandbox_provider, automation_integration @@ -1918,111 +1955,110 @@ export type RepoInfoType = /** * Metadata about the state of the repo when the experiment was created */ - | Partial<{ - /** - * SHA of most recent commit + Partial<{ + /** + * SHA of most recent commit + */ + commit: /** + * SHA of most recent commit + */ + | string + /** + * SHA of most recent commit */ - commit: /** - * SHA of most recent commit - */ - | string - /** - * SHA of most recent commit - */ - | null; + | null; + /** + * Name of the branch the most recent commit belongs to + */ + branch: /** + * Name of the branch the most recent commit belongs to + */ + | string /** * Name of the branch the most recent commit belongs to */ - branch: /** - * Name of the branch the most recent commit belongs to - */ - | string - /** - * Name of the branch the most recent commit belongs to - */ - | null; + | null; + /** + * Name of the tag on the most recent commit + */ + tag: /** + * Name of the tag on the most recent commit + */ + | string /** * Name of the tag on the most recent commit */ - tag: /** - * Name of the tag on the most recent commit - */ - | string - /** - * Name of the tag on the most recent commit - */ - | null; + | null; + /** + * Whether or not the repo had uncommitted changes when snapshotted + */ + dirty: /** + * Whether or not the repo had uncommitted changes when snapshotted + */ + | boolean /** * Whether or not the repo had uncommitted changes when snapshotted */ - dirty: /** - * Whether or not the repo had uncommitted changes when snapshotted - */ - | boolean - /** - * Whether or not the repo had uncommitted changes when snapshotted - */ - | null; + | null; + /** + * Name of the author of the most recent commit + */ + author_name: /** + * Name of the author of the most recent commit + */ + | string /** * Name of the author of the most recent commit */ - author_name: /** - * Name of the author of the most recent commit - */ - | string - /** - * Name of the author of the most recent commit - */ - | null; + | null; + /** + * Email of the author of the most recent commit + */ + author_email: /** + * Email of the author of the most recent commit + */ + | string /** * Email of the author of the most recent commit */ - author_email: /** - * Email of the author of the most recent commit - */ - | string - /** - * Email of the author of the most recent commit - */ - | null; + | null; + /** + * Most recent commit message + */ + commit_message: /** + * Most recent commit message + */ + | string /** * Most recent commit message */ - commit_message: /** - * Most recent commit message - */ - | string - /** - * Most recent commit message - */ - | null; + | null; + /** + * Time of the most recent commit + */ + commit_time: /** + * Time of the most recent commit + */ + | string /** * Time of the most recent commit */ - commit_time: /** - * Time of the most recent commit - */ - | string - /** - * Time of the most recent commit - */ - | null; + | null; + /** + * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. + */ + git_diff: /** + * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. + */ + | string /** * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. */ - git_diff: /** - * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. - */ - | string - /** - * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. - */ - | null; - }> + | null; + }> /** * Metadata about the state of the repo when the experiment was created - */ - | null; + */ | null; export type ExperimentType = { /** * Unique identifier for the experiment @@ -2142,28 +2178,25 @@ export type ExperimentType = { /** * Braintrust-controlled metadata about the experiment. */ - (| Partial< - { - /** - * BTQL filter payload used to evaluate a subset of a linked dataset. - */ - dataset_filter: /** - * BTQL filter payload used to evaluate a subset of a linked dataset. - */ - | {} - /** - * BTQL filter payload used to evaluate a subset of a linked dataset. - */ - | null; - } & { - [key: string]: any; - } - > - /** - * Braintrust-controlled metadata about the experiment. - */ - | null - ) + (Partial< + { + /** + * BTQL filter payload used to evaluate a subset of a linked dataset. + */ + dataset_filter: /** + * BTQL filter payload used to evaluate a subset of a linked dataset. + */ + {} + /** + * BTQL filter payload used to evaluate a subset of a linked dataset. + */ | null; + } & { + [key: string]: any; + } + > + /** + * Braintrust-controlled metadata about the experiment. + */ | null) | undefined; parameters_id?: | /** @@ -2218,12 +2251,10 @@ export type ExperimentType = { /** * User-controlled metadata about the experiment */ - (| {} - /** - * User-controlled metadata about the experiment - */ - | null - ) + ({} + /** + * User-controlled metadata about the experiment + */ | null) | undefined; tags?: | /** @@ -2232,24 +2263,22 @@ export type ExperimentType = { /** * A list of tags for the experiment */ - (| Array - /** - * A list of tags for the experiment - */ - | null - ) + (Array + /** + * A list of tags for the experiment + */ | null) | undefined; }; export type SpanTypeType = /** * Type of the span, for display purposes only * - * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, question, log + * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, decision, question, log */ | /** * Type of the span, for display purposes only * - * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, question, log + * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, decision, question, log */ (| "llm" | "score" @@ -2262,13 +2291,14 @@ export type SpanTypeType = | "preprocessor" | "classifier" | "review" + | "decision" | "question" | "log" ) /** * Type of the span, for display purposes only * - * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, question, log + * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, decision, question, log */ | null; export type SpanAttributesType = @@ -2278,64 +2308,63 @@ export type SpanAttributesType = /** * Human-identifying attributes of the span, such as name, type, etc. */ - | Partial< - { + Partial< + { + /** + * Name of the span, for display purposes only + */ + name: /** + * Name of the span, for display purposes only + */ + | string /** * Name of the span, for display purposes only */ - name: /** - * Name of the span, for display purposes only - */ - | string - /** - * Name of the span, for display purposes only - */ - | null; - type: SpanTypeType; + | null; + type: SpanTypeType; + /** + * A special value that indicates the span was generated by a scoring automation + * + * @enum scorer + */ + purpose: + | /** + * A special value that indicates the span was generated by a scoring automation + * + * @enum scorer + */ + "scorer" /** * A special value that indicates the span was generated by a scoring automation * * @enum scorer */ - purpose: - | /** - * A special value that indicates the span was generated by a scoring automation - * - * @enum scorer - */ - "scorer" - /** - * A special value that indicates the span was generated by a scoring automation - * - * @enum scorer - */ - | null; + | null; + /** + * Severity level of a log + * + * @enum trace, debug, info, warn, error, fatal + */ + log_level: + | /** + * Severity level of a log + * + * @enum trace, debug, info, warn, error, fatal + */ + ("trace" | "debug" | "info" | "warn" | "error" | "fatal") /** * Severity level of a log * * @enum trace, debug, info, warn, error, fatal */ - log_level: - | /** - * Severity level of a log - * - * @enum trace, debug, info, warn, error, fatal - */ - ("trace" | "debug" | "info" | "warn" | "error" | "fatal") - /** - * Severity level of a log - * - * @enum trace, debug, info, warn, error, fatal - */ - | null; - } & { - [key: string]: any; - } - > + | null; + } & { + [key: string]: any; + } + > /** * Human-identifying attributes of the span, such as name, type, etc. - */ - | null; + */ | null; export type ExperimentEventType = { /** * A unique identifier for the experiment event. If you don't provide one, Braintrust will generate one for you @@ -2372,34 +2401,32 @@ export type ExperimentEventType = { */ experiment_id: string; input?: /** - * 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 - */ - unknown | undefined; + * 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 + */ + unknown | undefined; 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 `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 - */ - unknown | undefined; + * 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 + */ + unknown | undefined; expected?: /** - * 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 - */ - unknown | undefined; + * 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 + */ + unknown | undefined; error?: /** - * The error that occurred, if any. - */ - unknown | undefined; + * The error that occurred, if any. + */ + unknown | undefined; 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 + * 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 ground 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. */ /** - * 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 + * 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 ground 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. */ - (| {} - /** - * 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 - */ - | null - ) + ({} + /** + * 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 ground 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. + */ | null) | undefined; metadata?: | /** @@ -2408,28 +2435,48 @@ export type ExperimentEventType = { /** * 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 */ - (| Partial< - { - /** - * The model used for this example - */ - model: /** - * The model used for this example - */ - | string - /** - * The model used for this example - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) + (Partial< + { + /** + * The model used for this example + */ + model: /** + * The model used for this example + */ + | string + /** + * The model used for this example + */ + | null; + /** + * The service tier requested for this LLM call + */ + requested_service_tier: /** + * The service tier requested for this LLM call + */ + | string + /** + * The service tier requested for this LLM call + */ + | null; + /** + * The service tier that served this LLM call + */ + served_service_tier: /** + * The service tier that served this LLM call + */ + | string + /** + * The service tier that served this LLM call + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) | undefined; tags?: | /** @@ -2438,12 +2485,10 @@ export type ExperimentEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; metrics?: | /** @@ -2468,70 +2513,66 @@ export type ExperimentEventType = { /** * 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 */ - (| Partial< - { - /** - * The function in code which created the experiment event - */ - caller_functionname: /** - * The function in code which created the experiment event - */ - | string - /** - * The function in code which created the experiment event - */ - | null; - /** - * Name of the file in code where the experiment event was created - */ - caller_filename: /** - * Name of the file in code where the experiment event was created - */ - | string - /** - * Name of the file in code where the experiment event was created - */ - | null; - /** - * Line of code where the experiment event was created - */ - caller_lineno: /** - * Line of code where the experiment event was created - */ - | number - /** - * Line of code where the experiment event was created - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) - | undefined; - /** - * 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_id: string; - span_parents?: - | /** - * 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 - */ - /** - * 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 - */ - (| Array - /** - * 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 - */ - | null - ) - | undefined; - /** + (Partial< + { + /** + * The function in code which created the experiment event + */ + caller_functionname: /** + * The function in code which created the experiment event + */ + | string + /** + * The function in code which created the experiment event + */ + | null; + /** + * Name of the file in code where the experiment event was created + */ + caller_filename: /** + * Name of the file in code where the experiment event was created + */ + | string + /** + * Name of the file in code where the experiment event was created + */ + | null; + /** + * Line of code where the experiment event was created + */ + caller_lineno: /** + * Line of code where the experiment event was created + */ + | number + /** + * Line of code where the experiment event was created + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) + | undefined; + /** + * A unique identifier used to link different experiment events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing + */ + span_id: string; + span_parents?: + | /** + * 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 + */ + /** + * 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 + */ + (Array + /** + * 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 + */ | null) + | undefined; + /** * A unique identifier for the trace this experiment event belongs to */ root_span_id: string; @@ -2558,12 +2599,10 @@ export type ExperimentEventType = { /** * Optional list of comments attached to this event */ - (| Array - /** - * Optional list of comments attached to this event - */ - | null - ) + (Array + /** + * Optional list of comments attached to this event + */ | null) | undefined; audit_data?: | /** @@ -2572,12 +2611,10 @@ export type ExperimentEventType = { /** * Optional list of audit entries attached to this event */ - (| Array - /** - * Optional list of audit entries attached to this event - */ - | null - ) + (Array + /** + * Optional list of audit entries attached to this event + */ | null) | undefined; facets?: | /** @@ -2586,12 +2623,10 @@ export type ExperimentEventType = { /** * Facets for categorization (dictionary from facet id to value) */ - (| {} - /** - * Facets for categorization (dictionary from facet id to value) - */ - | null - ) + ({} + /** + * Facets for categorization (dictionary from facet id to value) + */ | null) | undefined; classifications?: | /** @@ -2600,12 +2635,10 @@ export type ExperimentEventType = { /** * Classifications for this event (dictionary from classification name to items) */ - (| {} - /** - * Classifications for this event (dictionary from classification name to items) - */ - | null - ) + ({} + /** + * Classifications for this event (dictionary from classification name to items) + */ | null) | undefined; }; export type ExtendedSavedFunctionIdType = @@ -2616,9 +2649,9 @@ export type ExtendedSavedFunctionIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -2647,17 +2680,17 @@ export type FacetDataType = { */ prompt: string; model?: /** - * The model to use for facet extraction - */ - string | undefined; + * The model to use for facet extraction + */ + string | undefined; embedding_model?: /** - * The embedding model to use for vectorizing facet results. - */ - string | undefined; + * The embedding model to use for vectorizing facet results. + */ + string | undefined; no_match_pattern?: /** - * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' - */ - string | undefined; + * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' + */ + string | undefined; }; export type PromptBlockDataNullishType = | { @@ -2675,6 +2708,54 @@ export type PromptBlockDataNullishType = type: "completion"; content: string; } + | { + /** + * @enum decisions + */ + type: "decisions"; + input: + | string + | Array<{ + /** + * @enum system, developer, user, assistant + */ + role: "system" | "developer" | "user" | "assistant"; + content: string | Array; + }>; + questions: Array< + { + name?: string | undefined; + instructions: string; + } & ( + | { + /** + * @enum predicate + */ + type: "predicate"; + } + | { + /** + * @enum choice + */ + type: "choice"; + choices: Array<{ + value: string | boolean; + description?: string | undefined; + }>; + } + | { + /** + * @enum score + */ + type: "score"; + levels: Array<{ + label: string; + description?: string | undefined; + }>; + } + ) + >; + } | null; export type ModelParamsType = | Partial< @@ -2743,6 +2824,7 @@ export type ModelParamsType = * @enum low, medium, high */ verbosity: "low" | "medium" | "high"; + service_tier: string; } & { [key: string]: any; } @@ -2757,9 +2839,9 @@ export type ModelParamsType = top_k?: number | undefined; stop_sequences?: Array | undefined; max_tokens_to_sample?: /** - * This is a legacy parameter that should not be used. - */ - number | undefined; + * This is a legacy parameter that should not be used. + */ + number | undefined; } & { [key: string]: any; }) @@ -2809,21 +2891,21 @@ export type PromptParserNullishType = { type: "llm_classifier"; use_cot: boolean; choice_scores?: /** - * Map of choices to scores (0-1). Used by scorers. - */ - {} | undefined; + * Map of choices to scores (0-1). Used by scorers. + */ + {} | undefined; choice?: /** - * List of valid choices without score mapping. Used by classifiers that deposit output to tags. - */ - Array | undefined; + * List of valid choices without score mapping. Used by classifiers that deposit output to tags. + */ + Array | undefined; allow_no_match?: /** - * If true, adds a 'No match' option. When selected, no tag is deposited. - */ - boolean | undefined; + * If true, adds a 'No match' option. When selected, no tag is deposited. + */ + boolean | undefined; allow_skip?: /** - * If true, adds a 'Skip' option. When selected, the scorer returns null. - */ - boolean | undefined; + * If true, adds a 'Skip' option. When selected, the scorer returns null. + */ + boolean | undefined; } | null; export type PreprocessorIdType = /** @@ -2836,9 +2918,9 @@ export type PreprocessorIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -2874,35 +2956,34 @@ export type PromptDataNullishType = /** * The prompt, model, and its parameters */ - | Partial<{ - prompt: PromptBlockDataNullishType; - options: PromptOptionsNullishType; - parser: PromptParserNullishType; - preprocessor: PreprocessorIdType; - tool_functions: Array | null; + Partial<{ + prompt: PromptBlockDataNullishType; + options: PromptOptionsNullishType; + parser: PromptParserNullishType; + preprocessor: PreprocessorIdType; + tool_functions: Array | null; + /** + * @enum mustache, nunjucks, none + */ + template_format: + | /** + * @enum mustache, nunjucks, none + */ + ("mustache" | "nunjucks" | "none") /** * @enum mustache, nunjucks, none */ - template_format: - | /** - * @enum mustache, nunjucks, none - */ - ("mustache" | "nunjucks" | "none") - /** - * @enum mustache, nunjucks, none - */ - | null; - mcp: {} | null; - origin: Partial<{ - prompt_id: string; - project_id: string; - prompt_version: string; - }> | null; - }> + | null; + mcp: {} | null; + origin: Partial<{ + prompt_id: string; + project_id: string; + prompt_version: string; + }> | null; + }> /** * The prompt, model, and its parameters - */ - | null; + */ | null; export type FunctionTypeEnumNullishType = /** * @enum llm, scorer, task, tool, custom_view, preprocessor, facet, classifier, tag, parameters, sandbox @@ -2946,6 +3027,54 @@ export type PromptBlockDataType = */ type: "completion"; content: string; + } + | { + /** + * @enum decisions + */ + type: "decisions"; + input: + | string + | Array<{ + /** + * @enum system, developer, user, assistant + */ + role: "system" | "developer" | "user" | "assistant"; + content: string | Array; + }>; + questions: Array< + { + name?: string | undefined; + instructions: string; + } & ( + | { + /** + * @enum predicate + */ + type: "predicate"; + } + | { + /** + * @enum choice + */ + type: "choice"; + choices: Array<{ + value: string | boolean; + description?: string | undefined; + }>; + } + | { + /** + * @enum score + */ + type: "score"; + levels: Array<{ + label: string; + description?: string | undefined; + }>; + } + ) + >; }; export type GraphNodeType = | { @@ -2970,21 +3099,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum function @@ -3014,21 +3141,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * The input to the graph @@ -3059,21 +3184,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * The output of the graph @@ -3104,30 +3227,28 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum literal */ type: "literal"; value?: /** - * A literal value to be returned - */ - unknown | undefined; + * A literal value to be returned + */ + unknown | undefined; } | { description?: @@ -3151,21 +3272,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum btql @@ -3198,21 +3317,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum gate @@ -3255,21 +3372,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum aggregator @@ -3298,21 +3413,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum prompt_template @@ -3387,9 +3500,9 @@ export type FunctionDataType = }; code: string; code_hash?: /** - * SHA256 hash of the code, computed at save time - */ - string | undefined; + * SHA256 hash of the code, computed at save time + */ + string | undefined; }; } | GraphDataType @@ -3433,12 +3546,10 @@ export type FunctionDataType = /** * Configuration options to pass to the global function (e.g., for preprocessor customization) */ - (| {} - /** - * Configuration options to pass to the global function (e.g., for preprocessor customization) - */ - | null - ) + ({} + /** + * Configuration options to pass to the global function (e.g., for preprocessor customization) + */ | null) | undefined; } | FacetDataType @@ -3465,28 +3576,170 @@ export type FunctionDataType = additionalProperties?: boolean | undefined; }; } - | (TopicMapDataType & unknown); -export type FunctionType = { - /** - * Unique identifier for the prompt - */ - id: string; - /** - * 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 prompt (see the `version` parameter) - */ - _xact_id: string; - /** - * Unique identifier for the project that the prompt belongs under - */ - project_id: string; - /** - * A literal 'p' which identifies the object as a project prompt - * - * @enum p - */ - log_id: "p"; + | (TopicMapDataType & unknown) /** - * Unique identifier for the organization + * A task function that runs a conversation between an agent and a simulated user. + */ + | { + /** + * @enum conversation + */ + type: "conversation"; + config: + | { + /** + * Who speaks first in the conversation + * + * @default "agent" + * @enum agent, simulated_user + */ + initiator: "agent" | "simulated_user"; + /** + * Maximum conversation duration in seconds + * + * @default 600 + * @minimum 15 + * @maximum 3600 + */ + timeout_seconds: number; + /** + * @default "voice" + * @enum voice + */ + modality: "voice"; + agent: + | { + /** + * @enum livekit + */ + type: "livekit"; + /** + * The WebSocket URL of the LiveKit project hosting the agent + * + * @minLength 1 + */ + server_url: string; + /** + * The name of the LiveKit agent to dispatch + * + * @minLength 1 + */ + agent_name: string; + } + | { + /** + * @enum phone + */ + type: "phone"; + /** + * @pattern ^\+[1-9]\d{7,14}$ + */ + phone_number: string; + } + | { + /** + * @enum sip + */ + type: "sip"; + /** + * @pattern ^sips?:[^\s]+$ + */ + uri: string; + }; + } + | { + /** + * Who speaks first in the conversation + * + * @default "agent" + * @enum agent, simulated_user + */ + initiator: "agent" | "simulated_user"; + /** + * Maximum conversation duration in seconds + * + * @default 600 + * @minimum 15 + * @maximum 3600 + */ + timeout_seconds: number; + /** + * @enum text + */ + modality: "text"; + agent: + | { + /** + * @enum livekit + */ + type: "livekit"; + /** + * The WebSocket URL of the LiveKit project hosting the agent + * + * @minLength 1 + */ + server_url: string; + /** + * The name of the LiveKit agent to dispatch + * + * @minLength 1 + */ + agent_name: string; + } + | { + /** + * @enum acp + */ + type: "acp"; + /** + * Executable for the ACP agent subprocess, communicating over stdio + * + * @minLength 1 + */ + command: string; + /** + * Arguments passed to the executable without shell interpretation + * + * @default [] + */ + args: Array; + /** + * Absolute working directory for the ACP session on the execution host + * + * @pattern ^(?:[/]|[A-Za-z]:[\\/]|\\\\) + */ + cwd: string; + /** + * Deny ACP permission requests; this does not sandbox the subprocess + * + * @default "deny" + * @enum deny + */ + permissions: "deny"; + }; + }; + }; +export type FunctionType = { + /** + * Unique identifier for the prompt + */ + id: string; + /** + * 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 prompt (see the `version` parameter) + */ + _xact_id: string; + /** + * Unique identifier for the project that the prompt belongs under + */ + project_id: string; + /** + * A literal 'p' which identifies the object as a project prompt + * + * @enum p + */ + log_id: "p"; + /** + * Unique identifier for the organization */ org_id: string; /** @@ -3533,12 +3786,10 @@ export type FunctionType = { /** * A list of tags for the prompt */ - (| Array - /** - * A list of tags for the prompt - */ - | null - ) + (Array + /** + * A list of tags for the prompt + */ | null) | undefined; metadata?: | /** @@ -3547,12 +3798,10 @@ export type FunctionType = { /** * User-controlled metadata about the prompt */ - (| {} - /** - * User-controlled metadata about the prompt - */ - | null - ) + ({} + /** + * User-controlled metadata about the prompt + */ | null) | undefined; function_type?: FunctionTypeEnumNullishType | undefined; function_data: FunctionDataType; @@ -3565,14 +3814,14 @@ export type FunctionType = { object_id: string; internal?: | /** - * The function exists for internal purposes and should not be displayed in the list of functions. + * If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI. */ /** - * The function exists for internal purposes and should not be displayed in the list of functions. + * If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI. */ (| boolean /** - * The function exists for internal purposes and should not be displayed in the list of functions. + * If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI. */ | null ) @@ -3586,22 +3835,20 @@ export type FunctionType = { /** * JSON schema for the function's parameters and return type */ - (| Partial<{ - parameters: unknown; - returns: unknown; - }> - /** - * JSON schema for the function's parameters and return type - */ - | null - ) + (Partial<{ + parameters: unknown; + returns: unknown; + }> + /** + * JSON schema for the function's parameters and return type + */ | null) | undefined; }; export type FunctionFormatType = /** - * @enum llm, code, global, graph, topic_map + * @enum llm, code, global, graph, topic_map, conversation */ - "llm" | "code" | "global" | "graph" | "topic_map"; + "llm" | "code" | "global" | "graph" | "topic_map" | "conversation"; export type PromptDataType = Partial<{ prompt: PromptBlockDataNullishType; options: PromptOptionsNullishType; @@ -3640,9 +3887,9 @@ export type FunctionIdType = */ function_id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } /** * Project name and slug @@ -3657,9 +3904,9 @@ export type FunctionIdType = */ slug: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } /** * Global function name @@ -3684,9 +3931,9 @@ export type FunctionIdType = */ prompt_session_function_id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } /** * Inline code function @@ -3704,10 +3951,11 @@ export type FunctionIdType = */ code: string; function_type?: - | (FunctionTypeEnumType & - /** - * The function type for inline code. Required when invoking inline preprocessors. - */ unknown) + | (FunctionTypeEnumType + /** + * The function type for inline code. Required when invoking inline preprocessors. + */ & + unknown) | undefined; name?: | /** @@ -3887,12 +4135,10 @@ export type GroupType = { /** * Ids of users which belong to this group */ - (| Array - /** - * Ids of users which belong to this group - */ - | null - ) + (Array + /** + * Ids of users which belong to this group + */ | null) | undefined; member_groups?: | /** @@ -3905,13 +4151,11 @@ export type GroupType = { An inheriting group has all the users contained in its member groups, as well as all of their inherited users */ - (| Array /** + (Array /** * Ids of the groups this group inherits from An inheriting group has all the users contained in its member groups, as well as all of their inherited users - */ - | null - ) + */ | null) | undefined; }; export type GroupScopeType = { @@ -3924,18 +4168,18 @@ export type GroupScopeType = { */ group_by: string; interval_seconds?: /** - * Maximum time range to include when constructing a group - * - * @minimum 1 - */ - number | undefined; + * Maximum time range to include when constructing a group + * + * @minimum 1 + */ + number | undefined; max_traces?: /** - * Maximum number of traces to include when constructing a group (default/max: 64) - * - * @minimum 1 - * @maximum 64 - */ - number | undefined; + * Maximum number of traces to include when constructing a group (default/max: 64) + * + * @minimum 1 + * @maximum 64 + */ + number | undefined; /** * Which trace or traces to write grouped scorer results to * @@ -3943,9 +4187,9 @@ export type GroupScopeType = { */ placement: "first" | "each"; idle_seconds?: /** - * Optional: trigger after this many seconds of inactivity - */ - number | undefined; + * Optional: trigger after this many seconds of inactivity + */ + number | undefined; }; export type IfExistsType = /** @@ -3988,30 +4232,28 @@ export type InvokeParentType = object_id: string; row_ids?: | /** - * Identifiers for the row to to log a subspan under + * Identifiers for the row to log a subspan under */ /** - * Identifiers for the row to to log a subspan under + * Identifiers for the row to log a subspan under */ - (| { - /** - * The id of the row - */ - id: string; - /** - * The span_id of the row - */ - span_id: string; - /** - * The root_span_id of the row - */ - root_span_id: string; - } + ({ /** - * Identifiers for the row to to log a subspan under + * The id of the row */ - | null - ) + id: string; + /** + * The span_id of the row + */ + span_id: string; + /** + * The root_span_id of the row + */ + root_span_id: string; + } + /** + * Identifiers for the row to log a subspan under + */ | null) | undefined; propagated_event?: | /** @@ -4020,12 +4262,10 @@ export type InvokeParentType = /** * Include these properties in every span created under this parent */ - (| {} - /** - * Include these properties in every span created under this parent - */ - | null - ) + ({} + /** + * Include these properties in every span created under this parent + */ | null) | undefined; } /** @@ -4056,6 +4296,10 @@ export type InvokeFunctionType = */ FunctionIdType & Partial<{ + /** + * A label identifying the caller, used to attribute usage + */ + request_source: string; /** * Argument to the function, which can be any JSON serializable value */ @@ -4065,27 +4309,25 @@ export type InvokeFunctionType = */ expected: unknown; /** - * Any relevant metadata. This will be logged and available as the `metadata` argument. + * Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`. */ metadata: /** - * Any relevant metadata. This will be logged and available as the `metadata` argument. - */ - | {} - /** - * Any relevant metadata. This will be logged and available as the `metadata` argument. - */ - | null; + * Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`. + */ + {} + /** + * Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`. + */ | null; /** * Any relevant tags to log on the span. */ tags: /** - * Any relevant tags to log on the span. - */ - | Array - /** - * Any relevant tags to log on the span. - */ - | null; + * Any relevant tags to log on the span. + */ + Array + /** + * Any relevant tags to log on the span. + */ | null; /** * If the function is an LLM, additional messages to pass along to it */ @@ -4095,9 +4337,9 @@ export type InvokeFunctionType = * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. */ stream: /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. - */ - | boolean + * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. + */ + | boolean /** * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. */ @@ -4107,9 +4349,9 @@ export type InvokeFunctionType = * If true, throw an error if one of the variables in the prompt is not present in the input */ strict: /** - * If true, throw an error if one of the variables in the prompt is not present in the input - */ - | boolean + * If true, throw an error if one of the variables in the prompt is not present in the input + */ + | boolean /** * If true, throw an error if one of the variables in the prompt is not present in the input */ @@ -4122,20 +4364,19 @@ export type InvokeFunctionType = * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. */ overrides: /** - * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. - */ - | {} - /** - * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. - */ - | null; + * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. + */ + {} + /** + * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. + */ | null; /** * Name of the AI provider secret to pin this invocation to. */ endpoint_name: /** - * Name of the AI provider secret to pin this invocation to. - */ - | string + * Name of the AI provider secret to pin this invocation to. + */ + | string /** * Name of the AI provider secret to pin this invocation to. */ @@ -4242,9 +4483,9 @@ export type NullableSavedFunctionIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -4317,12 +4558,20 @@ export type TraceScopeType = { */ type: "trace"; idle_seconds?: /** - * Consider trace complete after this many seconds of inactivity (default: 30) - */ - number | undefined; + * Consider trace complete after this many seconds of inactivity (default: 30) + */ + number | undefined; }; export type OnlineScoreConfigType = { status?: AutomationStatusType | undefined; + service_tier?: + | /** + * Service tier for online scoring. If omitted, prompt-level service tiers are preserved. + * + * @enum standard, flex + */ + ("standard" | "flex") + | undefined; /** * The sampling rate for online scoring * @@ -4369,12 +4618,10 @@ export type OnlineScoreConfigType = { /** * Trigger online scoring on any spans with a name in this list. Only applies when scope is 'span' or unset. */ - (| Array - /** - * Trigger online scoring on any spans with a name in this list. Only applies when scope is 'span' or unset. - */ - | null - ) + (Array + /** + * Trigger online scoring on any spans with a name in this list. Only applies when scope is 'span' or unset. + */ | null) | undefined; skip_logging?: | /** @@ -4406,11 +4653,76 @@ export type OrganizationType = { * Name of the organization */ name: string; - api_url?: (string | null) | undefined; - is_universal_api?: (boolean | null) | undefined; - is_dataplane_private?: (boolean | null) | undefined; - proxy_url?: (string | null) | undefined; - realtime_url?: (string | null) | undefined; + api_url?: + | /** + * URL of the organization's data plane API. If unset, the Braintrust-hosted API is used. + */ + /** + * URL of the organization's data plane API. If unset, the Braintrust-hosted API is used. + */ + (| string + /** + * URL of the organization's data plane API. If unset, the Braintrust-hosted API is used. + */ + | null + ) + | undefined; + is_universal_api?: + | /** + * Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended + */ + /** + * Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended + */ + (| boolean + /** + * Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended + */ + | null + ) + | undefined; + is_dataplane_private?: + | /** + * Whether the organization's data plane is only reachable from a private network + */ + /** + * Whether the organization's data plane is only reachable from a private network + */ + (| boolean + /** + * Whether the organization's data plane is only reachable from a private network + */ + | null + ) + | undefined; + proxy_url?: + | /** + * URL of the organization's AI proxy + */ + /** + * URL of the organization's AI proxy + */ + (| string + /** + * URL of the organization's AI proxy + */ + | null + ) + | undefined; + realtime_url?: + | /** + * URL of the organization's realtime service + */ + /** + * URL of the organization's realtime service + */ + (| string + /** + * URL of the organization's realtime service + */ + | null + ) + | undefined; created?: | /** * Date of organization creation @@ -4425,8 +4737,34 @@ export type OrganizationType = { | null ) | undefined; - archived_at?: (string | null) | undefined; - deleted_at?: (string | null) | undefined; + archived_at?: + | /** + * Date the organization was archived + */ + /** + * Date the organization was archived + */ + (| string + /** + * Date the organization was archived + */ + | null + ) + | undefined; + deleted_at?: + | /** + * Date the organization was deleted + */ + /** + * Date the organization was deleted + */ + (| string + /** + * Date the organization was deleted + */ + | null + ) + | undefined; image_rendering_mode?: ImageRenderingModeType | undefined; }; export type RetentionObjectTypeType = @@ -4494,143 +4832,398 @@ export type OrgAutomationType = { /** * The configuration for the org automation rule */ - config: { - /** - * The type of automation. + config: { + /** + * The type of automation. + * + * @enum retention + */ + event_type: "retention"; + object_type: RetentionObjectTypeType; + /** + * The number of days to retain the object + * + * @minimum 0 + */ + retention_days: number; + }; +}; +export type ProjectSettingsType = Partial<{ + /** + * The key used to join two experiments (defaults to `input`) + */ + comparison_key: /** + * The key used to join two experiments (defaults to `input`) + */ + | string + /** + * The key used to join two experiments (defaults to `input`) + */ + | null; + /** + * The id of the experiment to use as the default baseline for comparisons + */ + baseline_experiment_id: /** + * The id of the experiment to use as the default baseline for comparisons + */ + | string + /** + * The id of the experiment to use as the default baseline for comparisons + */ + | null; + /** + * The order of the fields to display in the trace view + */ + spanFieldOrder: /** + * The order of the fields to display in the trace view + */ + Array<{ + object_type: string; + column_id: string; + position: string; + layout?: + | ( + | /** + * @enum full + */ + "full" + /** + * @enum two_column + */ + | "two_column" + | null + ) + | undefined; + }> + /** + * The order of the fields to display in the trace view + */ | null; + /** + * The remote eval sources to use for the project + */ + remote_eval_sources: /** + * The remote eval sources to use for the project + */ + Array<{ + url: string; + name?: (string | null) | undefined; + description?: (string | null) | undefined; + }> + /** + * The remote eval sources to use for the project + */ | null; + /** + * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + */ + disable_realtime_queries: /** + * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + */ + | boolean + /** + * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + */ + | null; + /** + * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + */ + monitor_charts_use_metrics_start: /** + * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + */ + | boolean + /** + * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + */ + | null; + /** + * If true, enable the agent insights dashboard for this project. + */ + coding_agent_insights_dashboard: /** + * If true, enable the agent insights dashboard for this project. + */ + | boolean + /** + * If true, enable the agent insights dashboard for this project. + */ + | null; + /** + * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + */ + blind_reviews: /** + * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + */ + | boolean + /** + * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + */ + | null; + /** + * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + */ + require_all_human_review_scores: /** + * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + */ + | boolean + /** + * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + */ + | null; + user_id_fields: Array< + /** + * Path to the application's end-user identifier in metadata or span_attributes, for example ["metadata", "customer_id"]. This identifies an end user, not a session, request, organization, or the Braintrust user who created the project. + */ + Array + > | null; + /** + * Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions. + */ + pattern_alert_mention: /** + * Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions. + */ + { + /** + * @minLength 1 + */ + workspace_id: string; + /** + * Slack member ID of the user or agent to mention in a Pattern alert's thread to investigate the pattern. + * + * @pattern ^[UW][A-Z0-9]+$ + */ + mention_user_id: string; + mention_handle?: /** + * Username shown for the selected user or agent. Mentions use mention_user_id. + * + * @maxLength 80 + */ + string | undefined; + mention_prompt?: /** + * Message posted after the mention in a Pattern alert's thread. {{pattern}} is replaced with a link to the pattern. Defaults to "Please investigate this pattern: {{pattern}}. Review the evidence, identify the root cause, and suggest a fix." + * + * @maxLength 2000 + * @pattern \{\{pattern\}\} + */ + string | undefined; + } + /** + * Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions. + */ | null; + /** + * Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts. + */ + pattern_alert_destinations: /** + * Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts. + */ + Array< + /** + * A delivery action available to an automation + */ + | { + /** + * The type of action to take + * + * @enum webhook + */ + type: "webhook"; + /** + * The webhook URL to send the request to + */ + url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; + formatting_prompt?: /** + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; + } + | { + /** + * The type of action to take + * + * @enum slack + */ + type: "slack"; + /** + * The Slack workspace ID to post to + */ + workspace_id: string; + /** + * The Slack channel ID to post to + */ + channel: string; + message_template?: /** + * Custom message template for the alert + */ + string | undefined; + formatting_prompt?: /** + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; + } + | { + /** + * The type of action to take + * + * @enum pagerduty + */ + type: "pagerduty"; + /** + * The data-plane secret containing the PagerDuty routing key + */ + routing_key_secret_name: string; + /** + * @enum critical, error, warning, info + */ + severity: "critical" | "error" | "warning" | "info"; + formatting_prompt?: /** + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; + } + > + /** + * Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts. + */ | null; + /** + * Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium. + * + * @enum high, medium, low + */ + pattern_alert_min_severity: + | /** + * Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium. * - * @enum retention + * @enum high, medium, low */ - event_type: "retention"; - object_type: RetentionObjectTypeType; + ("high" | "medium" | "low") /** - * The number of days to retain the object + * Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium. * - * @minimum 0 - */ - retention_days: number; - }; -}; -export type ProjectSettingsType = Partial<{ - /** - * The key used to join two experiments (defaults to `input`) - */ - comparison_key: /** - * The key used to join two experiments (defaults to `input`) - */ - | string - /** - * The key used to join two experiments (defaults to `input`) + * @enum high, medium, low */ | null; /** - * The id of the experiment to use as the default baseline for comparisons + * Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns. */ - baseline_experiment_id: /** - * The id of the experiment to use as the default baseline for comparisons - */ - | string - /** - * The id of the experiment to use as the default baseline for comparisons - */ - | null; - /** - * The order of the fields to display in the trace view + pattern_alert_informational: /** + * Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns. */ - spanFieldOrder: /** - * The order of the fields to display in the trace view - */ - | Array<{ - object_type: string; - column_id: string; - position: string; - layout?: - | ( - | /** - * @enum full - */ - "full" - /** - * @enum two_column - */ - | "two_column" - | null - ) - | undefined; - }> + | boolean /** - * The order of the fields to display in the trace view + * Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns. */ | null; /** - * The remote eval sources to use for the project + * Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server. */ - remote_eval_sources: /** - * The remote eval sources to use for the project - */ - | Array<{ - url: string; - name?: (string | null) | undefined; - description?: (string | null) | undefined; - }> - /** - * The remote eval sources to use for the project - */ - | null; - /** - * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + pattern_sources: /** + * Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server. */ - disable_realtime_queries: /** - * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. - */ - | boolean + Array<{ /** - * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. - */ - | null; - /** - * If true, use metrics.start rather than created for monitor chart time bucket dimensions. - */ - monitor_charts_use_metrics_start: /** - * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + * @minLength 1 + * @maxLength 64 */ - | boolean + type: string; /** - * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + * The project MCP server that reads this source. */ - | null; + mcp_server_id: string; + instructions?: + | /** + * What the user wants Patterns to look for in this source, in their own words. + * + * @maxLength 4000 + */ + /** + * What the user wants Patterns to look for in this source, in their own words. + * + * @maxLength 4000 + */ + (| string + /** + * What the user wants Patterns to look for in this source, in their own words. + * + * @maxLength 4000 + */ + | null + ) + | undefined; + }> /** - * If true, enable the agent insights dashboard for this project. - */ - coding_agent_insights_dashboard: /** - * If true, enable the agent insights dashboard for this project. - */ - | boolean - /** - * If true, enable the agent insights dashboard for this project. - */ - | null; + * Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server. + */ | null; /** - * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + * Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them. */ - blind_reviews: /** - * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. - */ - | boolean - /** - * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. - */ - | null; - /** - * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + pattern_excluded_categories: /** + * Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them. */ - require_all_human_review_scores: /** - * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. - */ - | boolean + Array + /** + * Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them. + */ | null; + session_id_fields: Array< /** - * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + * Path to the application's session or conversation identifier in metadata or span_attributes, for example ["metadata", "conversation_id"]. This links turns of one conversation across traces, rather than identifying a user, request, trace, organization, or service account. */ - | null; + Array + > | null; default_preprocessor: NullableSavedFunctionIdType; }> | null; export type ProjectType = { @@ -4704,6 +5297,35 @@ export type ProjectType = { | undefined; settings?: ProjectSettingsType | undefined; }; +export type SavedPreprocessorIdType = + /** + * Saved preprocessor that renders traces for the project's pattern questions. The project default when unset. + */ + | { + /** + * @enum function + */ + type: "function"; + id: string; + version?: /** + * The version of the function + */ + string | undefined; + } + | { + /** + * @enum global + */ + type: "global"; + name: string; + /** + * The type of global function. Defaults to 'preprocessor'. + * + * @default "preprocessor" + * @enum preprocessor + */ + function_type: "preprocessor"; + }; export type WindowedAutomationConfigType = { /** * The type of automation. @@ -4715,27 +5337,31 @@ export type WindowedAutomationConfigType = { | /** * The product surface that created and manages the automation * - * @enum patterns + * @enum patterns, dashboard, digest, pattern_alerts */ (| /** * The product surface that created and manages the automation * - * @enum patterns + * @enum patterns, dashboard, digest, pattern_alerts */ - "patterns" + ("patterns" | "dashboard" | "digest" | "pattern_alerts") /** * The product surface that created and manages the automation * - * @enum patterns + * @enum patterns, dashboard, digest, pattern_alerts */ | null ) | undefined; status?: AutomationStatusType | undefined; + continuous?: /** + * Between scheduled runs, check for accumulated new work. The executor decides how to process it. + */ + boolean | undefined; threshold?: /** - * Optional calculation and lifecycle policy that gate scheduled delivery - */ - | { + * Optional calculation and lifecycle policy that gate scheduled delivery + */ + | { /** * The calculation evaluated for each window */ @@ -4889,9 +5515,9 @@ export type WindowedAutomationConfigType = { evaluation_delay_seconds: number; }; loop?: /** - * Optional Loop agent to run for each triggered window - */ - | { + * Optional Loop agent to run for each triggered window + */ + | { /** * Instructions for the Loop agent * @@ -4899,6 +5525,14 @@ export type WindowedAutomationConfigType = { * @maxLength 10000 */ prompt: string; + digest?: + | { + /** + * @enum compact, detailed + */ + writing_style: "compact" | "detailed"; + } + | undefined; /** * Whether to include the automation trigger payload as input * @@ -4922,30 +5556,51 @@ export type WindowedAutomationConfigType = { string>; harness?: | /** - * Required when saving a Loop automation. Currently only Codex is supported. + * Required for an explicit model selection. Currently only Codex is supported. * - * @enum codex, native, claude-code + * @enum native, codex, claude-code, pi */ - ("codex" | "native" | "claude-code") + ("native" | "codex" | "claude-code" | "pi") | undefined; model?: /** - * Required when saving a Loop automation. - * - * @minLength 1 - */ - string | undefined; + * Omit harness, model, and endpoint_name to inherit the organization default provider and its recommended execution settings. + * + * @minLength 1 + */ + string | undefined; endpoint_name?: /** - * @minLength 1 - */ - string | undefined; + * @minLength 1 + */ + string | undefined; reasoning_effort?: | /** * @enum none, minimal, low, medium, high, xhigh, max */ ("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max") | undefined; + target?: /** + * The object this automation writes to or maintains + */ + | { + /** + * @enum dashboard + */ + type: "dashboard"; + /** + * @enum overview + */ + id: "overview"; + } + | undefined; } | undefined; + patterns?: /** + * Settings of the Patterns automation + */ + | Partial<{ + preprocessor: SavedPreprocessorIdType; + }> + | undefined; /** * Delivery actions exposed to Loop as tools, or run directly when Loop is not configured * @@ -4966,13 +5621,50 @@ export type WindowedAutomationConfigType = { * The webhook URL to send the request to */ url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -4990,27 +5682,16 @@ export type WindowedAutomationConfigType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. + * Instructions for Loop to format content sent to this destination * * @minLength 1 * @maxLength 10000 */ - string | undefined; + string | undefined; } | { /** @@ -5028,12 +5709,12 @@ export type WindowedAutomationConfigType = { */ severity: "critical" | "error" | "warning" | "info"; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } >; }; @@ -5056,10 +5737,11 @@ export type TopicAutomationFacetModelType = */ | null; export type TopicMapFunctionAutomationType = { - function: SavedFunctionIdType & - /** - * Topic map function - */ unknown; + function: SavedFunctionIdType + /** + * Topic map function + */ & + unknown; btql_filter?: | /** * Per-topic-map BTQL filter. For trace scope, a topic map runs when max(filter) over the trace is truthy. For span scope, it runs when the current span matches. @@ -5239,32 +5921,21 @@ export type TopicDigestAutomationConfigType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; }; topic_map_function_ids?: /** - * Optional topic map function IDs to include in the digest - */ - Array | undefined; + * Optional topic map function IDs to include in the digest + */ + Array | undefined; }; export type ProjectAutomationType = { /** @@ -5359,13 +6030,50 @@ export type ProjectAutomationType = { * The webhook URL to send the request to */ url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5383,27 +6091,16 @@ export type ProjectAutomationType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5421,12 +6118,12 @@ export type ProjectAutomationType = { */ severity: "critical" | "error" | "warning" | "info"; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; }; } | { @@ -5511,11 +6208,11 @@ export type ProjectAutomationType = { */ service_account_email: string; credential_name?: /** - * The name of a Google workload identity federation credential configured in this organization's AI providers. Supported data planes can use it regardless of hosting environment. If omitted, the data plane's GCP identity is used. - * - * @minLength 1 - */ - string | undefined; + * The name of a Google workload identity federation credential configured in this organization's AI providers. Supported data planes can use it regardless of hosting environment. If omitted, the data plane's GCP identity is used. + * + * @minLength 1 + */ + string | undefined; }; batch_size?: | /** @@ -5613,9 +6310,9 @@ export type ProjectAutomationType = { event_type: "environment_update"; status?: AutomationStatusType | undefined; environment_filter?: /** - * Optional list of environment slugs to filter by - */ - Array | undefined; + * Optional list of environment slugs to filter by + */ + Array | undefined; /** * The action to take when the automation rule is triggered */ @@ -5631,13 +6328,50 @@ export type ProjectAutomationType = { * The webhook URL to send the request to */ url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5655,27 +6389,16 @@ export type ProjectAutomationType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5693,12 +6416,12 @@ export type ProjectAutomationType = { */ severity: "critical" | "error" | "warning" | "info"; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; }; } | WindowedAutomationConfigType @@ -5783,7 +6506,7 @@ export type ProjectGroupType = { ) | undefined; /** - * Sorted ids of active projects in this project group + * Sorted ids of active projects in this project group. Modifying membership requires project_group:update on the group. */ member_projects: Array; }; @@ -5829,34 +6552,32 @@ export type ProjectLogsEventType = { */ log_id: "g"; input?: /** - * The arguments that uniquely define a user input (an arbitrary, JSON serializable object). - */ - unknown | undefined; + * The arguments that uniquely define a user input (an arbitrary, JSON serializable object). + */ + unknown | undefined; 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 `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. - */ - unknown | undefined; + * 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. + */ + unknown | undefined; expected?: /** - * 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 while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models. - */ - unknown | undefined; + * 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 while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models. + */ + unknown | undefined; error?: /** - * The error that occurred, if any. - */ - unknown | undefined; + * The error that occurred, if any. + */ + unknown | undefined; 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 logs. + * 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 ground 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 logs. */ /** - * 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 logs. + * 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 ground 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 logs. */ - (| {} - /** - * 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 logs. - */ - | null - ) + ({} + /** + * 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 ground 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 logs. + */ | null) | undefined; metadata?: | /** @@ -5865,28 +6586,48 @@ export type ProjectLogsEventType = { /** * 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 */ - (| Partial< - { - /** - * The model used for this example - */ - model: /** - * The model used for this example - */ - | string - /** - * The model used for this example - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) + (Partial< + { + /** + * The model used for this example + */ + model: /** + * The model used for this example + */ + | string + /** + * The model used for this example + */ + | null; + /** + * The service tier requested for this LLM call + */ + requested_service_tier: /** + * The service tier requested for this LLM call + */ + | string + /** + * The service tier requested for this LLM call + */ + | null; + /** + * The service tier that served this LLM call + */ + served_service_tier: /** + * The service tier that served this LLM call + */ + | string + /** + * The service tier that served this LLM call + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) | undefined; tags?: | /** @@ -5895,12 +6636,10 @@ export type ProjectLogsEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; metrics?: | /** @@ -5925,53 +6664,51 @@ export type ProjectLogsEventType = { /** * Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event */ - (| Partial< - { - /** - * The function in code which created the project logs event - */ - caller_functionname: /** - * The function in code which created the project logs event - */ - | string - /** - * The function in code which created the project logs event - */ - | null; - /** - * Name of the file in code where the project logs event was created - */ - caller_filename: /** - * Name of the file in code where the project logs event was created - */ - | string - /** - * Name of the file in code where the project logs event was created - */ - | null; - /** - * Line of code where the project logs event was created - */ - caller_lineno: /** - * Line of code where the project logs event was created - */ - | number - /** - * Line of code where the project logs event was created - */ - | null; - } & { - [key: string]: any; - } - > - /** - * Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event - */ - | null - ) + (Partial< + { + /** + * The function in code which created the project logs event + */ + caller_functionname: /** + * The function in code which created the project logs event + */ + | string + /** + * The function in code which created the project logs event + */ + | null; + /** + * Name of the file in code where the project logs event was created + */ + caller_filename: /** + * Name of the file in code where the project logs event was created + */ + | string + /** + * Name of the file in code where the project logs event was created + */ + | null; + /** + * Line of code where the project logs event was created + */ + caller_lineno: /** + * Line of code where the project logs event was created + */ + | number + /** + * Line of code where the project logs event was created + */ + | null; + } & { + [key: string]: any; + } + > + /** + * Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event + */ | null) | undefined; /** - * A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing + * A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing */ span_id: string; span_parents?: @@ -5981,12 +6718,10 @@ export type ProjectLogsEventType = { /** * An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans */ - (| Array - /** - * An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans - */ - | null - ) + (Array + /** + * An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans + */ | null) | undefined; /** * A unique identifier for the trace this project logs event belongs to @@ -6015,12 +6750,10 @@ export type ProjectLogsEventType = { /** * Optional list of comments attached to this event */ - (| Array - /** - * Optional list of comments attached to this event - */ - | null - ) + (Array + /** + * Optional list of comments attached to this event + */ | null) | undefined; audit_data?: | /** @@ -6029,17 +6762,15 @@ export type ProjectLogsEventType = { /** * Optional list of audit entries attached to this event */ - (| Array - /** - * Optional list of audit entries attached to this event - */ - | null - ) + (Array + /** + * Optional list of audit entries attached to this event + */ | null) | undefined; _async_scoring_state?: /** - * The async scoring state for this event - */ - unknown | undefined; + * The async scoring state for this event + */ + unknown | undefined; facets?: | /** * Facets for categorization (dictionary from facet id to value) @@ -6047,12 +6778,10 @@ export type ProjectLogsEventType = { /** * Facets for categorization (dictionary from facet id to value) */ - (| {} - /** - * Facets for categorization (dictionary from facet id to value) - */ - | null - ) + ({} + /** + * Facets for categorization (dictionary from facet id to value) + */ | null) | undefined; classifications?: | /** @@ -6061,12 +6790,10 @@ export type ProjectLogsEventType = { /** * Classifications for this event (dictionary from classification name to items) */ - (| {} - /** - * Classifications for this event (dictionary from classification name to items) - */ - | null - ) + ({} + /** + * Classifications for this event (dictionary from classification name to items) + */ | null) | undefined; }; export type ProjectScoreTypeType = @@ -6332,12 +7059,10 @@ export type PromptType = { /** * A list of tags for the prompt */ - (| Array - /** - * A list of tags for the prompt - */ - | null - ) + (Array + /** + * A list of tags for the prompt + */ | null) | undefined; metadata?: | /** @@ -6346,12 +7071,10 @@ export type PromptType = { /** * User-controlled metadata about the prompt */ - (| {} - /** - * User-controlled metadata about the prompt - */ - | null - ) + ({} + /** + * User-controlled metadata about the prompt + */ | null) | undefined; function_type?: FunctionTypeEnumNullishType | undefined; }; @@ -6397,26 +7120,26 @@ export type PromptSessionEventType = { */ prompt_session_id: string; prompt_session_data?: /** - * Data about the prompt session - */ - unknown | undefined; + * Data about the prompt session + */ + unknown | undefined; prompt_data?: /** - * Data about the prompt - */ - unknown | undefined; + * Data about the prompt + */ + unknown | undefined; function_data?: /** - * Data about the function - */ - unknown | undefined; + * Data about the function + */ + unknown | undefined; function_type?: FunctionTypeEnumNullishType | undefined; object_data?: /** - * Data about the mapped data - */ - unknown | undefined; + * Data about the mapped data + */ + unknown | undefined; completion?: /** - * Data about the completion - */ - unknown | undefined; + * Data about the completion + */ + unknown | undefined; tags?: | /** * A list of tags to log @@ -6424,12 +7147,10 @@ export type PromptSessionEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; }; export type ResponseFormatType = @@ -6549,15 +7270,13 @@ export type RoleType = { /** * (permission, restrict_object_type) tuples which belong to this role */ - (| Array<{ - permission: PermissionType; - restrict_object_type?: AclObjectTypeType | undefined; - }> - /** - * (permission, restrict_object_type) tuples which belong to this role - */ - | null - ) + (Array<{ + permission: PermissionType; + restrict_object_type?: AclObjectTypeType | undefined; + }> + /** + * (permission, restrict_object_type) tuples which belong to this role + */ | null) | undefined; member_roles?: | /** @@ -6570,13 +7289,11 @@ export type RoleType = { An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions */ - (| Array /** + (Array /** * Ids of the roles this role inherits from An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions - */ - | null - ) + */ | null) | undefined; }; export type RunEvalType = { @@ -6588,9 +7305,9 @@ export type RunEvalType = { * The dataset to use */ data: /** - * Dataset id - */ - | { + * Dataset id + */ + | { dataset_id: string; dataset_version?: | /** @@ -6620,7 +7337,18 @@ export type RunEvalType = { | null ) | undefined; - _internal_btql?: ({} | null) | undefined; + _internal_btql?: + | /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + ({} + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ | null) + | undefined; } /** * Project and dataset name @@ -6656,13 +7384,28 @@ export type RunEvalType = { | null ) | undefined; - _internal_btql?: ({} | null) | undefined; + _internal_btql?: + | /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + ({} + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ | null) + | undefined; } /** * Dataset rows */ | { data: Array; + source_dataset_id?: /** + * The saved dataset these rows came from. Its project scopes saved simulated-user references; the caller must have read access to the dataset and source project. + */ + string | undefined; } /** * Experiment whose inputs and outputs should be used as dataset inputs and expected values @@ -6671,39 +7414,41 @@ export type RunEvalType = { experiment_name: string; }; name?: /** - * The name of the eval to run when multiple evals available - */ - string | undefined; + * The name of the eval to run when multiple evals available + */ + string | undefined; parameters?: /** - * Values for any parameters used in the eval - */ - {} | undefined; - task: FunctionIdType & - /** - * The function to evaluate - */ unknown; + * Values for any parameters used in the eval + */ + {} | undefined; + task: FunctionIdType + /** + * The function to evaluate + */ & + unknown; /** * The functions to score the eval on */ scores: Array; experiment_name?: /** - * An optional name for the experiment created by this eval. If it conflicts with an existing experiment, it will be suffixed with a unique identifier. - */ - string | undefined; + * An optional name for the experiment created by this eval. If it conflicts with an existing experiment, it will be suffixed with a unique identifier. + */ + string | undefined; metadata?: /** - * Optional experiment-level metadata to store about the evaluation. You can later use this to slice & dice across experiments. - */ - {} | undefined; + * Optional experiment-level metadata to store about the evaluation. You can later use this to slice & dice across experiments. + */ + {} | undefined; parent?: - | (InvokeParentType & - /** - * Options for tracing the evaluation - */ unknown) + | (InvokeParentType + /** + * Options for tracing the evaluation + */ & + unknown) | undefined; stream?: /** - * Whether to stream the results of the eval. If true, the request will return two events: one to indicate the experiment has started, and another upon completion. If false, the request will return the evaluation's summary upon completion. - */ - boolean | undefined; + * Whether to stream the results of the eval. If true, the request will return two events: one to indicate the experiment has started, and another upon completion. If false, the request will return the evaluation's summary upon completion. + */ + boolean | undefined; trial_count?: | /** * The number of times to run the evaluator per input. This is useful for evaluating applications that have non-deterministic behavior and gives you both a stronger aggregate measure and a sense of the variance in the results. @@ -6734,14 +7479,14 @@ export type RunEvalType = { | undefined; timeout?: | /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout. + * The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default. */ /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout. + * The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default. */ (| number /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout. + * The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default. */ | null ) @@ -6752,11 +7497,11 @@ export type RunEvalType = { * @default 10 */ max_concurrency: /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used. - * - * @default 10 - */ - | number + * The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used. + * + * @default 10 + */ + | number /** * The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used. * @@ -6792,24 +7537,24 @@ export type RunEvalType = { ) | undefined; git_metadata_settings?: - | (GitMetadataSettingsType & + | (GitMetadataSettingsType + /** + * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. + */ & /** - * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. - */ /** * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. */ - (| {} - /** - * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. - */ - | null - )) + ({} + /** + * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. + */ | null)) | undefined; repo_info?: - | (RepoInfoType & - /** - * Optionally explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified. - */ unknown) + | (RepoInfoType + /** + * Optionally explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified. + */ & + unknown) | undefined; strict?: | /** @@ -6840,13 +7585,13 @@ export type RunEvalType = { ) | undefined; extra_messages?: /** - * A template path of extra messages to append to the conversion. These messages will be appended to the end of the conversation, after the last message. - */ - string | undefined; + * A template path of extra messages to append to the conversion. These messages will be appended to the end of the conversation, after the last message. + */ + string | undefined; tags?: /** - * Optional tags that will be added to the experiment. - */ - Array | undefined; + * Optional tags that will be added to the experiment. + */ + Array | undefined; mcp_auth?: {} | undefined; endpoint_name?: | /** @@ -6865,14 +7610,14 @@ export type RunEvalType = { }; export type ScoreObjectType = { name?: /** - * The score name. Defaults to the function name for a single score. - */ - string | undefined; + * The score name. Defaults to the function name for a single score. + */ + string | undefined; score: /** - * @minimum 0 - * @maximum 1 - */ - number | boolean | null; + * @minimum 0 + * @maximum 1 + */ + number | boolean | null; metadata?: {} | undefined; }; export type ScoreResultType = @@ -6914,6 +7659,9 @@ export type ServiceTokenType = { * Name of the service token */ name: string; + /** + * Masked preview showing the token prefix and last four characters, e.g. bt-st-…AbCd. + */ preview_name: string; service_account_id?: | /** @@ -6971,6 +7719,20 @@ export type ServiceTokenType = { | null ) | undefined; + last_used_at?: + | /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + (| string + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + | null + ) + | undefined; expires_at?: | /** * Date and time at which the service token expires. If null, the token never expires. @@ -7088,10 +7850,11 @@ export type SSEProgressEventDataType = { id: string; object_type: FunctionObjectTypeType; origin?: - | (ObjectReferenceNullishType & - /** - * The origin of the event - */ unknown) + | (ObjectReferenceNullishType + /** + * The origin of the event + */ & + unknown) | undefined; format: FunctionFormatType; output_type: FunctionOutputTypeType; @@ -7211,14 +7974,13 @@ export type ViewDataType = /** * The view definition */ - | Partial<{ - search: ViewDataSearchType; - custom_charts: unknown; - }> + Partial<{ + search: ViewDataSearchType; + custom_charts: unknown; + }> /** * The view definition - */ - | null; + */ | null; export type ViewOptionsType = /** * Options for the view in the app @@ -7229,6 +7991,10 @@ export type ViewOptionsType = */ viewType: "monitor"; options: Partial<{ + /** + * @enum span, trace + */ + filterScope: "span" | "trace"; /** * @enum range, frame */ @@ -7312,9 +8078,9 @@ export type ViewOptionsType = * One of 'avg', 'sum', 'min', 'max', 'median', 'all' */ xAxisAggregation: /** - * One of 'avg', 'sum', 'min', 'max', 'median', 'all' - */ - | string + * One of 'avg', 'sum', 'min', 'max', 'median', 'all' + */ + | string /** * One of 'avg', 'sum', 'min', 'max', 'median', 'all' */ @@ -7359,7 +8125,7 @@ export type ViewType = { /** * Type of object that the view corresponds to. * - * @enum projects, experiments, experiment, playgrounds, playground, datasets, dataset, prompts, parameters, tools, scorers, classifiers, logs, monitor, for_review_project_log, for_review_experiments, for_review_datasets + * @enum projects, experiments, experiment, playgrounds, playground, datasets, dataset, prompts, parameters, tools, scorers, classifiers, logs, patterns, monitor, for_review_project_log, for_review_experiments, for_review_datasets */ view_type: | "projects" @@ -7375,6 +8141,7 @@ export type ViewType = { | "scorers" | "classifiers" | "logs" + | "patterns" | "monitor" | "for_review_project_log" | "for_review_experiments" @@ -7398,9 +8165,9 @@ export type ViewType = { ) | undefined; starred?: /** - * Whether the view is starred in its project - */ - boolean | undefined; + * Whether the view is starred in its project + */ + boolean | undefined; created?: | /** * Date of view creation diff --git a/js/src/generated_types.ts b/js/src/generated_types.ts index 75f0a42ce..6f12cc8be 100644 --- a/js/src/generated_types.ts +++ b/js/src/generated_types.ts @@ -1,6 +1,6 @@ -// Auto-generated file (content hash 387034529ea006a9) -- do not modify +// Auto-generated file (content hash 10e789e597c8e600) -- do not modify -import {z} from "zod/v3"; +import { z } from "zod/v3"; export const AclObjectType = z.union([ z.enum([ @@ -54,6 +54,7 @@ export const Agent = z.object({ project_id: z.string().uuid(), user_id: z.string().uuid(), created: z.union([z.string(), z.null()]).optional(), + deleted_at: z.union([z.string(), z.null()]).optional(), name: z.string(), slug: z.string(), kind: z.string(), @@ -136,6 +137,7 @@ export const AnyModelParams = z.object({ .passthrough() .optional(), verbosity: z.enum(["low", "medium", "high"]).optional(), + service_tier: z.string().optional(), top_k: z.number().optional(), stop_sequences: z.array(z.string()).optional(), reasoning_enabled: z.boolean().optional(), @@ -157,6 +159,7 @@ export const ApiKey = z.object({ user_given_name: z.union([z.string(), z.null()]).optional(), user_family_name: z.union([z.string(), z.null()]).optional(), org_id: z.union([z.string(), z.null()]).optional(), + last_used_at: z.union([z.string(), z.null()]).optional(), expires_at: z.union([z.string(), z.null()]).optional(), }); export type ApiKeyType = z.infer; @@ -191,7 +194,11 @@ export const AsyncScoringState = z.union([ ]); export type AsyncScoringStateType = z.infer; export const AsyncScoringControl = z.union([ - z.object({ kind: z.literal("score_update"), token: z.string().optional() }), + z.object({ + kind: z.literal("score_update"), + token: z.string().optional(), + triggered_xact_id: z.string().optional(), + }), z.object({ kind: z.literal("state_override"), state: AsyncScoringState }), z.object({ kind: z.literal("state_force_reselect") }), z.object({ kind: z.literal("state_enabled_force_rescore") }), @@ -207,7 +214,7 @@ export const AsyncScoringControl = z.union([ ]), idempotency_key: z.string().optional(), triggered_xact_id: z.union([z.string(), z.number()]).optional(), - }), + }) ) .min(1), }), @@ -335,7 +342,7 @@ export const BatchedFacetData = z.object({ model: z.string().optional(), embedding_model: z.string().optional(), no_match_pattern: z.string().optional(), - }), + }) ), topic_maps: z .record( @@ -344,8 +351,8 @@ export const BatchedFacetData = z.object({ function_name: z.string(), topic_map_id: z.string().optional(), topic_map_data: TopicMapData, - }), - ), + }) + ) ) .optional(), }); @@ -679,7 +686,11 @@ export const DatasetEvent = z.object({ metadata: z .union([ z - .object({ model: z.union([z.string(), z.null()]) }) + .object({ + model: z.union([z.string(), z.null()]), + requested_service_tier: z.union([z.string(), z.null()]), + served_service_tier: z.union([z.string(), z.null()]), + }) .partial() .passthrough(), z.null(), @@ -719,10 +730,10 @@ export const DatasetEvent = z.object({ function_type: FunctionTypeEnum.optional().default("scorer"), }), z.null(), - ]), + ]) ).optional(), - }), - ), + }) + ) ), z.null(), ]) @@ -829,6 +840,7 @@ export const SpanType = z.union([ "preprocessor", "classifier", "review", + "decision", "question", "log", ]), @@ -868,7 +880,11 @@ export const ExperimentEvent = z.object({ metadata: z .union([ z - .object({ model: z.union([z.string(), z.null()]) }) + .object({ + model: z.union([z.string(), z.null()]), + requested_service_tier: z.union([z.string(), z.null()]), + served_service_tier: z.union([z.string(), z.null()]), + }) .partial() .passthrough(), z.null(), @@ -924,10 +940,10 @@ export const ExperimentEvent = z.object({ function_type: FunctionTypeEnum.optional().default("scorer"), }), z.null(), - ]), + ]) ).optional(), - }), - ), + }) + ) ), z.null(), ]) @@ -970,6 +986,48 @@ export const PromptBlockDataNullish = z.union([ tools: z.string().optional(), }), z.object({ type: z.literal("completion"), content: z.string() }), + z.object({ + type: z.literal("decisions"), + input: z.union([ + z.string(), + z.array( + z.object({ + role: z.enum(["system", "developer", "user", "assistant"]), + content: z.union([ + z.string(), + z.array(ChatCompletionContentPartText), + ]), + }) + ), + ]), + questions: z.array( + z + .object({ name: z.string().optional(), instructions: z.string() }) + .and( + z.union([ + z.object({ type: z.literal("predicate") }), + z.object({ + type: z.literal("choice"), + choices: z.array( + z.object({ + value: z.union([z.string(), z.boolean()]), + description: z.string().optional(), + }) + ), + }), + z.object({ + type: z.literal("score"), + levels: z.array( + z.object({ + label: z.string(), + description: z.string().optional(), + }) + ), + }), + ]) + ) + ), + }), z.null(), ]); export type PromptBlockDataNullishType = z.infer; @@ -1008,6 +1066,7 @@ export const ModelParams = z.union([ .partial() .passthrough(), verbosity: z.enum(["low", "medium", "high"]), + service_tier: z.string(), }) .partial() .passthrough(), @@ -1126,7 +1185,7 @@ export const PromptDataNullish = z.union([ .union([z.array(z.string()), z.null()]) .optional(), }), - ]), + ]) ), z.null(), ]), @@ -1173,6 +1232,48 @@ export const PromptBlockData = z.union([ tools: z.string().optional(), }), z.object({ type: z.literal("completion"), content: z.string() }), + z.object({ + type: z.literal("decisions"), + input: z.union([ + z.string(), + z.array( + z.object({ + role: z.enum(["system", "developer", "user", "assistant"]), + content: z.union([ + z.string(), + z.array(ChatCompletionContentPartText), + ]), + }) + ), + ]), + questions: z.array( + z + .object({ name: z.string().optional(), instructions: z.string() }) + .and( + z.union([ + z.object({ type: z.literal("predicate") }), + z.object({ + type: z.literal("choice"), + choices: z.array( + z.object({ + value: z.union([z.string(), z.boolean()]), + description: z.string().optional(), + }) + ), + }), + z.object({ + type: z.literal("score"), + levels: z.array( + z.object({ + label: z.string(), + description: z.string().optional(), + }) + ), + }), + ]) + ) + ), + }), ]); export type PromptBlockDataType = z.infer; export const GraphNode = z.union([ @@ -1297,6 +1398,68 @@ export const FunctionData = z.union([ }), }), TopicMapData.and(z.unknown()), + z.object({ + type: z.literal("conversation"), + config: z.union([ + z.object({ + initiator: z + .enum(["agent", "simulated_user"]) + .optional() + .default("agent"), + timeout_seconds: z + .number() + .int() + .gte(15) + .lte(3600) + .optional() + .default(600), + modality: z.literal("voice").optional().default("voice"), + agent: z.union([ + z.object({ + type: z.literal("livekit"), + server_url: z.string().min(1), + agent_name: z.string().min(1), + }), + z.object({ + type: z.literal("phone"), + phone_number: z.string().regex(/^\+[1-9]\d{7,14}$/), + }), + z.object({ + type: z.literal("sip"), + uri: z.string().regex(/^sips?:[^\s]+$/), + }), + ]), + }), + z.object({ + initiator: z + .enum(["agent", "simulated_user"]) + .optional() + .default("agent"), + timeout_seconds: z + .number() + .int() + .gte(15) + .lte(3600) + .optional() + .default(600), + modality: z.literal("text"), + agent: z.union([ + z.object({ + type: z.literal("livekit"), + server_url: z.string().min(1), + agent_name: z.string().min(1), + }), + z.object({ + type: z.literal("acp"), + command: z.string().min(1), + args: z.array(z.string()).optional().default([]), + cwd: z.string().regex(/^(?:[\/]|[A-Za-z]:[\\\/]|\\\\)/), + permissions: z.literal("deny").optional().default("deny"), + }), + ]), + }), + ]), + }), ]); export type FunctionDataType = z.infer; export const Function = z.object({ @@ -1340,6 +1503,7 @@ export const FunctionFormat = z.enum([ "global", "graph", "topic_map", + "conversation", ]); export type FunctionFormatType = z.infer; export const PromptData = z @@ -1368,7 +1532,7 @@ export const PromptData = z is_disabled: z.boolean().optional(), enabled_tools: z.union([z.array(z.string()), z.null()]).optional(), }), - ]), + ]) ), z.null(), ]), @@ -1459,7 +1623,7 @@ export const GitMetadataSettings = z.object({ "commit_message", "commit_time", "git_diff", - ]), + ]) ) .optional(), }); @@ -1521,6 +1685,7 @@ export type StreamingModeType = z.infer; export const InvokeFunction = FunctionId.and( z .object({ + request_source: z.string(), input: z.unknown(), expected: z.unknown(), metadata: z.union([z.object({}).partial().passthrough(), z.null()]), @@ -1534,7 +1699,7 @@ export const InvokeFunction = FunctionId.and( overrides: z.union([z.object({}).partial().passthrough(), z.null()]), endpoint_name: z.union([z.string(), z.null()]), }) - .partial(), + .partial() ); export type InvokeFunctionType = z.infer; export const MCPServer = z.object({ @@ -1605,6 +1770,7 @@ export type TraceScopeType = z.infer; export const OnlineScoreConfig = z.union([ z.object({ status: AutomationStatus.optional(), + service_tier: z.enum(["standard", "flex"]).optional(), sampling_rate: z.number().gte(0).lte(1), scorers: z.array(SavedFunctionId), btql_filter: z.union([z.string(), z.null()]).optional(), @@ -1664,7 +1830,7 @@ export const ProjectSettings = z.union([ layout: z .union([z.literal("full"), z.literal("two_column"), z.null()]) .optional(), - }), + }) ), z.null(), ]), @@ -1674,7 +1840,7 @@ export const ProjectSettings = z.union([ url: z.string(), name: z.union([z.string(), z.null()]).optional(), description: z.union([z.string(), z.null()]).optional(), - }), + }) ), z.null(), ]), @@ -1683,6 +1849,97 @@ export const ProjectSettings = z.union([ coding_agent_insights_dashboard: z.union([z.boolean(), z.null()]), blind_reviews: z.union([z.boolean(), z.null()]), require_all_human_review_scores: z.union([z.boolean(), z.null()]), + user_id_fields: z.union([ + z.array(z.array(z.string().min(1).max(256)).min(2).max(32)), + z.null(), + ]), + pattern_alert_mention: z.union([ + z.object({ + workspace_id: z.string().min(1), + mention_user_id: z.string().regex(/^[UW][A-Z0-9]+$/), + mention_handle: z.string().max(80).optional(), + mention_prompt: z + .string() + .max(2000) + .regex(/\{\{pattern\}\}/) + .optional(), + }), + z.null(), + ]), + pattern_alert_destinations: z.union([ + z.array( + z.union([ + z.object({ + type: z.literal("webhook"), + url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), + formatting_prompt: z.string().min(1).max(10000).optional(), + }), + z.object({ + type: z.literal("slack"), + workspace_id: z.string(), + channel: z.string(), + message_template: z.string().optional(), + formatting_prompt: z.string().min(1).max(10000).optional(), + }), + z.object({ + type: z.literal("pagerduty"), + routing_key_secret_name: z.string().uuid(), + severity: z.enum(["critical", "error", "warning", "info"]), + formatting_prompt: z.string().min(1).max(10000).optional(), + }), + ]) + ), + z.null(), + ]), + pattern_alert_min_severity: z.union([ + z.enum(["high", "medium", "low"]), + z.null(), + ]), + pattern_alert_informational: z.union([z.boolean(), z.null()]), + pattern_sources: z.union([ + z.array( + z.object({ + type: z.string().min(1).max(64), + mcp_server_id: z.string().uuid(), + instructions: z.union([z.string(), z.null()]).optional(), + }) + ), + z.null(), + ]), + pattern_excluded_categories: z.union([ + z.array(z.string().min(1).max(64)), + z.null(), + ]), + session_id_fields: z.union([ + z.array(z.array(z.string().min(1).max(256)).min(2).max(32)), + z.null(), + ]), default_preprocessor: NullableSavedFunctionId, }) .partial(), @@ -1700,10 +1957,29 @@ export const Project = z.object({ settings: ProjectSettings.optional(), }); export type ProjectType = z.infer; +export const SavedPreprocessorId = z.union([ + z.object({ + type: z.literal("function"), + id: z.string(), + version: z.string().optional(), + }), + z.object({ + type: z.literal("global"), + name: z.string(), + function_type: z.literal("preprocessor").optional().default("preprocessor"), + }), +]); +export type SavedPreprocessorIdType = z.infer; export const WindowedAutomationConfig = z.object({ event_type: z.literal("windowed"), - product_origin: z.union([z.literal("patterns"), z.null()]).optional(), + product_origin: z + .union([ + z.enum(["patterns", "dashboard", "digest", "pattern_alerts"]), + z.null(), + ]) + .optional(), status: AutomationStatus.optional(), + continuous: z.boolean().optional(), threshold: z .object({ calculation: z.object({ @@ -1745,23 +2021,59 @@ export const WindowedAutomationConfig = z.object({ loop: z .object({ prompt: z.string().min(1).max(10000), + digest: z + .object({ writing_style: z.enum(["compact", "detailed"]) }) + .optional(), include_trigger_input: z.boolean().optional().default(false), agent_slug: z.string().min(1), auto_approve_tools: z.array(z.string().min(1)).optional().default([]), - harness: z.enum(["codex", "native", "claude-code"]).optional(), + harness: z.enum(["native", "codex", "claude-code", "pi"]).optional(), model: z.string().min(1).optional(), endpoint_name: z.string().min(1).optional(), reasoning_effort: z .enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]) .optional(), + target: z + .object({ type: z.literal("dashboard"), id: z.literal("overview") }) + .optional(), }) .optional(), + patterns: z + .object({ preprocessor: SavedPreprocessorId }) + .partial() + .optional(), actions: z .array( z.union([ z.object({ type: z.literal("webhook"), url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), formatting_prompt: z.string().min(1).max(10000).optional(), }), z.object({ @@ -1777,7 +2089,7 @@ export const WindowedAutomationConfig = z.object({ severity: z.enum(["critical", "error", "warning", "info"]), formatting_prompt: z.string().min(1).max(10000).optional(), }), - ]), + ]) ) .max(20) .optional() @@ -1870,6 +2182,32 @@ export const ProjectAutomation = z.object({ z.object({ type: z.literal("webhook"), url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), formatting_prompt: z.string().min(1).max(10000).optional(), }), z.object({ @@ -1941,6 +2279,32 @@ export const ProjectAutomation = z.object({ z.object({ type: z.literal("webhook"), url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), formatting_prompt: z.string().min(1).max(10000).optional(), }), z.object({ @@ -1994,7 +2358,11 @@ export const ProjectLogsEvent = z.object({ metadata: z .union([ z - .object({ model: z.union([z.string(), z.null()]) }) + .object({ + model: z.union([z.string(), z.null()]), + requested_service_tier: z.union([z.string(), z.null()]), + served_service_tier: z.union([z.string(), z.null()]), + }) .partial() .passthrough(), z.null(), @@ -2051,10 +2419,10 @@ export const ProjectLogsEvent = z.object({ function_type: FunctionTypeEnum.optional().default("scorer"), }), z.null(), - ]), + ]) ).optional(), - }), - ), + }) + ) ), z.null(), ]) @@ -2212,7 +2580,7 @@ export const Role = z.object({ z.object({ permission: Permission, restrict_object_type: AclObjectType.optional(), - }), + }) ), z.null(), ]) @@ -2240,7 +2608,10 @@ export const RunEval = z.object({ .union([z.object({}).partial().passthrough(), z.null()]) .optional(), }), - z.object({ data: z.array(z.unknown()) }), + z.object({ + data: z.array(z.unknown()), + source_dataset_id: z.string().optional(), + }), z.object({ experiment_name: z.string() }), ]), name: z.string().optional(), @@ -2258,7 +2629,7 @@ export const RunEval = z.object({ base_experiment_name: z.union([z.string(), z.null()]).optional(), base_experiment_id: z.union([z.string(), z.null()]).optional(), git_metadata_settings: GitMetadataSettings.and( - z.union([z.object({}).partial(), z.null()]), + z.union([z.object({}).partial(), z.null()]) ).optional(), repo_info: RepoInfo.and(z.unknown()).optional(), strict: z.union([z.boolean(), z.null()]).optional(), @@ -2294,6 +2665,7 @@ export const ServiceToken = z.object({ service_account_email: z.union([z.string(), z.null()]).optional(), service_account_name: z.union([z.string(), z.null()]).optional(), org_id: z.union([z.string(), z.null()]).optional(), + last_used_at: z.union([z.string(), z.null()]).optional(), expires_at: z.union([z.string(), z.null()]).optional(), }); export type ServiceTokenType = z.infer; @@ -2375,6 +2747,7 @@ export const ViewOptions = z.union([ viewType: z.literal("monitor"), options: z .object({ + filterScope: z.enum(["span", "trace"]), spanType: z.union([z.enum(["range", "frame"]), z.null()]), rangeValue: z.union([z.string(), z.null()]), frameStart: z.union([z.string(), z.null()]), @@ -2404,7 +2777,7 @@ export const ViewOptions = z.union([ z.object({ type: z.enum(["none", "score", "metric", "metadata"]), value: z.string(), - }), + }) ), z.null(), ]), @@ -2475,6 +2848,7 @@ export const View = z.object({ "scorers", "classifiers", "logs", + "patterns", "monitor", "for_review_project_log", "for_review_experiments", diff --git a/js/util/generated_plain_types.ts b/js/util/generated_plain_types.ts index 708be55a2..d8e09d397 100644 --- a/js/util/generated_plain_types.ts +++ b/js/util/generated_plain_types.ts @@ -1,4 +1,4 @@ -// Auto-generated file (content hash 387034529ea006a9) -- do not modify +// Auto-generated file (content hash 10e789e597c8e600) -- do not modify export type AclObjectTypeType = /** @@ -39,7 +39,7 @@ export type PermissionType = /** * Each permission permits a certain type of operation on an object in the system -Permissions can be assigned to to objects on an individual basis, or grouped into roles +Permissions can be assigned to objects on an individual basis, or grouped into roles * * @enum create, read, update, delete, create_acls, read_acls, update_acls, delete_acls */ @@ -90,10 +90,11 @@ export type AclType = { ) | undefined; permission?: - | (PermissionType & + | (PermissionType + /** + * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided + */ & /** - * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided - */ /** * Permission the ACL grants. Exactly one of `permission` and `role_id` will be provided */ (| string @@ -104,10 +105,11 @@ export type AclType = { )) | undefined; restrict_object_type?: - | (AclObjectTypeType & - /** - * When setting a permission directly, optionally restricts the permission grant to just the specified object type. Cannot be set alongside a `role_id`. - */ unknown) + | (AclObjectTypeType + /** + * When setting a permission directly, optionally restricts the permission grant to just the specified object type. Cannot be set alongside a `role_id`. + */ & + unknown) | undefined; role_id?: | /** @@ -166,6 +168,20 @@ export type AgentType = { | null ) | undefined; + deleted_at?: + | /** + * Date of agent deletion, or null if the agent is still active + */ + /** + * Date of agent deletion, or null if the agent is still active + */ + (| string + /** + * Date of agent deletion, or null if the agent is still active + */ + | null + ) + | undefined; /** * Name of the agent. Within a project, agent names are unique */ @@ -199,12 +215,10 @@ export type AgentType = { /** * User-controlled metadata about the agent */ - (| {} - /** - * User-controlled metadata about the agent - */ - | null - ) + ({} + /** + * User-controlled metadata about the agent + */ | null) | undefined; }; export type AISecretType = { @@ -312,9 +326,9 @@ export type AnyModelParamsType = { top_p?: number | undefined; max_tokens: number; max_completion_tokens?: /** - * The successor to max_tokens - */ - number | undefined; + * The successor to max_tokens + */ + number | undefined; frequency_penalty?: number | undefined; presence_penalty?: number | undefined; response_format?: ResponseFormatNullishType | undefined; @@ -381,14 +395,15 @@ export type AnyModelParamsType = { */ ("low" | "medium" | "high") | undefined; + service_tier?: string | undefined; top_k?: number | undefined; stop_sequences?: Array | undefined; reasoning_enabled?: boolean | undefined; reasoning_budget?: number | undefined; max_tokens_to_sample?: /** - * This is a legacy parameter that should not be used. - */ - number | undefined; + * This is a legacy parameter that should not be used. + */ + number | undefined; maxOutputTokens?: number | undefined; topP?: number | undefined; topK?: number | undefined; @@ -417,6 +432,9 @@ export type ApiKeyType = { * Name of the api key */ name: string; + /** + * Masked preview showing the key prefix and last four characters, e.g. sk-…AbCd. + */ preview_name: string; user_id?: | /** @@ -488,6 +506,20 @@ export type ApiKeyType = { | null ) | undefined; + last_used_at?: + | /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + (| string + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + | null + ) + | undefined; expires_at?: | /** * Date at which the API key expires. If null, the key never expires. @@ -600,6 +632,7 @@ export type AsyncScoringControlType = */ kind: "score_update"; token?: string | undefined; + triggered_xact_id?: string | undefined; } | { /** @@ -722,9 +755,9 @@ export type UploadStatusType = export type AttachmentStatusType = { upload_status: UploadStatusType; error_message?: /** - * Describes the error encountered while uploading. - */ - string | undefined; + * Describes the error encountered while uploading. + */ + string | undefined; }; export type AutomationStatusType = /** @@ -762,9 +795,9 @@ export type FacetPreprocessorIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -795,9 +828,9 @@ export type SavedFunctionIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -833,32 +866,33 @@ export type TopicMapDataType = { */ source_facet: string; source_facet_function?: - | (SavedFunctionIdType & - /** - * The stable function reference for the source facet - */ unknown) + | (SavedFunctionIdType + /** + * The stable function reference for the source facet + */ & + unknown) | undefined; /** * The embedding model to use for embedding facet values */ embedding_model: string; bundle_key?: /** - * Key of the topic map bundle in code_bundles bucket - */ - string | undefined; + * Key of the topic map bundle in code_bundles bucket + */ + string | undefined; report_key?: /** - * Key of the clustering report in code_bundles bucket - */ - string | undefined; + * Key of the clustering report in code_bundles bucket + */ + string | undefined; topic_names?: /** - * Mapping from topic_id to topic name - */ - {} | undefined; + * Mapping from topic_id to topic name + */ + {} | undefined; generation_settings?: TopicMapGenerationSettingsType | undefined; disable_reconciliation?: /** - * Whether new topic generation should ignore the previously saved report during reconciliation. Defaults to false when omitted. - */ - boolean | undefined; + * Whether new topic generation should ignore the previously saved report during reconciliation. Defaults to false when omitted. + */ + boolean | undefined; reconcile_mode?: | /** * How reconciliation carries the previous map forward: "evolve" re-routes new samples into the previous topics before naming; "names_only" keeps the fresh clustering and carries only topic ids/names. Defaults to "names_only" when omitted. @@ -868,17 +902,17 @@ export type TopicMapDataType = { ("evolve" | "names_only") | undefined; distance_threshold?: /** - * Maximum distance to nearest centroid. If exceeded, returns no_match. - */ - number | undefined; + * Maximum distance to nearest centroid. If exceeded, returns no_match. + */ + number | undefined; btql_filter?: /** - * Per-topic-map BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. - */ - string | undefined; + * Per-topic-map BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. + */ + string | undefined; automation_btql_filter?: /** - * Automation-level BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. - */ - string | undefined; + * Automation-level BTQL filter that was applied when this version was generated. Absent on versions generated before this was recorded. + */ + string | undefined; }; export type BatchedFacetDataType = { /** @@ -896,22 +930,22 @@ export type BatchedFacetDataType = { */ prompt: string; model?: /** - * The model to use for facet extraction - */ - string | undefined; + * The model to use for facet extraction + */ + string | undefined; embedding_model?: /** - * The embedding model to use for vectorizing facet results. - */ - string | undefined; + * The embedding model to use for vectorizing facet results. + */ + string | undefined; no_match_pattern?: /** - * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' - */ - string | undefined; + * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' + */ + string | undefined; }>; topic_maps?: /** - * Topic maps that depend on facets in this batch, keyed by source facet name. Each source facet can have multiple topic maps. - */ - {} | undefined; + * Topic maps that depend on facets in this batch, keyed by source facet name. Each source facet can have multiple topic maps. + */ + {} | undefined; }; export type BraintrustModelParamsType = Partial<{ use_cache: boolean; @@ -1152,9 +1186,9 @@ export type ChatCompletionMessageReasoningType = Partial<{ export type ChatCompletionMessageParamType = | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum system */ @@ -1163,9 +1197,9 @@ export type ChatCompletionMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum user */ @@ -1193,9 +1227,9 @@ export type ChatCompletionMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum tool */ @@ -1215,9 +1249,9 @@ export type ChatCompletionMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum developer */ @@ -1234,9 +1268,9 @@ export type ChatCompletionMessageParamType = export type ChatCompletionOpenAIMessageParamType = | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum system */ @@ -1245,9 +1279,9 @@ export type ChatCompletionOpenAIMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum user */ @@ -1275,9 +1309,9 @@ export type ChatCompletionOpenAIMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum tool */ @@ -1297,9 +1331,9 @@ export type ChatCompletionOpenAIMessageParamType = } | { content: /** - * @default "" - */ - string | Array; + * @default "" + */ + string | Array; /** * @enum developer */ @@ -1382,7 +1416,7 @@ export type CodeBundleType = { */ provider: "modal"; /** - * sandbox snapshot ref + * The Modal snapshot to start the sandbox from */ snapshot_ref: string; } @@ -1393,18 +1427,18 @@ export type CodeBundleType = { provider: "lambda"; }; entrypoints?: /** - * Which entrypoints to execute in the sandbox - */ - Array | undefined; + * Which entrypoints to execute in the sandbox + */ + Array | undefined; eval_name: string; parameters?: /** - * Parameter values for sandbox eval execution - */ - {} | undefined; + * Parameter values for sandbox eval execution + */ + {} | undefined; evaluator_definition?: /** - * Definition of current evaluator with parameters - */ - unknown | undefined; + * Definition of current evaluator with parameters + */ + unknown | undefined; }; bundle_id?: (string | null) | undefined; preview?: @@ -1498,12 +1532,10 @@ export type DatasetType = { /** * A list of tags for the dataset */ - (| Array - /** - * A list of tags for the dataset - */ - | null - ) + (Array + /** + * A list of tags for the dataset + */ | null) | undefined; metadata?: | /** @@ -1512,12 +1544,10 @@ export type DatasetType = { /** * User-controlled metadata about the dataset */ - (| {} - /** - * User-controlled metadata about the dataset - */ - | null - ) + ({} + /** + * User-controlled metadata about the dataset + */ | null) | undefined; /** * URL slug for the dataset. used to construct dataset URLs @@ -1531,60 +1561,59 @@ export type ObjectReferenceNullishType = /** * Indicates the event was copied from another object. */ - | { - /** - * Type of the object the event is originating from. - * - * @enum project_logs, experiment, dataset, prompt, function, prompt_session + { + /** + * Type of the object the event is originating from. + * + * @enum project_logs, experiment, dataset, prompt, function, prompt_session + */ + object_type: + | "project_logs" + | "experiment" + | "dataset" + | "prompt" + | "function" + | "prompt_session"; + /** + * ID of the object the event is originating from. + */ + object_id: string; + /** + * ID of the original event. + */ + id: string; + _xact_id?: + | /** + * Transaction ID of the original event. */ - object_type: - | "project_logs" - | "experiment" - | "dataset" - | "prompt" - | "function" - | "prompt_session"; /** - * ID of the object the event is originating from. + * Transaction ID of the original event. + */ + (| string + /** + * Transaction ID of the original event. + */ + | null + ) + | undefined; + created?: + | /** + * Created timestamp of the original event. Used to help sort in the UI */ - object_id: string; /** - * ID of the original event. + * Created timestamp of the original event. Used to help sort in the UI */ - id: string; - _xact_id?: - | /** - * Transaction ID of the original event. - */ - /** - * Transaction ID of the original event. - */ - (| string - /** - * Transaction ID of the original event. - */ - | null - ) - | undefined; - created?: - | /** - * Created timestamp of the original event. Used to help sort in the UI - */ - /** - * Created timestamp of the original event. Used to help sort in the UI - */ - (| string - /** - * Created timestamp of the original event. Used to help sort in the UI - */ - | null - ) - | undefined; - } + (| string + /** + * Created timestamp of the original event. Used to help sort in the UI + */ + | null + ) + | undefined; + } /** * Indicates the event was copied from another object. - */ - | null; + */ | null; export type DatasetEventType = { /** * A unique identifier for the dataset event. If you don't provide one, Braintrust will generate one for you @@ -1621,13 +1650,13 @@ export type DatasetEventType = { */ dataset_id: string; input?: /** - * The argument that uniquely define an input case (an arbitrary, JSON serializable object) - */ - unknown | undefined; + * The argument that uniquely define an input case (an arbitrary, JSON serializable object) + */ + unknown | undefined; expected?: /** - * The output of your application, including post-processing (an arbitrary, JSON serializable object) - */ - unknown | undefined; + * The output of your application, including post-processing (an arbitrary, JSON serializable object) + */ + unknown | undefined; 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'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 @@ -1635,28 +1664,48 @@ export type DatasetEventType = { /** * 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 */ - (| Partial< - { - /** - * The model used for this example - */ - model: /** - * The model used for this example - */ - | string - /** - * The model used for this example - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) + (Partial< + { + /** + * The model used for this example + */ + model: /** + * The model used for this example + */ + | string + /** + * The model used for this example + */ + | null; + /** + * The service tier requested for this LLM call + */ + requested_service_tier: /** + * The service tier requested for this LLM call + */ + | string + /** + * The service tier requested for this LLM call + */ + | null; + /** + * The service tier that served this LLM call + */ + served_service_tier: /** + * The service tier that served this LLM call + */ + | string + /** + * The service tier that served this LLM call + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) | undefined; tags?: | /** @@ -1665,15 +1714,13 @@ export type DatasetEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; /** - * A unique identifier used to link different dataset events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing + * A unique identifier used to link different dataset events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing */ span_id: string; /** @@ -1702,12 +1749,10 @@ export type DatasetEventType = { /** * Optional list of comments attached to this event */ - (| Array - /** - * Optional list of comments attached to this event - */ - | null - ) + (Array + /** + * Optional list of comments attached to this event + */ | null) | undefined; audit_data?: | /** @@ -1716,12 +1761,10 @@ export type DatasetEventType = { /** * Optional list of audit entries attached to this event */ - (| Array - /** - * Optional list of audit entries attached to this event - */ - | null - ) + (Array + /** + * Optional list of audit entries attached to this event + */ | null) | undefined; facets?: | /** @@ -1730,12 +1773,10 @@ export type DatasetEventType = { /** * Facets for categorization (dictionary from facet id to value) */ - (| {} - /** - * Facets for categorization (dictionary from facet id to value) - */ - | null - ) + ({} + /** + * Facets for categorization (dictionary from facet id to value) + */ | null) | undefined; classifications?: | /** @@ -1744,12 +1785,10 @@ export type DatasetEventType = { /** * Classifications for this event (dictionary from classification name to items) */ - (| {} - /** - * Classifications for this event (dictionary from classification name to items) - */ - | null - ) + ({} + /** + * Classifications for this event (dictionary from classification name to items) + */ | null) | undefined; }; export type DatasetSnapshotType = { @@ -1767,16 +1806,16 @@ export type DatasetSnapshotType = { name: string; description: string | null; /** - * Transaction id of the brainstore version at the time of the snapshot + * Transaction ID of the dataset version at the time of the snapshot */ xact_id: string; /** * Date of dataset snapshot creation */ created: /** - * Date of dataset snapshot creation - */ - | string + * Date of dataset snapshot creation + */ + | string /** * Date of dataset snapshot creation */ @@ -1864,12 +1903,10 @@ export type EnvVarType = { /** * Optional metadata associated with the environment variable when managed via the function secrets API */ - (| {} - /** - * Optional metadata associated with the environment variable when managed via the function secrets API - */ - | null - ) + ({} + /** + * Optional metadata associated with the environment variable when managed via the function secrets API + */ | null) | undefined; preview_secret?: | /** @@ -1900,7 +1937,7 @@ export type EnvVarType = { ) | undefined; /** - * The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys + * The category of the secret: env_var for regular environment variables, ai_provider for AI provider API keys, sandbox_provider for sandbox provider credentials, automation_integration for automation delivery credentials * * @default "env_var" * @enum env_var, ai_provider, sandbox_provider, automation_integration @@ -1918,111 +1955,110 @@ export type RepoInfoType = /** * Metadata about the state of the repo when the experiment was created */ - | Partial<{ - /** - * SHA of most recent commit + Partial<{ + /** + * SHA of most recent commit + */ + commit: /** + * SHA of most recent commit + */ + | string + /** + * SHA of most recent commit */ - commit: /** - * SHA of most recent commit - */ - | string - /** - * SHA of most recent commit - */ - | null; + | null; + /** + * Name of the branch the most recent commit belongs to + */ + branch: /** + * Name of the branch the most recent commit belongs to + */ + | string /** * Name of the branch the most recent commit belongs to */ - branch: /** - * Name of the branch the most recent commit belongs to - */ - | string - /** - * Name of the branch the most recent commit belongs to - */ - | null; + | null; + /** + * Name of the tag on the most recent commit + */ + tag: /** + * Name of the tag on the most recent commit + */ + | string /** * Name of the tag on the most recent commit */ - tag: /** - * Name of the tag on the most recent commit - */ - | string - /** - * Name of the tag on the most recent commit - */ - | null; + | null; + /** + * Whether or not the repo had uncommitted changes when snapshotted + */ + dirty: /** + * Whether or not the repo had uncommitted changes when snapshotted + */ + | boolean /** * Whether or not the repo had uncommitted changes when snapshotted */ - dirty: /** - * Whether or not the repo had uncommitted changes when snapshotted - */ - | boolean - /** - * Whether or not the repo had uncommitted changes when snapshotted - */ - | null; + | null; + /** + * Name of the author of the most recent commit + */ + author_name: /** + * Name of the author of the most recent commit + */ + | string /** * Name of the author of the most recent commit */ - author_name: /** - * Name of the author of the most recent commit - */ - | string - /** - * Name of the author of the most recent commit - */ - | null; + | null; + /** + * Email of the author of the most recent commit + */ + author_email: /** + * Email of the author of the most recent commit + */ + | string /** * Email of the author of the most recent commit */ - author_email: /** - * Email of the author of the most recent commit - */ - | string - /** - * Email of the author of the most recent commit - */ - | null; + | null; + /** + * Most recent commit message + */ + commit_message: /** + * Most recent commit message + */ + | string /** * Most recent commit message */ - commit_message: /** - * Most recent commit message - */ - | string - /** - * Most recent commit message - */ - | null; + | null; + /** + * Time of the most recent commit + */ + commit_time: /** + * Time of the most recent commit + */ + | string /** * Time of the most recent commit */ - commit_time: /** - * Time of the most recent commit - */ - | string - /** - * Time of the most recent commit - */ - | null; + | null; + /** + * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. + */ + git_diff: /** + * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. + */ + | string /** * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. */ - git_diff: /** - * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. - */ - | string - /** - * If the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit. - */ - | null; - }> + | null; + }> /** * Metadata about the state of the repo when the experiment was created - */ - | null; + */ | null; export type ExperimentType = { /** * Unique identifier for the experiment @@ -2142,28 +2178,25 @@ export type ExperimentType = { /** * Braintrust-controlled metadata about the experiment. */ - (| Partial< - { - /** - * BTQL filter payload used to evaluate a subset of a linked dataset. - */ - dataset_filter: /** - * BTQL filter payload used to evaluate a subset of a linked dataset. - */ - | {} - /** - * BTQL filter payload used to evaluate a subset of a linked dataset. - */ - | null; - } & { - [key: string]: any; - } - > - /** - * Braintrust-controlled metadata about the experiment. - */ - | null - ) + (Partial< + { + /** + * BTQL filter payload used to evaluate a subset of a linked dataset. + */ + dataset_filter: /** + * BTQL filter payload used to evaluate a subset of a linked dataset. + */ + {} + /** + * BTQL filter payload used to evaluate a subset of a linked dataset. + */ | null; + } & { + [key: string]: any; + } + > + /** + * Braintrust-controlled metadata about the experiment. + */ | null) | undefined; parameters_id?: | /** @@ -2218,12 +2251,10 @@ export type ExperimentType = { /** * User-controlled metadata about the experiment */ - (| {} - /** - * User-controlled metadata about the experiment - */ - | null - ) + ({} + /** + * User-controlled metadata about the experiment + */ | null) | undefined; tags?: | /** @@ -2232,24 +2263,22 @@ export type ExperimentType = { /** * A list of tags for the experiment */ - (| Array - /** - * A list of tags for the experiment - */ - | null - ) + (Array + /** + * A list of tags for the experiment + */ | null) | undefined; }; export type SpanTypeType = /** * Type of the span, for display purposes only * - * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, question, log + * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, decision, question, log */ | /** * Type of the span, for display purposes only * - * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, question, log + * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, decision, question, log */ (| "llm" | "score" @@ -2262,13 +2291,14 @@ export type SpanTypeType = | "preprocessor" | "classifier" | "review" + | "decision" | "question" | "log" ) /** * Type of the span, for display purposes only * - * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, question, log + * @enum llm, score, function, eval, task, tool, automation, facet, preprocessor, classifier, review, decision, question, log */ | null; export type SpanAttributesType = @@ -2278,64 +2308,63 @@ export type SpanAttributesType = /** * Human-identifying attributes of the span, such as name, type, etc. */ - | Partial< - { + Partial< + { + /** + * Name of the span, for display purposes only + */ + name: /** + * Name of the span, for display purposes only + */ + | string /** * Name of the span, for display purposes only */ - name: /** - * Name of the span, for display purposes only - */ - | string - /** - * Name of the span, for display purposes only - */ - | null; - type: SpanTypeType; + | null; + type: SpanTypeType; + /** + * A special value that indicates the span was generated by a scoring automation + * + * @enum scorer + */ + purpose: + | /** + * A special value that indicates the span was generated by a scoring automation + * + * @enum scorer + */ + "scorer" /** * A special value that indicates the span was generated by a scoring automation * * @enum scorer */ - purpose: - | /** - * A special value that indicates the span was generated by a scoring automation - * - * @enum scorer - */ - "scorer" - /** - * A special value that indicates the span was generated by a scoring automation - * - * @enum scorer - */ - | null; + | null; + /** + * Severity level of a log + * + * @enum trace, debug, info, warn, error, fatal + */ + log_level: + | /** + * Severity level of a log + * + * @enum trace, debug, info, warn, error, fatal + */ + ("trace" | "debug" | "info" | "warn" | "error" | "fatal") /** * Severity level of a log * * @enum trace, debug, info, warn, error, fatal */ - log_level: - | /** - * Severity level of a log - * - * @enum trace, debug, info, warn, error, fatal - */ - ("trace" | "debug" | "info" | "warn" | "error" | "fatal") - /** - * Severity level of a log - * - * @enum trace, debug, info, warn, error, fatal - */ - | null; - } & { - [key: string]: any; - } - > + | null; + } & { + [key: string]: any; + } + > /** * Human-identifying attributes of the span, such as name, type, etc. - */ - | null; + */ | null; export type ExperimentEventType = { /** * A unique identifier for the experiment event. If you don't provide one, Braintrust will generate one for you @@ -2372,34 +2401,32 @@ export type ExperimentEventType = { */ experiment_id: string; input?: /** - * 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 - */ - unknown | undefined; + * 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 + */ + unknown | undefined; 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 `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 - */ - unknown | undefined; + * 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 + */ + unknown | undefined; expected?: /** - * 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 - */ - unknown | undefined; + * 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 + */ + unknown | undefined; error?: /** - * The error that occurred, if any. - */ - unknown | undefined; + * The error that occurred, if any. + */ + unknown | undefined; 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 + * 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 ground 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. */ /** - * 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 + * 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 ground 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. */ - (| {} - /** - * 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 - */ - | null - ) + ({} + /** + * 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 ground 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. + */ | null) | undefined; metadata?: | /** @@ -2408,28 +2435,48 @@ export type ExperimentEventType = { /** * 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 */ - (| Partial< - { - /** - * The model used for this example - */ - model: /** - * The model used for this example - */ - | string - /** - * The model used for this example - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) + (Partial< + { + /** + * The model used for this example + */ + model: /** + * The model used for this example + */ + | string + /** + * The model used for this example + */ + | null; + /** + * The service tier requested for this LLM call + */ + requested_service_tier: /** + * The service tier requested for this LLM call + */ + | string + /** + * The service tier requested for this LLM call + */ + | null; + /** + * The service tier that served this LLM call + */ + served_service_tier: /** + * The service tier that served this LLM call + */ + | string + /** + * The service tier that served this LLM call + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) | undefined; tags?: | /** @@ -2438,12 +2485,10 @@ export type ExperimentEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; metrics?: | /** @@ -2468,70 +2513,66 @@ export type ExperimentEventType = { /** * 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 */ - (| Partial< - { - /** - * The function in code which created the experiment event - */ - caller_functionname: /** - * The function in code which created the experiment event - */ - | string - /** - * The function in code which created the experiment event - */ - | null; - /** - * Name of the file in code where the experiment event was created - */ - caller_filename: /** - * Name of the file in code where the experiment event was created - */ - | string - /** - * Name of the file in code where the experiment event was created - */ - | null; - /** - * Line of code where the experiment event was created - */ - caller_lineno: /** - * Line of code where the experiment event was created - */ - | number - /** - * Line of code where the experiment event was created - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) - | undefined; - /** - * 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_id: string; - span_parents?: - | /** - * 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 - */ - /** - * 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 - */ - (| Array - /** - * 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 - */ - | null - ) - | undefined; - /** + (Partial< + { + /** + * The function in code which created the experiment event + */ + caller_functionname: /** + * The function in code which created the experiment event + */ + | string + /** + * The function in code which created the experiment event + */ + | null; + /** + * Name of the file in code where the experiment event was created + */ + caller_filename: /** + * Name of the file in code where the experiment event was created + */ + | string + /** + * Name of the file in code where the experiment event was created + */ + | null; + /** + * Line of code where the experiment event was created + */ + caller_lineno: /** + * Line of code where the experiment event was created + */ + | number + /** + * Line of code where the experiment event was created + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) + | undefined; + /** + * A unique identifier used to link different experiment events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing + */ + span_id: string; + span_parents?: + | /** + * 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 + */ + /** + * 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 + */ + (Array + /** + * 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 + */ | null) + | undefined; + /** * A unique identifier for the trace this experiment event belongs to */ root_span_id: string; @@ -2558,12 +2599,10 @@ export type ExperimentEventType = { /** * Optional list of comments attached to this event */ - (| Array - /** - * Optional list of comments attached to this event - */ - | null - ) + (Array + /** + * Optional list of comments attached to this event + */ | null) | undefined; audit_data?: | /** @@ -2572,12 +2611,10 @@ export type ExperimentEventType = { /** * Optional list of audit entries attached to this event */ - (| Array - /** - * Optional list of audit entries attached to this event - */ - | null - ) + (Array + /** + * Optional list of audit entries attached to this event + */ | null) | undefined; facets?: | /** @@ -2586,12 +2623,10 @@ export type ExperimentEventType = { /** * Facets for categorization (dictionary from facet id to value) */ - (| {} - /** - * Facets for categorization (dictionary from facet id to value) - */ - | null - ) + ({} + /** + * Facets for categorization (dictionary from facet id to value) + */ | null) | undefined; classifications?: | /** @@ -2600,12 +2635,10 @@ export type ExperimentEventType = { /** * Classifications for this event (dictionary from classification name to items) */ - (| {} - /** - * Classifications for this event (dictionary from classification name to items) - */ - | null - ) + ({} + /** + * Classifications for this event (dictionary from classification name to items) + */ | null) | undefined; }; export type ExtendedSavedFunctionIdType = @@ -2616,9 +2649,9 @@ export type ExtendedSavedFunctionIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -2647,17 +2680,17 @@ export type FacetDataType = { */ prompt: string; model?: /** - * The model to use for facet extraction - */ - string | undefined; + * The model to use for facet extraction + */ + string | undefined; embedding_model?: /** - * The embedding model to use for vectorizing facet results. - */ - string | undefined; + * The embedding model to use for vectorizing facet results. + */ + string | undefined; no_match_pattern?: /** - * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' - */ - string | undefined; + * Regex pattern to identify outputs that do not match the facet. If the output matches, the facet will be saved as 'no_match' + */ + string | undefined; }; export type PromptBlockDataNullishType = | { @@ -2675,6 +2708,54 @@ export type PromptBlockDataNullishType = type: "completion"; content: string; } + | { + /** + * @enum decisions + */ + type: "decisions"; + input: + | string + | Array<{ + /** + * @enum system, developer, user, assistant + */ + role: "system" | "developer" | "user" | "assistant"; + content: string | Array; + }>; + questions: Array< + { + name?: string | undefined; + instructions: string; + } & ( + | { + /** + * @enum predicate + */ + type: "predicate"; + } + | { + /** + * @enum choice + */ + type: "choice"; + choices: Array<{ + value: string | boolean; + description?: string | undefined; + }>; + } + | { + /** + * @enum score + */ + type: "score"; + levels: Array<{ + label: string; + description?: string | undefined; + }>; + } + ) + >; + } | null; export type ModelParamsType = | Partial< @@ -2743,6 +2824,7 @@ export type ModelParamsType = * @enum low, medium, high */ verbosity: "low" | "medium" | "high"; + service_tier: string; } & { [key: string]: any; } @@ -2757,9 +2839,9 @@ export type ModelParamsType = top_k?: number | undefined; stop_sequences?: Array | undefined; max_tokens_to_sample?: /** - * This is a legacy parameter that should not be used. - */ - number | undefined; + * This is a legacy parameter that should not be used. + */ + number | undefined; } & { [key: string]: any; }) @@ -2809,21 +2891,21 @@ export type PromptParserNullishType = { type: "llm_classifier"; use_cot: boolean; choice_scores?: /** - * Map of choices to scores (0-1). Used by scorers. - */ - {} | undefined; + * Map of choices to scores (0-1). Used by scorers. + */ + {} | undefined; choice?: /** - * List of valid choices without score mapping. Used by classifiers that deposit output to tags. - */ - Array | undefined; + * List of valid choices without score mapping. Used by classifiers that deposit output to tags. + */ + Array | undefined; allow_no_match?: /** - * If true, adds a 'No match' option. When selected, no tag is deposited. - */ - boolean | undefined; + * If true, adds a 'No match' option. When selected, no tag is deposited. + */ + boolean | undefined; allow_skip?: /** - * If true, adds a 'Skip' option. When selected, the scorer returns null. - */ - boolean | undefined; + * If true, adds a 'Skip' option. When selected, the scorer returns null. + */ + boolean | undefined; } | null; export type PreprocessorIdType = /** @@ -2836,9 +2918,9 @@ export type PreprocessorIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -2874,35 +2956,34 @@ export type PromptDataNullishType = /** * The prompt, model, and its parameters */ - | Partial<{ - prompt: PromptBlockDataNullishType; - options: PromptOptionsNullishType; - parser: PromptParserNullishType; - preprocessor: PreprocessorIdType; - tool_functions: Array | null; + Partial<{ + prompt: PromptBlockDataNullishType; + options: PromptOptionsNullishType; + parser: PromptParserNullishType; + preprocessor: PreprocessorIdType; + tool_functions: Array | null; + /** + * @enum mustache, nunjucks, none + */ + template_format: + | /** + * @enum mustache, nunjucks, none + */ + ("mustache" | "nunjucks" | "none") /** * @enum mustache, nunjucks, none */ - template_format: - | /** - * @enum mustache, nunjucks, none - */ - ("mustache" | "nunjucks" | "none") - /** - * @enum mustache, nunjucks, none - */ - | null; - mcp: {} | null; - origin: Partial<{ - prompt_id: string; - project_id: string; - prompt_version: string; - }> | null; - }> + | null; + mcp: {} | null; + origin: Partial<{ + prompt_id: string; + project_id: string; + prompt_version: string; + }> | null; + }> /** * The prompt, model, and its parameters - */ - | null; + */ | null; export type FunctionTypeEnumNullishType = /** * @enum llm, scorer, task, tool, custom_view, preprocessor, facet, classifier, tag, parameters, sandbox @@ -2946,6 +3027,54 @@ export type PromptBlockDataType = */ type: "completion"; content: string; + } + | { + /** + * @enum decisions + */ + type: "decisions"; + input: + | string + | Array<{ + /** + * @enum system, developer, user, assistant + */ + role: "system" | "developer" | "user" | "assistant"; + content: string | Array; + }>; + questions: Array< + { + name?: string | undefined; + instructions: string; + } & ( + | { + /** + * @enum predicate + */ + type: "predicate"; + } + | { + /** + * @enum choice + */ + type: "choice"; + choices: Array<{ + value: string | boolean; + description?: string | undefined; + }>; + } + | { + /** + * @enum score + */ + type: "score"; + levels: Array<{ + label: string; + description?: string | undefined; + }>; + } + ) + >; }; export type GraphNodeType = | { @@ -2970,21 +3099,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum function @@ -3014,21 +3141,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * The input to the graph @@ -3059,21 +3184,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * The output of the graph @@ -3104,30 +3227,28 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum literal */ type: "literal"; value?: /** - * A literal value to be returned - */ - unknown | undefined; + * A literal value to be returned + */ + unknown | undefined; } | { description?: @@ -3151,21 +3272,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum btql @@ -3198,21 +3317,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum gate @@ -3255,21 +3372,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum aggregator @@ -3298,21 +3413,19 @@ export type GraphNodeType = /** * The position of the node */ - (| { - /** - * The x position of the node - */ - x: number; - /** - * The y position of the node - */ - y: number; - } + ({ /** - * The position of the node + * The x position of the node */ - | null - ) + x: number; + /** + * The y position of the node + */ + y: number; + } + /** + * The position of the node + */ | null) | undefined; /** * @enum prompt_template @@ -3387,9 +3500,9 @@ export type FunctionDataType = }; code: string; code_hash?: /** - * SHA256 hash of the code, computed at save time - */ - string | undefined; + * SHA256 hash of the code, computed at save time + */ + string | undefined; }; } | GraphDataType @@ -3433,12 +3546,10 @@ export type FunctionDataType = /** * Configuration options to pass to the global function (e.g., for preprocessor customization) */ - (| {} - /** - * Configuration options to pass to the global function (e.g., for preprocessor customization) - */ - | null - ) + ({} + /** + * Configuration options to pass to the global function (e.g., for preprocessor customization) + */ | null) | undefined; } | FacetDataType @@ -3465,28 +3576,170 @@ export type FunctionDataType = additionalProperties?: boolean | undefined; }; } - | (TopicMapDataType & unknown); -export type FunctionType = { - /** - * Unique identifier for the prompt - */ - id: string; - /** - * 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 prompt (see the `version` parameter) - */ - _xact_id: string; - /** - * Unique identifier for the project that the prompt belongs under - */ - project_id: string; - /** - * A literal 'p' which identifies the object as a project prompt - * - * @enum p - */ - log_id: "p"; + | (TopicMapDataType & unknown) /** - * Unique identifier for the organization + * A task function that runs a conversation between an agent and a simulated user. + */ + | { + /** + * @enum conversation + */ + type: "conversation"; + config: + | { + /** + * Who speaks first in the conversation + * + * @default "agent" + * @enum agent, simulated_user + */ + initiator: "agent" | "simulated_user"; + /** + * Maximum conversation duration in seconds + * + * @default 600 + * @minimum 15 + * @maximum 3600 + */ + timeout_seconds: number; + /** + * @default "voice" + * @enum voice + */ + modality: "voice"; + agent: + | { + /** + * @enum livekit + */ + type: "livekit"; + /** + * The WebSocket URL of the LiveKit project hosting the agent + * + * @minLength 1 + */ + server_url: string; + /** + * The name of the LiveKit agent to dispatch + * + * @minLength 1 + */ + agent_name: string; + } + | { + /** + * @enum phone + */ + type: "phone"; + /** + * @pattern ^\+[1-9]\d{7,14}$ + */ + phone_number: string; + } + | { + /** + * @enum sip + */ + type: "sip"; + /** + * @pattern ^sips?:[^\s]+$ + */ + uri: string; + }; + } + | { + /** + * Who speaks first in the conversation + * + * @default "agent" + * @enum agent, simulated_user + */ + initiator: "agent" | "simulated_user"; + /** + * Maximum conversation duration in seconds + * + * @default 600 + * @minimum 15 + * @maximum 3600 + */ + timeout_seconds: number; + /** + * @enum text + */ + modality: "text"; + agent: + | { + /** + * @enum livekit + */ + type: "livekit"; + /** + * The WebSocket URL of the LiveKit project hosting the agent + * + * @minLength 1 + */ + server_url: string; + /** + * The name of the LiveKit agent to dispatch + * + * @minLength 1 + */ + agent_name: string; + } + | { + /** + * @enum acp + */ + type: "acp"; + /** + * Executable for the ACP agent subprocess, communicating over stdio + * + * @minLength 1 + */ + command: string; + /** + * Arguments passed to the executable without shell interpretation + * + * @default [] + */ + args: Array; + /** + * Absolute working directory for the ACP session on the execution host + * + * @pattern ^(?:[/]|[A-Za-z]:[\\/]|\\\\) + */ + cwd: string; + /** + * Deny ACP permission requests; this does not sandbox the subprocess + * + * @default "deny" + * @enum deny + */ + permissions: "deny"; + }; + }; + }; +export type FunctionType = { + /** + * Unique identifier for the prompt + */ + id: string; + /** + * 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 prompt (see the `version` parameter) + */ + _xact_id: string; + /** + * Unique identifier for the project that the prompt belongs under + */ + project_id: string; + /** + * A literal 'p' which identifies the object as a project prompt + * + * @enum p + */ + log_id: "p"; + /** + * Unique identifier for the organization */ org_id: string; /** @@ -3533,12 +3786,10 @@ export type FunctionType = { /** * A list of tags for the prompt */ - (| Array - /** - * A list of tags for the prompt - */ - | null - ) + (Array + /** + * A list of tags for the prompt + */ | null) | undefined; metadata?: | /** @@ -3547,12 +3798,10 @@ export type FunctionType = { /** * User-controlled metadata about the prompt */ - (| {} - /** - * User-controlled metadata about the prompt - */ - | null - ) + ({} + /** + * User-controlled metadata about the prompt + */ | null) | undefined; function_type?: FunctionTypeEnumNullishType | undefined; function_data: FunctionDataType; @@ -3565,14 +3814,14 @@ export type FunctionType = { object_id: string; internal?: | /** - * The function exists for internal purposes and should not be displayed in the list of functions. + * If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI. */ /** - * The function exists for internal purposes and should not be displayed in the list of functions. + * If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI. */ (| boolean /** - * The function exists for internal purposes and should not be displayed in the list of functions. + * If true, the function was created for use by another Braintrust object and is hidden from function lists in the Braintrust UI. */ | null ) @@ -3586,22 +3835,20 @@ export type FunctionType = { /** * JSON schema for the function's parameters and return type */ - (| Partial<{ - parameters: unknown; - returns: unknown; - }> - /** - * JSON schema for the function's parameters and return type - */ - | null - ) + (Partial<{ + parameters: unknown; + returns: unknown; + }> + /** + * JSON schema for the function's parameters and return type + */ | null) | undefined; }; export type FunctionFormatType = /** - * @enum llm, code, global, graph, topic_map + * @enum llm, code, global, graph, topic_map, conversation */ - "llm" | "code" | "global" | "graph" | "topic_map"; + "llm" | "code" | "global" | "graph" | "topic_map" | "conversation"; export type PromptDataType = Partial<{ prompt: PromptBlockDataNullishType; options: PromptOptionsNullishType; @@ -3640,9 +3887,9 @@ export type FunctionIdType = */ function_id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } /** * Project name and slug @@ -3657,9 +3904,9 @@ export type FunctionIdType = */ slug: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } /** * Global function name @@ -3684,9 +3931,9 @@ export type FunctionIdType = */ prompt_session_function_id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } /** * Inline code function @@ -3704,10 +3951,11 @@ export type FunctionIdType = */ code: string; function_type?: - | (FunctionTypeEnumType & - /** - * The function type for inline code. Required when invoking inline preprocessors. - */ unknown) + | (FunctionTypeEnumType + /** + * The function type for inline code. Required when invoking inline preprocessors. + */ & + unknown) | undefined; name?: | /** @@ -3887,12 +4135,10 @@ export type GroupType = { /** * Ids of users which belong to this group */ - (| Array - /** - * Ids of users which belong to this group - */ - | null - ) + (Array + /** + * Ids of users which belong to this group + */ | null) | undefined; member_groups?: | /** @@ -3905,13 +4151,11 @@ export type GroupType = { An inheriting group has all the users contained in its member groups, as well as all of their inherited users */ - (| Array /** + (Array /** * Ids of the groups this group inherits from An inheriting group has all the users contained in its member groups, as well as all of their inherited users - */ - | null - ) + */ | null) | undefined; }; export type GroupScopeType = { @@ -3924,18 +4168,18 @@ export type GroupScopeType = { */ group_by: string; interval_seconds?: /** - * Maximum time range to include when constructing a group - * - * @minimum 1 - */ - number | undefined; + * Maximum time range to include when constructing a group + * + * @minimum 1 + */ + number | undefined; max_traces?: /** - * Maximum number of traces to include when constructing a group (default/max: 64) - * - * @minimum 1 - * @maximum 64 - */ - number | undefined; + * Maximum number of traces to include when constructing a group (default/max: 64) + * + * @minimum 1 + * @maximum 64 + */ + number | undefined; /** * Which trace or traces to write grouped scorer results to * @@ -3943,9 +4187,9 @@ export type GroupScopeType = { */ placement: "first" | "each"; idle_seconds?: /** - * Optional: trigger after this many seconds of inactivity - */ - number | undefined; + * Optional: trigger after this many seconds of inactivity + */ + number | undefined; }; export type IfExistsType = /** @@ -3988,30 +4232,28 @@ export type InvokeParentType = object_id: string; row_ids?: | /** - * Identifiers for the row to to log a subspan under + * Identifiers for the row to log a subspan under */ /** - * Identifiers for the row to to log a subspan under + * Identifiers for the row to log a subspan under */ - (| { - /** - * The id of the row - */ - id: string; - /** - * The span_id of the row - */ - span_id: string; - /** - * The root_span_id of the row - */ - root_span_id: string; - } + ({ /** - * Identifiers for the row to to log a subspan under + * The id of the row */ - | null - ) + id: string; + /** + * The span_id of the row + */ + span_id: string; + /** + * The root_span_id of the row + */ + root_span_id: string; + } + /** + * Identifiers for the row to log a subspan under + */ | null) | undefined; propagated_event?: | /** @@ -4020,12 +4262,10 @@ export type InvokeParentType = /** * Include these properties in every span created under this parent */ - (| {} - /** - * Include these properties in every span created under this parent - */ - | null - ) + ({} + /** + * Include these properties in every span created under this parent + */ | null) | undefined; } /** @@ -4056,6 +4296,10 @@ export type InvokeFunctionType = */ FunctionIdType & Partial<{ + /** + * A label identifying the caller, used to attribute usage + */ + request_source: string; /** * Argument to the function, which can be any JSON serializable value */ @@ -4065,27 +4309,25 @@ export type InvokeFunctionType = */ expected: unknown; /** - * Any relevant metadata. This will be logged and available as the `metadata` argument. + * Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`. */ metadata: /** - * Any relevant metadata. This will be logged and available as the `metadata` argument. - */ - | {} - /** - * Any relevant metadata. This will be logged and available as the `metadata` argument. - */ - | null; + * Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`. + */ + {} + /** + * Any relevant metadata to log on the span. For prompts, this is available as the `metadata` template variable. For code functions, this is passed through hooks and is not added to `input`. + */ | null; /** * Any relevant tags to log on the span. */ tags: /** - * Any relevant tags to log on the span. - */ - | Array - /** - * Any relevant tags to log on the span. - */ - | null; + * Any relevant tags to log on the span. + */ + Array + /** + * Any relevant tags to log on the span. + */ | null; /** * If the function is an LLM, additional messages to pass along to it */ @@ -4095,9 +4337,9 @@ export type InvokeFunctionType = * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. */ stream: /** - * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. - */ - | boolean + * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. + */ + | boolean /** * Whether to stream the response. If true, results will be returned in the Braintrust SSE format. */ @@ -4107,9 +4349,9 @@ export type InvokeFunctionType = * If true, throw an error if one of the variables in the prompt is not present in the input */ strict: /** - * If true, throw an error if one of the variables in the prompt is not present in the input - */ - | boolean + * If true, throw an error if one of the variables in the prompt is not present in the input + */ + | boolean /** * If true, throw an error if one of the variables in the prompt is not present in the input */ @@ -4122,20 +4364,19 @@ export type InvokeFunctionType = * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. */ overrides: /** - * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. - */ - | {} - /** - * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. - */ - | null; + * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. + */ + {} + /** + * Partial function definition to merge with the function being invoked. Fields are validated against the function type's schema at runtime. For facets: { preprocessor?, prompt?, model? }. For prompts: { model?, ... }. + */ | null; /** * Name of the AI provider secret to pin this invocation to. */ endpoint_name: /** - * Name of the AI provider secret to pin this invocation to. - */ - | string + * Name of the AI provider secret to pin this invocation to. + */ + | string /** * Name of the AI provider secret to pin this invocation to. */ @@ -4242,9 +4483,9 @@ export type NullableSavedFunctionIdType = type: "function"; id: string; version?: /** - * The version of the function - */ - string | undefined; + * The version of the function + */ + string | undefined; } | { /** @@ -4317,12 +4558,20 @@ export type TraceScopeType = { */ type: "trace"; idle_seconds?: /** - * Consider trace complete after this many seconds of inactivity (default: 30) - */ - number | undefined; + * Consider trace complete after this many seconds of inactivity (default: 30) + */ + number | undefined; }; export type OnlineScoreConfigType = { status?: AutomationStatusType | undefined; + service_tier?: + | /** + * Service tier for online scoring. If omitted, prompt-level service tiers are preserved. + * + * @enum standard, flex + */ + ("standard" | "flex") + | undefined; /** * The sampling rate for online scoring * @@ -4369,12 +4618,10 @@ export type OnlineScoreConfigType = { /** * Trigger online scoring on any spans with a name in this list. Only applies when scope is 'span' or unset. */ - (| Array - /** - * Trigger online scoring on any spans with a name in this list. Only applies when scope is 'span' or unset. - */ - | null - ) + (Array + /** + * Trigger online scoring on any spans with a name in this list. Only applies when scope is 'span' or unset. + */ | null) | undefined; skip_logging?: | /** @@ -4406,11 +4653,76 @@ export type OrganizationType = { * Name of the organization */ name: string; - api_url?: (string | null) | undefined; - is_universal_api?: (boolean | null) | undefined; - is_dataplane_private?: (boolean | null) | undefined; - proxy_url?: (string | null) | undefined; - realtime_url?: (string | null) | undefined; + api_url?: + | /** + * URL of the organization's data plane API. If unset, the Braintrust-hosted API is used. + */ + /** + * URL of the organization's data plane API. If unset, the Braintrust-hosted API is used. + */ + (| string + /** + * URL of the organization's data plane API. If unset, the Braintrust-hosted API is used. + */ + | null + ) + | undefined; + is_universal_api?: + | /** + * Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended + */ + /** + * Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended + */ + (| boolean + /** + * Whether the data plane at `api_url` also serves the AI proxy, at `api_url` with `/v1/proxy` appended + */ + | null + ) + | undefined; + is_dataplane_private?: + | /** + * Whether the organization's data plane is only reachable from a private network + */ + /** + * Whether the organization's data plane is only reachable from a private network + */ + (| boolean + /** + * Whether the organization's data plane is only reachable from a private network + */ + | null + ) + | undefined; + proxy_url?: + | /** + * URL of the organization's AI proxy + */ + /** + * URL of the organization's AI proxy + */ + (| string + /** + * URL of the organization's AI proxy + */ + | null + ) + | undefined; + realtime_url?: + | /** + * URL of the organization's realtime service + */ + /** + * URL of the organization's realtime service + */ + (| string + /** + * URL of the organization's realtime service + */ + | null + ) + | undefined; created?: | /** * Date of organization creation @@ -4425,8 +4737,34 @@ export type OrganizationType = { | null ) | undefined; - archived_at?: (string | null) | undefined; - deleted_at?: (string | null) | undefined; + archived_at?: + | /** + * Date the organization was archived + */ + /** + * Date the organization was archived + */ + (| string + /** + * Date the organization was archived + */ + | null + ) + | undefined; + deleted_at?: + | /** + * Date the organization was deleted + */ + /** + * Date the organization was deleted + */ + (| string + /** + * Date the organization was deleted + */ + | null + ) + | undefined; image_rendering_mode?: ImageRenderingModeType | undefined; }; export type RetentionObjectTypeType = @@ -4494,143 +4832,398 @@ export type OrgAutomationType = { /** * The configuration for the org automation rule */ - config: { - /** - * The type of automation. + config: { + /** + * The type of automation. + * + * @enum retention + */ + event_type: "retention"; + object_type: RetentionObjectTypeType; + /** + * The number of days to retain the object + * + * @minimum 0 + */ + retention_days: number; + }; +}; +export type ProjectSettingsType = Partial<{ + /** + * The key used to join two experiments (defaults to `input`) + */ + comparison_key: /** + * The key used to join two experiments (defaults to `input`) + */ + | string + /** + * The key used to join two experiments (defaults to `input`) + */ + | null; + /** + * The id of the experiment to use as the default baseline for comparisons + */ + baseline_experiment_id: /** + * The id of the experiment to use as the default baseline for comparisons + */ + | string + /** + * The id of the experiment to use as the default baseline for comparisons + */ + | null; + /** + * The order of the fields to display in the trace view + */ + spanFieldOrder: /** + * The order of the fields to display in the trace view + */ + Array<{ + object_type: string; + column_id: string; + position: string; + layout?: + | ( + | /** + * @enum full + */ + "full" + /** + * @enum two_column + */ + | "two_column" + | null + ) + | undefined; + }> + /** + * The order of the fields to display in the trace view + */ | null; + /** + * The remote eval sources to use for the project + */ + remote_eval_sources: /** + * The remote eval sources to use for the project + */ + Array<{ + url: string; + name?: (string | null) | undefined; + description?: (string | null) | undefined; + }> + /** + * The remote eval sources to use for the project + */ | null; + /** + * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + */ + disable_realtime_queries: /** + * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + */ + | boolean + /** + * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + */ + | null; + /** + * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + */ + monitor_charts_use_metrics_start: /** + * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + */ + | boolean + /** + * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + */ + | null; + /** + * If true, enable the agent insights dashboard for this project. + */ + coding_agent_insights_dashboard: /** + * If true, enable the agent insights dashboard for this project. + */ + | boolean + /** + * If true, enable the agent insights dashboard for this project. + */ + | null; + /** + * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + */ + blind_reviews: /** + * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + */ + | boolean + /** + * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + */ + | null; + /** + * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + */ + require_all_human_review_scores: /** + * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + */ + | boolean + /** + * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + */ + | null; + user_id_fields: Array< + /** + * Path to the application's end-user identifier in metadata or span_attributes, for example ["metadata", "customer_id"]. This identifies an end user, not a session, request, organization, or the Braintrust user who created the project. + */ + Array + > | null; + /** + * Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions. + */ + pattern_alert_mention: /** + * Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions. + */ + { + /** + * @minLength 1 + */ + workspace_id: string; + /** + * Slack member ID of the user or agent to mention in a Pattern alert's thread to investigate the pattern. + * + * @pattern ^[UW][A-Z0-9]+$ + */ + mention_user_id: string; + mention_handle?: /** + * Username shown for the selected user or agent. Mentions use mention_user_id. + * + * @maxLength 80 + */ + string | undefined; + mention_prompt?: /** + * Message posted after the mention in a Pattern alert's thread. {{pattern}} is replaced with a link to the pattern. Defaults to "Please investigate this pattern: {{pattern}}. Review the evidence, identify the root cause, and suggest a fix." + * + * @maxLength 2000 + * @pattern \{\{pattern\}\} + */ + string | undefined; + } + /** + * Project-wide Slack user or agent and prompt for Pattern alert threads. Applies only to destinations in the selected workspace. Unset or null disables mentions. + */ | null; + /** + * Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts. + */ + pattern_alert_destinations: /** + * Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts. + */ + Array< + /** + * A delivery action available to an automation + */ + | { + /** + * The type of action to take + * + * @enum webhook + */ + type: "webhook"; + /** + * The webhook URL to send the request to + */ + url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; + formatting_prompt?: /** + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; + } + | { + /** + * The type of action to take + * + * @enum slack + */ + type: "slack"; + /** + * The Slack workspace ID to post to + */ + workspace_id: string; + /** + * The Slack channel ID to post to + */ + channel: string; + message_template?: /** + * Custom message template for the alert + */ + string | undefined; + formatting_prompt?: /** + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; + } + | { + /** + * The type of action to take + * + * @enum pagerduty + */ + type: "pagerduty"; + /** + * The data-plane secret containing the PagerDuty routing key + */ + routing_key_secret_name: string; + /** + * @enum critical, error, warning, info + */ + severity: "critical" | "error" | "warning" | "info"; + formatting_prompt?: /** + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; + } + > + /** + * Project-wide Slack, webhook, and PagerDuty destinations for new and reactivated Pattern alerts. An empty array disables alerts. + */ | null; + /** + * Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium. + * + * @enum high, medium, low + */ + pattern_alert_min_severity: + | /** + * Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium. * - * @enum retention + * @enum high, medium, low */ - event_type: "retention"; - object_type: RetentionObjectTypeType; + ("high" | "medium" | "low") /** - * The number of days to retain the object + * Lowest severity that sends Pattern alerts: `low`, `medium`, or `high`. New and reactivated Patterns below it don't send alerts, and raising an active Pattern's severity to it or above sends one. Patterns without a severity count as low. Informational Patterns follow `pattern_alert_informational` instead. Unset or null uses medium. * - * @minimum 0 - */ - retention_days: number; - }; -}; -export type ProjectSettingsType = Partial<{ - /** - * The key used to join two experiments (defaults to `input`) - */ - comparison_key: /** - * The key used to join two experiments (defaults to `input`) - */ - | string - /** - * The key used to join two experiments (defaults to `input`) + * @enum high, medium, low */ | null; /** - * The id of the experiment to use as the default baseline for comparisons + * Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns. */ - baseline_experiment_id: /** - * The id of the experiment to use as the default baseline for comparisons - */ - | string - /** - * The id of the experiment to use as the default baseline for comparisons - */ - | null; - /** - * The order of the fields to display in the trace view + pattern_alert_informational: /** + * Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns. */ - spanFieldOrder: /** - * The order of the fields to display in the trace view - */ - | Array<{ - object_type: string; - column_id: string; - position: string; - layout?: - | ( - | /** - * @enum full - */ - "full" - /** - * @enum two_column - */ - | "two_column" - | null - ) - | undefined; - }> + | boolean /** - * The order of the fields to display in the trace view + * Whether new and reactivated informational Patterns send alerts, independent of `pattern_alert_min_severity`. Unset or null sends alerts for informational Patterns. */ | null; /** - * The remote eval sources to use for the project + * Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server. */ - remote_eval_sources: /** - * The remote eval sources to use for the project - */ - | Array<{ - url: string; - name?: (string | null) | undefined; - description?: (string | null) | undefined; - }> - /** - * The remote eval sources to use for the project - */ - | null; - /** - * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. + pattern_sources: /** + * Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server. */ - disable_realtime_queries: /** - * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. - */ - | boolean + Array<{ /** - * If true, disable real-time queries for this project. This can improve query performance for high-volume logs. - */ - | null; - /** - * If true, use metrics.start rather than created for monitor chart time bucket dimensions. - */ - monitor_charts_use_metrics_start: /** - * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + * @minLength 1 + * @maxLength 64 */ - | boolean + type: string; /** - * If true, use metrics.start rather than created for monitor chart time bucket dimensions. + * The project MCP server that reads this source. */ - | null; + mcp_server_id: string; + instructions?: + | /** + * What the user wants Patterns to look for in this source, in their own words. + * + * @maxLength 4000 + */ + /** + * What the user wants Patterns to look for in this source, in their own words. + * + * @maxLength 4000 + */ + (| string + /** + * What the user wants Patterns to look for in this source, in their own words. + * + * @maxLength 4000 + */ + | null + ) + | undefined; + }> /** - * If true, enable the agent insights dashboard for this project. - */ - coding_agent_insights_dashboard: /** - * If true, enable the agent insights dashboard for this project. - */ - | boolean - /** - * If true, enable the agent insights dashboard for this project. - */ - | null; + * Sources outside Braintrust that Patterns reads alongside this project's logs, each through a project MCP server. + */ | null; /** - * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. + * Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them. */ - blind_reviews: /** - * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. - */ - | boolean - /** - * If true, hide peer review scores, comments, and aggregate results from reviewers without project update permissions until they submit their own review. - */ - | null; - /** - * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + pattern_excluded_categories: /** + * Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them. */ - require_all_human_review_scores: /** - * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. - */ - | boolean + Array + /** + * Patterns rubric categories that are turned off for this project. Patterns doesn't look for or assign them. + */ | null; + session_id_fields: Array< /** - * If true, automatically complete a review after every assigned reviewer fills all human review scores visible to them. + * Path to the application's session or conversation identifier in metadata or span_attributes, for example ["metadata", "conversation_id"]. This links turns of one conversation across traces, rather than identifying a user, request, trace, organization, or service account. */ - | null; + Array + > | null; default_preprocessor: NullableSavedFunctionIdType; }> | null; export type ProjectType = { @@ -4704,6 +5297,35 @@ export type ProjectType = { | undefined; settings?: ProjectSettingsType | undefined; }; +export type SavedPreprocessorIdType = + /** + * Saved preprocessor that renders traces for the project's pattern questions. The project default when unset. + */ + | { + /** + * @enum function + */ + type: "function"; + id: string; + version?: /** + * The version of the function + */ + string | undefined; + } + | { + /** + * @enum global + */ + type: "global"; + name: string; + /** + * The type of global function. Defaults to 'preprocessor'. + * + * @default "preprocessor" + * @enum preprocessor + */ + function_type: "preprocessor"; + }; export type WindowedAutomationConfigType = { /** * The type of automation. @@ -4715,27 +5337,31 @@ export type WindowedAutomationConfigType = { | /** * The product surface that created and manages the automation * - * @enum patterns + * @enum patterns, dashboard, digest, pattern_alerts */ (| /** * The product surface that created and manages the automation * - * @enum patterns + * @enum patterns, dashboard, digest, pattern_alerts */ - "patterns" + ("patterns" | "dashboard" | "digest" | "pattern_alerts") /** * The product surface that created and manages the automation * - * @enum patterns + * @enum patterns, dashboard, digest, pattern_alerts */ | null ) | undefined; status?: AutomationStatusType | undefined; + continuous?: /** + * Between scheduled runs, check for accumulated new work. The executor decides how to process it. + */ + boolean | undefined; threshold?: /** - * Optional calculation and lifecycle policy that gate scheduled delivery - */ - | { + * Optional calculation and lifecycle policy that gate scheduled delivery + */ + | { /** * The calculation evaluated for each window */ @@ -4889,9 +5515,9 @@ export type WindowedAutomationConfigType = { evaluation_delay_seconds: number; }; loop?: /** - * Optional Loop agent to run for each triggered window - */ - | { + * Optional Loop agent to run for each triggered window + */ + | { /** * Instructions for the Loop agent * @@ -4899,6 +5525,14 @@ export type WindowedAutomationConfigType = { * @maxLength 10000 */ prompt: string; + digest?: + | { + /** + * @enum compact, detailed + */ + writing_style: "compact" | "detailed"; + } + | undefined; /** * Whether to include the automation trigger payload as input * @@ -4922,30 +5556,51 @@ export type WindowedAutomationConfigType = { string>; harness?: | /** - * Required when saving a Loop automation. Currently only Codex is supported. + * Required for an explicit model selection. Currently only Codex is supported. * - * @enum codex, native, claude-code + * @enum native, codex, claude-code, pi */ - ("codex" | "native" | "claude-code") + ("native" | "codex" | "claude-code" | "pi") | undefined; model?: /** - * Required when saving a Loop automation. - * - * @minLength 1 - */ - string | undefined; + * Omit harness, model, and endpoint_name to inherit the organization default provider and its recommended execution settings. + * + * @minLength 1 + */ + string | undefined; endpoint_name?: /** - * @minLength 1 - */ - string | undefined; + * @minLength 1 + */ + string | undefined; reasoning_effort?: | /** * @enum none, minimal, low, medium, high, xhigh, max */ ("none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max") | undefined; + target?: /** + * The object this automation writes to or maintains + */ + | { + /** + * @enum dashboard + */ + type: "dashboard"; + /** + * @enum overview + */ + id: "overview"; + } + | undefined; } | undefined; + patterns?: /** + * Settings of the Patterns automation + */ + | Partial<{ + preprocessor: SavedPreprocessorIdType; + }> + | undefined; /** * Delivery actions exposed to Loop as tools, or run directly when Loop is not configured * @@ -4966,13 +5621,50 @@ export type WindowedAutomationConfigType = { * The webhook URL to send the request to */ url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -4990,27 +5682,16 @@ export type WindowedAutomationConfigType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. + * Instructions for Loop to format content sent to this destination * * @minLength 1 * @maxLength 10000 */ - string | undefined; + string | undefined; } | { /** @@ -5028,12 +5709,12 @@ export type WindowedAutomationConfigType = { */ severity: "critical" | "error" | "warning" | "info"; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } >; }; @@ -5056,10 +5737,11 @@ export type TopicAutomationFacetModelType = */ | null; export type TopicMapFunctionAutomationType = { - function: SavedFunctionIdType & - /** - * Topic map function - */ unknown; + function: SavedFunctionIdType + /** + * Topic map function + */ & + unknown; btql_filter?: | /** * Per-topic-map BTQL filter. For trace scope, a topic map runs when max(filter) over the trace is truthy. For span scope, it runs when the current span matches. @@ -5239,32 +5921,21 @@ export type TopicDigestAutomationConfigType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; }; topic_map_function_ids?: /** - * Optional topic map function IDs to include in the digest - */ - Array | undefined; + * Optional topic map function IDs to include in the digest + */ + Array | undefined; }; export type ProjectAutomationType = { /** @@ -5359,13 +6030,50 @@ export type ProjectAutomationType = { * The webhook URL to send the request to */ url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5383,27 +6091,16 @@ export type ProjectAutomationType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5421,12 +6118,12 @@ export type ProjectAutomationType = { */ severity: "critical" | "error" | "warning" | "info"; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; }; } | { @@ -5511,11 +6208,11 @@ export type ProjectAutomationType = { */ service_account_email: string; credential_name?: /** - * The name of a Google workload identity federation credential configured in this organization's AI providers. Supported data planes can use it regardless of hosting environment. If omitted, the data plane's GCP identity is used. - * - * @minLength 1 - */ - string | undefined; + * The name of a Google workload identity federation credential configured in this organization's AI providers. Supported data planes can use it regardless of hosting environment. If omitted, the data plane's GCP identity is used. + * + * @minLength 1 + */ + string | undefined; }; batch_size?: | /** @@ -5613,9 +6310,9 @@ export type ProjectAutomationType = { event_type: "environment_update"; status?: AutomationStatusType | undefined; environment_filter?: /** - * Optional list of environment slugs to filter by - */ - Array | undefined; + * Optional list of environment slugs to filter by + */ + Array | undefined; /** * The action to take when the automation rule is triggered */ @@ -5631,13 +6328,50 @@ export type ProjectAutomationType = { * The webhook URL to send the request to */ url: string; + headers?: /** + * Custom HTTP headers to send with the webhook request + */ + | Array< + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The HTTP header value + * + * @maxLength 8192 + * @pattern ^[\t\x20-\x7e\x80-\xff]*$ + */ + value: string; + } + | { + /** + * The HTTP header name. Connection, Content-Length, Content-Type, Expect, Host, Idempotency-Key, Keep-Alive, Transfer-Encoding, and Upgrade are reserved and can't be used. + * + * @minLength 1 + * @maxLength 256 + * @pattern ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$ + */ + name: string; + /** + * The data-plane secret that holds the header value. The secret only works with the webhook URL it was saved for. + */ + secret_name: string; + } + > + | undefined; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5655,27 +6389,16 @@ export type ProjectAutomationType = { */ channel: string; message_template?: /** - * Custom message template for the alert - */ - string | undefined; + * Custom message template for the alert + */ + string | undefined; formatting_prompt?: /** - * Publish a Slack mrkdwn digest. - - Pattern selection requirement: include every selected Pattern whose final status is active at the end of this automation run, plus every selected Pattern that changed from active to inactive during this run (a newly inactive outcome). Exclude Patterns that were already inactive before this run and remained inactive. Do not mention excluded Patterns anywhere in the digest, including Highlights. If no selected Patterns meet these criteria, say "No current pattern outcomes." This requirement overrides conflicting formatting guidance. - - Include a complete "*Pattern outcomes*" section with one row for every included Pattern. - - Use this row format exactly: - • — `outcome` - - If a Pattern has no URL, use the plain title instead. Do not use GitHub Markdown tables or code-block tables, because links must remain clickable. Do not omit any active selected Pattern. - - After the outcome list, include a "*Highlights*" section with one very short paragraph, 2-3 sentences maximum. Summarize what changed or what broadly stands out among the included active Patterns. Do not introduce new claims beyond the run report. - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; } | { /** @@ -5693,12 +6416,12 @@ export type ProjectAutomationType = { */ severity: "critical" | "error" | "warning" | "info"; formatting_prompt?: /** - * Instructions for Loop to format content sent to this destination - * - * @minLength 1 - * @maxLength 10000 - */ - string | undefined; + * Instructions for Loop to format content sent to this destination + * + * @minLength 1 + * @maxLength 10000 + */ + string | undefined; }; } | WindowedAutomationConfigType @@ -5783,7 +6506,7 @@ export type ProjectGroupType = { ) | undefined; /** - * Sorted ids of active projects in this project group + * Sorted ids of active projects in this project group. Modifying membership requires project_group:update on the group. */ member_projects: Array; }; @@ -5829,34 +6552,32 @@ export type ProjectLogsEventType = { */ log_id: "g"; input?: /** - * The arguments that uniquely define a user input (an arbitrary, JSON serializable object). - */ - unknown | undefined; + * The arguments that uniquely define a user input (an arbitrary, JSON serializable object). + */ + unknown | undefined; 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 `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. - */ - unknown | undefined; + * 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. + */ + unknown | undefined; expected?: /** - * 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 while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models. - */ - unknown | undefined; + * 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 while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models. + */ + unknown | undefined; error?: /** - * The error that occurred, if any. - */ - unknown | undefined; + * The error that occurred, if any. + */ + unknown | undefined; 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 logs. + * 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 ground 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 logs. */ /** - * 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 logs. + * 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 ground 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 logs. */ - (| {} - /** - * 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 logs. - */ - | null - ) + ({} + /** + * 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 ground 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 logs. + */ | null) | undefined; metadata?: | /** @@ -5865,28 +6586,48 @@ export type ProjectLogsEventType = { /** * 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 */ - (| Partial< - { - /** - * The model used for this example - */ - model: /** - * The model used for this example - */ - | string - /** - * The model used for this example - */ - | null; - } & { - [key: string]: any; - } - > - /** - * 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 - */ - | null - ) + (Partial< + { + /** + * The model used for this example + */ + model: /** + * The model used for this example + */ + | string + /** + * The model used for this example + */ + | null; + /** + * The service tier requested for this LLM call + */ + requested_service_tier: /** + * The service tier requested for this LLM call + */ + | string + /** + * The service tier requested for this LLM call + */ + | null; + /** + * The service tier that served this LLM call + */ + served_service_tier: /** + * The service tier that served this LLM call + */ + | string + /** + * The service tier that served this LLM call + */ + | null; + } & { + [key: string]: any; + } + > + /** + * 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 + */ | null) | undefined; tags?: | /** @@ -5895,12 +6636,10 @@ export type ProjectLogsEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; metrics?: | /** @@ -5925,53 +6664,51 @@ export type ProjectLogsEventType = { /** * Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event */ - (| Partial< - { - /** - * The function in code which created the project logs event - */ - caller_functionname: /** - * The function in code which created the project logs event - */ - | string - /** - * The function in code which created the project logs event - */ - | null; - /** - * Name of the file in code where the project logs event was created - */ - caller_filename: /** - * Name of the file in code where the project logs event was created - */ - | string - /** - * Name of the file in code where the project logs event was created - */ - | null; - /** - * Line of code where the project logs event was created - */ - caller_lineno: /** - * Line of code where the project logs event was created - */ - | number - /** - * Line of code where the project logs event was created - */ - | null; - } & { - [key: string]: any; - } - > - /** - * Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event - */ - | null - ) + (Partial< + { + /** + * The function in code which created the project logs event + */ + caller_functionname: /** + * The function in code which created the project logs event + */ + | string + /** + * The function in code which created the project logs event + */ + | null; + /** + * Name of the file in code where the project logs event was created + */ + caller_filename: /** + * Name of the file in code where the project logs event was created + */ + | string + /** + * Name of the file in code where the project logs event was created + */ + | null; + /** + * Line of code where the project logs event was created + */ + caller_lineno: /** + * Line of code where the project logs event was created + */ + | number + /** + * Line of code where the project logs event was created + */ + | null; + } & { + [key: string]: any; + } + > + /** + * Context is additional information about the code that produced the project logs event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the project logs event + */ | null) | undefined; /** - * A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/instrument) for full details on tracing + * A unique identifier used to link different project logs events together as part of a full trace. See the [tracing guide](https://docs.braintrust.dev/instrument) for full details on tracing */ span_id: string; span_parents?: @@ -5981,12 +6718,10 @@ export type ProjectLogsEventType = { /** * An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans */ - (| Array - /** - * An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans - */ - | null - ) + (Array + /** + * An array of the parent `span_ids` of this project logs event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans + */ | null) | undefined; /** * A unique identifier for the trace this project logs event belongs to @@ -6015,12 +6750,10 @@ export type ProjectLogsEventType = { /** * Optional list of comments attached to this event */ - (| Array - /** - * Optional list of comments attached to this event - */ - | null - ) + (Array + /** + * Optional list of comments attached to this event + */ | null) | undefined; audit_data?: | /** @@ -6029,17 +6762,15 @@ export type ProjectLogsEventType = { /** * Optional list of audit entries attached to this event */ - (| Array - /** - * Optional list of audit entries attached to this event - */ - | null - ) + (Array + /** + * Optional list of audit entries attached to this event + */ | null) | undefined; _async_scoring_state?: /** - * The async scoring state for this event - */ - unknown | undefined; + * The async scoring state for this event + */ + unknown | undefined; facets?: | /** * Facets for categorization (dictionary from facet id to value) @@ -6047,12 +6778,10 @@ export type ProjectLogsEventType = { /** * Facets for categorization (dictionary from facet id to value) */ - (| {} - /** - * Facets for categorization (dictionary from facet id to value) - */ - | null - ) + ({} + /** + * Facets for categorization (dictionary from facet id to value) + */ | null) | undefined; classifications?: | /** @@ -6061,12 +6790,10 @@ export type ProjectLogsEventType = { /** * Classifications for this event (dictionary from classification name to items) */ - (| {} - /** - * Classifications for this event (dictionary from classification name to items) - */ - | null - ) + ({} + /** + * Classifications for this event (dictionary from classification name to items) + */ | null) | undefined; }; export type ProjectScoreTypeType = @@ -6332,12 +7059,10 @@ export type PromptType = { /** * A list of tags for the prompt */ - (| Array - /** - * A list of tags for the prompt - */ - | null - ) + (Array + /** + * A list of tags for the prompt + */ | null) | undefined; metadata?: | /** @@ -6346,12 +7071,10 @@ export type PromptType = { /** * User-controlled metadata about the prompt */ - (| {} - /** - * User-controlled metadata about the prompt - */ - | null - ) + ({} + /** + * User-controlled metadata about the prompt + */ | null) | undefined; function_type?: FunctionTypeEnumNullishType | undefined; }; @@ -6397,26 +7120,26 @@ export type PromptSessionEventType = { */ prompt_session_id: string; prompt_session_data?: /** - * Data about the prompt session - */ - unknown | undefined; + * Data about the prompt session + */ + unknown | undefined; prompt_data?: /** - * Data about the prompt - */ - unknown | undefined; + * Data about the prompt + */ + unknown | undefined; function_data?: /** - * Data about the function - */ - unknown | undefined; + * Data about the function + */ + unknown | undefined; function_type?: FunctionTypeEnumNullishType | undefined; object_data?: /** - * Data about the mapped data - */ - unknown | undefined; + * Data about the mapped data + */ + unknown | undefined; completion?: /** - * Data about the completion - */ - unknown | undefined; + * Data about the completion + */ + unknown | undefined; tags?: | /** * A list of tags to log @@ -6424,12 +7147,10 @@ export type PromptSessionEventType = { /** * A list of tags to log */ - (| Array - /** - * A list of tags to log - */ - | null - ) + (Array + /** + * A list of tags to log + */ | null) | undefined; }; export type ResponseFormatType = @@ -6549,15 +7270,13 @@ export type RoleType = { /** * (permission, restrict_object_type) tuples which belong to this role */ - (| Array<{ - permission: PermissionType; - restrict_object_type?: AclObjectTypeType | undefined; - }> - /** - * (permission, restrict_object_type) tuples which belong to this role - */ - | null - ) + (Array<{ + permission: PermissionType; + restrict_object_type?: AclObjectTypeType | undefined; + }> + /** + * (permission, restrict_object_type) tuples which belong to this role + */ | null) | undefined; member_roles?: | /** @@ -6570,13 +7289,11 @@ export type RoleType = { An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions */ - (| Array /** + (Array /** * Ids of the roles this role inherits from An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions - */ - | null - ) + */ | null) | undefined; }; export type RunEvalType = { @@ -6588,9 +7305,9 @@ export type RunEvalType = { * The dataset to use */ data: /** - * Dataset id - */ - | { + * Dataset id + */ + | { dataset_id: string; dataset_version?: | /** @@ -6620,7 +7337,18 @@ export type RunEvalType = { | null ) | undefined; - _internal_btql?: ({} | null) | undefined; + _internal_btql?: + | /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + ({} + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ | null) + | undefined; } /** * Project and dataset name @@ -6656,13 +7384,28 @@ export type RunEvalType = { | null ) | undefined; - _internal_btql?: ({} | null) | undefined; + _internal_btql?: + | /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ + ({} + /** + * Internal BTQL query overrides in parsed JSON form that select which dataset rows to evaluate. `filter` is a BTQL expression object, `sort` is an array of BTQL sort expressions, and `limit` is an integer. + */ | null) + | undefined; } /** * Dataset rows */ | { data: Array; + source_dataset_id?: /** + * The saved dataset these rows came from. Its project scopes saved simulated-user references; the caller must have read access to the dataset and source project. + */ + string | undefined; } /** * Experiment whose inputs and outputs should be used as dataset inputs and expected values @@ -6671,39 +7414,41 @@ export type RunEvalType = { experiment_name: string; }; name?: /** - * The name of the eval to run when multiple evals available - */ - string | undefined; + * The name of the eval to run when multiple evals available + */ + string | undefined; parameters?: /** - * Values for any parameters used in the eval - */ - {} | undefined; - task: FunctionIdType & - /** - * The function to evaluate - */ unknown; + * Values for any parameters used in the eval + */ + {} | undefined; + task: FunctionIdType + /** + * The function to evaluate + */ & + unknown; /** * The functions to score the eval on */ scores: Array; experiment_name?: /** - * An optional name for the experiment created by this eval. If it conflicts with an existing experiment, it will be suffixed with a unique identifier. - */ - string | undefined; + * An optional name for the experiment created by this eval. If it conflicts with an existing experiment, it will be suffixed with a unique identifier. + */ + string | undefined; metadata?: /** - * Optional experiment-level metadata to store about the evaluation. You can later use this to slice & dice across experiments. - */ - {} | undefined; + * Optional experiment-level metadata to store about the evaluation. You can later use this to slice & dice across experiments. + */ + {} | undefined; parent?: - | (InvokeParentType & - /** - * Options for tracing the evaluation - */ unknown) + | (InvokeParentType + /** + * Options for tracing the evaluation + */ & + unknown) | undefined; stream?: /** - * Whether to stream the results of the eval. If true, the request will return two events: one to indicate the experiment has started, and another upon completion. If false, the request will return the evaluation's summary upon completion. - */ - boolean | undefined; + * Whether to stream the results of the eval. If true, the request will return two events: one to indicate the experiment has started, and another upon completion. If false, the request will return the evaluation's summary upon completion. + */ + boolean | undefined; trial_count?: | /** * The number of times to run the evaluator per input. This is useful for evaluating applications that have non-deterministic behavior and gives you both a stronger aggregate measure and a sense of the variance in the results. @@ -6734,14 +7479,14 @@ export type RunEvalType = { | undefined; timeout?: | /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout. + * The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default. */ /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout. + * The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default. */ (| number /** - * The maximum duration, in milliseconds, to run the evaluation. Defaults to undefined, in which case there is no timeout. + * The maximum duration, in milliseconds, to run the evaluation. There is no timeout by default. */ | null ) @@ -6752,11 +7497,11 @@ export type RunEvalType = { * @default 10 */ max_concurrency: /** - * The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used. - * - * @default 10 - */ - | number + * The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used. + * + * @default 10 + */ + | number /** * The maximum number of tasks/scorers that will be run concurrently. Defaults to 10. If null is provided, no max concurrency will be used. * @@ -6792,24 +7537,24 @@ export type RunEvalType = { ) | undefined; git_metadata_settings?: - | (GitMetadataSettingsType & + | (GitMetadataSettingsType + /** + * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. + */ & /** - * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. - */ /** * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. */ - (| {} - /** - * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. - */ - | null - )) + ({} + /** + * Optional settings for collecting git metadata. By default, will collect git metadata fields allowed in org-level settings, excluding diff content unless the org opts in. + */ | null)) | undefined; repo_info?: - | (RepoInfoType & - /** - * Optionally explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified. - */ unknown) + | (RepoInfoType + /** + * Optionally explicitly specify the git metadata for this experiment. This takes precedence over `gitMetadataSettings` if specified. + */ & + unknown) | undefined; strict?: | /** @@ -6840,13 +7585,13 @@ export type RunEvalType = { ) | undefined; extra_messages?: /** - * A template path of extra messages to append to the conversion. These messages will be appended to the end of the conversation, after the last message. - */ - string | undefined; + * A template path of extra messages to append to the conversion. These messages will be appended to the end of the conversation, after the last message. + */ + string | undefined; tags?: /** - * Optional tags that will be added to the experiment. - */ - Array | undefined; + * Optional tags that will be added to the experiment. + */ + Array | undefined; mcp_auth?: {} | undefined; endpoint_name?: | /** @@ -6865,14 +7610,14 @@ export type RunEvalType = { }; export type ScoreObjectType = { name?: /** - * The score name. Defaults to the function name for a single score. - */ - string | undefined; + * The score name. Defaults to the function name for a single score. + */ + string | undefined; score: /** - * @minimum 0 - * @maximum 1 - */ - number | boolean | null; + * @minimum 0 + * @maximum 1 + */ + number | boolean | null; metadata?: {} | undefined; }; export type ScoreResultType = @@ -6914,6 +7659,9 @@ export type ServiceTokenType = { * Name of the service token */ name: string; + /** + * Masked preview showing the token prefix and last four characters, e.g. bt-st-…AbCd. + */ preview_name: string; service_account_id?: | /** @@ -6971,6 +7719,20 @@ export type ServiceTokenType = { | null ) | undefined; + last_used_at?: + | /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + (| string + /** + * Approximate time this credential was last used to authenticate. Updates are limited to once every 10 minutes and may be delayed by authorization caches. If null, no usage has been recorded. + */ + | null + ) + | undefined; expires_at?: | /** * Date and time at which the service token expires. If null, the token never expires. @@ -7088,10 +7850,11 @@ export type SSEProgressEventDataType = { id: string; object_type: FunctionObjectTypeType; origin?: - | (ObjectReferenceNullishType & - /** - * The origin of the event - */ unknown) + | (ObjectReferenceNullishType + /** + * The origin of the event + */ & + unknown) | undefined; format: FunctionFormatType; output_type: FunctionOutputTypeType; @@ -7211,14 +7974,13 @@ export type ViewDataType = /** * The view definition */ - | Partial<{ - search: ViewDataSearchType; - custom_charts: unknown; - }> + Partial<{ + search: ViewDataSearchType; + custom_charts: unknown; + }> /** * The view definition - */ - | null; + */ | null; export type ViewOptionsType = /** * Options for the view in the app @@ -7229,6 +7991,10 @@ export type ViewOptionsType = */ viewType: "monitor"; options: Partial<{ + /** + * @enum span, trace + */ + filterScope: "span" | "trace"; /** * @enum range, frame */ @@ -7312,9 +8078,9 @@ export type ViewOptionsType = * One of 'avg', 'sum', 'min', 'max', 'median', 'all' */ xAxisAggregation: /** - * One of 'avg', 'sum', 'min', 'max', 'median', 'all' - */ - | string + * One of 'avg', 'sum', 'min', 'max', 'median', 'all' + */ + | string /** * One of 'avg', 'sum', 'min', 'max', 'median', 'all' */ @@ -7359,7 +8125,7 @@ export type ViewType = { /** * Type of object that the view corresponds to. * - * @enum projects, experiments, experiment, playgrounds, playground, datasets, dataset, prompts, parameters, tools, scorers, classifiers, logs, monitor, for_review_project_log, for_review_experiments, for_review_datasets + * @enum projects, experiments, experiment, playgrounds, playground, datasets, dataset, prompts, parameters, tools, scorers, classifiers, logs, patterns, monitor, for_review_project_log, for_review_experiments, for_review_datasets */ view_type: | "projects" @@ -7375,6 +8141,7 @@ export type ViewType = { | "scorers" | "classifiers" | "logs" + | "patterns" | "monitor" | "for_review_project_log" | "for_review_experiments" @@ -7398,9 +8165,9 @@ export type ViewType = { ) | undefined; starred?: /** - * Whether the view is starred in its project - */ - boolean | undefined; + * Whether the view is starred in its project + */ + boolean | undefined; created?: | /** * Date of view creation diff --git a/js/util/generated_types.ts b/js/util/generated_types.ts index 75f0a42ce..6f12cc8be 100644 --- a/js/util/generated_types.ts +++ b/js/util/generated_types.ts @@ -1,6 +1,6 @@ -// Auto-generated file (content hash 387034529ea006a9) -- do not modify +// Auto-generated file (content hash 10e789e597c8e600) -- do not modify -import {z} from "zod/v3"; +import { z } from "zod/v3"; export const AclObjectType = z.union([ z.enum([ @@ -54,6 +54,7 @@ export const Agent = z.object({ project_id: z.string().uuid(), user_id: z.string().uuid(), created: z.union([z.string(), z.null()]).optional(), + deleted_at: z.union([z.string(), z.null()]).optional(), name: z.string(), slug: z.string(), kind: z.string(), @@ -136,6 +137,7 @@ export const AnyModelParams = z.object({ .passthrough() .optional(), verbosity: z.enum(["low", "medium", "high"]).optional(), + service_tier: z.string().optional(), top_k: z.number().optional(), stop_sequences: z.array(z.string()).optional(), reasoning_enabled: z.boolean().optional(), @@ -157,6 +159,7 @@ export const ApiKey = z.object({ user_given_name: z.union([z.string(), z.null()]).optional(), user_family_name: z.union([z.string(), z.null()]).optional(), org_id: z.union([z.string(), z.null()]).optional(), + last_used_at: z.union([z.string(), z.null()]).optional(), expires_at: z.union([z.string(), z.null()]).optional(), }); export type ApiKeyType = z.infer; @@ -191,7 +194,11 @@ export const AsyncScoringState = z.union([ ]); export type AsyncScoringStateType = z.infer; export const AsyncScoringControl = z.union([ - z.object({ kind: z.literal("score_update"), token: z.string().optional() }), + z.object({ + kind: z.literal("score_update"), + token: z.string().optional(), + triggered_xact_id: z.string().optional(), + }), z.object({ kind: z.literal("state_override"), state: AsyncScoringState }), z.object({ kind: z.literal("state_force_reselect") }), z.object({ kind: z.literal("state_enabled_force_rescore") }), @@ -207,7 +214,7 @@ export const AsyncScoringControl = z.union([ ]), idempotency_key: z.string().optional(), triggered_xact_id: z.union([z.string(), z.number()]).optional(), - }), + }) ) .min(1), }), @@ -335,7 +342,7 @@ export const BatchedFacetData = z.object({ model: z.string().optional(), embedding_model: z.string().optional(), no_match_pattern: z.string().optional(), - }), + }) ), topic_maps: z .record( @@ -344,8 +351,8 @@ export const BatchedFacetData = z.object({ function_name: z.string(), topic_map_id: z.string().optional(), topic_map_data: TopicMapData, - }), - ), + }) + ) ) .optional(), }); @@ -679,7 +686,11 @@ export const DatasetEvent = z.object({ metadata: z .union([ z - .object({ model: z.union([z.string(), z.null()]) }) + .object({ + model: z.union([z.string(), z.null()]), + requested_service_tier: z.union([z.string(), z.null()]), + served_service_tier: z.union([z.string(), z.null()]), + }) .partial() .passthrough(), z.null(), @@ -719,10 +730,10 @@ export const DatasetEvent = z.object({ function_type: FunctionTypeEnum.optional().default("scorer"), }), z.null(), - ]), + ]) ).optional(), - }), - ), + }) + ) ), z.null(), ]) @@ -829,6 +840,7 @@ export const SpanType = z.union([ "preprocessor", "classifier", "review", + "decision", "question", "log", ]), @@ -868,7 +880,11 @@ export const ExperimentEvent = z.object({ metadata: z .union([ z - .object({ model: z.union([z.string(), z.null()]) }) + .object({ + model: z.union([z.string(), z.null()]), + requested_service_tier: z.union([z.string(), z.null()]), + served_service_tier: z.union([z.string(), z.null()]), + }) .partial() .passthrough(), z.null(), @@ -924,10 +940,10 @@ export const ExperimentEvent = z.object({ function_type: FunctionTypeEnum.optional().default("scorer"), }), z.null(), - ]), + ]) ).optional(), - }), - ), + }) + ) ), z.null(), ]) @@ -970,6 +986,48 @@ export const PromptBlockDataNullish = z.union([ tools: z.string().optional(), }), z.object({ type: z.literal("completion"), content: z.string() }), + z.object({ + type: z.literal("decisions"), + input: z.union([ + z.string(), + z.array( + z.object({ + role: z.enum(["system", "developer", "user", "assistant"]), + content: z.union([ + z.string(), + z.array(ChatCompletionContentPartText), + ]), + }) + ), + ]), + questions: z.array( + z + .object({ name: z.string().optional(), instructions: z.string() }) + .and( + z.union([ + z.object({ type: z.literal("predicate") }), + z.object({ + type: z.literal("choice"), + choices: z.array( + z.object({ + value: z.union([z.string(), z.boolean()]), + description: z.string().optional(), + }) + ), + }), + z.object({ + type: z.literal("score"), + levels: z.array( + z.object({ + label: z.string(), + description: z.string().optional(), + }) + ), + }), + ]) + ) + ), + }), z.null(), ]); export type PromptBlockDataNullishType = z.infer; @@ -1008,6 +1066,7 @@ export const ModelParams = z.union([ .partial() .passthrough(), verbosity: z.enum(["low", "medium", "high"]), + service_tier: z.string(), }) .partial() .passthrough(), @@ -1126,7 +1185,7 @@ export const PromptDataNullish = z.union([ .union([z.array(z.string()), z.null()]) .optional(), }), - ]), + ]) ), z.null(), ]), @@ -1173,6 +1232,48 @@ export const PromptBlockData = z.union([ tools: z.string().optional(), }), z.object({ type: z.literal("completion"), content: z.string() }), + z.object({ + type: z.literal("decisions"), + input: z.union([ + z.string(), + z.array( + z.object({ + role: z.enum(["system", "developer", "user", "assistant"]), + content: z.union([ + z.string(), + z.array(ChatCompletionContentPartText), + ]), + }) + ), + ]), + questions: z.array( + z + .object({ name: z.string().optional(), instructions: z.string() }) + .and( + z.union([ + z.object({ type: z.literal("predicate") }), + z.object({ + type: z.literal("choice"), + choices: z.array( + z.object({ + value: z.union([z.string(), z.boolean()]), + description: z.string().optional(), + }) + ), + }), + z.object({ + type: z.literal("score"), + levels: z.array( + z.object({ + label: z.string(), + description: z.string().optional(), + }) + ), + }), + ]) + ) + ), + }), ]); export type PromptBlockDataType = z.infer; export const GraphNode = z.union([ @@ -1297,6 +1398,68 @@ export const FunctionData = z.union([ }), }), TopicMapData.and(z.unknown()), + z.object({ + type: z.literal("conversation"), + config: z.union([ + z.object({ + initiator: z + .enum(["agent", "simulated_user"]) + .optional() + .default("agent"), + timeout_seconds: z + .number() + .int() + .gte(15) + .lte(3600) + .optional() + .default(600), + modality: z.literal("voice").optional().default("voice"), + agent: z.union([ + z.object({ + type: z.literal("livekit"), + server_url: z.string().min(1), + agent_name: z.string().min(1), + }), + z.object({ + type: z.literal("phone"), + phone_number: z.string().regex(/^\+[1-9]\d{7,14}$/), + }), + z.object({ + type: z.literal("sip"), + uri: z.string().regex(/^sips?:[^\s]+$/), + }), + ]), + }), + z.object({ + initiator: z + .enum(["agent", "simulated_user"]) + .optional() + .default("agent"), + timeout_seconds: z + .number() + .int() + .gte(15) + .lte(3600) + .optional() + .default(600), + modality: z.literal("text"), + agent: z.union([ + z.object({ + type: z.literal("livekit"), + server_url: z.string().min(1), + agent_name: z.string().min(1), + }), + z.object({ + type: z.literal("acp"), + command: z.string().min(1), + args: z.array(z.string()).optional().default([]), + cwd: z.string().regex(/^(?:[\/]|[A-Za-z]:[\\\/]|\\\\)/), + permissions: z.literal("deny").optional().default("deny"), + }), + ]), + }), + ]), + }), ]); export type FunctionDataType = z.infer; export const Function = z.object({ @@ -1340,6 +1503,7 @@ export const FunctionFormat = z.enum([ "global", "graph", "topic_map", + "conversation", ]); export type FunctionFormatType = z.infer; export const PromptData = z @@ -1368,7 +1532,7 @@ export const PromptData = z is_disabled: z.boolean().optional(), enabled_tools: z.union([z.array(z.string()), z.null()]).optional(), }), - ]), + ]) ), z.null(), ]), @@ -1459,7 +1623,7 @@ export const GitMetadataSettings = z.object({ "commit_message", "commit_time", "git_diff", - ]), + ]) ) .optional(), }); @@ -1521,6 +1685,7 @@ export type StreamingModeType = z.infer; export const InvokeFunction = FunctionId.and( z .object({ + request_source: z.string(), input: z.unknown(), expected: z.unknown(), metadata: z.union([z.object({}).partial().passthrough(), z.null()]), @@ -1534,7 +1699,7 @@ export const InvokeFunction = FunctionId.and( overrides: z.union([z.object({}).partial().passthrough(), z.null()]), endpoint_name: z.union([z.string(), z.null()]), }) - .partial(), + .partial() ); export type InvokeFunctionType = z.infer; export const MCPServer = z.object({ @@ -1605,6 +1770,7 @@ export type TraceScopeType = z.infer; export const OnlineScoreConfig = z.union([ z.object({ status: AutomationStatus.optional(), + service_tier: z.enum(["standard", "flex"]).optional(), sampling_rate: z.number().gte(0).lte(1), scorers: z.array(SavedFunctionId), btql_filter: z.union([z.string(), z.null()]).optional(), @@ -1664,7 +1830,7 @@ export const ProjectSettings = z.union([ layout: z .union([z.literal("full"), z.literal("two_column"), z.null()]) .optional(), - }), + }) ), z.null(), ]), @@ -1674,7 +1840,7 @@ export const ProjectSettings = z.union([ url: z.string(), name: z.union([z.string(), z.null()]).optional(), description: z.union([z.string(), z.null()]).optional(), - }), + }) ), z.null(), ]), @@ -1683,6 +1849,97 @@ export const ProjectSettings = z.union([ coding_agent_insights_dashboard: z.union([z.boolean(), z.null()]), blind_reviews: z.union([z.boolean(), z.null()]), require_all_human_review_scores: z.union([z.boolean(), z.null()]), + user_id_fields: z.union([ + z.array(z.array(z.string().min(1).max(256)).min(2).max(32)), + z.null(), + ]), + pattern_alert_mention: z.union([ + z.object({ + workspace_id: z.string().min(1), + mention_user_id: z.string().regex(/^[UW][A-Z0-9]+$/), + mention_handle: z.string().max(80).optional(), + mention_prompt: z + .string() + .max(2000) + .regex(/\{\{pattern\}\}/) + .optional(), + }), + z.null(), + ]), + pattern_alert_destinations: z.union([ + z.array( + z.union([ + z.object({ + type: z.literal("webhook"), + url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), + formatting_prompt: z.string().min(1).max(10000).optional(), + }), + z.object({ + type: z.literal("slack"), + workspace_id: z.string(), + channel: z.string(), + message_template: z.string().optional(), + formatting_prompt: z.string().min(1).max(10000).optional(), + }), + z.object({ + type: z.literal("pagerduty"), + routing_key_secret_name: z.string().uuid(), + severity: z.enum(["critical", "error", "warning", "info"]), + formatting_prompt: z.string().min(1).max(10000).optional(), + }), + ]) + ), + z.null(), + ]), + pattern_alert_min_severity: z.union([ + z.enum(["high", "medium", "low"]), + z.null(), + ]), + pattern_alert_informational: z.union([z.boolean(), z.null()]), + pattern_sources: z.union([ + z.array( + z.object({ + type: z.string().min(1).max(64), + mcp_server_id: z.string().uuid(), + instructions: z.union([z.string(), z.null()]).optional(), + }) + ), + z.null(), + ]), + pattern_excluded_categories: z.union([ + z.array(z.string().min(1).max(64)), + z.null(), + ]), + session_id_fields: z.union([ + z.array(z.array(z.string().min(1).max(256)).min(2).max(32)), + z.null(), + ]), default_preprocessor: NullableSavedFunctionId, }) .partial(), @@ -1700,10 +1957,29 @@ export const Project = z.object({ settings: ProjectSettings.optional(), }); export type ProjectType = z.infer; +export const SavedPreprocessorId = z.union([ + z.object({ + type: z.literal("function"), + id: z.string(), + version: z.string().optional(), + }), + z.object({ + type: z.literal("global"), + name: z.string(), + function_type: z.literal("preprocessor").optional().default("preprocessor"), + }), +]); +export type SavedPreprocessorIdType = z.infer; export const WindowedAutomationConfig = z.object({ event_type: z.literal("windowed"), - product_origin: z.union([z.literal("patterns"), z.null()]).optional(), + product_origin: z + .union([ + z.enum(["patterns", "dashboard", "digest", "pattern_alerts"]), + z.null(), + ]) + .optional(), status: AutomationStatus.optional(), + continuous: z.boolean().optional(), threshold: z .object({ calculation: z.object({ @@ -1745,23 +2021,59 @@ export const WindowedAutomationConfig = z.object({ loop: z .object({ prompt: z.string().min(1).max(10000), + digest: z + .object({ writing_style: z.enum(["compact", "detailed"]) }) + .optional(), include_trigger_input: z.boolean().optional().default(false), agent_slug: z.string().min(1), auto_approve_tools: z.array(z.string().min(1)).optional().default([]), - harness: z.enum(["codex", "native", "claude-code"]).optional(), + harness: z.enum(["native", "codex", "claude-code", "pi"]).optional(), model: z.string().min(1).optional(), endpoint_name: z.string().min(1).optional(), reasoning_effort: z .enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]) .optional(), + target: z + .object({ type: z.literal("dashboard"), id: z.literal("overview") }) + .optional(), }) .optional(), + patterns: z + .object({ preprocessor: SavedPreprocessorId }) + .partial() + .optional(), actions: z .array( z.union([ z.object({ type: z.literal("webhook"), url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), formatting_prompt: z.string().min(1).max(10000).optional(), }), z.object({ @@ -1777,7 +2089,7 @@ export const WindowedAutomationConfig = z.object({ severity: z.enum(["critical", "error", "warning", "info"]), formatting_prompt: z.string().min(1).max(10000).optional(), }), - ]), + ]) ) .max(20) .optional() @@ -1870,6 +2182,32 @@ export const ProjectAutomation = z.object({ z.object({ type: z.literal("webhook"), url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), formatting_prompt: z.string().min(1).max(10000).optional(), }), z.object({ @@ -1941,6 +2279,32 @@ export const ProjectAutomation = z.object({ z.object({ type: z.literal("webhook"), url: z.string(), + headers: z + .array( + z.union([ + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + value: z + .string() + .max(8192) + .regex(/^[\t\x20-\x7e\x80-\xff]*$/), + }), + z.object({ + name: z + .string() + .min(1) + .max(256) + .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), + secret_name: z.string().uuid(), + }), + ]) + ) + .max(20) + .optional(), formatting_prompt: z.string().min(1).max(10000).optional(), }), z.object({ @@ -1994,7 +2358,11 @@ export const ProjectLogsEvent = z.object({ metadata: z .union([ z - .object({ model: z.union([z.string(), z.null()]) }) + .object({ + model: z.union([z.string(), z.null()]), + requested_service_tier: z.union([z.string(), z.null()]), + served_service_tier: z.union([z.string(), z.null()]), + }) .partial() .passthrough(), z.null(), @@ -2051,10 +2419,10 @@ export const ProjectLogsEvent = z.object({ function_type: FunctionTypeEnum.optional().default("scorer"), }), z.null(), - ]), + ]) ).optional(), - }), - ), + }) + ) ), z.null(), ]) @@ -2212,7 +2580,7 @@ export const Role = z.object({ z.object({ permission: Permission, restrict_object_type: AclObjectType.optional(), - }), + }) ), z.null(), ]) @@ -2240,7 +2608,10 @@ export const RunEval = z.object({ .union([z.object({}).partial().passthrough(), z.null()]) .optional(), }), - z.object({ data: z.array(z.unknown()) }), + z.object({ + data: z.array(z.unknown()), + source_dataset_id: z.string().optional(), + }), z.object({ experiment_name: z.string() }), ]), name: z.string().optional(), @@ -2258,7 +2629,7 @@ export const RunEval = z.object({ base_experiment_name: z.union([z.string(), z.null()]).optional(), base_experiment_id: z.union([z.string(), z.null()]).optional(), git_metadata_settings: GitMetadataSettings.and( - z.union([z.object({}).partial(), z.null()]), + z.union([z.object({}).partial(), z.null()]) ).optional(), repo_info: RepoInfo.and(z.unknown()).optional(), strict: z.union([z.boolean(), z.null()]).optional(), @@ -2294,6 +2665,7 @@ export const ServiceToken = z.object({ service_account_email: z.union([z.string(), z.null()]).optional(), service_account_name: z.union([z.string(), z.null()]).optional(), org_id: z.union([z.string(), z.null()]).optional(), + last_used_at: z.union([z.string(), z.null()]).optional(), expires_at: z.union([z.string(), z.null()]).optional(), }); export type ServiceTokenType = z.infer; @@ -2375,6 +2747,7 @@ export const ViewOptions = z.union([ viewType: z.literal("monitor"), options: z .object({ + filterScope: z.enum(["span", "trace"]), spanType: z.union([z.enum(["range", "frame"]), z.null()]), rangeValue: z.union([z.string(), z.null()]), frameStart: z.union([z.string(), z.null()]), @@ -2404,7 +2777,7 @@ export const ViewOptions = z.union([ z.object({ type: z.enum(["none", "score", "metric", "metadata"]), value: z.string(), - }), + }) ), z.null(), ]), @@ -2475,6 +2848,7 @@ export const View = z.object({ "scorers", "classifiers", "logs", + "patterns", "monitor", "for_review_project_log", "for_review_experiments",