From f73549f9aef3fbc3b99dcf6f9ef724d8fb7d0f9d Mon Sep 17 00:00:00 2001 From: Dan Piet Date: Fri, 23 Oct 2026 21:11:14 +0000 Subject: [PATCH] feat(api): add delegation controls and prompt cache lifetimes Castiron-Internal-PR: https://github.com/openai/openai-java-internal/pull/355 Castiron-Source-SHA: 58efdbf70ac0b67c982c5e432d30a4b3aa87fb5a Castiron-Public-Base-SHA: 0ce5f3f17518fb2390d31ec9a4de0a9dda6d9946 --- .castiron.stats.yml | 14 +- .../castiron-custom-code-comment.yml | 99 +- api_reference/openapi.transformed.yml | 20158 +++++++++------- .../openai/models/PromptCacheBreakpointTtl.kt | 145 + .../com/openai/models/beta/agents/Agent.kt | 3 + .../models/beta/agents/AgentCreateParams.kt | 6 + .../openai/models/beta/agents/AgentSession.kt | 3 + .../openai/models/beta/agents/AgentTool.kt | 45 +- .../models/beta/agents/AgentToolParam.kt | 53 +- .../models/beta/agents/AgentUpdateParams.kt | 6 + .../models/beta/agents/PersistedAgentTool.kt | 53 +- .../beta/agents/PersistedAgentToolParam.kt | 53 +- .../agents/sessions/SessionCreateParams.kt | 3 + .../beta/responses/BetaResponseInputFile.kt | 52 +- .../responses/BetaResponseInputFileContent.kt | 52 +- .../beta/responses/BetaResponseInputImage.kt | 52 +- .../BetaResponseInputImageContent.kt | 52 +- .../beta/responses/BetaResponseInputText.kt | 52 +- .../responses/BetaResponseInputTextContent.kt | 52 +- .../models/beta/responses/BetaResponseItem.kt | 63 +- .../beta/responses/BetaResponseOutputItem.kt | 63 +- .../completions/ChatCompletionContentPart.kt | 53 +- .../ChatCompletionContentPartImage.kt | 52 +- .../ChatCompletionContentPartInputAudio.kt | 52 +- .../ChatCompletionContentPartText.kt | 52 +- .../ComputerScreenshotContent.kt | 52 +- .../openai/models/live/ClientDelegation.kt | 78 +- .../openai/models/live/ForkSessionConfig.kt | 71 +- .../openai/models/live/MediaSessionConfig.kt | 127 +- .../models/live/MediaSessionForkConfig.kt | 71 +- .../com/openai/models/live/SessionConfig.kt | 127 +- .../com/openai/models/live/SessionResource.kt | 127 +- .../openai/models/live/SessionUpdateConfig.kt | 138 +- .../live/sessions/SessionAcceptParams.kt | 128 +- ...onItemInputAudioTranscriptionDeltaEvent.kt | 4 +- .../models/realtime/RealtimeErrorEvent.kt | 2 +- .../models/realtime/RealtimeServerEvent.kt | 8 +- .../RealtimeTranslationServerEvent.kt | 8 +- .../models/responses/ResponseInputFile.kt | 52 +- .../responses/ResponseInputFileContent.kt | 52 +- .../models/responses/ResponseInputImage.kt | 52 +- .../responses/ResponseInputImageContent.kt | 52 +- .../models/responses/ResponseInputText.kt | 52 +- .../responses/ResponseInputTextContent.kt | 52 +- .../META-INF/proguard/openai-java-core.pro | 4 +- .../models/beta/agents/AgentToolParamTest.kt | 34 + .../models/beta/agents/AgentToolTest.kt | 31 + .../agents/PersistedAgentToolParamTest.kt | 34 + .../beta/agents/PersistedAgentToolTest.kt | 34 + .../beta/responses/BetaResponseContentTest.kt | 25 +- .../BetaResponseFunctionCallOutputItemTest.kt | 25 +- .../responses/BetaResponseInputContentTest.kt | 25 +- .../BetaResponseInputFileContentTest.kt | 11 +- .../responses/BetaResponseInputFileTest.kt | 11 +- .../BetaResponseInputImageContentTest.kt | 11 +- .../responses/BetaResponseInputImageTest.kt | 11 +- .../responses/BetaResponseInputItemTest.kt | 17 +- .../BetaResponseInputMessageItemTest.kt | 9 +- .../BetaResponseInputTextContentTest.kt | 11 +- .../responses/BetaResponseInputTextTest.kt | 11 +- .../beta/responses/BetaResponseItemTest.kt | 17 +- .../responses/BetaResponseOutputItemTest.kt | 9 +- .../BetaResponseSteerInputContentTest.kt | 25 +- .../responses/BetaResponseSteerInputTest.kt | 3 + .../inputitems/BetaResponseItemListTest.kt | 9 +- .../ChatCompletionContentPartImageTest.kt | 11 +- ...ChatCompletionContentPartInputAudioTest.kt | 11 +- .../ChatCompletionContentPartTest.kt | 33 +- .../ChatCompletionContentPartTextTest.kt | 11 +- .../ChatCompletionStoreMessageTest.kt | 9 +- .../messages/MessageListPageResponseTest.kt | 3 + .../ComputerScreenshotContentTest.kt | 11 +- .../models/conversations/MessageTest.kt | 9 +- .../items/ConversationItemListTest.kt | 9 +- .../items/ConversationItemTest.kt | 9 +- .../gradermodels/EvalContentItemTest.kt | 11 +- .../models/live/ClientDelegationTest.kt | 4 +- .../com/openai/models/live/ClientEventTest.kt | 8 +- .../models/live/ForkSessionConfigTest.kt | 2 + .../models/live/ForkSessionStartEventTest.kt | 2 + .../models/live/LiveCreateParamsTest.kt | 6 +- .../models/live/MediaSessionConfigTest.kt | 8 +- .../models/live/MediaSessionForkConfigTest.kt | 2 + .../com/openai/models/live/ServerEventTest.kt | 128 +- .../models/live/SessionClosedEventTest.kt | 4 +- .../openai/models/live/SessionConfigTest.kt | 8 +- .../openai/models/live/SessionResourceTest.kt | 8 +- .../models/live/SessionStartEventTest.kt | 4 +- .../models/live/SessionStartedEventTest.kt | 4 +- .../models/live/SessionUpdateConfigTest.kt | 8 +- .../models/live/SessionUpdateEventTest.kt | 2 + .../models/live/SessionUpdatedEventTest.kt | 108 +- .../models/live/forks/ForkClientEventTest.kt | 4 + .../models/live/forks/ForkServerEventTest.kt | 128 +- .../live/sessions/SessionAcceptParamsTest.kt | 6 +- .../live/sessions/SessionForkParamsTest.kt | 3 + .../live/sideband/SidebandClientEventTest.kt | 2 + .../live/sideband/SidebandServerEventTest.kt | 128 +- .../models/responses/ResponseContentTest.kt | 31 +- .../ResponseFunctionCallOutputItemTest.kt | 25 +- .../responses/ResponseInputContentTest.kt | 31 +- .../responses/ResponseInputFileContentTest.kt | 11 +- .../models/responses/ResponseInputFileTest.kt | 13 +- .../ResponseInputImageContentTest.kt | 11 +- .../responses/ResponseInputImageTest.kt | 13 +- .../models/responses/ResponseInputItemTest.kt | 9 +- .../responses/ResponseInputMessageItemTest.kt | 9 +- .../responses/ResponseInputTextContentTest.kt | 11 +- .../models/responses/ResponseInputTextTest.kt | 13 +- .../models/responses/ResponseItemTest.kt | 9 +- .../ResponseSteerInputContentTest.kt | 25 +- .../responses/ResponseSteerInputTest.kt | 3 + .../inputitems/ResponseItemListTest.kt | 9 +- .../services/async/LiveServiceAsyncTest.kt | 4 +- .../async/live/SessionServiceAsyncTest.kt | 5 +- .../services/blocking/LiveServiceTest.kt | 4 +- .../blocking/live/SessionServiceTest.kt | 3 +- scripts/castiron/CUSTOM_CODE.md | 2 + scripts/castiron/custom_code_policy.py | 141 +- scripts/castiron/custom_code_test_support.py | 29 +- .../castiron/fixtures/github_publisher.cjs | 50 +- scripts/castiron/generated-files.json | 246 +- scripts/castiron/test_custom_code_policy.py | 92 + .../castiron/test_custom_code_publication.py | 735 +- .../test_custom_code_review_revocation.py | 596 + 125 files changed, 15062 insertions(+), 10680 deletions(-) create mode 100644 openai-java-core/src/main/kotlin/com/openai/models/PromptCacheBreakpointTtl.kt create mode 100644 scripts/castiron/test_custom_code_review_revocation.py diff --git a/.castiron.stats.yml b/.castiron.stats.yml index b479e5def..f9e42035c 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,8 +1,8 @@ schema_version: 1 -generation_id: 13866b42-3537-41d4-9c12-f53214868c28 -openapi_spec_hash: 4a02922518092801c43f2526a9ced0f5 -openapi_transformed_spec_hash: b577364c156fa7f501df6fef87ae11ed -config_hash: 07f8531f9ff20bc9f5156b5a258c76ff -codegen_sha: e92d3226b583127c9519d4b89e52c20d6c596d0b -codegen_hash: 7afac60a97214c8b2cd5a6684367ee3e19efa7bd30856d197a78779278534669 -public_codegen_sha: cf08e5bb49e8c3d1f4eadee5d4b517dd2a06cabc +generation_id: ecf0c665-7b5c-432c-8ca0-d26784190472 +openapi_spec_hash: 23f0bfa58ad53fef090bea6a72a05dda +openapi_transformed_spec_hash: c631189d638b72705db583893fa22bb2 +config_hash: 249b5f41fe1b916955299cea75cddfbf +codegen_sha: a42b98f1e77a430e69488201ad31243f9a938996 +codegen_hash: 36d13008ea00041d76a078918a4b3cac9d4206d4f79cbdd222e65912a347ef33 +public_codegen_sha: 4720178859e015fec0cbd3af1e1a7a4244a11434 diff --git a/.github/workflows/castiron-custom-code-comment.yml b/.github/workflows/castiron-custom-code-comment.yml index 7e2702a43..c0f9e37ee 100644 --- a/.github/workflows/castiron-custom-code-comment.yml +++ b/.github/workflows/castiron-custom-code-comment.yml @@ -29,8 +29,21 @@ jobs: pull-requests: read statuses: write steps: - # Trusted main definition: no candidate checkout, artifacts, or executable inputs. + # Execute only the helper belonging to this immutable workflow revision. + - name: Check out the trusted review policy + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.workflow_sha }} + persist-credentials: false + - name: Re-evaluate current PR and queue after review changes + env: + GH_TOKEN: ${{ github.token }} + GIT_CONFIG_COUNT: '2' + GIT_CONFIG_KEY_0: credential.helper + GIT_CONFIG_VALUE_0: '' + GIT_CONFIG_KEY_1: credential.https://github.com.helper + GIT_CONFIG_VALUE_1: '!gh auth git-credential' uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | @@ -56,58 +69,21 @@ jobs: if (!/^[0-9a-f]{40}$/.test(sha || '')) throw new Error('Invalid policy merge base'); return sha; } - async function readPolicy(ref) { - const {data: file} = await github.rest.repos.getContent({ - ...context.repo, path: '.castiron-ratchet.json', ref, - }); - if (file.type !== 'file' || file.encoding !== 'base64' || !Number.isSafeInteger(file.size) || - file.size > 4096 || typeof file.content !== 'string') throw new Error('Invalid policy file'); - const content = Buffer.from(file.content, 'base64'); - if (content.length !== file.size) throw new Error('Invalid policy content'); - const policy = JSON.parse(content.toString('utf8'), (key, value, source) => - key === 'max_custom_patch_lines' && typeof value === 'number' ? BigInt(source.source) : value); - if (!policy || typeof policy !== 'object' || typeof policy.max_custom_patch_lines !== 'bigint' || - policy.max_custom_patch_lines < 0n) throw new Error('Invalid policy budget'); - return policy; - } - async function supportsEffectivePinReview(ref) { - let file; + async function requiresHuman(pr, mainSha) { + const path = require('node:path'); + const fs = require('node:fs'); + const root = fs.mkdtempSync(path.join(process.env.RUNNER_TEMP, 'castiron-review-')); try { - ({data: file} = await github.rest.repos.getContent({ - ...context.repo, path: 'scripts/castiron/custom_code_policy.py', ref, - })); - } catch (error) { - if (error.status === 404) return false; - throw error; + const result = await exec.getExecOutput('python3', ['-I', + 'scripts/castiron/custom_code_policy.py', 'review-required', + '--repository', repo, '--repo', path.join(root, 'objects.git'), + '--base', pr.base.sha, '--head', pr.head.sha, '--main', mainSha], {silent: true}); + const decision = JSON.parse(result.stdout); + if (typeof decision.requires_human !== 'boolean') throw new Error('Invalid review decision'); + return decision.requires_human; + } finally { + fs.rmSync(root, {recursive: true, force: true}); } - if (file.type !== 'file' || file.encoding !== 'base64' || !Number.isSafeInteger(file.size) || - file.size < 0 || typeof file.content !== 'string') throw new Error('Invalid checker contract'); - const content = Buffer.from(file.content, 'base64'); - if (content.length !== file.size) throw new Error('Invalid checker content'); - // Read data only from the effective checker, never import or execute it. - const declarations = content.toString('utf8').match(/^PIN_REVIEW_POLICY = .*$/gm) || []; - return declarations.length === 1 && declarations[0] === 'PIN_REVIEW_POLICY = "effective-policy-v1"'; - } - async function pinRequiresHuman(pr, headPolicy, mainSha) { - const targetPolicy = await readPolicy(pr.base.sha); - const pinSha = pin => pin?.repository === repo && /^[0-9a-f]{40}$/.test(pin.main_sha || '') - ? pin.main_sha : null; - const proposedChecker = pinSha(headPolicy.next_policy); - const previousChecker = targetPolicy.next_policy ? pinSha(targetPolicy.next_policy) : mainSha; - if (!proposedChecker || !/^[0-9a-f]{40}$/.test(previousChecker || '') || - !/^[0-9a-f]{40}$/.test(mainSha || '')) return true; - // Older checkers require human review for every pin edit. Retain that - // requirement until the protected checker explicitly supports the exemption. - if (!await supportsEffectivePinReview(previousChecker)) return true; - const [previous, proposed, previousBase, proposedBase] = await Promise.all([ - readPolicy(previousChecker), - readPolicy(proposedChecker), mergeBase(previousChecker, proposedChecker), - mergeBase(proposedChecker, mainSha), - ]); - return previousBase !== previousChecker || proposedBase !== proposedChecker || - proposed.max_custom_patch_lines > previous.max_custom_patch_lines || - proposed.schema_version !== previous.schema_version || - proposed.generated_files !== previous.generated_files || proposed.ratchet !== previous.ratchet; } const dirtyTargets = new Set(); // Retry discovery within this job timeout while targets are changing. @@ -146,18 +122,17 @@ jobs: const pr = matching[0]; const files = await github.paginate(github.rest.pulls.listFiles, {...context.repo, pull_number: pr.number}); if (!files.some(file => file.filename === '.castiron-ratchet.json')) return; - const baseline = await mergeBase(pr.base.sha, pr.head.sha); - const [basePolicy, headPolicy] = await Promise.all([readPolicy(baseline), readPolicy(pr.head.sha)]); - const pinChanged = !require('node:util').isDeepStrictEqual(basePolicy.next_policy ?? null, headPolicy.next_policy ?? null); - let requiresHuman = headPolicy.max_custom_patch_lines > basePolicy.max_custom_patch_lines || - (headPolicy.ratchet === 'go' && basePolicy.ratchet !== 'go'); - let mainSha = null; - if (!requiresHuman && pinChanged) { - const {data: main} = await github.rest.git.getRef({...context.repo, ref: 'heads/main'}); - mainSha = main.object.sha; - requiresHuman = await pinRequiresHuman(pr, headPolicy, mainSha); + const {data: main} = await github.rest.git.getRef({...context.repo, ref: 'heads/main'}); + const mainSha = main.object.sha; + let requiresReview; + try { + requiresReview = await requiresHuman(pr, mainSha); + } catch (error) { + const {data: currentMain} = await github.rest.git.getRef({...context.repo, ref: 'heads/main'}); + if (currentMain.object.sha !== mainSha) continue; + throw error; } - if (!requiresHuman) { + if (!requiresReview) { const [{data: current}, {data: target}, main] = await Promise.all([ github.rest.pulls.get({...context.repo, pull_number: pr.number}), github.rest.git.getRef({...context.repo, ref: 'heads/next'}), diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index 01f2e5157..11c63a1d0 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -1742,6 +1742,58 @@ paths: "prompt": "A warm, calm narrator with a clear, measured delivery.", "model": "auto" }' + /audio/voices/{voice_id}: + delete: + operationId: deleteVoice + tags: + - Audio + summary: Delete voice + description: | + Deletes a voice created from a text prompt or an audio sample. + + Requires voice write permission and access to the voice's project. Access to voices created from recordings is limited to eligible customers. See the [custom voices guide](https://developers.openai.com/api/docs/guides/custom-voices). + + Deleting a voice does not delete its consent recording. Deleting an already deleted voice returns a 404 error. + parameters: + - in: path + name: voice_id + required: true + schema: + type: string + description: The ID of the voice to delete. + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VoiceDeletedResource' + '400': + description: Invalid voice ID. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The endpoint is unavailable or the voice was not found in the requested project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + group: audio + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/voices/voice_1234 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + response: | + { + "id": "voice_1234", + "object": "audio.voice.deleted", + "deleted": true + } /batches: post: summary: Create batch @@ -16832,7 +16884,8 @@ paths: "object": "organization.usage.completions.result", "input_tokens": 1000, "input_cached_tokens": 400, - "input_cache_write_tokens": 75, + "input_cache_write_tokens": 100, + "input_cache_write_30m_tokens": 75, "input_cache_write_12h_tokens": 25, "input_uncached_tokens": 500, "output_tokens": 500, @@ -30485,53 +30538,26 @@ paths: "total_tokens": 42 } } - /agents/environments: - get: - operationId: listAgentEnvironments - summary: List agent environments - description: Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta. + /agents/automations: + post: + operationId: createAgentAutomation + summary: Create an automation + description: Saves an active automation without invoking it immediately. tags: - Agents - parameters: - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. - - name: type - in: query - required: false - schema: - $ref: '#/components/schemas/EnvironmentTypeParam' - description: The hosting type to list. Defaults to `openai_hosted`. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAutomationParams' + required: true responses: - '200': - description: A page of owned environments. + '201': + description: The created automation. content: application/json: schema: - $ref: '#/components/schemas/AgentEnvironmentListResource' - description: An ID-paginated list of owned environments. + $ref: '#/components/schemas/AutomationResource' '400': description: The request was invalid. content: @@ -30551,13 +30577,13 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment or referenced resource was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current environment state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -30574,34 +30600,91 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: createAgentEnvironment - summary: Create an agent environment - description: Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta. + get: + operationId: listAgentAutomations + summary: List automations + description: Lists project-owned automations, optionally filtered by target session. tags: - Agents parameters: - - name: Idempotency-Key - in: header + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query required: false schema: type: string - minLength: 1 - maxLength: 256 - description: Deduplicates creation for 24 hours within the authenticated organization, project, and creator. Retry the same JSON parameters with the same key to retrieve the original environment in its current state. Different parameters or an incomplete hosted creation return 409. Deleted environments are not recreated. After retention expires, the key may create a new environment. Without this header, each request creates a new environment. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAgentEnvironmentParams' - required: true + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + - name: session_id + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Matches existing-session targets, including agent-created automations. responses: - '201': - description: The created OpenAI-hosted environment. + '200': + description: The automations. content: application/json: schema: - $ref: '#/components/schemas/PublicEnvironmentResource' + type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/AutomationResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. '400': description: The request was invalid. content: @@ -30621,25 +30704,25 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment or referenced resource was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current environment state. + description: The request conflicted with the current session state. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - '429': - description: The request exceeded a rate or capacity limit. + '500': + description: An internal error occurred. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - '500': - description: An internal error occurred. + '501': + description: Automation listing is not implemented. content: application/json: schema: @@ -30650,29 +30733,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/environments/{environment_id}: + /agents/automations/{automation_id}: get: - operationId: retrieveAgentEnvironment - summary: Retrieve an agent environment - description: Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle). + operationId: getAgentAutomation + summary: Get an automation + description: Retrieves a project-owned automation. tags: - Agents parameters: - - name: environment_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the environment. responses: '200': - description: The requested environment. + description: Successful response. content: application/json: schema: - $ref: '#/components/schemas/PublicEnvironmentResource' + $ref: '#/components/schemas/AutomationResource' '400': description: The request was invalid. content: @@ -30715,64 +30797,33 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/environments/{environment_id}/files: - get: - operationId: listAgentEnvironmentFiles - summary: List agent environment files - description: Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + post: + operationId: updateAgentAutomation + summary: Update an automation + description: Updates supplied fields; target and metadata replace the whole field. tags: - Agents parameters: - - name: environment_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the environment. - - name: path - in: query - required: false - schema: - type: - - string - - 'null' - minLength: 0 - maxLength: 1048576 - description: Restrict the listing to this absolute workspace directory. - - name: limit - in: query - required: false - schema: - type: - - integer - - 'null' - format: int64 - minimum: 1 - maximum: 100 - description: The maximum number of files to return, between 1 and 100. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - description: Sort by case-sensitive path components. Defaults to descending. - - name: page - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The opaque token from the previous page. Keep the same path, order, and limit. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAutomationParams' + required: true responses: '200': - description: A page of live environment files. + description: Successful response. content: application/json: schema: - $ref: '#/components/schemas/EnvironmentFileListResource' + $ref: '#/components/schemas/AutomationResource' '400': description: The request was invalid. content: @@ -30815,33 +30866,27 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: createAgentEnvironmentFile - summary: Write an agent environment file - description: Copies inline bytes or a Files API file into a connected execution environment, replacing an existing regular file at the same path. Upload between turns and wait for success before starting the next turn. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + delete: + operationId: deleteAgentAutomation + summary: Delete an automation + description: Deletes the automation and prevents future invocations without deleting its target session. tags: - Agents parameters: - - name: environment_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the environment. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/HostedEnvironmentFileParam' responses: - '201': - description: The written live environment file. + '200': + description: Successful response. content: application/json: schema: - $ref: '#/components/schemas/EnvironmentFileResource' + $ref: '#/components/schemas/DeletedAutomationResource' '400': description: The request was invalid. content: @@ -30872,12 +30917,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - '429': - description: The Files API rate limit for your user has been exceeded. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse-2' '500': description: An internal error occurred. content: @@ -30890,92 +30929,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/subagents: - get: - operationId: listAgentSessionSubagents - summary: List session subagents - description: Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + /agents/automations/{automation_id}/pause: + post: + operationId: pauseAgentAutomation + summary: Pause an automation + description: Pauses future scheduled delivery without stopping an active session. tags: - Agents parameters: - - name: session_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session. - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. responses: '200': - description: The requested subagents. + description: Successful response. content: application/json: schema: - type: object - properties: - object: - type: string - enum: - - list - default: list - x-stainless-const: true - description: The object type, which is always `list`. - data: - type: array - items: - $ref: '#/components/schemas/SubagentResource' - minItems: 0 - maxItems: 2000 - description: The resources returned in this page, in the requested sort order. - first_id: - type: - - string - - 'null' - minLength: 0 - description: The ID of the first resource in `data`, or `null` if the page is empty. - last_id: - type: - - string - - 'null' - minLength: 0 - description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. - has_more: - type: boolean - description: Whether there are more resources to retrieve after this page. - required: - - object - - data - - first_id - - last_id - - has_more - additionalProperties: false - description: A page of Agents API resources, with IDs for retrieving additional pages. + $ref: '#/components/schemas/AutomationResource' '400': description: The request was invalid. content: @@ -31018,37 +30993,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/subagents/{subagent_id}: - get: - operationId: retrieveAgentSessionSubagent - summary: Retrieve a session subagent - description: Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + /agents/automations/{automation_id}/resume: + post: + operationId: resumeAgentAutomation + summary: Resume an automation + description: Resumes scheduled delivery; one-time automations without a pending invocation require a future run_at. tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - - name: subagent_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the subagent in this session. responses: '200': - description: The requested subagent. + description: Successful response. content: application/json: schema: - $ref: '#/components/schemas/SubagentResource' + $ref: '#/components/schemas/AutomationResource' '400': description: The request was invalid. content: @@ -31091,62 +31057,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/subagents/{subagent_id}/items: - get: - operationId: listAgentSessionSubagentItems - summary: List subagent items - description: Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + /agents/automations/{automation_id}/invocations: + post: + operationId: createAgentAutomationInvocation + summary: Invoke an automation + description: Queues a manual delivery without changing the saved schedule. tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - - name: subagent_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the subagent in this session. - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. responses: '200': - description: The requested subagent history. + description: The queued invocation. content: application/json: schema: - $ref: '#/components/schemas/SessionItemListResource' + $ref: '#/components/schemas/AutomationInvocationResource' '400': description: The request was invalid. content: @@ -31189,30 +31121,20 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/subagents/{subagent_id}/turns: get: - operationId: listAgentSessionSubagentTurns - summary: List subagent turns - description: Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + operationId: listAgentAutomationInvocations + summary: List automation invocations + description: Lists delivery records for a project-owned automation. tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - - name: subagent_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the subagent in this session. - name: limit in: query required: false @@ -31240,12 +31162,49 @@ paths: description: Return resources after this resource ID in the selected order. responses: '200': - description: The requested subagent history. + description: The invocation history. content: application/json: schema: - $ref: '#/components/schemas/SessionTurnListResource' - description: A page of turns from an agent session or subagent. + type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/AutomationInvocationResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. '400': description: The request was invalid. content: @@ -31282,51 +31241,47 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' + '501': + description: This operation is not implemented. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' '503': description: The service is temporarily unavailable. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}: + /agents/automations/{automation_id}/invocations/{invocation_id}: get: - operationId: retrieveAgentSessionSubagentTurn - summary: Retrieve a subagent turn - description: Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + operationId: getAgentAutomationInvocation + summary: Get an automation invocation + description: Retrieves a delivery record for a project-owned automation. tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - - name: subagent_id + - name: automation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the subagent in this session. - - name: turn_id + - name: invocation_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of a turn belonging to this subagent. responses: '200': - description: The requested subagent history. + description: The invocation. content: application/json: schema: - $ref: '#/components/schemas/TurnResource' + $ref: '#/components/schemas/AutomationInvocationResource' '400': description: The request was invalid. content: @@ -31369,38 +31324,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items: + /agents/environments: get: - operationId: listAgentSessionSubagentTurnItems - summary: List subagent turn items - description: Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + operationId: listAgentEnvironments + summary: List agent environments + description: Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta. tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - - name: subagent_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the subagent in this session. - - name: turn_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of a turn belonging to this subagent. - name: limit in: query required: false @@ -31426,13 +31357,20 @@ paths: minLength: 0 maxLength: 1048576 description: Return resources after this resource ID in the selected order. + - name: type + in: query + required: false + schema: + $ref: '#/components/schemas/EnvironmentTypeParam' + description: The hosting type to list. Defaults to `openai_hosted`. responses: '200': - description: The requested subagent history. + description: A page of owned environments. content: application/json: schema: - $ref: '#/components/schemas/SessionItemListResource' + $ref: '#/components/schemas/AgentEnvironmentListResource' + description: An ID-paginated list of owned environments. '400': description: The request was invalid. content: @@ -31452,13 +31390,13 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested session or event was not found. + description: The requested environment or referenced resource was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current session state. + description: The request conflicted with the current environment state. content: application/json: schema: @@ -31475,47 +31413,34 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents: - get: - operationId: listAgents - summary: List agents - description: Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + post: + operationId: createAgentEnvironment + summary: Create an agent environment + description: Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta. tags: - Agents parameters: - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query + - name: Idempotency-Key + in: header required: false schema: type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. + minLength: 1 + maxLength: 256 + description: Deduplicates creation for 24 hours within the authenticated organization, project, and creator. Retry the same JSON parameters with the same key to retrieve the original environment in its current state. Different parameters or an incomplete hosted creation return 409. Deleted environments are not recreated. After retention expires, the key may create a new environment. Without this header, each request creates a new environment. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAgentEnvironmentParams' + required: true responses: - '200': - description: A page of agents. + '201': + description: The created OpenAI-hosted environment. content: application/json: schema: - $ref: '#/components/schemas/AgentListResource' - description: A page of reusable agents. + $ref: '#/components/schemas/PublicEnvironmentResource' '400': description: The request was invalid. content: @@ -31535,13 +31460,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested session or event was not found. + description: The requested environment or referenced resource was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current session state. + description: The request conflicted with the current environment state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '429': + description: The request exceeded a rate or capacity limit. content: application/json: schema: @@ -31558,24 +31489,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: createAgent - summary: Create an agent - description: Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + /agents/environments/{environment_id}: + get: + operationId: retrieveAgentEnvironment + summary: Retrieve an agent environment + description: Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle). tags: - Agents - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateAgentParams' + parameters: + - name: environment_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the environment. responses: - '201': - description: The created agent. + '200': + description: The requested environment. content: application/json: schema: - $ref: '#/components/schemas/AgentResource' + $ref: '#/components/schemas/PublicEnvironmentResource' '400': description: The request was invalid. content: @@ -31618,29 +31554,64 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/{agent_id}: + /agents/environments/{environment_id}/files: get: - operationId: retrieveAgent - summary: Retrieve an agent - description: Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + operationId: listAgentEnvironmentFiles + summary: List agent environment files + description: Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). tags: - Agents parameters: - - name: agent_id + - name: environment_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the reusable agent. + description: The ID of the environment. + - name: path + in: query + required: false + schema: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Restrict the listing to this absolute workspace directory. + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 1 + maximum: 100 + description: The maximum number of files to return, between 1 and 100. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + description: Sort by case-sensitive path components. Defaults to descending. + - name: page + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The opaque token from the previous page. Keep the same path, order, and limit. responses: '200': - description: The requested agent. + description: A page of live environment files. content: application/json: schema: - $ref: '#/components/schemas/AgentResource' + $ref: '#/components/schemas/EnvironmentFileListResource' '400': description: The request was invalid. content: @@ -31684,32 +31655,32 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' post: - operationId: updateAgent - summary: Update an agent - description: Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + operationId: createAgentEnvironmentFile + summary: Write an agent environment file + description: Copies inline bytes or a Files API file into a connected execution environment, replacing an existing regular file at the same path. Upload between turns and wait for success before starting the next turn. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). tags: - Agents parameters: - - name: agent_id + - name: environment_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the reusable agent. + description: The ID of the environment. requestBody: content: application/json: schema: - $ref: '#/components/schemas/UpdateAgentParams' + $ref: '#/components/schemas/HostedEnvironmentFileParam' responses: - '200': - description: The updated agent. + '201': + description: The written live environment file. content: application/json: schema: - $ref: '#/components/schemas/AgentResource' + $ref: '#/components/schemas/EnvironmentFileResource' '400': description: The request was invalid. content: @@ -31740,6 +31711,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' + '429': + description: The Files API rate limit for your user has been exceeded. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' '500': description: An internal error occurred. content: @@ -31752,173 +31729,92 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - x-oaiMeta: - examples: - request: - curl: | - # 1. Omit reasoning: keep its current settings while renaming the agent. - curl "https://api.openai.com/v1/agents/$AGENT_ID" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -H "Content-Type: application/json" \ - -H "OpenAI-Beta: agents=v1" \ - -d '{"name": "Renamed"}' - - # 2. Send null: reset reasoning to the model's defaults. - curl "https://api.openai.com/v1/agents/$AGENT_ID" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -H "Content-Type: application/json" \ - -H "OpenAI-Beta: agents=v1" \ - -d '{"reasoning": null}' - - # 3. Send an object: replace the entire reasoning configuration, without merging. - # The agent's model must support the "low" reasoning effort. - curl "https://api.openai.com/v1/agents/$AGENT_ID" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -H "Content-Type: application/json" \ - -H "OpenAI-Beta: agents=v1" \ - -d '{"reasoning": {"effort": "low"}}' - python: | - from openai import OpenAI - - client = OpenAI() - agent_id = "your-agent-id" - - # 1. Omit reasoning: keep its current settings while renaming the agent. - client.beta.agents.update(agent_id, name="Renamed") - - # 2. Python's None sends JSON null: reset reasoning to the model's defaults. - client.beta.agents.update(agent_id, reasoning=None) - - # 3. Send an object: replace the entire reasoning configuration, without merging. - # The agent's model must support the "low" reasoning effort. - client.beta.agents.update(agent_id, reasoning={"effort": "low"}) - javascript: | - import OpenAI from "openai"; - - const client = new OpenAI(); - const agentId = "your-agent-id"; - - // 1. Omit reasoning: keep its current settings while renaming the agent. - await client.beta.agents.update(agentId, { name: "Renamed" }); - - // 2. Send null: reset reasoning to the model's defaults. - await client.beta.agents.update(agentId, { reasoning: null }); - - // 3. Send an object: replace the entire reasoning configuration, without merging. - // The agent's model must support the "low" reasoning effort. - await client.beta.agents.update(agentId, { reasoning: { effort: "low" } }); - go: | - package main - - import ( - "context" - "log" - - "github.com/openai/openai-go/v3" - "github.com/openai/openai-go/v3/packages/param" - ) - - func main() { - client := openai.NewClient() - ctx := context.Background() - agentID := "your-agent-id" - - // 1. Omit reasoning: keep its current settings while renaming the agent. - _, err := client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{ - Name: openai.String("Renamed"), - }) - if err != nil { - log.Fatal(err) - } - - // 2. Send null: reset reasoning to the model's defaults. - _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{ - Reasoning: param.NullStruct[openai.AgentReasoningParam](), - }) - if err != nil { - log.Fatal(err) - } - - // 3. Send an object: replace the entire reasoning configuration, without merging. - // The agent's model must support the "low" reasoning effort. - _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{ - Reasoning: openai.AgentReasoningParam{Effort: openai.AgentReasoningParamEffortLow}, - }) - if err != nil { - log.Fatal(err) - } - } - java: | - import com.openai.client.OpenAIClient; - import com.openai.client.okhttp.OpenAIOkHttpClient; - import com.openai.core.JsonValue; - import com.openai.models.beta.agents.AgentReasoningParam; - import com.openai.models.beta.agents.AgentUpdateParams; - - public class AgentUpdateExample { - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - String agentId = "your-agent-id"; - - // 1. Omit reasoning: keep its current settings while renaming the agent. - client.beta().agents().update(AgentUpdateParams.builder() - .agentId(agentId) - .name("Renamed") - .build()); - - // 2. Send null: reset reasoning to the model's defaults. - client.beta().agents().update(AgentUpdateParams.builder() - .agentId(agentId) - .reasoning(JsonValue.from(null)) - .build()); - - // 3. Send an object: replace the entire reasoning configuration, without merging. - // The agent's model must support the "low" reasoning effort. - client.beta().agents().update(AgentUpdateParams.builder() - .agentId(agentId) - .reasoning(AgentReasoningParam.builder() - .effort(AgentReasoningParam.Effort.LOW) - .build()) - .build()); - } - } - ruby: | - require "openai" - - client = OpenAI::Client.new - agent_id = "your-agent-id" - - # 1. Omit reasoning: keep its current settings while renaming the agent. - client.beta.agents.update(agent_id, name: "Renamed") - - # 2. Ruby's nil sends JSON null: reset reasoning to the model's defaults. - client.beta.agents.update(agent_id, reasoning: nil) - - # 3. Send an object: replace the entire reasoning configuration, without merging. - # The agent's model must support the "low" reasoning effort. - client.beta.agents.update(agent_id, reasoning: {effort: :low}) - delete: - operationId: deleteAgent - summary: Delete an agent - description: Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + /agents/sessions/{session_id}/subagents: + get: + operationId: listAgentSessionSubagents + summary: List session subagents + description: Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). tags: - Agents parameters: - - name: agent_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the reusable agent. + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: '200': - description: The deleted agent. + description: The requested subagents. content: application/json: schema: - $ref: '#/components/schemas/DeletedAgentResource' + type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/SubagentResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. '400': description: The request was invalid. content: @@ -31961,47 +31857,37 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/environments/templates: + /agents/sessions/{session_id}/subagents/{subagent_id}: get: - operationId: listAgentEnvironmentTemplates - summary: List agent environment templates - description: Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + operationId: retrieveAgentSessionSubagent + summary: Retrieve a session subagent + description: Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). tags: - Agents parameters: - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false + - name: session_id + in: path + required: true schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true schema: type: string minLength: 0 maxLength: 1048576 - description: Return resources after this resource ID in the selected order. + description: The ID of the subagent in this session. responses: '200': - description: A page of environment templates. + description: The requested subagent. content: application/json: schema: - $ref: '#/components/schemas/EnvironmentTemplateListResource' - description: A page of reusable environment templates. + $ref: '#/components/schemas/SubagentResource' '400': description: The request was invalid. content: @@ -32015,13 +31901,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment definition was not found. + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. content: application/json: schema: @@ -32038,24 +31930,62 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: createAgentEnvironmentTemplate - summary: Create an agent environment template - description: Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + /agents/sessions/{session_id}/subagents/{subagent_id}/items: + get: + operationId: listAgentSessionSubagentItems + summary: List subagent items + description: Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). tags: - Agents - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateEnvironmentTemplateParams' + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: - '201': - description: The created environment template. + '200': + description: The requested subagent history. content: application/json: schema: - $ref: '#/components/schemas/EnvironmentTemplateResource' + $ref: '#/components/schemas/SessionItemListResource' '400': description: The request was invalid. content: @@ -32069,13 +31999,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment definition was not found. + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. content: application/json: schema: @@ -32092,29 +32028,63 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/environments/templates/{environment_template_id}: + /agents/sessions/{session_id}/subagents/{subagent_id}/turns: get: - operationId: retrieveAgentEnvironmentTemplate - summary: Retrieve an agent environment template - description: Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + operationId: listAgentSessionSubagentTurns + summary: List subagent turns + description: Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). tags: - Agents parameters: - - name: environment_template_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the reusable environment template. + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: '200': - description: The requested environment template. + description: The requested subagent history. content: application/json: schema: - $ref: '#/components/schemas/EnvironmentTemplateResource' + $ref: '#/components/schemas/SessionTurnListResource' + description: A page of turns from an agent session or subagent. '400': description: The request was invalid. content: @@ -32128,13 +32098,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment definition was not found. + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. content: application/json: schema: @@ -32151,33 +32127,45 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: updateAgentEnvironmentTemplate - summary: Update an agent environment template - description: Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}: + get: + operationId: retrieveAgentSessionSubagentTurn + summary: Retrieve a subagent turn + description: Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). tags: - Agents parameters: - - name: environment_template_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the reusable environment template. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateEnvironmentTemplateParams' + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: turn_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of a turn belonging to this subagent. responses: '200': - description: The updated environment template. + description: The requested subagent history. content: application/json: schema: - $ref: '#/components/schemas/EnvironmentTemplateResource' + $ref: '#/components/schemas/TurnResource' '400': description: The request was invalid. content: @@ -32191,19 +32179,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment definition was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current environment state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -32220,28 +32208,70 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - delete: - operationId: deleteAgentEnvironmentTemplate - summary: Delete an agent environment template - description: Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items: + get: + operationId: listAgentSessionSubagentTurnItems + summary: List subagent turn items + description: Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). tags: - Agents parameters: - - name: environment_template_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the reusable environment template. + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: turn_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of a turn belonging to this subagent. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: '200': - description: The deleted environment template. + description: The requested subagent history. content: application/json: schema: - $ref: '#/components/schemas/DeletedEnvironmentTemplateResource' + $ref: '#/components/schemas/SessionItemListResource' '400': description: The request was invalid. content: @@ -32255,19 +32285,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested environment definition was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current environment state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -32284,11 +32314,11 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions: + /agents: get: - operationId: listAgentSessions - summary: List agent sessions - description: Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + operationId: listAgents + summary: List agents + description: Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). tags: - Agents parameters: @@ -32317,22 +32347,14 @@ paths: minLength: 0 maxLength: 1048576 description: Return resources after this resource ID in the selected order. - - name: agent_id - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Only return sessions whose root agent has this ID. Omit to return sessions for all agents. responses: '200': - description: A page of sessions. + description: A page of agents. content: application/json: schema: - $ref: '#/components/schemas/SessionListResource' - description: A paginated list of sessions. + $ref: '#/components/schemas/AgentListResource' + description: A page of reusable agents. '400': description: The request was invalid. content: @@ -32376,26 +32398,23 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' post: - operationId: createAgentSession - summary: Create an agent session - description: Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). + operationId: createAgent + summary: Create an agent + description: Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). tags: - Agents requestBody: content: application/json: schema: - $ref: '#/components/schemas/CreateAgentSessionParams' + $ref: '#/components/schemas/CreateAgentParams' responses: '201': - description: The created session or its event stream. + description: The created agent. content: application/json: schema: - $ref: '#/components/schemas/SessionResource' - text/event-stream: - schema: - $ref: '#/components/schemas/SessionEvent' + $ref: '#/components/schemas/AgentResource' '400': description: The request was invalid. content: @@ -32426,12 +32445,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - '429': - description: The Files API rate limit for your user has been exceeded. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse-2' '500': description: An internal error occurred. content: @@ -32444,32 +32457,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - x-oai-streaming: - request_field: stream - response_status_code: 201 - /agents/sessions/{session_id}: + /agents/{agent_id}: get: - operationId: retrieveAgentSession - summary: Retrieve an agent session - description: Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + operationId: retrieveAgent + summary: Retrieve an agent + description: Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). tags: - Agents parameters: - - name: session_id + - name: agent_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session. + description: The ID of the reusable agent. responses: '200': - description: The requested session. + description: The requested agent. content: application/json: schema: - $ref: '#/components/schemas/SessionResource' + $ref: '#/components/schemas/AgentResource' '400': description: The request was invalid. content: @@ -32513,32 +32523,32 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' post: - operationId: updateAgentSession - summary: Update an agent session - description: Updates session metadata, model, reasoning effort, or service tier. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + operationId: updateAgent + summary: Update an agent + description: Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). tags: - Agents parameters: - - name: session_id + - name: agent_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session. + description: The ID of the reusable agent. requestBody: content: application/json: schema: - $ref: '#/components/schemas/UpdateAgentSessionParams' + $ref: '#/components/schemas/UpdateAgentParams' responses: '200': - description: The updated session. + description: The updated agent. content: application/json: schema: - $ref: '#/components/schemas/SessionResource' + $ref: '#/components/schemas/AgentResource' '400': description: The request was invalid. content: @@ -32581,28 +32591,173 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + examples: + request: + curl: | + # 1. Omit reasoning: keep its current settings while renaming the agent. + curl "https://api.openai.com/v1/agents/$AGENT_ID" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: agents=v1" \ + -d '{"name": "Renamed"}' + + # 2. Send null: reset reasoning to the model's defaults. + curl "https://api.openai.com/v1/agents/$AGENT_ID" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: agents=v1" \ + -d '{"reasoning": null}' + + # 3. Send an object: replace the entire reasoning configuration, without merging. + # The agent's model must support the "low" reasoning effort. + curl "https://api.openai.com/v1/agents/$AGENT_ID" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: agents=v1" \ + -d '{"reasoning": {"effort": "low"}}' + python: | + from openai import OpenAI + + client = OpenAI() + agent_id = "your-agent-id" + + # 1. Omit reasoning: keep its current settings while renaming the agent. + client.beta.agents.update(agent_id, name="Renamed") + + # 2. Python's None sends JSON null: reset reasoning to the model's defaults. + client.beta.agents.update(agent_id, reasoning=None) + + # 3. Send an object: replace the entire reasoning configuration, without merging. + # The agent's model must support the "low" reasoning effort. + client.beta.agents.update(agent_id, reasoning={"effort": "low"}) + javascript: | + import OpenAI from "openai"; + + const client = new OpenAI(); + const agentId = "your-agent-id"; + + // 1. Omit reasoning: keep its current settings while renaming the agent. + await client.beta.agents.update(agentId, { name: "Renamed" }); + + // 2. Send null: reset reasoning to the model's defaults. + await client.beta.agents.update(agentId, { reasoning: null }); + + // 3. Send an object: replace the entire reasoning configuration, without merging. + // The agent's model must support the "low" reasoning effort. + await client.beta.agents.update(agentId, { reasoning: { effort: "low" } }); + go: | + package main + + import ( + "context" + "log" + + "github.com/openai/openai-go/v3" + "github.com/openai/openai-go/v3/packages/param" + ) + + func main() { + client := openai.NewClient() + ctx := context.Background() + agentID := "your-agent-id" + + // 1. Omit reasoning: keep its current settings while renaming the agent. + _, err := client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{ + Name: openai.String("Renamed"), + }) + if err != nil { + log.Fatal(err) + } + + // 2. Send null: reset reasoning to the model's defaults. + _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{ + Reasoning: param.NullStruct[openai.AgentReasoningParam](), + }) + if err != nil { + log.Fatal(err) + } + + // 3. Send an object: replace the entire reasoning configuration, without merging. + // The agent's model must support the "low" reasoning effort. + _, err = client.Beta.Agents.Update(ctx, agentID, openai.BetaAgentUpdateParams{ + Reasoning: openai.AgentReasoningParam{Effort: openai.AgentReasoningParamEffortLow}, + }) + if err != nil { + log.Fatal(err) + } + } + java: | + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.core.JsonValue; + import com.openai.models.beta.agents.AgentReasoningParam; + import com.openai.models.beta.agents.AgentUpdateParams; + + public class AgentUpdateExample { + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + String agentId = "your-agent-id"; + + // 1. Omit reasoning: keep its current settings while renaming the agent. + client.beta().agents().update(AgentUpdateParams.builder() + .agentId(agentId) + .name("Renamed") + .build()); + + // 2. Send null: reset reasoning to the model's defaults. + client.beta().agents().update(AgentUpdateParams.builder() + .agentId(agentId) + .reasoning(JsonValue.from(null)) + .build()); + + // 3. Send an object: replace the entire reasoning configuration, without merging. + // The agent's model must support the "low" reasoning effort. + client.beta().agents().update(AgentUpdateParams.builder() + .agentId(agentId) + .reasoning(AgentReasoningParam.builder() + .effort(AgentReasoningParam.Effort.LOW) + .build()) + .build()); + } + } + ruby: | + require "openai" + + client = OpenAI::Client.new + agent_id = "your-agent-id" + + # 1. Omit reasoning: keep its current settings while renaming the agent. + client.beta.agents.update(agent_id, name: "Renamed") + + # 2. Ruby's nil sends JSON null: reset reasoning to the model's defaults. + client.beta.agents.update(agent_id, reasoning: nil) + + # 3. Send an object: replace the entire reasoning configuration, without merging. + # The agent's model must support the "low" reasoning effort. + client.beta.agents.update(agent_id, reasoning: {effort: :low}) delete: - operationId: deleteAgentSession - summary: Delete an agent session - description: Removes a managed agent session from the public API and returns a deletion confirmation. If backend execution has ended, deletion can cancel a still-open public turn and abandon unpublished outputs. Running execution must be cancelled first. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + operationId: deleteAgent + summary: Delete an agent + description: Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). tags: - Agents parameters: - - name: session_id + - name: agent_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session. + description: The ID of the reusable agent. responses: '200': - description: The deleted session. + description: The deleted agent. content: application/json: schema: - $ref: '#/components/schemas/DeletedSessionResource' + $ref: '#/components/schemas/DeletedAgentResource' '400': description: The request was invalid. content: @@ -32645,22 +32800,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/artifacts: + /agents/environments/templates: get: - operationId: listAgentSessionArtifacts - summary: List agent session artifacts - description: Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + operationId: listAgentEnvironmentTemplates + summary: List agent environment templates + description: Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - name: limit in: query required: false @@ -32686,24 +32833,14 @@ paths: minLength: 0 maxLength: 1048576 description: Return resources after this resource ID in the selected order. - - name: environment_id - in: query - required: false - schema: - type: - - string - - 'null' - minLength: 0 - maxLength: 1048576 - description: Restrict the listing to artifacts produced by this environment. responses: '200': - description: A page of durable session artifacts. + description: A page of environment templates. content: application/json: schema: - $ref: '#/components/schemas/SessionArtifactListResource' - description: A page of durable artifacts published by a session. + $ref: '#/components/schemas/EnvironmentTemplateListResource' + description: A page of reusable environment templates. '400': description: The request was invalid. content: @@ -32717,19 +32854,67 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required permission. + description: The API key lacks the required management permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested session or event was not found. + description: The requested environment definition was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - '409': - description: The request conflicted with the current session state. + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + post: + operationId: createAgentEnvironmentTemplate + summary: Create an agent environment template + description: Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + tags: + - Agents + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEnvironmentTemplateParams' + responses: + '201': + description: The created environment template. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentTemplateResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested environment definition was not found. content: application/json: schema: @@ -32746,37 +32931,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/artifacts/{artifact_id}: + /agents/environments/templates/{environment_template_id}: get: - operationId: retrieveAgentSessionArtifact - summary: Retrieve an agent session artifact - description: Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + operationId: retrieveAgentEnvironmentTemplate + summary: Retrieve an agent environment template + description: Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session that owns the artifact. - - name: artifact_id + - name: environment_template_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The immutable session artifact ID. + description: The ID of the reusable environment template. responses: '200': - description: The requested session artifact. + description: The requested environment template. content: application/json: schema: - $ref: '#/components/schemas/SessionArtifactResource' + $ref: '#/components/schemas/EnvironmentTemplateResource' '400': description: The request was invalid. content: @@ -32790,19 +32967,13 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required permission. + description: The API key lacks the required management permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested session or event was not found. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse-2' - '409': - description: The request conflicted with the current session state. + description: The requested environment definition was not found. content: application/json: schema: @@ -32819,36 +32990,33 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - delete: - operationId: deleteAgentSessionArtifact - summary: Delete an agent session artifact - description: Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + post: + operationId: updateAgentEnvironmentTemplate + summary: Update an agent environment template + description: Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session that owns the artifact. - - name: artifact_id + - name: environment_template_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The immutable session artifact ID. + description: The ID of the reusable environment template. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateEnvironmentTemplateParams' responses: '200': - description: The deleted session artifact. + description: The updated environment template. content: application/json: schema: - $ref: '#/components/schemas/DeletedSessionArtifactResource' + $ref: '#/components/schemas/EnvironmentTemplateResource' '400': description: The request was invalid. content: @@ -32862,19 +33030,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required permission. + description: The API key lacks the required management permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested session or event was not found. + description: The requested environment definition was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current session state. + description: The request conflicted with the current environment state. content: application/json: schema: @@ -32891,38 +33059,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/artifacts/{artifact_id}/content: - get: - operationId: retrieveAgentSessionArtifactContent - summary: Retrieve agent session artifact content - description: Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + delete: + operationId: deleteAgentEnvironmentTemplate + summary: Delete an agent environment template + description: Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). tags: - Agents parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session that owns the artifact. - - name: artifact_id + - name: environment_template_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The immutable session artifact ID. + description: The ID of the reusable environment template. responses: '200': - description: The immutable artifact contents. + description: The deleted environment template. content: - application/octet-stream: + application/json: schema: - type: string - format: binary + $ref: '#/components/schemas/DeletedEnvironmentTemplateResource' '400': description: The request was invalid. content: @@ -32936,19 +33094,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required permission. + description: The API key lacks the required management permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested session or event was not found. + description: The requested environment definition was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current session state. + description: The request conflicted with the current environment state. content: application/json: schema: @@ -32965,29 +33123,55 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/events: + /agents/sessions: get: - operationId: listAgentSessionEvents - summary: Stream agent session events - description: Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + operationId: listAgentSessions + summary: List agent sessions + description: Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). tags: - Agents parameters: - - name: session_id - in: path - required: true + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session. + description: Return resources after this resource ID in the selected order. + - name: agent_id + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Only return sessions whose root agent has this ID. Omit to return sessions for all agents. responses: '200': - description: A live stream of session events. + description: A page of sessions. content: - text/event-stream: + application/json: schema: - $ref: '#/components/schemas/SessionEvent' + $ref: '#/components/schemas/SessionListResource' + description: A paginated list of sessions. '400': description: The request was invalid. content: @@ -33030,40 +33214,27 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - x-oai-streaming: - request_field: null - response_status_code: 200 post: - operationId: createAgentSessionEvents - summary: Create agent session input events - description: Submits message, cancellation, tool-result, or computer-use approval-response events to a managed agent session. Cancellation can recover a still-open turn whose backend execution has ended by marking it cancelled and abandoning unpublished outputs. Saved results, published files, and existing terminal outcomes are preserved. HTTP 202 confirms acceptance, not durable completion. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + operationId: createAgentSession + summary: Create an agent session + description: Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). tags: - Agents - parameters: - - name: session_id - in: path - required: true - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the session. - - name: Idempotency-Key - in: header - required: false - schema: - type: string - minLength: 1 - maxLength: 256 - description: An optional client-generated key that makes retries of submitted messages idempotent. requestBody: content: application/json: schema: - $ref: '#/components/schemas/CreateSessionEventsParams' + $ref: '#/components/schemas/CreateAgentSessionParams' responses: - '202': - description: The events were accepted. + '201': + description: The created session or its event stream. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionResource' + text/event-stream: + schema: + $ref: '#/components/schemas/SessionEvent' '400': description: The request was invalid. content: @@ -33094,6 +33265,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' + '429': + description: The Files API rate limit for your user has been exceeded. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' '500': description: An internal error occurred. content: @@ -33106,11 +33283,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/items: + x-oai-streaming: + request_field: stream + response_status_code: 201 + /agents/sessions/{session_id}: get: - operationId: listAgentSessionItems - summary: List agent session items - description: Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). + operationId: retrieveAgentSession + summary: Retrieve an agent session + description: Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). tags: - Agents parameters: @@ -33122,38 +33302,13 @@ paths: minLength: 0 maxLength: 1048576 description: The ID of the session. - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. responses: '200': - description: A page of session items. + description: The requested session. content: application/json: schema: - $ref: '#/components/schemas/SessionItemListResource' + $ref: '#/components/schemas/SessionResource' '400': description: The request was invalid. content: @@ -33196,11 +33351,10 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/traces: - get: - operationId: listAgentSessionTraces - summary: List agent session traces - description: Lists published root-turn traces as OTLP JSON, ordered by turn creation time and ID. Unpublished traces are skipped. Each page returns data available when read; it does not wait for late traces. Trace reads and the JSON response are limited to 16 MiB per request. If the limit is exceeded, request fewer traces. + post: + operationId: updateAgentSession + summary: Update an agent session + description: Updates session metadata, model, reasoning effort, or service tier. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). tags: - Agents parameters: @@ -33212,39 +33366,18 @@ paths: minLength: 0 maxLength: 1048576 description: The ID of the session. - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAgentSessionParams' responses: '200': - description: A page of published session traces. + description: The updated session. content: application/json: schema: - $ref: '#/components/schemas/SessionTraceListResource' - description: A page of published session traces. + $ref: '#/components/schemas/SessionResource' '400': description: The request was invalid. content: @@ -33287,11 +33420,10 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/turns: - get: - operationId: listAgentSessionTurns - summary: List agent session turns - description: Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + delete: + operationId: deleteAgentSession + summary: Delete an agent session + description: Removes a managed agent session from the public API and returns a deletion confirmation. If backend execution has ended, deletion can cancel a still-open public turn and abandon unpublished outputs. Running execution must be cancelled first. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). tags: - Agents parameters: @@ -33303,39 +33435,13 @@ paths: minLength: 0 maxLength: 1048576 description: The ID of the session. - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return resources after this resource ID in the selected order. responses: '200': - description: A page of session turns. + description: The deleted session. content: application/json: schema: - $ref: '#/components/schemas/SessionTurnListResource' - description: A page of turns from an agent session or subagent. + $ref: '#/components/schemas/DeletedSessionResource' '400': description: The request was invalid. content: @@ -33378,11 +33484,11 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/turns/{turn_id}: + /agents/sessions/{session_id}/artifacts: get: - operationId: retrieveAgentSessionTurn - summary: Retrieve an agent session turn - description: Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + operationId: listAgentSessionArtifacts + summary: List agent session artifacts + description: Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). tags: - Agents parameters: @@ -33393,22 +33499,50 @@ paths: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session that owns the turn. - - name: turn_id - in: path - required: true + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the turn. + description: Return resources after this resource ID in the selected order. + - name: environment_id + in: query + required: false + schema: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Restrict the listing to artifacts produced by this environment. responses: '200': - description: The requested turn. + description: A page of durable session artifacts. content: application/json: schema: - $ref: '#/components/schemas/TurnResource' + $ref: '#/components/schemas/SessionArtifactListResource' + description: A page of durable artifacts published by a session. '400': description: The request was invalid. content: @@ -33451,11 +33585,11 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /agents/sessions/{session_id}/turns/{turn_id}/items: + /agents/sessions/{session_id}/artifacts/{artifact_id}: get: - operationId: listAgentSessionTurnItems - summary: List agent session turn items - description: Lists items belonging to one root-agent turn, including its interactions with subagents. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). + operationId: retrieveAgentSessionArtifact + summary: Retrieve an agent session artifact + description: Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). tags: - Agents parameters: @@ -33466,47 +33600,22 @@ paths: type: string minLength: 0 maxLength: 1048576 - description: The ID of the session that owns the turn. - - name: turn_id + description: The ID of the session that owns the artifact. + - name: artifact_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the turn. - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false - schema: - type: string - minLength: 0 - maxLength: 1048576 - description: Return items after this cursor in the selected order. Pass the previous response's last_id, which can differ from the last item's ID. + description: The immutable session artifact ID. responses: '200': - description: A page of session turn items. + description: The requested session artifact. content: application/json: schema: - $ref: '#/components/schemas/SessionItemListResource' + $ref: '#/components/schemas/SessionArtifactResource' '400': description: The request was invalid. content: @@ -33549,71 +33658,36 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /vaults: - get: - operationId: listVaults - summary: List vaults - description: Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + delete: + operationId: deleteAgentSessionArtifact + summary: Delete an agent session artifact + description: Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). tags: - - Vaults + - Agents parameters: - - name: limit - in: query - required: false - schema: - type: integer - format: int64 - minimum: 1 - maximum: 100 - default: 20 - description: The maximum number of resources to return, between 1 and 100. Defaults to 20. - - name: order - in: query - required: false - schema: - $ref: '#/components/schemas/ListOrderParam' - default: desc - description: The order in which resources are returned. Defaults to `desc`. - - name: after - in: query - required: false + - name: session_id + in: path + required: true schema: type: string minLength: 0 maxLength: 1048576 - description: Return resources after this resource ID in the selected order. - - name: metadata - in: query - required: false - schema: - type: object - additionalProperties: - type: string - minLength: 0 - maxLength: 512 - propertyNames: - type: string - minLength: 1 - maxLength: 64 - minProperties: 0 - maxProperties: 16 - description: Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear. - style: deepObject - explode: true - - name: status - in: query - required: false + description: The ID of the session that owns the artifact. + - name: artifact_id + in: path + required: true schema: - $ref: '#/components/schemas/VaultStatusFilterParam' - description: Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default. + type: string + minLength: 0 + maxLength: 1048576 + description: The immutable session artifact ID. responses: '200': - description: A page of vaults. + description: The deleted session artifact. content: application/json: schema: - $ref: '#/components/schemas/VaultListResource' - description: A page of vaults. + $ref: '#/components/schemas/DeletedSessionArtifactResource' '400': description: The request was invalid. content: @@ -33627,19 +33701,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -33656,24 +33730,38 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: createVault - summary: Create a vault - description: Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + /agents/sessions/{session_id}/artifacts/{artifact_id}/content: + get: + operationId: retrieveAgentSessionArtifactContent + summary: Retrieve agent session artifact content + description: Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). tags: - - Vaults - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateVaultParams' + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session that owns the artifact. + - name: artifact_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The immutable session artifact ID. responses: - '201': - description: The created vault. + '200': + description: The immutable artifact contents. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/VaultResource' + type: string + format: binary '400': description: The request was invalid. content: @@ -33687,19 +33775,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -33716,29 +33804,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /vaults/{vault_id}: + /agents/sessions/{session_id}/events: get: - operationId: retrieveVault - summary: Retrieve a vault - description: Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + operationId: listAgentSessionEvents + summary: Stream agent session events + description: Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. + description: The ID of the session. responses: '200': - description: The requested vault. + description: A live stream of session events. content: - application/json: + text/event-stream: schema: - $ref: '#/components/schemas/VaultResource' + $ref: '#/components/schemas/SessionEvent' '400': description: The request was invalid. content: @@ -33752,19 +33840,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -33781,36 +33869,40 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' + x-oai-streaming: + request_field: null + response_status_code: 200 post: - operationId: updateVault - summary: Update a vault - description: Updates the name or metadata of an active vault. Omitted fields remain unchanged. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + operationId: createAgentSessionEvents + summary: Create agent session input events + description: Submits message, cancellation, tool-result, or computer-use approval-response events to a managed agent session. Cancellation can recover a still-open turn whose backend execution has ended by marking it cancelled and abandoning unpublished outputs. Saved results, published files, and existing terminal outcomes are preserved. HTTP 202 confirms acceptance, not durable completion. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. + description: The ID of the session. + - name: Idempotency-Key + in: header + required: false + schema: + type: string + minLength: 1 + maxLength: 256 + description: An optional client-generated key that makes retries of submitted messages idempotent. requestBody: content: application/json: schema: - $ref: '#/components/schemas/UpdateVaultParams' - example: - name: Research vault - required: true + $ref: '#/components/schemas/CreateSessionEventsParams' responses: - '200': - description: The updated vault. - content: - application/json: - schema: - $ref: '#/components/schemas/VaultResource' + '202': + description: The events were accepted. '400': description: The request was invalid. content: @@ -33824,19 +33916,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -33853,28 +33945,54 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - delete: - operationId: deleteVault - summary: Delete a vault - description: Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + /agents/sessions/{session_id}/items: + get: + operationId: listAgentSessionItems + summary: List agent session items + description: Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: '200': - description: The deleted vault. + description: A page of session items. content: application/json: schema: - $ref: '#/components/schemas/DeletedVaultResource' + $ref: '#/components/schemas/SessionItemListResource' '400': description: The request was invalid. content: @@ -33888,19 +34006,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -33917,22 +34035,22 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /vaults/{vault_id}/credentials: + /agents/sessions/{session_id}/traces: get: - operationId: listVaultCredentials - summary: List vault credentials - description: Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + operationId: listAgentSessionTraces + summary: List agent session traces + description: Lists published root-turn traces as OTLP JSON, ordered by turn creation time and ID. Unpublished traces are skipped. Each page returns data available when read; it does not wait for late traces. Trace reads and the JSON response are limited to 16 MiB per request. If the limit is exceeded, request fewer traces. tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. + description: The ID of the session. - name: limit in: query required: false @@ -33958,38 +34076,14 @@ paths: minLength: 0 maxLength: 1048576 description: Return resources after this resource ID in the selected order. - - name: metadata - in: query - required: false - schema: - type: object - additionalProperties: - type: string - minLength: 0 - maxLength: 512 - propertyNames: - type: string - minLength: 1 - maxLength: 64 - minProperties: 0 - maxProperties: 16 - description: Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear. - style: deepObject - explode: true - - name: status - in: query - required: false - schema: - $ref: '#/components/schemas/VaultStatusFilterParam' - description: Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default. responses: '200': - description: A page of vault credentials. + description: A page of published session traces. content: application/json: schema: - $ref: '#/components/schemas/VaultCredentialListResource' - description: A page of credentials in a vault. + $ref: '#/components/schemas/SessionTraceListResource' + description: A page of published session traces. '400': description: The request was invalid. content: @@ -34003,19 +34097,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -34032,33 +34126,55 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: createVaultCredential - summary: Create a vault credential - description: Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + /agents/sessions/{session_id}/turns: + get: + operationId: listAgentSessionTurns + summary: List agent session turns + description: Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateVaultCredentialParams' + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: - '201': - description: The created vault credential without secret values. + '200': + description: A page of session turns. content: application/json: schema: - $ref: '#/components/schemas/VaultCredentialResource' + $ref: '#/components/schemas/SessionTurnListResource' + description: A page of turns from an agent session or subagent. '400': description: The request was invalid. content: @@ -34072,19 +34188,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -34101,37 +34217,37 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /vaults/{vault_id}/credentials/{credential_id}: + /agents/sessions/{session_id}/turns/{turn_id}: get: - operationId: retrieveVaultCredential - summary: Retrieve a vault credential - description: Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + operationId: retrieveAgentSessionTurn + summary: Retrieve an agent session turn + description: Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. - - name: credential_id + description: The ID of the session that owns the turn. + - name: turn_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault credential. + description: The ID of the turn. responses: '200': - description: The requested vault credential without secret values. + description: The requested turn. content: application/json: schema: - $ref: '#/components/schemas/VaultCredentialResource' + $ref: '#/components/schemas/TurnResource' '400': description: The request was invalid. content: @@ -34145,19 +34261,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -34174,44 +34290,62 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - post: - operationId: rotateVaultCredential - summary: Update a vault credential - description: Updates credential metadata or rotates its write-only secret. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + /agents/sessions/{session_id}/turns/{turn_id}/items: + get: + operationId: listAgentSessionTurnItems + summary: List agent session turn items + description: Lists items belonging to one root-agent turn, including its interactions with subagents. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). tags: - - Vaults + - Agents parameters: - - name: vault_id + - name: session_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault. - - name: credential_id + description: The ID of the session that owns the turn. + - name: turn_id in: path required: true schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault credential. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/RotateVaultCredentialParams' - example: - metadata: {} - required: true + description: The ID of the turn. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return items after this cursor in the selected order. Pass the previous response's last_id, which can differ from the last item's ID. responses: '200': - description: The updated vault credential without secret values. + description: A page of session turn items. content: application/json: schema: - $ref: '#/components/schemas/VaultCredentialResource' + $ref: '#/components/schemas/SessionItemListResource' '400': description: The request was invalid. content: @@ -34225,19 +34359,19 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse-2' '403': - description: The API key lacks the required management permission. + description: The API key lacks the required permission. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The requested vault or credential was not found. + description: The requested session or event was not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' '409': - description: The request conflicted with the current vault state. + description: The request conflicted with the current session state. content: application/json: schema: @@ -34254,36 +34388,71 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - delete: - operationId: deleteVaultCredential - summary: Delete a vault credential - description: Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + /vaults: + get: + operationId: listVaults + summary: List vaults + description: Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). tags: - Vaults parameters: - - name: vault_id - in: path - required: true + - name: limit + in: query + required: false schema: - type: string - minLength: 0 - maxLength: 1048576 - description: The ID of the vault. - - name: credential_id - in: path - required: true + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false schema: type: string minLength: 0 maxLength: 1048576 - description: The ID of the vault credential. + description: Return resources after this resource ID in the selected order. + - name: metadata + in: query + required: false + schema: + type: object + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear. + style: deepObject + explode: true + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/VaultStatusFilterParam' + description: Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default. responses: '200': - description: The deleted vault credential. + description: A page of vaults. content: application/json: schema: - $ref: '#/components/schemas/DeletedVaultCredentialResource' + $ref: '#/components/schemas/VaultListResource' + description: A page of vaults. '400': description: The request was invalid. content: @@ -34326,337 +34495,1007 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' - /webhook_endpoints: - get: - summary: List Webhook Endpoints - description: Returns webhook endpoints for the authenticated project in newest-first order. - operationId: ListWebhookEndpoints - parameters: - - name: limit - in: query - description: Maximum number of webhook endpoints to return. Defaults to 20. - required: false - schema: - type: integer - minimum: 1 - maximum: 100 - - name: after - in: query - description: ID of the last webhook endpoint from the previous page. - required: false - schema: - anyOf: - - example: whe_123 - type: string - - type: 'null' - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookEndpointListResource' - '400': - description: The request parameters are invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '404': - description: The pagination cursor does not identify a webhook endpoint in the authenticated project. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true post: - summary: Create Webhook Endpoint - description: Creates a webhook endpoint for the authenticated project. - operationId: CreateWebhookEndpoint - parameters: [] + operationId: createVault + summary: Create a vault + description: Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults requestBody: content: application/json: schema: - $ref: '#/components/schemas/PublicCreateEndpointBody' + $ref: '#/components/schemas/CreateVaultParams' responses: - '200': - description: Success + '201': + description: The created vault. content: application/json: schema: - $ref: '#/components/schemas/WebhookEndpointWithSecretResource' + $ref: '#/components/schemas/VaultResource' '400': - description: The webhook endpoint parameters are invalid or the endpoint cannot be created with the requested URL or event types. + description: The request was invalid. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - /webhook_endpoints/{webhook_endpoint_id}: - get: - summary: Retrieve Webhook Endpoint - description: Retrieves a webhook endpoint for the authenticated project. - operationId: RetrieveWebhookEndpoint - parameters: - - name: webhook_endpoint_id - in: path - description: The ID of the webhook endpoint to retrieve. - required: true - schema: - example: whe_123 - type: string - responses: - '200': - description: Success + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. content: application/json: schema: - $ref: '#/components/schemas/WebhookEndpointBody' - '400': - description: The request parameters are invalid. + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The webhook endpoint was not found in the authenticated project. + description: The requested vault or credential was not found. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - post: - summary: Update Webhook Endpoint - description: Updates a webhook endpoint for the authenticated project. - operationId: UpdateWebhookEndpoint - parameters: - - name: webhook_endpoint_id - in: path - description: The ID of the webhook endpoint to update. - required: true - schema: - example: whe_123 - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PublicUpdateEndpointBody' - responses: - '200': - description: Success + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. content: application/json: schema: - $ref: '#/components/schemas/WebhookEndpointBody' - '400': - description: The webhook endpoint parameters are invalid or the requested URL or event types are not permitted. + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - '404': - description: The webhook endpoint was not found in the authenticated project. + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - delete: - summary: Delete Webhook Endpoint - description: Deletes a webhook endpoint for the authenticated project. - operationId: DeleteWebhookEndpoint + $ref: '#/components/schemas/ErrorResponse-2' + /vaults/{vault_id}: + get: + operationId: retrieveVault + summary: Retrieve a vault + description: Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults parameters: - - name: webhook_endpoint_id + - name: vault_id in: path - description: The ID of the webhook endpoint to delete. required: true schema: - example: whe_123 type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. responses: '200': - description: Success + description: The requested vault. content: application/json: schema: - $ref: '#/components/schemas/DeletedWebhookEndpointResource' + $ref: '#/components/schemas/VaultResource' '400': - description: The request parameters are invalid. + description: The request was invalid. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' '404': - description: The webhook endpoint was not found in the authenticated project. + description: The requested vault or credential was not found. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - /webhook_endpoints/{webhook_endpoint_id}/rotate_secret: - post: - summary: Rotate Webhook Endpoint Signing Secret - description: Rotates the signing secret for a webhook endpoint in the authenticated project. - operationId: RotateWebhookEndpointSigningSecret - parameters: - - name: webhook_endpoint_id - in: path - description: The ID of the webhook endpoint whose signing secret will be rotated. - required: true - schema: - example: whe_123 - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PublicRotateSecretBody' - responses: - '200': - description: Success + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. content: application/json: schema: - $ref: '#/components/schemas/WebhookEndpointWithSecretResource' - '400': - description: The request parameters are invalid. + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - '404': - description: The webhook endpoint was not found in the authenticated project. + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - /webhook_endpoints/{webhook_endpoint_id}/test: + $ref: '#/components/schemas/ErrorResponse-2' post: - summary: Test Webhook Endpoint - description: Sends a sample event to a webhook endpoint for the authenticated project. - operationId: TestWebhookEndpoint + operationId: updateVault + summary: Update a vault + description: Updates the name or metadata of an active vault. Omitted fields remain unchanged. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults parameters: - - name: webhook_endpoint_id + - name: vault_id in: path - description: The ID of the webhook endpoint to test. required: true schema: - example: whe_123 type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. requestBody: content: application/json: schema: - $ref: '#/components/schemas/PublicTestEndpointBody' + $ref: '#/components/schemas/UpdateVaultParams' + example: + name: Research vault + required: true responses: '200': - description: Success + description: The updated vault. content: application/json: schema: - $ref: '#/components/schemas/WebhookEndpointTestResultResource' + $ref: '#/components/schemas/VaultResource' '400': - description: The request parameters are invalid. + description: The request was invalid. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - '404': - description: The webhook endpoint was not found in the authenticated project. + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - '500': - description: The sample event could not be sent to the webhook endpoint. + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - /webhook_event_types: - get: - summary: List Webhook Event Types - description: Returns webhook event types visible to the authenticated project. - operationId: ListWebhookEventTypes - parameters: [] - responses: - '200': - description: Success + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. content: application/json: schema: - $ref: '#/components/schemas/WebhookEventTypeListResource' - '401': - description: The request does not contain authentication credentials. - headers: - WWW-Authenticate: - description: The bearer authentication challenge returned by the service. + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: schema: - type: string - example: Bearer realm="OpenAI API" + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. content: application/json: schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - beta: true - /responses?beta=true: - post: - operationId: beta_createResponse + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + delete: + operationId: deleteVault + summary: Delete a vault + description: Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). tags: - - Responses - summary: Create a model response - description: | - Creates a model response. Provide [text](https://developers.openai.com/api/docs/guides/text) or - [image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate [text](https://developers.openai.com/api/docs/guides/text) - or [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have the model call - your own [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use built-in - [tools](https://developers.openai.com/api/docs/guides/tools) like [web search](https://developers.openai.com/api/docs/guides/tools-web-search) - or [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use your own data - as input for the model's response. - requestBody: + - Vaults + parameters: + - name: vault_id + in: path required: true - content: - application/json: - schema: - $ref: '#/components/schemas/BetaCreateResponse' + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. responses: '200': - description: OK + description: The deleted vault. content: application/json: schema: - $ref: '#/components/schemas/BetaResponse' - text/event-stream: - schema: - $ref: '#/components/schemas/BetaResponseStreamEvent' + $ref: '#/components/schemas/DeletedVaultResource' '400': - description: Invalid response request or incompatible request parameters. + description: The request was invalid. content: application/json: schema: - $ref: '#/components/schemas/BetaErrorResponse' - '404': - description: The requested model or a referenced resource was not found or is unavailable to this caller. + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. content: application/json: schema: - $ref: '#/components/schemas/BetaErrorResponse' - '429': - $ref: '#/components/responses/InferenceRateLimited' - '503': - $ref: '#/components/responses/InferenceServiceUnavailable' + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + /vaults/{vault_id}/credentials: + get: + operationId: listVaultCredentials + summary: List vault credentials + description: Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + - name: metadata + in: query + required: false + schema: + type: object + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Exact string matches supplied as `metadata[key]=value`. All supplied pairs must match. Up to 16 pairs, with keys from 1 to 64 characters and values up to 512 characters. Filtering is eventually consistent; metadata changes may take time to appear. + style: deepObject + explode: true + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/VaultStatusFilterParam' + description: Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default. + responses: + '200': + description: A page of vault credentials. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialListResource' + description: A page of credentials in a vault. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + post: + operationId: createVaultCredential + summary: Create a vault credential + description: Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVaultCredentialParams' + responses: + '201': + description: The created vault credential without secret values. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + /vaults/{vault_id}/credentials/{credential_id}: + get: + operationId: retrieveVaultCredential + summary: Retrieve a vault credential + description: Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: credential_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault credential. + responses: + '200': + description: The requested vault credential without secret values. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + post: + operationId: rotateVaultCredential + summary: Update a vault credential + description: Updates credential metadata or rotates its write-only secret. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: credential_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault credential. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RotateVaultCredentialParams' + example: + metadata: {} + required: true + responses: + '200': + description: The updated vault credential without secret values. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + delete: + operationId: deleteVaultCredential + summary: Delete a vault credential + description: Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: credential_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault credential. + responses: + '200': + description: The deleted vault credential. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedVaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + /webhook_endpoints: + get: + summary: List Webhook Endpoints + description: Returns webhook endpoints for the authenticated project in newest-first order. + operationId: ListWebhookEndpoints + parameters: + - name: limit + in: query + description: Maximum number of webhook endpoints to return. Defaults to 20. + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + - name: after + in: query + description: ID of the last webhook endpoint from the previous page. + required: false + schema: + anyOf: + - example: whe_123 + type: string + - type: 'null' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEndpointListResource' + '400': + description: The request parameters are invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The pagination cursor does not identify a webhook endpoint in the authenticated project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + post: + summary: Create Webhook Endpoint + description: Creates a webhook endpoint for the authenticated project. + operationId: CreateWebhookEndpoint + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PublicCreateEndpointBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEndpointWithSecretResource' + '400': + description: The webhook endpoint parameters are invalid or the endpoint cannot be created with the requested URL or event types. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + /webhook_endpoints/{webhook_endpoint_id}: + get: + summary: Retrieve Webhook Endpoint + description: Retrieves a webhook endpoint for the authenticated project. + operationId: RetrieveWebhookEndpoint + parameters: + - name: webhook_endpoint_id + in: path + description: The ID of the webhook endpoint to retrieve. + required: true + schema: + example: whe_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEndpointBody' + '400': + description: The request parameters are invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The webhook endpoint was not found in the authenticated project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + post: + summary: Update Webhook Endpoint + description: Updates a webhook endpoint for the authenticated project. + operationId: UpdateWebhookEndpoint + parameters: + - name: webhook_endpoint_id + in: path + description: The ID of the webhook endpoint to update. + required: true + schema: + example: whe_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PublicUpdateEndpointBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEndpointBody' + '400': + description: The webhook endpoint parameters are invalid or the requested URL or event types are not permitted. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The webhook endpoint was not found in the authenticated project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + delete: + summary: Delete Webhook Endpoint + description: Deletes a webhook endpoint for the authenticated project. + operationId: DeleteWebhookEndpoint + parameters: + - name: webhook_endpoint_id + in: path + description: The ID of the webhook endpoint to delete. + required: true + schema: + example: whe_123 + type: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedWebhookEndpointResource' + '400': + description: The request parameters are invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The webhook endpoint was not found in the authenticated project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + /webhook_endpoints/{webhook_endpoint_id}/rotate_secret: + post: + summary: Rotate Webhook Endpoint Signing Secret + description: Rotates the signing secret for a webhook endpoint in the authenticated project. + operationId: RotateWebhookEndpointSigningSecret + parameters: + - name: webhook_endpoint_id + in: path + description: The ID of the webhook endpoint whose signing secret will be rotated. + required: true + schema: + example: whe_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PublicRotateSecretBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEndpointWithSecretResource' + '400': + description: The request parameters are invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The webhook endpoint was not found in the authenticated project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + /webhook_endpoints/{webhook_endpoint_id}/test: + post: + summary: Test Webhook Endpoint + description: Sends a sample event to a webhook endpoint for the authenticated project. + operationId: TestWebhookEndpoint + parameters: + - name: webhook_endpoint_id + in: path + description: The ID of the webhook endpoint to test. + required: true + schema: + example: whe_123 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PublicTestEndpointBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEndpointTestResultResource' + '400': + description: The request parameters are invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '404': + description: The webhook endpoint was not found in the authenticated project. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + '500': + description: The sample event could not be sent to the webhook endpoint. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + /webhook_event_types: + get: + summary: List Webhook Event Types + description: Returns webhook event types visible to the authenticated project. + operationId: ListWebhookEventTypes + parameters: [] + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEventTypeListResource' + '401': + description: The request does not contain authentication credentials. + headers: + WWW-Authenticate: + description: The bearer authentication challenge returned by the service. + schema: + type: string + example: Bearer realm="OpenAI API" + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-oaiMeta: + beta: true + /responses?beta=true: + post: + operationId: beta_createResponse + tags: + - Responses + summary: Create a model response + description: | + Creates a model response. Provide [text](https://developers.openai.com/api/docs/guides/text) or + [image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate [text](https://developers.openai.com/api/docs/guides/text) + or [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have the model call + your own [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use built-in + [tools](https://developers.openai.com/api/docs/guides/tools) like [web search](https://developers.openai.com/api/docs/guides/tools-web-search) + or [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use your own data + as input for the model's response. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateResponse' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BetaResponse' + text/event-stream: + schema: + $ref: '#/components/schemas/BetaResponseStreamEvent' + '400': + description: Invalid response request or incompatible request parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '404': + description: The requested model or a referenced resource was not found or is unavailable to this caller. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + '429': + $ref: '#/components/responses/InferenceRateLimited' + '503': + $ref: '#/components/responses/InferenceServiceUnavailable' x-oaiMeta: group: responses path: create @@ -36642,58 +37481,6 @@ paths: "object": "response.input_tokens", "input_tokens": 11 } - /audio/voices/{voice_id}: - delete: - operationId: deleteVoice - tags: - - Audio - summary: Delete voice - description: | - Deletes a voice created from a text prompt or an audio sample. - - Requires voice write permission and access to the voice's project. Access to voices created from recordings is limited to eligible customers. See the [custom voices guide](https://developers.openai.com/api/docs/guides/custom-voices). - - Deleting a voice does not delete its consent recording. Deleting an already deleted voice returns a 404 error. - parameters: - - in: path - name: voice_id - required: true - schema: - type: string - description: The ID of the voice to delete. - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/VoiceDeletedResource' - '400': - description: Invalid voice ID. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - '404': - description: The endpoint is unavailable or the voice was not found in the requested project. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - x-oaiMeta: - group: audio - examples: - request: - curl: | - curl https://api.openai.com/v1/audio/voices/voice_1234 \ - -X DELETE \ - -H "Authorization: Bearer $OPENAI_API_KEY" - response: | - { - "id": "voice_1234", - "object": "audio.voice.deleted", - "deleted": true - } webhooks: agent_environment_expired: post: @@ -41935,6 +42722,12 @@ components: index: type: integer description: The index of the choice in the list of choices. + x-openai-go-public-shape: + field_order: + - delta + - finish_reason + - index + - logprobs created: type: integer format: unixtime @@ -50201,6 +50994,9 @@ components: ItemResource: description: | Content item used to generate a response. + x-openai-go-public-shape: + dispatch: + message: '#/components/schemas/OutputMessage' discriminator: propertyName: type anyOf: @@ -52076,9 +52872,14 @@ components: description: The tools to add this file to. type: array items: + x-openai-go-public-shape: + variant_names: + '#/components/schemas/AssistantToolsFileSearchTypeOnly': FileSearchTool anyOf: - $ref: '#/components/schemas/AssistantToolsCode' - $ref: '#/components/schemas/AssistantToolsFileSearchTypeOnly' + x-openai-go-public-shape: + type_name: MessageAttachmentToolFileSearchTool description: A list of files attached to the message, and the tools they were added to. - type: 'null' metadata: @@ -53009,6 +53810,9 @@ components: - $ref: '#/components/schemas/RefusalContent' - $ref: '#/components/schemas/ReasoningTextContent' OutputItem: + x-openai-go-public-shape: + projection_sources: + content: '#/components/schemas/OutputMessage/properties/content' discriminator: propertyName: type anyOf: @@ -58801,7 +59605,7 @@ components: logprobs: anyOf: - type: array - description: 'The log probabilities of the transcription. These can be enabled by configurating the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.' + description: 'The log probabilities of the transcription. These can be enabled by configuring the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.' items: $ref: '#/components/schemas/LogProbProperties' - type: 'null' @@ -59023,7 +59827,7 @@ components: description: | Returned when an error occurs, which could be a client problem or a server problem. Most errors are recoverable and the session will stay open, we - recommend to implementors to monitor and log error messages by default. + recommend to implementers to monitor and log error messages by default. properties: event_id: type: string @@ -61161,8 +61965,10 @@ components: - gpt-audio-mini-2025-10-06 - gpt-audio-mini-2025-12-15 x-stainless-nominal: false + x-openai-go-public-type: string_alias description: | The Realtime model used for this session. + x-openai-go-public-type: string_alias instructions: type: string description: | @@ -64271,6 +65077,7 @@ components: schema: $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' x-openai-ruby-json-schema-input: true + x-openai-go-public-type: any strict: anyOf: - type: boolean @@ -66365,6 +67172,7 @@ components: - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' x-stainless-skip: - go + x-openai-go-include-union-variant: true - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' - $ref: '#/components/schemas/ResponseInProgressEvent' - $ref: '#/components/schemas/ResponseFailedEvent' @@ -71822,6 +72630,35 @@ components: "language": "en-US", "created_at": 1734220800 } + VoiceDeletedResource: + type: object + additionalProperties: false + properties: + id: + type: string + description: The voice identifier. + example: voice_1234 + object: + type: string + enum: + - audio.voice.deleted + x-stainless-const: true + description: The object type, which is always `audio.voice.deleted`. + deleted: + type: boolean + description: Whether the voice was deleted. + required: + - id + - object + - deleted + x-oaiMeta: + name: The voice deletion object + example: | + { + "id": "voice_1234", + "object": "audio.voice.deleted", + "deleted": true + } VoiceIdsOrCustomVoice: title: Voice description: | @@ -72151,6 +72988,9 @@ components: description: | An object describing the specific action taken in this web search call. Includes details on how the model used the web (search, open_page, find_in_page). + x-openai-go-public-shape: + variant_names: + '#/components/schemas/WebSearchActionFind': Find discriminator: propertyName: type anyOf: @@ -73854,6 +74694,12 @@ components: description: The breakpoint mode. Always `explicit`. default: explicit x-stainless-const: true + ttl: + type: string + enum: + - 30m + - 12h + description: The minimum lifetime of this cache breakpoint. Defaults to the request TTL. type: object required: - mode @@ -74078,6 +74924,12 @@ components: description: The breakpoint mode. Always `explicit`. default: explicit x-stainless-const: true + ttl: + type: string + enum: + - 30m + - 12h + description: The minimum lifetime of this cache breakpoint. Defaults to the request TTL. type: object required: - mode @@ -77476,6 +78328,11 @@ components: description: Delegate tasks to your application. The Live session emits delegation events that your backend handles. type: object properties: + acknowledgement_delay_ms: + description: Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations. + type: integer + minimum: 0 + maximum: 800 type: description: The delegation owner. Always `client` for tasks handled by your application. default: client @@ -78214,6 +79071,11 @@ components: description: Delegate tasks to a Responses model managed by the Live session. type: object properties: + acknowledgement_delay_ms: + description: Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations. + type: integer + minimum: 0 + maximum: 800 type: description: The delegation owner. Always `responses` for tasks handled by the Responses API. default: responses @@ -78336,6 +79198,11 @@ components: LiveDecisionsDelegationParam: type: object properties: + acknowledgement_delay_ms: + description: Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400. Updates apply to subsequent delegations. + type: integer + minimum: 0 + maximum: 800 type: default: decisions x-stainless-const: true @@ -78711,1095 +79578,1731 @@ components: tool_choice: description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. anyOf: - - $ref: '#/components/schemas/LiveToolChoiceEnum' - - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' - - $ref: '#/components/schemas/LiveMCPToolChoiceParam' - parallel_tool_calls: + - $ref: '#/components/schemas/LiveToolChoiceEnum' + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + parallel_tool_calls: + anyOf: + - description: Whether the delegated Responses model may request multiple tool calls in a single response. + type: boolean + - type: 'null' + required: [] + LiveResponsesDelegationUpdateParam: + description: Update the Responses backend for an existing Live session without changing delegation ownership. + type: object + properties: + acknowledgement_delay_ms: + description: Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations. + type: integer + minimum: 0 + maximum: 800 + type: + description: The delegation owner. Always `responses` for tasks handled by the Responses API. + default: responses + x-stainless-const: true + type: string + enum: + - responses + responses: + description: Responses backend settings to update. Omitted settings keep their existing values. + $ref: '#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam' + required: + - type + target_uri: + type: string + description: |- + URI that should appear in the SIP Refer-To header. Supports values like + `tel:+14155550123` or `sip:agent@example.com`. + example: tel:+14155550123 + AwsExternalStorageProviderResponse: + properties: + type: + type: string + enum: + - aws + default: aws + x-stainless-const: true + account_id: + type: string + region: + type: string + bucket: + type: string + role_arn: + type: string + external_id: + type: string + type: object + required: + - type + - account_id + - region + - bucket + - role_arn + - external_id + AzureExternalStorageProviderResponse: + properties: + type: + type: string + enum: + - azure + default: azure + x-stainless-const: true + tenant_id: + type: string + subscription_id: + type: string + resource_group: + type: string + account_name: + type: string + container: + type: string + region: + type: string + type: object + required: + - type + - tenant_id + - subscription_id + - resource_group + - account_name + - container + - region + GcpExternalStorageProviderResponse: + properties: + type: + type: string + enum: + - gcp + default: gcp + x-stainless-const: true + bucket: + type: string + workload_identity_project_number: + type: string + workload_identity_pool_id: + type: string + workload_identity_provider_id: + type: string + region: + type: string + audience: + type: string + type: object + required: + - type + - bucket + - workload_identity_project_number + - workload_identity_pool_id + - workload_identity_provider_id + - region + - audience + OciExternalStorageProviderResponse: + properties: + type: + type: string + enum: + - oci + default: oci + x-stainless-const: true + tenancy_ocid: + type: string + region: + type: string + bucket: + type: string + type: object + required: + - type + - tenancy_ocid + - region + - bucket + provider: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/AwsExternalStorageProviderResponse' + - $ref: '#/components/schemas/AzureExternalStorageProviderResponse' + - $ref: '#/components/schemas/GcpExternalStorageProviderResponse' + - $ref: '#/components/schemas/OciExternalStorageProviderResponse' + PublicProjectResidency: + type: string + enum: + - GLOBAL + - US_STORAGE_PROCESSING + - EU_STORAGE_PROCESSING + - JP_STORAGE + - JP_STORAGE_PROCESSING + - KR_STORAGE + - CA_STORAGE + - SG_STORAGE + - IN_STORAGE + - IN_STORAGE_PROCESSING + - AU_STORAGE + - AU_STORAGE_PROCESSING + - GB_STORAGE + - AE_STORAGE + - AE_STORAGE_PROCESSING + UpdateProjectApiKeyBody: + anyOf: + - required: + - scopes + - required: + - expires_in_seconds + properties: + expires_in_seconds: + type: integer + maximum: 31536000 + minimum: 1 + description: Number of seconds from this request until the API key expires. Must comply with the organization and project expiry policies. Expired keys cannot be updated. Retrying resets the expiry relative to the new request. Omit to keep the current expiration. + x-openai-go-public-type: plain_scalar + scopes: + items: + type: string + type: array + description: Replace the API key scope restrictions. Omit to leave scopes unchanged. An empty array removes key restrictions (All permissions), subject to the owner's effective permissions. Use ["api.all.read"] for read-only access. Scopes do not change the owner's roles or grant administrative permissions. + type: object + required: [] + SpecificProgrammaticToolCallingParam: + properties: + type: + type: string + enum: + - programmatic_tool_calling + description: The tool to call. Always `programmatic_tool_calling`. + default: programmatic_tool_calling + x-stainless-const: true + type: object + required: + - type + SpecificApplyPatchParam: + properties: + type: + type: string + enum: + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch + x-stainless-const: true + type: object + required: + - type + title: Specific apply patch tool choice + description: Forces the model to call the apply_patch tool when executing a tool call. + SpecificFunctionShellParam: + properties: + type: + type: string + enum: + - shell + description: The tool to call. Always `shell`. + default: shell + x-stainless-const: true + type: object + required: + - type + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + CyberAccessProgramEnum: + type: string + enum: + - standard + - daybreak_blue + - daybreak_red + AccessProgramsParam: + properties: + cyber: + $ref: '#/components/schemas/CyberAccessProgramEnum' + description: The Cyber access program to use for this request. Supported values are `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves the program from the model's Cyber tier and your organization and project access, subject to model-specific eligibility restrictions. By default, models without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when authorized; otherwise they fall back to Standard unless the model requires Daybreak access. Red-tier models use Daybreak Red and require authorization. Requests that require unavailable Daybreak access return 403. An implicit Standard fallback is represented by null in the response's access_programs field, rather than an explicit Standard selection. + additionalProperties: false + type: object + required: [] + description: Domain-specific access programs to use for this request. + ResponsePromptCacheOptionsParam: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. + prewarm: + type: boolean + description: Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`. + comparison_response_id: + anyOf: + - type: string + description: The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled. + example: resp_123 + - type: 'null' + type: object + required: [] + title: Prompt cache options + description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. + ReasoningModeEnum: + anyOf: + - type: string + - type: string + enum: + - standard + - pro + ConversationParam-2: + properties: + id: + type: string + description: The unique ID of the conversation. + example: conv_123 + type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + ContextManagementParam: + properties: + type: + type: string + description: The context management entry type. Currently only 'compaction' is supported. + compact_threshold: + anyOf: + - type: integer + minimum: 1000 + description: Token threshold at which compaction should be triggered for this entry. + - type: 'null' + type: object + required: + - type + AccessProgramsBody: + properties: + cyber: + $ref: '#/components/schemas/CyberAccessProgramEnum' + description: The effective Cyber access program used for this response. + type: object + required: + - cyber + PromptCacheOptions: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to each cache breakpoint. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Whether implicit prompt-cache breakpoints were enabled. + comparison_response_id: + anyOf: + - type: string + description: The response ID supplied as the prompt cache diagnostics comparison. + - type: 'null' + type: object + required: + - ttl + - mode + title: Prompt cache options + description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. + CacheMissReasonTypeEnum: + type: string + enum: + - model_changed + - prompt_cache_key_changed + - tools_changed + - text_format_changed + - reasoning_effort_changed + - verbosity_changed + - context_compacted + - input_changed + - service_tier_changed + PromptCacheMissDiagnosticsBody: + properties: + type: + type: string + enum: + - cache_miss + default: cache_miss + x-stainless-const: true + reason: + $ref: '#/components/schemas/CacheMissReasonTypeEnum' + description: The reason prompt cache reuse did not occur. + cache_missed_tokens: + type: integer + description: The estimated number of input tokens affected after the first detected divergence. + comparison_reusable_tokens: + type: integer + description: The raw token count of the reusable prefix in the compared response. + type: object + required: + - type + - reason + - cache_missed_tokens + PromptCacheHitDiagnosticsBody: + properties: + type: + type: string + enum: + - cache_hit + default: cache_hit + x-stainless-const: true + type: object + required: + - type + PromptCacheComparisonResponseNotFoundDiagnosticsBody: + properties: + type: + type: string + enum: + - comparison_response_not_found + default: comparison_response_not_found + x-stainless-const: true + type: object + required: + - type + PromptCacheUnavailableDiagnosticsBody: + properties: + type: + type: string + enum: + - unavailable + default: unavailable + x-stainless-const: true + type: object + required: + - type + PromptCacheDiagnostics: + discriminator: + propertyName: type + description: Prompt cache diagnostics requested for this response. + anyOf: + - $ref: '#/components/schemas/PromptCacheMissDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheHitDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheUnavailableDiagnosticsBody' + ModerationErrorBody: + properties: + type: + type: string + enum: + - error + description: The object type, which was always `error` for moderation failures. + default: error + x-stainless-const: true + code: + type: string + description: The error code. + message: + type: string + description: The error message. + type: object + required: + - type + - code + - message + title: Moderation error + description: An error produced while attempting moderation for the response input or output. + Moderation: + properties: + input: + discriminator: + propertyName: type + description: Moderation for the response input. + anyOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + output: + discriminator: + propertyName: type + description: Moderation for the response output. anyOf: - - description: Whether the delegated Responses model may request multiple tool calls in a single response. - type: boolean - - type: 'null' - required: [] - LiveResponsesDelegationUpdateParam: - description: Update the Responses backend for an existing Live session without changing delegation ownership. + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + type: object + required: + - input + - output + title: Moderation + description: Moderation results or errors for the response input and output. + ResponseConversation: + properties: + id: + type: string + description: The unique ID of the conversation that this response was associated with. type: object + required: + - id + title: Conversation + description: The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation. + ResponseCompactionCompactingStreamingEvent: properties: type: - description: The delegation owner. Always `responses` for tasks handled by the Responses API. - default: responses - x-stainless-const: true type: string enum: - - responses - responses: - description: Responses backend settings to update. Omitted settings keep their existing values. - $ref: '#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam' + - response.compaction.compacting + description: The type of the event, always `response.compaction.compacting`. + default: response.compaction.compacting + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the compaction output item. + item_id: + type: string + description: The ID of the compaction output item. + type: object required: - type - target_uri: - type: string - description: |- - URI that should appear in the SIP Refer-To header. Supports values like - `tel:+14155550123` or `sip:agent@example.com`. - example: tel:+14155550123 - AwsExternalStorageProviderResponse: + - sequence_number + - output_index + - item_id + title: Response compaction compacting event + description: Emitted when new summary content is sampled for a compaction trigger. Contains no summary content. + ResponseShellCallCommandAddedStreamingEvent: properties: type: type: string enum: - - aws - default: aws + - response.shell_call_command.added + description: The type of the event, always `response.shell_call_command.added`. + default: response.shell_call_command.added x-stainless-const: true - account_id: - type: string - region: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that was added. + command: type: string - bucket: + description: The shell command that was added. + type: object + required: + - type + - sequence_number + - output_index + - command_index + - command + title: Response shell command added event + description: A streaming event that indicated a shell command was added to a tool call. + ResponseShellCallCommandDeltaStreamingEvent: + properties: + type: type: string - role_arn: + enum: + - response.shell_call_command.delta + description: The type of the event, always `response.shell_call_command.delta`. + default: response.shell_call_command.delta + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that was updated. + delta: type: string - external_id: + description: The shell command delta that was appended. + obfuscation: type: string + description: An obfuscation string that was added to pad the event payload. type: object required: - type - - account_id - - region - - bucket - - role_arn - - external_id - AzureExternalStorageProviderResponse: + - sequence_number + - output_index + - command_index + - delta + title: Response shell command delta event + description: A streaming event that indicated a shell command was incrementally updated. + ResponseShellCallCommandDoneStreamingEvent: properties: type: type: string enum: - - azure - default: azure + - response.shell_call_command.done + description: The type of the event, always `response.shell_call_command.done`. + default: response.shell_call_command.done x-stainless-const: true - tenant_id: - type: string - subscription_id: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that was completed. + command: type: string - resource_group: + description: The final shell command that was emitted. + type: object + required: + - type + - sequence_number + - output_index + - command_index + - command + title: Response shell command done event + description: A streaming event that indicated a shell command was completed. + ShellCallOutputDelta: + properties: + stdout: type: string - account_name: + description: The stdout delta that was emitted. + stderr: type: string - container: + description: The stderr delta that was emitted. + type: object + required: [] + title: Shell call output delta + description: A delta of stdout/stderr emitted while a shell call was running. + ResponseShellCallOutputContentDeltaStreamingEvent: + properties: + type: type: string - region: + enum: + - response.shell_call_output_content.delta + description: The type of the event, always `response.shell_call_output_content.delta`. + default: response.shell_call_output_content.delta + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + item_id: type: string + description: The ID of the output item that was updated. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that produced output. + delta: + $ref: '#/components/schemas/ShellCallOutputDelta' + description: The stdout/stderr delta that was emitted. + x-openai-go-skip-union-projection: true type: object required: - type - - tenant_id - - subscription_id - - resource_group - - account_name - - container - - region - GcpExternalStorageProviderResponse: + - sequence_number + - item_id + - output_index + - command_index + - delta + title: Response shell call output content delta event + description: A streaming event that indicated shell call output was incrementally added. + ResponseShellCallOutputContentDoneStreamingEvent: properties: type: type: string enum: - - gcp - default: gcp + - response.shell_call_output_content.done + description: The type of the event, always `response.shell_call_output_content.done`. + default: response.shell_call_output_content.done x-stainless-const: true - bucket: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + item_id: type: string - workload_identity_project_number: + description: The ID of the output item that was updated. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that produced output. + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContent' + type: array + description: The output contents emitted for the shell command. + type: object + required: + - type + - sequence_number + - item_id + - output_index + - command_index + - output + title: Response shell call output content done event + description: A streaming event that indicated shell call output was completed. + CreateConversationBody: + properties: + metadata: + anyOf: + - $ref: '#/components/schemas/Metadata' + description: |- + Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + - type: 'null' + items: + anyOf: + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 20 + description: Initial items to include in the conversation context. You may add up to 20 items at a time. + - type: 'null' + type: object + required: [] + UpdateConversationBody: + properties: + metadata: + $ref: '#/components/schemas/Metadata' + description: |- + Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + type: object + required: + - metadata + DeletedConversationResource: + properties: + object: type: string - workload_identity_pool_id: + enum: + - conversation.deleted + default: conversation.deleted + x-stainless-const: true + deleted: + type: boolean + id: type: string - workload_identity_provider_id: + type: object + required: + - object + - deleted + - id + SafetyCaseNoticeType: + type: string + enum: + - warning + - deactivation + SafetyCaseNotice: + properties: + type: + $ref: '#/components/schemas/SafetyCaseNoticeType' + type: object + required: + - type + SafetyCaseResource: + properties: + id: type: string - region: + object: type: string - audience: + enum: + - safety.case + default: safety.case + x-stainless-const: true + created_at: + type: integer + format: unixtime + entity_identifier: type: string + reason: + anyOf: + - type: string + - type: 'null' + notice: + $ref: '#/components/schemas/SafetyCaseNotice' type: object required: - - type - - bucket - - workload_identity_project_number - - workload_identity_pool_id - - workload_identity_provider_id - - region - - audience - OciExternalStorageProviderResponse: + - id + - object + - created_at + - entity_identifier + - reason + - notice + SafetyAlertErrorType: + type: string + enum: + - potentially_unintended_data_transfer + - potentially_unintended_data_access + - potentially_unintended_destructive_activity + - other + SafetyAlertResource: properties: - type: + id: + type: string + object: type: string enum: - - oci - default: oci + - safety.alert + default: safety.alert x-stainless-const: true - tenancy_ocid: + created_at: + type: integer + format: unixtime + request_id: type: string - region: + response_id: type: string - bucket: + model: type: string + request_paused: + type: boolean + description: Whether block registration succeeded for this request. This does not confirm that response execution stopped. + error_type: + $ref: '#/components/schemas/SafetyAlertErrorType' + reason: + anyOf: + - type: string + description: A customer-safe description derived from error_type, or null for zero data retention requests. + - type: 'null' + detailed_explanation: + anyOf: + - type: string + description: A generated explanation, temporarily available for eligible zero data retention alerts. Omitted when unavailable. + - type: 'null' type: object required: - - type - - tenancy_ocid - - region - - bucket - provider: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/AwsExternalStorageProviderResponse' - - $ref: '#/components/schemas/AzureExternalStorageProviderResponse' - - $ref: '#/components/schemas/GcpExternalStorageProviderResponse' - - $ref: '#/components/schemas/OciExternalStorageProviderResponse' - PublicProjectResidency: + - id + - object + - created_at + - request_id + - response_id + - model + - request_paused + - error_type + - reason + DecisionsUsageBucketWidth: type: string enum: - - GLOBAL - - US_STORAGE_PROCESSING - - EU_STORAGE_PROCESSING - - JP_STORAGE - - JP_STORAGE_PROCESSING - - KR_STORAGE - - CA_STORAGE - - SG_STORAGE - - IN_STORAGE - - IN_STORAGE_PROCESSING - - AU_STORAGE - - AU_STORAGE_PROCESSING - - GB_STORAGE - - AE_STORAGE - - AE_STORAGE_PROCESSING - UpdateProjectApiKeyBody: - anyOf: - - required: - - scopes - - required: - - expires_in_seconds + - 1m + - 1h + - 1d + DecisionsUsageGroupBy: + type: string + enum: + - project_id + - user_id + - api_key_id + - model + - batch + - service_tier + - api_source + DecisionsUsageApiSource: + type: string + enum: + - agents_api + - unlabeled + DecisionsUsageResult: properties: - expires_in_seconds: + api_source: + anyOf: + - $ref: '#/components/schemas/DecisionsUsageApiSource' + description: When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null. + - type: 'null' + object: + type: string + enum: + - organization.usage.decisions.result + default: organization.usage.decisions.result + x-stainless-const: true + input_tokens: + type: integer + description: The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens. + input_cached_tokens: + anyOf: + - type: integer + description: The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. + - type: 'null' + input_cache_write_tokens: + anyOf: + - type: integer + description: The aggregated number of input tokens written to the cache across 30-minute and 12-hour retention periods. + - type: 'null' + input_cache_write_30m_tokens: + anyOf: + - type: integer + description: The aggregated number of input tokens written to the cache with a 30-minute retention period. + - type: 'null' + input_cache_write_12h_tokens: + anyOf: + - type: integer + description: The aggregated number of input tokens written to the cache with a 12-hour retention period. + - type: 'null' + input_uncached_tokens: + anyOf: + - type: integer + description: The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens. + - type: 'null' + output_tokens: + type: integer + description: The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. + input_text_tokens: + anyOf: + - type: integer + description: The aggregated number of uncached text input tokens used, excluding cache-write tokens. + - type: 'null' + output_text_tokens: + anyOf: + - type: integer + description: The aggregated number of text output tokens used. + - type: 'null' + input_cached_text_tokens: + anyOf: + - type: integer + description: The aggregated number of cached text input tokens used. + - type: 'null' + input_audio_tokens: + anyOf: + - type: integer + description: The aggregated number of uncached audio input tokens used. + - type: 'null' + input_cached_audio_tokens: + anyOf: + - type: integer + description: The aggregated number of cached audio input tokens used. + - type: 'null' + output_audio_tokens: + anyOf: + - type: integer + description: The aggregated number of audio output tokens used. + - type: 'null' + input_image_tokens: + anyOf: + - type: integer + description: The aggregated number of uncached image input tokens used. + - type: 'null' + input_cached_image_tokens: + anyOf: + - type: integer + description: The aggregated number of cached image input tokens used. + - type: 'null' + output_image_tokens: + anyOf: + - type: integer + description: The aggregated number of image output tokens used. + - type: 'null' + num_model_requests: type: integer - maximum: 31536000 - minimum: 1 - description: Number of seconds from this request until the API key expires. Must comply with the organization and project expiry policies. Expired keys cannot be updated. Retrying resets the expiry relative to the new request. Omit to keep the current expiration. - scopes: - items: - type: string - type: array - description: Replace the API key scope restrictions. Omit to leave scopes unchanged. An empty array removes key restrictions (All permissions), subject to the owner's effective permissions. Use ["api.all.read"] for read-only access. Scopes do not change the owner's roles or grant administrative permissions. - type: object - required: [] - SpecificProgrammaticToolCallingParam: - properties: - type: - type: string - enum: - - programmatic_tool_calling - description: The tool to call. Always `programmatic_tool_calling`. - default: programmatic_tool_calling - x-stainless-const: true + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' + batch: + anyOf: + - type: boolean + description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + - type: 'null' + service_tier: + anyOf: + - type: string + description: When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + - type: 'null' type: object required: - - type - SpecificApplyPatchParam: + - object + - input_tokens + - output_tokens + - num_model_requests + description: The aggregated Decisions API usage details of the specific time bucket. + DecisionsUsageBucket: properties: - type: + object: type: string enum: - - apply_patch - description: The tool to call. Always `apply_patch`. - default: apply_patch + - bucket + default: bucket x-stainless-const: true + start_time: + type: integer + end_time: + type: integer + results: + items: + $ref: '#/components/schemas/DecisionsUsageResult' + type: array type: object required: - - type - title: Specific apply patch tool choice - description: Forces the model to call the apply_patch tool when executing a tool call. - SpecificFunctionShellParam: + - object + - start_time + - end_time + - results + PublicDecisionsUsageResponseResource: properties: - type: + object: type: string enum: - - shell - description: The tool to call. Always `shell`. - default: shell + - page + default: page x-stainless-const: true - type: object - required: - - type - title: Specific shell tool choice - description: Forces the model to call the shell tool when a tool call is required. - CyberAccessProgramEnum: - type: string - enum: - - standard - - daybreak_blue - - daybreak_red - AccessProgramsParam: - properties: - cyber: - $ref: '#/components/schemas/CyberAccessProgramEnum' - description: The Cyber access program to use for this request. Supported values are `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves the program from the model's Cyber tier and your organization and project access, subject to model-specific eligibility restrictions. By default, models without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when authorized; otherwise they fall back to Standard unless the model requires Daybreak access. Red-tier models use Daybreak Red and require authorization. Requests that require unavailable Daybreak access return 403. An implicit Standard fallback is represented by null in the response's access_programs field, rather than an explicit Standard selection. - additionalProperties: false - type: object - required: [] - description: Domain-specific access programs to use for this request. - ResponsePromptCacheOptionsParam: - properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. - prewarm: + has_more: type: boolean - description: Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`. - comparison_response_id: + next_page: anyOf: - type: string - description: The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled. - example: resp_123 - type: 'null' - type: object - required: [] - title: Prompt cache options - description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. - ReasoningModeEnum: - anyOf: - - type: string - - type: string - enum: - - standard - - pro - ConversationParam-2: - properties: - id: - type: string - description: The unique ID of the conversation. - example: conv_123 + data: + items: + $ref: '#/components/schemas/DecisionsUsageBucket' + type: array type: object required: - - id - title: Conversation object - description: The conversation that this response belongs to. - ContextManagementParam: + - object + - has_more + - next_page + - data + DecisionsUsageErrorDetails: properties: - type: - type: string - description: The context management entry type. Currently only 'compaction' is supported. - compact_threshold: + code: anyOf: - - type: integer - minimum: 1000 - description: Token threshold at which compaction should be triggered for this entry. + - type: string - type: 'null' - type: object - required: - - type - AccessProgramsBody: - properties: - cyber: - $ref: '#/components/schemas/CyberAccessProgramEnum' - description: The effective Cyber access program used for this response. - type: object - required: - - cyber - PromptCacheOptions: - properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to each cache breakpoint. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Whether implicit prompt-cache breakpoints were enabled. - comparison_response_id: + message: + type: string + param: anyOf: - type: string - description: The response ID supplied as the prompt cache diagnostics comparison. - type: 'null' - type: object - required: - - ttl - - mode - title: Prompt cache options - description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. - CacheMissReasonTypeEnum: - type: string - enum: - - model_changed - - prompt_cache_key_changed - - tools_changed - - text_format_changed - - reasoning_effort_changed - - verbosity_changed - - context_compacted - - input_changed - - service_tier_changed - PromptCacheMissDiagnosticsBody: - properties: - type: - type: string - enum: - - cache_miss - default: cache_miss - x-stainless-const: true - reason: - $ref: '#/components/schemas/CacheMissReasonTypeEnum' - description: The reason prompt cache reuse did not occur. - cache_missed_tokens: - type: integer - description: The estimated number of input tokens affected after the first detected divergence. - comparison_reusable_tokens: - type: integer - description: The raw token count of the reusable prefix in the compared response. - type: object - required: - - type - - reason - - cache_missed_tokens - PromptCacheHitDiagnosticsBody: - properties: type: type: string - enum: - - cache_hit - default: cache_hit - x-stainless-const: true type: object required: + - code + - message + - param - type - PromptCacheComparisonResponseNotFoundDiagnosticsBody: + DecisionsUsageErrorResponse: properties: - type: - type: string - enum: - - comparison_response_not_found - default: comparison_response_not_found - x-stainless-const: true + error: + $ref: '#/components/schemas/DecisionsUsageErrorDetails' type: object required: - - type - PromptCacheUnavailableDiagnosticsBody: + - error + DecisionsUsagePermissionErrorResponse: properties: - type: - type: string - enum: - - unavailable - default: unavailable - x-stainless-const: true + error: + description: Details about the permission error. + anyOf: + - $ref: '#/components/schemas/DecisionsUsageErrorDetails' + - type: string + description: An explanation of the missing API permissions. type: object required: - - type - PromptCacheDiagnostics: - discriminator: - propertyName: type - description: Prompt cache diagnostics requested for this response. - anyOf: - - $ref: '#/components/schemas/PromptCacheMissDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheHitDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheUnavailableDiagnosticsBody' - ModerationErrorBody: + - error + ExternalStorageOrder: + type: string + enum: + - asc + - desc + ExternalStorageStatus: + type: string + enum: + - pending + - validated + - degraded + - unhealthy + ExternalStorageResponse: properties: - type: + object: type: string enum: - - error - description: The object type, which was always `error` for moderation failures. - default: error + - organization.external_storage + default: organization.external_storage x-stainless-const: true - code: + id: type: string - description: The error code. - message: + project_id: type: string - description: The error message. - type: object - required: - - type - - code - - message - title: Moderation error - description: An error produced while attempting moderation for the response input or output. - Moderation: - properties: - input: - discriminator: - propertyName: type - description: Moderation for the response input. - anyOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - output: + provider: discriminator: propertyName: type - description: Moderation for the response output. anyOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - type: object - required: - - input - - output - title: Moderation - description: Moderation results or errors for the response input and output. - ResponseConversation: - properties: - id: + - $ref: '#/components/schemas/AwsExternalStorageProviderResponse' + - $ref: '#/components/schemas/AzureExternalStorageProviderResponse' + - $ref: '#/components/schemas/GcpExternalStorageProviderResponse' + - $ref: '#/components/schemas/OciExternalStorageProviderResponse' + geography: type: string - description: The unique ID of the conversation that this response was associated with. + status: + $ref: '#/components/schemas/ExternalStorageStatus' + created_at: + type: integer + format: unixtime type: object required: + - object - id - title: Conversation - description: The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation. - ResponseCompactionCompactingStreamingEvent: + - project_id + - provider + - geography + - status + - created_at + ExternalStorageListResource: properties: - type: + object: type: string enum: - - response.compaction.compacting - description: The type of the event, always `response.compaction.compacting`. - default: response.compaction.compacting + - list + default: list x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the compaction output item. - item_id: - type: string - description: The ID of the compaction output item. + data: + items: + $ref: '#/components/schemas/ExternalStorageResponse' + type: array + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean type: object required: - - type - - sequence_number - - output_index - - item_id - title: Response compaction compacting event - description: Emitted when new summary content is sampled for a compaction trigger. Contains no summary content. - ResponseShellCallCommandAddedStreamingEvent: + - object + - data + - first_id + - last_id + - has_more + AwsExternalStorageProviderParams: properties: type: type: string enum: - - response.shell_call_command.added - description: The type of the event, always `response.shell_call_command.added`. - default: response.shell_call_command.added + - aws + default: aws x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that was added. - command: + bucket: + type: string + role_arn: type: string - description: The shell command that was added. type: object required: - type - - sequence_number - - output_index - - command_index - - command - title: Response shell command added event - description: A streaming event that indicated a shell command was added to a tool call. - ResponseShellCallCommandDeltaStreamingEvent: + - bucket + - role_arn + AzureExternalStorageProviderParams: properties: type: type: string enum: - - response.shell_call_command.delta - description: The type of the event, always `response.shell_call_command.delta`. - default: response.shell_call_command.delta + - azure + default: azure x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that was updated. - delta: + tenant_id: type: string - description: The shell command delta that was appended. - obfuscation: + subscription_id: type: string - description: An obfuscation string that was added to pad the event payload. - type: object - required: - - type - - sequence_number - - output_index - - command_index - - delta - title: Response shell command delta event - description: A streaming event that indicated a shell command was incrementally updated. - ResponseShellCallCommandDoneStreamingEvent: - properties: - type: + resource_group: type: string - enum: - - response.shell_call_command.done - description: The type of the event, always `response.shell_call_command.done`. - default: response.shell_call_command.done - x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that was completed. - command: + account_name: + type: string + container: type: string - description: The final shell command that was emitted. type: object required: - type - - sequence_number - - output_index - - command_index - - command - title: Response shell command done event - description: A streaming event that indicated a shell command was completed. - ShellCallOutputDelta: - properties: - stdout: - type: string - description: The stdout delta that was emitted. - stderr: - type: string - description: The stderr delta that was emitted. - type: object - required: [] - title: Shell call output delta - description: A delta of stdout/stderr emitted while a shell call was running. - ResponseShellCallOutputContentDeltaStreamingEvent: + - tenant_id + - subscription_id + - resource_group + - account_name + - container + GcpExternalStorageProviderParams: properties: type: type: string enum: - - response.shell_call_output_content.delta - description: The type of the event, always `response.shell_call_output_content.delta`. - default: response.shell_call_output_content.delta + - gcp + default: gcp x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - item_id: + bucket: + type: string + workload_identity_project_number: + type: string + workload_identity_pool_id: + type: string + workload_identity_provider_id: type: string - description: The ID of the output item that was updated. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that produced output. - delta: - $ref: '#/components/schemas/ShellCallOutputDelta' - description: The stdout/stderr delta that was emitted. type: object required: - type - - sequence_number - - item_id - - output_index - - command_index - - delta - title: Response shell call output content delta event - description: A streaming event that indicated shell call output was incrementally added. - ResponseShellCallOutputContentDoneStreamingEvent: + - bucket + - workload_identity_project_number + - workload_identity_pool_id + - workload_identity_provider_id + OciExternalStorageProviderParams: properties: type: type: string enum: - - response.shell_call_output_content.done - description: The type of the event, always `response.shell_call_output_content.done`. - default: response.shell_call_output_content.done + - oci + default: oci x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - item_id: + tenancy_ocid: + type: string + region: + type: string + bucket: type: string - description: The ID of the output item that was updated. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that produced output. - output: - items: - $ref: '#/components/schemas/FunctionShellCallOutputContent' - type: array - description: The output contents emitted for the shell command. type: object required: - type - - sequence_number - - item_id - - output_index - - command_index - - output - title: Response shell call output content done event - description: A streaming event that indicated shell call output was completed. - CreateConversationBody: + - tenancy_ocid + - region + - bucket + CreateExternalStorageBody: properties: - metadata: - anyOf: - - $ref: '#/components/schemas/Metadata' - description: |- - Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. - - type: 'null' - items: + project_id: + type: string + example: proj_123 + provider: + discriminator: + propertyName: type anyOf: - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 20 - description: Initial items to include in the conversation context. You may add up to 20 items at a time. - - type: 'null' - type: object - required: [] - UpdateConversationBody: - properties: - metadata: - $ref: '#/components/schemas/Metadata' - description: |- - Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + - $ref: '#/components/schemas/AwsExternalStorageProviderParams' + - $ref: '#/components/schemas/AzureExternalStorageProviderParams' + - $ref: '#/components/schemas/GcpExternalStorageProviderParams' + - $ref: '#/components/schemas/OciExternalStorageProviderParams' type: object required: - - metadata - DeletedConversationResource: + - project_id + - provider + ExternalStorageDeletedResource: properties: object: type: string enum: - - conversation.deleted - default: conversation.deleted + - organization.external_storage.deleted + default: organization.external_storage.deleted x-stainless-const: true - deleted: - type: boolean id: type: string + deleted: + type: boolean type: object required: - object - - deleted - id - SafetyCaseNoticeType: - type: string - enum: - - warning - - deactivation - SafetyCaseNotice: + - deleted + SpendLimitCurrency: + anyOf: + - type: string + - type: string + enum: + - USD + SpendLimitInterval: + anyOf: + - type: string + - type: string + enum: + - month + SpendLimitEnforcementStatus: + anyOf: + - type: string + - type: string + enum: + - inactive + - enforcing + SpendLimitEnforcement: properties: - type: - $ref: '#/components/schemas/SafetyCaseNoticeType' + status: + $ref: '#/components/schemas/SpendLimitEnforcementStatus' + description: Whether the hard spend limit is currently enforcing. type: object required: - - type - SafetyCaseResource: + - status + description: The current enforcement state of a hard spend limit. + OrganizationSpendLimitResource: properties: - id: - type: string object: type: string enum: - - safety.case - default: safety.case + - organization.spend_limit + description: The object type, which is always `organization.spend_limit`. + default: organization.spend_limit x-stainless-const: true - created_at: + threshold_amount: type: integer - format: unixtime - entity_identifier: - type: string - reason: - anyOf: - - type: string - - type: 'null' - notice: - $ref: '#/components/schemas/SafetyCaseNotice' + description: The hard spend limit amount, in cents. + currency: + $ref: '#/components/schemas/SpendLimitCurrency' + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: + $ref: '#/components/schemas/SpendLimitInterval' + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + enforcement: + $ref: '#/components/schemas/SpendLimitEnforcement' + description: The current enforcement state of the hard spend limit. type: object required: - - id - object - - created_at - - entity_identifier - - reason - - notice - SafetyAlertErrorType: - type: string - enum: - - potentially_unintended_data_transfer - - potentially_unintended_data_access - - potentially_unintended_destructive_activity - - other - SafetyAlertResource: + - threshold_amount + - currency + - interval + - enforcement + description: Represents a hard spend limit configured at the organization level. + UpdateOrganizationSpendLimitBody: properties: - id: + threshold_amount: + type: integer + minimum: 1 + description: The hard spend limit amount, in cents. + currency: + type: string + enum: + - USD + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: type: string + enum: + - month + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + type: object + required: + - threshold_amount + - currency + - interval + description: Parameters for the hard spend limit you want to create or replace. + OrganizationSpendLimitDeletedResource: + properties: object: type: string enum: - - safety.alert - default: safety.alert + - organization.spend_limit.deleted + description: The object type, which is always `organization.spend_limit.deleted`. + default: organization.spend_limit.deleted x-stainless-const: true - created_at: + deleted: + type: boolean + description: Whether the hard spend limit was deleted. + type: object + required: + - object + - deleted + description: Confirmation payload returned after deleting an organization hard spend limit. + ProjectSpendLimitResource: + properties: + object: + type: string + enum: + - project.spend_limit + description: The object type, which is always `project.spend_limit`. + default: project.spend_limit + x-stainless-const: true + threshold_amount: type: integer - format: unixtime - request_id: + description: The hard spend limit amount, in cents. + currency: + $ref: '#/components/schemas/SpendLimitCurrency' + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: + $ref: '#/components/schemas/SpendLimitInterval' + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + enforcement: + $ref: '#/components/schemas/SpendLimitEnforcement' + description: The current enforcement state of the hard spend limit. + type: object + required: + - object + - threshold_amount + - currency + - interval + - enforcement + description: Represents a hard spend limit configured at the project level. + UpdateProjectSpendLimitBody: + properties: + threshold_amount: + type: integer + minimum: 1 + description: The hard spend limit amount, in cents. + currency: type: string - response_id: + enum: + - USD + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: type: string - model: + enum: + - month + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + type: object + required: + - threshold_amount + - currency + - interval + description: Parameters for the hard spend limit you want to create or replace. + ProjectSpendLimitDeletedResource: + properties: + object: type: string - request_paused: + enum: + - project.spend_limit.deleted + description: The object type, which is always `project.spend_limit.deleted`. + default: project.spend_limit.deleted + x-stainless-const: true + deleted: type: boolean - description: Whether block registration succeeded for this request. This does not confirm that response execution stopped. - error_type: - $ref: '#/components/schemas/SafetyAlertErrorType' - reason: + description: Whether the hard spend limit was deleted. + type: object + required: + - object + - deleted + description: Confirmation payload returned after deleting a project hard spend limit. + CreateProjectServiceAccountApiKeyBody: + properties: + name: + type: string + description: API key name. + scopes: + items: + type: string + description: API key scope. + type: array + description: API key scopes. + expires_in_seconds: anyOf: - - type: string - description: A customer-safe description derived from error_type, or null for zero data retention requests. + - type: integer + maximum: 31536000 + minimum: 1 + description: Number of seconds until the API key expires. - type: 'null' - detailed_explanation: + type: object + required: [] + description: The service account API key create request payload. + ServiceAccountApiKeyBody: + properties: + object: + type: string + enum: + - organization.project.service_account.api_key + description: The object type, which is always `organization.project.service_account.api_key` + default: organization.project.service_account.api_key + x-stainless-const: true + value: + type: string + description: The unredacted API key value. + name: + type: string + description: The name of the API key. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) when the API key was created. + expires_at: anyOf: - - type: string - description: A generated explanation, temporarily available for eligible zero data retention alerts. Omitted when unavailable. + - type: integer + format: unixtime + description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. - type: 'null' + id: + type: string + description: The identifier of the API key. type: object required: - - id - object + - value + - name - created_at - - request_id - - response_id - - model - - request_paused - - error_type - - reason - DecisionsUsageBucketWidth: + - id + CreateContentProvenanceBody: + properties: + file: + type: string + format: binary + description: The image or audio file to check for supported OpenAI provenance signals. + type: object + required: + - file + ProvenanceCheckObject: type: string enum: - - 1m - - 1h - - 1d - DecisionsUsageGroupBy: + - content_provenance_check + ProvenanceDetectionResultApi: type: string enum: - - project_id - - user_id - - api_key_id - - model - - batch - - service_tier - - api_source - DecisionsUsageApiSource: + - detected + - not_detected + C2PAValidationStateApi: type: string enum: - - agents_api - - unlabeled - DecisionsUsageResult: + - trusted + - valid + - invalid + - not_present + C2PAProvenanceResult: properties: - api_source: - anyOf: - - $ref: '#/components/schemas/DecisionsUsageApiSource' - description: When grouped by `api_source`, `agents_api` identifies attributed Agents API activity and `unlabeled` includes all records without published source attribution, including historical and unknown origins. Unlabeled does not imply direct API usage. Without source grouping, this field is null. - - type: 'null' - object: + type: type: string enum: - - organization.usage.decisions.result - default: organization.usage.decisions.result + - c2pa + description: The provenance signal type. Always `c2pa`. + default: c2pa x-stainless-const: true - input_tokens: - type: integer - description: The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens. - input_cached_tokens: - anyOf: - - type: integer - description: The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. - - type: 'null' - input_cache_write_tokens: - anyOf: - - type: integer - description: The aggregated number of input tokens written to the cache across 30-minute and 12-hour retention periods. - - type: 'null' - input_cache_write_30m_tokens: - anyOf: - - type: integer - description: The aggregated number of input tokens written to the cache with a 30-minute retention period. - - type: 'null' - input_cache_write_12h_tokens: - anyOf: - - type: integer - description: The aggregated number of input tokens written to the cache with a 12-hour retention period. - - type: 'null' - input_uncached_tokens: - anyOf: - - type: integer - description: The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens. - - type: 'null' - output_tokens: - type: integer - description: The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. - input_text_tokens: - anyOf: - - type: integer - description: The aggregated number of uncached text input tokens used, excluding cache-write tokens. - - type: 'null' - output_text_tokens: - anyOf: - - type: integer - description: The aggregated number of text output tokens used. - - type: 'null' - input_cached_text_tokens: - anyOf: - - type: integer - description: The aggregated number of cached text input tokens used. - - type: 'null' - input_audio_tokens: - anyOf: - - type: integer - description: The aggregated number of uncached audio input tokens used. - - type: 'null' - input_cached_audio_tokens: - anyOf: - - type: integer - description: The aggregated number of cached audio input tokens used. - - type: 'null' - output_audio_tokens: - anyOf: - - type: integer - description: The aggregated number of audio output tokens used. - - type: 'null' - input_image_tokens: - anyOf: - - type: integer - description: The aggregated number of uncached image input tokens used. - - type: 'null' - input_cached_image_tokens: - anyOf: - - type: integer - description: The aggregated number of cached image input tokens used. - - type: 'null' - output_image_tokens: - anyOf: - - type: integer - description: The aggregated number of image output tokens used. - - type: 'null' - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: + outcome: + $ref: '#/components/schemas/ProvenanceDetectionResultApi' + description: |- + Whether a supported OpenAI C2PA provenance signal was detected. + If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. + validation_state: + $ref: '#/components/schemas/C2PAValidationStateApi' + description: The validation status of the C2PA manifest in the uploaded image. + issuer: anyOf: - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + description: The C2PA manifest issuer, when available. - type: 'null' - user_id: + model: anyOf: - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + description: The OpenAI model recorded by the provenance signal, when available. - type: 'null' - api_key_id: + generated_at: anyOf: - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. - type: 'null' + type: object + required: + - type + - outcome + - validation_state + - issuer + - model + - generated_at + SynthIDProvenanceResult: + properties: + type: + type: string + enum: + - synthid + description: The provenance signal type. Always `synthid`. + default: synthid + x-stainless-const: true + outcome: + $ref: '#/components/schemas/ProvenanceDetectionResultApi' + description: |- + Whether a supported OpenAI SynthID watermark was detected. + If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. model: anyOf: - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. - - type: 'null' - batch: - anyOf: - - type: boolean - description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + description: The OpenAI model recorded by the provenance signal, when available. - type: 'null' - service_tier: + generated_at: anyOf: - type: string - description: When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. - type: 'null' type: object required: - - object - - input_tokens - - output_tokens - - num_model_requests - description: The aggregated Decisions API usage details of the specific time bucket. - DecisionsUsageBucket: + - type + - outcome + - model + - generated_at + ProvenanceResource: properties: object: - type: string - enum: - - bucket - default: bucket - x-stainless-const: true - start_time: - type: integer - end_time: + $ref: '#/components/schemas/ProvenanceCheckObject' + description: The object type. Always `content_provenance_check` for this endpoint. + created_at: type: integer + format: unixtime + description: The Unix timestamp, in seconds, when the provenance check was created. results: items: - $ref: '#/components/schemas/DecisionsUsageResult' + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/C2PAProvenanceResult' + - $ref: '#/components/schemas/SynthIDProvenanceResult' type: array + description: The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID. type: object required: - object - - start_time - - end_time + - created_at - results - PublicDecisionsUsageResponseResource: - properties: - object: - type: string - enum: - - page - default: page - x-stainless-const: true - has_more: - type: boolean - next_page: - anyOf: - - type: string - - type: 'null' - data: - items: - $ref: '#/components/schemas/DecisionsUsageBucket' - type: array - type: object - required: - - object - - has_more - - next_page - - data - DecisionsUsageErrorDetails: + OrderEnum: + type: string + enum: + - asc + - desc + VideoModel: + anyOf: + - type: string + - type: string + enum: + - sora-2 + - sora-2-pro + - sora-2-2025-10-06 + - sora-2-pro-2025-10-06 + - sora-2-2025-12-08 + VideoStatus: + type: string + enum: + - queued + - in_progress + - completed + - failed + VideoSize: + type: string + enum: + - 720x1280 + - 1280x720 + - 1024x1792 + - 1792x1024 + Error-2: properties: code: + type: string + description: A machine-readable error code that was returned. + type: anyOf: - type: string + description: The original error type, or null if it was not recorded. - type: 'null' - message: - type: string param: anyOf: - type: string + description: The request parameter associated with the error, or null if none was recorded. - type: 'null' - type: + message: type: string + description: A human-readable description of the error that was returned. + headers: + additionalProperties: + type: string + description: The retry header value. + type: object + description: The Retry-After and Retry-After-Ms headers returned with the original error, if any. + x-oaiTypeLabel: map + misalignment: + $ref: '#/components/schemas/MisalignmentErrorDetailsResource' type: object required: - code - message - - param - - type - DecisionsUsageErrorResponse: - properties: - error: - $ref: '#/components/schemas/DecisionsUsageErrorDetails' - type: object - required: - - error - DecisionsUsagePermissionErrorResponse: - properties: - error: - description: Details about the permission error. - anyOf: - - $ref: '#/components/schemas/DecisionsUsageErrorDetails' - - type: string - description: An explanation of the missing API permissions. - type: object - required: - - error - ExternalStorageOrder: - type: string - enum: - - asc - - desc - ExternalStorageStatus: - type: string - enum: - - pending - - validated - - degraded - - unhealthy - ExternalStorageResponse: + title: Error + description: An error that occurred while generating the response. + VideoResource: properties: + id: + type: string + description: Unique identifier for the video job. object: type: string enum: - - organization.external_storage - default: organization.external_storage + - video + description: The object type, which is always `video`. + default: video x-stainless-const: true - id: - type: string - project_id: - type: string - provider: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/AwsExternalStorageProviderResponse' - - $ref: '#/components/schemas/AzureExternalStorageProviderResponse' - - $ref: '#/components/schemas/GcpExternalStorageProviderResponse' - - $ref: '#/components/schemas/OciExternalStorageProviderResponse' - geography: - type: string + model: + $ref: '#/components/schemas/VideoModel' + description: The video generation model that produced the job. status: - $ref: '#/components/schemas/ExternalStorageStatus' + $ref: '#/components/schemas/VideoStatus' + description: Current lifecycle status of the video job. + progress: + type: integer + description: Approximate completion percentage for the generation task. created_at: type: integer format: unixtime + description: Unix timestamp (seconds) for when the job was created. + completed_at: + anyOf: + - type: integer + format: unixtime + description: Unix timestamp (seconds) for when the job completed, if finished. + - type: 'null' + expires_at: + anyOf: + - type: integer + format: unixtime + description: Unix timestamp (seconds) for when the downloadable assets expire, if set. + - type: 'null' + prompt: + anyOf: + - type: string + description: The prompt that was used to generate the video. + - type: 'null' + size: + $ref: '#/components/schemas/VideoSize' + description: The resolution of the generated video. + seconds: + anyOf: + - type: string + - $ref: '#/components/schemas/VideoSeconds' + description: Duration of the generated clip in seconds. For extensions, this is the stitched total duration. + remixed_from_video_id: + anyOf: + - type: string + description: Identifier of the source video if this video is a remix. + - type: 'null' + error: + anyOf: + - $ref: '#/components/schemas/Error-2' + description: Error payload that explains why generation failed, if applicable. + - type: 'null' type: object required: - - object - id - - project_id - - provider - - geography + - object + - model - status + - progress - created_at - ExternalStorageListResource: + - completed_at + - expires_at + - prompt + - size + - seconds + - remixed_from_video_id + - error + title: Video job + description: Structured information describing a generated video job. + VideoListResource: properties: object: - type: string - enum: - - list - default: list x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list data: items: - $ref: '#/components/schemas/ExternalStorageResponse' + $ref: '#/components/schemas/VideoResource' type: array + description: A list of items first_id: anyOf: - type: string + description: The ID of the first item in the list. - type: 'null' last_id: anyOf: - type: string + description: The ID of the last item in the list. - type: 'null' has_more: type: boolean + description: Whether there are more items available. type: object required: - object @@ -79807,604 +81310,632 @@ components: - first_id - last_id - has_more - AwsExternalStorageProviderParams: + ImageRefParam-2: properties: - type: - type: string - enum: - - aws - default: aws - x-stainless-const: true - bucket: + image_url: type: string - role_arn: + maxLength: 20971520 + format: uri + description: A fully qualified URL or base64-encoded data URL. + file_id: type: string + example: file-123 type: object - required: - - type - - bucket - - role_arn - AzureExternalStorageProviderParams: + required: [] + VideoSeconds: + type: string + enum: + - '4' + - '8' + - '12' + CreateVideoMultipartBody: properties: - type: - type: string - enum: - - azure - default: azure - x-stainless-const: true - tenant_id: - type: string - subscription_id: - type: string - resource_group: - type: string - account_name: - type: string - container: + model: + $ref: '#/components/schemas/VideoModel' + description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' + prompt: type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes the video to generate. + input_reference: + anyOf: + - type: string + format: binary + description: Optional reference asset upload or reference object that guides generation. + - $ref: '#/components/schemas/ImageRefParam-2' + description: Optional reference asset upload or reference object that guides generation. Provide exactly one of `image_url` or `file_id` when using an object. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' + size: + $ref: '#/components/schemas/VideoSize' + description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' type: object required: - - type - - tenant_id - - subscription_id - - resource_group - - account_name - - container - GcpExternalStorageProviderParams: + - prompt + title: Create video multipart request + description: Multipart parameters for creating a new video generation job. + CreateVideoJsonBody: properties: - type: - type: string - enum: - - gcp - default: gcp - x-stainless-const: true - bucket: - type: string - workload_identity_project_number: - type: string - workload_identity_pool_id: - type: string - workload_identity_provider_id: + model: + $ref: '#/components/schemas/VideoModel' + description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' + prompt: type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes the video to generate. + input_reference: + $ref: '#/components/schemas/ImageRefParam-2' + description: Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' + size: + $ref: '#/components/schemas/VideoSize' + description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' type: object required: - - type - - bucket - - workload_identity_project_number - - workload_identity_pool_id - - workload_identity_provider_id - OciExternalStorageProviderParams: + - prompt + title: Create video JSON request + description: JSON parameters for creating a new video generation job. + CreateVideoCharacterBody: properties: - type: - type: string - enum: - - oci - default: oci - x-stainless-const: true - tenancy_ocid: - type: string - region: - type: string - bucket: + video: type: string - type: object - required: - - type - - tenancy_ocid - - region - - bucket - CreateExternalStorageBody: - properties: - project_id: + format: binary + description: Video file used to create a character. + name: type: string - example: proj_123 - provider: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/AwsExternalStorageProviderParams' - - $ref: '#/components/schemas/AzureExternalStorageProviderParams' - - $ref: '#/components/schemas/GcpExternalStorageProviderParams' - - $ref: '#/components/schemas/OciExternalStorageProviderParams' + maxLength: 80 + minLength: 1 + description: Display name for this API character. type: object required: - - project_id - - provider - ExternalStorageDeletedResource: + - video + - name + title: Create character request + description: Parameters for creating a character from an uploaded video. + VideoCharacterResource: properties: - object: - type: string - enum: - - organization.external_storage.deleted - default: organization.external_storage.deleted - x-stainless-const: true id: - type: string - deleted: - type: boolean - type: object - required: - - object - - id - - deleted - SpendLimitCurrency: - anyOf: - - type: string - - type: string - enum: - - USD - SpendLimitInterval: - anyOf: - - type: string - - type: string - enum: - - month - SpendLimitEnforcementStatus: - anyOf: - - type: string - - type: string - enum: - - inactive - - enforcing - SpendLimitEnforcement: - properties: - status: - $ref: '#/components/schemas/SpendLimitEnforcementStatus' - description: Whether the hard spend limit is currently enforcing. - type: object - required: - - status - description: The current enforcement state of a hard spend limit. - OrganizationSpendLimitResource: - properties: - object: - type: string - enum: - - organization.spend_limit - description: The object type, which is always `organization.spend_limit`. - default: organization.spend_limit - x-stainless-const: true - threshold_amount: + anyOf: + - type: string + description: Identifier for the character creation cameo. + - type: 'null' + name: + anyOf: + - type: string + description: Display name for the character. + - type: 'null' + created_at: type: integer - description: The hard spend limit amount, in cents. - currency: - $ref: '#/components/schemas/SpendLimitCurrency' - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: - $ref: '#/components/schemas/SpendLimitInterval' - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. - enforcement: - $ref: '#/components/schemas/SpendLimitEnforcement' - description: The current enforcement state of the hard spend limit. + format: unixtime + description: Unix timestamp (in seconds) when the character was created. type: object required: - - object - - threshold_amount - - currency - - interval - - enforcement - description: Represents a hard spend limit configured at the organization level. - UpdateOrganizationSpendLimitBody: + - id + - name + - created_at + VideoReferenceInputParam: properties: - threshold_amount: - type: integer - minimum: 1 - description: The hard spend limit amount, in cents. - currency: - type: string - enum: - - USD - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: + id: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + description: The identifier of the completed video. + example: video_123 type: object required: - - threshold_amount - - currency - - interval - description: Parameters for the hard spend limit you want to create or replace. - OrganizationSpendLimitDeletedResource: + - id + description: Reference to the completed video. + CreateVideoEditMultipartBody: properties: - object: + video: + anyOf: + - type: string + format: binary + description: Reference to the completed video to edit. + - $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to edit. + prompt: type: string - enum: - - organization.spend_limit.deleted - description: The object type, which is always `organization.spend_limit.deleted`. - default: organization.spend_limit.deleted - x-stainless-const: true - deleted: - type: boolean - description: Whether the hard spend limit was deleted. + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. type: object required: - - object - - deleted - description: Confirmation payload returned after deleting an organization hard spend limit. - ProjectSpendLimitResource: + - video + - prompt + title: Create video edit multipart request + description: Parameters for editing an existing generated video. + CreateVideoEditJsonBody: properties: - object: + video: + $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to edit. + prompt: type: string - enum: - - project.spend_limit - description: The object type, which is always `project.spend_limit`. - default: project.spend_limit - x-stainless-const: true - threshold_amount: - type: integer - description: The hard spend limit amount, in cents. - currency: - $ref: '#/components/schemas/SpendLimitCurrency' - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: - $ref: '#/components/schemas/SpendLimitInterval' - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. - enforcement: - $ref: '#/components/schemas/SpendLimitEnforcement' - description: The current enforcement state of the hard spend limit. + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. type: object required: - - object - - threshold_amount - - currency - - interval - - enforcement - description: Represents a hard spend limit configured at the project level. - UpdateProjectSpendLimitBody: + - video + - prompt + title: Create video edit JSON request + description: JSON parameters for editing an existing generated video. + CreateVideoExtendMultipartBody: properties: - threshold_amount: - type: integer - minimum: 1 - description: The hard spend limit amount, in cents. - currency: + video: + oneOf: + - type: string + format: binary + description: Reference to the completed video to extend. + - $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to extend. + prompt: type: string - enum: - - USD - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the extension generation. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' + type: object + required: + - video + - prompt + - seconds + title: Create video extension multipart request + description: Multipart parameters for extending an existing generated video. + CreateVideoExtendJsonBody: + properties: + video: + $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to extend. + prompt: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the extension generation. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' type: object required: - - threshold_amount - - currency - - interval - description: Parameters for the hard spend limit you want to create or replace. - ProjectSpendLimitDeletedResource: + - video + - prompt + - seconds + title: Create video extension JSON request + description: JSON parameters for extending an existing generated video. + DeletedVideoResource: properties: object: type: string enum: - - project.spend_limit.deleted - description: The object type, which is always `project.spend_limit.deleted`. - default: project.spend_limit.deleted + - video.deleted + description: The object type that signals the deletion response. + default: video.deleted x-stainless-const: true deleted: type: boolean - description: Whether the hard spend limit was deleted. + description: Indicates that the video resource was deleted. + id: + type: string + description: Identifier of the deleted video. type: object required: - object - deleted - description: Confirmation payload returned after deleting a project hard spend limit. - CreateProjectServiceAccountApiKeyBody: + - id + title: Deleted video response + description: Confirmation payload returned after deleting a video. + VideoContentVariant: + type: string + enum: + - video + - thumbnail + - spritesheet + CreateVideoRemixBody: properties: - name: + prompt: type: string - description: API key name. - scopes: - items: - type: string - description: API key scope. - type: array - description: API key scopes. - expires_in_seconds: + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the remix generation. + type: object + required: + - prompt + title: Create video remix request + description: Parameters for remixing an existing generated video. + TruncationEnum: + type: string + enum: + - auto + - disabled + PersonalityEnum: + anyOf: + - type: string + - type: string + enum: + - friendly + - pragmatic + TokenCountsBody: + properties: + model: anyOf: - - type: integer - maximum: 31536000 - minimum: 1 - description: Number of seconds until the API key expires. + - type: string + description: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. + - type: 'null' + input: + anyOf: + - description: Text, image, or file inputs to the model, used to generate a response + anyOf: + - type: string + maxLength: 10485760 + description: A text input to the model, equivalent to a text input with the `user` role. + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 131072 + description: A list of one or many input items to the model, containing different content types. + - type: 'null' + previous_response_id: + anyOf: + - type: string + description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + example: resp_123 + - type: 'null' + tools: + anyOf: + - items: + $ref: '#/components/schemas/Tool' + type: array + description: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. + - type: 'null' + text: + anyOf: + - $ref: '#/components/schemas/ResponseTextParam' + - type: 'null' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + description: '**gpt-5 and o-series models only** Configuration options for [reasoning models](https://developers.openai.com/api/docs/guides/reasoning).' + - type: 'null' + truncation: + $ref: '#/components/schemas/TruncationEnum' + description: 'The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model''s context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.' + deprecated: true + instructions: + anyOf: + - type: string + description: |- + A system (or developer) message inserted into the model's context. + When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. + - type: 'null' + personality: + $ref: '#/components/schemas/PersonalityEnum' + description: A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters. + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + tool_choice: + anyOf: + - $ref: '#/components/schemas/ToolChoiceParam' + description: Controls which tool the model should use, if any. + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: Whether to allow the model to run tool calls in parallel. - type: 'null' type: object required: [] - description: The service account API key create request payload. - ServiceAccountApiKeyBody: + TokenCountsResource: properties: object: type: string enum: - - organization.project.service_account.api_key - description: The object type, which is always `organization.project.service_account.api_key` - default: organization.project.service_account.api_key + - response.input_tokens + default: response.input_tokens x-stainless-const: true - value: - type: string - description: The unredacted API key value. - name: - type: string - description: The name of the API key. - created_at: + input_tokens: type: integer - format: unixtime - description: The Unix timestamp (in seconds) when the API key was created. - expires_at: - anyOf: - - type: integer - format: unixtime - description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. - - type: 'null' - id: - type: string - description: The identifier of the API key. type: object required: - object - - value - - name - - created_at - - id - CreateContentProvenanceBody: - properties: - file: - type: string - format: binary - description: The image or audio file to check for supported OpenAI provenance signals. - type: object - required: - - file - ProvenanceCheckObject: - type: string - enum: - - content_provenance_check - ProvenanceDetectionResultApi: + - input_tokens + title: Token counts + example: + object: response.input_tokens + input_tokens: 123 + PromptCacheRetentionEnum: type: string enum: - - detected - - not_detected - C2PAValidationStateApi: + - in_memory + - 24h + ServiceTierEnum: type: string enum: - - trusted - - valid - - invalid - - not_present - C2PAProvenanceResult: + - auto + - default + - fast + - flex + - priority + CompactResponseMethodPublicBody: properties: - type: - type: string - enum: - - c2pa - description: The provenance signal type. Always `c2pa`. - default: c2pa - x-stainless-const: true - outcome: - $ref: '#/components/schemas/ProvenanceDetectionResultApi' - description: |- - Whether a supported OpenAI C2PA provenance signal was detected. - If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. - validation_state: - $ref: '#/components/schemas/C2PAValidationStateApi' - description: The validation status of the C2PA manifest in the uploaded image. - issuer: + model: + $ref: '#/components/schemas/ModelIdsCompaction' + input: anyOf: - - type: string - description: The C2PA manifest issuer, when available. + - description: Text, image, or file inputs to the model, used to generate a response + anyOf: + - type: string + maxLength: 10485760 + description: A text input to the model, equivalent to a text input with the `user` role. + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 131072 + description: A list of one or many input items to the model, containing different content types. - type: 'null' - model: + previous_response_id: anyOf: - type: string - description: The OpenAI model recorded by the provenance signal, when available. + description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + example: resp_123 - type: 'null' - generated_at: + instructions: anyOf: - type: string - description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. + description: |- + A system (or developer) message inserted into the model's context. + When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. - type: 'null' - type: object - required: - - type - - outcome - - validation_state - - issuer - - model - - generated_at - SynthIDProvenanceResult: - properties: - type: - type: string - enum: - - synthid - description: The provenance signal type. Always `synthid`. - default: synthid - x-stainless-const: true - outcome: - $ref: '#/components/schemas/ProvenanceDetectionResultApi' - description: |- - Whether a supported OpenAI SynthID watermark was detected. - If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. - model: + prompt_cache_key: anyOf: - type: string - description: The OpenAI model recorded by the provenance signal, when available. + maxLength: 64 + description: A key to use when reading from or writing to the prompt cache. - type: 'null' - generated_at: + prompt_cache_retention: anyOf: - - type: string - description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. + - $ref: '#/components/schemas/PromptCacheRetentionEnum' + description: How long to retain a prompt cache entry created by this request. + deprecated: true + - type: 'null' + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsParam' + - type: 'null' + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierEnum' + description: |- + Specifies the processing type used for serving the request. - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`. - When not set, the default behavior is 'auto'. + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. - type: 'null' type: object required: - - type - - outcome - model - - generated_at - ProvenanceResource: + ItemField: + discriminator: + propertyName: type + description: An item representing a message, tool call, tool output, reasoning, or other response element. + anyOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/FunctionToolCallOutput' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + deprecated: true + - $ref: '#/components/schemas/LocalShellToolCallOutput' + deprecated: true + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' + CompactResource: + properties: + id: + type: string + description: The unique identifier for the compacted response. + object: + type: string + enum: + - response.compaction + description: The object type. Always `response.compaction`. + default: response.compaction + x-stainless-const: true + output: + type: array + description: The compacted list of output items. This is a list of all user messages, followed by a single compaction item. + items: + $ref: '#/components/schemas/OutputItem' + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the compacted conversation was created. + usage: + $ref: '#/components/schemas/ResponseUsage' + description: Token accounting for the compaction pass, including cached, reasoning, and total tokens. + type: object + required: + - id + - object + - output + - created_at + - usage + title: The compacted response object + SkillResource: properties: + id: + type: string + description: Unique identifier for the skill. object: - $ref: '#/components/schemas/ProvenanceCheckObject' - description: The object type. Always `content_provenance_check` for this endpoint. + type: string + enum: + - skill + description: The object type, which is `skill`. + default: skill + x-stainless-const: true + name: + type: string + description: Name of the skill. + description: + type: string + description: Description of the skill. created_at: type: integer format: unixtime - description: The Unix timestamp, in seconds, when the provenance check was created. - results: - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/C2PAProvenanceResult' - - $ref: '#/components/schemas/SynthIDProvenanceResult' - type: array - description: The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID. + description: Unix timestamp (seconds) for when the skill was created. + default_version: + type: string + description: Default version for the skill. + latest_version: + type: string + description: Latest version for the skill. type: object required: + - id - object + - name + - description - created_at - - results - OrderEnum: - type: string - enum: - - asc - - desc - VideoModel: - anyOf: - - type: string - - type: string - enum: - - sora-2 - - sora-2-pro - - sora-2-2025-10-06 - - sora-2-pro-2025-10-06 - - sora-2-2025-12-08 - VideoStatus: - type: string - enum: - - queued - - in_progress - - completed - - failed - VideoSize: - type: string - enum: - - 720x1280 - - 1280x720 - - 1024x1792 - - 1792x1024 - Error-2: + - default_version + - latest_version + SkillListResource: properties: - code: - type: string - description: A machine-readable error code that was returned. - type: + object: + x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list + data: + items: + $ref: '#/components/schemas/SkillResource' + type: array + description: A list of items + first_id: anyOf: - type: string - description: The original error type, or null if it was not recorded. + description: The ID of the first item in the list. - type: 'null' - param: + last_id: anyOf: - type: string - description: The request parameter associated with the error, or null if none was recorded. + description: The ID of the last item in the list. - type: 'null' - message: + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + CreateSkillBody: + properties: + files: + anyOf: + - items: + type: string + format: binary + type: array + maxItems: 500 + description: Skill files to upload (directory upload) or a single zip file. + - type: string + format: binary + description: Skill zip file to upload. + type: object + description: Uploads a skill either as a directory (multipart `files[]`) or as a single zip file. + title: Create skill request + SetDefaultSkillVersionBody: + properties: + default_version: type: string - description: A human-readable description of the error that was returned. - headers: - additionalProperties: - type: string - description: The retry header value. - type: object - description: The Retry-After and Retry-After-Ms headers returned with the original error, if any. - x-oaiTypeLabel: map - misalignment: - $ref: '#/components/schemas/MisalignmentErrorDetailsResource' + description: The skill version number to set as default. type: object required: - - code - - message - title: Error - description: An error that occurred while generating the response. - VideoResource: + - default_version + title: Update skill request + description: Updates the default version pointer for a skill. + DeletedSkillResource: properties: + object: + type: string + enum: + - skill.deleted + default: skill.deleted + x-stainless-const: true + deleted: + type: boolean id: type: string - description: Unique identifier for the video job. + type: object + required: + - object + - deleted + - id + SkillVersionResource: + properties: object: type: string enum: - - video - description: The object type, which is always `video`. - default: video + - skill.version + description: The object type, which is `skill.version`. + default: skill.version x-stainless-const: true - model: - $ref: '#/components/schemas/VideoModel' - description: The video generation model that produced the job. - status: - $ref: '#/components/schemas/VideoStatus' - description: Current lifecycle status of the video job. - progress: - type: integer - description: Approximate completion percentage for the generation task. + id: + type: string + description: Unique identifier for the skill version. + skill_id: + type: string + description: Identifier of the skill for this version. + version: + type: string + description: Version number for this skill. created_at: type: integer format: unixtime - description: Unix timestamp (seconds) for when the job was created. - completed_at: - anyOf: - - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the job completed, if finished. - - type: 'null' - expires_at: - anyOf: - - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the downloadable assets expire, if set. - - type: 'null' - prompt: - anyOf: - - type: string - description: The prompt that was used to generate the video. - - type: 'null' - size: - $ref: '#/components/schemas/VideoSize' - description: The resolution of the generated video. - seconds: - anyOf: - - type: string - - $ref: '#/components/schemas/VideoSeconds' - description: Duration of the generated clip in seconds. For extensions, this is the stitched total duration. - remixed_from_video_id: - anyOf: - - type: string - description: Identifier of the source video if this video is a remix. - - type: 'null' - error: - anyOf: - - $ref: '#/components/schemas/Error-2' - description: Error payload that explains why generation failed, if applicable. - - type: 'null' + description: Unix timestamp (seconds) for when the version was created. + name: + type: string + description: Name of the skill version. + description: + type: string + description: Description of the skill version. type: object required: - - id - object - - model - - status - - progress + - id + - skill_id + - version - created_at - - completed_at - - expires_at - - prompt - - size - - seconds - - remixed_from_video_id - - error - title: Video job - description: Structured information describing a generated video job. - VideoListResource: + - name + - description + SkillVersionListResource: properties: object: x-stainless-const: true @@ -80413,7 +81944,7 @@ components: const: list data: items: - $ref: '#/components/schemas/VideoResource' + $ref: '#/components/schemas/SkillVersionResource' type: array description: A list of items first_id: @@ -80436,2698 +81967,2775 @@ components: - first_id - last_id - has_more - ImageRefParam-2: + CreateSkillVersionBody: properties: - image_url: + files: + anyOf: + - items: + type: string + format: binary + type: array + maxItems: 500 + description: Skill files to upload (directory upload) or a single zip file. + - type: string + format: binary + description: Skill zip file to upload. + default: + type: boolean + description: Whether to set this version as the default. + type: object + description: Uploads a new immutable version of a skill. + title: Create skill version request + DeletedSkillVersionResource: + properties: + object: type: string - maxLength: 20971520 - format: uri - description: A fully qualified URL or base64-encoded data URL. - file_id: + enum: + - skill.version.deleted + default: skill.version.deleted + x-stainless-const: true + deleted: + type: boolean + id: type: string - example: file-123 + version: + type: string + description: The deleted skill version. type: object - required: [] - VideoSeconds: - type: string - enum: - - '4' - - '8' - - '12' - CreateVideoMultipartBody: + required: + - object + - deleted + - id + - version + ChatkitWorkflowTracing: properties: - model: - $ref: '#/components/schemas/VideoModel' - description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' - prompt: + enabled: + type: boolean + description: Indicates whether tracing is enabled. + type: object + required: + - enabled + title: Tracing Configuration + description: Controls diagnostic tracing during the session. + ChatkitWorkflow: + properties: + id: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes the video to generate. - input_reference: + description: Identifier of the workflow backing the session. + version: anyOf: - type: string - format: binary - description: Optional reference asset upload or reference object that guides generation. - - $ref: '#/components/schemas/ImageRefParam-2' - description: Optional reference asset upload or reference object that guides generation. Provide exactly one of `image_url` or `file_id` when using an object. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' - size: - $ref: '#/components/schemas/VideoSize' - description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' + description: Specific workflow version used for the session. Defaults to null when using the latest deployment. + - type: 'null' + state_variables: + anyOf: + - additionalProperties: + anyOf: + - type: string + - type: integer + - type: boolean + - type: number + type: object + description: State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided. + x-oaiTypeLabel: map + - type: 'null' + tracing: + $ref: '#/components/schemas/ChatkitWorkflowTracing' + description: Tracing settings applied to the workflow. + type: object + required: + - id + - version + - state_variables + - tracing + title: Workflow + description: Workflow metadata and state returned for the session. + ChatSessionRateLimits: + properties: + max_requests_per_1_minute: + type: integer + description: Maximum allowed requests per one-minute window. + type: object + required: + - max_requests_per_1_minute + title: Rate limits + description: Active per-minute request limit for the session. + ChatSessionStatus: + type: string + enum: + - active + - expired + - cancelled + ChatSessionAutomaticThreadTitling: + properties: + enabled: + type: boolean + description: Whether automatic thread titling is enabled. + type: object + required: + - enabled + title: Automatic thread titling + description: Automatic thread title preferences for the session. + ChatSessionFileUpload: + properties: + enabled: + type: boolean + description: Indicates if uploads are enabled for the session. + max_file_size: + anyOf: + - type: integer + description: Maximum upload size in megabytes. + - type: 'null' + max_files: + anyOf: + - type: integer + description: Maximum number of uploads allowed during the session. + - type: 'null' + type: object + required: + - enabled + - max_file_size + - max_files + title: File upload settings + description: Upload permissions and limits applied to the session. + ChatSessionHistory: + properties: + enabled: + type: boolean + description: Indicates if chat history is persisted for the session. + recent_threads: + anyOf: + - type: integer + description: Number of prior threads surfaced in history views. Defaults to null when all history is retained. + - type: 'null' + type: object + required: + - enabled + - recent_threads + title: History settings + description: History retention preferences returned for the session. + ChatSessionChatkitConfiguration: + properties: + automatic_thread_titling: + $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' + description: Automatic thread titling preferences. + file_upload: + $ref: '#/components/schemas/ChatSessionFileUpload' + description: Upload settings for the session. + history: + $ref: '#/components/schemas/ChatSessionHistory' + description: History retention configuration. + type: object + required: + - automatic_thread_titling + - file_upload + - history + title: ChatKit configuration + description: ChatKit configuration for the session. + ChatSessionResource: + properties: + id: + type: string + description: Identifier for the ChatKit session. + object: + type: string + enum: + - chatkit.session + description: Type discriminator that is always `chatkit.session`. + default: chatkit.session + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the session expires. + client_secret: + type: string + description: Ephemeral client secret that authenticates session requests. + workflow: + $ref: '#/components/schemas/ChatkitWorkflow' + description: Workflow metadata for the session. + user: + type: string + description: User identifier associated with the session. + rate_limits: + $ref: '#/components/schemas/ChatSessionRateLimits' + description: Resolved rate limit values. + max_requests_per_1_minute: + type: integer + description: Convenience copy of the per-minute request limit. + status: + $ref: '#/components/schemas/ChatSessionStatus' + description: Current lifecycle state of the session. + chatkit_configuration: + $ref: '#/components/schemas/ChatSessionChatkitConfiguration' + description: Resolved ChatKit feature configuration for the session. + type: object + required: + - id + - object + - expires_at + - client_secret + - workflow + - user + - rate_limits + - max_requests_per_1_minute + - status + - chatkit_configuration + title: The chat session object + description: Represents a ChatKit session and its resolved configuration. + example: + id: cksess_123 + object: chatkit.session + client_secret: ek_token_123 + expires_at: 1712349876 + workflow: + id: workflow_alpha + version: 2024-10-01 + state_variables: + message: hello + tracing: + enabled: true + user: user_789 + rate_limits: + max_requests_per_1_minute: 60 + max_requests_per_1_minute: 60 + status: active + chatkit_configuration: + automatic_thread_titling: + enabled: true + file_upload: + enabled: true + max_file_size: 16 + max_files: 20 + history: + enabled: true + recent_threads: 10 + WorkflowTracingParam: + properties: + enabled: + type: boolean + description: Whether tracing is enabled during the session. Defaults to true. type: object - required: - - prompt - title: Create video multipart request - description: Multipart parameters for creating a new video generation job. - CreateVideoJsonBody: + required: [] + title: Tracing Configuration + description: Controls diagnostic tracing during the session. + WorkflowParam: properties: - model: - $ref: '#/components/schemas/VideoModel' - description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' - prompt: + id: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes the video to generate. - input_reference: - $ref: '#/components/schemas/ImageRefParam-2' - description: Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' - size: - $ref: '#/components/schemas/VideoSize' - description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' + description: Identifier for the workflow invoked by the session. + version: + type: string + description: Specific workflow version to run. Defaults to the latest deployed version. + state_variables: + additionalProperties: + anyOf: + - type: string + maxLength: 10485760 + - type: integer + - type: boolean + - type: number + type: object + maxProperties: 64 + description: State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object. + x-oaiTypeLabel: map + tracing: + $ref: '#/components/schemas/WorkflowTracingParam' + description: Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default. type: object required: - - prompt - title: Create video JSON request - description: JSON parameters for creating a new video generation job. - CreateVideoCharacterBody: + - id + title: Workflow settings + description: Workflow reference and overrides applied to the chat session. + ExpiresAfterParam: properties: - video: - type: string - format: binary - description: Video file used to create a character. - name: + anchor: type: string - maxLength: 80 - minLength: 1 - description: Display name for this API character. + enum: + - created_at + description: Base timestamp used to calculate expiration. Currently fixed to `created_at`. + default: created_at + x-stainless-const: true + seconds: + type: integer + maximum: 600 + minimum: 1 + format: int64 + description: Number of seconds after the anchor when the session expires. type: object required: - - video - - name - title: Create character request - description: Parameters for creating a character from an uploaded video. - VideoCharacterResource: + - anchor + - seconds + title: Expiration overrides + description: Controls when the session expires relative to an anchor timestamp. + RateLimitsParam: properties: - id: - anyOf: - - type: string - description: Identifier for the character creation cameo. - - type: 'null' - name: - anyOf: - - type: string - description: Display name for the character. - - type: 'null' - created_at: + max_requests_per_1_minute: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the character was created. + minimum: 1 + description: Maximum number of requests allowed per minute for the session. Defaults to 10. type: object - required: - - id - - name - - created_at - VideoReferenceInputParam: + required: [] + title: Rate limit overrides + description: Controls request rate limits for the session. + AutomaticThreadTitlingParam: properties: - id: - type: string - description: The identifier of the completed video. - example: video_123 + enabled: + type: boolean + description: Enable automatic thread title generation. Defaults to true. type: object - required: - - id - description: Reference to the completed video. - CreateVideoEditMultipartBody: + required: [] + title: Automatic thread titling configuration + description: Controls whether ChatKit automatically generates thread titles. + FileUploadParam: properties: - video: - anyOf: - - type: string - format: binary - description: Reference to the completed video to edit. - - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to edit. - prompt: - type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes how to edit the source video. + enabled: + type: boolean + description: Enable uploads for this session. Defaults to false. + max_file_size: + type: integer + maximum: 512 + minimum: 1 + description: Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size. + max_files: + type: integer + minimum: 1 + description: Maximum number of files that can be uploaded to the session. Defaults to 10. type: object - required: - - video - - prompt - title: Create video edit multipart request - description: Parameters for editing an existing generated video. - CreateVideoEditJsonBody: + required: [] + title: File upload configuration + description: Controls whether users can upload files. + HistoryParam: properties: - video: - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to edit. - prompt: - type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes how to edit the source video. + enabled: + type: boolean + description: Enables chat users to access previous ChatKit threads. Defaults to true. + recent_threads: + type: integer + minimum: 1 + description: Number of recent ChatKit threads users have access to. Defaults to unlimited when unset. type: object - required: - - video - - prompt - title: Create video edit JSON request - description: JSON parameters for editing an existing generated video. - CreateVideoExtendMultipartBody: + required: [] + title: Chat history configuration + description: Controls how much historical context is retained for the session. + ChatkitConfigurationParam: properties: - video: - oneOf: - - type: string - format: binary - description: Reference to the completed video to extend. - - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to extend. - prompt: - type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the extension generation. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' + automatic_thread_titling: + $ref: '#/components/schemas/AutomaticThreadTitlingParam' + description: Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default. + file_upload: + $ref: '#/components/schemas/FileUploadParam' + description: Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB). + history: + $ref: '#/components/schemas/HistoryParam' + description: Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null). type: object - required: - - video - - prompt - - seconds - title: Create video extension multipart request - description: Multipart parameters for extending an existing generated video. - CreateVideoExtendJsonBody: + required: [] + title: ChatKit configuration overrides + description: Optional per-session configuration settings for ChatKit behavior. + CreateChatSessionBody: properties: - video: - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to extend. - prompt: + workflow: + $ref: '#/components/schemas/WorkflowParam' + description: Workflow that powers the session. + x-stainless-go-json: omitzero + user: type: string - maxLength: 32000 minLength: 1 - description: Updated text prompt that directs the extension generation. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' + description: A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope. + expires_after: + $ref: '#/components/schemas/ExpiresAfterParam' + description: Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes. + rate_limits: + $ref: '#/components/schemas/RateLimitsParam' + description: Optional override for per-minute request limits. When omitted, defaults to 10. + chatkit_configuration: + $ref: '#/components/schemas/ChatkitConfigurationParam' + description: Optional overrides for ChatKit runtime configuration features type: object required: - - video - - prompt - - seconds - title: Create video extension JSON request - description: JSON parameters for extending an existing generated video. - DeletedVideoResource: + - workflow + - user + title: Create chat session request + description: Parameters for provisioning a new ChatKit session. + UserMessageInputText: properties: - object: + type: type: string enum: - - video.deleted - description: The object type that signals the deletion response. - default: video.deleted + - input_text + description: Type discriminator that is always `input_text`. + default: input_text x-stainless-const: true - deleted: - type: boolean - description: Indicates that the video resource was deleted. - id: + text: type: string - description: Identifier of the deleted video. + description: Plain-text content supplied by the user. type: object required: - - object - - deleted - - id - title: Deleted video response - description: Confirmation payload returned after deleting a video. - VideoContentVariant: - type: string - enum: - - video - - thumbnail - - spritesheet - CreateVideoRemixBody: + - type + - text + title: User message input + description: Text block that a user contributed to the thread. + UserMessageQuotedText: properties: - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the remix generation. + enum: + - quoted_text + description: Type discriminator that is always `quoted_text`. + default: quoted_text + x-stainless-const: true + text: + type: string + description: Quoted text content. type: object required: - - prompt - title: Create video remix request - description: Parameters for remixing an existing generated video. - TruncationEnum: + - type + - text + title: User message quoted text + description: Quoted snippet that the user referenced in their message. + AttachmentType: type: string enum: - - auto - - disabled - PersonalityEnum: - anyOf: - - type: string - - type: string - enum: - - friendly - - pragmatic - TokenCountsBody: + - image + - file + Attachment: properties: - model: - anyOf: - - type: string - description: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. - - type: 'null' - input: - anyOf: - - description: Text, image, or file inputs to the model, used to generate a response - anyOf: - - type: string - maxLength: 10485760 - description: A text input to the model, equivalent to a text input with the `user` role. - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 131072 - description: A list of one or many input items to the model, containing different content types. - - type: 'null' - previous_response_id: - anyOf: - - type: string - description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. - example: resp_123 - - type: 'null' - tools: - anyOf: - - items: - $ref: '#/components/schemas/Tool' - type: array - description: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. - - type: 'null' - text: - anyOf: - - $ref: '#/components/schemas/ResponseTextParam' - - type: 'null' - reasoning: - anyOf: - - $ref: '#/components/schemas/Reasoning' - description: '**gpt-5 and o-series models only** Configuration options for [reasoning models](https://developers.openai.com/api/docs/guides/reasoning).' - - type: 'null' - truncation: - $ref: '#/components/schemas/TruncationEnum' - description: 'The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model''s context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.' - deprecated: true - instructions: + type: + $ref: '#/components/schemas/AttachmentType' + description: Attachment discriminator. + id: + type: string + description: Identifier for the attachment. + name: + type: string + description: Original display name for the attachment. + mime_type: + type: string + description: MIME type of the attachment. + preview_url: anyOf: - type: string - description: |- - A system (or developer) message inserted into the model's context. - When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. - - type: 'null' - personality: - $ref: '#/components/schemas/PersonalityEnum' - description: A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters. - conversation: - anyOf: - - $ref: '#/components/schemas/ConversationParam' - - type: 'null' - tool_choice: - anyOf: - - $ref: '#/components/schemas/ToolChoiceParam' - description: Controls which tool the model should use, if any. - - type: 'null' - parallel_tool_calls: - anyOf: - - type: boolean - description: Whether to allow the model to run tool calls in parallel. + format: uri + description: Preview URL for rendering the attachment inline. - type: 'null' type: object - required: [] - TokenCountsResource: + required: + - type + - id + - name + - mime_type + - preview_url + title: Attachment + description: Attachment metadata included on thread items. + ToolChoice: properties: - object: + id: type: string - enum: - - response.input_tokens - default: response.input_tokens - x-stainless-const: true - input_tokens: - type: integer + description: Identifier of the requested tool. type: object required: - - object - - input_tokens - title: Token counts - example: - object: response.input_tokens - input_tokens: 123 - PromptCacheRetentionEnum: - type: string - enum: - - in_memory - - 24h - ServiceTierEnum: - type: string - enum: - - auto - - default - - fast - - flex - - priority - CompactResponseMethodPublicBody: + - id + title: Tool choice + description: Tool selection that the assistant should honor when executing the item. + InferenceOptions: properties: - model: - $ref: '#/components/schemas/ModelIdsCompaction' - input: - anyOf: - - description: Text, image, or file inputs to the model, used to generate a response - anyOf: - - type: string - maxLength: 10485760 - description: A text input to the model, equivalent to a text input with the `user` role. - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 131072 - description: A list of one or many input items to the model, containing different content types. - - type: 'null' - previous_response_id: - anyOf: - - type: string - description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. - example: resp_123 - - type: 'null' - instructions: - anyOf: - - type: string - description: |- - A system (or developer) message inserted into the model's context. - When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. - - type: 'null' - prompt_cache_key: - anyOf: - - type: string - maxLength: 64 - description: A key to use when reading from or writing to the prompt cache. - - type: 'null' - prompt_cache_retention: - anyOf: - - $ref: '#/components/schemas/PromptCacheRetentionEnum' - description: How long to retain a prompt cache entry created by this request. - deprecated: true - - type: 'null' - prompt_cache_options: + tool_choice: anyOf: - - $ref: '#/components/schemas/PromptCacheOptionsParam' + - $ref: '#/components/schemas/ToolChoice' + description: Preferred tool to invoke. Defaults to null when ChatKit should auto-select. - type: 'null' - service_tier: - anyOf: - - $ref: '#/components/schemas/ServiceTierEnum' - description: |- - Specifies the processing type used for serving the request. - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`. - When not set, the default behavior is 'auto'. - When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + model: + anyOf: + - type: string + description: Model name that generated the response. Defaults to null when using the session default. - type: 'null' type: object required: + - tool_choice - model - ItemField: - discriminator: - propertyName: type - description: An item representing a message, tool call, tool output, reasoning, or other response element. - anyOf: - - $ref: '#/components/schemas/Message' - - $ref: '#/components/schemas/Program' - - $ref: '#/components/schemas/ProgramOutput' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/FunctionToolCallOutput' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - deprecated: true - - $ref: '#/components/schemas/LocalShellToolCallOutput' - deprecated: true - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - CompactResource: + title: Inference options + description: Model and tool overrides applied when generating the assistant response. + UserMessageItem: properties: id: type: string - description: The unique identifier for the compacted response. + description: Identifier of the thread item. object: type: string enum: - - response.compaction - description: The object type. Always `response.compaction`. - default: response.compaction + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - output: - type: array - description: The compacted list of output items. This is a list of all user messages, followed by a single compaction item. - items: - $ref: '#/components/schemas/OutputItem' created_at: type: integer format: unixtime - description: Unix timestamp (in seconds) when the compacted conversation was created. - usage: - $ref: '#/components/schemas/ResponseUsage' - description: Token accounting for the compaction pass, including cached, reasoning, and total tokens. + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.user_message + default: chatkit.user_message + x-stainless-const: true + content: + items: + discriminator: + propertyName: type + description: Content blocks that comprise a user message. + anyOf: + - $ref: '#/components/schemas/UserMessageInputText' + - $ref: '#/components/schemas/UserMessageQuotedText' + type: array + description: Ordered content elements supplied by the user. + attachments: + items: + $ref: '#/components/schemas/Attachment' + type: array + description: Attachments associated with the user message. Defaults to an empty list. + inference_options: + anyOf: + - $ref: '#/components/schemas/InferenceOptions' + description: Inference overrides applied to the message. Defaults to null when unset. + - type: 'null' type: object required: - id - object - - output - created_at - - usage - title: The compacted response object - SkillResource: + - thread_id + - type + - content + - attachments + - inference_options + title: User Message Item + description: User-authored messages within a thread. + FileAnnotationSource: properties: - id: - type: string - description: Unique identifier for the skill. - object: + type: type: string enum: - - skill - description: The object type, which is `skill`. - default: skill + - file + description: Type discriminator that is always `file`. + default: file x-stainless-const: true - name: - type: string - description: Name of the skill. - description: - type: string - description: Description of the skill. - created_at: - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the skill was created. - default_version: - type: string - description: Default version for the skill. - latest_version: + filename: type: string - description: Latest version for the skill. + description: Filename referenced by the annotation. type: object required: - - id - - object - - name - - description - - created_at - - default_version - - latest_version - SkillListResource: + - type + - filename + title: File annotation source + description: Attachment source referenced by an annotation. + FileAnnotation: properties: - object: + type: + type: string + enum: + - file + description: Type discriminator that is always `file` for this annotation. + default: file x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/SkillResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. + source: + $ref: '#/components/schemas/FileAnnotationSource' + description: File attachment referenced by the annotation. type: object required: - - object - - data - - first_id - - last_id - - has_more - CreateSkillBody: + - type + - source + title: File annotation + description: Annotation that references an uploaded file. + UrlAnnotationSource: properties: - files: - anyOf: - - items: - type: string - format: binary - type: array - maxItems: 500 - description: Skill files to upload (directory upload) or a single zip file. - - type: string - format: binary - description: Skill zip file to upload. + type: + type: string + enum: + - url + description: Type discriminator that is always `url`. + default: url + x-stainless-const: true + url: + type: string + format: uri + description: URL referenced by the annotation. type: object - description: Uploads a skill either as a directory (multipart `files[]`) or as a single zip file. - title: Create skill request - SetDefaultSkillVersionBody: + required: + - type + - url + title: URL annotation source + description: URL backing an annotation entry. + UrlAnnotation: properties: - default_version: + type: type: string - description: The skill version number to set as default. + enum: + - url + description: Type discriminator that is always `url` for this annotation. + default: url + x-stainless-const: true + source: + $ref: '#/components/schemas/UrlAnnotationSource' + description: URL referenced by the annotation. type: object required: - - default_version - title: Update skill request - description: Updates the default version pointer for a skill. - DeletedSkillResource: + - type + - source + title: URL annotation + description: Annotation that references a URL. + ResponseOutputText: properties: - object: + type: type: string enum: - - skill.deleted - default: skill.deleted + - output_text + description: Type discriminator that is always `output_text`. + default: output_text x-stainless-const: true - deleted: - type: boolean - id: + text: type: string + description: Assistant generated text. + annotations: + items: + discriminator: + propertyName: type + description: Annotation object describing a cited source. + anyOf: + - $ref: '#/components/schemas/FileAnnotation' + - $ref: '#/components/schemas/UrlAnnotation' + type: array + description: Ordered list of annotations attached to the response text. type: object required: - - object - - deleted - - id - SkillVersionResource: + - type + - text + - annotations + title: Assistant message content + description: Assistant response text accompanied by optional annotations. + AssistantMessageItem: properties: + id: + type: string + description: Identifier of the thread item. object: type: string enum: - - skill.version - description: The object type, which is `skill.version`. - default: skill.version + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - id: - type: string - description: Unique identifier for the skill version. - skill_id: - type: string - description: Identifier of the skill for this version. - version: - type: string - description: Version number for this skill. created_at: type: integer format: unixtime - description: Unix timestamp (seconds) for when the version was created. - name: + description: Unix timestamp (in seconds) for when the item was created. + thread_id: type: string - description: Name of the skill version. - description: + description: Identifier of the parent thread. + type: type: string - description: Description of the skill version. - type: object - required: - - object - - id - - skill_id - - version - - created_at - - name - - description - SkillVersionListResource: - properties: - object: + enum: + - chatkit.assistant_message + description: Type discriminator that is always `chatkit.assistant_message`. + default: chatkit.assistant_message x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: + content: items: - $ref: '#/components/schemas/SkillVersionResource' + $ref: '#/components/schemas/ResponseOutputText' type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. + description: Ordered assistant response segments. type: object required: + - id - object - - data - - first_id - - last_id - - has_more - CreateSkillVersionBody: - properties: - files: - anyOf: - - items: - type: string - format: binary - type: array - maxItems: 500 - description: Skill files to upload (directory upload) or a single zip file. - - type: string - format: binary - description: Skill zip file to upload. - default: - type: boolean - description: Whether to set this version as the default. - type: object - description: Uploads a new immutable version of a skill. - title: Create skill version request - DeletedSkillVersionResource: + - created_at + - thread_id + - type + - content + title: Assistant message + description: Assistant-authored message within a thread. + WidgetMessageItem: properties: + id: + type: string + description: Identifier of the thread item. object: type: string enum: - - skill.version.deleted - default: skill.version.deleted + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - deleted: - type: boolean - id: - type: string - version: + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: type: string - description: The deleted skill version. - type: object - required: - - object - - deleted - - id - - version - ChatkitWorkflowTracing: - properties: - enabled: - type: boolean - description: Indicates whether tracing is enabled. - type: object - required: - - enabled - title: Tracing Configuration - description: Controls diagnostic tracing during the session. - ChatkitWorkflow: - properties: - id: + description: Identifier of the parent thread. + type: type: string - description: Identifier of the workflow backing the session. - version: - anyOf: - - type: string - description: Specific workflow version used for the session. Defaults to null when using the latest deployment. - - type: 'null' - state_variables: - anyOf: - - additionalProperties: - anyOf: - - type: string - - type: integer - - type: boolean - - type: number - type: object - description: State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided. - x-oaiTypeLabel: map - - type: 'null' - tracing: - $ref: '#/components/schemas/ChatkitWorkflowTracing' - description: Tracing settings applied to the workflow. - type: object - required: - - id - - version - - state_variables - - tracing - title: Workflow - description: Workflow metadata and state returned for the session. - ChatSessionRateLimits: - properties: - max_requests_per_1_minute: - type: integer - description: Maximum allowed requests per one-minute window. - type: object - required: - - max_requests_per_1_minute - title: Rate limits - description: Active per-minute request limit for the session. - ChatSessionStatus: - type: string - enum: - - active - - expired - - cancelled - ChatSessionAutomaticThreadTitling: - properties: - enabled: - type: boolean - description: Whether automatic thread titling is enabled. - type: object - required: - - enabled - title: Automatic thread titling - description: Automatic thread title preferences for the session. - ChatSessionFileUpload: - properties: - enabled: - type: boolean - description: Indicates if uploads are enabled for the session. - max_file_size: - anyOf: - - type: integer - description: Maximum upload size in megabytes. - - type: 'null' - max_files: - anyOf: - - type: integer - description: Maximum number of uploads allowed during the session. - - type: 'null' - type: object - required: - - enabled - - max_file_size - - max_files - title: File upload settings - description: Upload permissions and limits applied to the session. - ChatSessionHistory: - properties: - enabled: - type: boolean - description: Indicates if chat history is persisted for the session. - recent_threads: - anyOf: - - type: integer - description: Number of prior threads surfaced in history views. Defaults to null when all history is retained. - - type: 'null' - type: object - required: - - enabled - - recent_threads - title: History settings - description: History retention preferences returned for the session. - ChatSessionChatkitConfiguration: - properties: - automatic_thread_titling: - $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' - description: Automatic thread titling preferences. - file_upload: - $ref: '#/components/schemas/ChatSessionFileUpload' - description: Upload settings for the session. - history: - $ref: '#/components/schemas/ChatSessionHistory' - description: History retention configuration. + enum: + - chatkit.widget + description: Type discriminator that is always `chatkit.widget`. + default: chatkit.widget + x-stainless-const: true + widget: + type: string + description: Serialized widget payload rendered in the UI. type: object required: - - automatic_thread_titling - - file_upload - - history - title: ChatKit configuration - description: ChatKit configuration for the session. - ChatSessionResource: + - id + - object + - created_at + - thread_id + - type + - widget + title: Widget message + description: Thread item that renders a widget payload. + ClientToolCallStatus: + type: string + enum: + - in_progress + - completed + ClientToolCallItem: properties: id: type: string - description: Identifier for the ChatKit session. + description: Identifier of the thread item. object: type: string enum: - - chatkit.session - description: Type discriminator that is always `chatkit.session`. - default: chatkit.session + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - expires_at: + created_at: type: integer format: unixtime - description: Unix timestamp (in seconds) for when the session expires. - client_secret: + description: Unix timestamp (in seconds) for when the item was created. + thread_id: type: string - description: Ephemeral client secret that authenticates session requests. - workflow: - $ref: '#/components/schemas/ChatkitWorkflow' - description: Workflow metadata for the session. - user: + description: Identifier of the parent thread. + type: type: string - description: User identifier associated with the session. - rate_limits: - $ref: '#/components/schemas/ChatSessionRateLimits' - description: Resolved rate limit values. - max_requests_per_1_minute: - type: integer - description: Convenience copy of the per-minute request limit. + enum: + - chatkit.client_tool_call + description: Type discriminator that is always `chatkit.client_tool_call`. + default: chatkit.client_tool_call + x-stainless-const: true status: - $ref: '#/components/schemas/ChatSessionStatus' - description: Current lifecycle state of the session. - chatkit_configuration: - $ref: '#/components/schemas/ChatSessionChatkitConfiguration' - description: Resolved ChatKit feature configuration for the session. + $ref: '#/components/schemas/ClientToolCallStatus' + description: Execution status for the tool call. + call_id: + type: string + description: Identifier for the client tool call. + name: + type: string + description: Tool name that was invoked. + arguments: + type: string + description: JSON-encoded arguments that were sent to the tool. + output: + anyOf: + - type: string + description: JSON-encoded output captured from the tool. Defaults to null while execution is in progress. + - type: 'null' type: object required: - id - object - - expires_at - - client_secret - - workflow - - user - - rate_limits - - max_requests_per_1_minute + - created_at + - thread_id + - type - status - - chatkit_configuration - title: The chat session object - description: Represents a ChatKit session and its resolved configuration. - example: - id: cksess_123 - object: chatkit.session - client_secret: ek_token_123 - expires_at: 1712349876 - workflow: - id: workflow_alpha - version: 2024-10-01 - state_variables: - message: hello - tracing: - enabled: true - user: user_789 - rate_limits: - max_requests_per_1_minute: 60 - max_requests_per_1_minute: 60 - status: active - chatkit_configuration: - automatic_thread_titling: - enabled: true - file_upload: - enabled: true - max_file_size: 16 - max_files: 20 - history: - enabled: true - recent_threads: 10 - WorkflowTracingParam: - properties: - enabled: - type: boolean - description: Whether tracing is enabled during the session. Defaults to true. - type: object - required: [] - title: Tracing Configuration - description: Controls diagnostic tracing during the session. - WorkflowParam: + - call_id + - name + - arguments + - output + title: Client tool call + description: Record of a client side tool invocation initiated by the assistant. + TaskType: + type: string + enum: + - custom + - thought + TaskItem: properties: id: type: string - description: Identifier for the workflow invoked by the session. - version: - type: string - description: Specific workflow version to run. Defaults to the latest deployed version. - state_variables: - additionalProperties: - anyOf: - - type: string - maxLength: 10485760 - - type: integer - - type: boolean - - type: number - type: object - maxProperties: 64 - description: State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object. - x-oaiTypeLabel: map - tracing: - $ref: '#/components/schemas/WorkflowTracingParam' - description: Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default. - type: object - required: - - id - title: Workflow settings - description: Workflow reference and overrides applied to the chat session. - ExpiresAfterParam: - properties: - anchor: + description: Identifier of the thread item. + object: type: string enum: - - created_at - description: Base timestamp used to calculate expiration. Currently fixed to `created_at`. - default: created_at + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - seconds: + created_at: type: integer - maximum: 600 - minimum: 1 - format: int64 - description: Number of seconds after the anchor when the session expires. + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.task + description: Type discriminator that is always `chatkit.task`. + default: chatkit.task + x-stainless-const: true + task_type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the task. + heading: + anyOf: + - type: string + description: Optional heading for the task. Defaults to null when not provided. + - type: 'null' + summary: + anyOf: + - type: string + description: Optional summary that describes the task. Defaults to null when omitted. + - type: 'null' type: object required: - - anchor - - seconds - title: Expiration overrides - description: Controls when the session expires relative to an anchor timestamp. - RateLimitsParam: - properties: - max_requests_per_1_minute: - type: integer - minimum: 1 - description: Maximum number of requests allowed per minute for the session. Defaults to 10. - type: object - required: [] - title: Rate limit overrides - description: Controls request rate limits for the session. - AutomaticThreadTitlingParam: + - id + - object + - created_at + - thread_id + - type + - task_type + - heading + - summary + title: Task item + description: Task emitted by the workflow to show progress and status updates. + TaskGroupTask: properties: - enabled: - type: boolean - description: Enable automatic thread title generation. Defaults to true. + type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the grouped task. + heading: + anyOf: + - type: string + description: Optional heading for the grouped task. Defaults to null when not provided. + - type: 'null' + summary: + anyOf: + - type: string + description: Optional summary that describes the grouped task. Defaults to null when omitted. + - type: 'null' type: object - required: [] - title: Automatic thread titling configuration - description: Controls whether ChatKit automatically generates thread titles. - FileUploadParam: + required: + - type + - heading + - summary + title: Task group task + description: Task entry that appears within a TaskGroup. + TaskGroupItem: properties: - enabled: - type: boolean - description: Enable uploads for this session. Defaults to false. - max_file_size: - type: integer - maximum: 512 - minimum: 1 - description: Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size. - max_files: + id: + type: string + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: type: integer - minimum: 1 - description: Maximum number of files that can be uploaded to the session. Defaults to 10. + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.task_group + description: Type discriminator that is always `chatkit.task_group`. + default: chatkit.task_group + x-stainless-const: true + tasks: + items: + $ref: '#/components/schemas/TaskGroupTask' + type: array + description: Tasks included in the group. type: object - required: [] - title: File upload configuration - description: Controls whether users can upload files. - HistoryParam: + required: + - id + - object + - created_at + - thread_id + - type + - tasks + title: Task group + description: Collection of workflow tasks grouped together in the thread. + ThreadItem: + discriminator: + propertyName: type + title: The thread item + anyOf: + - $ref: '#/components/schemas/UserMessageItem' + - $ref: '#/components/schemas/AssistantMessageItem' + - $ref: '#/components/schemas/WidgetMessageItem' + - $ref: '#/components/schemas/ClientToolCallItem' + - $ref: '#/components/schemas/TaskItem' + - $ref: '#/components/schemas/TaskGroupItem' + ThreadItemListResource: properties: - enabled: + object: + x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list + data: + items: + $ref: '#/components/schemas/ThreadItem' + type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: type: boolean - description: Enables chat users to access previous ChatKit threads. Defaults to true. - recent_threads: - type: integer - minimum: 1 - description: Number of recent ChatKit threads users have access to. Defaults to unlimited when unset. - type: object - required: [] - title: Chat history configuration - description: Controls how much historical context is retained for the session. - ChatkitConfigurationParam: - properties: - automatic_thread_titling: - $ref: '#/components/schemas/AutomaticThreadTitlingParam' - description: Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default. - file_upload: - $ref: '#/components/schemas/FileUploadParam' - description: Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB). - history: - $ref: '#/components/schemas/HistoryParam' - description: Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null). + description: Whether there are more items available. type: object - required: [] - title: ChatKit configuration overrides - description: Optional per-session configuration settings for ChatKit behavior. - CreateChatSessionBody: + required: + - object + - data + - first_id + - last_id + - has_more + title: Thread Items + description: A paginated list of thread items rendered for the ChatKit API. + ActiveStatus: properties: - workflow: - $ref: '#/components/schemas/WorkflowParam' - description: Workflow that powers the session. - x-stainless-go-json: omitzero - user: + type: type: string - minLength: 1 - description: A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope. - expires_after: - $ref: '#/components/schemas/ExpiresAfterParam' - description: Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes. - rate_limits: - $ref: '#/components/schemas/RateLimitsParam' - description: Optional override for per-minute request limits. When omitted, defaults to 10. - chatkit_configuration: - $ref: '#/components/schemas/ChatkitConfigurationParam' - description: Optional overrides for ChatKit runtime configuration features + enum: + - active + description: Status discriminator that is always `active`. + default: active + x-stainless-const: true type: object required: - - workflow - - user - title: Create chat session request - description: Parameters for provisioning a new ChatKit session. - UserMessageInputText: + - type + title: Active thread status + description: Indicates that a thread is active. + LockedStatus: properties: type: type: string enum: - - input_text - description: Type discriminator that is always `input_text`. - default: input_text + - locked + description: Status discriminator that is always `locked`. + default: locked x-stainless-const: true - text: - type: string - description: Plain-text content supplied by the user. + reason: + anyOf: + - type: string + description: Reason that the thread was locked. Defaults to null when no reason is recorded. + - type: 'null' type: object required: - type - - text - title: User message input - description: Text block that a user contributed to the thread. - UserMessageQuotedText: + - reason + title: Locked thread status + description: Indicates that a thread is locked and cannot accept new input. + ClosedStatus: properties: type: type: string enum: - - quoted_text - description: Type discriminator that is always `quoted_text`. - default: quoted_text + - closed + description: Status discriminator that is always `closed`. + default: closed x-stainless-const: true - text: - type: string - description: Quoted text content. + reason: + anyOf: + - type: string + description: Reason that the thread was closed. Defaults to null when no reason is recorded. + - type: 'null' type: object required: - type - - text - title: User message quoted text - description: Quoted snippet that the user referenced in their message. - AttachmentType: - type: string - enum: - - image - - file - Attachment: + - reason + title: Closed thread status + description: Indicates that a thread has been closed. + ThreadResource: properties: - type: - $ref: '#/components/schemas/AttachmentType' - description: Attachment discriminator. id: type: string - description: Identifier for the attachment. - name: - type: string - description: Original display name for the attachment. - mime_type: + description: Identifier of the thread. + object: type: string - description: MIME type of the attachment. - preview_url: + enum: + - chatkit.thread + description: Type discriminator that is always `chatkit.thread`. + default: chatkit.thread + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the thread was created. + title: anyOf: - type: string - format: uri - description: Preview URL for rendering the attachment inline. + description: Optional human-readable title for the thread. Defaults to null when no title has been generated. - type: 'null' + status: + discriminator: + propertyName: type + description: Current status for the thread. Defaults to `active` for newly created threads. + anyOf: + - $ref: '#/components/schemas/ActiveStatus' + - $ref: '#/components/schemas/LockedStatus' + - $ref: '#/components/schemas/ClosedStatus' + user: + type: string + description: Free-form string that identifies your end user who owns the thread. type: object required: - - type - id - - name - - mime_type - - preview_url - title: Attachment - description: Attachment metadata included on thread items. - ToolChoice: + - object + - created_at + - title + - status + - user + title: The thread object + description: Represents a ChatKit thread and its current status. + example: + id: cthr_def456 + object: chatkit.thread + created_at: 1712345600 + title: Demo feedback + status: + type: active + user: user_456 + DeletedThreadResource: properties: id: type: string - description: Identifier of the requested tool. + description: Identifier of the deleted thread. + object: + type: string + enum: + - chatkit.thread.deleted + description: Type discriminator that is always `chatkit.thread.deleted`. + default: chatkit.thread.deleted + x-stainless-const: true + deleted: + type: boolean + description: Indicates that the thread has been deleted. type: object required: - id - title: Tool choice - description: Tool selection that the assistant should honor when executing the item. - InferenceOptions: + - object + - deleted + title: Deleted thread + description: Confirmation payload returned after deleting a thread. + ThreadListResource: properties: - tool_choice: + object: + x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list + data: + items: + $ref: '#/components/schemas/ThreadResource' + type: array + description: A list of items + first_id: anyOf: - - $ref: '#/components/schemas/ToolChoice' - description: Preferred tool to invoke. Defaults to null when ChatKit should auto-select. + - type: string + description: The ID of the first item in the list. - type: 'null' - model: + last_id: anyOf: - type: string - description: Model name that generated the response. Defaults to null when using the session default. + description: The ID of the last item in the list. - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. type: object required: - - tool_choice - - model - title: Inference options - description: Model and tool overrides applied when generating the assistant response. - UserMessageItem: + - object + - data + - first_id + - last_id + - has_more + title: Threads + description: A paginated list of ChatKit threads. + DecisionInputText: + type: object properties: - id: - type: string - description: Identifier of the thread item. - object: - type: string - enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. type: type: string enum: - - chatkit.user_message - default: chatkit.user_message + - input_text + default: input_text x-stainless-const: true - content: - items: - discriminator: - propertyName: type - description: Content blocks that comprise a user message. - anyOf: - - $ref: '#/components/schemas/UserMessageInputText' - - $ref: '#/components/schemas/UserMessageQuotedText' - type: array - description: Ordered content elements supplied by the user. - attachments: - items: - $ref: '#/components/schemas/Attachment' - type: array - description: Attachments associated with the user message. Defaults to an empty list. - inference_options: + text: + type: string + minLength: 0 + maxLength: 10485760 + prompt_cache_breakpoint: anyOf: - - $ref: '#/components/schemas/InferenceOptions' - description: Inference overrides applied to the message. Defaults to null when unset. + - $ref: '#/components/schemas/DecisionPromptCacheBreakpoint' - type: 'null' - type: object required: - - id - - object - - created_at - - thread_id - type - - content - - attachments - - inference_options - title: User Message Item - description: User-authored messages within a thread. - FileAnnotationSource: + - text + additionalProperties: false + ImageDetailParam: + type: string + enum: + - low + - high + - auto + - original + DecisionInputImage: + type: object properties: + image_url: + type: string + minLength: 0 + maxLength: 1073741824 + pattern: ^(data:|https?://) + description: A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL. + detail: + anyOf: + - $ref: '#/components/schemas/ImageDetailParam' + - type: 'null' + description: The image detail level, using the selected model's image profile. Defaults to auto. + default: auto + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/DecisionPromptCacheBreakpoint' + - type: 'null' type: type: string enum: - - file - description: Type discriminator that is always `file`. - default: file + - input_image + default: input_image x-stainless-const: true - filename: - type: string - description: Filename referenced by the annotation. - type: object required: + - image_url - type - - filename - title: File annotation source - description: Attachment source referenced by an annotation. - FileAnnotation: + additionalProperties: false + description: An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported. + DecisionInputJson: + type: object properties: type: type: string enum: - - file - description: Type discriminator that is always `file` for this annotation. - default: file + - input_json + default: input_json x-stainless-const: true - source: - $ref: '#/components/schemas/FileAnnotationSource' - description: File attachment referenced by the annotation. - type: object + data: + anyOf: + - type: object + additionalProperties: + anyOf: + - {} + - type: 'null' + propertyNames: + type: string + minLength: 0 + minProperties: 0 + - type: array + items: + type: object + additionalProperties: + anyOf: + - {} + - type: 'null' + propertyNames: + type: string + minLength: 0 + minProperties: 0 + minItems: 0 required: - type - - source - title: File annotation - description: Annotation that references an uploaded file. - UrlAnnotationSource: + - data + additionalProperties: false + description: A JSON object or an array of objects rendered as text. Nested values may be any JSON value. Limited to 32 container levels, 10,000 values, and 256 KiB of compact UTF-8 JSON. + DecisionInputContentParts: + type: array + items: + x-oai-discriminator-values: + - input_text + - input_image + - input_json + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/DecisionInputText' + input_image: '#/components/schemas/DecisionInputImage' + input_json: '#/components/schemas/DecisionInputJson' + anyOf: + - $ref: '#/components/schemas/DecisionInputText' + - $ref: '#/components/schemas/DecisionInputImage' + - $ref: '#/components/schemas/DecisionInputJson' + minItems: 0 + maxItems: 16384 + DecisionInputContent: + description: A text string or an ordered list of text, image, and JSON parts. + anyOf: + - type: string + minLength: 0 + maxLength: 10485760 + - $ref: '#/components/schemas/DecisionInputContentParts' + title: Parts + DecisionInputUserMessage: + type: object properties: - type: + role: type: string enum: - - url - description: Type discriminator that is always `url`. - default: url + - user + default: user x-stainless-const: true - url: - type: string - format: uri - description: URL referenced by the annotation. - type: object - required: - - type - - url - title: URL annotation source - description: URL backing an annotation entry. - UrlAnnotation: - properties: + content: + $ref: '#/components/schemas/DecisionInputContent' type: type: string enum: - - url - description: Type discriminator that is always `url` for this annotation. - default: url + - message + default: message x-stainless-const: true - source: - $ref: '#/components/schemas/UrlAnnotationSource' - description: URL referenced by the annotation. - type: object required: - - type - - source - title: URL annotation - description: Annotation that references a URL. - ResponseOutputText: + - role + - content + additionalProperties: false + description: A user message containing input text, images, or JSON. + DecisionInputDeveloperContentParts: + type: array + items: + $ref: '#/components/schemas/DecisionInputText' + minItems: 0 + maxItems: 16384 + DecisionInputDeveloperContent: + description: A text string or an ordered list of input text parts. + anyOf: + - type: string + minLength: 0 + maxLength: 10485760 + - $ref: '#/components/schemas/DecisionInputDeveloperContentParts' + title: Parts + DecisionInputDeveloperMessage: + type: object properties: - type: + role: type: string enum: - - output_text - description: Type discriminator that is always `output_text`. - default: output_text + - developer + default: developer x-stainless-const: true - text: + content: + $ref: '#/components/schemas/DecisionInputDeveloperContent' + type: type: string - description: Assistant generated text. - annotations: - items: - discriminator: - propertyName: type - description: Annotation object describing a cited source. - anyOf: - - $ref: '#/components/schemas/FileAnnotation' - - $ref: '#/components/schemas/UrlAnnotation' - type: array - description: Ordered list of annotations attached to the response text. - type: object + enum: + - message + default: message + x-stainless-const: true required: - - type - - text - - annotations - title: Assistant message content - description: Assistant response text accompanied by optional annotations. - AssistantMessageItem: + - role + - content + additionalProperties: false + description: A developer message containing input text. + DecisionInputSystemMessage: + type: object properties: - id: - type: string - description: Identifier of the thread item. - object: + role: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - system + default: system x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. + content: + $ref: '#/components/schemas/DecisionInputDeveloperContent' type: type: string enum: - - chatkit.assistant_message - description: Type discriminator that is always `chatkit.assistant_message`. - default: chatkit.assistant_message + - message + default: message x-stainless-const: true - content: - items: - $ref: '#/components/schemas/ResponseOutputText' - type: array - description: Ordered assistant response segments. - type: object required: - - id - - object - - created_at - - thread_id - - type + - role - content - title: Assistant message - description: Assistant-authored message within a thread. - WidgetMessageItem: + additionalProperties: false + description: A system message containing input text. + DecisionInputOutputText: + type: object properties: - id: - type: string - description: Identifier of the thread item. - object: + type: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - output_text + default: output_text x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + text: type: string - description: Identifier of the parent thread. + minLength: 0 + maxLength: 10485760 + required: + - type + - text + additionalProperties: false + DecisionInputRefusal: + type: object + properties: type: type: string enum: - - chatkit.widget - description: Type discriminator that is always `chatkit.widget`. - default: chatkit.widget + - refusal + default: refusal x-stainless-const: true - widget: + refusal: type: string - description: Serialized widget payload rendered in the UI. - type: object + minLength: 0 + maxLength: 10485760 required: - - id - - object - - created_at - - thread_id - type - - widget - title: Widget message - description: Thread item that renders a widget payload. - ClientToolCallStatus: + - refusal + additionalProperties: false + DecisionInputAssistantContentParts: + type: array + items: + x-oai-discriminator-values: + - output_text + - refusal + discriminator: + propertyName: type + mapping: + output_text: '#/components/schemas/DecisionInputOutputText' + refusal: '#/components/schemas/DecisionInputRefusal' + anyOf: + - $ref: '#/components/schemas/DecisionInputOutputText' + - $ref: '#/components/schemas/DecisionInputRefusal' + minItems: 0 + maxItems: 16384 + DecisionInputAssistantContent: + description: A text string or an ordered list of output text and refusal parts. + anyOf: + - type: string + minLength: 0 + maxLength: 10485760 + - $ref: '#/components/schemas/DecisionInputAssistantContentParts' + title: Parts + MessagePhaseParam: type: string enum: - - in_progress - - completed - ClientToolCallItem: + - commentary + - final_answer + DecisionInputAssistantMessage: + type: object properties: - id: - type: string - description: Identifier of the thread item. - object: + role: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - assistant + default: assistant x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. + content: + $ref: '#/components/schemas/DecisionInputAssistantContent' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhaseParam' + - type: 'null' + description: The phase of an assistant message. type: type: string enum: - - chatkit.client_tool_call - description: Type discriminator that is always `chatkit.client_tool_call`. - default: chatkit.client_tool_call + - message + default: message x-stainless-const: true - status: - $ref: '#/components/schemas/ClientToolCallStatus' - description: Execution status for the tool call. + required: + - role + - content + additionalProperties: false + description: An assistant message containing output text or refusals. + DecisionInputMessage: + type: object + discriminator: + propertyName: role + mapping: + user: '#/components/schemas/DecisionInputUserMessage' + developer: '#/components/schemas/DecisionInputDeveloperMessage' + system: '#/components/schemas/DecisionInputSystemMessage' + assistant: '#/components/schemas/DecisionInputAssistantMessage' + x-oai-discriminator-values: + - user + - developer + - system + - assistant + anyOf: + - $ref: '#/components/schemas/DecisionInputUserMessage' + - $ref: '#/components/schemas/DecisionInputDeveloperMessage' + - $ref: '#/components/schemas/DecisionInputSystemMessage' + - $ref: '#/components/schemas/DecisionInputAssistantMessage' + FunctionCallStatusParam: + type: string + enum: + - in_progress + - completed + - incomplete + DecisionInputFunctionCall: + type: object + properties: + id: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 call_id: type: string - description: Identifier for the client tool call. + minLength: 1 + maxLength: 64 + namespace: + type: + - string + - 'null' + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ name: type: string - description: Tool name that was invoked. + minLength: 1 + maxLength: 128 + pattern: ^[a-zA-Z0-9_.-]+$ arguments: type: string - description: JSON-encoded arguments that were sent to the tool. - output: + minLength: 0 + maxLength: 1048576 + status: anyOf: - - type: string - description: JSON-encoded output captured from the tool. Defaults to null while execution is in progress. + - $ref: '#/components/schemas/FunctionCallStatusParam' - type: 'null' - type: object + type: + type: string + enum: + - function_call + default: function_call + x-stainless-const: true required: - - id - - object - - created_at - - thread_id - - type - - status - call_id - name - arguments - - output - title: Client tool call - description: Record of a client side tool invocation initiated by the assistant. - TaskType: - type: string - enum: - - custom - - thought - TaskItem: + - type + additionalProperties: false + DecisionInputToolOutputContentParts: + type: array + items: + x-oai-discriminator-values: + - input_text + - input_image + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/DecisionInputText' + input_image: '#/components/schemas/DecisionInputImage' + anyOf: + - $ref: '#/components/schemas/DecisionInputText' + - $ref: '#/components/schemas/DecisionInputImage' + minItems: 0 + maxItems: 16384 + DecisionInputToolOutputContent: + description: Text evidence or an ordered list of text and image parts. + anyOf: + - type: string + minLength: 0 + maxLength: 10485760 + - $ref: '#/components/schemas/DecisionInputToolOutputContentParts' + title: Parts + DecisionInputFunctionCallOutput: + type: object properties: id: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + call_id: type: string - description: Identifier of the thread item. - object: - type: string - enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. + minLength: 1 + maxLength: 64 + output: + $ref: '#/components/schemas/DecisionInputToolOutputContent' + status: + anyOf: + - $ref: '#/components/schemas/FunctionCallStatusParam' + - type: 'null' type: type: string enum: - - chatkit.task - description: Type discriminator that is always `chatkit.task`. - default: chatkit.task + - function_call_output + default: function_call_output x-stainless-const: true - task_type: - $ref: '#/components/schemas/TaskType' - description: Subtype for the task. - heading: - anyOf: - - type: string - description: Optional heading for the task. Defaults to null when not provided. - - type: 'null' - summary: - anyOf: - - type: string - description: Optional summary that describes the task. Defaults to null when omitted. - - type: 'null' - type: object required: - - id - - object - - created_at - - thread_id + - call_id + - output - type - - task_type - - heading - - summary - title: Task item - description: Task emitted by the workflow to show progress and status updates. - TaskGroupTask: - properties: - type: - $ref: '#/components/schemas/TaskType' - description: Subtype for the grouped task. - heading: - anyOf: - - type: string - description: Optional heading for the grouped task. Defaults to null when not provided. - - type: 'null' - summary: - anyOf: - - type: string - description: Optional summary that describes the grouped task. Defaults to null when omitted. - - type: 'null' + additionalProperties: false + DecisionInputCustomToolCall: type: object - required: - - type - - heading - - summary - title: Task group task - description: Task entry that appears within a TaskGroup. - TaskGroupItem: properties: id: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + call_id: type: string - description: Identifier of the thread item. - object: + minLength: 1 + maxLength: 64 + namespace: + type: + - string + - 'null' + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + name: type: string - enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ + input: type: string - description: Identifier of the parent thread. + minLength: 0 + maxLength: 1048576 + status: + anyOf: + - $ref: '#/components/schemas/FunctionCallStatusParam' + - type: 'null' type: type: string enum: - - chatkit.task_group - description: Type discriminator that is always `chatkit.task_group`. - default: chatkit.task_group + - custom_tool_call + default: custom_tool_call x-stainless-const: true - tasks: - items: - $ref: '#/components/schemas/TaskGroupTask' - type: array - description: Tasks included in the group. - type: object required: - - id - - object - - created_at - - thread_id + - call_id + - name + - input - type - - tasks - title: Task group - description: Collection of workflow tasks grouped together in the thread. - ThreadItem: - discriminator: - propertyName: type - title: The thread item - anyOf: - - $ref: '#/components/schemas/UserMessageItem' - - $ref: '#/components/schemas/AssistantMessageItem' - - $ref: '#/components/schemas/WidgetMessageItem' - - $ref: '#/components/schemas/ClientToolCallItem' - - $ref: '#/components/schemas/TaskItem' - - $ref: '#/components/schemas/TaskGroupItem' - ThreadItemListResource: + additionalProperties: false + DecisionInputCustomToolCallOutput: + type: object properties: - object: - x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/ThreadItem' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: + id: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + call_id: + type: string + minLength: 1 + maxLength: 64 + output: + $ref: '#/components/schemas/DecisionInputToolOutputContent' + status: anyOf: - - type: string - description: The ID of the last item in the list. + - $ref: '#/components/schemas/FunctionCallStatusParam' - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object - required: - - object - - data - - first_id - - last_id - - has_more - title: Thread Items - description: A paginated list of thread items rendered for the ChatKit API. - ActiveStatus: - properties: type: type: string enum: - - active - description: Status discriminator that is always `active`. - default: active + - custom_tool_call_output + default: custom_tool_call_output x-stainless-const: true - type: object required: + - call_id + - output - type - title: Active thread status - description: Indicates that a thread is active. - LockedStatus: - properties: - type: - type: string - enum: - - locked - description: Status discriminator that is always `locked`. - default: locked - x-stainless-const: true - reason: + additionalProperties: false + DecisionInput: + description: The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID. + anyOf: + - type: string + minLength: 0 + maxLength: 10485760 + - type: array + items: + x-oai-default-discriminator-value: message + discriminator: + propertyName: type + mapping: + message: '#/components/schemas/DecisionInputMessage' + function_call: '#/components/schemas/DecisionInputFunctionCall' + function_call_output: '#/components/schemas/DecisionInputFunctionCallOutput' + custom_tool_call: '#/components/schemas/DecisionInputCustomToolCall' + custom_tool_call_output: '#/components/schemas/DecisionInputCustomToolCallOutput' + x-oai-discriminator-values: + - message + - function_call + - function_call_output + - custom_tool_call + - custom_tool_call_output anyOf: - - type: string - description: Reason that the thread was locked. Defaults to null when no reason is recorded. - - type: 'null' + - $ref: '#/components/schemas/DecisionInputMessage' + - $ref: '#/components/schemas/DecisionInputFunctionCall' + - $ref: '#/components/schemas/DecisionInputFunctionCallOutput' + - $ref: '#/components/schemas/DecisionInputCustomToolCall' + - $ref: '#/components/schemas/DecisionInputCustomToolCallOutput' + minItems: 0 + maxItems: 131072 + DecisionQuestionInputText: type: object - required: - - type - - reason - title: Locked thread status - description: Indicates that a thread is locked and cannot accept new input. - ClosedStatus: properties: type: type: string enum: - - closed - description: Status discriminator that is always `closed`. - default: closed + - input_text + default: input_text x-stainless-const: true - reason: - anyOf: - - type: string - description: Reason that the thread was closed. Defaults to null when no reason is recorded. - - type: 'null' - type: object + text: + type: string + minLength: 0 + maxLength: 10485760 required: - type - - reason - title: Closed thread status - description: Indicates that a thread has been closed. - ThreadResource: + - text + additionalProperties: false + DecisionQuestionInputImage: + type: object properties: - id: - type: string - description: Identifier of the thread. - object: + image_url: type: string - enum: - - chatkit.thread - description: Type discriminator that is always `chatkit.thread`. - default: chatkit.thread - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the thread was created. - title: + minLength: 0 + maxLength: 1073741824 + pattern: ^(data:|https?://) + description: A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL. + detail: anyOf: - - type: string - description: Optional human-readable title for the thread. Defaults to null when no title has been generated. + - $ref: '#/components/schemas/ImageDetailParam' - type: 'null' - status: - discriminator: - propertyName: type - description: Current status for the thread. Defaults to `active` for newly created threads. - anyOf: - - $ref: '#/components/schemas/ActiveStatus' - - $ref: '#/components/schemas/LockedStatus' - - $ref: '#/components/schemas/ClosedStatus' - user: - type: string - description: Free-form string that identifies your end user who owns the thread. - type: object - required: - - id - - object - - created_at - - title - - status - - user - title: The thread object - description: Represents a ChatKit thread and its current status. - example: - id: cthr_def456 - object: chatkit.thread - created_at: 1712345600 - title: Demo feedback - status: - type: active - user: user_456 - DeletedThreadResource: - properties: - id: - type: string - description: Identifier of the deleted thread. - object: + description: The image detail level, using the selected model's image profile. Defaults to auto. + default: auto + type: type: string enum: - - chatkit.thread.deleted - description: Type discriminator that is always `chatkit.thread.deleted`. - default: chatkit.thread.deleted + - input_image + default: input_image x-stainless-const: true - deleted: - type: boolean - description: Indicates that the thread has been deleted. - type: object required: - - id - - object - - deleted - title: Deleted thread - description: Confirmation payload returned after deleting a thread. - ThreadListResource: + - image_url + - type + additionalProperties: false + description: An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported. + DecisionQuestionInputPart: + description: A text, image, or JSON content part in a question instruction. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/DecisionQuestionInputText' + input_image: '#/components/schemas/DecisionQuestionInputImage' + input_json: '#/components/schemas/DecisionInputJson' + x-oai-discriminator-values: + - input_text + - input_image + - input_json + anyOf: + - $ref: '#/components/schemas/DecisionQuestionInputText' + - $ref: '#/components/schemas/DecisionQuestionInputImage' + - $ref: '#/components/schemas/DecisionInputJson' + QuestionParamPredicate: + type: object properties: - object: + type: + type: string + enum: + - predicate + default: predicate x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/ThreadResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: + description: The type of the object. Always `predicate`. + name: + type: string + minLength: 0 + maxLength: 1048576 + instructions: anyOf: - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. + minLength: 0 + maxLength: 1048576 + - type: array + items: + $ref: '#/components/schemas/DecisionQuestionInputPart' + minItems: 1 + maxItems: 16384 + required: + - type + - instructions + additionalProperties: false + description: Estimate how likely it is that a statement about the input is true. + ChoiceValueParam: + description: 'Choice values are typed: a string and a boolean with the same text are distinct.' + anyOf: + - type: string + minLength: 0 + maxLength: 1048576 + - type: boolean + ChoiceOptionParam: type: object + properties: + value: + $ref: '#/components/schemas/ChoiceValueParam' + description: + type: string + minLength: 0 + maxLength: 1048576 required: - - object - - data - - first_id - - last_id - - has_more - title: Threads - description: A paginated list of ChatKit threads. - DecisionInputText: + - value + additionalProperties: false + QuestionParamChoice: type: object properties: type: type: string enum: - - input_text - default: input_text + - choice + default: choice x-stainless-const: true - text: + description: The type of the object. Always `choice`. + name: type: string minLength: 0 - maxLength: 10485760 - prompt_cache_breakpoint: + maxLength: 1048576 + instructions: anyOf: - - $ref: '#/components/schemas/DecisionPromptCacheBreakpoint' - - type: 'null' + - type: string + minLength: 0 + maxLength: 1048576 + - type: array + items: + $ref: '#/components/schemas/DecisionQuestionInputPart' + minItems: 1 + maxItems: 16384 + choices: + type: array + items: + $ref: '#/components/schemas/ChoiceOptionParam' + minItems: 2 + maxItems: 255 + description: Provide between 2 and 255 choices. Each choice must be unique. required: - type - - text + - instructions + - choices additionalProperties: false - ImageDetailParam: - type: string - enum: - - low - - high - - auto - - original - DecisionInputImage: + description: Choose from the supplied options based on the input. + ScoreLevelParam: type: object properties: - image_url: + label: type: string minLength: 0 - maxLength: 1073741824 - pattern: ^(data:|https?://) - description: A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL. - detail: - anyOf: - - $ref: '#/components/schemas/ImageDetailParam' - - type: 'null' - description: The image detail level, using the selected model's image profile. Defaults to auto. - default: auto - prompt_cache_breakpoint: - anyOf: - - $ref: '#/components/schemas/DecisionPromptCacheBreakpoint' - - type: 'null' - type: + maxLength: 1048576 + description: type: string - enum: - - input_image - default: input_image - x-stainless-const: true + minLength: 0 + maxLength: 1048576 required: - - image_url - - type + - label additionalProperties: false - description: An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported. - DecisionInputOutputText: + QuestionParamScore: type: object properties: type: type: string enum: - - output_text - default: output_text + - score + default: score x-stainless-const: true - text: + description: The type of the object. Always `score`. + name: type: string minLength: 0 - maxLength: 10485760 + maxLength: 1048576 + instructions: + anyOf: + - type: string + minLength: 0 + maxLength: 1048576 + - type: array + items: + $ref: '#/components/schemas/DecisionQuestionInputPart' + minItems: 1 + maxItems: 16384 + levels: + type: array + items: + $ref: '#/components/schemas/ScoreLevelParam' + minItems: 2 + maxItems: 10 required: - type - - text + - instructions + - levels additionalProperties: false - DecisionInputRefusal: + description: Rate the input against the supplied ordered levels. + QuestionParam: + description: A question about the request's input, with an optional correlation name. + discriminator: + propertyName: type + mapping: + predicate: '#/components/schemas/QuestionParamPredicate' + choice: '#/components/schemas/QuestionParamChoice' + score: '#/components/schemas/QuestionParamScore' + x-oai-discriminator-values: + - predicate + - choice + - score + anyOf: + - $ref: '#/components/schemas/QuestionParamPredicate' + - $ref: '#/components/schemas/QuestionParamChoice' + - $ref: '#/components/schemas/QuestionParamScore' + DecisionRequest: + type: object + properties: + model: + type: string + minLength: 0 + maxLength: 1048576 + description: The model to use. Only `gpt-6-luna` is supported. + input: + $ref: '#/components/schemas/DecisionInput' + questions: + type: array + items: + $ref: '#/components/schemas/QuestionParam' + minItems: 1 + maxItems: 400 + description: Ask 1–400 questions about the input. Each question can be a predicate, choice, or score. Answers come back in the same order. + safety_identifier: + type: + - string + - 'null' + minLength: 0 + maxLength: 128 + description: Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity. + prompt_cache_key: + type: + - string + - 'null' + minLength: 0 + maxLength: 64 + description: Partition prompt cache reuse by caller-provided key. + prompt_cache_options: + type: + - object + - 'null' + properties: + ttl: + type: string + enum: + - 30m + default: 30m + x-stainless-const: true + description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. + mode: + type: + - string + - 'null' + enum: + - implicit + - explicit + - null + description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. + x-openai-go-optional-enum: true + additionalProperties: false + title: Prompt cache options + description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. + required: + - model + - input + - questions + additionalProperties: false + AnswerResourcePredicate: type: object properties: type: type: string enum: - - refusal - default: refusal + - predicate + default: predicate x-stainless-const: true - refusal: - type: string + description: The type of the object. Always `predicate`. + name: + type: + - string + - 'null' minLength: 0 - maxLength: 10485760 + probability: + type: number required: - type - - refusal + - name + - probability additionalProperties: false - DecisionInputContentParts: - type: array - items: - x-oai-discriminator-values: - - input_text - - input_image - - input_json - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/DecisionInputText' - input_image: '#/components/schemas/DecisionInputImage' - input_json: '#/components/schemas/DecisionInputJson' - anyOf: - - $ref: '#/components/schemas/DecisionInputText' - - $ref: '#/components/schemas/DecisionInputImage' - - $ref: '#/components/schemas/DecisionInputJson' - minItems: 0 - maxItems: 16384 - DecisionInputContent: - description: A text string or an ordered list of text, image, and JSON parts. + ChoiceValueResource: + description: 'Choice values are typed: a string and a boolean with the same text are distinct.' anyOf: - type: string minLength: 0 - maxLength: 10485760 - - $ref: '#/components/schemas/DecisionInputContentParts' - title: Parts - MessagePhaseParam: - type: string - enum: - - commentary - - final_answer - DecisionInputMessage: + - type: boolean + ChoiceProbabilityResource: type: object - discriminator: - propertyName: role - mapping: - user: '#/components/schemas/DecisionInputUserMessage' - developer: '#/components/schemas/DecisionInputDeveloperMessage' - system: '#/components/schemas/DecisionInputSystemMessage' - assistant: '#/components/schemas/DecisionInputAssistantMessage' - x-oai-discriminator-values: - - user - - developer - - system - - assistant - anyOf: - - $ref: '#/components/schemas/DecisionInputUserMessage' - - $ref: '#/components/schemas/DecisionInputDeveloperMessage' - - $ref: '#/components/schemas/DecisionInputSystemMessage' - - $ref: '#/components/schemas/DecisionInputAssistantMessage' - FunctionCallStatusParam: - type: string - enum: - - in_progress - - completed - - incomplete - DecisionInputFunctionCall: + properties: + value: + $ref: '#/components/schemas/ChoiceValueResource' + probability: + type: number + required: + - value + - probability + additionalProperties: false + AnswerResourceChoice: type: object properties: - id: + type: + type: string + enum: + - choice + default: choice + x-stainless-const: true + description: The type of the object. Always `choice`. + name: type: - string - 'null' minLength: 0 - maxLength: 1048576 - call_id: + choice: + $ref: '#/components/schemas/ChoiceValueResource' + probabilities: + type: array + items: + $ref: '#/components/schemas/ChoiceProbabilityResource' + minItems: 0 + maxItems: 2000 + confidence: + type: number + required: + - type + - name + - choice + - probabilities + - confidence + additionalProperties: false + ScoreProbabilityResource: + type: object + properties: + value: + type: integer + format: int64 + label: type: string - minLength: 1 - maxLength: 64 - namespace: + minLength: 0 + probability: + type: number + required: + - value + - label + - probability + additionalProperties: false + AnswerResourceScore: + type: object + properties: + type: + type: string + enum: + - score + default: score + x-stainless-const: true + description: The type of the object. Always `score`. + name: type: - string - 'null' - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - name: + minLength: 0 + score: + type: number + probabilities: + type: array + items: + $ref: '#/components/schemas/ScoreProbabilityResource' + minItems: 0 + maxItems: 2000 + confidence: + type: number + required: + - type + - name + - score + - probabilities + - confidence + additionalProperties: false + AnswerResourceRefusal: + type: object + properties: + type: type: string - minLength: 1 - maxLength: 128 - pattern: ^[a-zA-Z0-9_.-]+$ - arguments: + enum: + - refusal + default: refusal + x-stainless-const: true + description: The type of the object. Always `refusal`. + name: + type: + - string + - 'null' + minLength: 0 + required: + - type + - name + additionalProperties: false + description: The model declined to answer this question. Other questions in the same request can still receive answers. + AnswerResource: + description: A completed question always includes its name, including null when unnamed. + discriminator: + propertyName: type + mapping: + predicate: '#/components/schemas/AnswerResourcePredicate' + choice: '#/components/schemas/AnswerResourceChoice' + score: '#/components/schemas/AnswerResourceScore' + refusal: '#/components/schemas/AnswerResourceRefusal' + x-oai-discriminator-values: + - predicate + - choice + - score + - refusal + anyOf: + - $ref: '#/components/schemas/AnswerResourcePredicate' + - $ref: '#/components/schemas/AnswerResourceChoice' + - $ref: '#/components/schemas/AnswerResourceScore' + - $ref: '#/components/schemas/AnswerResourceRefusal' + InputTokensDetailsResource: + type: object + properties: + cached_tokens: + type: integer + format: int64 + minimum: -2147483648 + maximum: 2147483647 + cache_write_tokens: + type: integer + format: int64 + minimum: -2147483648 + maximum: 2147483647 + required: + - cached_tokens + - cache_write_tokens + additionalProperties: false + OutputTokensDetailsResource: + type: object + properties: + reasoning_tokens: + type: integer + format: int64 + minimum: -2147483648 + maximum: 2147483647 + required: + - reasoning_tokens + additionalProperties: false + ResponseUsageResource: + type: object + properties: + input_tokens: + type: integer + format: int64 + minimum: -2147483648 + maximum: 2147483647 + input_tokens_details: + $ref: '#/components/schemas/InputTokensDetailsResource' + output_tokens: + type: integer + format: int64 + minimum: -2147483648 + maximum: 2147483647 + output_tokens_details: + $ref: '#/components/schemas/OutputTokensDetailsResource' + total_tokens: + type: integer + format: int64 + minimum: -2147483648 + maximum: 2147483647 + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + additionalProperties: false + DecisionResponse: + type: object + properties: + model: type: string minLength: 0 - maxLength: 1048576 - status: + description: The model used. + answers: + type: array + items: + $ref: '#/components/schemas/AnswerResource' + minItems: 0 + maxItems: 2000 + description: 'Answers in question order. Any question can return a refusal instead of an answer; other questions can still receive answers. A refusal has `type: "refusal"` and the question''s `name`, or `null` if it was unnamed.' + usage: + $ref: '#/components/schemas/ResponseUsageResource' + description: Token usage for the request. + required: + - model + - answers + - usage + additionalProperties: false + ListOrderParam: + type: string + enum: + - asc + - desc + x-enumDescriptions: + - Returns resources in ascending order. + - Returns resources in descending order. + description: The order in which paginated resources are returned. + ReasoningEffortResource: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + description: The amount of reasoning effort used by an agent. + ReasoningSummaryResource: + type: string + enum: + - concise + - detailed + - auto + x-enumDescriptions: + - Returns a concise reasoning summary when supported. + - Returns a detailed reasoning summary when supported. + - Automatically selects the most detailed summary supported by the model. + description: The reasoning summary format requested from an agent. + ReasoningResource: + type: object + properties: + effort: anyOf: - - $ref: '#/components/schemas/FunctionCallStatusParam' + - $ref: '#/components/schemas/ReasoningEffortResource' - type: 'null' - type: - type: string - enum: - - function_call - default: function_call - x-stainless-const: true + description: The requested reasoning effort, or `null` when the model selects its own default. + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryResource' + - type: 'null' + description: The requested reasoning summary format, or `null` when summaries are disabled. required: - - call_id - - name - - arguments - - type + - effort + - summary additionalProperties: false - DecisionInputToolOutputContentParts: - type: array - items: - x-oai-discriminator-values: - - input_text - - input_image - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/DecisionInputText' - input_image: '#/components/schemas/DecisionInputImage' - anyOf: - - $ref: '#/components/schemas/DecisionInputText' - - $ref: '#/components/schemas/DecisionInputImage' - minItems: 0 - maxItems: 16384 - DecisionInputToolOutputContent: - description: Text evidence or an ordered list of text and image parts. - anyOf: - - type: string - minLength: 0 - maxLength: 10485760 - - $ref: '#/components/schemas/DecisionInputToolOutputContentParts' - title: Parts - DecisionInputFunctionCallOutput: + description: The reasoning configuration used by an agent. + TextFormatResourceText: type: object properties: - id: - type: - - string - - 'null' - minLength: 0 - maxLength: 1048576 - call_id: - type: string - minLength: 1 - maxLength: 64 - output: - $ref: '#/components/schemas/DecisionInputToolOutputContent' - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallStatusParam' - - type: 'null' type: type: string enum: - - function_call_output - default: function_call_output + - text + default: text x-stainless-const: true + description: The type of the object. Always `text`. required: - - call_id - - output - type additionalProperties: false - DecisionInputCustomToolCall: + description: Generates ordinary text without a structured-output constraint. + TextFormatResourceJsonSchema: type: object properties: - id: - type: - - string - - 'null' - minLength: 0 - maxLength: 1048576 - call_id: - type: string - minLength: 1 - maxLength: 64 - namespace: - type: - - string - - 'null' - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - name: - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ - input: - type: string - minLength: 0 - maxLength: 1048576 - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallStatusParam' - - type: 'null' type: type: string enum: - - custom_tool_call - default: custom_tool_call + - json_schema + default: json_schema x-stainless-const: true + description: The type of the object. Always `json_schema`. + schema: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: The JSON Schema that generated text must match. required: - - call_id - - name - - input - type + - schema additionalProperties: false - DecisionInputCustomToolCallOutput: + description: Constrains generated text to a JSON Schema. + TextFormatResource: + description: The effective output format for generated text. + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/TextFormatResourceText' + json_schema: '#/components/schemas/TextFormatResourceJsonSchema' + x-oai-discriminator-values: + - text + - json_schema + anyOf: + - $ref: '#/components/schemas/TextFormatResourceText' + - $ref: '#/components/schemas/TextFormatResourceJsonSchema' + VerbosityResource: + type: string + enum: + - low + - medium + - high + description: The amount of text produced by an agent. + TextResource: type: object properties: - id: - type: - - string - - 'null' - minLength: 0 - maxLength: 1048576 - call_id: - type: string - minLength: 1 - maxLength: 64 - output: - $ref: '#/components/schemas/DecisionInputToolOutputContent' - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallStatusParam' - - type: 'null' - type: - type: string - enum: - - custom_tool_call_output - default: custom_tool_call_output - x-stainless-const: true + format: + $ref: '#/components/schemas/TextFormatResource' + description: The effective output format. Defaults to ordinary text. + verbosity: + $ref: '#/components/schemas/VerbosityResource' + description: The amount of text produced by the agent. Defaults to `medium`. required: - - call_id - - output - - type + - format + - verbosity additionalProperties: false - DecisionInput: - description: The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID. - anyOf: - - type: string - minLength: 0 - maxLength: 10485760 - - type: array - items: - x-oai-default-discriminator-value: message - discriminator: - propertyName: type - mapping: - message: '#/components/schemas/DecisionInputMessage' - function_call: '#/components/schemas/DecisionInputFunctionCall' - function_call_output: '#/components/schemas/DecisionInputFunctionCallOutput' - custom_tool_call: '#/components/schemas/DecisionInputCustomToolCall' - custom_tool_call_output: '#/components/schemas/DecisionInputCustomToolCallOutput' - x-oai-discriminator-values: - - message - - function_call - - function_call_output - - custom_tool_call - - custom_tool_call_output - anyOf: - - $ref: '#/components/schemas/DecisionInputMessage' - - $ref: '#/components/schemas/DecisionInputFunctionCall' - - $ref: '#/components/schemas/DecisionInputFunctionCallOutput' - - $ref: '#/components/schemas/DecisionInputCustomToolCall' - - $ref: '#/components/schemas/DecisionInputCustomToolCallOutput' - minItems: 0 - maxItems: 131072 - QuestionParamPredicate: + description: The text configuration used by an agent. + ServiceTierResource: + type: string + enum: + - auto + - default + - flex + - priority + - fast + - ultrafast + description: The service-tier policy configured for an agent. + AgentToolResourceFunction: type: object properties: type: type: string enum: - - predicate - default: predicate + - function + default: function x-stainless-const: true - description: The type of the object. Always `predicate`. + description: The type of the object. Always `function`. name: type: string minLength: 0 - maxLength: 1048576 - instructions: - anyOf: - - type: string - minLength: 0 - maxLength: 1048576 - - type: array - items: - $ref: '#/components/schemas/DecisionQuestionInputPart' - minItems: 1 - maxItems: 16384 - required: - - type - - instructions - additionalProperties: false - description: Estimate how likely it is that a statement about the input is true. - ChoiceValueParam: - description: 'Choice values are typed: a string and a boolean with the same text are distinct.' - anyOf: - - type: string - minLength: 0 - maxLength: 1048576 - - type: boolean - ChoiceOptionParam: - type: object - properties: - value: - $ref: '#/components/schemas/ChoiceValueParam' + description: The name of the function. description: type: string minLength: 0 - maxLength: 1048576 + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + description: Whether the function is deferred and discovered through tool search. required: - - value + - type + - name + - description + - parameters + - defer_loading additionalProperties: false - QuestionParamChoice: + description: A function defined by the application. + AgentToolResourceProgrammaticToolCalling: type: object properties: type: type: string enum: - - choice - default: choice + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true - description: The type of the object. Always `choice`. - name: - type: string - minLength: 0 - maxLength: 1048576 - instructions: - anyOf: - - type: string - minLength: 0 - maxLength: 1048576 - - type: array - items: - $ref: '#/components/schemas/DecisionQuestionInputPart' - minItems: 1 - maxItems: 16384 - choices: - type: array - items: - $ref: '#/components/schemas/ChoiceOptionParam' - minItems: 2 - maxItems: 255 - description: Provide between 2 and 255 choices. Each choice must be unique. + description: The type of the object. Always `programmatic_tool_calling`. + enabled: + type: boolean + description: Whether tools can be called from model-generated code. required: - type - - instructions - - choices + - enabled additionalProperties: false - description: Choose from the supplied options based on the input. - ScoreLevelParam: + description: Enables calling tools from model-generated code. + McpTransportResourceHttp: type: object properties: - label: + type: type: string - minLength: 0 - maxLength: 1048576 - description: + enum: + - http + default: http + x-stainless-const: true + description: The type of the object. Always `http`. + server_url: type: string minLength: 0 - maxLength: 1048576 + description: The URL of the MCP server. required: - - label + - type + - server_url additionalProperties: false - QuestionParamScore: + description: Connects to an MCP server over HTTP. + McpTransportResourceStdio: type: object properties: type: type: string enum: - - score - default: score + - stdio + default: stdio x-stainless-const: true - description: The type of the object. Always `score`. - name: + description: The type of the object. Always `stdio`. + command: type: string minLength: 0 - maxLength: 1048576 - instructions: - anyOf: - - type: string + description: The command used to start the MCP server. + args: + type: array + items: + type: string minLength: 0 - maxLength: 1048576 - - type: array - items: - $ref: '#/components/schemas/DecisionQuestionInputPart' - minItems: 1 - maxItems: 16384 - levels: + minItems: 0 + maxItems: 2000 + description: Arguments passed to the MCP server command. + cwd: + type: string + minLength: 0 + description: The working directory used to start the MCP server. + env_vars: type: array items: - $ref: '#/components/schemas/ScoreLevelParam' - minItems: 2 - maxItems: 10 + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Environment variable names inherited from the execution environment. required: - type - - instructions - - levels + - command + - args + - cwd + - env_vars additionalProperties: false - description: Rate the input against the supplied ordered levels. - QuestionParam: - description: A question about the request's input, with an optional correlation name. + description: Starts an MCP server as a local process. + McpTransportResource: + description: The transport used to connect to an MCP server. discriminator: propertyName: type mapping: - predicate: '#/components/schemas/QuestionParamPredicate' - choice: '#/components/schemas/QuestionParamChoice' - score: '#/components/schemas/QuestionParamScore' + http: '#/components/schemas/McpTransportResourceHttp' + stdio: '#/components/schemas/McpTransportResourceStdio' x-oai-discriminator-values: - - predicate - - choice - - score + - http + - stdio anyOf: - - $ref: '#/components/schemas/QuestionParamPredicate' - - $ref: '#/components/schemas/QuestionParamChoice' - - $ref: '#/components/schemas/QuestionParamScore' - DecisionRequest: + - $ref: '#/components/schemas/McpTransportResourceHttp' + - $ref: '#/components/schemas/McpTransportResourceStdio' + McpConnectionOriginResource: + type: string + enum: + - service + - environment + description: Where outbound MCP HTTP connections originate. + AgentToolResourceMcp: type: object properties: - model: + type: + type: string + enum: + - mcp + default: mcp + x-stainless-const: true + description: The type of the object. Always `mcp`. + server_label: type: string minLength: 0 - maxLength: 1048576 - description: The model to use. Only `gpt-6-luna` is supported. - input: - $ref: '#/components/schemas/DecisionInput' - questions: - type: array - items: - $ref: '#/components/schemas/QuestionParam' - minItems: 1 - maxItems: 400 - description: Ask 1–400 questions about the input. Each question can be a predicate, choice, or score. Answers come back in the same order. - safety_identifier: - type: - - string - - 'null' - minLength: 0 - maxLength: 128 - description: Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses' limit; this is never the authenticated user identity. - prompt_cache_key: + description: A label used to identify the MCP server in tool calls. + credential_id: type: - string - 'null' minLength: 0 - maxLength: 64 - description: Partition prompt cache reuse by caller-provided key. - prompt_cache_options: + description: The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL. + transport: + $ref: '#/components/schemas/McpTransportResource' + description: The transport used to connect to the MCP server. + request_metadata: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Metadata included with requests to this MCP server. + allowed_tools: type: - - object + - array - 'null' - properties: - ttl: - type: string - enum: - - 30m - default: 30m - x-stainless-const: true - description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. - mode: - type: - - string - - 'null' - enum: - - implicit - - explicit - - null - description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. - x-openai-go-optional-enum: true - additionalProperties: false - title: Prompt cache options - description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The MCP tools the agent may call. + required: + type: boolean + description: Whether this MCP server must initialize before the first turn. + connection_origin: + $ref: '#/components/schemas/McpConnectionOriginResource' + description: Where outbound MCP HTTP connections originate. required: - - model - - input - - questions + - type + - server_label + - credential_id + - transport + - request_metadata + - allowed_tools + - required + - connection_origin additionalProperties: false - AnswerResourcePredicate: + description: Tools provided by a remote MCP server. + WebSearchModeResource: + type: string + enum: + - disabled + - cached + - live + description: The source used for web search results. + WebSearchContextSizeResource: + type: string + enum: + - low + - medium + - high + description: The amount of web search context made available to the model. + WebSearchLocationResource: type: object properties: - type: - type: string - enum: - - predicate - default: predicate - x-stainless-const: true - description: The type of the object. Always `predicate`. - name: + country: type: - string - 'null' minLength: 0 - probability: - type: number - required: - - type - - name - - probability - additionalProperties: false - ChoiceValueResource: - description: 'Choice values are typed: a string and a boolean with the same text are distinct.' - anyOf: - - type: string - minLength: 0 - - type: boolean - ChoiceProbabilityResource: - type: object - properties: - value: - $ref: '#/components/schemas/ChoiceValueResource' - probability: - type: number + description: The two-letter ISO country code, such as `US`. + region: + type: + - string + - 'null' + minLength: 0 + description: The region or state name. + city: + type: + - string + - 'null' + minLength: 0 + description: The city name. + timezone: + type: + - string + - 'null' + minLength: 0 + description: The IANA timezone, such as `America/Los_Angeles`. required: - - value - - probability + - country + - region + - city + - timezone additionalProperties: false - AnswerResourceChoice: + description: Approximate user location used to localize web search results. + AgentToolResourceWebSearch: type: object properties: type: type: string enum: - - choice - default: choice + - web_search + default: web_search x-stainless-const: true - description: The type of the object. Always `choice`. - name: + description: The type of the object. Always `web_search`. + mode: + $ref: '#/components/schemas/WebSearchModeResource' + description: The source used for web search results. + context_size: + $ref: '#/components/schemas/WebSearchContextSizeResource' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: type: - - string + - array - 'null' - minLength: 0 - choice: - $ref: '#/components/schemas/ChoiceValueResource' - probabilities: - type: array items: - $ref: '#/components/schemas/ChoiceProbabilityResource' + type: string + minLength: 0 minItems: 0 maxItems: 2000 - confidence: - type: number + description: Allowed search domains, or `null` when the search is unrestricted. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationResource' + - type: 'null' + description: Approximate location used to localize search results, if provided. required: - type - - name - - choice - - probabilities - - confidence - additionalProperties: false - ScoreProbabilityResource: - type: object - properties: - value: - type: integer - format: int64 - label: - type: string - minLength: 0 - probability: - type: number - required: - - value - - label - - probability + - mode + - context_size + - allowed_domains + - location additionalProperties: false - AnswerResourceScore: + description: Web search. + AgentToolResourceComputerUse: type: object properties: type: type: string enum: - - score - default: score + - computer_use + default: computer_use x-stainless-const: true - description: The type of the object. Always `score`. - name: - type: - - string - - 'null' - minLength: 0 - score: - type: number - probabilities: - type: array - items: - $ref: '#/components/schemas/ScoreProbabilityResource' - minItems: 0 - maxItems: 2000 - confidence: - type: number + description: The type of the object. Always `computer_use`. + include_screenshots: + type: boolean + description: Whether computer tool outputs include screenshots. required: - type - - name - - score - - probabilities - - confidence + - include_screenshots additionalProperties: false - AnswerResourceRefusal: + description: Browser use in an OpenAI-hosted session. + AgentToolResourceAutomations: type: object properties: type: type: string enum: - - refusal - default: refusal + - automations + default: automations x-stainless-const: true - description: The type of the object. Always `refusal`. - name: - type: - - string - - 'null' - minLength: 0 + description: The type of the object. Always `automations`. required: - type - - name additionalProperties: false - description: The model declined to answer this question. Other questions in the same request can still receive answers. - AnswerResource: - description: A completed question always includes its name, including null when unnamed. + description: Lets the agent manage its own scheduled wakeups. + AgentToolResource: + description: A tool available to the agent. discriminator: propertyName: type mapping: - predicate: '#/components/schemas/AnswerResourcePredicate' - choice: '#/components/schemas/AnswerResourceChoice' - score: '#/components/schemas/AnswerResourceScore' - refusal: '#/components/schemas/AnswerResourceRefusal' + function: '#/components/schemas/AgentToolResourceFunction' + programmatic_tool_calling: '#/components/schemas/AgentToolResourceProgrammaticToolCalling' + mcp: '#/components/schemas/AgentToolResourceMcp' + web_search: '#/components/schemas/AgentToolResourceWebSearch' + computer_use: '#/components/schemas/AgentToolResourceComputerUse' + automations: '#/components/schemas/AgentToolResourceAutomations' x-oai-discriminator-values: - - predicate - - choice - - score - - refusal + - function + - programmatic_tool_calling + - mcp + - web_search + - computer_use + - automations anyOf: - - $ref: '#/components/schemas/AnswerResourcePredicate' - - $ref: '#/components/schemas/AnswerResourceChoice' - - $ref: '#/components/schemas/AnswerResourceScore' - - $ref: '#/components/schemas/AnswerResourceRefusal' - InputTokensDetailsResource: + - $ref: '#/components/schemas/AgentToolResourceFunction' + - $ref: '#/components/schemas/AgentToolResourceProgrammaticToolCalling' + - $ref: '#/components/schemas/AgentToolResourceMcp' + - $ref: '#/components/schemas/AgentToolResourceWebSearch' + - $ref: '#/components/schemas/AgentToolResourceComputerUse' + - $ref: '#/components/schemas/AgentToolResourceAutomations' + MultiAgentConfigResource: type: object properties: - cached_tokens: - type: integer - format: int64 - minimum: -2147483648 - maximum: 2147483647 - cache_write_tokens: - type: integer + enabled: + type: boolean + description: Whether subagent tools are enabled. Defaults to false. + max_concurrent_subagents: + type: + - integer + - 'null' format: int64 - minimum: -2147483648 - maximum: 2147483647 + minimum: 1 + maximum: 4294967295 + description: Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled. required: - - cached_tokens - - cache_write_tokens + - enabled + - max_concurrent_subagents additionalProperties: false - OutputTokensDetailsResource: + description: The resolved configuration for creating and coordinating subagents. + AutomationAgentConfigResource: type: object properties: - reasoning_tokens: - type: integer - format: int64 - minimum: -2147483648 - maximum: 2147483647 + model: + type: string + minLength: 0 + description: The requested model name. + reasoning: + $ref: '#/components/schemas/ReasoningResource' + description: The configured reasoning policy. + text: + $ref: '#/components/schemas/TextResource' + description: The configured output format and verbosity. + service_tier: + $ref: '#/components/schemas/ServiceTierResource' + description: The configured service-tier policy. + instructions: + type: + - string + - 'null' + minLength: 0 + description: Custom instructions, or null when absent. + tools: + type: array + items: + $ref: '#/components/schemas/AgentToolResource' + minItems: 0 + maxItems: 2000 + description: Configured tools, excluding confidential credentials. + multi_agent: + $ref: '#/components/schemas/MultiAgentConfigResource' + description: The configuration for creating and coordinating subagents. required: - - reasoning_tokens + - model + - reasoning + - text + - service_tier + - instructions + - tools + - multi_agent additionalProperties: false - ResponseUsageResource: + description: Inline agent configuration without a generated session-local identity. + AutomationEnvironmentResourceNone: type: object properties: - input_tokens: - type: integer - format: int64 - minimum: -2147483648 - maximum: 2147483647 - input_tokens_details: - $ref: '#/components/schemas/InputTokensDetailsResource' - output_tokens: - type: integer - format: int64 - minimum: -2147483648 - maximum: 2147483647 - output_tokens_details: - $ref: '#/components/schemas/OutputTokensDetailsResource' - total_tokens: - type: integer - format: int64 - minimum: -2147483648 - maximum: 2147483647 + type: + type: string + enum: + - none + default: none + x-stainless-const: true + description: The type of the object. Always `none`. required: - - input_tokens - - input_tokens_details - - output_tokens - - output_tokens_details - - total_tokens + - type additionalProperties: false - DecisionResponse: + ContainerSizeResource: + type: string + enum: + - small + - medium + - large + description: The effective CPU and memory tier of an OpenAI-hosted environment. + EnvironmentPackagesResource: type: object properties: - model: - type: string - minLength: 0 - description: The model used. - answers: + python: type: array items: - $ref: '#/components/schemas/AnswerResource' + type: string + minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: 'Answers in question order. Any question can return a refusal instead of an answer; other questions can still receive answers. A refusal has `type: "refusal"` and the question''s `name`, or `null` if it was unnamed.' - usage: - $ref: '#/components/schemas/ResponseUsageResource' - description: Token usage for the request. + maxItems: 16384 + description: Python packages installed in the environment. + system: + type: array + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: System packages installed in the environment. + npm: + type: array + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: npm packages installed globally in the environment. required: - - model - - answers - - usage + - python + - system + - npm additionalProperties: false - ListOrderParam: - type: string - enum: - - asc - - desc - x-enumDescriptions: - - Returns resources in ascending order. - - Returns resources in descending order. - description: The order in which paginated resources are returned. - EnvironmentTypeParam: - type: string - enum: - - openai_hosted - description: The hosting type of an execution environment. - EnvironmentTypeResource: - type: string - enum: - - openai_hosted - - self_hosted - description: The kind of execution environment. - EnvironmentStatusResource: + description: Packages installed in an OpenAI-hosted environment. + NetworkAccessResource: type: string enum: - - pending - - ready - - connected - - disconnected - - suspended - - expired - - failed + - enabled + - disabled + - restricted x-enumDescriptions: - - '' - - Provisioning succeeded and the environment is available for attachment or use. - - '' - - '' - - The sandbox is stopped and can be resumed from its private checkpoint. - - '' - - '' - description: The public lifecycle status of an execution environment. - HostedEnvironmentFileResourceFileId: + - Allows unrestricted network access. + - Disables network access. + - Applies the configured domain restrictions. + description: The network access mode for an OpenAI-hosted environment. + NetworkPolicyResource: type: object properties: - type: - type: string - enum: - - file_id - default: file_id - x-stainless-const: true - description: The type of the object. Always `file_id`. - id: - type: string - minLength: 0 - description: The session-scoped ID of the file in the execution environment. - file_id: - type: string - minLength: 0 - description: The ID of the uploaded file. - path: - type: string - minLength: 0 - description: The file's absolute path inside the environment. - size_bytes: - type: integer - format: int64 - minimum: 0 - description: The decoded file size in bytes. + access: + $ref: '#/components/schemas/NetworkAccessResource' + description: The environment's network access mode. + allowed_domains: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Domains the environment may access when network access is restricted. required: - - type - - id - - file_id - - path - - size_bytes + - access + - allowed_domains additionalProperties: false - description: A file copied from the OpenAI Files API. - HostedEnvironmentFileResourceInline: + description: Network access for an OpenAI-hosted environment. + DesktopResource: type: object properties: - type: - type: string - enum: - - inline - default: inline - x-stainless-const: true - description: The type of the object. Always `inline`. - id: - type: string - minLength: 0 - description: The session-scoped ID of the file in the execution environment. - path: - type: string - minLength: 0 - description: The file's absolute path inside the environment. - size_bytes: - type: integer - format: int64 - minimum: 0 - description: The decoded file size in bytes. + enabled: + type: boolean + description: Whether the environment provisions a desktop and browser proxy. required: - - type - - id - - path - - size_bytes + - enabled additionalProperties: false - description: A file supplied inline when the session was created. - HostedEnvironmentFileResource: - description: Metadata for a file materialized in an OpenAI-hosted execution environment. - discriminator: - propertyName: type - mapping: - file_id: '#/components/schemas/HostedEnvironmentFileResourceFileId' - inline: '#/components/schemas/HostedEnvironmentFileResourceInline' - x-oai-discriminator-values: - - file_id - - inline - anyOf: - - $ref: '#/components/schemas/HostedEnvironmentFileResourceFileId' - - $ref: '#/components/schemas/HostedEnvironmentFileResourceInline' - HostedSkillResourceSkillReference: + description: The effective desktop configuration for an OpenAI-hosted environment. + HostedTemplateSkillResourceSkillReference: type: object properties: type: @@ -83142,26 +84750,18 @@ components: minLength: 0 description: The referenced skill ID. version: - type: string - minLength: 0 - description: The concrete skill version installed for this session. - name: - type: string - minLength: 0 - description: The installed skill name. - description: - type: string + type: + - string + - 'null' minLength: 0 - description: The installed skill description. + description: The requested version selector, including `latest`. required: - type - skill_id - version - - name - - description additionalProperties: false - description: A skill installed from the Skills API. - HostedSkillResourceInline: + description: A skill resolved afresh from the Skills API whenever a session starts. + HostedTemplateSkillResourceInline: type: object properties: type: @@ -83174,30 +84774,30 @@ components: name: type: string minLength: 0 - description: The installed skill name. + description: The skill name declared in `SKILL.md`. description: type: string minLength: 0 - description: The installed skill description. + description: The skill description declared in `SKILL.md`. required: - type - name - description additionalProperties: false - description: A skill installed from an inline ZIP archive. - HostedSkillResource: - description: A skill installed in an OpenAI-hosted environment. + description: Safe metadata for an inline skill archive. + HostedTemplateSkillResource: + description: Safe metadata for a skill configured by an environment template. discriminator: propertyName: type mapping: - skill_reference: '#/components/schemas/HostedSkillResourceSkillReference' - inline: '#/components/schemas/HostedSkillResourceInline' + skill_reference: '#/components/schemas/HostedTemplateSkillResourceSkillReference' + inline: '#/components/schemas/HostedTemplateSkillResourceInline' x-oai-discriminator-values: - skill_reference - inline anyOf: - - $ref: '#/components/schemas/HostedSkillResourceSkillReference' - - $ref: '#/components/schemas/HostedSkillResourceInline' + - $ref: '#/components/schemas/HostedTemplateSkillResourceSkillReference' + - $ref: '#/components/schemas/HostedTemplateSkillResourceInline' HostedPluginResourceInline: type: object properties: @@ -83232,517 +84832,1020 @@ components: - inline anyOf: - $ref: '#/components/schemas/HostedPluginResourceInline' - PublicEnvironmentResource: + HostedTemplateFileResourceFileId: type: object properties: type: - $ref: '#/components/schemas/EnvironmentTypeResource' - description: Whether the environment is hosted by OpenAI or by the application. - id: + type: string + enum: + - file_id + default: file_id + x-stainless-const: true + description: The type of the object. Always `file_id`. + file_id: type: string minLength: 0 - description: The ID of the environment. - object: + description: The ID of the uploaded file. + path: + type: string + minLength: 0 + description: The file's absolute path inside the environment. + required: + - type + - file_id + - path + additionalProperties: false + description: A project-scoped Files API reference resolved separately for each session. + HostedTemplateFileResourceInline: + type: object + properties: + type: type: string enum: - - agent.environment - default: agent.environment + - inline + default: inline x-stainless-const: true - description: The object type. Always `agent.environment`. - status: - $ref: '#/components/schemas/EnvironmentStatusResource' - description: The current environment connection status. - files: - type: array + description: The type of the object. Always `inline`. + path: + type: string + minLength: 0 + description: The file's absolute path inside the environment. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The decoded size of the inline file in bytes. + required: + - type + - path + - size_bytes + additionalProperties: false + description: Metadata for confidential inline file contents. + HostedTemplateFileResource: + description: Safe metadata for a file configured by an environment template. + discriminator: + propertyName: type + mapping: + file_id: '#/components/schemas/HostedTemplateFileResourceFileId' + inline: '#/components/schemas/HostedTemplateFileResourceInline' + x-oai-discriminator-values: + - file_id + - inline + anyOf: + - $ref: '#/components/schemas/HostedTemplateFileResourceFileId' + - $ref: '#/components/schemas/HostedTemplateFileResourceInline' + AutomationEnvironmentResourceOpenaiHosted: + type: object + properties: + type: + type: string + enum: + - openai_hosted + default: openai_hosted + x-stainless-const: true + description: The type of the object. Always `openai_hosted`. + environment_id: + type: + - string + - 'null' + minLength: 0 + description: An existing environment reference, or null when provisioning a new environment. + environment_template_id: + type: + - string + - 'null' + minLength: 0 + description: A template reference, or null when no template is selected. + container_size: + anyOf: + - $ref: '#/components/schemas/ContainerSizeResource' + - type: 'null' + description: The configured container size, or null to use the creation default. + packages: + anyOf: + - $ref: '#/components/schemas/EnvironmentPackagesResource' + - type: 'null' + description: Package overrides, or null to inherit the template or creation default. + network: + anyOf: + - $ref: '#/components/schemas/NetworkPolicyResource' + - type: 'null' + description: Network overrides, or null to inherit the template or creation default. + desktop: + anyOf: + - $ref: '#/components/schemas/DesktopResource' + - type: 'null' + description: Desktop overrides, or null to inherit the template or creation default. + capability_directories: + type: + - array + - 'null' items: - $ref: '#/components/schemas/HostedEnvironmentFileResource' + type: string + minLength: 0 minItems: 0 maxItems: 2000 - description: Files installed in the environment, without their contents. + description: Directory overrides, or null to inherit the template or creation default. skills: - type: array + type: + - array + - 'null' items: - $ref: '#/components/schemas/HostedSkillResource' + $ref: '#/components/schemas/HostedTemplateSkillResource' minItems: 0 maxItems: 2000 - description: Skills installed in the environment, without their archive contents. + description: Skill overrides, excluding archive contents, or null to inherit. plugins: - type: array + type: + - array + - 'null' items: $ref: '#/components/schemas/HostedPluginResource' minItems: 0 maxItems: 2000 - description: Plugins installed in the environment, without their archive contents. + description: Plugin overrides, excluding archive contents, or null to inherit. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedTemplateFileResource' + minItems: 0 + maxItems: 2000 + description: File overrides, excluding contents, or null to inherit. required: - - id - - object - type - - status - - files + - environment_id + - environment_template_id + - container_size + - packages + - network + - desktop + - capability_directories - skills - plugins + - files additionalProperties: false - description: Safe metadata for a first-class execution environment. - AgentEnvironmentListResource: + description: Hosted environment selection with confidential setup commands and variables omitted. + AutomationEnvironmentResourceSelfHosted: type: object properties: - object: + type: type: string enum: - - list - default: list + - self_hosted + default: self_hosted x-stainless-const: true - description: The object type, which is always `list`. - data: - type: array - items: - $ref: '#/components/schemas/PublicEnvironmentResource' - minItems: 0 - maxItems: 2000 - description: The resources returned in this page, in the requested sort order. - first_id: + description: The type of the object. Always `self_hosted`. + environment_id: type: - string - 'null' minLength: 0 - description: The ID of the first resource in `data`, or `null` if the page is empty. - last_id: - type: - - string - - 'null' + description: An existing registration, or null to create a session-owned environment. + workspace_directory: + type: string minLength: 0 - description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. - has_more: - type: boolean - description: Whether there are more resources to retrieve after this page. + description: The absolute project directory in the environment. + capability_directories: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Directories that expose capabilities to the agent. required: - - object - - data - - first_id - - last_id - - has_more + - type + - environment_id + - workspace_directory + - capability_directories additionalProperties: false - description: A page of Agents API resources, with IDs for retrieving additional pages. - ErrorBodyResource: + AutomationEnvironmentResource: + description: Environment selection saved before an invocation creates its session. + discriminator: + propertyName: type + mapping: + none: '#/components/schemas/AutomationEnvironmentResourceNone' + openai_hosted: '#/components/schemas/AutomationEnvironmentResourceOpenaiHosted' + self_hosted: '#/components/schemas/AutomationEnvironmentResourceSelfHosted' + x-oai-discriminator-values: + - none + - openai_hosted + - self_hosted + anyOf: + - $ref: '#/components/schemas/AutomationEnvironmentResourceNone' + - $ref: '#/components/schemas/AutomationEnvironmentResourceOpenaiHosted' + - $ref: '#/components/schemas/AutomationEnvironmentResourceSelfHosted' + InputContentResourceInputText: type: object properties: type: type: string - minLength: 0 - description: The error type. - code: + enum: + - input_text + default: input_text + x-stainless-const: true + description: The type of the object. Always `input_text`. + text: type: string minLength: 0 - description: A machine-readable error code. - message: + description: The text supplied to the agent. + required: + - type + - text + additionalProperties: false + description: Text input recorded in a session item. + InputContentResourceInputImage: + type: object + properties: + type: + type: string + enum: + - input_image + default: input_image + x-stainless-const: true + description: The type of the object. Always `input_image`. + image_url: type: string minLength: 0 - description: A human-readable error message. - param: - type: - - string - - 'null' - minLength: 0 - description: The request parameter that caused the error, or null for a request-wide error. + description: The URL of the image supplied to the agent, which may be a base64-encoded data URL. required: - type - - code - - message - - param + - image_url additionalProperties: false - description: Details about an API error. - ErrorResponse-2: + description: Image input recorded in a session item. + InputContentResource: + description: User-provided content recorded in a session item. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/InputContentResourceInputText' + input_image: '#/components/schemas/InputContentResourceInputImage' + x-oai-discriminator-values: + - input_text + - input_image + anyOf: + - $ref: '#/components/schemas/InputContentResourceInputText' + - $ref: '#/components/schemas/InputContentResourceInputImage' + InputMessageResource-2: type: object properties: - error: - $ref: '#/components/schemas/ErrorBodyResource' - description: The error returned by the API. + type: + type: string + enum: + - message + default: message + x-stainless-const: true + description: The type of the input item. Always `message`. + role: + type: string + enum: + - user + default: user + x-stainless-const: true + description: The role of the message author. Always `user`. + content: + type: array + items: + $ref: '#/components/schemas/InputContentResource' + minItems: 0 + maxItems: 2000 + description: The content of the message. required: - - error + - type + - role + - content additionalProperties: false - description: An API error response. - EnvironmentPackagesParam: + description: A user message recorded in a session. + AutomationTargetResourceNewSession: type: object properties: - python: + type: + type: string + enum: + - new_session + default: new_session + x-stainless-const: true + description: The type of the object. Always `new_session`. + agent_id: type: - - array + - string - 'null' + minLength: 0 + description: The saved agent reference, or null when an inline agent is configured. + agent: + anyOf: + - $ref: '#/components/schemas/AutomationAgentConfigResource' + - type: 'null' + description: The inline agent configuration, or null when agent_id is configured. + environment: + $ref: '#/components/schemas/AutomationEnvironmentResource' + description: Configuration or references used to select the execution environment. + input: + type: array items: - type: string - minLength: 0 - maxLength: 1048576 + $ref: '#/components/schemas/InputMessageResource-2' minItems: 0 - maxItems: 16384 - description: Python packages to install. Defaults to an empty list. - system: - type: - - array - - 'null' + maxItems: 2000 + description: Initial input delivered to each new session. + vault_ids: + type: array items: type: string minLength: 0 - maxLength: 1048576 minItems: 0 - maxItems: 16384 - description: System packages to install. Defaults to an empty list. - npm: - type: - - array - - 'null' - items: + maxItems: 2000 + description: Vaults made available to each new session. + metadata: + type: object + additionalProperties: type: string minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: npm packages to install globally. Defaults to an empty list. + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Metadata attached to each new session. + required: + - type + - agent_id + - agent + - environment + - input + - vault_ids + - metadata additionalProperties: false - description: Packages to install in an OpenAI-hosted environment. - SetupCommandParam: + AutomationTargetResourceExistingSession: type: object properties: - command: + type: + type: string + enum: + - existing_session + default: existing_session + x-stainless-const: true + description: The type of the object. Always `existing_session`. + session_id: type: string minLength: 0 - maxLength: 65536 - description: The shell command to execute. - cwd: - type: - - string - - 'null' + description: The session receiving each invocation. + instructions: + type: string minLength: 0 - maxLength: 4096 - description: The absolute working directory. Defaults to `/workspace`. + description: Saved instructions delivered as an automation notification. required: - - command + - type + - session_id + - instructions additionalProperties: false - description: A confidential setup command executed before the hosted agent starts. - NetworkAccessParam: + AutomationTargetResource: + description: Saved target configuration, excluding confidential request-only values. + discriminator: + propertyName: type + mapping: + new_session: '#/components/schemas/AutomationTargetResourceNewSession' + existing_session: '#/components/schemas/AutomationTargetResourceExistingSession' + x-oai-discriminator-values: + - new_session + - existing_session + anyOf: + - $ref: '#/components/schemas/AutomationTargetResourceNewSession' + - $ref: '#/components/schemas/AutomationTargetResourceExistingSession' + AutomationCreatedByResourceDeveloper: + type: object + properties: + type: + type: string + enum: + - developer + default: developer + x-stainless-const: true + description: The type of the object. Always `developer`. + required: + - type + additionalProperties: false + AutomationCreatedByResourceAgent: + type: object + properties: + type: + type: string + enum: + - agent + default: agent + x-stainless-const: true + description: The type of the object. Always `agent`. + session_id: + type: string + minLength: 0 + description: The creator session, which is also the automation's target. + tool_call_id: + type: string + minLength: 0 + description: The tool call that created the automation. + required: + - type + - session_id + - tool_call_id + additionalProperties: false + AutomationCreatedByResource: + description: How the automation was created, independently of how an invocation started. + discriminator: + propertyName: type + mapping: + developer: '#/components/schemas/AutomationCreatedByResourceDeveloper' + agent: '#/components/schemas/AutomationCreatedByResourceAgent' + x-oai-discriminator-values: + - developer + - agent + anyOf: + - $ref: '#/components/schemas/AutomationCreatedByResourceDeveloper' + - $ref: '#/components/schemas/AutomationCreatedByResourceAgent' + PeriodicAutomationStatusResource: type: string enum: - - enabled - - disabled - - restricted - x-enumDescriptions: - - Allows unrestricted network access. - - Disables network access. - - Applies the configured domain restrictions. - description: The network access mode for an OpenAI-hosted environment. - NetworkPolicyParam: + - active + - paused + AutomationResourcePeriodic: type: object properties: - access: - $ref: '#/components/schemas/NetworkAccessParam' - description: The environment's network access mode. - allowed_domains: - type: - - array - - 'null' - items: + type: + type: string + enum: + - periodic + default: periodic + x-stainless-const: true + description: The type of the object. Always `periodic`. + id: + type: string + minLength: 0 + description: The automation ID. + object: + type: string + enum: + - agent.automation + default: agent.automation + x-stainless-const: true + description: Always `agent.automation`. + created_at: + type: integer + format: int64 + description: The creation time as a Unix timestamp in seconds. + name: + type: string + minLength: 0 + description: The automation's display name. + target: + $ref: '#/components/schemas/AutomationTargetResource' + description: The session configuration or existing session receiving invocations. + metadata: + type: object + additionalProperties: type: string minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Domains the environment may access when network access is restricted. - blocked_domains: - type: - - array - - 'null' - items: + propertyNames: type: string minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 100 - description: 'Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.' + minProperties: 0 + description: Custom string key-value pairs attached to the automation. + created_by: + $ref: '#/components/schemas/AutomationCreatedByResource' + description: Service-recorded provenance; callers cannot supply this field. + expression: + type: string + minLength: 0 + description: The cron expression determining scheduled occurrences. + timezone: + type: string + minLength: 0 + description: The timezone used to interpret the expression. + status: + $ref: '#/components/schemas/PeriodicAutomationStatusResource' + description: Whether scheduled delivery is active or paused. required: - - access + - type + - id + - object + - created_at + - name + - target + - metadata + - created_by + - expression + - timezone + - status additionalProperties: false - description: Network access for an OpenAI-hosted environment. - example: - access: restricted - allowed_domains: - - example.com - blocked_domains: [] - DesktopParam: + description: Fields shared by periodic and one-time automations. + OnceAutomationStatusResource: + type: string + enum: + - active + - paused + - completed + AutomationResourceOnce: type: object properties: - enabled: - type: boolean - description: Whether to provision the desktop and its browser proxy. + type: + type: string + enum: + - once + default: once + x-stainless-const: true + description: The type of the object. Always `once`. + id: + type: string + minLength: 0 + description: The automation ID. + object: + type: string + enum: + - agent.automation + default: agent.automation + x-stainless-const: true + description: Always `agent.automation`. + created_at: + type: integer + format: int64 + description: The creation time as a Unix timestamp in seconds. + name: + type: string + minLength: 0 + description: The automation's display name. + target: + $ref: '#/components/schemas/AutomationTargetResource' + description: The session configuration or existing session receiving invocations. + metadata: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Custom string key-value pairs attached to the automation. + created_by: + $ref: '#/components/schemas/AutomationCreatedByResource' + description: Service-recorded provenance; callers cannot supply this field. + run_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, of the scheduled occurrence. + status: + $ref: '#/components/schemas/OnceAutomationStatusResource' + description: Completion means the schedule has finished, not the agent's work. required: - - enabled + - type + - id + - object + - created_at + - name + - target + - metadata + - created_by + - run_at + - status additionalProperties: false - description: Desktop configuration for an OpenAI-hosted environment. - HostedSkillParamSkillReference: + description: Fields shared by periodic and one-time automations. + AutomationResource: + description: A saved automation and its schedule. + discriminator: + propertyName: type + mapping: + periodic: '#/components/schemas/AutomationResourcePeriodic' + once: '#/components/schemas/AutomationResourceOnce' + x-oai-discriminator-values: + - periodic + - once + anyOf: + - $ref: '#/components/schemas/AutomationResourcePeriodic' + - $ref: '#/components/schemas/AutomationResourceOnce' + ErrorBodyResource: type: object properties: type: type: string - enum: - - skill_reference - default: skill_reference - x-stainless-const: true - description: The type of the object. Always `skill_reference`. - skill_id: + minLength: 0 + description: The error type. + code: type: string - minLength: 1 - maxLength: 64 - description: The ID of the skill created through `/v1/skills`. - version: + minLength: 0 + description: A machine-readable error code. + message: + type: string + minLength: 0 + description: A human-readable error message. + param: type: - string - 'null' minLength: 0 - maxLength: 1048576 - description: The skill version, a positive integer or `latest`; omission selects the default. + description: The request parameter that caused the error, or null for a request-wide error. required: - type - - skill_id + - code + - message + - param additionalProperties: false - description: References a skill uploaded through the Skills API. - InlineCapabilitySourceParamBase64: + description: Details about an API error. + ErrorResponse-2: + type: object + properties: + error: + $ref: '#/components/schemas/ErrorBodyResource' + description: The error returned by the API. + required: + - error + additionalProperties: false + description: An API error response. + ReasoningEffortParam: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + description: The amount of reasoning effort the model should use. + ReasoningSummaryParam: + type: string + enum: + - concise + - detailed + - auto + x-enumDescriptions: + - Returns a concise reasoning summary when supported. + - Returns a detailed reasoning summary when supported. + - Automatically selects the most detailed summary supported by the model. + description: The reasoning summary format requested from the model. + ReasoningParam: + type: object + properties: + effort: + anyOf: + - $ref: '#/components/schemas/ReasoningEffortParam' + - type: 'null' + description: The amount of reasoning effort the model should use. Omission lets the model select it. + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryParam' + - type: 'null' + description: Controls whether the response includes a reasoning summary. + additionalProperties: false + description: Reasoning configuration for the agent. + TextFormatParamText: type: object properties: type: type: string enum: - - base64 - default: base64 + - text + default: text x-stainless-const: true - description: The type of the object. Always `base64`. - media_type: + description: The type of the object. Always `text`. + required: + - type + additionalProperties: false + description: Generates ordinary text without a structured-output constraint. + TextFormatParamJsonSchema: + type: object + properties: + type: type: string enum: - - application/zip - default: application/zip + - json_schema + default: json_schema x-stainless-const: true - x-enumDescriptions: - - A ZIP archive. - description: The archive media type, always `application/zip`. - data: - type: string - minLength: 1 - maxLength: 70254592 - description: Standard-base64 encoded ZIP archive bytes. + description: The type of the object. Always `json_schema`. + schema: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: The JSON Schema that generated text must match. required: - type - - media_type - - data + - schema additionalProperties: false - description: Provides ZIP bytes encoded with standard base64. - InlineCapabilitySourceParam: - description: The encoded ZIP archive for an inline skill or plugin. + description: Constrains generated text to a JSON Schema. + TextFormatParam: + description: The output format for generated text. discriminator: propertyName: type mapping: - base64: '#/components/schemas/InlineCapabilitySourceParamBase64' + text: '#/components/schemas/TextFormatParamText' + json_schema: '#/components/schemas/TextFormatParamJsonSchema' x-oai-discriminator-values: - - base64 + - text + - json_schema anyOf: - - $ref: '#/components/schemas/InlineCapabilitySourceParamBase64' - HostedSkillParamInline: + - $ref: '#/components/schemas/TextFormatParamText' + - $ref: '#/components/schemas/TextFormatParamJsonSchema' + VerbosityParam: + type: string + enum: + - low + - medium + - high + x-enumDescriptions: + - Produces less text. + - Uses the default amount of text. + - Produces more text. + description: The amount of text the model should produce. + TextParam: + type: object + properties: + format: + anyOf: + - $ref: '#/components/schemas/TextFormatParam' + - type: 'null' + description: 'The output format. Omission uses ordinary text (`{"type": "text"}`).' + verbosity: + anyOf: + - $ref: '#/components/schemas/VerbosityParam' + - type: 'null' + description: The amount of text the model should produce. Defaults to `medium`, matching Responses. + additionalProperties: false + description: Configuration for text generated by the agent. + ServiceTierParam: + type: string + enum: + - auto + - default + - flex + - priority + - fast + - ultrafast + x-enumDescriptions: + - Selects the service tier automatically. + - Uses the default service tier. + - Uses the flex service tier. + - Uses the priority service tier. + - Uses the fast service tier. + - Uses the ultrafast service tier. + description: The service tier used for model requests. + MultiAgentConfigCurrentParam: + type: object + properties: + enabled: + type: boolean + description: Whether subagent tools are enabled. + max_concurrent_subagents: + type: integer + format: int64 + minimum: 1 + maximum: 4294967295 + description: Maximum number of subagents that may run concurrently. Defaults to 6. + required: + - enabled + additionalProperties: false + description: Explicit configuration for creating and coordinating subagents. + x-openai-go-legacy-bool-fields: + - enabled + AgentToolConfigParamFunction: type: object properties: type: type: string enum: - - inline - default: inline + - function + default: function x-stainless-const: true - description: The type of the object. Always `inline`. + description: The type of the object. Always `function`. name: type: string - minLength: 1 - maxLength: 64 - description: The skill name declared in `SKILL.md`. + minLength: 0 + maxLength: 1048576 + description: The name of the function. description: type: string minLength: 0 maxLength: 1048576 - description: The skill description declared in `SKILL.md`. - source: - $ref: '#/components/schemas/InlineCapabilitySourceParam' - description: The inline ZIP archive. - x-stainless-go-json: omitzero + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + default: false + description: Whether this function is deferred and discovered through tool search. Defaults to `false`. required: - type - name - description - - source + - parameters additionalProperties: false - description: Supplies a skill ZIP directly in the session request. - HostedSkillParam: - description: A skill installed in an OpenAI-hosted environment. - discriminator: - propertyName: type - mapping: - skill_reference: '#/components/schemas/HostedSkillParamSkillReference' - inline: '#/components/schemas/HostedSkillParamInline' - x-oai-discriminator-values: - - skill_reference - - inline - anyOf: - - $ref: '#/components/schemas/HostedSkillParamSkillReference' - - $ref: '#/components/schemas/HostedSkillParamInline' - HostedPluginParamInline: + description: A function defined by the application. + AgentToolConfigParamToolSearch: type: object properties: type: type: string enum: - - inline - default: inline + - tool_search + default: tool_search x-stainless-const: true - description: The type of the object. Always `inline`. - name: - type: string - minLength: 1 - maxLength: 64 - description: The plugin name declared in `.codex-plugin/plugin.json`. - description: - type: string - minLength: 0 - maxLength: 1048576 - description: The plugin description declared in `.codex-plugin/plugin.json`. - source: - $ref: '#/components/schemas/InlineCapabilitySourceParam' - description: The inline ZIP archive. - x-stainless-go-json: omitzero + description: The type of the object. Always `tool_search`. required: - type - - name - - description - - source additionalProperties: false - description: Supplies a plugin ZIP directly in the session request. - HostedPluginParam: - description: A plugin installed in an OpenAI-hosted environment. - discriminator: - propertyName: type - mapping: - inline: '#/components/schemas/HostedPluginParamInline' - x-oai-discriminator-values: - - inline - anyOf: - - $ref: '#/components/schemas/HostedPluginParamInline' - HostedEnvironmentFileParamFileId: + description: Discovers deferred function tools and loads them into the model context. + AgentToolConfigParamProgrammaticToolCalling: type: object properties: type: type: string enum: - - file_id - default: file_id + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true - description: The type of the object. Always `file_id`. - file_id: + description: The type of the object. Always `programmatic_tool_calling`. + enabled: + type: boolean + default: true + description: Whether tools can be called from model-generated code. Defaults to `true`. + required: + - type + additionalProperties: false + description: Enables calling tools from model-generated code. + McpTransportConfigParamHttp: + type: object + properties: + type: type: string - minLength: 1 - maxLength: 256 - description: The ID of the uploaded file. - path: + enum: + - http + default: http + x-stainless-const: true + description: The type of the object. Always `http`. + server_url: type: string - minLength: 1 - maxLength: 4096 - description: The absolute destination path inside `/workspace`. + minLength: 0 + maxLength: 1048576 + description: The URL of the MCP server. + authorization: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The authorization value sent to the MCP server, if any. + headers: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Additional HTTP headers sent to the MCP server. required: - type - - file_id - - path + - server_url additionalProperties: false - description: A file previously uploaded through the OpenAI Files API. - HostedEnvironmentFileParamInline: + description: Connects to an MCP server over HTTP. + McpTransportConfigParamStdio: type: object properties: type: type: string enum: - - inline - default: inline + - stdio + default: stdio x-stainless-const: true - description: The type of the object. Always `inline`. - data: + description: The type of the object. Always `stdio`. + command: type: string minLength: 0 - maxLength: 6990508 - description: The standard-base64-encoded file contents. - path: + maxLength: 1048576 + description: The command used to start the MCP server. + args: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Arguments passed to the MCP server command. + cwd: type: string - minLength: 1 - maxLength: 4096 - description: The absolute destination path inside `/workspace`. + minLength: 0 + maxLength: 1048576 + description: The working directory used to start the MCP server. + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Environment variables set for the MCP server process. + env_vars: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Environment variable names to inherit from the selected execution environment. required: - type - - data - - path + - command + - cwd additionalProperties: false - description: A file supplied directly as standard-base64 data. - HostedEnvironmentFileParam: - description: A file materialized in an OpenAI-hosted execution environment. + description: Starts an MCP server as a local process. + McpTransportConfigParam: + description: The transport used to connect to an MCP server. discriminator: propertyName: type mapping: - file_id: '#/components/schemas/HostedEnvironmentFileParamFileId' - inline: '#/components/schemas/HostedEnvironmentFileParamInline' + http: '#/components/schemas/McpTransportConfigParamHttp' + stdio: '#/components/schemas/McpTransportConfigParamStdio' x-oai-discriminator-values: - - file_id - - inline + - http + - stdio anyOf: - - $ref: '#/components/schemas/HostedEnvironmentFileParamFileId' - - $ref: '#/components/schemas/HostedEnvironmentFileParamInline' - CreateEnvironmentParamOpenaiHosted: + - $ref: '#/components/schemas/McpTransportConfigParamHttp' + - $ref: '#/components/schemas/McpTransportConfigParamStdio' + McpConnectionOriginParam: + type: string + enum: + - service + - environment + x-enumDescriptions: + - Uses the Managed Agents service network. + - Uses the session's execution environment. + description: Where outbound MCP HTTP connections originate. + AgentToolConfigParamMcp: type: object properties: type: type: string enum: - - openai_hosted - default: openai_hosted + - mcp + default: mcp x-stainless-const: true - description: The type of the object. Always `openai_hosted`. - packages: - anyOf: - - $ref: '#/components/schemas/EnvironmentPackagesParam' - - type: 'null' - description: Packages to install in the environment. Defaults to empty package lists. - setup_commands: + description: The type of the object. Always `mcp`. + server_label: + type: string + minLength: 0 + maxLength: 1048576 + description: A label used to identify the MCP server in tool calls. + credential_id: type: - - array + - string - 'null' - items: - $ref: '#/components/schemas/SetupCommandParam' - minItems: 0 - maxItems: 16 - description: Ordered, confidential setup commands. Command bodies are never returned. - network: - anyOf: - - $ref: '#/components/schemas/NetworkPolicyParam' - - type: 'null' - description: Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled. - desktop: - anyOf: - - $ref: '#/components/schemas/DesktopParam' - - type: 'null' - description: Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled. - env: + minLength: 0 + maxLength: 1048576 + description: The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL. + transport: + $ref: '#/components/schemas/McpTransportConfigParam' + description: The transport used to connect to the MCP server. + request_metadata: type: - object - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 1048576 + additionalProperties: {} propertyNames: type: string minLength: 1 maxLength: 256 minProperties: 0 maxProperties: 1024 - description: Environment variables made available to the agent. - capability_directories: + description: Metadata included with requests to this MCP server. + allowed_tools: type: - array - 'null' @@ -83752,60 +85855,94 @@ components: maxLength: 1048576 minItems: 0 maxItems: 16384 - description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. - skills: + description: The MCP tools the agent may call. All server tools are allowed when omitted. + required: + type: boolean + default: false + description: Whether this MCP server must initialize before the first turn. Defaults to `false`. + connection_origin: + anyOf: + - $ref: '#/components/schemas/McpConnectionOriginParam' + - type: 'null' + description: Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment. + required: + - type + - server_label + - transport + additionalProperties: false + description: Tools provided by a remote MCP server. + WebSearchModeParam: + type: string + enum: + - disabled + - cached + - live + x-enumDescriptions: + - Disables web search. + - Uses cached search results. + - Searches the live web. + description: The source used for web search results. + WebSearchContextSizeParam: + type: string + enum: + - low + - medium + - high + description: The amount of web search context made available to the model. + WebSearchLocationParam: + type: object + properties: + country: type: - - array + - string - 'null' - items: - $ref: '#/components/schemas/HostedSkillParam' - minItems: 0 - maxItems: 200 - description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. - plugins: + minLength: 0 + maxLength: 1048576 + description: The two-letter ISO country code, such as `US`. + region: type: - - array + - string - 'null' - items: - $ref: '#/components/schemas/HostedPluginParam' - minItems: 0 - maxItems: 32 - description: Plugins provided as inline ZIP archives. Defaults to an empty list. - files: + minLength: 0 + maxLength: 1048576 + description: The region or state name. + city: type: - - array + - string - 'null' - items: - $ref: '#/components/schemas/HostedEnvironmentFileParam' - minItems: 0 - maxItems: 50 - description: Files available before the agent starts. Defaults to an empty list. - environment_template_id: - type: string minLength: 0 - maxLength: 64 - description: A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy. - required: - - type + maxLength: 1048576 + description: The city name. + timezone: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The IANA timezone, such as `America/Los_Angeles`. additionalProperties: false - description: Provision an OpenAI-hosted environment from inline configuration or a template. - CreateEnvironmentParam: - description: Configuration for a new prewarmed OpenAI-hosted environment. - discriminator: - propertyName: type - mapping: - openai_hosted: '#/components/schemas/CreateEnvironmentParamOpenaiHosted' - x-oai-discriminator-values: - - openai_hosted - anyOf: - - $ref: '#/components/schemas/CreateEnvironmentParamOpenaiHosted' - CreateAgentEnvironmentParams: + description: Approximate user location used to localize web search results. + AgentToolConfigParamWebSearch: type: object properties: - environment: - $ref: '#/components/schemas/CreateEnvironmentParam' - description: The required hosting type and its configuration. - vault_ids: + type: + type: string + enum: + - web_search + default: web_search + x-stainless-const: true + description: The type of the object. Always `web_search`. + mode: + anyOf: + - $ref: '#/components/schemas/WebSearchModeParam' + - type: 'null' + description: The source used for web search results. Defaults to `live`. + context_size: + anyOf: + - $ref: '#/components/schemas/WebSearchContextSizeParam' + - type: 'null' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: type: - array - 'null' @@ -83814,3348 +85951,3173 @@ components: minLength: 0 maxLength: 1048576 minItems: 0 - maxItems: 10 - description: The IDs of up to 10 vaults made available to an OpenAI-hosted environment. - required: - - environment - additionalProperties: false - description: Parameters for creating an execution environment before its sessions. - EnvironmentFilePageObjectResource: - type: string - enum: - - page - default: page - x-stainless-const: true - description: The object type for a page of files in an execution environment. - EnvironmentFileResource: - type: object - properties: - object: - type: string - enum: - - agent.environment.file - default: agent.environment.file - x-stainless-const: true - description: The object type. Always `agent.environment.file`. - environment_id: - type: string - minLength: 0 - description: The ID of the environment containing this file. - path: - type: string - minLength: 0 - description: The absolute file path inside the environment's workspace. - size_bytes: - type: integer - format: int64 - minimum: 0 - description: The file size in bytes. - required: - - object - - environment_id - - path - - size_bytes - additionalProperties: false - description: A live file in an execution environment. - EnvironmentFileListResource: - type: object - properties: - object: - $ref: '#/components/schemas/EnvironmentFilePageObjectResource' - description: The object type. Always `page`. - data: - type: array - items: - $ref: '#/components/schemas/EnvironmentFileResource' - minItems: 0 - maxItems: 2000 - description: Files available on the current page. - next: - type: - - string - - 'null' - minLength: 0 - description: The opaque cursor to use when requesting the next page, if any. - has_more: - type: boolean - description: Whether more files follow this page. + maxItems: 16384 + description: Domains the search may include. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationParam' + - type: 'null' + description: Approximate location used to localize search results. required: - - object - - data - - next - - has_more + - type additionalProperties: false - description: A paginated list of live execution environment files. - SubagentObjectResource: - type: string - enum: - - agent.session.subagent - default: agent.session.subagent - x-stainless-const: true - description: The object type for a subagent. - OutputTextResource: + description: Web search. + AgentToolConfigParamComputerUse: type: object properties: type: type: string enum: - - output_text - default: output_text + - computer_use + default: computer_use x-stainless-const: true - description: The content type. Always `output_text`. - text: - type: string - minLength: 0 - description: The text produced by the agent. + description: The type of the object. Always `computer_use`. + include_screenshots: + type: boolean + default: false + description: Whether computer tool outputs include screenshots. Defaults to `false`. required: - type - - text additionalProperties: false - description: A text content part produced by the agent. - EncryptedContentResource: + description: Browser use in an OpenAI-hosted session. + AgentToolConfigParamAutomations: type: object properties: type: type: string enum: - - encrypted_content - default: encrypted_content + - automations + default: automations x-stainless-const: true - description: The content type. Always `encrypted_content`. - encrypted_content: - type: string - minLength: 0 - description: The encrypted content payload. + description: The type of the object. Always `automations`. required: - type - - encrypted_content additionalProperties: false - description: Encrypted content exchanged between agents. - AgentContentResource: - description: A plaintext or encrypted content part exchanged between agents. + description: Lets the agent manage its own scheduled wakeups. + AgentToolConfigParam: + description: A tool available to the agent. discriminator: propertyName: type mapping: - output_text: '#/components/schemas/OutputTextResource' - encrypted_content: '#/components/schemas/EncryptedContentResource' + function: '#/components/schemas/AgentToolConfigParamFunction' + tool_search: '#/components/schemas/AgentToolConfigParamToolSearch' + programmatic_tool_calling: '#/components/schemas/AgentToolConfigParamProgrammaticToolCalling' + mcp: '#/components/schemas/AgentToolConfigParamMcp' + web_search: '#/components/schemas/AgentToolConfigParamWebSearch' + computer_use: '#/components/schemas/AgentToolConfigParamComputerUse' + automations: '#/components/schemas/AgentToolConfigParamAutomations' x-oai-discriminator-values: - - output_text - - encrypted_content + - function + - tool_search + - programmatic_tool_calling + - mcp + - web_search + - computer_use + - automations anyOf: - - $ref: '#/components/schemas/OutputTextResource' - - $ref: '#/components/schemas/EncryptedContentResource' - SubagentStatusResource: - type: string - enum: - - active - - closed - x-enumDescriptions: - - The subagent remains available, including while idle between turns. - - The subagent is closed. - description: The current status of a subagent. - SubagentResource: + - $ref: '#/components/schemas/AgentToolConfigParamFunction' + - $ref: '#/components/schemas/AgentToolConfigParamToolSearch' + - $ref: '#/components/schemas/AgentToolConfigParamProgrammaticToolCalling' + - $ref: '#/components/schemas/AgentToolConfigParamMcp' + - $ref: '#/components/schemas/AgentToolConfigParamWebSearch' + - $ref: '#/components/schemas/AgentToolConfigParamComputerUse' + - $ref: '#/components/schemas/AgentToolConfigParamAutomations' + SessionAgentConfigParam: type: object properties: - id: - type: string - minLength: 0 - description: The ID of the subagent. - object: - $ref: '#/components/schemas/SubagentObjectResource' - description: The object type. Always `agent.session.subagent`. - session_id: + model: type: string minLength: 0 - description: The ID of the session that owns the subagent. - name: + maxLength: 1048576 + description: The model to use for the agent. The requested model name is preserved. + reasoning: + anyOf: + - $ref: '#/components/schemas/ReasoningParam' + - type: 'null' + description: Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort. + text: + anyOf: + - $ref: '#/components/schemas/TextParam' + - type: 'null' + description: Configuration for text generated by the agent. + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierParam' + - type: 'null' + description: The service tier used for model requests. + instructions: type: - string - 'null' minLength: 0 - description: The runner-assigned nickname, or null when unavailable. - instructions: + maxLength: 1048576 + description: Additional instructions appended to the agent's default base instructions. Omit to leave unchanged. + multi_agent: + anyOf: + - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' + - type: 'null' + description: Configuration for creating and coordinating subagents. + tools: type: - array - 'null' items: - $ref: '#/components/schemas/AgentContentResource' + $ref: '#/components/schemas/AgentToolConfigParam' minItems: 0 - maxItems: 2000 - description: Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available. - parent_agent_id: - type: string - minLength: 0 - description: The ID of the agent that created this subagent. - status: - $ref: '#/components/schemas/SubagentStatusResource' - description: The current status of the subagent. - opened_at: - type: integer - format: int64 - description: The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it. - closed_at: - type: - - integer - - 'null' - format: int64 - description: The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume. - required: - - id - - object - - session_id - - name - - instructions - - parent_agent_id - - status - - opened_at - - closed_at + maxItems: 16384 + description: Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. additionalProperties: false - description: A subagent created within a session. - SessionMessageRoleResource: - type: string - enum: - - user - - assistant - description: The author of a session message. - MessageContentResourceInputText: + description: Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field; null resets nullable fields. + EnvironmentParamNone: type: object properties: type: type: string enum: - - input_text - default: input_text + - none + default: none x-stainless-const: true - description: The type of the object. Always `input_text`. - text: - type: string - minLength: 0 - description: The text supplied by the user. + description: The type of the object. Always `none`. required: - type - - text additionalProperties: false - description: Text supplied by the user. - MessageContentResourceInputImage: + description: Runs the agent without an execution environment. + EnvironmentPackagesParam: type: object properties: - type: - type: string - enum: - - input_image - default: input_image - x-stainless-const: true - description: The type of the object. Always `input_image`. - image_url: - type: string - minLength: 0 - description: The URL of the image supplied by the user, which may be a base64-encoded data URL. - required: - - type - - image_url + python: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Python packages to install. Defaults to an empty list. + system: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: System packages to install. Defaults to an empty list. + npm: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: npm packages to install globally. Defaults to an empty list. additionalProperties: false - description: An image supplied by the user. - MessageContentResourceOutputText: + description: Packages to install in an OpenAI-hosted environment. + SetupCommandParam: type: object properties: - type: - type: string - enum: - - output_text - default: output_text - x-stainless-const: true - description: The type of the object. Always `output_text`. - text: + command: type: string minLength: 0 - description: The text produced by the assistant. + maxLength: 65536 + description: The shell command to execute. + cwd: + type: + - string + - 'null' + minLength: 0 + maxLength: 4096 + description: The absolute working directory. Defaults to `/workspace`. required: - - type - - text + - command additionalProperties: false - description: Text produced by the assistant. - MessageContentResource: - description: A content part in a session message. - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/MessageContentResourceInputText' - input_image: '#/components/schemas/MessageContentResourceInputImage' - output_text: '#/components/schemas/MessageContentResourceOutputText' - x-oai-discriminator-values: - - input_text - - input_image - - output_text - anyOf: - - $ref: '#/components/schemas/MessageContentResourceInputText' - - $ref: '#/components/schemas/MessageContentResourceInputImage' - - $ref: '#/components/schemas/MessageContentResourceOutputText' - OutputItemStatusResource: - type: string - enum: - - in_progress - - completed - - incomplete - x-enumDescriptions: - - The item is in progress. - - The item is complete. - - The item stopped before completing. - description: The status of an agent output item. - MessagePhaseResource: + description: A confidential setup command executed before the hosted agent starts. + NetworkAccessParam: type: string enum: - - commentary - - final_answer + - enabled + - disabled + - restricted x-enumDescriptions: - - Commentary produced while the agent works. - - The agent's final answer. - description: The phase of an assistant message. - MessageItemResource: - type: object - properties: - type: - type: string - enum: - - message - default: message - x-stainless-const: true - description: The item type. Always `message`. - id: + - Allows unrestricted network access. + - Disables network access. + - Applies the configured domain restrictions. + description: The network access mode for an OpenAI-hosted environment. + NetworkPolicyParam: + type: object + properties: + access: + $ref: '#/components/schemas/NetworkAccessParam' + description: The environment's network access mode. + allowed_domains: type: - - string + - array - 'null' - minLength: 0 - description: The ID of this item, or null for legacy user messages whose ID was not recorded. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - role: - $ref: '#/components/schemas/SessionMessageRoleResource' - description: The role of the message author. - content: - type: array items: - $ref: '#/components/schemas/MessageContentResource' + type: string + minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: The content of the message. User messages contain input text or images; assistant messages contain output text. - status: - $ref: '#/components/schemas/OutputItemStatusResource' - description: The status of the message. User messages are always `completed`. - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhaseResource' - - type: 'null' - description: The phase of an assistant message. Null for user messages. + maxItems: 16384 + description: Domains the environment may access when network access is restricted. + blocked_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 100 + description: 'Domains blocked for both executor and browser when access is restricted. A nonempty list requires `access: restricted` and cannot be combined with nonempty `allowed_domains`. Wildcard domains are not supported.' required: - - type - - id - - turn_id - - role - - content - - status - - phase + - access additionalProperties: false - description: A user or assistant message recorded in a session. - SummaryTextResource: + description: Network access for an OpenAI-hosted environment. + example: + access: restricted + allowed_domains: + - example.com + blocked_domains: [] + DesktopParam: type: object properties: - type: - type: string - enum: - - summary_text - default: summary_text - x-stainless-const: true - description: The content type. Always `summary_text`. - text: - type: string - minLength: 0 - description: The reasoning summary text. + enabled: + type: boolean + description: Whether to provision the desktop and its browser proxy. required: - - type - - text + - enabled additionalProperties: false - description: A reasoning summary content part. - ReasoningItemResource: + description: Desktop configuration for an OpenAI-hosted environment. + HostedSkillParamSkillReference: type: object properties: type: type: string enum: - - reasoning - default: reasoning + - skill_reference + default: skill_reference x-stainless-const: true - description: The item type. Always `reasoning`. - id: - type: string - minLength: 0 - description: The ID of the reasoning item. - turn_id: + description: The type of the object. Always `skill_reference`. + skill_id: type: string + minLength: 1 + maxLength: 64 + description: The ID of the skill created through `/v1/skills`. + version: + type: + - string + - 'null' minLength: 0 - description: The ID of the turn that contains this item. - summary: - type: array - items: - $ref: '#/components/schemas/SummaryTextResource' - minItems: 0 - maxItems: 2000 - description: The reasoning summaries produced by the agent. - status: - anyOf: - - $ref: '#/components/schemas/OutputItemStatusResource' - - type: 'null' - description: The status of the reasoning item. + maxLength: 1048576 + description: The skill version, a positive integer or `latest`; omission selects the default. required: - type - - id - - turn_id - - summary - - status + - skill_id additionalProperties: false - description: A reasoning item produced by the agent. - FunctionCallStatusResource: - type: string - enum: - - in_progress - - completed - - failed - - incomplete - x-enumDescriptions: - - The call is in progress. - - The call completed successfully. - - The call failed. - - The call stopped before completing. - description: The status of a tool call. - FunctionCallItemResource: + description: References a skill uploaded through the Skills API. + InlineCapabilitySourceParamBase64: type: object properties: type: type: string enum: - - function_call - default: function_call + - base64 + default: base64 x-stainless-const: true - description: The item type. Always `function_call`. - id: - type: string - minLength: 0 - description: The ID of the function call item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - call_id: + description: The type of the object. Always `base64`. + media_type: type: string - minLength: 0 - description: The ID used to submit the function result. - name: + enum: + - application/zip + default: application/zip + x-stainless-const: true + x-enumDescriptions: + - A ZIP archive. + description: The archive media type, always `application/zip`. + data: type: string - minLength: 0 - description: The name of the function to call. - arguments: - description: The arguments to pass to the function. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the function call. + minLength: 1 + maxLength: 70254592 + description: Standard-base64 encoded ZIP archive bytes. required: - type - - id - - turn_id - - call_id - - name - - arguments - - status + - media_type + - data additionalProperties: false - description: A function call produced by the agent. - InputContentResourceInputText: + description: Provides ZIP bytes encoded with standard base64. + InlineCapabilitySourceParam: + description: The encoded ZIP archive for an inline skill or plugin. + discriminator: + propertyName: type + mapping: + base64: '#/components/schemas/InlineCapabilitySourceParamBase64' + x-oai-discriminator-values: + - base64 + anyOf: + - $ref: '#/components/schemas/InlineCapabilitySourceParamBase64' + HostedSkillParamInline: type: object properties: type: type: string enum: - - input_text - default: input_text + - inline + default: inline x-stainless-const: true - description: The type of the object. Always `input_text`. - text: + description: The type of the object. Always `inline`. + name: + type: string + minLength: 1 + maxLength: 64 + description: The skill name declared in `SKILL.md`. + description: type: string minLength: 0 - description: The text supplied to the agent. + maxLength: 1048576 + description: The skill description declared in `SKILL.md`. + source: + $ref: '#/components/schemas/InlineCapabilitySourceParam' + description: The inline ZIP archive. + x-stainless-go-json: omitzero required: - type - - text + - name + - description + - source additionalProperties: false - description: Text input recorded in a session item. - InputContentResourceInputImage: + description: Supplies a skill ZIP directly in the session request. + HostedSkillParam: + description: A skill installed in an OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + skill_reference: '#/components/schemas/HostedSkillParamSkillReference' + inline: '#/components/schemas/HostedSkillParamInline' + x-oai-discriminator-values: + - skill_reference + - inline + anyOf: + - $ref: '#/components/schemas/HostedSkillParamSkillReference' + - $ref: '#/components/schemas/HostedSkillParamInline' + HostedPluginParamInline: type: object properties: type: type: string enum: - - input_image - default: input_image + - inline + default: inline x-stainless-const: true - description: The type of the object. Always `input_image`. - image_url: + description: The type of the object. Always `inline`. + name: + type: string + minLength: 1 + maxLength: 64 + description: The plugin name declared in `.codex-plugin/plugin.json`. + description: type: string minLength: 0 - description: The URL of the image supplied to the agent, which may be a base64-encoded data URL. + maxLength: 1048576 + description: The plugin description declared in `.codex-plugin/plugin.json`. + source: + $ref: '#/components/schemas/InlineCapabilitySourceParam' + description: The inline ZIP archive. + x-stainless-go-json: omitzero required: - type - - image_url + - name + - description + - source additionalProperties: false - description: Image input recorded in a session item. - InputContentResource: - description: User-provided content recorded in a session item. + description: Supplies a plugin ZIP directly in the session request. + HostedPluginParam: + description: A plugin installed in an OpenAI-hosted environment. discriminator: propertyName: type mapping: - input_text: '#/components/schemas/InputContentResourceInputText' - input_image: '#/components/schemas/InputContentResourceInputImage' + inline: '#/components/schemas/HostedPluginParamInline' x-oai-discriminator-values: - - input_text - - input_image - anyOf: - - $ref: '#/components/schemas/InputContentResourceInputText' - - $ref: '#/components/schemas/InputContentResourceInputImage' - FunctionCallOutputResource: - description: The text or model-input content supplied as a function result. + - inline anyOf: - - type: string - minLength: 0 - - type: array - items: - $ref: '#/components/schemas/InputContentResource' - minItems: 0 - maxItems: 2000 - FunctionCallOutputItemResource: + - $ref: '#/components/schemas/HostedPluginParamInline' + HostedEnvironmentFileParamFileId: type: object properties: - id: - type: string - minLength: 0 - description: The ID of the function call output item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. type: type: string enum: - - function_call_output - default: function_call_output + - file_id + default: file_id x-stainless-const: true - description: The item type. Always `function_call_output`. - call_id: + description: The type of the object. Always `file_id`. + file_id: type: string - minLength: 0 - description: The ID of the function call that produced this output. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the function call. - output: - anyOf: - - $ref: '#/components/schemas/FunctionCallOutputResource' - - type: 'null' - description: The function result, if the call succeeded. - error: - type: - - string - - 'null' - minLength: 0 - description: The error message, if the call failed. + minLength: 1 + maxLength: 256 + description: The ID of the uploaded file. + path: + type: string + minLength: 1 + maxLength: 4096 + description: The absolute destination path inside `/workspace`. required: - - id - - turn_id - type - - call_id - - status - - output - - error + - file_id + - path additionalProperties: false - description: The result supplied for a function call. - AgentMessageItemResource: + description: A file previously uploaded through the OpenAI Files API. + HostedEnvironmentFileParamInline: type: object properties: - id: - type: string - minLength: 0 - description: The ID of the message. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. type: type: string enum: - - agent_message - default: agent_message + - inline + default: inline x-stainless-const: true - description: The item type. Always `agent_message`. - sender_agent_id: + description: The type of the object. Always `inline`. + data: type: string minLength: 0 - description: The ID or name of the sending agent. - recipient_agent_id: + maxLength: 6990508 + description: The standard-base64-encoded file contents. + path: type: string - minLength: 0 - description: The ID or name of the receiving agent. - content: - type: array - items: - $ref: '#/components/schemas/AgentContentResource' - minItems: 0 - maxItems: 2000 - description: The content exchanged between the agents. + minLength: 1 + maxLength: 4096 + description: The absolute destination path inside `/workspace`. required: - - id - - turn_id - type - - sender_agent_id - - recipient_agent_id - - content + - data + - path additionalProperties: false - description: A message exchanged between agent threads. - McpCallItemResource: + description: A file supplied directly as standard-base64 data. + HostedEnvironmentFileParam: + description: A file materialized in an OpenAI-hosted execution environment. + discriminator: + propertyName: type + mapping: + file_id: '#/components/schemas/HostedEnvironmentFileParamFileId' + inline: '#/components/schemas/HostedEnvironmentFileParamInline' + x-oai-discriminator-values: + - file_id + - inline + anyOf: + - $ref: '#/components/schemas/HostedEnvironmentFileParamFileId' + - $ref: '#/components/schemas/HostedEnvironmentFileParamInline' + ContainerSizeParam: + type: string + enum: + - small + - medium + - large + description: The CPU and memory tier for a new OpenAI-hosted session environment. + EnvironmentParamOpenaiHosted: type: object properties: type: type: string enum: - - mcp_call - default: mcp_call + - openai_hosted + default: openai_hosted x-stainless-const: true - description: The item type. Always `mcp_call`. - id: - type: string - minLength: 0 - description: The ID of the MCP call item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - server_label: + description: The type of the object. Always `openai_hosted`. + packages: + anyOf: + - $ref: '#/components/schemas/EnvironmentPackagesParam' + - type: 'null' + description: Packages to install in the environment. Defaults to empty package lists. + setup_commands: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Ordered, confidential setup commands. Command bodies are never returned. + network: + anyOf: + - $ref: '#/components/schemas/NetworkPolicyParam' + - type: 'null' + description: Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled. + desktop: + anyOf: + - $ref: '#/components/schemas/DesktopParam' + - type: 'null' + description: Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled. + x-openai-go-legacy-bool-fields: + - enabled + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Environment variables made available to the agent. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Plugins provided as inline ZIP archives. Defaults to an empty list. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Files available before the agent starts. Defaults to an empty list. + environment_id: type: string - minLength: 0 - description: The label of the MCP server. - name: + minLength: 9 + maxLength: 256 + description: An existing prewarmed environment. Cannot be combined with a template or inline configuration. + environment_template_id: type: string minLength: 0 - description: The name of the MCP tool. - arguments: - description: The arguments passed to the MCP tool. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the MCP tool call. - output: - anyOf: - - {} - - type: 'null' - description: The output returned by the MCP tool, if any. - error: - anyOf: - - {} - - type: 'null' - description: The error returned by the MCP tool, if any. + maxLength: 64 + description: A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy. + container_size: + $ref: '#/components/schemas/ContainerSizeParam' + description: The hosted container size. Omission selects the medium tier. + x-stainless-skip: + - cli required: - type - - id - - turn_id - - server_label - - name - - arguments - - status - - output - - error additionalProperties: false - description: A call to a tool on an MCP server. - ComputerScreenshotResource: + description: An existing OpenAI-hosted environment or new inline/template-based hosted configuration. + not: + required: + - environment_id + anyOf: + - required: + - packages + - required: + - setup_commands + - required: + - network + - required: + - desktop + - required: + - env + - required: + - capability_directories + - required: + - skills + - required: + - plugins + - required: + - files + - required: + - environment_template_id + - required: + - container_size + EnvironmentParamSelfHosted: type: object properties: type: type: string enum: - - computer_screenshot - default: computer_screenshot + - self_hosted + default: self_hosted x-stainless-const: true - description: The content type. Always `computer_screenshot`. - image_url: + description: The type of the object. Always `self_hosted`. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + workspace_directory: type: string minLength: 0 - description: The complete JPEG image as a base64 data URL. + maxLength: 1048576 + description: Absolute project directory inside the self-hosted environment. required: - type - - image_url + - workspace_directory additionalProperties: false - description: A browser screenshot emitted by the model during computer use. - ComputerUseCallItemResource: + description: An application-hosted environment configured inline. + EnvironmentParam: + description: The execution environment and optional reusable template for a session. + discriminator: + propertyName: type + mapping: + none: '#/components/schemas/EnvironmentParamNone' + openai_hosted: '#/components/schemas/EnvironmentParamOpenaiHosted' + self_hosted: '#/components/schemas/EnvironmentParamSelfHosted' + x-oai-discriminator-values: + - none + - openai_hosted + - self_hosted + anyOf: + - $ref: '#/components/schemas/EnvironmentParamNone' + - $ref: '#/components/schemas/EnvironmentParamOpenaiHosted' + - $ref: '#/components/schemas/EnvironmentParamSelfHosted' + InputContentParamInputText: type: object properties: type: type: string enum: - - computer_use_call - default: computer_use_call + - input_text + default: input_text x-stainless-const: true - description: The item type. Always `computer_use_call`. - id: - type: string - minLength: 0 - description: The ID of the activity item. - turn_id: + description: The type of the object. Always `input_text`. + text: type: string minLength: 0 - description: The ID of the turn that contains this item. - title: - type: - - string - - 'null' - minLength: 0 - description: A model-generated description of the activity, when available. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The execution status of the activity. - output: - anyOf: - - $ref: '#/components/schemas/ComputerScreenshotResource' - - type: 'null' - description: The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot. + maxLength: 1048576 + description: The text sent to the model. required: - type - - id - - turn_id - - title - - status - - output + - text additionalProperties: false - description: One execution of the platform-provided computer-use capability. - BrowserAuthenticationFieldResource: + description: Text input to the model. + InputContentParamInputImage: type: object properties: - id: - type: string - minLength: 0 - description: The field ID to submit as field_id in a fields entry. - label: - type: string - minLength: 0 - description: The label to display beside the control. type: + type: string + enum: + - input_image + default: input_image + x-stainless-const: true + description: The type of the object. Always `input_image`. + image_url: type: string minLength: 0 - description: The rendering type, such as email, password, or text. - required: - type: boolean - description: Whether this control requires a nonempty value. + maxLength: 1048576 + description: The URL of the image sent to the model. required: - - id - - label - type - - required + - image_url additionalProperties: false - description: A control in a registered browser-login form. - BrowserAuthenticationOptionResource: + description: Image input to the model. + InputContentParam: + description: Content included in an input message. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/InputContentParamInputText' + input_image: '#/components/schemas/InputContentParamInputImage' + x-oai-discriminator-values: + - input_text + - input_image + anyOf: + - $ref: '#/components/schemas/InputContentParamInputText' + - $ref: '#/components/schemas/InputContentParamInputImage' + InputMessageParam: type: object properties: - id: + type: type: string - minLength: 0 - description: The option ID to submit as selected_option. - label: + enum: + - message + default: message + x-stainless-const: true + description: The type of the input item. Always `message`. + role: type: string - minLength: 0 - description: The method label to display. - field_ids: + enum: + - user + default: user + x-stainless-const: true + description: The role of the message author. Always `user`. + content: type: array items: - type: string - minLength: 0 + $ref: '#/components/schemas/InputContentParam' minItems: 0 - maxItems: 2000 - description: IDs from the registered fields that this method accepts. + maxItems: 16384 + description: The content of the message. required: - - id - - label - - field_ids + - role + - content additionalProperties: false - description: A sign-in method and the fields that belong to it. - BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication: + description: A user message submitted to a session. + AutomationTargetParamNewSession: type: object properties: type: type: string enum: - - browser_authentication - default: browser_authentication + - new_session + default: new_session x-stainless-const: true - description: The type of the object. Always `browser_authentication`. - reason: - type: - - string - - 'null' - minLength: 0 - description: Why the agent needs the user to sign in. - credential_origin: - type: - - string - - 'null' + description: The type of the object. Always `new_session`. + agent: + $ref: '#/components/schemas/SessionAgentConfigParam' + description: Inline agent configuration. Provide exactly one of agent and agent_id. + agent_id: + type: string minLength: 0 - description: The registered form or frame origin where values will be entered. - fields: + maxLength: 64 + description: A saved agent ID. Provide exactly one of agent and agent_id. + environment: + $ref: '#/components/schemas/EnvironmentParam' + description: The execution environment for each new session. + input: type: array items: - $ref: '#/components/schemas/BrowserAuthenticationFieldResource' + $ref: '#/components/schemas/InputMessageParam' minItems: 0 - maxItems: 2000 - description: Controls to render. All submitted values are sensitive. - options: - type: array + maxItems: 16384 + description: Initial user messages submitted with each new session. + vault_ids: + type: + - array + - 'null' items: - $ref: '#/components/schemas/BrowserAuthenticationOptionResource' + type: string + minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: Sign-in methods. Empty for a plain form. + maxItems: 16384 + description: The IDs of vaults made available to each new session. + metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Metadata attached to each new session. required: - type - - reason - - credential_origin - - fields - - options + - environment + - input additionalProperties: false - description: A registered form awaiting the application's response. - BrowserAuthenticationHistoryRequestKindResource: - x-oai-discriminator-values: - - browser_authentication - discriminator: - propertyName: type - mapping: - browser_authentication: '#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication' - anyOf: - - $ref: '#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication' - BrowserAuthenticationRequestItemResource: + description: Create a session for each invocation. + AutomationTargetParamExistingSession: type: object properties: - turn_id: + type: type: string - minLength: 0 - request_id: + enum: + - existing_session + default: existing_session + x-stainless-const: true + description: The type of the object. Always `existing_session`. + session_id: type: string minLength: 0 - request: - $ref: '#/components/schemas/BrowserAuthenticationHistoryRequestKindResource' - id: + maxLength: 1048576 + description: The session receiving each invocation. + instructions: type: string minLength: 0 - description: The stable history item ID. - type: - type: string - enum: - - computer_use_approval_request - default: computer_use_approval_request - x-stainless-const: true - description: The item type. Always computer_use_approval_request. + maxLength: 1048576 + description: Instructions delivered as an automation notification. required: - - turn_id - - request_id - - request - - id - type + - session_id + - instructions additionalProperties: false - description: A credential-free history record of the emitted login request. - ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource: + description: Deliver instructions to an existing session. + AutomationTargetParam: + description: The session an automation invocation targets. + discriminator: + propertyName: type + mapping: + new_session: '#/components/schemas/AutomationTargetParamNewSession' + existing_session: '#/components/schemas/AutomationTargetParamExistingSession' + x-oai-discriminator-values: + - new_session + - existing_session + anyOf: + - $ref: '#/components/schemas/AutomationTargetParamNewSession' + - $ref: '#/components/schemas/AutomationTargetParamExistingSession' + CreateAutomationParamsPeriodic: type: object properties: type: type: string enum: - - browser_authentication - default: browser_authentication + - periodic + default: periodic x-stainless-const: true - action: + description: The type of the object. Always `periodic`. + name: type: string - enum: - - submit - default: submit - x-stainless-const: true - selected_option: - type: - - string - - 'null' - minLength: 0 - description: The chosen sign-in method, or null when no options were offered. + minLength: 1 + maxLength: 256 + description: A human-readable name for the automation. + target: + $ref: '#/components/schemas/AutomationTargetParam' + metadata: + $ref: '#/components/schemas/AutomationMetadataParam' + expression: + type: string + minLength: 1 + maxLength: 256 + description: A standard five-field cron expression defining scheduled occurrences. + timezone: + type: string + minLength: 1 + maxLength: 128 + description: The IANA timezone used to interpret the cron expression. required: - type - - action - - selected_option + - name + - target + - expression + - timezone additionalProperties: false - ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource: + CreateAutomationParamsOnce: type: object properties: type: type: string enum: - - browser_authentication - default: browser_authentication + - once + default: once x-stainless-const: true - action: + description: The type of the object. Always `once`. + name: type: string - enum: - - cancel - default: cancel - x-stainless-const: true + minLength: 1 + maxLength: 256 + description: A human-readable name for the automation. + target: + $ref: '#/components/schemas/AutomationTargetParam' + metadata: + $ref: '#/components/schemas/AutomationMetadataParam' + run_at: + type: integer + format: int64 + description: A future Unix timestamp in seconds. required: - type - - action + - name + - target + - run_at additionalProperties: false - ComputerUseApprovalResponseKindResource: - x-oai-discriminator-values: - - submit - - cancel + CreateAutomationParams: + description: Creates an automation without invoking it immediately. discriminator: - propertyName: action + propertyName: type mapping: - submit: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource' - cancel: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource' + periodic: '#/components/schemas/CreateAutomationParamsPeriodic' + once: '#/components/schemas/CreateAutomationParamsOnce' + x-oai-discriminator-values: + - periodic + - once anyOf: - - $ref: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource' - - $ref: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource' - ComputerUseApprovalRequestResultItemResource: + - $ref: '#/components/schemas/CreateAutomationParamsPeriodic' + - $ref: '#/components/schemas/CreateAutomationParamsOnce' + UpdateAutomationParams: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 256 + target: + $ref: '#/components/schemas/AutomationTargetParam' + description: Replaces the complete target, retaining its type and any creator session. + metadata: + type: object + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Replaces all metadata; omit to leave unchanged. + expression: + type: string + minLength: 1 + maxLength: 256 + description: Only accepted for periodic automations. + timezone: + type: string + minLength: 1 + maxLength: 128 + description: Only accepted for periodic automations. + run_at: + type: integer + format: int64 + description: A future Unix timestamp in seconds; accepted only before a one-time scheduled invocation exists. + additionalProperties: false + description: Updates configuration; timing fields must match the stored automation type. + DeletedAutomationResource: type: object properties: id: type: string minLength: 0 - description: The stable history item ID. - type: + description: The deleted automation ID. + object: type: string enum: - - computer_use_approval_request_result - default: computer_use_approval_request_result + - agent.automation.deleted + default: agent.automation.deleted x-stainless-const: true - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - request_id: - type: string - minLength: 0 - description: The registered request answered by this item. - response: - $ref: '#/components/schemas/ComputerUseApprovalResponseKindResource' - description: The admitted response, without submitted credential values. + description: Always `agent.automation.deleted`. + deleted: + type: boolean + description: Always true. required: - id - - type - - turn_id - - request_id - - response + - object + - deleted additionalProperties: false - description: A credential-free record of an admitted response, not proof of completion. - WebSearchActionResourceSearch: + AutomationInvocationSourceResourceManual: type: object properties: type: type: string enum: - - search - default: search + - manual + default: manual x-stainless-const: true - description: The type of the object. Always `search`. - query: - type: - - string - - 'null' - minLength: 0 - description: The search query, when a single query was used. - queries: - type: - - array - - 'null' - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: The search queries, when multiple queries were used. + description: The type of the object. Always `manual`. required: - type - - query - - queries additionalProperties: false - description: A search query or group of search queries. - WebSearchActionResourceOpenPage: + AutomationInvocationSourceResourceAutomation: type: object properties: type: type: string enum: - - open_page - default: open_page + - automation + default: automation x-stainless-const: true - description: The type of the object. Always `open_page`. - url: - type: - - string - - 'null' - minLength: 0 - description: The URL of the page that was opened. + description: The type of the object. Always `automation`. + automation: + $ref: '#/components/schemas/AutomationResource' + description: The automation snapshot for this occurrence, excluding confidential values. required: - type - - url + - automation additionalProperties: false - description: Opens a web page. - WebSearchActionResourceFindInPage: + AutomationInvocationSourceResource: + x-oai-discriminator-values: + - manual + - automation + discriminator: + propertyName: type + mapping: + manual: '#/components/schemas/AutomationInvocationSourceResourceManual' + automation: '#/components/schemas/AutomationInvocationSourceResourceAutomation' + anyOf: + - $ref: '#/components/schemas/AutomationInvocationSourceResourceManual' + - $ref: '#/components/schemas/AutomationInvocationSourceResourceAutomation' + AutomationInvocationStatusResource: + type: string + enum: + - queued + - completed + - failed + - skipped + AutomationInvocationErrorResource: type: object properties: - type: + code: + type: string + minLength: 0 + description: A machine-readable error code. + message: + type: string + minLength: 0 + description: A public explanation of the delivery failure. + required: + - code + - message + additionalProperties: false + AutomationInvocationResource: + type: object + properties: + id: + type: string + minLength: 0 + description: The invocation ID. + object: type: string enum: - - find_in_page - default: find_in_page + - agent.automation.invocation + default: agent.automation.invocation x-stainless-const: true - description: The type of the object. Always `find_in_page`. - url: + description: Always `agent.automation.invocation`. + automation_id: + type: string + minLength: 0 + description: The automation that owns the invocation. + created_at: + type: integer + format: int64 + description: The creation time as a Unix timestamp in seconds. + source: + $ref: '#/components/schemas/AutomationInvocationSourceResource' + description: Whether the invocation was manual or scheduled. + scheduled_at: + type: + - integer + - 'null' + format: int64 + description: The intended occurrence as a Unix timestamp in seconds, or null for manual runs. + session_id: type: - string - 'null' minLength: 0 - description: The URL of the page that was searched. - pattern: + description: The target or newly created session ID, or null before one is available. + status: + $ref: '#/components/schemas/AutomationInvocationStatusResource' + description: Delivery status; completed does not mean the agent's work has finished. + skip_reason: type: - string - 'null' - minLength: 0 - description: The text pattern that was searched for. - required: - - type - - url - - pattern - additionalProperties: false - description: Finds text within a web page. - WebSearchActionResourceOther: - type: object - properties: - type: - type: string enum: - - other - default: other + - pending_delivery + - null + default: pending_delivery x-stainless-const: true - description: The type of the object. Always `other`. + description: Why an occurrence was skipped, or null when it was not skipped. + error: + anyOf: + - $ref: '#/components/schemas/AutomationInvocationErrorResource' + - type: 'null' + description: The permanent delivery failure, or null when no failure occurred. required: - - type + - id + - object + - automation_id + - created_at + - source + - scheduled_at + - session_id + - status + - skip_reason + - error additionalProperties: false - description: Another web search action. - WebSearchActionResource: - description: An action performed by the web search tool. - discriminator: - propertyName: type - mapping: - search: '#/components/schemas/WebSearchActionResourceSearch' - open_page: '#/components/schemas/WebSearchActionResourceOpenPage' - find_in_page: '#/components/schemas/WebSearchActionResourceFindInPage' - other: '#/components/schemas/WebSearchActionResourceOther' - x-oai-discriminator-values: - - search - - open_page - - find_in_page - - other - anyOf: - - $ref: '#/components/schemas/WebSearchActionResourceSearch' - - $ref: '#/components/schemas/WebSearchActionResourceOpenPage' - - $ref: '#/components/schemas/WebSearchActionResourceFindInPage' - - $ref: '#/components/schemas/WebSearchActionResourceOther' - WebSearchCallItemResource: + description: One attempted delivery by an automation. + EnvironmentTypeParam: + type: string + enum: + - openai_hosted + description: The hosting type of an execution environment. + EnvironmentTypeResource: + type: string + enum: + - openai_hosted + - self_hosted + description: The kind of execution environment. + EnvironmentStatusResource: + type: string + enum: + - pending + - ready + - connected + - disconnected + - suspended + - expired + - failed + x-enumDescriptions: + - '' + - Provisioning succeeded and the environment is available for attachment or use. + - '' + - '' + - The sandbox is stopped and can be resumed from its private checkpoint. + - '' + - '' + description: The public lifecycle status of an execution environment. + HostedEnvironmentFileResourceFileId: type: object properties: type: type: string enum: - - web_search_call - default: web_search_call + - file_id + default: file_id x-stainless-const: true - description: The item type. Always `web_search_call`. + description: The type of the object. Always `file_id`. id: type: string minLength: 0 - description: The ID of the web search call. - turn_id: + description: The session-scoped ID of the file in the execution environment. + file_id: type: string minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/OutputItemStatusResource' - description: The status of the web search call. - action: - anyOf: - - $ref: '#/components/schemas/WebSearchActionResource' - - type: 'null' - description: The action performed by the web search tool. + description: The ID of the uploaded file. + path: + type: string + minLength: 0 + description: The file's absolute path inside the environment. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The decoded file size in bytes. required: - type - id - - turn_id - - status - - action + - file_id + - path + - size_bytes additionalProperties: false - description: A web search call produced by the agent. - CommandExecutionItemResource: + description: A file copied from the OpenAI Files API. + HostedEnvironmentFileResourceInline: type: object properties: type: type: string enum: - - command_execution - default: command_execution + - inline + default: inline x-stainless-const: true - description: The item type. Always `command_execution`. + description: The type of the object. Always `inline`. id: type: string minLength: 0 - description: The ID of the command execution item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - command: + description: The session-scoped ID of the file in the execution environment. + path: type: string minLength: 0 - description: The command that was executed. - cwd: - type: - - string - - 'null' - minLength: 0 - description: The working directory used to execute the command. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the command execution. - output: - type: - - string - - 'null' - minLength: 0 - description: The command output, if available. - exit_code: - type: - - integer - - 'null' - format: int64 - description: The process exit code, if the command completed. - duration_ms: - type: - - integer - - 'null' + description: The file's absolute path inside the environment. + size_bytes: + type: integer format: int64 - description: The command duration in milliseconds. + minimum: 0 + description: The decoded file size in bytes. required: - type - id - - turn_id - - command - - cwd - - status - - output - - exit_code - - duration_ms + - path + - size_bytes additionalProperties: false - description: A command execution produced by the agent. - InterruptSubagentCallItemResource: + description: A file supplied inline when the session was created. + HostedEnvironmentFileResource: + description: Metadata for a file materialized in an OpenAI-hosted execution environment. + discriminator: + propertyName: type + mapping: + file_id: '#/components/schemas/HostedEnvironmentFileResourceFileId' + inline: '#/components/schemas/HostedEnvironmentFileResourceInline' + x-oai-discriminator-values: + - file_id + - inline + anyOf: + - $ref: '#/components/schemas/HostedEnvironmentFileResourceFileId' + - $ref: '#/components/schemas/HostedEnvironmentFileResourceInline' + HostedSkillResourceSkillReference: type: object properties: type: type: string enum: - - interrupt_subagent_call - default: interrupt_subagent_call + - skill_reference + default: skill_reference x-stainless-const: true - x-enumDescriptions: - - The current public item type. - description: The item type. Always `interrupt_subagent_call`. - id: + description: The type of the object. Always `skill_reference`. + skill_id: type: string minLength: 0 - description: The ID of the tool call item. - turn_id: + description: The referenced skill ID. + version: type: string minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the tool call. - sender_agent_id: + description: The concrete skill version installed for this session. + name: type: string minLength: 0 - description: The ID of the agent requesting the interrupt. - recipient_agent_id: + description: The installed skill name. + description: type: string minLength: 0 - description: The ID of the agent to interrupt. + description: The installed skill description. required: - type - - id - - turn_id - - status - - sender_agent_id - - recipient_agent_id + - skill_id + - version + - name + - description additionalProperties: false - description: A request to interrupt a subagent's current turn. The subagent remains available. - CreateSubagentCallItemResource: + description: A skill installed from the Skills API. + HostedSkillResourceInline: type: object properties: type: type: string enum: - - create_subagent_call - default: create_subagent_call + - inline + default: inline x-stainless-const: true - x-enumDescriptions: - - The current public item type. - description: The item type. Always `create_subagent_call`. - id: + description: The type of the object. Always `inline`. + name: type: string minLength: 0 - description: The ID of the tool call item. - turn_id: + description: The installed skill name. + description: type: string minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the tool call. - agent_id: + description: The installed skill description. + required: + - type + - name + - description + additionalProperties: false + description: A skill installed from an inline ZIP archive. + HostedSkillResource: + description: A skill installed in an OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + skill_reference: '#/components/schemas/HostedSkillResourceSkillReference' + inline: '#/components/schemas/HostedSkillResourceInline' + x-oai-discriminator-values: + - skill_reference + - inline + anyOf: + - $ref: '#/components/schemas/HostedSkillResourceSkillReference' + - $ref: '#/components/schemas/HostedSkillResourceInline' + PublicEnvironmentResource: + type: object + properties: + type: + $ref: '#/components/schemas/EnvironmentTypeResource' + description: Whether the environment is hosted by OpenAI or by the application. + id: type: string minLength: 0 - description: The ID of the agent that requested the subagent. - content: + description: The ID of the environment. + object: + type: string + enum: + - agent.environment + default: agent.environment + x-stainless-const: true + description: The object type. Always `agent.environment`. + status: + $ref: '#/components/schemas/EnvironmentStatusResource' + description: The current environment connection status. + files: type: array items: - $ref: '#/components/schemas/AgentContentResource' + $ref: '#/components/schemas/HostedEnvironmentFileResource' minItems: 0 maxItems: 2000 - description: The task given to the spawned agent. - model: + description: Files installed in the environment, without their contents. + skills: + type: array + items: + $ref: '#/components/schemas/HostedSkillResource' + minItems: 0 + maxItems: 2000 + description: Skills installed in the environment, without their archive contents. + plugins: + type: array + items: + $ref: '#/components/schemas/HostedPluginResource' + minItems: 0 + maxItems: 2000 + description: Plugins installed in the environment, without their archive contents. + required: + - id + - object + - type + - status + - files + - skills + - plugins + additionalProperties: false + description: Safe metadata for a first-class execution environment. + AgentEnvironmentListResource: + type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/PublicEnvironmentResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: type: - string - 'null' minLength: 0 - description: The model requested for the spawned agent. - reasoning_effort: + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: type: - string - 'null' minLength: 0 - description: The reasoning effort requested for the spawned agent. + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. required: - - type - - id - - turn_id - - status - - agent_id - - content - - model - - reasoning_effort + - object + - data + - first_id + - last_id + - has_more additionalProperties: false - description: A request to spawn a subagent. - SendSubagentInputCallItemResource: + description: A page of Agents API resources, with IDs for retrieving additional pages. + CreateEnvironmentParamOpenaiHosted: type: object properties: type: type: string enum: - - send_subagent_input_call - default: send_subagent_input_call + - openai_hosted + default: openai_hosted x-stainless-const: true - x-enumDescriptions: - - The current public item type. - description: The item type. Always `send_subagent_input_call`. - id: - type: string - minLength: 0 - description: The ID of the tool call item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the tool call. - sender_agent_id: - type: string - minLength: 0 - description: The ID of the agent sending the input. - recipient_agent_id: + description: The type of the object. Always `openai_hosted`. + packages: + anyOf: + - $ref: '#/components/schemas/EnvironmentPackagesParam' + - type: 'null' + description: Packages to install in the environment. Defaults to empty package lists. + setup_commands: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Ordered, confidential setup commands. Command bodies are never returned. + network: + anyOf: + - $ref: '#/components/schemas/NetworkPolicyParam' + - type: 'null' + description: Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled. + desktop: + anyOf: + - $ref: '#/components/schemas/DesktopParam' + - type: 'null' + description: Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled. + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Environment variables made available to the agent. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Plugins provided as inline ZIP archives. Defaults to an empty list. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Files available before the agent starts. Defaults to an empty list. + environment_template_id: type: string minLength: 0 - description: The ID of the agent receiving the input. - content: - type: array + maxLength: 64 + description: A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy. + required: + - type + additionalProperties: false + description: Provision an OpenAI-hosted environment from inline configuration or a template. + CreateEnvironmentParam: + description: Configuration for a new prewarmed OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + openai_hosted: '#/components/schemas/CreateEnvironmentParamOpenaiHosted' + x-oai-discriminator-values: + - openai_hosted + anyOf: + - $ref: '#/components/schemas/CreateEnvironmentParamOpenaiHosted' + CreateAgentEnvironmentParams: + type: object + properties: + environment: + $ref: '#/components/schemas/CreateEnvironmentParam' + description: The required hosting type and its configuration. + vault_ids: + type: + - array + - 'null' items: - $ref: '#/components/schemas/AgentContentResource' + type: string + minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: The input sent to the receiving agent. + maxItems: 10 + description: The IDs of up to 10 vaults made available to an OpenAI-hosted environment. required: - - type - - id - - turn_id - - status - - sender_agent_id - - recipient_agent_id - - content + - environment additionalProperties: false - description: A request to send input to another agent. - ResumeSubagentCallItemResource: + description: Parameters for creating an execution environment before its sessions. + EnvironmentFilePageObjectResource: + type: string + enum: + - page + default: page + x-stainless-const: true + description: The object type for a page of files in an execution environment. + EnvironmentFileResource: type: object properties: - type: + object: type: string enum: - - resume_subagent_call - default: resume_subagent_call + - agent.environment.file + default: agent.environment.file x-stainless-const: true - x-enumDescriptions: - - The current public item type. - description: The item type. Always `resume_subagent_call`. - id: - type: string - minLength: 0 - description: The ID of the tool call item. - turn_id: + description: The object type. Always `agent.environment.file`. + environment_id: type: string minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the tool call. - sender_agent_id: + description: The ID of the environment containing this file. + path: type: string minLength: 0 - description: The ID of the agent requesting the resume. - recipient_agent_id: - type: string + description: The absolute file path inside the environment's workspace. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The file size in bytes. + required: + - object + - environment_id + - path + - size_bytes + additionalProperties: false + description: A live file in an execution environment. + EnvironmentFileListResource: + type: object + properties: + object: + $ref: '#/components/schemas/EnvironmentFilePageObjectResource' + description: The object type. Always `page`. + data: + type: array + items: + $ref: '#/components/schemas/EnvironmentFileResource' + minItems: 0 + maxItems: 2000 + description: Files available on the current page. + next: + type: + - string + - 'null' minLength: 0 - description: The ID of the agent to resume. + description: The opaque cursor to use when requesting the next page, if any. + has_more: + type: boolean + description: Whether more files follow this page. required: - - type - - id - - turn_id - - status - - sender_agent_id - - recipient_agent_id + - object + - data + - next + - has_more additionalProperties: false - description: A request to resume a subagent. - WaitForSubagentsCallItemResource: + description: A paginated list of live execution environment files. + SubagentObjectResource: + type: string + enum: + - agent.session.subagent + default: agent.session.subagent + x-stainless-const: true + description: The object type for a subagent. + OutputTextResource: type: object properties: type: type: string enum: - - wait_for_subagents_call - default: wait_for_subagents_call + - output_text + default: output_text x-stainless-const: true - x-enumDescriptions: - - The current public item type. - description: The item type. Always `wait_for_subagents_call`. - id: - type: string - minLength: 0 - description: The ID of the tool call item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the tool call. - sender_agent_id: + description: The content type. Always `output_text`. + text: type: string minLength: 0 - description: The ID of the agent waiting for results. - recipient_agent_ids: - type: array - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: The IDs of the agents to wait for. + description: The text produced by the agent. required: - type - - id - - turn_id - - status - - sender_agent_id - - recipient_agent_ids + - text additionalProperties: false - description: A request to wait for one or more subagents. - CloseSubagentCallItemResource: + description: A text content part produced by the agent. + EncryptedContentResource: type: object properties: type: type: string enum: - - close_subagent_call - default: close_subagent_call + - encrypted_content + default: encrypted_content x-stainless-const: true - x-enumDescriptions: - - The current public item type. - description: The item type. Always `close_subagent_call`. - id: - type: string - minLength: 0 - description: The ID of the tool call item. - turn_id: - type: string - minLength: 0 - description: The ID of the turn that contains this item. - status: - $ref: '#/components/schemas/FunctionCallStatusResource' - description: The status of the tool call. - sender_agent_id: - type: string - minLength: 0 - description: The ID of the agent requesting the close. - recipient_agent_id: + description: The content type. Always `encrypted_content`. + encrypted_content: type: string minLength: 0 - description: The ID of the agent to close. + description: The encrypted content payload. required: - type - - id - - turn_id - - status - - sender_agent_id - - recipient_agent_id + - encrypted_content additionalProperties: false - description: A request to close a subagent. - SessionTurnItemResource: - description: An item associated with a session turn. + description: Encrypted content exchanged between agents. + AgentContentResource: + description: A plaintext or encrypted content part exchanged between agents. discriminator: propertyName: type mapping: - message: '#/components/schemas/MessageItemResource' - reasoning: '#/components/schemas/ReasoningItemResource' - function_call: '#/components/schemas/FunctionCallItemResource' - function_call_output: '#/components/schemas/FunctionCallOutputItemResource' - agent_message: '#/components/schemas/AgentMessageItemResource' - mcp_call: '#/components/schemas/McpCallItemResource' - computer_use_call: '#/components/schemas/ComputerUseCallItemResource' - computer_use_approval_request: '#/components/schemas/BrowserAuthenticationRequestItemResource' - computer_use_approval_request_result: '#/components/schemas/ComputerUseApprovalRequestResultItemResource' - web_search_call: '#/components/schemas/WebSearchCallItemResource' - command_execution: '#/components/schemas/CommandExecutionItemResource' - interrupt_subagent_call: '#/components/schemas/InterruptSubagentCallItemResource' - create_subagent_call: '#/components/schemas/CreateSubagentCallItemResource' - send_subagent_input_call: '#/components/schemas/SendSubagentInputCallItemResource' - resume_subagent_call: '#/components/schemas/ResumeSubagentCallItemResource' - wait_for_subagents_call: '#/components/schemas/WaitForSubagentsCallItemResource' - close_subagent_call: '#/components/schemas/CloseSubagentCallItemResource' + output_text: '#/components/schemas/OutputTextResource' + encrypted_content: '#/components/schemas/EncryptedContentResource' x-oai-discriminator-values: - - message - - reasoning - - function_call - - function_call_output - - agent_message - - mcp_call - - computer_use_call - - computer_use_approval_request - - computer_use_approval_request_result - - web_search_call - - command_execution - - create_subagent_call - - send_subagent_input_call - - resume_subagent_call - - wait_for_subagents_call - - interrupt_subagent_call - - close_subagent_call + - output_text + - encrypted_content anyOf: - - $ref: '#/components/schemas/MessageItemResource' - - $ref: '#/components/schemas/ReasoningItemResource' - - $ref: '#/components/schemas/FunctionCallItemResource' - - $ref: '#/components/schemas/FunctionCallOutputItemResource' - - $ref: '#/components/schemas/AgentMessageItemResource' - - $ref: '#/components/schemas/McpCallItemResource' - - $ref: '#/components/schemas/ComputerUseCallItemResource' - - $ref: '#/components/schemas/BrowserAuthenticationRequestItemResource' - - $ref: '#/components/schemas/ComputerUseApprovalRequestResultItemResource' - - $ref: '#/components/schemas/WebSearchCallItemResource' - - $ref: '#/components/schemas/CommandExecutionItemResource' - - $ref: '#/components/schemas/CreateSubagentCallItemResource' - - $ref: '#/components/schemas/SendSubagentInputCallItemResource' - - $ref: '#/components/schemas/ResumeSubagentCallItemResource' - - $ref: '#/components/schemas/WaitForSubagentsCallItemResource' - - $ref: '#/components/schemas/InterruptSubagentCallItemResource' - - $ref: '#/components/schemas/CloseSubagentCallItemResource' - SessionItemListResource: + - $ref: '#/components/schemas/OutputTextResource' + - $ref: '#/components/schemas/EncryptedContentResource' + SubagentStatusResource: + type: string + enum: + - active + - closed + x-enumDescriptions: + - The subagent remains available, including while idle between turns. + - The subagent is closed. + description: The current status of a subagent. + SubagentResource: type: object properties: + id: + type: string + minLength: 0 + description: The ID of the subagent. object: + $ref: '#/components/schemas/SubagentObjectResource' + description: The object type. Always `agent.session.subagent`. + session_id: type: string - enum: - - list - default: list - x-stainless-const: true - description: The object type, which is always `list`. - data: - type: array - items: - $ref: '#/components/schemas/SessionTurnItemResource' - minItems: 0 - maxItems: 2000 - description: The resources returned in this page, in the requested sort order. - first_id: + minLength: 0 + description: The ID of the session that owns the subagent. + name: type: - string - 'null' minLength: 0 - description: The ID of the first resource in `data`, or `null` if the page is empty. - last_id: + description: The runner-assigned nickname, or null when unavailable. + instructions: type: - - string + - array - 'null' + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available. + parent_agent_id: + type: string minLength: 0 - description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. - has_more: - type: boolean - description: Whether there are more resources to retrieve after this page. + description: The ID of the agent that created this subagent. + status: + $ref: '#/components/schemas/SubagentStatusResource' + description: The current status of the subagent. + opened_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it. + closed_at: + type: + - integer + - 'null' + format: int64 + description: The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume. required: + - id - object - - data - - first_id - - last_id - - has_more + - session_id + - name + - instructions + - parent_agent_id + - status + - opened_at + - closed_at additionalProperties: false - description: A page of messages, reasoning, and tool calls from a session's item history. - TurnObjectResource: - type: string - enum: - - agent.session.turn - default: agent.session.turn - x-stainless-const: true - description: The object type for a turn. - TurnStatusResource: - type: string - enum: - - queued - - in_progress - - waiting - - completed - - failed - - cancelled - x-enumDescriptions: - - The turn is waiting to start. - - The turn is in progress. - - The turn is waiting for external input. - - The turn completed successfully. - - The turn failed. - - The turn was cancelled. - description: The current status of a turn. - SessionTurnErrorCodeResource: + description: A subagent created within a session. + SessionMessageRoleResource: type: string enum: - - context_length_exceeded - - session_budget_exceeded - - usage_limit_exceeded - - project_spend_limit_exceeded - - organization_spend_limit_exceeded - - organization_usage_limit_exceeded - - billing_not_active - - credit_balance_exhausted - - rate_limit_exceeded - - flex_unavailable - - server_overloaded - - cyber_policy - - misalignment_policy_violation - - connection_failed - - server_error - - authentication_error - - invalid_request - - resource_not_found - - sandbox_error - - executor_version_incompatible - - active_turn_not_steerable - - request_timeout - - internal_error - x-enumDescriptions: - - The request exceeds the model's context window. - - The session has reached its usage budget. - - The organization has reached a usage, plan, or billing limit. - - The project has reached its enforced spend limit. - - The organization has reached its enforced spend limit. - - The organization has reached its OpenAI-assigned usage limit. - - Billing is not active for the account. - - The organization has no API credits remaining. - - The request exceeds the available rate limit. - - Flex processing is temporarily unavailable. - - The model service is temporarily overloaded. - - The request was rejected by a safety policy. - - The request was blocked by the safety systems. - - The request could not connect to the model service. - - The model service encountered an unexpected error. - - The API credentials are invalid or lack the required access. - - The request contains invalid input or configuration. - - The requested model or resource is unavailable. - - The request could not complete in its execution environment. - - The executor must be upgraded before it can run this turn. - - The session cannot accept additional input while a request is running. - - The request timed out before the model service responded. - - An unexpected internal error prevented the session request from completing. - description: Stable public categories for session request failures. - SessionTurnErrorResource: + - user + - assistant + description: The author of a session message. + MessageContentResourceInputText: type: object properties: - code: - $ref: '#/components/schemas/SessionTurnErrorCodeResource' - description: A stable, machine-readable failure category. - message: + type: + type: string + enum: + - input_text + default: input_text + x-stainless-const: true + description: The type of the object. Always `input_text`. + text: type: string minLength: 0 - description: A customer-safe explanation of the failure. - required: - - code - - message - additionalProperties: false - description: A customer-safe error describing why a session request failed. - InputTokensDetailsResource-2: - type: object - properties: - cached_tokens: - type: integer - format: int64 - description: The number of input tokens retrieved from the prompt cache. + description: The text supplied by the user. required: - - cached_tokens + - type + - text additionalProperties: false - description: A breakdown of input token usage for a session or turn. - OutputTokensDetailsResource-2: + description: Text supplied by the user. + MessageContentResourceInputImage: type: object properties: - reasoning_tokens: - type: integer - format: int64 - description: The number of output tokens used for reasoning. + type: + type: string + enum: + - input_image + default: input_image + x-stainless-const: true + description: The type of the object. Always `input_image`. + image_url: + type: string + minLength: 0 + description: The URL of the image supplied by the user, which may be a base64-encoded data URL. required: - - reasoning_tokens + - type + - image_url additionalProperties: false - description: A breakdown of output token usage for a session or turn. - TokenUsageResource: + description: An image supplied by the user. + MessageContentResourceOutputText: type: object properties: - input_tokens: - type: integer - format: int64 - description: The number of input tokens used by the agent. - input_tokens_details: - $ref: '#/components/schemas/InputTokensDetailsResource-2' - description: A breakdown of the agent's input token usage. - output_tokens: - type: integer - format: int64 - description: The number of output tokens generated by the agent. - output_tokens_details: - $ref: '#/components/schemas/OutputTokensDetailsResource-2' - description: A breakdown of the agent's output token usage. - total_tokens: - type: integer - format: int64 - description: The total number of input and output tokens used by the agent. + type: + type: string + enum: + - output_text + default: output_text + x-stainless-const: true + description: The type of the object. Always `output_text`. + text: + type: string + minLength: 0 + description: The text produced by the assistant. required: - - input_tokens - - input_tokens_details - - output_tokens - - output_tokens_details - - total_tokens + - type + - text additionalProperties: false - description: Recorded token usage for a session or turn. Usage is best effort and may change. - TurnResource: + description: Text produced by the assistant. + MessageContentResource: + description: A content part in a session message. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/MessageContentResourceInputText' + input_image: '#/components/schemas/MessageContentResourceInputImage' + output_text: '#/components/schemas/MessageContentResourceOutputText' + x-oai-discriminator-values: + - input_text + - input_image + - output_text + anyOf: + - $ref: '#/components/schemas/MessageContentResourceInputText' + - $ref: '#/components/schemas/MessageContentResourceInputImage' + - $ref: '#/components/schemas/MessageContentResourceOutputText' + OutputItemStatusResource: + type: string + enum: + - in_progress + - completed + - incomplete + x-enumDescriptions: + - The item is in progress. + - The item is complete. + - The item stopped before completing. + description: The status of an agent output item. + MessagePhaseResource: + type: string + enum: + - commentary + - final_answer + x-enumDescriptions: + - Commentary produced while the agent works. + - The agent's final answer. + description: The phase of an assistant message. + MessageItemResource: type: object properties: - id: - type: string - minLength: 0 - description: The ID of the turn. - object: - $ref: '#/components/schemas/TurnObjectResource' - description: The object type. Always `agent.session.turn`. - session_id: - type: string - minLength: 0 - description: The ID of the session that owns the turn. - agent_id: + type: type: string - minLength: 0 - description: The ID of the agent that ran the turn. - subagent_id: + enum: + - message + default: message + x-stainless-const: true + description: The item type. Always `message`. + id: type: - string - 'null' minLength: 0 - description: The ID of the subagent that ran the turn, if applicable. + description: The ID of this item, or null for legacy user messages whose ID was not recorded. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + role: + $ref: '#/components/schemas/SessionMessageRoleResource' + description: The role of the message author. + content: + type: array + items: + $ref: '#/components/schemas/MessageContentResource' + minItems: 0 + maxItems: 2000 + description: The content of the message. User messages contain input text or images; assistant messages contain output text. status: - $ref: '#/components/schemas/TurnStatusResource' - description: The current status of the turn. - created_at: - type: integer - format: int64 - description: The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable. - started_at: - type: - - integer - - 'null' - format: int64 - description: The Unix timestamp, in seconds, when the turn started. - completed_at: - type: - - integer - - 'null' - format: int64 - description: The Unix timestamp, in seconds, when the turn reached a terminal state. - error: - anyOf: - - $ref: '#/components/schemas/SessionTurnErrorResource' - - type: 'null' - description: A customer-safe error. Non-null only for a failed turn. - usage: + $ref: '#/components/schemas/OutputItemStatusResource' + description: The status of the message. User messages are always `completed`. + phase: anyOf: - - $ref: '#/components/schemas/TokenUsageResource' + - $ref: '#/components/schemas/MessagePhaseResource' - type: 'null' - description: Best-effort token usage for the turn, or null if unknown. Recorded usage may change. + description: The phase of an assistant message. Null for user messages. required: + - type - id - - object - - session_id - - agent_id - - subagent_id + - turn_id + - role + - content - status - - created_at - - started_at - - completed_at - - error - - usage + - phase additionalProperties: false - description: The canonical public representation of a session turn. - SessionTurnListResource: + description: A user or assistant message recorded in a session. + SummaryTextResource: type: object properties: - object: + type: type: string enum: - - list - default: list + - summary_text + default: summary_text x-stainless-const: true - description: The object type, which is always `list`. - data: - type: array - items: - $ref: '#/components/schemas/TurnResource' - minItems: 0 - maxItems: 2000 - description: The resources returned in this page, in the requested sort order. - first_id: - type: - - string - - 'null' - minLength: 0 - description: The ID of the first resource in `data`, or `null` if the page is empty. - last_id: - type: - - string - - 'null' + description: The content type. Always `summary_text`. + text: + type: string minLength: 0 - description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. - has_more: - type: boolean - description: Whether there are more resources to retrieve after this page. + description: The reasoning summary text. required: - - object - - data - - first_id - - last_id - - has_more + - type + - text additionalProperties: false - description: A page of Agents API resources, with IDs for retrieving additional pages. - ReasoningEffortResource: - type: string - enum: - - none - - minimal - - low - - medium - - high - - xhigh - - max - description: The amount of reasoning effort used by an agent. - ReasoningSummaryResource: - type: string - enum: - - concise - - detailed - - auto - x-enumDescriptions: - - Returns a concise reasoning summary when supported. - - Returns a detailed reasoning summary when supported. - - Automatically selects the most detailed summary supported by the model. - description: The reasoning summary format requested from an agent. - ReasoningResource: + description: A reasoning summary content part. + ReasoningItemResource: type: object properties: - effort: - anyOf: - - $ref: '#/components/schemas/ReasoningEffortResource' - - type: 'null' - description: The requested reasoning effort, or `null` when the model selects its own default. + type: + type: string + enum: + - reasoning + default: reasoning + x-stainless-const: true + description: The item type. Always `reasoning`. + id: + type: string + minLength: 0 + description: The ID of the reasoning item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. summary: + type: array + items: + $ref: '#/components/schemas/SummaryTextResource' + minItems: 0 + maxItems: 2000 + description: The reasoning summaries produced by the agent. + status: anyOf: - - $ref: '#/components/schemas/ReasoningSummaryResource' + - $ref: '#/components/schemas/OutputItemStatusResource' - type: 'null' - description: The requested reasoning summary format, or `null` when summaries are disabled. + description: The status of the reasoning item. required: - - effort + - type + - id + - turn_id - summary + - status additionalProperties: false - description: The reasoning configuration used by an agent. - TextFormatResourceText: + description: A reasoning item produced by the agent. + FunctionCallStatusResource: + type: string + enum: + - in_progress + - completed + - failed + - incomplete + x-enumDescriptions: + - The call is in progress. + - The call completed successfully. + - The call failed. + - The call stopped before completing. + description: The status of a tool call. + FunctionCallItemResource: type: object properties: type: type: string enum: - - text - default: text + - function_call + default: function_call x-stainless-const: true - description: The type of the object. Always `text`. + description: The item type. Always `function_call`. + id: + type: string + minLength: 0 + description: The ID of the function call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + call_id: + type: string + minLength: 0 + description: The ID used to submit the function result. + name: + type: string + minLength: 0 + description: The name of the function to call. + arguments: + description: The arguments to pass to the function. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the function call. required: - type + - id + - turn_id + - call_id + - name + - arguments + - status additionalProperties: false - description: Generates ordinary text without a structured-output constraint. - TextFormatResourceJsonSchema: + description: A function call produced by the agent. + FunctionCallOutputResource: + description: The text or model-input content supplied as a function result. + anyOf: + - type: string + minLength: 0 + - type: array + items: + $ref: '#/components/schemas/InputContentResource' + minItems: 0 + maxItems: 2000 + FunctionCallOutputItemResource: type: object properties: + id: + type: string + minLength: 0 + description: The ID of the function call output item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. type: type: string enum: - - json_schema - default: json_schema + - function_call_output + default: function_call_output x-stainless-const: true - description: The type of the object. Always `json_schema`. - schema: - type: object - additionalProperties: {} - propertyNames: - type: string - minLength: 0 - minProperties: 0 - description: The JSON Schema that generated text must match. + description: The item type. Always `function_call_output`. + call_id: + type: string + minLength: 0 + description: The ID of the function call that produced this output. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the function call. + output: + anyOf: + - $ref: '#/components/schemas/FunctionCallOutputResource' + - type: 'null' + description: The function result, if the call succeeded. + error: + type: + - string + - 'null' + minLength: 0 + description: The error message, if the call failed. required: + - id + - turn_id - type - - schema + - call_id + - status + - output + - error additionalProperties: false - description: Constrains generated text to a JSON Schema. - TextFormatResource: - description: The effective output format for generated text. - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/TextFormatResourceText' - json_schema: '#/components/schemas/TextFormatResourceJsonSchema' - x-oai-discriminator-values: - - text - - json_schema - anyOf: - - $ref: '#/components/schemas/TextFormatResourceText' - - $ref: '#/components/schemas/TextFormatResourceJsonSchema' - VerbosityResource: - type: string - enum: - - low - - medium - - high - description: The amount of text produced by an agent. - TextResource: + description: The result supplied for a function call. + AgentMessageItemResource: type: object properties: - format: - $ref: '#/components/schemas/TextFormatResource' - description: The effective output format. Defaults to ordinary text. - verbosity: - $ref: '#/components/schemas/VerbosityResource' - description: The amount of text produced by the agent. Defaults to `medium`. + id: + type: string + minLength: 0 + description: The ID of the message. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + type: + type: string + enum: + - agent_message + default: agent_message + x-stainless-const: true + description: The item type. Always `agent_message`. + sender_agent_id: + type: string + minLength: 0 + description: The ID or name of the sending agent. + recipient_agent_id: + type: string + minLength: 0 + description: The ID or name of the receiving agent. + content: + type: array + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: The content exchanged between the agents. required: - - format - - verbosity + - id + - turn_id + - type + - sender_agent_id + - recipient_agent_id + - content additionalProperties: false - description: The text configuration used by an agent. - ServiceTierResource: - type: string - enum: - - auto - - default - - flex - - priority - - fast - - ultrafast - description: The service-tier policy configured for an agent. - PersistedAgentToolResourceFunction: + description: A message exchanged between agent threads. + McpCallItemResource: type: object properties: type: type: string enum: - - function - default: function + - mcp_call + default: mcp_call x-stainless-const: true - description: The type of the object. Always `function`. - name: + description: The item type. Always `mcp_call`. + id: type: string minLength: 0 - description: The name of the function. - description: + description: The ID of the MCP call item. + turn_id: type: string minLength: 0 - description: A description of what the function does. - parameters: - type: object - additionalProperties: {} - propertyNames: - type: string - minLength: 0 - minProperties: 0 - description: A JSON Schema object describing the function's arguments. - defer_loading: - type: boolean - description: Whether the function is deferred and discovered through tool search. + description: The ID of the turn that contains this item. + server_label: + type: string + minLength: 0 + description: The label of the MCP server. + name: + type: string + minLength: 0 + description: The name of the MCP tool. + arguments: + description: The arguments passed to the MCP tool. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the MCP tool call. + output: + anyOf: + - {} + - type: 'null' + description: The output returned by the MCP tool, if any. + error: + anyOf: + - {} + - type: 'null' + description: The error returned by the MCP tool, if any. required: - type + - id + - turn_id + - server_label - name - - description - - parameters - - defer_loading + - arguments + - status + - output + - error additionalProperties: false - description: A function defined by the application. - PersistedAgentToolResourceToolSearch: + description: A call to a tool on an MCP server. + ComputerScreenshotResource: type: object properties: type: type: string enum: - - tool_search - default: tool_search + - computer_screenshot + default: computer_screenshot x-stainless-const: true - description: The type of the object. Always `tool_search`. + description: The content type. Always `computer_screenshot`. + image_url: + type: string + minLength: 0 + description: The complete JPEG image as a base64 data URL. required: - type + - image_url additionalProperties: false - description: Discovers deferred function tools and loads them into the model context. - PersistedAgentToolResourceProgrammaticToolCalling: + description: A browser screenshot emitted by the model during computer use. + ComputerUseCallItemResource: type: object properties: type: type: string enum: - - programmatic_tool_calling - default: programmatic_tool_calling + - computer_use_call + default: computer_use_call x-stainless-const: true - description: The type of the object. Always `programmatic_tool_calling`. - enabled: - type: boolean - description: Whether tools can be called from model-generated code. + description: The item type. Always `computer_use_call`. + id: + type: string + minLength: 0 + description: The ID of the activity item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + title: + type: + - string + - 'null' + minLength: 0 + description: A model-generated description of the activity, when available. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The execution status of the activity. + output: + anyOf: + - $ref: '#/components/schemas/ComputerScreenshotResource' + - type: 'null' + description: The last screenshot emitted by the model. Null when screenshot inclusion is disabled or the call emitted no screenshot. required: - type - - enabled + - id + - turn_id + - title + - status + - output additionalProperties: false - description: Enables calling tools from model-generated code. - PersistedMcpTransportResourceHttp: + description: One execution of the platform-provided computer-use capability. + BrowserAuthenticationFieldResource: type: object properties: - type: + id: type: string - enum: - - http - default: http - x-stainless-const: true - description: The type of the object. Always `http`. - server_url: + minLength: 0 + description: The field ID to submit as field_id in a fields entry. + label: type: string minLength: 0 - description: The URL of the MCP server. - headers: - type: object - additionalProperties: - type: string - minLength: 0 - propertyNames: - type: string - minLength: 0 - minProperties: 0 - description: Non-secret HTTP headers sent to the MCP server. + description: The label to display beside the control. + type: + type: string + minLength: 0 + description: The rendering type, such as email, password, or text. + required: + type: boolean + description: Whether this control requires a nonempty value. required: + - id + - label - type - - server_url - - headers + - required additionalProperties: false - description: Connects to an MCP server over HTTP. - PersistedMcpTransportResourceStdio: + description: A control in a registered browser-login form. + BrowserAuthenticationOptionResource: type: object properties: - type: - type: string - enum: - - stdio - default: stdio - x-stainless-const: true - description: The type of the object. Always `stdio`. - command: + id: type: string minLength: 0 - description: The command used to start the MCP server. - args: - type: array - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: Arguments passed to the MCP server command. - cwd: + description: The option ID to submit as selected_option. + label: type: string minLength: 0 - description: The working directory used to start the MCP server. - env_vars: + description: The method label to display. + field_ids: type: array items: type: string minLength: 0 minItems: 0 maxItems: 2000 - description: Environment variable names inherited from the execution environment. + description: IDs from the registered fields that this method accepts. required: - - type - - command - - args - - cwd - - env_vars + - id + - label + - field_ids additionalProperties: false - description: Starts an MCP server as a local process. - PersistedMcpTransportResource: - description: A credential-free transport used to connect to an MCP server. - discriminator: - propertyName: type - mapping: - http: '#/components/schemas/PersistedMcpTransportResourceHttp' - stdio: '#/components/schemas/PersistedMcpTransportResourceStdio' - x-oai-discriminator-values: - - http - - stdio - anyOf: - - $ref: '#/components/schemas/PersistedMcpTransportResourceHttp' - - $ref: '#/components/schemas/PersistedMcpTransportResourceStdio' - McpConnectionOriginResource: - type: string - enum: - - service - - environment - description: Where outbound MCP HTTP connections originate. - PersistedAgentToolResourceMcp: + description: A sign-in method and the fields that belong to it. + BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication: type: object properties: type: type: string enum: - - mcp - default: mcp + - browser_authentication + default: browser_authentication x-stainless-const: true - description: The type of the object. Always `mcp`. - server_label: - type: string - minLength: 0 - description: A label used to identify the MCP server in tool calls. - credential_id: + description: The type of the object. Always `browser_authentication`. + reason: type: - string - 'null' minLength: 0 - description: The vault credential selected for this MCP server, if any. - transport: - $ref: '#/components/schemas/PersistedMcpTransportResource' - description: The credential-free transport used to connect to the MCP server. - request_metadata: - type: object - additionalProperties: {} - propertyNames: - type: string - minLength: 0 - minProperties: 0 - description: Metadata included with requests to this MCP server. - allowed_tools: + description: Why the agent needs the user to sign in. + credential_origin: type: - - array + - string - 'null' + minLength: 0 + description: The registered form or frame origin where values will be entered. + fields: + type: array items: - type: string - minLength: 0 + $ref: '#/components/schemas/BrowserAuthenticationFieldResource' minItems: 0 maxItems: 2000 - description: The MCP tools the agent may call, or null when all server tools are allowed. - required: - type: boolean - description: Whether this MCP server must initialize before the first turn. - connection_origin: - $ref: '#/components/schemas/McpConnectionOriginResource' - description: Where outbound MCP HTTP connections originate. + description: Controls to render. All submitted values are sensitive. + options: + type: array + items: + $ref: '#/components/schemas/BrowserAuthenticationOptionResource' + minItems: 0 + maxItems: 2000 + description: Sign-in methods. Empty for a plain form. required: - type - - server_label - - credential_id - - transport - - request_metadata - - allowed_tools - - required - - connection_origin + - reason + - credential_origin + - fields + - options additionalProperties: false - description: Tools provided by a remote MCP server without stored credentials. - WebSearchModeResource: - type: string - enum: - - disabled - - cached - - live - description: The source used for web search results. - WebSearchContextSizeResource: - type: string - enum: - - low - - medium - - high - description: The amount of web search context made available to the model. - WebSearchLocationResource: + description: A registered form awaiting the application's response. + BrowserAuthenticationHistoryRequestKindResource: + x-oai-discriminator-values: + - browser_authentication + discriminator: + propertyName: type + mapping: + browser_authentication: '#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication' + anyOf: + - $ref: '#/components/schemas/BrowserAuthenticationHistoryRequestKindResourceBrowserAuthentication' + BrowserAuthenticationRequestItemResource: type: object properties: - country: - type: - - string - - 'null' - minLength: 0 - description: The two-letter ISO country code, such as `US`. - region: - type: - - string - - 'null' + turn_id: + type: string minLength: 0 - description: The region or state name. - city: - type: - - string - - 'null' + request_id: + type: string minLength: 0 - description: The city name. - timezone: - type: - - string - - 'null' + request: + $ref: '#/components/schemas/BrowserAuthenticationHistoryRequestKindResource' + id: + type: string minLength: 0 - description: The IANA timezone, such as `America/Los_Angeles`. + description: The stable history item ID. + type: + type: string + enum: + - computer_use_approval_request + default: computer_use_approval_request + x-stainless-const: true + description: The item type. Always computer_use_approval_request. required: - - country - - region - - city - - timezone + - turn_id + - request_id + - request + - id + - type additionalProperties: false - description: Approximate user location used to localize web search results. - PersistedAgentToolResourceWebSearch: + description: A credential-free history record of the emitted login request. + ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource: type: object properties: type: type: string enum: - - web_search - default: web_search + - browser_authentication + default: browser_authentication x-stainless-const: true - description: The type of the object. Always `web_search`. - mode: - $ref: '#/components/schemas/WebSearchModeResource' - description: The source used for web search results. - context_size: - $ref: '#/components/schemas/WebSearchContextSizeResource' - description: The amount of search context made available to the model. Defaults to `medium`. - allowed_domains: + action: + type: string + enum: + - submit + default: submit + x-stainless-const: true + selected_option: type: - - array + - string - 'null' - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: Allowed search domains, or `null` when the search is unrestricted. - location: - anyOf: - - $ref: '#/components/schemas/WebSearchLocationResource' - - type: 'null' - description: Approximate location used to localize search results, if provided. + minLength: 0 + description: The chosen sign-in method, or null when no options were offered. required: - type - - mode - - context_size - - allowed_domains - - location + - action + - selected_option additionalProperties: false - description: Web search. - PersistedAgentToolResourceComputerUse: + ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource: type: object properties: type: type: string enum: - - computer_use - default: computer_use + - browser_authentication + default: browser_authentication + x-stainless-const: true + action: + type: string + enum: + - cancel + default: cancel x-stainless-const: true - description: The type of the object. Always `computer_use`. - include_screenshots: - type: boolean - description: Whether computer tool outputs include screenshots. required: - type - - include_screenshots + - action additionalProperties: false - description: Browser use in an OpenAI-hosted session. - PersistedAgentToolResource: - description: A credential-free tool available to a reusable agent. + ComputerUseApprovalResponseKindResource: + x-oai-discriminator-values: + - submit + - cancel discriminator: - propertyName: type + propertyName: action mapping: - function: '#/components/schemas/PersistedAgentToolResourceFunction' - tool_search: '#/components/schemas/PersistedAgentToolResourceToolSearch' - programmatic_tool_calling: '#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling' - mcp: '#/components/schemas/PersistedAgentToolResourceMcp' - web_search: '#/components/schemas/PersistedAgentToolResourceWebSearch' - computer_use: '#/components/schemas/PersistedAgentToolResourceComputerUse' - x-oai-discriminator-values: - - function - - tool_search - - programmatic_tool_calling - - mcp - - web_search - - computer_use + submit: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource' + cancel: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource' anyOf: - - $ref: '#/components/schemas/PersistedAgentToolResourceFunction' - - $ref: '#/components/schemas/PersistedAgentToolResourceToolSearch' - - $ref: '#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling' - - $ref: '#/components/schemas/PersistedAgentToolResourceMcp' - - $ref: '#/components/schemas/PersistedAgentToolResourceWebSearch' - - $ref: '#/components/schemas/PersistedAgentToolResourceComputerUse' - MultiAgentConfigResource: - type: object - properties: - enabled: - type: boolean - description: Whether subagent tools are enabled. Defaults to false. - max_concurrent_subagents: - type: - - integer - - 'null' - format: int64 - minimum: 1 - maximum: 4294967295 - description: Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled. - required: - - enabled - - max_concurrent_subagents - additionalProperties: false - description: The resolved configuration for creating and coordinating subagents. - AgentResource: + - $ref: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationSubmitResource' + - $ref: '#/components/schemas/ComputerUseApprovalResponseKindResourceBrowserAuthenticationCancelResource' + ComputerUseApprovalRequestResultItemResource: type: object properties: id: type: string minLength: 0 - description: The ID of the reusable agent. - object: + description: The stable history item ID. + type: type: string enum: - - agent - default: agent + - computer_use_approval_request_result + default: computer_use_approval_request_result x-stainless-const: true - description: The object type. Always `agent`. - created_at: - type: integer - format: int64 - description: The Unix timestamp, in seconds, when the agent was created. - updated_at: - type: integer - format: int64 - description: The Unix timestamp, in seconds, when the agent was last updated. - name: - type: - - string - - 'null' - minLength: 0 - description: A human-readable name for the agent, or null if it is unnamed. - metadata: - type: object - additionalProperties: - type: string - minLength: 0 - propertyNames: - type: string - minLength: 0 - minProperties: 0 - description: Custom string key-value pairs attached to the agent. - model: + turn_id: type: string minLength: 0 - description: The requested model name used for inference. - reasoning: - $ref: '#/components/schemas/ReasoningResource' - description: The resolved reasoning configuration, including the model default for an omitted effort. - text: - $ref: '#/components/schemas/TextResource' - description: The resolved configuration for text generated by the agent. - service_tier: - $ref: '#/components/schemas/ServiceTierResource' - description: The resolved service-tier policy used for model requests. - instructions: - type: - - string - - 'null' - minLength: 0 - description: Custom instructions appended to the agent's default base instructions. - tools: - type: array - items: - $ref: '#/components/schemas/PersistedAgentToolResource' - minItems: 0 - maxItems: 2000 - description: Tools available to the agent. - multi_agent: - $ref: '#/components/schemas/MultiAgentConfigResource' - description: The resolved configuration for creating and coordinating subagents. - required: - - id - - object - - created_at - - updated_at - - name - - metadata - - model - - reasoning - - text - - service_tier - - instructions - - tools - - multi_agent - additionalProperties: false - description: A reusable agent scoped to the caller's project. - AgentListResource: - type: object - properties: - object: + description: The ID of the turn that contains this item. + request_id: type: string - enum: - - list - default: list - x-stainless-const: true - description: The object type, which is always `list`. - data: - type: array - items: - $ref: '#/components/schemas/AgentResource' - minItems: 0 - maxItems: 2000 - description: The resources returned in this page, in the requested sort order. - first_id: - type: - - string - - 'null' - minLength: 0 - description: The ID of the first resource in `data`, or `null` if the page is empty. - last_id: - type: - - string - - 'null' minLength: 0 - description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. - has_more: - type: boolean - description: Whether there are more resources to retrieve after this page. + description: The registered request answered by this item. + response: + $ref: '#/components/schemas/ComputerUseApprovalResponseKindResource' + description: The admitted response, without submitted credential values. required: - - object - - data - - first_id - - last_id - - has_more - additionalProperties: false - description: A page of Agents API resources, with IDs for retrieving additional pages. - ReasoningEffortParam: - type: string - enum: - - none - - minimal - - low - - medium - - high - - xhigh - - max - description: The amount of reasoning effort the model should use. - ReasoningSummaryParam: - type: string - enum: - - concise - - detailed - - auto - x-enumDescriptions: - - Returns a concise reasoning summary when supported. - - Returns a detailed reasoning summary when supported. - - Automatically selects the most detailed summary supported by the model. - description: The reasoning summary format requested from the model. - ReasoningParam: - type: object - properties: - effort: - anyOf: - - $ref: '#/components/schemas/ReasoningEffortParam' - - type: 'null' - description: The amount of reasoning effort the model should use. Omission lets the model select it. - summary: - anyOf: - - $ref: '#/components/schemas/ReasoningSummaryParam' - - type: 'null' - description: Controls whether the response includes a reasoning summary. + - id + - type + - turn_id + - request_id + - response additionalProperties: false - description: Reasoning configuration for the agent. - TextFormatParamText: + description: A credential-free record of an admitted response, not proof of completion. + WebSearchActionResourceSearch: type: object properties: type: type: string enum: - - text - default: text + - search + default: search x-stainless-const: true - description: The type of the object. Always `text`. + description: The type of the object. Always `search`. + query: + type: + - string + - 'null' + minLength: 0 + description: The search query, when a single query was used. + queries: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The search queries, when multiple queries were used. required: - type + - query + - queries additionalProperties: false - description: Generates ordinary text without a structured-output constraint. - TextFormatParamJsonSchema: + description: A search query or group of search queries. + WebSearchActionResourceOpenPage: type: object properties: type: type: string enum: - - json_schema - default: json_schema + - open_page + default: open_page x-stainless-const: true - description: The type of the object. Always `json_schema`. - schema: - type: object - additionalProperties: {} - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: The JSON Schema that generated text must match. + description: The type of the object. Always `open_page`. + url: + type: + - string + - 'null' + minLength: 0 + description: The URL of the page that was opened. required: - type - - schema - additionalProperties: false - description: Constrains generated text to a JSON Schema. - TextFormatParam: - description: The output format for generated text. - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/TextFormatParamText' - json_schema: '#/components/schemas/TextFormatParamJsonSchema' - x-oai-discriminator-values: - - text - - json_schema - anyOf: - - $ref: '#/components/schemas/TextFormatParamText' - - $ref: '#/components/schemas/TextFormatParamJsonSchema' - VerbosityParam: - type: string - enum: - - low - - medium - - high - x-enumDescriptions: - - Produces less text. - - Uses the default amount of text. - - Produces more text. - description: The amount of text the model should produce. - TextParam: - type: object - properties: - format: - anyOf: - - $ref: '#/components/schemas/TextFormatParam' - - type: 'null' - description: 'The output format. Omission uses ordinary text (`{"type": "text"}`).' - verbosity: - anyOf: - - $ref: '#/components/schemas/VerbosityParam' - - type: 'null' - description: The amount of text the model should produce. Defaults to `medium`, matching Responses. + - url additionalProperties: false - description: Configuration for text generated by the agent. - ServiceTierParam: - type: string - enum: - - auto - - default - - flex - - priority - - fast - - ultrafast - x-enumDescriptions: - - Selects the service tier automatically. - - Uses the default service tier. - - Uses the flex service tier. - - Uses the priority service tier. - - Uses the fast service tier. - - Uses the ultrafast service tier. - description: The service tier used for model requests. - PersistedAgentToolConfigParamFunction: + description: Opens a web page. + WebSearchActionResourceFindInPage: type: object properties: type: type: string enum: - - function - default: function + - find_in_page + default: find_in_page x-stainless-const: true - description: The type of the object. Always `function`. - name: - type: string + description: The type of the object. Always `find_in_page`. + url: + type: + - string + - 'null' minLength: 0 - maxLength: 1048576 - description: The name of the function. - description: - type: string + description: The URL of the page that was searched. + pattern: + type: + - string + - 'null' minLength: 0 - maxLength: 1048576 - description: A description of what the function does. - parameters: - type: object - additionalProperties: {} - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: A JSON Schema object describing the function's arguments. - defer_loading: - type: boolean - default: false - description: Whether this function is deferred and discovered through tool search. Defaults to `false`. + description: The text pattern that was searched for. required: - type - - name - - description - - parameters + - url + - pattern additionalProperties: false - description: A function defined by the application. - PersistedAgentToolConfigParamToolSearch: + description: Finds text within a web page. + WebSearchActionResourceOther: type: object properties: type: type: string enum: - - tool_search - default: tool_search + - other + default: other x-stainless-const: true - description: The type of the object. Always `tool_search`. + description: The type of the object. Always `other`. required: - type additionalProperties: false - description: Discovers deferred function tools and loads them into the model context. - PersistedAgentToolConfigParamProgrammaticToolCalling: + description: Another web search action. + WebSearchActionResource: + description: An action performed by the web search tool. + discriminator: + propertyName: type + mapping: + search: '#/components/schemas/WebSearchActionResourceSearch' + open_page: '#/components/schemas/WebSearchActionResourceOpenPage' + find_in_page: '#/components/schemas/WebSearchActionResourceFindInPage' + other: '#/components/schemas/WebSearchActionResourceOther' + x-oai-discriminator-values: + - search + - open_page + - find_in_page + - other + anyOf: + - $ref: '#/components/schemas/WebSearchActionResourceSearch' + - $ref: '#/components/schemas/WebSearchActionResourceOpenPage' + - $ref: '#/components/schemas/WebSearchActionResourceFindInPage' + - $ref: '#/components/schemas/WebSearchActionResourceOther' + WebSearchCallItemResource: type: object properties: type: type: string enum: - - programmatic_tool_calling - default: programmatic_tool_calling + - web_search_call + default: web_search_call x-stainless-const: true - description: The type of the object. Always `programmatic_tool_calling`. - enabled: - type: boolean - default: true - description: Whether tools can be called from model-generated code. Defaults to `true`. + description: The item type. Always `web_search_call`. + id: + type: string + minLength: 0 + description: The ID of the web search call. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/OutputItemStatusResource' + description: The status of the web search call. + action: + anyOf: + - $ref: '#/components/schemas/WebSearchActionResource' + - type: 'null' + description: The action performed by the web search tool. required: - type + - id + - turn_id + - status + - action additionalProperties: false - description: Enables calling tools from model-generated code. - PersistedMcpTransportConfigParamHttp: + description: A web search call produced by the agent. + CommandExecutionItemResource: type: object properties: type: type: string enum: - - http - default: http + - command_execution + default: command_execution x-stainless-const: true - description: The type of the object. Always `http`. - server_url: + description: The item type. Always `command_execution`. + id: type: string minLength: 0 - maxLength: 1048576 - description: The URL of the MCP server. - headers: + description: The ID of the command execution item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + command: + type: string + minLength: 0 + description: The command that was executed. + cwd: type: - - object + - string - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 1048576 - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: Non-secret HTTP headers sent to the MCP server. + minLength: 0 + description: The working directory used to execute the command. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the command execution. + output: + type: + - string + - 'null' + minLength: 0 + description: The command output, if available. + exit_code: + type: + - integer + - 'null' + format: int64 + description: The process exit code, if the command completed. + duration_ms: + type: + - integer + - 'null' + format: int64 + description: The command duration in milliseconds. required: - type - - server_url + - id + - turn_id + - command + - cwd + - status + - output + - exit_code + - duration_ms additionalProperties: false - description: Connects to an MCP server over HTTP. - PersistedMcpTransportConfigParamStdio: + description: A command execution produced by the agent. + InterruptSubagentCallItemResource: type: object properties: type: type: string enum: - - stdio - default: stdio + - interrupt_subagent_call + default: interrupt_subagent_call x-stainless-const: true - description: The type of the object. Always `stdio`. - command: + x-enumDescriptions: + - The current public item type. + description: The item type. Always `interrupt_subagent_call`. + id: type: string minLength: 0 - maxLength: 1048576 - description: The command used to start the MCP server. - args: - type: - - array - - 'null' - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Arguments passed to the MCP server command. - cwd: + description: The ID of the tool call item. + turn_id: type: string minLength: 0 - maxLength: 1048576 - description: The working directory used to start the MCP server. - env_vars: - type: - - array - - 'null' - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Environment variable names to inherit from the selected execution environment. + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent requesting the interrupt. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent to interrupt. required: - type - - command - - cwd + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id additionalProperties: false - description: Starts an MCP server as a local process. - PersistedMcpTransportConfigParam: - description: A credential-free transport used to connect to an MCP server. - discriminator: - propertyName: type - mapping: - http: '#/components/schemas/PersistedMcpTransportConfigParamHttp' - stdio: '#/components/schemas/PersistedMcpTransportConfigParamStdio' - x-oai-discriminator-values: - - http - - stdio - anyOf: - - $ref: '#/components/schemas/PersistedMcpTransportConfigParamHttp' - - $ref: '#/components/schemas/PersistedMcpTransportConfigParamStdio' - McpConnectionOriginParam: - type: string - enum: - - service - - environment - x-enumDescriptions: - - Uses the Managed Agents service network. - - Uses the session's execution environment. - description: Where outbound MCP HTTP connections originate. - PersistedAgentToolConfigParamMcp: + description: A request to interrupt a subagent's current turn. The subagent remains available. + CreateSubagentCallItemResource: type: object properties: type: type: string enum: - - mcp - default: mcp + - create_subagent_call + default: create_subagent_call x-stainless-const: true - description: The type of the object. Always `mcp`. - server_label: + x-enumDescriptions: + - The current public item type. + description: The item type. Always `create_subagent_call`. + id: type: string minLength: 0 - maxLength: 1048576 - description: A label used to identify the MCP server in tool calls. - credential_id: + description: The ID of the tool call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + agent_id: + type: string + minLength: 0 + description: The ID of the agent that requested the subagent. + content: + type: array + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: The task given to the spawned agent. + model: type: - string - 'null' minLength: 0 - maxLength: 1048576 - description: The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL. - transport: - $ref: '#/components/schemas/PersistedMcpTransportConfigParam' - description: The credential-free transport used to connect to the MCP server. - request_metadata: - type: - - object - - 'null' - additionalProperties: {} - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: Metadata included with requests to this MCP server. - allowed_tools: + description: The model requested for the spawned agent. + reasoning_effort: type: - - array + - string - 'null' - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: The MCP tools the agent may call. All server tools are allowed when omitted. - required: - type: boolean - default: false - description: Whether this MCP server must initialize before the first turn. Defaults to `false`. - connection_origin: - anyOf: - - $ref: '#/components/schemas/McpConnectionOriginParam' - - type: 'null' - description: Selects where outbound MCP HTTP connections originate. + minLength: 0 + description: The reasoning effort requested for the spawned agent. required: - type - - server_label - - transport + - id + - turn_id + - status + - agent_id + - content + - model + - reasoning_effort additionalProperties: false - description: Tools provided by a remote MCP server without stored credentials. - WebSearchModeParam: - type: string - enum: - - disabled - - cached - - live - x-enumDescriptions: - - Disables web search. - - Uses cached search results. - - Searches the live web. - description: The source used for web search results. - WebSearchContextSizeParam: - type: string - enum: - - low - - medium - - high - description: The amount of web search context made available to the model. - WebSearchLocationParam: + description: A request to spawn a subagent. + SendSubagentInputCallItemResource: + type: object + properties: + type: + type: string + enum: + - send_subagent_input_call + default: send_subagent_input_call + x-stainless-const: true + x-enumDescriptions: + - The current public item type. + description: The item type. Always `send_subagent_input_call`. + id: + type: string + minLength: 0 + description: The ID of the tool call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent sending the input. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent receiving the input. + content: + type: array + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: The input sent to the receiving agent. + required: + - type + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id + - content + additionalProperties: false + description: A request to send input to another agent. + ResumeSubagentCallItemResource: type: object properties: - country: - type: - - string - - 'null' + type: + type: string + enum: + - resume_subagent_call + default: resume_subagent_call + x-stainless-const: true + x-enumDescriptions: + - The current public item type. + description: The item type. Always `resume_subagent_call`. + id: + type: string minLength: 0 - maxLength: 1048576 - description: The two-letter ISO country code, such as `US`. - region: - type: - - string - - 'null' + description: The ID of the tool call item. + turn_id: + type: string minLength: 0 - maxLength: 1048576 - description: The region or state name. - city: - type: - - string - - 'null' + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string minLength: 0 - maxLength: 1048576 - description: The city name. - timezone: - type: - - string - - 'null' + description: The ID of the agent requesting the resume. + recipient_agent_id: + type: string minLength: 0 - maxLength: 1048576 - description: The IANA timezone, such as `America/Los_Angeles`. + description: The ID of the agent to resume. + required: + - type + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id additionalProperties: false - description: Approximate user location used to localize web search results. - PersistedAgentToolConfigParamWebSearch: + description: A request to resume a subagent. + WaitForSubagentsCallItemResource: type: object properties: type: type: string enum: - - web_search - default: web_search + - wait_for_subagents_call + default: wait_for_subagents_call x-stainless-const: true - description: The type of the object. Always `web_search`. - mode: - anyOf: - - $ref: '#/components/schemas/WebSearchModeParam' - - type: 'null' - description: The source used for web search results. Defaults to `live`. - context_size: - anyOf: - - $ref: '#/components/schemas/WebSearchContextSizeParam' - - type: 'null' - description: The amount of search context made available to the model. Defaults to `medium`. - allowed_domains: - type: - - array - - 'null' + x-enumDescriptions: + - The current public item type. + description: The item type. Always `wait_for_subagents_call`. + id: + type: string + minLength: 0 + description: The ID of the tool call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent waiting for results. + recipient_agent_ids: + type: array items: type: string minLength: 0 - maxLength: 1048576 minItems: 0 - maxItems: 16384 - description: Domains the search may include. - location: - anyOf: - - $ref: '#/components/schemas/WebSearchLocationParam' - - type: 'null' - description: Approximate location used to localize search results. + maxItems: 2000 + description: The IDs of the agents to wait for. required: - type + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_ids additionalProperties: false - description: Web search. - PersistedAgentToolConfigParamComputerUse: + description: A request to wait for one or more subagents. + CloseSubagentCallItemResource: type: object properties: type: type: string enum: - - computer_use - default: computer_use + - close_subagent_call + default: close_subagent_call x-stainless-const: true - description: The type of the object. Always `computer_use`. - include_screenshots: - type: boolean - default: false - description: Whether computer tool outputs include screenshots. Defaults to `false`. + x-enumDescriptions: + - The current public item type. + description: The item type. Always `close_subagent_call`. + id: + type: string + minLength: 0 + description: The ID of the tool call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent requesting the close. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent to close. required: - type + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id additionalProperties: false - description: Browser use in an OpenAI-hosted session. - PersistedAgentToolConfigParam: - description: A tool that can be stored on a reusable agent without session credentials. + description: A request to close a subagent. + SessionTurnItemResource: + description: An item associated with a session turn. discriminator: propertyName: type mapping: - function: '#/components/schemas/PersistedAgentToolConfigParamFunction' - tool_search: '#/components/schemas/PersistedAgentToolConfigParamToolSearch' - programmatic_tool_calling: '#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling' - mcp: '#/components/schemas/PersistedAgentToolConfigParamMcp' - web_search: '#/components/schemas/PersistedAgentToolConfigParamWebSearch' - computer_use: '#/components/schemas/PersistedAgentToolConfigParamComputerUse' + message: '#/components/schemas/MessageItemResource' + reasoning: '#/components/schemas/ReasoningItemResource' + function_call: '#/components/schemas/FunctionCallItemResource' + function_call_output: '#/components/schemas/FunctionCallOutputItemResource' + agent_message: '#/components/schemas/AgentMessageItemResource' + mcp_call: '#/components/schemas/McpCallItemResource' + computer_use_call: '#/components/schemas/ComputerUseCallItemResource' + computer_use_approval_request: '#/components/schemas/BrowserAuthenticationRequestItemResource' + computer_use_approval_request_result: '#/components/schemas/ComputerUseApprovalRequestResultItemResource' + web_search_call: '#/components/schemas/WebSearchCallItemResource' + command_execution: '#/components/schemas/CommandExecutionItemResource' + interrupt_subagent_call: '#/components/schemas/InterruptSubagentCallItemResource' + create_subagent_call: '#/components/schemas/CreateSubagentCallItemResource' + send_subagent_input_call: '#/components/schemas/SendSubagentInputCallItemResource' + resume_subagent_call: '#/components/schemas/ResumeSubagentCallItemResource' + wait_for_subagents_call: '#/components/schemas/WaitForSubagentsCallItemResource' + close_subagent_call: '#/components/schemas/CloseSubagentCallItemResource' x-oai-discriminator-values: - - function - - tool_search - - programmatic_tool_calling - - mcp - - web_search - - computer_use + - message + - reasoning + - function_call + - function_call_output + - agent_message + - mcp_call + - computer_use_call + - computer_use_approval_request + - computer_use_approval_request_result + - web_search_call + - command_execution + - create_subagent_call + - send_subagent_input_call + - resume_subagent_call + - wait_for_subagents_call + - interrupt_subagent_call + - close_subagent_call anyOf: - - $ref: '#/components/schemas/PersistedAgentToolConfigParamFunction' - - $ref: '#/components/schemas/PersistedAgentToolConfigParamToolSearch' - - $ref: '#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling' - - $ref: '#/components/schemas/PersistedAgentToolConfigParamMcp' - - $ref: '#/components/schemas/PersistedAgentToolConfigParamWebSearch' - - $ref: '#/components/schemas/PersistedAgentToolConfigParamComputerUse' - MultiAgentConfigCurrentParam: - type: object - properties: - enabled: - type: boolean - description: Whether subagent tools are enabled. - max_concurrent_subagents: - type: integer - format: int64 - minimum: 1 - maximum: 4294967295 - description: Maximum number of subagents that may run concurrently. Defaults to 6. - required: - - enabled - additionalProperties: false - description: Explicit configuration for creating and coordinating subagents. - x-openai-go-legacy-bool-fields: - - enabled - CreateAgentParams: + - $ref: '#/components/schemas/MessageItemResource' + - $ref: '#/components/schemas/ReasoningItemResource' + - $ref: '#/components/schemas/FunctionCallItemResource' + - $ref: '#/components/schemas/FunctionCallOutputItemResource' + - $ref: '#/components/schemas/AgentMessageItemResource' + - $ref: '#/components/schemas/McpCallItemResource' + - $ref: '#/components/schemas/ComputerUseCallItemResource' + - $ref: '#/components/schemas/BrowserAuthenticationRequestItemResource' + - $ref: '#/components/schemas/ComputerUseApprovalRequestResultItemResource' + - $ref: '#/components/schemas/WebSearchCallItemResource' + - $ref: '#/components/schemas/CommandExecutionItemResource' + - $ref: '#/components/schemas/CreateSubagentCallItemResource' + - $ref: '#/components/schemas/SendSubagentInputCallItemResource' + - $ref: '#/components/schemas/ResumeSubagentCallItemResource' + - $ref: '#/components/schemas/WaitForSubagentsCallItemResource' + - $ref: '#/components/schemas/InterruptSubagentCallItemResource' + - $ref: '#/components/schemas/CloseSubagentCallItemResource' + SessionItemListResource: type: object properties: - metadata: - type: - - object - - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 512 - propertyNames: - type: string - minLength: 1 - maxLength: 64 - minProperties: 0 - maxProperties: 16 - description: Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map. - name: - type: - - string - - 'null' - minLength: 0 - maxLength: 128 - description: A human-readable name for the agent. Omission or null leaves the agent unnamed. - model: + object: type: string - minLength: 0 - maxLength: 1048576 - description: The model to use for the agent. The requested model name is preserved. - reasoning: - anyOf: - - $ref: '#/components/schemas/ReasoningParam' - - type: 'null' - description: Configuration for model reasoning. Omission uses the model's default effort. - text: - anyOf: - - $ref: '#/components/schemas/TextParam' - - type: 'null' - description: Configuration for generated text. Defaults to the `text` format and medium verbosity. - service_tier: - anyOf: - - $ref: '#/components/schemas/ServiceTierParam' - - type: 'null' - description: The service tier used for model requests. Defaults to `auto`. - instructions: - type: - - string - - 'null' - minLength: 0 - maxLength: 1048576 - description: Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions. - tools: - type: - - array - - 'null' + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array items: - $ref: '#/components/schemas/PersistedAgentToolConfigParam' + $ref: '#/components/schemas/SessionTurnItemResource' minItems: 0 maxItems: 2000 - description: Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. - multi_agent: - anyOf: - - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' - - type: 'null' - description: Configuration for creating and coordinating subagents. Subagent tools are disabled by default. - required: - - model - additionalProperties: false - description: Parameters for creating a reusable agent. - UpdateAgentParams: - type: object - properties: - model: - type: string - minLength: 0 - maxLength: 1048576 - description: The model to use for the agent. The requested model name is preserved. - reasoning: - anyOf: - - $ref: '#/components/schemas/ReasoningParam' - - type: 'null' - description: Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort. - text: - anyOf: - - $ref: '#/components/schemas/TextParam' - - type: 'null' - description: Configuration for text generated by the agent. - service_tier: - anyOf: - - $ref: '#/components/schemas/ServiceTierParam' - - type: 'null' - description: The service tier used for model requests. - instructions: + description: The resources returned in this page, in the requested sort order. + first_id: type: - string - 'null' minLength: 0 - maxLength: 1048576 - description: Additional instructions appended to the agent's default base instructions. Omit to leave unchanged. - multi_agent: - anyOf: - - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' - - type: 'null' - description: Configuration for creating and coordinating subagents. - metadata: - type: - - object - - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 512 - propertyNames: - type: string - minLength: 1 - maxLength: 64 - minProperties: 0 - maxProperties: 16 - description: Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. - name: + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: type: - string - 'null' minLength: 0 - maxLength: 128 - description: A replacement name. Omit to leave unchanged, or pass null to clear it. - tools: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/PersistedAgentToolConfigParam' - minItems: 0 - maxItems: 2000 - description: Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. - additionalProperties: false - description: Fields to replace on an existing reusable agent. - DeletedAgentResource: - type: object - properties: - id: - type: string - minLength: 0 - description: The ID of the deleted agent. - object: - type: string - enum: - - agent.deleted - default: agent.deleted - x-stainless-const: true - description: The object type. Always `agent.deleted`. - deleted: + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: type: boolean - description: Whether the agent was deleted. Always `true`. + description: Whether there are more resources to retrieve after this page. required: - - id - object - - deleted - additionalProperties: false - description: A deleted reusable agent. - EnvironmentPackagesResource: - type: object - properties: - python: - type: array - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Python packages installed in the environment. - system: - type: array - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: System packages installed in the environment. - npm: - type: array - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: npm packages installed globally in the environment. - required: - - python - - system - - npm + - data + - first_id + - last_id + - has_more additionalProperties: false - description: Packages installed in an OpenAI-hosted environment. - NetworkAccessResource: + description: A page of messages, reasoning, and tool calls from a session's item history. + TurnObjectResource: type: string enum: - - enabled - - disabled - - restricted + - agent.session.turn + default: agent.session.turn + x-stainless-const: true + description: The object type for a turn. + TurnStatusResource: + type: string + enum: + - queued + - in_progress + - waiting + - completed + - failed + - cancelled + x-enumDescriptions: + - The turn is waiting to start. + - The turn is in progress. + - The turn is waiting for external input. + - The turn completed successfully. + - The turn failed. + - The turn was cancelled. + description: The current status of a turn. + SessionTurnErrorCodeResource: + type: string + enum: + - context_length_exceeded + - session_budget_exceeded + - usage_limit_exceeded + - project_spend_limit_exceeded + - organization_spend_limit_exceeded + - organization_usage_limit_exceeded + - billing_not_active + - credit_balance_exhausted + - rate_limit_exceeded + - flex_unavailable + - server_overloaded + - cyber_policy + - misalignment_policy_violation + - connection_failed + - server_error + - authentication_error + - invalid_request + - resource_not_found + - sandbox_error + - executor_version_incompatible + - active_turn_not_steerable + - request_timeout + - internal_error x-enumDescriptions: - - Allows unrestricted network access. - - Disables network access. - - Applies the configured domain restrictions. - description: The network access mode for an OpenAI-hosted environment. - NetworkPolicyResource: - type: object - properties: - access: - $ref: '#/components/schemas/NetworkAccessResource' - description: The environment's network access mode. - allowed_domains: - type: array - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: Domains the environment may access when network access is restricted. - required: - - access - - allowed_domains - additionalProperties: false - description: Network access for an OpenAI-hosted environment. - DesktopResource: - type: object - properties: - enabled: - type: boolean - description: Whether the environment provisions a desktop and browser proxy. - required: - - enabled - additionalProperties: false - description: The effective desktop configuration for an OpenAI-hosted environment. - HostedTemplateSkillResourceSkillReference: + - The request exceeds the model's context window. + - The session has reached its usage budget. + - The organization has reached a usage, plan, or billing limit. + - The project has reached its enforced spend limit. + - The organization has reached its enforced spend limit. + - The organization has reached its OpenAI-assigned usage limit. + - Billing is not active for the account. + - The organization has no API credits remaining. + - The request exceeds the available rate limit. + - Flex processing is temporarily unavailable. + - The model service is temporarily overloaded. + - The request was rejected by a safety policy. + - The request was blocked by the safety systems. + - The request could not connect to the model service. + - The model service encountered an unexpected error. + - The API credentials are invalid or lack the required access. + - The request contains invalid input or configuration. + - The requested model or resource is unavailable. + - The request could not complete in its execution environment. + - The executor must be upgraded before it can run this turn. + - The session cannot accept additional input while a request is running. + - The request timed out before the model service responded. + - An unexpected internal error prevented the session request from completing. + description: Stable public categories for session request failures. + SessionTurnErrorResource: type: object properties: - type: - type: string - enum: - - skill_reference - default: skill_reference - x-stainless-const: true - description: The type of the object. Always `skill_reference`. - skill_id: + code: + $ref: '#/components/schemas/SessionTurnErrorCodeResource' + description: A stable, machine-readable failure category. + message: type: string minLength: 0 - description: The referenced skill ID. - version: - type: - - string - - 'null' - minLength: 0 - description: The requested version selector, including `latest`. + description: A customer-safe explanation of the failure. required: - - type - - skill_id - - version + - code + - message additionalProperties: false - description: A skill resolved afresh from the Skills API whenever a session starts. - HostedTemplateSkillResourceInline: + description: A customer-safe error describing why a session request failed. + InputTokensDetailsResource-2: type: object properties: - type: - type: string - enum: - - inline - default: inline - x-stainless-const: true - description: The type of the object. Always `inline`. - name: - type: string - minLength: 0 - description: The skill name declared in `SKILL.md`. - description: - type: string - minLength: 0 - description: The skill description declared in `SKILL.md`. + cached_tokens: + type: integer + format: int64 + description: The number of input tokens retrieved from the prompt cache. required: - - type - - name - - description + - cached_tokens additionalProperties: false - description: Safe metadata for an inline skill archive. - HostedTemplateSkillResource: - description: Safe metadata for a skill configured by an environment template. - discriminator: - propertyName: type - mapping: - skill_reference: '#/components/schemas/HostedTemplateSkillResourceSkillReference' - inline: '#/components/schemas/HostedTemplateSkillResourceInline' - x-oai-discriminator-values: - - skill_reference - - inline - anyOf: - - $ref: '#/components/schemas/HostedTemplateSkillResourceSkillReference' - - $ref: '#/components/schemas/HostedTemplateSkillResourceInline' - HostedTemplateFileResourceFileId: + description: A breakdown of input token usage for a session or turn. + OutputTokensDetailsResource-2: type: object properties: - type: - type: string - enum: - - file_id - default: file_id - x-stainless-const: true - description: The type of the object. Always `file_id`. - file_id: - type: string - minLength: 0 - description: The ID of the uploaded file. - path: - type: string - minLength: 0 - description: The file's absolute path inside the environment. + reasoning_tokens: + type: integer + format: int64 + description: The number of output tokens used for reasoning. required: - - type - - file_id - - path + - reasoning_tokens additionalProperties: false - description: A project-scoped Files API reference resolved separately for each session. - HostedTemplateFileResourceInline: + description: A breakdown of output token usage for a session or turn. + TokenUsageResource: type: object properties: - type: - type: string - enum: - - inline - default: inline - x-stainless-const: true - description: The type of the object. Always `inline`. - path: - type: string - minLength: 0 - description: The file's absolute path inside the environment. - size_bytes: + input_tokens: type: integer format: int64 - minimum: 0 - description: The decoded size of the inline file in bytes. + description: The number of input tokens used by the agent. + input_tokens_details: + $ref: '#/components/schemas/InputTokensDetailsResource-2' + description: A breakdown of the agent's input token usage. + output_tokens: + type: integer + format: int64 + description: The number of output tokens generated by the agent. + output_tokens_details: + $ref: '#/components/schemas/OutputTokensDetailsResource-2' + description: A breakdown of the agent's output token usage. + total_tokens: + type: integer + format: int64 + description: The total number of input and output tokens used by the agent. required: - - type - - path - - size_bytes + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens additionalProperties: false - description: Metadata for confidential inline file contents. - HostedTemplateFileResource: - description: Safe metadata for a file configured by an environment template. - discriminator: - propertyName: type - mapping: - file_id: '#/components/schemas/HostedTemplateFileResourceFileId' - inline: '#/components/schemas/HostedTemplateFileResourceInline' - x-oai-discriminator-values: - - file_id - - inline - anyOf: - - $ref: '#/components/schemas/HostedTemplateFileResourceFileId' - - $ref: '#/components/schemas/HostedTemplateFileResourceInline' - EnvironmentTemplateResource: + description: Recorded token usage for a session or turn. Usage is best effort and may change. + TurnResource: type: object properties: id: type: string minLength: 0 - description: The ID of the reusable environment template. - name: + description: The ID of the turn. + object: + $ref: '#/components/schemas/TurnObjectResource' + description: The object type. Always `agent.session.turn`. + session_id: + type: string + minLength: 0 + description: The ID of the session that owns the turn. + agent_id: + type: string + minLength: 0 + description: The ID of the agent that ran the turn. + subagent_id: type: - string - 'null' minLength: 0 - description: An optional human-readable display name for the template. - object: - type: string - enum: - - agent.environment.template - default: agent.environment.template - x-stainless-const: true - description: The object type. Always `agent.environment.template`. + description: The ID of the subagent that ran the turn, if applicable. + status: + $ref: '#/components/schemas/TurnStatusResource' + description: The current status of the turn. created_at: type: integer format: int64 - description: The Unix timestamp, in seconds, when the template was created. - updated_at: - type: integer + description: The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable. + started_at: + type: + - integer + - 'null' format: int64 - description: The Unix timestamp, in seconds, when the template was last updated. - packages: - $ref: '#/components/schemas/EnvironmentPackagesResource' - description: Packages installed in each fresh OpenAI-hosted environment. - network: - $ref: '#/components/schemas/NetworkPolicyResource' - description: Runtime network access for each OpenAI-hosted environment. - desktop: - $ref: '#/components/schemas/DesktopResource' - description: Desktop configuration for each OpenAI-hosted environment. - capability_directories: - type: array - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: Directories that expose capabilities to the agent. - skills: - type: array - items: - $ref: '#/components/schemas/HostedTemplateSkillResource' - minItems: 0 - maxItems: 200 - description: Safe skill metadata, preserving unresolved version selectors. - plugins: - type: array - items: - $ref: '#/components/schemas/HostedPluginResource' - minItems: 0 - maxItems: 32 - description: Safe plugin metadata, excluding inline archive contents. - files: - type: array - items: - $ref: '#/components/schemas/HostedTemplateFileResource' - minItems: 0 - maxItems: 50 - description: Safe file metadata, excluding contents and session-scoped file IDs. + description: The Unix timestamp, in seconds, when the turn started. + completed_at: + type: + - integer + - 'null' + format: int64 + description: The Unix timestamp, in seconds, when the turn reached a terminal state. + error: + anyOf: + - $ref: '#/components/schemas/SessionTurnErrorResource' + - type: 'null' + description: A customer-safe error. Non-null only for a failed turn. + usage: + anyOf: + - $ref: '#/components/schemas/TokenUsageResource' + - type: 'null' + description: Best-effort token usage for the turn, or null if unknown. Recorded usage may change. required: - id - - name - object + - session_id + - agent_id + - subagent_id + - status - created_at - - updated_at - - packages - - network - - capability_directories - - skills - - plugins - - files + - started_at + - completed_at + - error + - usage additionalProperties: false - description: Reusable configuration that provisions a fresh OpenAI-hosted environment for each session. - EnvironmentTemplateListResource: + description: The canonical public representation of a session turn. + SessionTurnListResource: type: object properties: object: @@ -87168,7 +89130,7 @@ components: data: type: array items: - $ref: '#/components/schemas/EnvironmentTemplateResource' + $ref: '#/components/schemas/TurnResource' minItems: 0 maxItems: 2000 description: The resources returned in this page, in the requested sort order. @@ -87195,402 +89157,441 @@ components: - has_more additionalProperties: false description: A page of Agents API resources, with IDs for retrieving additional pages. - CreateEnvironmentTemplateParams: - type: object - properties: - packages: - anyOf: - - $ref: '#/components/schemas/EnvironmentPackagesParam' - - type: 'null' - description: Packages to install in the environment. Defaults to empty package lists. - setup_commands: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/SetupCommandParam' - minItems: 0 - maxItems: 16 - description: Ordered, confidential setup commands. Command bodies are never returned. - network: - anyOf: - - $ref: '#/components/schemas/NetworkPolicyParam' - - type: 'null' - description: Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled. - desktop: - anyOf: - - $ref: '#/components/schemas/DesktopParam' - - type: 'null' - description: Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled. - x-openai-go-legacy-bool-fields: - - enabled - env: - type: - - object - - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 1048576 - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: Environment variables made available to the agent. - capability_directories: - type: - - array - - 'null' - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. - skills: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/HostedSkillParam' - minItems: 0 - maxItems: 200 - description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. - plugins: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/HostedPluginParam' - minItems: 0 - maxItems: 32 - description: Plugins provided as inline ZIP archives. Defaults to an empty list. - files: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/HostedEnvironmentFileParam' - minItems: 0 - maxItems: 50 - description: Files available before the agent starts. Defaults to an empty list. - name: - type: - - string - - 'null' - minLength: 1 - maxLength: 256 - description: An optional human-readable display name for the template. - additionalProperties: false - description: Parameters for creating a reusable, project-scoped OpenAI-hosted environment template. - UpdateEnvironmentTemplateParams: + PersistedAgentToolResourceFunction: type: object properties: - name: - type: - - string - - 'null' - minLength: 1 - maxLength: 256 - description: A replacement human-readable display name, or `null` to clear the name. - packages: - anyOf: - - $ref: '#/components/schemas/EnvironmentPackagesParam' - - type: 'null' - description: Packages installed before the runtime network policy applies. - setup_commands: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/SetupCommandParam' - minItems: 0 - maxItems: 16 - description: Replacement confidential setup commands, never included in returned resources. - network: - anyOf: - - $ref: '#/components/schemas/NetworkPolicyParam' - - type: 'null' - description: Network access available after setup completes. Omit to preserve the current policy, or pass `null` to reset to the default policy. - desktop: - anyOf: - - $ref: '#/components/schemas/DesktopParam' - - type: 'null' - description: Replacement desktop configuration, or null to disable the desktop. - x-openai-go-legacy-bool-fields: - - enabled - env: - type: - - object - - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 1048576 - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: Replacement confidential environment values. - capability_directories: - type: - - array - - 'null' - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Directories that expose capabilities to the agent. - skills: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/HostedSkillParam' - minItems: 0 - maxItems: 200 - description: Replacement skill configuration installed for each new session. - plugins: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/HostedPluginParam' - minItems: 0 - maxItems: 32 - description: Replacement plugin configuration installed for each new session. - files: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/HostedEnvironmentFileParam' - minItems: 0 - maxItems: 50 - description: Replacement file configuration materialized for each new session. + type: + type: string + enum: + - function + default: function + x-stainless-const: true + description: The type of the object. Always `function`. + name: + type: string + minLength: 0 + description: The name of the function. + description: + type: string + minLength: 0 + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + description: Whether the function is deferred and discovered through tool search. + required: + - type + - name + - description + - parameters + - defer_loading additionalProperties: false - description: Fields to replace on an existing reusable OpenAI-hosted environment template. - DeletedEnvironmentTemplateResource: + description: A function defined by the application. + PersistedAgentToolResourceToolSearch: type: object properties: - id: + type: type: string - minLength: 0 - description: The ID of the deleted environment template. - object: + enum: + - tool_search + default: tool_search + x-stainless-const: true + description: The type of the object. Always `tool_search`. + required: + - type + additionalProperties: false + description: Discovers deferred function tools and loads them into the model context. + PersistedAgentToolResourceProgrammaticToolCalling: + type: object + properties: + type: type: string enum: - - agent.environment.template.deleted - default: agent.environment.template.deleted + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true - description: The object type. Always `agent.environment.template.deleted`. - deleted: + description: The type of the object. Always `programmatic_tool_calling`. + enabled: type: boolean - description: Whether the environment template was deleted. Always `true`. + description: Whether tools can be called from model-generated code. required: - - id - - object - - deleted + - type + - enabled additionalProperties: false - description: A deleted reusable environment template. - SessionStatusResource: - type: string - enum: - - idle - - in_progress - - requires_action - - failed - x-enumDescriptions: - - The session has no turn in progress and is ready for input. A hosted environment may still be provisioning. - - The session is processing a turn. - - The session is waiting for one or more required actions. - - The session failed. - description: The current status of a session. - ComputerUseApprovalRequestKindResourceBrowserAuthentication: + description: Enables calling tools from model-generated code. + PersistedMcpTransportResourceHttp: type: object properties: type: type: string enum: - - browser_authentication - default: browser_authentication + - http + default: http x-stainless-const: true - description: The type of the object. Always `browser_authentication`. - reason: - type: - - string - - 'null' + description: The type of the object. Always `http`. + server_url: + type: string minLength: 0 - description: Why the agent needs the user to sign in. - credential_origin: - type: - - string - - 'null' + description: The URL of the MCP server. + headers: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Non-secret HTTP headers sent to the MCP server. + required: + - type + - server_url + - headers + additionalProperties: false + description: Connects to an MCP server over HTTP. + PersistedMcpTransportResourceStdio: + type: object + properties: + type: + type: string + enum: + - stdio + default: stdio + x-stainless-const: true + description: The type of the object. Always `stdio`. + command: + type: string minLength: 0 - description: The registered form or frame origin where values will be entered. - fields: + description: The command used to start the MCP server. + args: type: array items: - $ref: '#/components/schemas/BrowserAuthenticationFieldResource' + type: string + minLength: 0 minItems: 0 maxItems: 2000 - description: Controls to render. All submitted values are sensitive. - options: + description: Arguments passed to the MCP server command. + cwd: + type: string + minLength: 0 + description: The working directory used to start the MCP server. + env_vars: type: array items: - $ref: '#/components/schemas/BrowserAuthenticationOptionResource' + type: string + minLength: 0 minItems: 0 maxItems: 2000 - description: Sign-in methods. Empty for a plain form. + description: Environment variable names inherited from the execution environment. required: - type - - reason - - credential_origin - - fields - - options + - command + - args + - cwd + - env_vars additionalProperties: false - description: A registered form awaiting the application's response. - ComputerUseApprovalRequestKindResourceBrowserOriginAccess: + description: Starts an MCP server as a local process. + PersistedMcpTransportResource: + description: A credential-free transport used to connect to an MCP server. + discriminator: + propertyName: type + mapping: + http: '#/components/schemas/PersistedMcpTransportResourceHttp' + stdio: '#/components/schemas/PersistedMcpTransportResourceStdio' + x-oai-discriminator-values: + - http + - stdio + anyOf: + - $ref: '#/components/schemas/PersistedMcpTransportResourceHttp' + - $ref: '#/components/schemas/PersistedMcpTransportResourceStdio' + PersistedAgentToolResourceMcp: type: object properties: type: type: string enum: - - browser_origin_access - default: browser_origin_access + - mcp + default: mcp x-stainless-const: true - description: The type of the object. Always `browser_origin_access`. - reason: + description: The type of the object. Always `mcp`. + server_label: + type: string + minLength: 0 + description: A label used to identify the MCP server in tool calls. + credential_id: type: - string - 'null' minLength: 0 - description: The browser's explanation for this request, or null when unavailable. - origin: - type: string - minLength: 0 - description: The origin the browser needs permission to access. + description: The vault credential selected for this MCP server, if any. + transport: + $ref: '#/components/schemas/PersistedMcpTransportResource' + description: The credential-free transport used to connect to the MCP server. + request_metadata: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Metadata included with requests to this MCP server. + allowed_tools: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The MCP tools the agent may call, or null when all server tools are allowed. + required: + type: boolean + description: Whether this MCP server must initialize before the first turn. + connection_origin: + $ref: '#/components/schemas/McpConnectionOriginResource' + description: Where outbound MCP HTTP connections originate. required: - type - - reason - - origin + - server_label + - credential_id + - transport + - request_metadata + - allowed_tools + - required + - connection_origin additionalProperties: false - description: A browser origin awaiting the application's approval decision. - ComputerUseApprovalRequestKindResource: - x-oai-discriminator-values: - - browser_authentication - - browser_origin_access - discriminator: - propertyName: type - mapping: - browser_authentication: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication' - browser_origin_access: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess' - anyOf: - - $ref: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication' - - $ref: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess' - SessionRequiredActionResourceComputerUseApprovalRequest: + description: Tools provided by a remote MCP server without stored credentials. + PersistedAgentToolResourceWebSearch: type: object properties: type: type: string enum: - - computer_use_approval_request - default: computer_use_approval_request + - web_search + default: web_search x-stainless-const: true - description: The type of the object. Always `computer_use_approval_request`. - turn_id: - type: string - minLength: 0 - description: The turn that requested approval. - request_id: + description: The type of the object. Always `web_search`. + mode: + $ref: '#/components/schemas/WebSearchModeResource' + description: The source used for web search results. + context_size: + $ref: '#/components/schemas/WebSearchContextSizeResource' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Allowed search domains, or `null` when the search is unrestricted. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationResource' + - type: 'null' + description: Approximate location used to localize search results, if provided. + required: + - type + - mode + - context_size + - allowed_domains + - location + additionalProperties: false + description: Web search. + PersistedAgentToolResourceComputerUse: + type: object + properties: + type: type: string - minLength: 0 - description: The registered request ID to echo when responding. - request: - $ref: '#/components/schemas/ComputerUseApprovalRequestKindResource' - description: The information needed to render the request. + enum: + - computer_use + default: computer_use + x-stainless-const: true + description: The type of the object. Always `computer_use`. + include_screenshots: + type: boolean + description: Whether computer tool outputs include screenshots. required: - type - - turn_id - - request_id - - request + - include_screenshots additionalProperties: false - description: Respond to a computer-use request. - SessionRequiredActionResourceFunctionCall: + description: Browser use in an OpenAI-hosted session. + PersistedAgentToolResourceAutomations: type: object properties: type: type: string enum: - - function_call - default: function_call + - automations + default: automations x-stainless-const: true - description: The type of the object. Always `function_call`. - turn_id: + description: The type of the object. Always `automations`. + required: + - type + additionalProperties: false + description: Lets the agent manage its own scheduled wakeups. + PersistedAgentToolResource: + description: A credential-free tool available to a reusable agent. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/PersistedAgentToolResourceFunction' + tool_search: '#/components/schemas/PersistedAgentToolResourceToolSearch' + programmatic_tool_calling: '#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling' + mcp: '#/components/schemas/PersistedAgentToolResourceMcp' + web_search: '#/components/schemas/PersistedAgentToolResourceWebSearch' + computer_use: '#/components/schemas/PersistedAgentToolResourceComputerUse' + automations: '#/components/schemas/PersistedAgentToolResourceAutomations' + x-oai-discriminator-values: + - function + - tool_search + - programmatic_tool_calling + - mcp + - web_search + - computer_use + - automations + anyOf: + - $ref: '#/components/schemas/PersistedAgentToolResourceFunction' + - $ref: '#/components/schemas/PersistedAgentToolResourceToolSearch' + - $ref: '#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling' + - $ref: '#/components/schemas/PersistedAgentToolResourceMcp' + - $ref: '#/components/schemas/PersistedAgentToolResourceWebSearch' + - $ref: '#/components/schemas/PersistedAgentToolResourceComputerUse' + - $ref: '#/components/schemas/PersistedAgentToolResourceAutomations' + AgentResource: + type: object + properties: + id: type: string minLength: 0 - description: The ID of the turn that requested the function call. - call_id: + description: The ID of the reusable agent. + object: type: string - minLength: 0 - description: The ID to include when submitting the function result. + enum: + - agent + default: agent + x-stainless-const: true + description: The object type. Always `agent`. + created_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the agent was created. + updated_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the agent was last updated. name: + type: + - string + - 'null' + minLength: 0 + description: A human-readable name for the agent, or null if it is unnamed. + metadata: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Custom string key-value pairs attached to the agent. + model: type: string minLength: 0 - description: The function name. - arguments: - description: The arguments supplied by the model. + description: The requested model name used for inference. + reasoning: + $ref: '#/components/schemas/ReasoningResource' + description: The resolved reasoning configuration, including the model default for an omitted effort. + text: + $ref: '#/components/schemas/TextResource' + description: The resolved configuration for text generated by the agent. + service_tier: + $ref: '#/components/schemas/ServiceTierResource' + description: The resolved service-tier policy used for model requests. + instructions: + type: + - string + - 'null' + minLength: 0 + description: Custom instructions appended to the agent's default base instructions. + tools: + type: array + items: + $ref: '#/components/schemas/PersistedAgentToolResource' + minItems: 0 + maxItems: 2000 + description: Tools available to the agent. + multi_agent: + $ref: '#/components/schemas/MultiAgentConfigResource' + description: The resolved configuration for creating and coordinating subagents. required: - - type - - turn_id - - call_id + - id + - object + - created_at + - updated_at - name - - arguments + - metadata + - model + - reasoning + - text + - service_tier + - instructions + - tools + - multi_agent additionalProperties: false - description: Run a function tool and submit its result. - SessionRequiredActionResourceEnvironmentConnection: + description: A reusable agent scoped to the caller's project. + AgentListResource: type: object properties: - type: + object: type: string enum: - - environment_connection - default: environment_connection + - list + default: list x-stainless-const: true - description: The type of the object. Always `environment_connection`. - environment_id: - type: string + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/AgentResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' minLength: 0 - description: The ID of the environment to reconnect. + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. required: - - type - - environment_id + - object + - data + - first_id + - last_id + - has_more additionalProperties: false - description: Reconnect a session environment. - SessionRequiredActionResource: - description: An action that must be completed before a session can continue. - discriminator: - propertyName: type - mapping: - computer_use_approval_request: '#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest' - function_call: '#/components/schemas/SessionRequiredActionResourceFunctionCall' - environment_connection: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' - x-oai-discriminator-values: - - computer_use_approval_request - - function_call - - environment_connection - anyOf: - - $ref: '#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest' - - $ref: '#/components/schemas/SessionRequiredActionResourceFunctionCall' - - $ref: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' - AgentToolResourceFunction: + description: A page of Agents API resources, with IDs for retrieving additional pages. + PersistedAgentToolConfigParamFunction: type: object properties: type: @@ -87603,31 +89604,49 @@ components: name: type: string minLength: 0 + maxLength: 1048576 description: The name of the function. description: type: string minLength: 0 + maxLength: 1048576 description: A description of what the function does. parameters: type: object additionalProperties: {} propertyNames: type: string - minLength: 0 + minLength: 1 + maxLength: 256 minProperties: 0 + maxProperties: 1024 description: A JSON Schema object describing the function's arguments. defer_loading: type: boolean - description: Whether the function is deferred and discovered through tool search. + default: false + description: Whether this function is deferred and discovered through tool search. Defaults to `false`. required: - type - name - description - parameters - - defer_loading additionalProperties: false description: A function defined by the application. - AgentToolResourceProgrammaticToolCalling: + PersistedAgentToolConfigParamToolSearch: + type: object + properties: + type: + type: string + enum: + - tool_search + default: tool_search + x-stainless-const: true + description: The type of the object. Always `tool_search`. + required: + - type + additionalProperties: false + description: Discovers deferred function tools and loads them into the model context. + PersistedAgentToolConfigParamProgrammaticToolCalling: type: object properties: type: @@ -87639,13 +89658,13 @@ components: description: The type of the object. Always `programmatic_tool_calling`. enabled: type: boolean - description: Whether tools can be called from model-generated code. + default: true + description: Whether tools can be called from model-generated code. Defaults to `true`. required: - type - - enabled additionalProperties: false description: Enables calling tools from model-generated code. - McpTransportResourceHttp: + PersistedMcpTransportConfigParamHttp: type: object properties: type: @@ -87658,13 +89677,29 @@ components: server_url: type: string minLength: 0 + maxLength: 1048576 description: The URL of the MCP server. + headers: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Non-secret HTTP headers sent to the MCP server. required: - type - server_url additionalProperties: false description: Connects to an MCP server over HTTP. - McpTransportResourceStdio: + PersistedMcpTransportConfigParamStdio: type: object properties: type: @@ -87677,49 +89712,55 @@ components: command: type: string minLength: 0 + maxLength: 1048576 description: The command used to start the MCP server. args: - type: array + type: + - array + - 'null' items: type: string minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 + maxItems: 16384 description: Arguments passed to the MCP server command. cwd: type: string minLength: 0 + maxLength: 1048576 description: The working directory used to start the MCP server. env_vars: - type: array + type: + - array + - 'null' items: type: string minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: Environment variable names inherited from the execution environment. + maxItems: 16384 + description: Environment variable names to inherit from the selected execution environment. required: - type - command - - args - cwd - - env_vars additionalProperties: false description: Starts an MCP server as a local process. - McpTransportResource: - description: The transport used to connect to an MCP server. + PersistedMcpTransportConfigParam: + description: A credential-free transport used to connect to an MCP server. discriminator: propertyName: type mapping: - http: '#/components/schemas/McpTransportResourceHttp' - stdio: '#/components/schemas/McpTransportResourceStdio' + http: '#/components/schemas/PersistedMcpTransportConfigParamHttp' + stdio: '#/components/schemas/PersistedMcpTransportConfigParamStdio' x-oai-discriminator-values: - http - stdio anyOf: - - $ref: '#/components/schemas/McpTransportResourceHttp' - - $ref: '#/components/schemas/McpTransportResourceStdio' - AgentToolResourceMcp: + - $ref: '#/components/schemas/PersistedMcpTransportConfigParamHttp' + - $ref: '#/components/schemas/PersistedMcpTransportConfigParamStdio' + PersistedAgentToolConfigParamMcp: type: object properties: type: @@ -87732,23 +89773,29 @@ components: server_label: type: string minLength: 0 + maxLength: 1048576 description: A label used to identify the MCP server in tool calls. credential_id: type: - string - 'null' minLength: 0 - description: The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL. + maxLength: 1048576 + description: The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL. transport: - $ref: '#/components/schemas/McpTransportResource' - description: The transport used to connect to the MCP server. + $ref: '#/components/schemas/PersistedMcpTransportConfigParam' + description: The credential-free transport used to connect to the MCP server. request_metadata: - type: object + type: + - object + - 'null' additionalProperties: {} propertyNames: type: string - minLength: 0 + minLength: 1 + maxLength: 256 minProperties: 0 + maxProperties: 1024 description: Metadata included with requests to this MCP server. allowed_tools: type: @@ -87757,27 +89804,26 @@ components: items: type: string minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: The MCP tools the agent may call. + maxItems: 16384 + description: The MCP tools the agent may call. All server tools are allowed when omitted. required: type: boolean - description: Whether this MCP server must initialize before the first turn. + default: false + description: Whether this MCP server must initialize before the first turn. Defaults to `false`. connection_origin: - $ref: '#/components/schemas/McpConnectionOriginResource' - description: Where outbound MCP HTTP connections originate. + anyOf: + - $ref: '#/components/schemas/McpConnectionOriginParam' + - type: 'null' + description: Selects where outbound MCP HTTP connections originate. required: - type - server_label - - credential_id - transport - - request_metadata - - allowed_tools - - required - - connection_origin additionalProperties: false - description: Tools provided by a remote MCP server. - AgentToolResourceWebSearch: + description: Tools provided by a remote MCP server without stored credentials. + PersistedAgentToolConfigParamWebSearch: type: object properties: type: @@ -87788,10 +89834,14 @@ components: x-stainless-const: true description: The type of the object. Always `web_search`. mode: - $ref: '#/components/schemas/WebSearchModeResource' - description: The source used for web search results. + anyOf: + - $ref: '#/components/schemas/WebSearchModeParam' + - type: 'null' + description: The source used for web search results. Defaults to `live`. context_size: - $ref: '#/components/schemas/WebSearchContextSizeResource' + anyOf: + - $ref: '#/components/schemas/WebSearchContextSizeParam' + - type: 'null' description: The amount of search context made available to the model. Defaults to `medium`. allowed_domains: type: @@ -87800,23 +89850,20 @@ components: items: type: string minLength: 0 + maxLength: 1048576 minItems: 0 - maxItems: 2000 - description: Allowed search domains, or `null` when the search is unrestricted. + maxItems: 16384 + description: Domains the search may include. location: anyOf: - - $ref: '#/components/schemas/WebSearchLocationResource' + - $ref: '#/components/schemas/WebSearchLocationParam' - type: 'null' - description: Approximate location used to localize search results, if provided. + description: Approximate location used to localize search results. required: - type - - mode - - context_size - - allowed_domains - - location additionalProperties: false description: Web search. - AgentToolResourceComputerUse: + PersistedAgentToolConfigParamComputerUse: type: object properties: type: @@ -87828,319 +89875,296 @@ components: description: The type of the object. Always `computer_use`. include_screenshots: type: boolean - description: Whether computer tool outputs include screenshots. + default: false + description: Whether computer tool outputs include screenshots. Defaults to `false`. required: - type - - include_screenshots additionalProperties: false description: Browser use in an OpenAI-hosted session. - AgentToolResource: - description: A tool available to the agent. + PersistedAgentToolConfigParamAutomations: + type: object + properties: + type: + type: string + enum: + - automations + default: automations + x-stainless-const: true + description: The type of the object. Always `automations`. + required: + - type + additionalProperties: false + description: Lets the agent manage its own scheduled wakeups. + PersistedAgentToolConfigParam: + description: A tool that can be stored on a reusable agent without session credentials. discriminator: propertyName: type mapping: - function: '#/components/schemas/AgentToolResourceFunction' - programmatic_tool_calling: '#/components/schemas/AgentToolResourceProgrammaticToolCalling' - mcp: '#/components/schemas/AgentToolResourceMcp' - web_search: '#/components/schemas/AgentToolResourceWebSearch' - computer_use: '#/components/schemas/AgentToolResourceComputerUse' + function: '#/components/schemas/PersistedAgentToolConfigParamFunction' + tool_search: '#/components/schemas/PersistedAgentToolConfigParamToolSearch' + programmatic_tool_calling: '#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling' + mcp: '#/components/schemas/PersistedAgentToolConfigParamMcp' + web_search: '#/components/schemas/PersistedAgentToolConfigParamWebSearch' + computer_use: '#/components/schemas/PersistedAgentToolConfigParamComputerUse' + automations: '#/components/schemas/PersistedAgentToolConfigParamAutomations' x-oai-discriminator-values: - function + - tool_search - programmatic_tool_calling - mcp - web_search - computer_use + - automations anyOf: - - $ref: '#/components/schemas/AgentToolResourceFunction' - - $ref: '#/components/schemas/AgentToolResourceProgrammaticToolCalling' - - $ref: '#/components/schemas/AgentToolResourceMcp' - - $ref: '#/components/schemas/AgentToolResourceWebSearch' - - $ref: '#/components/schemas/AgentToolResourceComputerUse' - SessionAgentResource: + - $ref: '#/components/schemas/PersistedAgentToolConfigParamFunction' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamToolSearch' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamMcp' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamWebSearch' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamComputerUse' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamAutomations' + CreateAgentParams: type: object properties: - id: - type: string - minLength: 0 - description: The ID of the agent. + metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map. name: type: - string - 'null' minLength: 0 - description: The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value. + maxLength: 128 + description: A human-readable name for the agent. Omission or null leaves the agent unnamed. model: type: string minLength: 0 - description: The model used by the agent. + maxLength: 1048576 + description: The model to use for the agent. The requested model name is preserved. reasoning: - $ref: '#/components/schemas/ReasoningResource' - description: The agent's reasoning configuration. + anyOf: + - $ref: '#/components/schemas/ReasoningParam' + - type: 'null' + description: Configuration for model reasoning. Omission uses the model's default effort. text: - $ref: '#/components/schemas/TextResource' - description: Configuration for text generated by the agent. + anyOf: + - $ref: '#/components/schemas/TextParam' + - type: 'null' + description: Configuration for generated text. Defaults to the `text` format and medium verbosity. service_tier: - $ref: '#/components/schemas/ServiceTierResource' - description: The effective service-tier policy for model requests. Defaults to `auto`. + anyOf: + - $ref: '#/components/schemas/ServiceTierParam' + - type: 'null' + description: The service tier used for model requests. Defaults to `auto`. instructions: type: - string - 'null' minLength: 0 - description: Custom instructions appended to the agent's default base instructions. + maxLength: 1048576 + description: Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions. tools: - type: array + type: + - array + - 'null' items: - $ref: '#/components/schemas/AgentToolResource' + $ref: '#/components/schemas/PersistedAgentToolConfigParam' minItems: 0 maxItems: 2000 - description: Tools available to the agent. + description: Tools available to the agent. Defaults to an empty list. The tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. multi_agent: - $ref: '#/components/schemas/MultiAgentConfigResource' - description: Configuration for creating and coordinating subagents. + anyOf: + - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' + - type: 'null' + description: Configuration for creating and coordinating subagents. Subagent tools are disabled by default. required: - - id - - name - model - - reasoning - - text - - service_tier - - instructions - - tools - - multi_agent - additionalProperties: false - description: The effective agent configuration for a session. - EnvironmentResourceNone: - type: object - properties: - type: - type: string - enum: - - none - default: none - x-stainless-const: true - description: The type of the object. Always `none`. - required: - - type additionalProperties: false - description: The session talks to CCA without selecting or provisioning an execution environment. - ContainerSizeResource: - type: string - enum: - - small - - medium - - large - description: The effective CPU and memory tier of an OpenAI-hosted environment. - EnvironmentResourceOpenaiHosted: + description: Parameters for creating a reusable agent. + UpdateAgentParams: type: object properties: - type: - type: string - enum: - - openai_hosted - default: openai_hosted - x-stainless-const: true - description: The type of the object. Always `openai_hosted`. - id: + model: type: string minLength: 0 - description: The public ID of the environment. - container_size: + maxLength: 1048576 + description: The model to use for the agent. The requested model name is preserved. + reasoning: anyOf: - - $ref: '#/components/schemas/ContainerSizeResource' + - $ref: '#/components/schemas/ReasoningParam' - type: 'null' - description: The effective CPU and memory tier, or null when unknown or outside the public tiers. - x-stainless-skip: - - cli - packages: - $ref: '#/components/schemas/EnvironmentPackagesResource' - description: Packages installed in the environment. - network: - $ref: '#/components/schemas/NetworkPolicyResource' - description: The effective network access policy for the environment. - desktop: - $ref: '#/components/schemas/DesktopResource' - description: The effective desktop configuration. - capability_directories: - type: array - items: + description: Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort. + text: + anyOf: + - $ref: '#/components/schemas/TextParam' + - type: 'null' + description: Configuration for text generated by the agent. + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierParam' + - type: 'null' + description: The service tier used for model requests. + instructions: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Additional instructions appended to the agent's default base instructions. Omit to leave unchanged. + multi_agent: + anyOf: + - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' + - type: 'null' + description: Configuration for creating and coordinating subagents. + metadata: + type: + - object + - 'null' + additionalProperties: type: string minLength: 0 - minItems: 0 - maxItems: 2000 - description: Directories that contain capabilities exposed to the agent. - skills: - type: array - items: - $ref: '#/components/schemas/HostedSkillResource' - minItems: 0 - maxItems: 2000 - description: Skills installed in the environment, excluding their archive contents. - plugins: - type: array + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. + name: + type: + - string + - 'null' + minLength: 0 + maxLength: 128 + description: A replacement name. Omit to leave unchanged, or pass null to clear it. + tools: + type: + - array + - 'null' items: - $ref: '#/components/schemas/HostedPluginResource' + $ref: '#/components/schemas/PersistedAgentToolConfigParam' minItems: 0 maxItems: 2000 - description: Plugins installed in the environment, excluding their archive contents. - files: - type: array - items: - $ref: '#/components/schemas/HostedEnvironmentFileResource' - minItems: 0 - maxItems: 50 - description: Files available in the environment, excluding their contents. - required: - - type - - id - - packages - - network - - capability_directories - - skills - - plugins - - files + description: Replaces the tool list. Omit to leave it unchanged, or pass null to clear it. The replacement must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. additionalProperties: false - description: An environment hosted by OpenAI. - EnvironmentResourceSelfHosted: + description: Fields to replace on an existing reusable agent. + DeletedAgentResource: type: object properties: - type: - type: string - enum: - - self_hosted - default: self_hosted - x-stainless-const: true - description: The type of the object. Always `self_hosted`. - remote_url: - type: string - minLength: 0 - description: Pass this URL unchanged to `codex exec-server --remote` when connecting this environment. id: type: string minLength: 0 - description: The public ID of the environment. - workspace_directory: + description: The ID of the deleted agent. + object: type: string - minLength: 0 - description: The absolute project directory inside the environment. Defaults to `/workspace`. - capability_directories: - type: array - items: - type: string - minLength: 0 - minItems: 0 - maxItems: 2000 - description: Directories that contain capabilities exposed to the agent. + enum: + - agent.deleted + default: agent.deleted + x-stainless-const: true + description: The object type. Always `agent.deleted`. + deleted: + type: boolean + description: Whether the agent was deleted. Always `true`. required: - - type - - remote_url - id - - workspace_directory - - capability_directories + - object + - deleted additionalProperties: false - description: An environment hosted by the application. - EnvironmentResource: - description: The execution environment for a session. - discriminator: - propertyName: type - mapping: - none: '#/components/schemas/EnvironmentResourceNone' - openai_hosted: '#/components/schemas/EnvironmentResourceOpenaiHosted' - self_hosted: '#/components/schemas/EnvironmentResourceSelfHosted' - x-oai-discriminator-values: - - none - - openai_hosted - - self_hosted - anyOf: - - $ref: '#/components/schemas/EnvironmentResourceNone' - - $ref: '#/components/schemas/EnvironmentResourceOpenaiHosted' - - $ref: '#/components/schemas/EnvironmentResourceSelfHosted' - SessionResource: + description: A deleted reusable agent. + EnvironmentTemplateResource: type: object properties: - metadata: - type: object - additionalProperties: - type: string - minLength: 0 - propertyNames: - type: string - minLength: 0 - minProperties: 0 - description: Custom string key-value pairs attached to the session. id: type: string minLength: 0 - description: The ID of the session. + description: The ID of the reusable environment template. + name: + type: + - string + - 'null' + minLength: 0 + description: An optional human-readable display name for the template. object: type: string enum: - - agent.session - default: agent.session + - agent.environment.template + default: agent.environment.template x-stainless-const: true - description: The object type. Always `agent.session`. + description: The object type. Always `agent.environment.template`. created_at: type: integer format: int64 - description: The Unix timestamp, in seconds, when the session was created. - last_active_at: + description: The Unix timestamp, in seconds, when the template was created. + updated_at: type: integer format: int64 - description: The Unix timestamp, in seconds, when the session was last active. - status: - $ref: '#/components/schemas/SessionStatusResource' - description: The current status of the session. - required_actions: + description: The Unix timestamp, in seconds, when the template was last updated. + packages: + $ref: '#/components/schemas/EnvironmentPackagesResource' + description: Packages installed in each fresh OpenAI-hosted environment. + network: + $ref: '#/components/schemas/NetworkPolicyResource' + description: Runtime network access for each OpenAI-hosted environment. + desktop: + $ref: '#/components/schemas/DesktopResource' + description: Desktop configuration for each OpenAI-hosted environment. + capability_directories: type: array items: - $ref: '#/components/schemas/SessionRequiredActionResource' + type: string + minLength: 0 minItems: 0 maxItems: 2000 - description: Actions that must be completed before the session can continue. - error: - description: The error that caused the session to fail, if any. - type: - - string - - 'null' - minLength: 0 - agent: - $ref: '#/components/schemas/SessionAgentResource' - description: The agent running in the session. - environment: - $ref: '#/components/schemas/EnvironmentResource' - description: The execution environment for the session. - vault_ids: + description: Directories that expose capabilities to the agent. + skills: type: array items: - type: string - minLength: 0 + $ref: '#/components/schemas/HostedTemplateSkillResource' minItems: 0 - maxItems: 2000 - description: The IDs of vaults made available to the session. - usage: - anyOf: - - $ref: '#/components/schemas/TokenUsageResource' - - type: 'null' - description: Best-effort token usage for the session, or null if unknown. Recorded usage may change. - spend_control: - $ref: '#/components/schemas/SessionSpendControlResource' - description: Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object. + maxItems: 200 + description: Safe skill metadata, preserving unresolved version selectors. + plugins: + type: array + items: + $ref: '#/components/schemas/HostedPluginResource' + minItems: 0 + maxItems: 32 + description: Safe plugin metadata, excluding inline archive contents. + files: + type: array + items: + $ref: '#/components/schemas/HostedTemplateFileResource' + minItems: 0 + maxItems: 50 + description: Safe file metadata, excluding contents and session-scoped file IDs. required: - - metadata - id + - name - object - created_at - - last_active_at - - status - - required_actions - - error - - agent - - environment - - vault_ids - - usage + - updated_at + - packages + - network + - capability_directories + - skills + - plugins + - files additionalProperties: false - description: A Managed Agents session. - SessionListResource: + description: Reusable configuration that provisions a fresh OpenAI-hosted environment for each session. + EnvironmentTemplateListResource: type: object properties: object: @@ -88153,7 +90177,7 @@ components: data: type: array items: - $ref: '#/components/schemas/SessionResource' + $ref: '#/components/schemas/EnvironmentTemplateResource' minItems: 0 maxItems: 2000 description: The resources returned in this page, in the requested sort order. @@ -88180,102 +90204,36 @@ components: - has_more additionalProperties: false description: A page of Agents API resources, with IDs for retrieving additional pages. - AgentToolConfigParamFunction: - type: object - properties: - type: - type: string - enum: - - function - default: function - x-stainless-const: true - description: The type of the object. Always `function`. - name: - type: string - minLength: 0 - maxLength: 1048576 - description: The name of the function. - description: - type: string - minLength: 0 - maxLength: 1048576 - description: A description of what the function does. - parameters: - type: object - additionalProperties: {} - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: A JSON Schema object describing the function's arguments. - defer_loading: - type: boolean - default: false - description: Whether this function is deferred and discovered through tool search. Defaults to `false`. - required: - - type - - name - - description - - parameters - additionalProperties: false - description: A function defined by the application. - AgentToolConfigParamToolSearch: - type: object - properties: - type: - type: string - enum: - - tool_search - default: tool_search - x-stainless-const: true - description: The type of the object. Always `tool_search`. - required: - - type - additionalProperties: false - description: Discovers deferred function tools and loads them into the model context. - AgentToolConfigParamProgrammaticToolCalling: - type: object - properties: - type: - type: string - enum: - - programmatic_tool_calling - default: programmatic_tool_calling - x-stainless-const: true - description: The type of the object. Always `programmatic_tool_calling`. - enabled: - type: boolean - default: true - description: Whether tools can be called from model-generated code. Defaults to `true`. - required: - - type - additionalProperties: false - description: Enables calling tools from model-generated code. - McpTransportConfigParamHttp: + CreateEnvironmentTemplateParams: type: object properties: - type: - type: string - enum: - - http - default: http - x-stainless-const: true - description: The type of the object. Always `http`. - server_url: - type: string - minLength: 0 - maxLength: 1048576 - description: The URL of the MCP server. - authorization: + packages: + anyOf: + - $ref: '#/components/schemas/EnvironmentPackagesParam' + - type: 'null' + description: Packages to install in the environment. Defaults to empty package lists. + setup_commands: type: - - string + - array - 'null' - minLength: 0 - maxLength: 1048576 - description: The authorization value sent to the MCP server, if any. - headers: + items: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Ordered, confidential setup commands. Command bodies are never returned. + network: + anyOf: + - $ref: '#/components/schemas/NetworkPolicyParam' + - type: 'null' + description: Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled. + desktop: + anyOf: + - $ref: '#/components/schemas/DesktopParam' + - type: 'null' + description: Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled. + x-openai-go-legacy-bool-fields: + - enabled + env: type: - object - 'null' @@ -88289,28 +90247,8 @@ components: maxLength: 256 minProperties: 0 maxProperties: 1024 - description: Additional HTTP headers sent to the MCP server. - required: - - type - - server_url - additionalProperties: false - description: Connects to an MCP server over HTTP. - McpTransportConfigParamStdio: - type: object - properties: - type: - type: string - enum: - - stdio - default: stdio - x-stainless-const: true - description: The type of the object. Always `stdio`. - command: - type: string - minLength: 0 - maxLength: 1048576 - description: The command used to start the MCP server. - args: + description: Environment variables made available to the agent. + capability_directories: type: - array - 'null' @@ -88320,12 +90258,79 @@ components: maxLength: 1048576 minItems: 0 maxItems: 16384 - description: Arguments passed to the MCP server command. - cwd: - type: string - minLength: 0 - maxLength: 1048576 - description: The working directory used to start the MCP server. + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Plugins provided as inline ZIP archives. Defaults to an empty list. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Files available before the agent starts. Defaults to an empty list. + name: + type: + - string + - 'null' + minLength: 1 + maxLength: 256 + description: An optional human-readable display name for the template. + additionalProperties: false + description: Parameters for creating a reusable, project-scoped OpenAI-hosted environment template. + UpdateEnvironmentTemplateParams: + type: object + properties: + name: + type: + - string + - 'null' + minLength: 1 + maxLength: 256 + description: A replacement human-readable display name, or `null` to clear the name. + packages: + anyOf: + - $ref: '#/components/schemas/EnvironmentPackagesParam' + - type: 'null' + description: Packages installed before the runtime network policy applies. + setup_commands: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Replacement confidential setup commands, never included in returned resources. + network: + anyOf: + - $ref: '#/components/schemas/NetworkPolicyParam' + - type: 'null' + description: Network access available after setup completes. Omit to preserve the current policy, or pass `null` to reset to the default policy. + desktop: + anyOf: + - $ref: '#/components/schemas/DesktopParam' + - type: 'null' + description: Replacement desktop configuration, or null to disable the desktop. + x-openai-go-legacy-bool-fields: + - enabled env: type: - object @@ -88340,8 +90345,8 @@ components: maxLength: 256 minProperties: 0 maxProperties: 1024 - description: Environment variables set for the MCP server process. - env_vars: + description: Replacement confidential environment values. + capability_directories: type: - array - 'null' @@ -88351,219 +90356,304 @@ components: maxLength: 1048576 minItems: 0 maxItems: 16384 - description: Environment variable names to inherit from the selected execution environment. + description: Directories that expose capabilities to the agent. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Replacement skill configuration installed for each new session. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Replacement plugin configuration installed for each new session. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Replacement file configuration materialized for each new session. + additionalProperties: false + description: Fields to replace on an existing reusable OpenAI-hosted environment template. + DeletedEnvironmentTemplateResource: + type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the deleted environment template. + object: + type: string + enum: + - agent.environment.template.deleted + default: agent.environment.template.deleted + x-stainless-const: true + description: The object type. Always `agent.environment.template.deleted`. + deleted: + type: boolean + description: Whether the environment template was deleted. Always `true`. required: - - type - - command - - cwd + - id + - object + - deleted additionalProperties: false - description: Starts an MCP server as a local process. - McpTransportConfigParam: - description: The transport used to connect to an MCP server. - discriminator: - propertyName: type - mapping: - http: '#/components/schemas/McpTransportConfigParamHttp' - stdio: '#/components/schemas/McpTransportConfigParamStdio' - x-oai-discriminator-values: - - http - - stdio - anyOf: - - $ref: '#/components/schemas/McpTransportConfigParamHttp' - - $ref: '#/components/schemas/McpTransportConfigParamStdio' - AgentToolConfigParamMcp: + description: A deleted reusable environment template. + SessionStatusResource: + type: string + enum: + - idle + - in_progress + - requires_action + - failed + x-enumDescriptions: + - The session has no turn in progress and is ready for input. A hosted environment may still be provisioning. + - The session is processing a turn. + - The session is waiting for one or more required actions. + - The session failed. + description: The current status of a session. + ComputerUseApprovalRequestKindResourceBrowserAuthentication: type: object properties: type: type: string enum: - - mcp - default: mcp + - browser_authentication + default: browser_authentication x-stainless-const: true - description: The type of the object. Always `mcp`. - server_label: - type: string - minLength: 0 - maxLength: 1048576 - description: A label used to identify the MCP server in tool calls. - credential_id: + description: The type of the object. Always `browser_authentication`. + reason: type: - string - 'null' minLength: 0 - maxLength: 1048576 - description: The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL. - transport: - $ref: '#/components/schemas/McpTransportConfigParam' - description: The transport used to connect to the MCP server. - request_metadata: - type: - - object - - 'null' - additionalProperties: {} - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: Metadata included with requests to this MCP server. - allowed_tools: + description: Why the agent needs the user to sign in. + credential_origin: type: - - array + - string - 'null' + minLength: 0 + description: The registered form or frame origin where values will be entered. + fields: + type: array items: - type: string - minLength: 0 - maxLength: 1048576 + $ref: '#/components/schemas/BrowserAuthenticationFieldResource' minItems: 0 - maxItems: 16384 - description: The MCP tools the agent may call. All server tools are allowed when omitted. - required: - type: boolean - default: false - description: Whether this MCP server must initialize before the first turn. Defaults to `false`. - connection_origin: - anyOf: - - $ref: '#/components/schemas/McpConnectionOriginParam' - - type: 'null' - description: Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment. + maxItems: 2000 + description: Controls to render. All submitted values are sensitive. + options: + type: array + items: + $ref: '#/components/schemas/BrowserAuthenticationOptionResource' + minItems: 0 + maxItems: 2000 + description: Sign-in methods. Empty for a plain form. required: - type - - server_label - - transport + - reason + - credential_origin + - fields + - options additionalProperties: false - description: Tools provided by a remote MCP server. - AgentToolConfigParamWebSearch: + description: A registered form awaiting the application's response. + ComputerUseApprovalRequestKindResourceBrowserOriginAccess: type: object properties: type: type: string enum: - - web_search - default: web_search + - browser_origin_access + default: browser_origin_access x-stainless-const: true - description: The type of the object. Always `web_search`. - mode: - anyOf: - - $ref: '#/components/schemas/WebSearchModeParam' - - type: 'null' - description: The source used for web search results. Defaults to `live`. - context_size: - anyOf: - - $ref: '#/components/schemas/WebSearchContextSizeParam' - - type: 'null' - description: The amount of search context made available to the model. Defaults to `medium`. - allowed_domains: + description: The type of the object. Always `browser_origin_access`. + reason: type: - - array + - string - 'null' - items: - type: string - minLength: 0 - maxLength: 1048576 - minItems: 0 - maxItems: 16384 - description: Domains the search may include. - location: - anyOf: - - $ref: '#/components/schemas/WebSearchLocationParam' - - type: 'null' - description: Approximate location used to localize search results. + minLength: 0 + description: The browser's explanation for this request, or null when unavailable. + origin: + type: string + minLength: 0 + description: The origin the browser needs permission to access. + required: + - type + - reason + - origin + additionalProperties: false + description: A browser origin awaiting the application's approval decision. + ComputerUseApprovalRequestKindResource: + x-oai-discriminator-values: + - browser_authentication + - browser_origin_access + discriminator: + propertyName: type + mapping: + browser_authentication: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication' + browser_origin_access: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess' + anyOf: + - $ref: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserAuthentication' + - $ref: '#/components/schemas/ComputerUseApprovalRequestKindResourceBrowserOriginAccess' + SessionRequiredActionResourceComputerUseApprovalRequest: + type: object + properties: + type: + type: string + enum: + - computer_use_approval_request + default: computer_use_approval_request + x-stainless-const: true + description: The type of the object. Always `computer_use_approval_request`. + turn_id: + type: string + minLength: 0 + description: The turn that requested approval. + request_id: + type: string + minLength: 0 + description: The registered request ID to echo when responding. + request: + $ref: '#/components/schemas/ComputerUseApprovalRequestKindResource' + description: The information needed to render the request. + required: + - type + - turn_id + - request_id + - request + additionalProperties: false + description: Respond to a computer-use request. + SessionRequiredActionResourceFunctionCall: + type: object + properties: + type: + type: string + enum: + - function_call + default: function_call + x-stainless-const: true + description: The type of the object. Always `function_call`. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that requested the function call. + call_id: + type: string + minLength: 0 + description: The ID to include when submitting the function result. + name: + type: string + minLength: 0 + description: The function name. + arguments: + description: The arguments supplied by the model. required: - type + - turn_id + - call_id + - name + - arguments additionalProperties: false - description: Web search. - AgentToolConfigParamComputerUse: + description: Run a function tool and submit its result. + SessionRequiredActionResourceEnvironmentConnection: type: object properties: type: type: string enum: - - computer_use - default: computer_use + - environment_connection + default: environment_connection x-stainless-const: true - description: The type of the object. Always `computer_use`. - include_screenshots: - type: boolean - default: false - description: Whether computer tool outputs include screenshots. Defaults to `false`. + description: The type of the object. Always `environment_connection`. + environment_id: + type: string + minLength: 0 + description: The ID of the environment to reconnect. required: - type + - environment_id additionalProperties: false - description: Browser use in an OpenAI-hosted session. - AgentToolConfigParam: - description: A tool available to the agent. + description: Reconnect a session environment. + SessionRequiredActionResource: + description: An action that must be completed before a session can continue. discriminator: propertyName: type mapping: - function: '#/components/schemas/AgentToolConfigParamFunction' - tool_search: '#/components/schemas/AgentToolConfigParamToolSearch' - programmatic_tool_calling: '#/components/schemas/AgentToolConfigParamProgrammaticToolCalling' - mcp: '#/components/schemas/AgentToolConfigParamMcp' - web_search: '#/components/schemas/AgentToolConfigParamWebSearch' - computer_use: '#/components/schemas/AgentToolConfigParamComputerUse' + computer_use_approval_request: '#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest' + function_call: '#/components/schemas/SessionRequiredActionResourceFunctionCall' + environment_connection: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' x-oai-discriminator-values: - - function - - tool_search - - programmatic_tool_calling - - mcp - - web_search - - computer_use + - computer_use_approval_request + - function_call + - environment_connection anyOf: - - $ref: '#/components/schemas/AgentToolConfigParamFunction' - - $ref: '#/components/schemas/AgentToolConfigParamToolSearch' - - $ref: '#/components/schemas/AgentToolConfigParamProgrammaticToolCalling' - - $ref: '#/components/schemas/AgentToolConfigParamMcp' - - $ref: '#/components/schemas/AgentToolConfigParamWebSearch' - - $ref: '#/components/schemas/AgentToolConfigParamComputerUse' - SessionAgentConfigParam: + - $ref: '#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest' + - $ref: '#/components/schemas/SessionRequiredActionResourceFunctionCall' + - $ref: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' + SessionAgentResource: type: object properties: + id: + type: string + minLength: 0 + description: The ID of the agent. + name: + type: + - string + - 'null' + minLength: 0 + description: The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value. model: type: string minLength: 0 - maxLength: 1048576 - description: The model to use for the agent. The requested model name is preserved. + description: The model used by the agent. reasoning: - anyOf: - - $ref: '#/components/schemas/ReasoningParam' - - type: 'null' - description: Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort. + $ref: '#/components/schemas/ReasoningResource' + description: The agent's reasoning configuration. text: - anyOf: - - $ref: '#/components/schemas/TextParam' - - type: 'null' + $ref: '#/components/schemas/TextResource' description: Configuration for text generated by the agent. service_tier: - anyOf: - - $ref: '#/components/schemas/ServiceTierParam' - - type: 'null' - description: The service tier used for model requests. + $ref: '#/components/schemas/ServiceTierResource' + description: The effective service-tier policy for model requests. Defaults to `auto`. instructions: type: - string - 'null' minLength: 0 - maxLength: 1048576 - description: Additional instructions appended to the agent's default base instructions. Omit to leave unchanged. - multi_agent: - anyOf: - - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' - - type: 'null' - description: Configuration for creating and coordinating subagents. + description: Custom instructions appended to the agent's default base instructions. tools: - type: - - array - - 'null' + type: array items: - $ref: '#/components/schemas/AgentToolConfigParam' + $ref: '#/components/schemas/AgentToolResource' minItems: 0 - maxItems: 16384 - description: Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON. + maxItems: 2000 + description: Tools available to the agent. + multi_agent: + $ref: '#/components/schemas/MultiAgentConfigResource' + description: Configuration for creating and coordinating subagents. + required: + - id + - name + - model + - reasoning + - text + - service_tier + - instructions + - tools + - multi_agent additionalProperties: false - description: Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field; null resets nullable fields. - EnvironmentParamNone: + description: The effective agent configuration for a session. + EnvironmentResourceNone: type: object properties: type: @@ -88576,15 +90666,8 @@ components: required: - type additionalProperties: false - description: Runs the agent without an execution environment. - ContainerSizeParam: - type: string - enum: - - small - - medium - - large - description: The CPU and memory tier for a new OpenAI-hosted session environment. - EnvironmentParamOpenaiHosted: + description: The session talks to CCA without selecting or provisioning an execution environment. + EnvironmentResourceOpenaiHosted: type: object properties: type: @@ -88594,131 +90677,67 @@ components: default: openai_hosted x-stainless-const: true description: The type of the object. Always `openai_hosted`. - packages: + id: + type: string + minLength: 0 + description: The public ID of the environment. + container_size: anyOf: - - $ref: '#/components/schemas/EnvironmentPackagesParam' + - $ref: '#/components/schemas/ContainerSizeResource' - type: 'null' - description: Packages to install in the environment. Defaults to empty package lists. - setup_commands: - type: - - array - - 'null' - items: - $ref: '#/components/schemas/SetupCommandParam' - minItems: 0 - maxItems: 16 - description: Ordered, confidential setup commands. Command bodies are never returned. + description: The effective CPU and memory tier, or null when unknown or outside the public tiers. + x-stainless-skip: + - cli + packages: + $ref: '#/components/schemas/EnvironmentPackagesResource' + description: Packages installed in the environment. network: - anyOf: - - $ref: '#/components/schemas/NetworkPolicyParam' - - type: 'null' - description: Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled. + $ref: '#/components/schemas/NetworkPolicyResource' + description: The effective network access policy for the environment. desktop: - anyOf: - - $ref: '#/components/schemas/DesktopParam' - - type: 'null' - description: Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled. - x-openai-go-legacy-bool-fields: - - enabled - env: - type: - - object - - 'null' - additionalProperties: - type: string - minLength: 0 - maxLength: 1048576 - propertyNames: - type: string - minLength: 1 - maxLength: 256 - minProperties: 0 - maxProperties: 1024 - description: Environment variables made available to the agent. + $ref: '#/components/schemas/DesktopResource' + description: The effective desktop configuration. capability_directories: - type: - - array - - 'null' + type: array items: type: string minLength: 0 - maxLength: 1048576 minItems: 0 - maxItems: 16384 - description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + maxItems: 2000 + description: Directories that contain capabilities exposed to the agent. skills: - type: - - array - - 'null' + type: array items: - $ref: '#/components/schemas/HostedSkillParam' + $ref: '#/components/schemas/HostedSkillResource' minItems: 0 - maxItems: 200 - description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. + maxItems: 2000 + description: Skills installed in the environment, excluding their archive contents. plugins: - type: - - array - - 'null' + type: array items: - $ref: '#/components/schemas/HostedPluginParam' + $ref: '#/components/schemas/HostedPluginResource' minItems: 0 - maxItems: 32 - description: Plugins provided as inline ZIP archives. Defaults to an empty list. + maxItems: 2000 + description: Plugins installed in the environment, excluding their archive contents. files: - type: - - array - - 'null' + type: array items: - $ref: '#/components/schemas/HostedEnvironmentFileParam' + $ref: '#/components/schemas/HostedEnvironmentFileResource' minItems: 0 maxItems: 50 - description: Files available before the agent starts. Defaults to an empty list. - environment_id: - type: string - minLength: 9 - maxLength: 256 - description: An existing prewarmed environment. Cannot be combined with a template or inline configuration. - environment_template_id: - type: string - minLength: 0 - maxLength: 64 - description: A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy. - container_size: - $ref: '#/components/schemas/ContainerSizeParam' - description: The hosted container size. Omission selects the medium tier. - x-stainless-skip: - - cli + description: Files available in the environment, excluding their contents. required: - type + - id + - packages + - network + - capability_directories + - skills + - plugins + - files additionalProperties: false - description: An existing OpenAI-hosted environment or new inline/template-based hosted configuration. - not: - required: - - environment_id - anyOf: - - required: - - packages - - required: - - setup_commands - - required: - - network - - required: - - desktop - - required: - - env - - required: - - capability_directories - - required: - - skills - - required: - - plugins - - required: - - files - - required: - - environment_template_id - - required: - - container_size - EnvironmentParamSelfHosted: + description: An environment hosted by OpenAI. + EnvironmentResourceSelfHosted: type: object properties: type: @@ -88728,125 +90747,175 @@ components: default: self_hosted x-stainless-const: true description: The type of the object. Always `self_hosted`. + remote_url: + type: string + minLength: 0 + description: Pass this URL unchanged to `codex exec-server --remote` when connecting this environment. + id: + type: string + minLength: 0 + description: The public ID of the environment. + workspace_directory: + type: string + minLength: 0 + description: The absolute project directory inside the environment. Defaults to `/workspace`. capability_directories: - type: - - array - - 'null' + type: array items: type: string minLength: 0 - maxLength: 1048576 minItems: 0 - maxItems: 16384 - description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. - workspace_directory: - type: string - minLength: 0 - maxLength: 1048576 - description: Absolute project directory inside the self-hosted environment. + maxItems: 2000 + description: Directories that contain capabilities exposed to the agent. required: - type + - remote_url + - id - workspace_directory + - capability_directories additionalProperties: false - description: An application-hosted environment configured inline. - EnvironmentParam: - description: The execution environment and optional reusable template for a session. + description: An environment hosted by the application. + EnvironmentResource: + description: The execution environment for a session. discriminator: propertyName: type mapping: - none: '#/components/schemas/EnvironmentParamNone' - openai_hosted: '#/components/schemas/EnvironmentParamOpenaiHosted' - self_hosted: '#/components/schemas/EnvironmentParamSelfHosted' + none: '#/components/schemas/EnvironmentResourceNone' + openai_hosted: '#/components/schemas/EnvironmentResourceOpenaiHosted' + self_hosted: '#/components/schemas/EnvironmentResourceSelfHosted' x-oai-discriminator-values: - none - openai_hosted - self_hosted anyOf: - - $ref: '#/components/schemas/EnvironmentParamNone' - - $ref: '#/components/schemas/EnvironmentParamOpenaiHosted' - - $ref: '#/components/schemas/EnvironmentParamSelfHosted' - InputContentParamInputText: + - $ref: '#/components/schemas/EnvironmentResourceNone' + - $ref: '#/components/schemas/EnvironmentResourceOpenaiHosted' + - $ref: '#/components/schemas/EnvironmentResourceSelfHosted' + SessionResource: type: object properties: - type: - type: string - enum: - - input_text - default: input_text - x-stainless-const: true - description: The type of the object. Always `input_text`. - text: + metadata: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Custom string key-value pairs attached to the session. + id: type: string minLength: 0 - maxLength: 1048576 - description: The text sent to the model. - required: - - type - - text - additionalProperties: false - description: Text input to the model. - InputContentParamInputImage: - type: object - properties: - type: + description: The ID of the session. + object: type: string enum: - - input_image - default: input_image + - agent.session + default: agent.session x-stainless-const: true - description: The type of the object. Always `input_image`. - image_url: - type: string + description: The object type. Always `agent.session`. + created_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the session was created. + last_active_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the session was last active. + status: + $ref: '#/components/schemas/SessionStatusResource' + description: The current status of the session. + required_actions: + type: array + items: + $ref: '#/components/schemas/SessionRequiredActionResource' + minItems: 0 + maxItems: 2000 + description: Actions that must be completed before the session can continue. + error: + description: The error that caused the session to fail, if any. + type: + - string + - 'null' minLength: 0 - maxLength: 1048576 - description: The URL of the image sent to the model. + agent: + $ref: '#/components/schemas/SessionAgentResource' + description: The agent running in the session. + environment: + $ref: '#/components/schemas/EnvironmentResource' + description: The execution environment for the session. + vault_ids: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The IDs of vaults made available to the session. + usage: + anyOf: + - $ref: '#/components/schemas/TokenUsageResource' + - type: 'null' + description: Best-effort token usage for the session, or null if unknown. Recorded usage may change. + spend_control: + $ref: '#/components/schemas/SessionSpendControlResource' + description: Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object. required: - - type - - image_url + - metadata + - id + - object + - created_at + - last_active_at + - status + - required_actions + - error + - agent + - environment + - vault_ids + - usage additionalProperties: false - description: Image input to the model. - InputContentParam: - description: Content included in an input message. - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/InputContentParamInputText' - input_image: '#/components/schemas/InputContentParamInputImage' - x-oai-discriminator-values: - - input_text - - input_image - anyOf: - - $ref: '#/components/schemas/InputContentParamInputText' - - $ref: '#/components/schemas/InputContentParamInputImage' - InputMessageParam: + description: A Managed Agents session. + SessionListResource: type: object properties: - type: - type: string - enum: - - message - default: message - x-stainless-const: true - description: The type of the input item. Always `message`. - role: + object: type: string enum: - - user - default: user + - list + default: list x-stainless-const: true - description: The role of the message author. Always `user`. - content: + description: The object type, which is always `list`. + data: type: array items: - $ref: '#/components/schemas/InputContentParam' + $ref: '#/components/schemas/SessionResource' minItems: 0 - maxItems: 16384 - description: The content of the message. + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. required: - - role - - content + - object + - data + - first_id + - last_id + - has_more additionalProperties: false - description: A user message submitted to a session. + description: A page of Agents API resources, with IDs for retrieving additional pages. CreateSessionInputParam: description: Initial input submitted when creating a session. anyOf: @@ -92537,6 +94606,11 @@ components: LiveDecisionsDelegationParam-2: type: object properties: + acknowledgement_delay_ms: + description: Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400. Updates apply to subsequent delegations. + type: integer + minimum: 0 + maximum: 800 type: default: decisions x-stainless-const: true @@ -92696,6 +94770,11 @@ components: LiveDecisionsDelegationUpdateParam: type: object properties: + acknowledgement_delay_ms: + description: Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations. + type: integer + minimum: 0 + maximum: 800 type: default: decisions x-stainless-const: true @@ -97098,6 +99177,12 @@ components: description: The breakpoint mode. Always `explicit`. default: explicit x-stainless-const: true + ttl: + type: string + enum: + - 30m + - 12h + description: The minimum lifetime of this cache breakpoint. Defaults to the request TTL. type: object required: - mode @@ -98949,6 +101034,12 @@ components: description: The breakpoint mode. Always `explicit`. default: explicit x-stainless-const: true + ttl: + type: string + enum: + - 30m + - 12h + description: The minimum lifetime of this cache breakpoint. Defaults to the request TTL. type: object required: - mode @@ -100486,6 +102577,9 @@ components: BetaItemResource: description: | Content item used to generate a response. + x-openai-go-public-shape: + dispatch: + message: '#/components/schemas/BetaOutputMessage' discriminator: propertyName: type anyOf: @@ -104124,6 +106218,7 @@ components: delta: $ref: '#/components/schemas/BetaShellCallOutputDelta' description: The stdout/stderr delta that was emitted. + x-openai-go-skip-union-projection: true type: object required: - type @@ -107496,6 +109591,7 @@ components: - $ref: '#/components/schemas/BetaResponseShellCallOutputContentDeltaStreamingEvent' x-stainless-skip: - go + x-openai-go-include-union-variant: true - $ref: '#/components/schemas/BetaResponseShellCallOutputContentDoneStreamingEvent' - $ref: '#/components/schemas/BetaResponseInProgressEvent' - $ref: '#/components/schemas/BetaResponseFailedEvent' @@ -107533,262 +109629,6 @@ components: - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDoneEvent' discriminator: propertyName: type - VoiceDeletedResource: - type: object - additionalProperties: false - properties: - id: - type: string - description: The voice identifier. - example: voice_1234 - object: - type: string - enum: - - audio.voice.deleted - x-stainless-const: true - description: The object type, which is always `audio.voice.deleted`. - deleted: - type: boolean - description: Whether the voice was deleted. - required: - - id - - object - - deleted - x-oaiMeta: - name: The voice deletion object - example: | - { - "id": "voice_1234", - "object": "audio.voice.deleted", - "deleted": true - } - DecisionInputJson: - type: object - properties: - type: - type: string - enum: - - input_json - default: input_json - x-stainless-const: true - data: - anyOf: - - type: object - additionalProperties: - anyOf: - - {} - - type: 'null' - propertyNames: - type: string - minLength: 0 - minProperties: 0 - - type: array - items: - type: object - additionalProperties: - anyOf: - - {} - - type: 'null' - propertyNames: - type: string - minLength: 0 - minProperties: 0 - minItems: 0 - required: - - type - - data - additionalProperties: false - description: A JSON object or an array of objects rendered as text. Nested values may be any JSON value. Limited to 32 container levels, 10,000 values, and 256 KiB of compact UTF-8 JSON. - DecisionQuestionInputPart: - description: A text, image, or JSON content part in a question instruction. - discriminator: - propertyName: type - mapping: - input_text: '#/components/schemas/DecisionQuestionInputText' - input_image: '#/components/schemas/DecisionQuestionInputImage' - input_json: '#/components/schemas/DecisionInputJson' - x-oai-discriminator-values: - - input_text - - input_image - - input_json - anyOf: - - $ref: '#/components/schemas/DecisionQuestionInputText' - - $ref: '#/components/schemas/DecisionQuestionInputImage' - - $ref: '#/components/schemas/DecisionInputJson' - DecisionQuestionInputText: - type: object - properties: - type: - type: string - enum: - - input_text - default: input_text - x-stainless-const: true - text: - type: string - minLength: 0 - maxLength: 10485760 - required: - - type - - text - additionalProperties: false - DecisionQuestionInputImage: - type: object - properties: - image_url: - type: string - minLength: 0 - maxLength: 1073741824 - pattern: ^(data:|https?://) - description: A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL. - detail: - anyOf: - - $ref: '#/components/schemas/ImageDetailParam' - - type: 'null' - description: The image detail level, using the selected model's image profile. Defaults to auto. - default: auto - type: - type: string - enum: - - input_image - default: input_image - x-stainless-const: true - required: - - image_url - - type - additionalProperties: false - description: An image provided as a base64 data URL or a publicly accessible HTTP(S) URL. File IDs are not supported. - DecisionInputUserMessage: - type: object - properties: - role: - type: string - enum: - - user - default: user - x-stainless-const: true - content: - $ref: '#/components/schemas/DecisionInputContent' - type: - type: string - enum: - - message - default: message - x-stainless-const: true - required: - - role - - content - additionalProperties: false - description: A user message containing input text, images, or JSON. - DecisionInputDeveloperMessage: - type: object - properties: - role: - type: string - enum: - - developer - default: developer - x-stainless-const: true - content: - $ref: '#/components/schemas/DecisionInputDeveloperContent' - type: - type: string - enum: - - message - default: message - x-stainless-const: true - required: - - role - - content - additionalProperties: false - description: A developer message containing input text. - DecisionInputSystemMessage: - type: object - properties: - role: - type: string - enum: - - system - default: system - x-stainless-const: true - content: - $ref: '#/components/schemas/DecisionInputDeveloperContent' - type: - type: string - enum: - - message - default: message - x-stainless-const: true - required: - - role - - content - additionalProperties: false - description: A system message containing input text. - DecisionInputAssistantMessage: - type: object - properties: - role: - type: string - enum: - - assistant - default: assistant - x-stainless-const: true - content: - $ref: '#/components/schemas/DecisionInputAssistantContent' - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhaseParam' - - type: 'null' - description: The phase of an assistant message. - type: - type: string - enum: - - message - default: message - x-stainless-const: true - required: - - role - - content - additionalProperties: false - description: An assistant message containing output text or refusals. - DecisionInputDeveloperContent: - description: A text string or an ordered list of input text parts. - anyOf: - - type: string - minLength: 0 - maxLength: 10485760 - - $ref: '#/components/schemas/DecisionInputDeveloperContentParts' - title: Parts - DecisionInputAssistantContent: - description: A text string or an ordered list of output text and refusal parts. - anyOf: - - type: string - minLength: 0 - maxLength: 10485760 - - $ref: '#/components/schemas/DecisionInputAssistantContentParts' - title: Parts - DecisionInputDeveloperContentParts: - type: array - items: - $ref: '#/components/schemas/DecisionInputText' - minItems: 0 - maxItems: 16384 - DecisionInputAssistantContentParts: - type: array - items: - x-oai-discriminator-values: - - output_text - - refusal - discriminator: - propertyName: type - mapping: - output_text: '#/components/schemas/DecisionInputOutputText' - refusal: '#/components/schemas/DecisionInputRefusal' - anyOf: - - $ref: '#/components/schemas/DecisionInputOutputText' - - $ref: '#/components/schemas/DecisionInputRefusal' - minItems: 0 - maxItems: 16384 SessionSpendControlResource: type: object properties: @@ -107845,6 +109685,18 @@ components: - invalid_grant - invalid_subject_token - type: string + AutomationMetadataParam: + type: object + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 ResponseSteerInputContent: discriminator: propertyName: type diff --git a/openai-java-core/src/main/kotlin/com/openai/models/PromptCacheBreakpointTtl.kt b/openai-java-core/src/main/kotlin/com/openai/models/PromptCacheBreakpointTtl.kt new file mode 100644 index 000000000..7c87e35a7 --- /dev/null +++ b/openai-java-core/src/main/kotlin/com/openai/models/PromptCacheBreakpointTtl.kt @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details. + +package com.openai.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openai.core.Enum +import com.openai.core.JsonField +import com.openai.errors.OpenAIInvalidDataException + +/** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ +class PromptCacheBreakpointTtl +@JsonCreator +private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val _30M = of("30m") + + @JvmField val _12H = of("12h") + + @JvmStatic fun of(value: String) = PromptCacheBreakpointTtl(JsonField.of(value)) + } + + /** An enum containing [PromptCacheBreakpointTtl]'s known values. */ + enum class Known { + _30M, + _12H, + } + + /** + * An enum containing [PromptCacheBreakpointTtl]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [PromptCacheBreakpointTtl] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + _30M, + _12H, + /** + * An enum member indicating that [PromptCacheBreakpointTtl] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ + fun value(): Value = + when (this) { + _30M -> Value._30M + _12H -> Value._12H + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws OpenAIInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + _30M -> Known._30M + _12H -> Known._12H + else -> throw OpenAIInvalidDataException("Unknown PromptCacheBreakpointTtl: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws OpenAIInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenAIInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): PromptCacheBreakpointTtl = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PromptCacheBreakpointTtl && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/Agent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/Agent.kt index af218194f..a7ea562bc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/Agent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/Agent.kt @@ -607,6 +607,9 @@ private constructor( .build() ) + /** Alias for calling [addTool] with `PersistedAgentTool.ofAutomations()`. */ + fun addToolAutomations() = addTool(PersistedAgentTool.ofAutomations()) + /** The Unix timestamp, in seconds, when the agent was last updated. */ fun updatedAt(updatedAt: Long) = updatedAt(JsonField.of(updatedAt)) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentCreateParams.kt index fe927e049..b63ea5fd1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentCreateParams.kt @@ -413,6 +413,9 @@ private constructor( body.addTool(computerUse) } + /** Alias for calling [addTool] with `PersistedAgentToolParam.ofAutomations()`. */ + fun addToolAutomations() = apply { body.addToolAutomations() } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -1049,6 +1052,9 @@ private constructor( fun addTool(computerUse: PersistedAgentToolParam.ComputerUse) = addTool(PersistedAgentToolParam.ofComputerUse(computerUse)) + /** Alias for calling [addTool] with `PersistedAgentToolParam.ofAutomations()`. */ + fun addToolAutomations() = addTool(PersistedAgentToolParam.ofAutomations()) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentSession.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentSession.kt index aa1dc64b7..54773b405 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentSession.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentSession.kt @@ -1238,6 +1238,9 @@ private constructor( AgentTool.ComputerUse.builder().includeScreenshots(includeScreenshots).build() ) + /** Alias for calling [addTool] with `AgentTool.ofAutomations()`. */ + fun addToolAutomations() = addTool(AgentTool.ofAutomations()) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentTool.kt index 2e26f6bef..18fe4f035 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentTool.kt @@ -41,6 +41,7 @@ private constructor( private val mcp: Mcp? = null, private val webSearch: WebSearch? = null, private val computerUse: ComputerUse? = null, + private val automations: JsonValue? = null, private val _json: JsonValue? = null, ) { @@ -60,6 +61,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun computerUse(): Optional = Optional.ofNullable(computerUse) + /** Lets the agent manage its own scheduled wakeups. */ + fun automations(): Optional = Optional.ofNullable(automations) + fun isFunction(): Boolean = function != null fun isProgrammaticToolCalling(): Boolean = programmaticToolCalling != null @@ -70,6 +74,8 @@ private constructor( fun isComputerUse(): Boolean = computerUse != null + fun isAutomations(): Boolean = automations != null + /** A function defined by the application. */ fun asFunction(): Function = function.getOrThrow("function") @@ -86,6 +92,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun asComputerUse(): ComputerUse = computerUse.getOrThrow("computerUse") + /** Lets the agent manage its own scheduled wakeups. */ + fun asAutomations(): JsonValue = automations.getOrThrow("automations") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -125,6 +134,7 @@ private constructor( mcp != null -> visitor.visitMcp(mcp) webSearch != null -> visitor.visitWebSearch(webSearch) computerUse != null -> visitor.visitComputerUse(computerUse) + automations != null -> visitor.visitAutomations(automations) else -> visitor.unknown(_json) } @@ -166,6 +176,16 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) { computerUse.validate() } + + override fun visitAutomations(automations: JsonValue) { + automations.let { + if (it != JsonValue.from(mapOf("type" to "automations"))) { + throw OpenAIInvalidDataException( + "'automations' is invalid, received $it" + ) + } + } + } } ) validated = true @@ -200,6 +220,11 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) = computerUse.validity() + override fun visitAutomations(automations: JsonValue) = + automations.let { + if (it == JsonValue.from(mapOf("type" to "automations"))) 1 else 0 + } + override fun unknown(json: JsonValue?) = 0 } ) @@ -214,11 +239,12 @@ private constructor( programmaticToolCalling == other.programmaticToolCalling && mcp == other.mcp && webSearch == other.webSearch && - computerUse == other.computerUse + computerUse == other.computerUse && + automations == other.automations } override fun hashCode(): Int = - Objects.hash(function, programmaticToolCalling, mcp, webSearch, computerUse) + Objects.hash(function, programmaticToolCalling, mcp, webSearch, computerUse, automations) override fun toString(): String = when { @@ -228,6 +254,7 @@ private constructor( mcp != null -> "AgentTool{mcp=$mcp}" webSearch != null -> "AgentTool{webSearch=$webSearch}" computerUse != null -> "AgentTool{computerUse=$computerUse}" + automations != null -> "AgentTool{automations=$automations}" _json != null -> "AgentTool{_unknown=$_json}" else -> throw IllegalStateException("Invalid AgentTool") } @@ -251,6 +278,11 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ @JvmStatic fun ofComputerUse(computerUse: ComputerUse) = AgentTool(computerUse = computerUse) + + /** Lets the agent manage its own scheduled wakeups. */ + @JvmStatic + fun ofAutomations() = + AgentTool(automations = JsonValue.from(mapOf("type" to "automations"))) } /** An interface that defines how to map each variant of [AgentTool] to a value of type [T]. */ @@ -271,6 +303,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun visitComputerUse(computerUse: ComputerUse): T + /** Lets the agent manage its own scheduled wakeups. */ + fun visitAutomations(automations: JsonValue): T = unknown(JsonValue.from(automations)) + /** * Maps an unknown variant of [AgentTool] to a value of type [T]. * @@ -317,6 +352,11 @@ private constructor( AgentTool(computerUse = it, _json = json) } ?: AgentTool(_json = json) } + "automations" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { AgentTool(automations = it, _json = json) } + ?.takeIf { it.isValid() } ?: AgentTool(_json = json) + } } return AgentTool(_json = json) @@ -337,6 +377,7 @@ private constructor( value.mcp != null -> generator.writeObject(value.mcp) value.webSearch != null -> generator.writeObject(value.webSearch) value.computerUse != null -> generator.writeObject(value.computerUse) + value.automations != null -> generator.writeObject(value.automations) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid AgentTool") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentToolParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentToolParam.kt index 27f6de874..41a9ca8ec 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentToolParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentToolParam.kt @@ -42,6 +42,7 @@ private constructor( private val mcp: Mcp? = null, private val webSearch: WebSearch? = null, private val computerUse: ComputerUse? = null, + private val automations: JsonValue? = null, private val _json: JsonValue? = null, ) { @@ -64,6 +65,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun computerUse(): Optional = Optional.ofNullable(computerUse) + /** Lets the agent manage its own scheduled wakeups. */ + fun automations(): Optional = Optional.ofNullable(automations) + fun isFunction(): Boolean = function != null fun isToolSearch(): Boolean = toolSearch != null @@ -76,6 +80,8 @@ private constructor( fun isComputerUse(): Boolean = computerUse != null + fun isAutomations(): Boolean = automations != null + /** A function defined by the application. */ fun asFunction(): Function = function.getOrThrow("function") @@ -95,6 +101,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun asComputerUse(): ComputerUse = computerUse.getOrThrow("computerUse") + /** Lets the agent manage its own scheduled wakeups. */ + fun asAutomations(): JsonValue = automations.getOrThrow("automations") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -135,6 +144,7 @@ private constructor( mcp != null -> visitor.visitMcp(mcp) webSearch != null -> visitor.visitWebSearch(webSearch) computerUse != null -> visitor.visitComputerUse(computerUse) + automations != null -> visitor.visitAutomations(automations) else -> visitor.unknown(_json) } @@ -186,6 +196,16 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) { computerUse.validate() } + + override fun visitAutomations(automations: JsonValue) { + automations.let { + if (it != JsonValue.from(mapOf("type" to "automations"))) { + throw OpenAIInvalidDataException( + "'automations' is invalid, received $it" + ) + } + } + } } ) validated = true @@ -225,6 +245,11 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) = computerUse.validity() + override fun visitAutomations(automations: JsonValue) = + automations.let { + if (it == JsonValue.from(mapOf("type" to "automations"))) 1 else 0 + } + override fun unknown(json: JsonValue?) = 0 } ) @@ -240,11 +265,20 @@ private constructor( programmaticToolCalling == other.programmaticToolCalling && mcp == other.mcp && webSearch == other.webSearch && - computerUse == other.computerUse + computerUse == other.computerUse && + automations == other.automations } override fun hashCode(): Int = - Objects.hash(function, toolSearch, programmaticToolCalling, mcp, webSearch, computerUse) + Objects.hash( + function, + toolSearch, + programmaticToolCalling, + mcp, + webSearch, + computerUse, + automations, + ) override fun toString(): String = when { @@ -255,6 +289,7 @@ private constructor( mcp != null -> "AgentToolParam{mcp=$mcp}" webSearch != null -> "AgentToolParam{webSearch=$webSearch}" computerUse != null -> "AgentToolParam{computerUse=$computerUse}" + automations != null -> "AgentToolParam{automations=$automations}" _json != null -> "AgentToolParam{_unknown=$_json}" else -> throw IllegalStateException("Invalid AgentToolParam") } @@ -283,6 +318,11 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ @JvmStatic fun ofComputerUse(computerUse: ComputerUse) = AgentToolParam(computerUse = computerUse) + + /** Lets the agent manage its own scheduled wakeups. */ + @JvmStatic + fun ofAutomations() = + AgentToolParam(automations = JsonValue.from(mapOf("type" to "automations"))) } /** @@ -308,6 +348,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun visitComputerUse(computerUse: ComputerUse): T + /** Lets the agent manage its own scheduled wakeups. */ + fun visitAutomations(automations: JsonValue): T = unknown(JsonValue.from(automations)) + /** * Maps an unknown variant of [AgentToolParam] to a value of type [T]. * @@ -360,6 +403,11 @@ private constructor( AgentToolParam(computerUse = it, _json = json) } ?: AgentToolParam(_json = json) } + "automations" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { AgentToolParam(automations = it, _json = json) } + ?.takeIf { it.isValid() } ?: AgentToolParam(_json = json) + } } return AgentToolParam(_json = json) @@ -381,6 +429,7 @@ private constructor( value.mcp != null -> generator.writeObject(value.mcp) value.webSearch != null -> generator.writeObject(value.webSearch) value.computerUse != null -> generator.writeObject(value.computerUse) + value.automations != null -> generator.writeObject(value.automations) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid AgentToolParam") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentUpdateParams.kt index 7fb4af251..990a84425 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentUpdateParams.kt @@ -417,6 +417,9 @@ private constructor( body.addTool(computerUse) } + /** Alias for calling [addTool] with `PersistedAgentToolParam.ofAutomations()`. */ + fun addToolAutomations() = apply { body.addToolAutomations() } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -1044,6 +1047,9 @@ private constructor( fun addTool(computerUse: PersistedAgentToolParam.ComputerUse) = addTool(PersistedAgentToolParam.ofComputerUse(computerUse)) + /** Alias for calling [addTool] with `PersistedAgentToolParam.ofAutomations()`. */ + fun addToolAutomations() = addTool(PersistedAgentToolParam.ofAutomations()) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentTool.kt index c51270a66..74d4ced88 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentTool.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentTool.kt @@ -42,6 +42,7 @@ private constructor( private val mcp: Mcp? = null, private val webSearch: WebSearch? = null, private val computerUse: ComputerUse? = null, + private val automations: JsonValue? = null, private val _json: JsonValue? = null, ) { @@ -64,6 +65,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun computerUse(): Optional = Optional.ofNullable(computerUse) + /** Lets the agent manage its own scheduled wakeups. */ + fun automations(): Optional = Optional.ofNullable(automations) + fun isFunction(): Boolean = function != null fun isToolSearch(): Boolean = toolSearch != null @@ -76,6 +80,8 @@ private constructor( fun isComputerUse(): Boolean = computerUse != null + fun isAutomations(): Boolean = automations != null + /** A function defined by the application. */ fun asFunction(): Function = function.getOrThrow("function") @@ -95,6 +101,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun asComputerUse(): ComputerUse = computerUse.getOrThrow("computerUse") + /** Lets the agent manage its own scheduled wakeups. */ + fun asAutomations(): JsonValue = automations.getOrThrow("automations") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -135,6 +144,7 @@ private constructor( mcp != null -> visitor.visitMcp(mcp) webSearch != null -> visitor.visitWebSearch(webSearch) computerUse != null -> visitor.visitComputerUse(computerUse) + automations != null -> visitor.visitAutomations(automations) else -> visitor.unknown(_json) } @@ -186,6 +196,16 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) { computerUse.validate() } + + override fun visitAutomations(automations: JsonValue) { + automations.let { + if (it != JsonValue.from(mapOf("type" to "automations"))) { + throw OpenAIInvalidDataException( + "'automations' is invalid, received $it" + ) + } + } + } } ) validated = true @@ -225,6 +245,11 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) = computerUse.validity() + override fun visitAutomations(automations: JsonValue) = + automations.let { + if (it == JsonValue.from(mapOf("type" to "automations"))) 1 else 0 + } + override fun unknown(json: JsonValue?) = 0 } ) @@ -240,11 +265,20 @@ private constructor( programmaticToolCalling == other.programmaticToolCalling && mcp == other.mcp && webSearch == other.webSearch && - computerUse == other.computerUse + computerUse == other.computerUse && + automations == other.automations } override fun hashCode(): Int = - Objects.hash(function, toolSearch, programmaticToolCalling, mcp, webSearch, computerUse) + Objects.hash( + function, + toolSearch, + programmaticToolCalling, + mcp, + webSearch, + computerUse, + automations, + ) override fun toString(): String = when { @@ -255,6 +289,7 @@ private constructor( mcp != null -> "PersistedAgentTool{mcp=$mcp}" webSearch != null -> "PersistedAgentTool{webSearch=$webSearch}" computerUse != null -> "PersistedAgentTool{computerUse=$computerUse}" + automations != null -> "PersistedAgentTool{automations=$automations}" _json != null -> "PersistedAgentTool{_unknown=$_json}" else -> throw IllegalStateException("Invalid PersistedAgentTool") } @@ -283,6 +318,11 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ @JvmStatic fun ofComputerUse(computerUse: ComputerUse) = PersistedAgentTool(computerUse = computerUse) + + /** Lets the agent manage its own scheduled wakeups. */ + @JvmStatic + fun ofAutomations() = + PersistedAgentTool(automations = JsonValue.from(mapOf("type" to "automations"))) } /** @@ -309,6 +349,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun visitComputerUse(computerUse: ComputerUse): T + /** Lets the agent manage its own scheduled wakeups. */ + fun visitAutomations(automations: JsonValue): T = unknown(JsonValue.from(automations)) + /** * Maps an unknown variant of [PersistedAgentTool] to a value of type [T]. * @@ -361,6 +404,11 @@ private constructor( PersistedAgentTool(computerUse = it, _json = json) } ?: PersistedAgentTool(_json = json) } + "automations" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { PersistedAgentTool(automations = it, _json = json) } + ?.takeIf { it.isValid() } ?: PersistedAgentTool(_json = json) + } } return PersistedAgentTool(_json = json) @@ -382,6 +430,7 @@ private constructor( value.mcp != null -> generator.writeObject(value.mcp) value.webSearch != null -> generator.writeObject(value.webSearch) value.computerUse != null -> generator.writeObject(value.computerUse) + value.automations != null -> generator.writeObject(value.automations) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid PersistedAgentTool") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentToolParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentToolParam.kt index 2b0874479..465460443 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentToolParam.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentToolParam.kt @@ -42,6 +42,7 @@ private constructor( private val mcp: Mcp? = null, private val webSearch: WebSearch? = null, private val computerUse: ComputerUse? = null, + private val automations: JsonValue? = null, private val _json: JsonValue? = null, ) { @@ -64,6 +65,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun computerUse(): Optional = Optional.ofNullable(computerUse) + /** Lets the agent manage its own scheduled wakeups. */ + fun automations(): Optional = Optional.ofNullable(automations) + fun isFunction(): Boolean = function != null fun isToolSearch(): Boolean = toolSearch != null @@ -76,6 +80,8 @@ private constructor( fun isComputerUse(): Boolean = computerUse != null + fun isAutomations(): Boolean = automations != null + /** A function defined by the application. */ fun asFunction(): Function = function.getOrThrow("function") @@ -95,6 +101,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun asComputerUse(): ComputerUse = computerUse.getOrThrow("computerUse") + /** Lets the agent manage its own scheduled wakeups. */ + fun asAutomations(): JsonValue = automations.getOrThrow("automations") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -135,6 +144,7 @@ private constructor( mcp != null -> visitor.visitMcp(mcp) webSearch != null -> visitor.visitWebSearch(webSearch) computerUse != null -> visitor.visitComputerUse(computerUse) + automations != null -> visitor.visitAutomations(automations) else -> visitor.unknown(_json) } @@ -186,6 +196,16 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) { computerUse.validate() } + + override fun visitAutomations(automations: JsonValue) { + automations.let { + if (it != JsonValue.from(mapOf("type" to "automations"))) { + throw OpenAIInvalidDataException( + "'automations' is invalid, received $it" + ) + } + } + } } ) validated = true @@ -225,6 +245,11 @@ private constructor( override fun visitComputerUse(computerUse: ComputerUse) = computerUse.validity() + override fun visitAutomations(automations: JsonValue) = + automations.let { + if (it == JsonValue.from(mapOf("type" to "automations"))) 1 else 0 + } + override fun unknown(json: JsonValue?) = 0 } ) @@ -240,11 +265,20 @@ private constructor( programmaticToolCalling == other.programmaticToolCalling && mcp == other.mcp && webSearch == other.webSearch && - computerUse == other.computerUse + computerUse == other.computerUse && + automations == other.automations } override fun hashCode(): Int = - Objects.hash(function, toolSearch, programmaticToolCalling, mcp, webSearch, computerUse) + Objects.hash( + function, + toolSearch, + programmaticToolCalling, + mcp, + webSearch, + computerUse, + automations, + ) override fun toString(): String = when { @@ -255,6 +289,7 @@ private constructor( mcp != null -> "PersistedAgentToolParam{mcp=$mcp}" webSearch != null -> "PersistedAgentToolParam{webSearch=$webSearch}" computerUse != null -> "PersistedAgentToolParam{computerUse=$computerUse}" + automations != null -> "PersistedAgentToolParam{automations=$automations}" _json != null -> "PersistedAgentToolParam{_unknown=$_json}" else -> throw IllegalStateException("Invalid PersistedAgentToolParam") } @@ -285,6 +320,11 @@ private constructor( @JvmStatic fun ofComputerUse(computerUse: ComputerUse) = PersistedAgentToolParam(computerUse = computerUse) + + /** Lets the agent manage its own scheduled wakeups. */ + @JvmStatic + fun ofAutomations() = + PersistedAgentToolParam(automations = JsonValue.from(mapOf("type" to "automations"))) } /** @@ -311,6 +351,9 @@ private constructor( /** Browser use in an OpenAI-hosted session. */ fun visitComputerUse(computerUse: ComputerUse): T + /** Lets the agent manage its own scheduled wakeups. */ + fun visitAutomations(automations: JsonValue): T = unknown(JsonValue.from(automations)) + /** * Maps an unknown variant of [PersistedAgentToolParam] to a value of type [T]. * @@ -364,6 +407,11 @@ private constructor( PersistedAgentToolParam(computerUse = it, _json = json) } ?: PersistedAgentToolParam(_json = json) } + "automations" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { PersistedAgentToolParam(automations = it, _json = json) } + ?.takeIf { it.isValid() } ?: PersistedAgentToolParam(_json = json) + } } return PersistedAgentToolParam(_json = json) @@ -386,6 +434,7 @@ private constructor( value.mcp != null -> generator.writeObject(value.mcp) value.webSearch != null -> generator.writeObject(value.webSearch) value.computerUse != null -> generator.writeObject(value.computerUse) + value.automations != null -> generator.writeObject(value.automations) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid PersistedAgentToolParam") } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/sessions/SessionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/sessions/SessionCreateParams.kt index c87612efd..d0df38df7 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/sessions/SessionCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/agents/sessions/SessionCreateParams.kt @@ -1443,6 +1443,9 @@ private constructor( fun addTool(computerUse: AgentToolParam.ComputerUse) = addTool(AgentToolParam.ofComputerUse(computerUse)) + /** Alias for calling [addTool] with `AgentToolParam.ofAutomations()`. */ + fun addToolAutomations() = addTool(AgentToolParam.ofAutomations()) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFile.kt index 283e45d0b..e5a5644a2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFile.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -572,13 +573,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -593,6 +598,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -607,7 +627,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -635,11 +655,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -657,6 +679,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -682,7 +716,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -706,6 +740,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -724,7 +759,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -733,15 +770,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContent.kt index 36a7fd434..921250bc5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContent.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -590,13 +591,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -611,6 +616,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -625,7 +645,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -653,11 +673,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -675,6 +697,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -700,7 +734,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -724,6 +758,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -742,7 +777,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -751,15 +788,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImage.kt index db82c4be0..5731862b6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImage.kt @@ -14,6 +14,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -520,13 +521,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -541,6 +546,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -555,7 +575,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -583,11 +603,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -605,6 +627,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -630,7 +664,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -654,6 +688,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -672,7 +707,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -681,15 +718,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContent.kt index add6fa6ce..150ddf747 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContent.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -518,13 +519,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -539,6 +544,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -553,7 +573,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -581,11 +601,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -603,6 +625,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -628,7 +662,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -652,6 +686,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -670,7 +705,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -679,15 +716,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputText.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputText.kt index 68a77530b..d9b967e1c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputText.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -284,13 +285,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -305,6 +310,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -319,7 +339,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -347,11 +367,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -369,6 +391,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -394,7 +428,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -418,6 +452,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -436,7 +471,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -445,15 +482,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContent.kt index ba30f23f0..5663777c5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContent.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -291,13 +292,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -312,6 +317,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -326,7 +346,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -354,11 +374,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -376,6 +398,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -401,7 +435,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -425,6 +459,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -443,7 +478,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -452,15 +489,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt index 5bae2bb49..b6a083cfb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt @@ -27,6 +27,7 @@ import com.openai.core.collectAllProperties import com.openai.core.getOrThrow import com.openai.core.toImmutable import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -3772,13 +3773,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -3793,6 +3798,24 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ttl") + @ExcludeMissing + fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3807,7 +3830,11 @@ private constructor( * while explicit nulls and unrecognized values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties( + additionalProperties, + "mode" to this.mode, + "ttl" to this.ttl, + ) /** * Returns the legacy additional-properties view. @@ -3839,12 +3866,14 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -3863,6 +3892,21 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request + * TTL. + */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed + * [PromptCacheBreakpointTtl] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3891,7 +3935,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -3916,6 +3960,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -3935,7 +3980,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -3944,15 +3990,18 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(mode, ttl, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseOutputItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseOutputItem.kt index 051aa6aae..e5050d9f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseOutputItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseOutputItem.kt @@ -26,6 +26,7 @@ import com.openai.core.collectAllProperties import com.openai.core.getOrThrow import com.openai.core.toImmutable import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -3676,13 +3677,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -3697,6 +3702,24 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ttl") + @ExcludeMissing + fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3711,7 +3734,11 @@ private constructor( * while explicit nulls and unrecognized values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties( + additionalProperties, + "mode" to this.mode, + "ttl" to this.ttl, + ) /** * Returns the legacy additional-properties view. @@ -3743,12 +3770,14 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -3767,6 +3796,21 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request + * TTL. + */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed + * [PromptCacheBreakpointTtl] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3795,7 +3839,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -3820,6 +3864,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -3839,7 +3884,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -3848,15 +3894,18 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(mode, ttl, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt index 779a4a125..1e6d43e8e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt @@ -23,6 +23,7 @@ import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.core.getOrThrow import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -864,13 +865,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -885,6 +890,23 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") + @ExcludeMissing + fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -899,7 +921,7 @@ private constructor( * and unrecognized values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -930,11 +952,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -952,6 +976,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed + * [PromptCacheBreakpointTtl] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -980,7 +1016,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -1005,6 +1041,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -1024,7 +1061,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -1033,15 +1071,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt index a540cf074..5f40699f6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt @@ -14,6 +14,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -663,13 +664,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -684,6 +689,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -698,7 +718,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -726,11 +746,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -748,6 +770,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -773,7 +807,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -797,6 +831,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -815,7 +850,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -824,15 +861,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt index 0e75ca6dd..4e1edc23d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt @@ -14,6 +14,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -656,13 +657,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -677,6 +682,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -691,7 +711,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -719,11 +739,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -741,6 +763,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -766,7 +800,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -790,6 +824,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -808,7 +843,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -817,15 +854,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt index 2d00d7448..aa5ef04bf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -285,13 +286,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -306,6 +311,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -320,7 +340,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -348,11 +368,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -370,6 +392,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -395,7 +429,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -419,6 +453,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -437,7 +472,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -446,15 +483,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt index 8ca030a45..20079ab67 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt @@ -14,6 +14,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -518,13 +519,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -539,6 +544,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -553,7 +573,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -581,11 +601,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -603,6 +625,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -628,7 +662,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -652,6 +686,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -670,7 +705,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -679,15 +716,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/ClientDelegation.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/ClientDelegation.kt index 0f2ab4824..8803f3809 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/ClientDelegation.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/ClientDelegation.kt @@ -7,12 +7,14 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.openai.core.ExcludeMissing +import com.openai.core.JsonField import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException import java.util.Collections import java.util.Objects +import java.util.Optional /** * Delegate tasks to your application. The Live session emits delegation events that your backend @@ -22,13 +24,17 @@ class ClientDelegation @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of() - ) : this(type, mutableMapOf()) + @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(type, acknowledgementDelayMs, mutableMapOf()) /** * The delegation owner. Always `client` for tasks handled by your application. @@ -43,6 +49,29 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. + * The model may still speak before this delay. Any commentary or thinking appended to the + * session cancels all pending acknowledgements, including those for other delegations. Defaults + * to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a + * session update preserves the current value. Updates apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -57,7 +86,11 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "type" to this.type) + collectAllProperties( + additionalProperties, + "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, + ) /** * Returns the legacy additional-properties view. @@ -83,11 +116,13 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("client") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(clientDelegation: ClientDelegation) = apply { type = clientDelegation.type + acknowledgementDelayMs = clientDelegation.acknowledgementDelayMs additionalProperties = clientDelegation.additionalProperties.toMutableMap() } @@ -105,6 +140,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for other + * delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other + * sessions. Omission in a session update preserves the current value. Updates apply to + * subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -129,7 +186,8 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): ClientDelegation = ClientDelegation(type, additionalProperties.toMutableMap()) + fun build(): ClientDelegation = + ClientDelegation(type, acknowledgementDelayMs, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -152,6 +210,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -169,7 +228,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = type.let { if (it == JsonValue.from("client")) 1 else 0 } + internal fun validity(): Int = + type.let { if (it == JsonValue.from("client")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -178,13 +239,16 @@ private constructor( return other is ClientDelegation && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(type, acknowledgementDelayMs, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "ClientDelegation{type=$type, additionalProperties=$additionalProperties}" + "ClientDelegation{type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/ForkSessionConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/ForkSessionConfig.kt index d1fa7409c..5deb851c1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/ForkSessionConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/ForkSessionConfig.kt @@ -522,6 +522,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val responses: JsonField, private val additionalProperties: MutableMap, ) { @@ -529,10 +530,13 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), @JsonProperty("responses") @ExcludeMissing responses: JsonField = JsonMissing.of(), - ) : this(type, responses, mutableMapOf()) + ) : this(type, acknowledgementDelayMs, responses, mutableMapOf()) /** * The delegation owner. Always `responses` for tasks handled by the Responses API. @@ -547,6 +551,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for other + * delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other + * sessions. Omission in a session update preserves the current value. Updates apply to + * subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Responses backend settings to update. Omitted settings keep their existing values. * @@ -556,6 +574,16 @@ private constructor( fun responses(): Optional = responses.getOptional("responses") + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + /** * Returns the raw JSON value of [responses]. * @@ -582,6 +610,7 @@ private constructor( collectAllProperties( additionalProperties, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, "responses" to this.responses, ) @@ -609,12 +638,14 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var responses: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(delegation: Delegation) = apply { type = delegation.type + acknowledgementDelayMs = delegation.acknowledgementDelayMs responses = delegation.responses additionalProperties = delegation.additionalProperties.toMutableMap() } @@ -633,6 +664,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + /** * Responses backend settings to update. Omitted settings keep their existing values. */ @@ -675,7 +728,12 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Delegation = - Delegation(type, responses, additionalProperties.toMutableMap()) + Delegation( + type, + acknowledgementDelayMs, + responses, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -699,6 +757,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() responses().ifPresent { it.validate() } validated = true } @@ -720,6 +779,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) + (responses.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -729,16 +789,19 @@ private constructor( return other is Delegation && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && responses == other.responses && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(type, responses, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(type, acknowledgementDelayMs, responses, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "Delegation{type=$type, responses=$responses, additionalProperties=$additionalProperties}" + "Delegation{type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, responses=$responses, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionConfig.kt index 2a712714f..bf28d137d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionConfig.kt @@ -1639,6 +1639,7 @@ private constructor( private constructor( private val responses: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -1648,7 +1649,10 @@ private constructor( @ExcludeMissing responses: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(responses, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(responses, type, acknowledgementDelayMs, mutableMapOf()) /** * Backend model, prompt, and tools used when the Live session delegates a task to @@ -1673,6 +1677,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [responses]. * @@ -1683,6 +1701,16 @@ private constructor( @ExcludeMissing fun _responses(): JsonField = responses + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1701,6 +1729,7 @@ private constructor( additionalProperties, "responses" to this.responses, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -1737,12 +1766,14 @@ private constructor( private var responses: JsonField? = null private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(responses: Responses) = apply { this.responses = responses.responses type = responses.type + acknowledgementDelayMs = responses.acknowledgementDelayMs additionalProperties = responses.additionalProperties.toMutableMap() } @@ -1778,6 +1809,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400 for Decisions sessions and 0 + * (request immediately) for other sessions. Omission in a session update preserves + * the current value. Updates apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1816,6 +1869,7 @@ private constructor( Responses( checkRequired("responses", responses), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -1843,6 +1897,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -1863,7 +1918,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (responses.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("responses")) 1 else 0 } + type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -1873,17 +1929,18 @@ private constructor( return other is Responses && responses == other.responses && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(responses, type, additionalProperties) + Objects.hash(responses, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Responses{responses=$responses, type=$type, additionalProperties=$additionalProperties}" + "Responses{responses=$responses, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } class Decisions @@ -1891,6 +1948,7 @@ private constructor( private constructor( private val decisions: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -1900,7 +1958,10 @@ private constructor( @ExcludeMissing decisions: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(decisions, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(decisions, type, acknowledgementDelayMs, mutableMapOf()) /** * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is @@ -1920,6 +1981,18 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400. Updates apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [decisions]. * @@ -1930,6 +2003,16 @@ private constructor( @ExcludeMissing fun _decisions(): JsonField = decisions + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1948,6 +2031,7 @@ private constructor( additionalProperties, "decisions" to this.decisions, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -1984,12 +2068,14 @@ private constructor( private var decisions: JsonField? = null private var type: JsonValue = JsonValue.from("decisions") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decisions: Decisions) = apply { this.decisions = decisions.decisions type = decisions.type + acknowledgementDelayMs = decisions.acknowledgementDelayMs additionalProperties = decisions.additionalProperties.toMutableMap() } @@ -2021,6 +2107,27 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400. Updates apply to subsequent + * delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2059,6 +2166,7 @@ private constructor( Decisions( checkRequired("decisions", decisions), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -2086,6 +2194,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -2106,7 +2215,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (decisions.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2116,17 +2226,18 @@ private constructor( return other is Decisions && decisions == other.decisions && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(decisions, type, additionalProperties) + Objects.hash(decisions, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Decisions{decisions=$decisions, type=$type, additionalProperties=$additionalProperties}" + "Decisions{decisions=$decisions, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionForkConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionForkConfig.kt index ff70fad6f..6ba568e9c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionForkConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionForkConfig.kt @@ -263,6 +263,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val responses: JsonField, private val additionalProperties: MutableMap, ) { @@ -270,10 +271,13 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), @JsonProperty("responses") @ExcludeMissing responses: JsonField = JsonMissing.of(), - ) : this(type, responses, mutableMapOf()) + ) : this(type, acknowledgementDelayMs, responses, mutableMapOf()) /** * The delegation owner. Always `responses` for tasks handled by the Responses API. @@ -288,6 +292,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for other + * delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other + * sessions. Omission in a session update preserves the current value. Updates apply to + * subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Responses backend settings to update. Omitted settings keep their existing values. * @@ -297,6 +315,16 @@ private constructor( fun responses(): Optional = responses.getOptional("responses") + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + /** * Returns the raw JSON value of [responses]. * @@ -323,6 +351,7 @@ private constructor( collectAllProperties( additionalProperties, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, "responses" to this.responses, ) @@ -350,12 +379,14 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var responses: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(delegation: Delegation) = apply { type = delegation.type + acknowledgementDelayMs = delegation.acknowledgementDelayMs responses = delegation.responses additionalProperties = delegation.additionalProperties.toMutableMap() } @@ -374,6 +405,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + /** * Responses backend settings to update. Omitted settings keep their existing values. */ @@ -416,7 +469,12 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Delegation = - Delegation(type, responses, additionalProperties.toMutableMap()) + Delegation( + type, + acknowledgementDelayMs, + responses, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -440,6 +498,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() responses().ifPresent { it.validate() } validated = true } @@ -461,6 +520,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) + (responses.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -470,16 +530,19 @@ private constructor( return other is Delegation && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && responses == other.responses && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(type, responses, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(type, acknowledgementDelayMs, responses, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "Delegation{type=$type, responses=$responses, additionalProperties=$additionalProperties}" + "Delegation{type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, responses=$responses, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/SessionConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/SessionConfig.kt index dd6c2ba85..e36cdac5a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/SessionConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/SessionConfig.kt @@ -1721,6 +1721,7 @@ private constructor( private constructor( private val responses: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -1730,7 +1731,10 @@ private constructor( @ExcludeMissing responses: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(responses, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(responses, type, acknowledgementDelayMs, mutableMapOf()) /** * Backend model, prompt, and tools used when the Live session delegates a task to @@ -1755,6 +1759,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [responses]. * @@ -1765,6 +1783,16 @@ private constructor( @ExcludeMissing fun _responses(): JsonField = responses + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1783,6 +1811,7 @@ private constructor( additionalProperties, "responses" to this.responses, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -1819,12 +1848,14 @@ private constructor( private var responses: JsonField? = null private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(responses: Responses) = apply { this.responses = responses.responses type = responses.type + acknowledgementDelayMs = responses.acknowledgementDelayMs additionalProperties = responses.additionalProperties.toMutableMap() } @@ -1860,6 +1891,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400 for Decisions sessions and 0 + * (request immediately) for other sessions. Omission in a session update preserves + * the current value. Updates apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1898,6 +1951,7 @@ private constructor( Responses( checkRequired("responses", responses), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -1925,6 +1979,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -1945,7 +2000,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (responses.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("responses")) 1 else 0 } + type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -1955,17 +2011,18 @@ private constructor( return other is Responses && responses == other.responses && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(responses, type, additionalProperties) + Objects.hash(responses, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Responses{responses=$responses, type=$type, additionalProperties=$additionalProperties}" + "Responses{responses=$responses, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } class Decisions @@ -1973,6 +2030,7 @@ private constructor( private constructor( private val decisions: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -1982,7 +2040,10 @@ private constructor( @ExcludeMissing decisions: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(decisions, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(decisions, type, acknowledgementDelayMs, mutableMapOf()) /** * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is @@ -2002,6 +2063,18 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400. Updates apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [decisions]. * @@ -2012,6 +2085,16 @@ private constructor( @ExcludeMissing fun _decisions(): JsonField = decisions + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -2030,6 +2113,7 @@ private constructor( additionalProperties, "decisions" to this.decisions, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -2066,12 +2150,14 @@ private constructor( private var decisions: JsonField? = null private var type: JsonValue = JsonValue.from("decisions") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decisions: Decisions) = apply { this.decisions = decisions.decisions type = decisions.type + acknowledgementDelayMs = decisions.acknowledgementDelayMs additionalProperties = decisions.additionalProperties.toMutableMap() } @@ -2103,6 +2189,27 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400. Updates apply to subsequent + * delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2141,6 +2248,7 @@ private constructor( Decisions( checkRequired("decisions", decisions), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -2168,6 +2276,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -2188,7 +2297,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (decisions.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2198,17 +2308,18 @@ private constructor( return other is Decisions && decisions == other.decisions && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(decisions, type, additionalProperties) + Objects.hash(decisions, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Decisions{decisions=$decisions, type=$type, additionalProperties=$additionalProperties}" + "Decisions{decisions=$decisions, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/SessionResource.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/SessionResource.kt index ae2c81f62..579f9c716 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/SessionResource.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/SessionResource.kt @@ -1847,6 +1847,7 @@ private constructor( private constructor( private val responses: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -1856,7 +1857,10 @@ private constructor( @ExcludeMissing responses: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(responses, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(responses, type, acknowledgementDelayMs, mutableMapOf()) /** * Backend model, prompt, and tools used when the Live session delegates a task to @@ -1881,6 +1885,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [responses]. * @@ -1891,6 +1909,16 @@ private constructor( @ExcludeMissing fun _responses(): JsonField = responses + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1909,6 +1937,7 @@ private constructor( additionalProperties, "responses" to this.responses, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -1945,12 +1974,14 @@ private constructor( private var responses: JsonField? = null private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(responses: Responses) = apply { this.responses = responses.responses type = responses.type + acknowledgementDelayMs = responses.acknowledgementDelayMs additionalProperties = responses.additionalProperties.toMutableMap() } @@ -1986,6 +2017,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400 for Decisions sessions and 0 + * (request immediately) for other sessions. Omission in a session update preserves + * the current value. Updates apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2024,6 +2077,7 @@ private constructor( Responses( checkRequired("responses", responses), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -2051,6 +2105,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -2071,7 +2126,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (responses.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("responses")) 1 else 0 } + type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2081,17 +2137,18 @@ private constructor( return other is Responses && responses == other.responses && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(responses, type, additionalProperties) + Objects.hash(responses, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Responses{responses=$responses, type=$type, additionalProperties=$additionalProperties}" + "Responses{responses=$responses, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } class Decisions @@ -2099,6 +2156,7 @@ private constructor( private constructor( private val decisions: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -2108,7 +2166,10 @@ private constructor( @ExcludeMissing decisions: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(decisions, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(decisions, type, acknowledgementDelayMs, mutableMapOf()) /** * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is @@ -2128,6 +2189,18 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400. Updates apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [decisions]. * @@ -2138,6 +2211,16 @@ private constructor( @ExcludeMissing fun _decisions(): JsonField = decisions + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -2156,6 +2239,7 @@ private constructor( additionalProperties, "decisions" to this.decisions, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -2192,12 +2276,14 @@ private constructor( private var decisions: JsonField? = null private var type: JsonValue = JsonValue.from("decisions") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decisions: Decisions) = apply { this.decisions = decisions.decisions type = decisions.type + acknowledgementDelayMs = decisions.acknowledgementDelayMs additionalProperties = decisions.additionalProperties.toMutableMap() } @@ -2229,6 +2315,27 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400. Updates apply to subsequent + * delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2267,6 +2374,7 @@ private constructor( Decisions( checkRequired("decisions", decisions), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -2294,6 +2402,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -2314,7 +2423,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (decisions.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2324,17 +2434,18 @@ private constructor( return other is Decisions && decisions == other.decisions && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(decisions, type, additionalProperties) + Objects.hash(decisions, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Decisions{decisions=$decisions, type=$type, additionalProperties=$additionalProperties}" + "Decisions{decisions=$decisions, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/SessionUpdateConfig.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/SessionUpdateConfig.kt index e3a9420ea..daf7cfeba 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/SessionUpdateConfig.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/SessionUpdateConfig.kt @@ -543,6 +543,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val responses: JsonField, private val additionalProperties: MutableMap, ) { @@ -550,10 +551,13 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), @JsonProperty("responses") @ExcludeMissing responses: JsonField = JsonMissing.of(), - ) : this(type, responses, mutableMapOf()) + ) : this(type, acknowledgementDelayMs, responses, mutableMapOf()) /** * The delegation owner. Always `responses` for tasks handled by the Responses API. @@ -568,6 +572,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Responses backend settings to update. Omitted settings keep their existing values. * @@ -577,6 +595,16 @@ private constructor( fun responses(): Optional = responses.getOptional("responses") + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + /** * Returns the raw JSON value of [responses]. * @@ -604,6 +632,7 @@ private constructor( collectAllProperties( additionalProperties, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, "responses" to this.responses, ) @@ -633,12 +662,14 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var responses: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(responses: Responses) = apply { type = responses.type + acknowledgementDelayMs = responses.acknowledgementDelayMs this.responses = responses.responses additionalProperties = responses.additionalProperties.toMutableMap() } @@ -657,6 +688,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400 for Decisions sessions and 0 + * (request immediately) for other sessions. Omission in a session update preserves + * the current value. Updates apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + /** * Responses backend settings to update. Omitted settings keep their existing * values. @@ -703,7 +756,12 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Responses = - Responses(type, responses, additionalProperties.toMutableMap()) + Responses( + type, + acknowledgementDelayMs, + responses, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -728,6 +786,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() responses().ifPresent { it.validate() } validated = true } @@ -749,6 +808,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) + (responses.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -758,24 +818,26 @@ private constructor( return other is Responses && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && responses == other.responses && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(type, responses, additionalProperties) + Objects.hash(type, acknowledgementDelayMs, responses, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Responses{type=$type, responses=$responses, additionalProperties=$additionalProperties}" + "Responses{type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, responses=$responses, additionalProperties=$additionalProperties}" } class Decisions @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val decisions: JsonField, private val additionalProperties: MutableMap, ) { @@ -783,10 +845,13 @@ private constructor( @JsonCreator private constructor( @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), @JsonProperty("decisions") @ExcludeMissing decisions: JsonField = JsonMissing.of(), - ) : this(type, decisions, mutableMapOf()) + ) : this(type, acknowledgementDelayMs, decisions, mutableMapOf()) /** * Expected to always return the following: @@ -799,6 +864,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or thinking + * appended to the session cancels all pending acknowledgements, including those for + * other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) + * for other sessions. Omission in a session update preserves the current value. Updates + * apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -806,6 +885,16 @@ private constructor( fun decisions(): Optional = decisions.getOptional("decisions") + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + /** * Returns the raw JSON value of [decisions]. * @@ -833,6 +922,7 @@ private constructor( collectAllProperties( additionalProperties, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, "decisions" to this.decisions, ) @@ -862,12 +952,14 @@ private constructor( class Builder internal constructor() { private var type: JsonValue = JsonValue.from("decisions") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var decisions: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decisions: Decisions) = apply { type = decisions.type + acknowledgementDelayMs = decisions.acknowledgementDelayMs this.decisions = decisions.decisions additionalProperties = decisions.additionalProperties.toMutableMap() } @@ -886,6 +978,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400 for Decisions sessions and 0 + * (request immediately) for other sessions. Omission in a session update preserves + * the current value. Updates apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun decisions(decisions: DecisionsDelegationUpdateConfig) = decisions(JsonField.of(decisions)) @@ -928,7 +1042,12 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Decisions = - Decisions(type, decisions, additionalProperties.toMutableMap()) + Decisions( + type, + acknowledgementDelayMs, + decisions, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -953,6 +1072,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() decisions().ifPresent { it.validate() } validated = true } @@ -974,6 +1094,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) + (decisions.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -983,18 +1104,19 @@ private constructor( return other is Decisions && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && decisions == other.decisions && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(type, decisions, additionalProperties) + Objects.hash(type, acknowledgementDelayMs, decisions, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Decisions{type=$type, decisions=$decisions, additionalProperties=$additionalProperties}" + "Decisions{type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, decisions=$decisions, additionalProperties=$additionalProperties}" } } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/live/sessions/SessionAcceptParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/live/sessions/SessionAcceptParams.kt index 8ed7fab27..7236f1520 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/live/sessions/SessionAcceptParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/live/sessions/SessionAcceptParams.kt @@ -2098,6 +2098,7 @@ private constructor( private constructor( private val responses: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -2107,7 +2108,10 @@ private constructor( @ExcludeMissing responses: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(responses, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(responses, type, acknowledgementDelayMs, mutableMapOf()) /** * Backend model, prompt, and tools used when the Live session delegates a task to @@ -2132,6 +2136,20 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400 for Decisions sessions and 0 + * (request immediately) for other sessions. Omission in a session update preserves + * the current value. Updates apply to subsequent delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [responses]. * @@ -2142,6 +2160,16 @@ private constructor( @ExcludeMissing fun _responses(): JsonField = responses + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -2160,6 +2188,7 @@ private constructor( additionalProperties, "responses" to this.responses, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -2196,12 +2225,14 @@ private constructor( private var responses: JsonField? = null private var type: JsonValue = JsonValue.from("responses") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(responses: Responses) = apply { this.responses = responses.responses type = responses.type + acknowledgementDelayMs = responses.acknowledgementDelayMs additionalProperties = responses.additionalProperties.toMutableMap() } @@ -2237,6 +2268,28 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement + * for a delegation. The model may still speak before this delay. Any commentary + * or thinking appended to the session cancels all pending acknowledgements, + * including those for other delegations. Defaults to 400 for Decisions sessions + * and 0 (request immediately) for other sessions. Omission in a session update + * preserves the current value. Updates apply to subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed + * [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2275,6 +2328,7 @@ private constructor( Responses( checkRequired("responses", responses), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -2302,6 +2356,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -2322,7 +2377,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (responses.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("responses")) 1 else 0 } + type.let { if (it == JsonValue.from("responses")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2332,17 +2388,18 @@ private constructor( return other is Responses && responses == other.responses && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(responses, type, additionalProperties) + Objects.hash(responses, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Responses{responses=$responses, type=$type, additionalProperties=$additionalProperties}" + "Responses{responses=$responses, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } class Decisions @@ -2350,6 +2407,7 @@ private constructor( private constructor( private val decisions: JsonField, private val type: JsonValue, + private val acknowledgementDelayMs: JsonField, private val additionalProperties: MutableMap, ) { @@ -2359,7 +2417,10 @@ private constructor( @ExcludeMissing decisions: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(decisions, type, mutableMapOf()) + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + acknowledgementDelayMs: JsonField = JsonMissing.of(), + ) : this(decisions, type, acknowledgementDelayMs, mutableMapOf()) /** * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is @@ -2379,6 +2440,19 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement for a + * delegation. The model may still speak before this delay. Any commentary or + * thinking appended to the session cancels all pending acknowledgements, including + * those for other delegations. Defaults to 400. Updates apply to subsequent + * delegations. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun acknowledgementDelayMs(): Optional = + acknowledgementDelayMs.getOptional("acknowledgement_delay_ms") + /** * Returns the raw JSON value of [decisions]. * @@ -2389,6 +2463,16 @@ private constructor( @ExcludeMissing fun _decisions(): JsonField = decisions + /** + * Returns the raw JSON value of [acknowledgementDelayMs]. + * + * Unlike [acknowledgementDelayMs], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("acknowledgement_delay_ms") + @ExcludeMissing + fun _acknowledgementDelayMs(): JsonField = acknowledgementDelayMs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -2407,6 +2491,7 @@ private constructor( additionalProperties, "decisions" to this.decisions, "type" to this.type, + "acknowledgement_delay_ms" to this.acknowledgementDelayMs, ) /** @@ -2443,12 +2528,14 @@ private constructor( private var decisions: JsonField? = null private var type: JsonValue = JsonValue.from("decisions") + private var acknowledgementDelayMs: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(decisions: Decisions) = apply { this.decisions = decisions.decisions type = decisions.type + acknowledgementDelayMs = decisions.acknowledgementDelayMs additionalProperties = decisions.additionalProperties.toMutableMap() } @@ -2480,6 +2567,27 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + /** + * Milliseconds to wait before requesting an automatic spoken acknowledgement + * for a delegation. The model may still speak before this delay. Any commentary + * or thinking appended to the session cancels all pending acknowledgements, + * including those for other delegations. Defaults to 400. Updates apply to + * subsequent delegations. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: Long) = + acknowledgementDelayMs(JsonField.of(acknowledgementDelayMs)) + + /** + * Sets [Builder.acknowledgementDelayMs] to an arbitrary JSON value. + * + * You should usually call [Builder.acknowledgementDelayMs] with a well-typed + * [Long] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun acknowledgementDelayMs(acknowledgementDelayMs: JsonField) = apply { + this.acknowledgementDelayMs = acknowledgementDelayMs + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2518,6 +2626,7 @@ private constructor( Decisions( checkRequired("decisions", decisions), type, + acknowledgementDelayMs, additionalProperties.toMutableMap(), ) } @@ -2545,6 +2654,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + acknowledgementDelayMs() validated = true } @@ -2565,7 +2675,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (decisions.asKnown().getOrNull()?.validity() ?: 0) + - type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + type.let { if (it == JsonValue.from("decisions")) 1 else 0 } + + (if (acknowledgementDelayMs.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2575,17 +2686,18 @@ private constructor( return other is Decisions && decisions == other.decisions && type == other.type && + acknowledgementDelayMs == other.acknowledgementDelayMs && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(decisions, type, additionalProperties) + Objects.hash(decisions, type, acknowledgementDelayMs, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Decisions{decisions=$decisions, type=$type, additionalProperties=$additionalProperties}" + "Decisions{decisions=$decisions, type=$type, acknowledgementDelayMs=$acknowledgementDelayMs, additionalProperties=$additionalProperties}" } } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt index 9e4da9ba2..8e6c1bd42 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt @@ -96,7 +96,7 @@ private constructor( fun delta(): Optional = delta.getOptional("delta") /** - * The log probabilities of the transcription. These can be enabled by configurating the session + * The log probabilities of the transcription. These can be enabled by configuring the session * with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array * corresponds a log probability of which token would be selected for this chunk of * transcription. This can help to identify if it was possible there were multiple valid options @@ -290,7 +290,7 @@ private constructor( fun delta(delta: JsonField) = apply { this.delta = delta } /** - * The log probabilities of the transcription. These can be enabled by configurating the + * The log probabilities of the transcription. These can be enabled by configuring the * session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the * array corresponds a log probability of which token would be selected for this chunk of * transcription. This can help to identify if it was possible there were multiple valid diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt index 266c32e84..8b7c7bf5a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt @@ -19,7 +19,7 @@ import kotlin.jvm.optionals.getOrNull /** * Returned when an error occurs, which could be a client problem or a server problem. Most errors - * are recoverable and the session will stay open, we recommend to implementors to monitor and log + * are recoverable and the session will stay open, we recommend to implementers to monitor and log * error messages by default. */ class RealtimeErrorEvent diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt index 7c4d50896..a02750286 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt @@ -169,7 +169,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ fun error(): Optional = Optional.ofNullable(error) @@ -617,7 +617,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ fun asError(): RealtimeErrorEvent = error.getOrThrow("error") @@ -1803,7 +1803,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ @JvmStatic fun ofError(error: RealtimeErrorEvent) = RealtimeServerEvent(error = error) @@ -2238,7 +2238,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ fun visitError(error: RealtimeErrorEvent): T = unknown(JsonValue.from(error)) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranslationServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranslationServerEvent.kt index e37a1ae5f..51283b61a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranslationServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranslationServerEvent.kt @@ -35,7 +35,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ fun error(): Optional = Optional.ofNullable(error) @@ -102,7 +102,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ fun asError(): RealtimeErrorEvent = error.getOrThrow("error") @@ -355,7 +355,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ @JvmStatic @@ -431,7 +431,7 @@ private constructor( /** * Returned when an error occurs, which could be a client problem or a server problem. Most - * errors are recoverable and the session will stay open, we recommend to implementors to + * errors are recoverable and the session will stay open, we recommend to implementers to * monitor and log error messages by default. */ fun visitError(error: RealtimeErrorEvent): T = unknown(JsonValue.from(error)) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt index 17b1309f4..0633ce965 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -572,13 +573,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -593,6 +598,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -607,7 +627,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -635,11 +655,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -657,6 +679,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -682,7 +716,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -706,6 +740,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -724,7 +759,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -733,15 +770,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt index aff67a52a..eadfffefd 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -588,13 +589,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -609,6 +614,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -623,7 +643,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -651,11 +671,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -673,6 +695,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -698,7 +732,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -722,6 +756,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -740,7 +775,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -749,15 +786,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt index 1e6dbd4ec..5ef5060e4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt @@ -14,6 +14,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -520,13 +521,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -541,6 +546,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -555,7 +575,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -583,11 +603,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -605,6 +627,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -630,7 +664,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -654,6 +688,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -672,7 +707,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -681,15 +718,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt index f970b8559..7b878ac5e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonMissing import com.openai.core.JsonValue import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -517,13 +518,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -538,6 +543,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -552,7 +572,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -580,11 +600,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -602,6 +624,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -627,7 +661,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -651,6 +685,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -669,7 +704,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -678,15 +715,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt index da386540c..231dbace3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -284,13 +285,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -305,6 +310,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -319,7 +339,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -347,11 +367,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -369,6 +391,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -394,7 +428,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -418,6 +452,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -436,7 +471,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -445,15 +482,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt index b0695d3e7..d42c93b8b 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt @@ -13,6 +13,7 @@ import com.openai.core.JsonValue import com.openai.core.checkRequired import com.openai.core.collectAllProperties import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import java.util.Collections import java.util.Objects import java.util.Optional @@ -291,13 +292,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val mode: JsonValue, + private val ttl: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of() - ) : this(mode, mutableMapOf()) + @JsonProperty("mode") @ExcludeMissing mode: JsonValue = JsonMissing.of(), + @JsonProperty("ttl") + @ExcludeMissing + ttl: JsonField = JsonMissing.of(), + ) : this(mode, ttl, mutableMapOf()) /** * The breakpoint mode. Always `explicit`. @@ -312,6 +317,21 @@ private constructor( */ @JsonProperty("mode") @ExcludeMissing fun _mode(): JsonValue = mode + /** + * The minimum lifetime of this cache breakpoint. Defaults to the request TTL. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ttl(): Optional = ttl.getOptional("ttl") + + /** + * Returns the raw JSON value of [ttl]. + * + * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -326,7 +346,7 @@ private constructor( * values are preserved. */ fun _allProperties(): Map = - collectAllProperties(additionalProperties, "mode" to this.mode) + collectAllProperties(additionalProperties, "mode" to this.mode, "ttl" to this.ttl) /** * Returns the legacy additional-properties view. @@ -354,11 +374,13 @@ private constructor( class Builder internal constructor() { private var mode: JsonValue = JsonValue.from("explicit") + private var ttl: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(promptCacheBreakpoint: PromptCacheBreakpoint) = apply { mode = promptCacheBreakpoint.mode + ttl = promptCacheBreakpoint.ttl additionalProperties = promptCacheBreakpoint.additionalProperties.toMutableMap() } @@ -376,6 +398,18 @@ private constructor( */ fun mode(mode: JsonValue) = apply { this.mode = mode } + /** The minimum lifetime of this cache breakpoint. Defaults to the request TTL. */ + fun ttl(ttl: PromptCacheBreakpointTtl) = ttl(JsonField.of(ttl)) + + /** + * Sets [Builder.ttl] to an arbitrary JSON value. + * + * You should usually call [Builder.ttl] with a well-typed [PromptCacheBreakpointTtl] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ttl(ttl: JsonField) = apply { this.ttl = ttl } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -401,7 +435,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): PromptCacheBreakpoint = - PromptCacheBreakpoint(mode, additionalProperties.toMutableMap()) + PromptCacheBreakpoint(mode, ttl, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -425,6 +459,7 @@ private constructor( throw OpenAIInvalidDataException("'mode' is invalid, received $it") } } + ttl().ifPresent { it.validate() } validated = true } @@ -443,7 +478,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + internal fun validity(): Int = + mode.let { if (it == JsonValue.from("explicit")) 1 else 0 } + + (ttl.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -452,15 +489,16 @@ private constructor( return other is PromptCacheBreakpoint && mode == other.mode && + ttl == other.ttl && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(mode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(mode, ttl, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "PromptCacheBreakpoint{mode=$mode, additionalProperties=$additionalProperties}" + "PromptCacheBreakpoint{mode=$mode, ttl=$ttl, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro b/openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro index d342480a9..e4fd708eb 100644 --- a/openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro +++ b/openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro @@ -21,6 +21,8 @@ -keep class com.openai.models.completions.CompletionUsage { *; } -keep class com.openai.models.responses.ResponseUsage { *; } -keep class com.openai.models.beta.responses.BetaResponseUsage { *; } +# Preserve the default for an omitted optional TTL during reflective deserialization. +-keep class com.openai.models.**$PromptCacheBreakpoint { *; } # Jackson uses reflection to access annotation members. -keepclassmembers @interface com.fasterxml.jackson.annotation.** { @@ -39,4 +41,4 @@ -keepclassmembers class com.openai.** { (...); @com.fasterxml.jackson.annotation.* *; -} \ No newline at end of file +} diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolParamTest.kt index d29a70025..573bcf4ed 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolParamTest.kt @@ -36,6 +36,7 @@ internal class AgentToolParamTest { assertThat(agentToolParam.mcp()).isEmpty assertThat(agentToolParam.webSearch()).isEmpty assertThat(agentToolParam.computerUse()).isEmpty + assertThat(agentToolParam.automations()).isEmpty } @Test @@ -75,6 +76,7 @@ internal class AgentToolParamTest { assertThat(agentToolParam.mcp()).isEmpty assertThat(agentToolParam.webSearch()).isEmpty assertThat(agentToolParam.computerUse()).isEmpty + assertThat(agentToolParam.automations()).isEmpty } @Test @@ -104,6 +106,7 @@ internal class AgentToolParamTest { assertThat(agentToolParam.mcp()).isEmpty assertThat(agentToolParam.webSearch()).isEmpty assertThat(agentToolParam.computerUse()).isEmpty + assertThat(agentToolParam.automations()).isEmpty } @Test @@ -158,6 +161,7 @@ internal class AgentToolParamTest { assertThat(agentToolParam.mcp()).contains(mcp) assertThat(agentToolParam.webSearch()).isEmpty assertThat(agentToolParam.computerUse()).isEmpty + assertThat(agentToolParam.automations()).isEmpty } @Test @@ -224,6 +228,7 @@ internal class AgentToolParamTest { assertThat(agentToolParam.mcp()).isEmpty assertThat(agentToolParam.webSearch()).contains(webSearch) assertThat(agentToolParam.computerUse()).isEmpty + assertThat(agentToolParam.automations()).isEmpty } @Test @@ -267,6 +272,7 @@ internal class AgentToolParamTest { assertThat(agentToolParam.mcp()).isEmpty assertThat(agentToolParam.webSearch()).isEmpty assertThat(agentToolParam.computerUse()).contains(computerUse) + assertThat(agentToolParam.automations()).isEmpty } @Test @@ -286,6 +292,34 @@ internal class AgentToolParamTest { assertThat(roundtrippedAgentToolParam).isEqualTo(agentToolParam) } + @Test + fun ofAutomations() { + val agentToolParam = AgentToolParam.ofAutomations() + + assertThat(agentToolParam.function()).isEmpty + assertThat(agentToolParam.toolSearch()).isEmpty + assertThat(agentToolParam.programmaticToolCalling()).isEmpty + assertThat(agentToolParam.mcp()).isEmpty + assertThat(agentToolParam.webSearch()).isEmpty + assertThat(agentToolParam.computerUse()).isEmpty + assertThat(agentToolParam.automations()) + .contains(JsonValue.from(mapOf("type" to "automations"))) + } + + @Test + fun ofAutomationsRoundtrip() { + val jsonMapper = jsonMapper() + val agentToolParam = AgentToolParam.ofAutomations() + + val roundtrippedAgentToolParam = + jsonMapper.readValue( + jsonMapper.writeValueAsString(agentToolParam), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAgentToolParam).isEqualTo(agentToolParam) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolTest.kt index ff887dd23..105dd28e3 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolTest.kt @@ -35,6 +35,7 @@ internal class AgentToolTest { assertThat(agentTool.mcp()).isEmpty assertThat(agentTool.webSearch()).isEmpty assertThat(agentTool.computerUse()).isEmpty + assertThat(agentTool.automations()).isEmpty } @Test @@ -75,6 +76,7 @@ internal class AgentToolTest { assertThat(agentTool.mcp()).isEmpty assertThat(agentTool.webSearch()).isEmpty assertThat(agentTool.computerUse()).isEmpty + assertThat(agentTool.automations()).isEmpty } @Test @@ -118,6 +120,7 @@ internal class AgentToolTest { assertThat(agentTool.mcp()).contains(mcp) assertThat(agentTool.webSearch()).isEmpty assertThat(agentTool.computerUse()).isEmpty + assertThat(agentTool.automations()).isEmpty } @Test @@ -173,6 +176,7 @@ internal class AgentToolTest { assertThat(agentTool.mcp()).isEmpty assertThat(agentTool.webSearch()).contains(webSearch) assertThat(agentTool.computerUse()).isEmpty + assertThat(agentTool.automations()).isEmpty } @Test @@ -215,6 +219,7 @@ internal class AgentToolTest { assertThat(agentTool.mcp()).isEmpty assertThat(agentTool.webSearch()).isEmpty assertThat(agentTool.computerUse()).contains(computerUse) + assertThat(agentTool.automations()).isEmpty } @Test @@ -234,6 +239,32 @@ internal class AgentToolTest { assertThat(roundtrippedAgentTool).isEqualTo(agentTool) } + @Test + fun ofAutomations() { + val agentTool = AgentTool.ofAutomations() + + assertThat(agentTool.function()).isEmpty + assertThat(agentTool.programmaticToolCalling()).isEmpty + assertThat(agentTool.mcp()).isEmpty + assertThat(agentTool.webSearch()).isEmpty + assertThat(agentTool.computerUse()).isEmpty + assertThat(agentTool.automations()).contains(JsonValue.from(mapOf("type" to "automations"))) + } + + @Test + fun ofAutomationsRoundtrip() { + val jsonMapper = jsonMapper() + val agentTool = AgentTool.ofAutomations() + + val roundtrippedAgentTool = + jsonMapper.readValue( + jsonMapper.writeValueAsString(agentTool), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAgentTool).isEqualTo(agentTool) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolParamTest.kt index 176d80e18..2f461d52a 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolParamTest.kt @@ -36,6 +36,7 @@ internal class PersistedAgentToolParamTest { assertThat(persistedAgentToolParam.mcp()).isEmpty assertThat(persistedAgentToolParam.webSearch()).isEmpty assertThat(persistedAgentToolParam.computerUse()).isEmpty + assertThat(persistedAgentToolParam.automations()).isEmpty } @Test @@ -75,6 +76,7 @@ internal class PersistedAgentToolParamTest { assertThat(persistedAgentToolParam.mcp()).isEmpty assertThat(persistedAgentToolParam.webSearch()).isEmpty assertThat(persistedAgentToolParam.computerUse()).isEmpty + assertThat(persistedAgentToolParam.automations()).isEmpty } @Test @@ -106,6 +108,7 @@ internal class PersistedAgentToolParamTest { assertThat(persistedAgentToolParam.mcp()).isEmpty assertThat(persistedAgentToolParam.webSearch()).isEmpty assertThat(persistedAgentToolParam.computerUse()).isEmpty + assertThat(persistedAgentToolParam.automations()).isEmpty } @Test @@ -159,6 +162,7 @@ internal class PersistedAgentToolParamTest { assertThat(persistedAgentToolParam.mcp()).contains(mcp) assertThat(persistedAgentToolParam.webSearch()).isEmpty assertThat(persistedAgentToolParam.computerUse()).isEmpty + assertThat(persistedAgentToolParam.automations()).isEmpty } @Test @@ -224,6 +228,7 @@ internal class PersistedAgentToolParamTest { assertThat(persistedAgentToolParam.mcp()).isEmpty assertThat(persistedAgentToolParam.webSearch()).contains(webSearch) assertThat(persistedAgentToolParam.computerUse()).isEmpty + assertThat(persistedAgentToolParam.automations()).isEmpty } @Test @@ -268,6 +273,7 @@ internal class PersistedAgentToolParamTest { assertThat(persistedAgentToolParam.mcp()).isEmpty assertThat(persistedAgentToolParam.webSearch()).isEmpty assertThat(persistedAgentToolParam.computerUse()).contains(computerUse) + assertThat(persistedAgentToolParam.automations()).isEmpty } @Test @@ -287,6 +293,34 @@ internal class PersistedAgentToolParamTest { assertThat(roundtrippedPersistedAgentToolParam).isEqualTo(persistedAgentToolParam) } + @Test + fun ofAutomations() { + val persistedAgentToolParam = PersistedAgentToolParam.ofAutomations() + + assertThat(persistedAgentToolParam.function()).isEmpty + assertThat(persistedAgentToolParam.toolSearch()).isEmpty + assertThat(persistedAgentToolParam.programmaticToolCalling()).isEmpty + assertThat(persistedAgentToolParam.mcp()).isEmpty + assertThat(persistedAgentToolParam.webSearch()).isEmpty + assertThat(persistedAgentToolParam.computerUse()).isEmpty + assertThat(persistedAgentToolParam.automations()) + .contains(JsonValue.from(mapOf("type" to "automations"))) + } + + @Test + fun ofAutomationsRoundtrip() { + val jsonMapper = jsonMapper() + val persistedAgentToolParam = PersistedAgentToolParam.ofAutomations() + + val roundtrippedPersistedAgentToolParam = + jsonMapper.readValue( + jsonMapper.writeValueAsString(persistedAgentToolParam), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPersistedAgentToolParam).isEqualTo(persistedAgentToolParam) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolTest.kt index 5ef357398..ee11f750b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolTest.kt @@ -36,6 +36,7 @@ internal class PersistedAgentToolTest { assertThat(persistedAgentTool.mcp()).isEmpty assertThat(persistedAgentTool.webSearch()).isEmpty assertThat(persistedAgentTool.computerUse()).isEmpty + assertThat(persistedAgentTool.automations()).isEmpty } @Test @@ -75,6 +76,7 @@ internal class PersistedAgentToolTest { assertThat(persistedAgentTool.mcp()).isEmpty assertThat(persistedAgentTool.webSearch()).isEmpty assertThat(persistedAgentTool.computerUse()).isEmpty + assertThat(persistedAgentTool.automations()).isEmpty } @Test @@ -105,6 +107,7 @@ internal class PersistedAgentToolTest { assertThat(persistedAgentTool.mcp()).isEmpty assertThat(persistedAgentTool.webSearch()).isEmpty assertThat(persistedAgentTool.computerUse()).isEmpty + assertThat(persistedAgentTool.automations()).isEmpty } @Test @@ -158,6 +161,7 @@ internal class PersistedAgentToolTest { assertThat(persistedAgentTool.mcp()).contains(mcp) assertThat(persistedAgentTool.webSearch()).isEmpty assertThat(persistedAgentTool.computerUse()).isEmpty + assertThat(persistedAgentTool.automations()).isEmpty } @Test @@ -223,6 +227,7 @@ internal class PersistedAgentToolTest { assertThat(persistedAgentTool.mcp()).isEmpty assertThat(persistedAgentTool.webSearch()).contains(webSearch) assertThat(persistedAgentTool.computerUse()).isEmpty + assertThat(persistedAgentTool.automations()).isEmpty } @Test @@ -266,6 +271,7 @@ internal class PersistedAgentToolTest { assertThat(persistedAgentTool.mcp()).isEmpty assertThat(persistedAgentTool.webSearch()).isEmpty assertThat(persistedAgentTool.computerUse()).contains(computerUse) + assertThat(persistedAgentTool.automations()).isEmpty } @Test @@ -285,6 +291,34 @@ internal class PersistedAgentToolTest { assertThat(roundtrippedPersistedAgentTool).isEqualTo(persistedAgentTool) } + @Test + fun ofAutomations() { + val persistedAgentTool = PersistedAgentTool.ofAutomations() + + assertThat(persistedAgentTool.function()).isEmpty + assertThat(persistedAgentTool.toolSearch()).isEmpty + assertThat(persistedAgentTool.programmaticToolCalling()).isEmpty + assertThat(persistedAgentTool.mcp()).isEmpty + assertThat(persistedAgentTool.webSearch()).isEmpty + assertThat(persistedAgentTool.computerUse()).isEmpty + assertThat(persistedAgentTool.automations()) + .contains(JsonValue.from(mapOf("type" to "automations"))) + } + + @Test + fun ofAutomationsRoundtrip() { + val jsonMapper = jsonMapper() + val persistedAgentTool = PersistedAgentTool.ofAutomations() + + val roundtrippedPersistedAgentTool = + jsonMapper.readValue( + jsonMapper.writeValueAsString(persistedAgentTool), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPersistedAgentTool).isEqualTo(persistedAgentTool) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseContentTest.kt index d2349b41f..fb393790d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseContentTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class BetaResponseContentTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -42,7 +45,9 @@ internal class BetaResponseContentTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -64,7 +69,9 @@ internal class BetaResponseContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImage.PromptCacheBreakpoint.builder().build() + BetaResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -88,7 +95,9 @@ internal class BetaResponseContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImage.PromptCacheBreakpoint.builder().build() + BetaResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -112,7 +121,9 @@ internal class BetaResponseContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFile.PromptCacheBreakpoint.builder().build() + BetaResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -138,7 +149,9 @@ internal class BetaResponseContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFile.PromptCacheBreakpoint.builder().build() + BetaResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionCallOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionCallOutputItemTest.kt index 1842ff30f..7ae2da77e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionCallOutputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionCallOutputItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class BetaResponseFunctionCallOutputItemTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -40,7 +43,9 @@ internal class BetaResponseFunctionCallOutputItemTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -63,7 +68,9 @@ internal class BetaResponseFunctionCallOutputItemTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImageContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -85,7 +92,9 @@ internal class BetaResponseFunctionCallOutputItemTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImageContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -110,7 +119,9 @@ internal class BetaResponseFunctionCallOutputItemTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFileContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -134,7 +145,9 @@ internal class BetaResponseFunctionCallOutputItemTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFileContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputContentTest.kt index d2f8013fb..c512c10ae 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputContentTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class BetaResponseInputContentTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -39,7 +42,9 @@ internal class BetaResponseInputContentTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -61,7 +66,9 @@ internal class BetaResponseInputContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImage.PromptCacheBreakpoint.builder().build() + BetaResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -82,7 +89,9 @@ internal class BetaResponseInputContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImage.PromptCacheBreakpoint.builder().build() + BetaResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -106,7 +115,9 @@ internal class BetaResponseInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFile.PromptCacheBreakpoint.builder().build() + BetaResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -129,7 +140,9 @@ internal class BetaResponseInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFile.PromptCacheBreakpoint.builder().build() + BetaResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContentTest.kt index db42f2b49..e910a9116 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -19,7 +20,9 @@ internal class BetaResponseInputFileContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFileContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -30,7 +33,11 @@ internal class BetaResponseInputFileContentTest { assertThat(betaResponseInputFileContent.fileUrl()).contains("https://example.com") assertThat(betaResponseInputFileContent.filename()).contains("filename") assertThat(betaResponseInputFileContent.promptCacheBreakpoint()) - .contains(BetaResponseInputFileContent.PromptCacheBreakpoint.builder().build()) + .contains( + BetaResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileTest.kt index d636f8e37..263794974 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -19,7 +20,9 @@ internal class BetaResponseInputFileTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFile.PromptCacheBreakpoint.builder().build() + BetaResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -29,7 +32,11 @@ internal class BetaResponseInputFileTest { assertThat(betaResponseInputFile.fileUrl()).contains("https://example.com") assertThat(betaResponseInputFile.filename()).contains("filename") assertThat(betaResponseInputFile.promptCacheBreakpoint()) - .contains(BetaResponseInputFile.PromptCacheBreakpoint.builder().build()) + .contains( + BetaResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContentTest.kt index 32fc6f30d..570d17680 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,7 +18,9 @@ internal class BetaResponseInputImageContentTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImageContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -26,7 +29,11 @@ internal class BetaResponseInputImageContentTest { assertThat(betaResponseInputImageContent.fileId()).contains("file-123") assertThat(betaResponseInputImageContent.imageUrl()).contains("https://example.com") assertThat(betaResponseInputImageContent.promptCacheBreakpoint()) - .contains(BetaResponseInputImageContent.PromptCacheBreakpoint.builder().build()) + .contains( + BetaResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageTest.kt index 048a54d26..355bb462b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,7 +18,9 @@ internal class BetaResponseInputImageTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImage.PromptCacheBreakpoint.builder().build() + BetaResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -25,7 +28,11 @@ internal class BetaResponseInputImageTest { assertThat(betaResponseInputImage.fileId()).contains("file_id") assertThat(betaResponseInputImage.imageUrl()).contains("https://example.com") assertThat(betaResponseInputImage.promptCacheBreakpoint()) - .contains(BetaResponseInputImage.PromptCacheBreakpoint.builder().build()) + .contains( + BetaResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt index ec6f2df2b..fae4bc144 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -95,7 +96,9 @@ internal class BetaResponseInputItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -157,7 +160,9 @@ internal class BetaResponseInputItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -920,7 +925,9 @@ internal class BetaResponseInputItemTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -984,7 +991,9 @@ internal class BetaResponseInputItemTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItemTest.kt index d816e9026..8565057ba 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItemTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,7 +19,9 @@ internal class BetaResponseInputMessageItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -34,7 +37,9 @@ internal class BetaResponseInputMessageItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContentTest.kt index ce78e2850..6a35b7a62 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,13 +16,19 @@ internal class BetaResponseInputTextContentTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() assertThat(betaResponseInputTextContent.text()).isEqualTo("text") assertThat(betaResponseInputTextContent.promptCacheBreakpoint()) - .contains(BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build()) + .contains( + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextTest.kt index ca356fc56..a1b5b5a64 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,13 +16,19 @@ internal class BetaResponseInputTextTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() assertThat(betaResponseInputText.text()).isEqualTo("text") assertThat(betaResponseInputText.promptCacheBreakpoint()) - .contains(BetaResponseInputText.PromptCacheBreakpoint.builder().build()) + .contains( + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt index 204c7d52b..7e64a1e75 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -23,7 +24,9 @@ internal class BetaResponseItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -82,7 +85,9 @@ internal class BetaResponseItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -827,7 +832,9 @@ internal class BetaResponseItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -886,7 +893,9 @@ internal class BetaResponseItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseOutputItemTest.kt index 6a0ee044f..336024541 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseOutputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseOutputItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -408,7 +409,9 @@ internal class BetaResponseOutputItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -467,7 +470,9 @@ internal class BetaResponseOutputItemTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputContentTest.kt index 9cf2312d0..8591aec21 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputContentTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class BetaResponseSteerInputContentTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -39,7 +42,9 @@ internal class BetaResponseSteerInputContentTest { BetaResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputTextContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -62,7 +67,9 @@ internal class BetaResponseSteerInputContentTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImageContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -83,7 +90,9 @@ internal class BetaResponseSteerInputContentTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - BetaResponseInputImageContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -108,7 +117,9 @@ internal class BetaResponseSteerInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFileContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -131,7 +142,9 @@ internal class BetaResponseSteerInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - BetaResponseInputFileContent.PromptCacheBreakpoint.builder().build() + BetaResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputTest.kt index 4745243a0..4d4f8e54d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -52,6 +53,7 @@ internal class BetaResponseSteerInputTest { .promptCacheBreakpoint( BetaResponseInputTextContent.PromptCacheBreakpoint .builder() + .ttl(PromptCacheBreakpointTtl._30M) .build() ) .build() @@ -93,6 +95,7 @@ internal class BetaResponseSteerInputTest { .promptCacheBreakpoint( BetaResponseInputTextContent.PromptCacheBreakpoint .builder() + .ttl(PromptCacheBreakpointTtl._30M) .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/inputitems/BetaResponseItemListTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/inputitems/BetaResponseItemListTest.kt index 958a13757..753a14f36 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/inputitems/BetaResponseItemListTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/beta/responses/inputitems/BetaResponseItemListTest.kt @@ -4,6 +4,7 @@ package com.openai.models.beta.responses.inputitems import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.beta.responses.BetaResponseInputMessageItem import com.openai.models.beta.responses.BetaResponseInputText import com.openai.models.beta.responses.BetaResponseItem @@ -23,7 +24,9 @@ internal class BetaResponseItemListTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -50,7 +53,9 @@ internal class BetaResponseItemListTest { BetaResponseInputText.builder() .text("text") .promptCacheBreakpoint( - BetaResponseInputText.PromptCacheBreakpoint.builder().build() + BetaResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImageTest.kt index 06f420127..7726f40a6 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImageTest.kt @@ -4,6 +4,7 @@ package com.openai.models.chat.completions import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,7 +21,9 @@ internal class ChatCompletionContentPartImageTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPartImage.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -32,7 +35,11 @@ internal class ChatCompletionContentPartImageTest { .build() ) assertThat(chatCompletionContentPartImage.promptCacheBreakpoint()) - .contains(ChatCompletionContentPartImage.PromptCacheBreakpoint.builder().build()) + .contains( + ChatCompletionContentPartImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudioTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudioTest.kt index ab1fe4a49..671d2ae41 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudioTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudioTest.kt @@ -4,6 +4,7 @@ package com.openai.models.chat.completions import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,7 +21,9 @@ internal class ChatCompletionContentPartInputAudioTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -32,7 +35,11 @@ internal class ChatCompletionContentPartInputAudioTest { .build() ) assertThat(chatCompletionContentPartInputAudio.promptCacheBreakpoint()) - .contains(ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder().build()) + .contains( + ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTest.kt index fdcf08c3e..d4fc330cb 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class ChatCompletionContentPartTest { ChatCompletionContentPartText.builder() .text("text") .promptCacheBreakpoint( - ChatCompletionContentPartText.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -40,7 +43,9 @@ internal class ChatCompletionContentPartTest { ChatCompletionContentPartText.builder() .text("text") .promptCacheBreakpoint( - ChatCompletionContentPartText.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -65,7 +70,9 @@ internal class ChatCompletionContentPartTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPartImage.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -90,7 +97,9 @@ internal class ChatCompletionContentPartTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPartImage.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -115,7 +124,9 @@ internal class ChatCompletionContentPartTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -140,7 +151,9 @@ internal class ChatCompletionContentPartTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartInputAudio.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -166,7 +179,9 @@ internal class ChatCompletionContentPartTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPart.File.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPart.File.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -192,7 +207,9 @@ internal class ChatCompletionContentPartTest { .build() ) .promptCacheBreakpoint( - ChatCompletionContentPart.File.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPart.File.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTextTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTextTest.kt index 414ac869f..fb3cde39f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTextTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTextTest.kt @@ -4,6 +4,7 @@ package com.openai.models.chat.completions import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,13 +16,19 @@ internal class ChatCompletionContentPartTextTest { ChatCompletionContentPartText.builder() .text("text") .promptCacheBreakpoint( - ChatCompletionContentPartText.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() assertThat(chatCompletionContentPartText.text()).isEqualTo("text") assertThat(chatCompletionContentPartText.promptCacheBreakpoint()) - .contains(ChatCompletionContentPartText.PromptCacheBreakpoint.builder().build()) + .contains( + ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessageTest.kt index 3b766375d..0deedfa28 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessageTest.kt @@ -4,6 +4,7 @@ package com.openai.models.chat.completions import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -58,7 +59,9 @@ internal class ChatCompletionStoreMessageTest { ChatCompletionContentPartText.builder() .text("text") .promptCacheBreakpoint( - ChatCompletionContentPartText.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -116,7 +119,9 @@ internal class ChatCompletionStoreMessageTest { ChatCompletionContentPartText.builder() .text("text") .promptCacheBreakpoint( - ChatCompletionContentPartText.PromptCacheBreakpoint.builder().build() + ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponseTest.kt index 6e91b0e1d..c393d47ce 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponseTest.kt @@ -4,6 +4,7 @@ package com.openai.models.chat.completions.messages import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.chat.completions.ChatCompletionAudio import com.openai.models.chat.completions.ChatCompletionContentPartText import com.openai.models.chat.completions.ChatCompletionMessage @@ -65,6 +66,7 @@ internal class MessageListPageResponseTest { .text("text") .promptCacheBreakpoint( ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) .build() ) .build() @@ -124,6 +126,7 @@ internal class MessageListPageResponseTest { .text("text") .promptCacheBreakpoint( ChatCompletionContentPartText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt index ef7d2eef1..902e8d461 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.conversations import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,7 +18,9 @@ internal class ComputerScreenshotContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - ComputerScreenshotContent.PromptCacheBreakpoint.builder().build() + ComputerScreenshotContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -26,7 +29,11 @@ internal class ComputerScreenshotContentTest { assertThat(computerScreenshotContent.fileId()).contains("file_id") assertThat(computerScreenshotContent.imageUrl()).contains("https://example.com") assertThat(computerScreenshotContent.promptCacheBreakpoint()) - .contains(ComputerScreenshotContent.PromptCacheBreakpoint.builder().build()) + .contains( + ComputerScreenshotContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/MessageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/MessageTest.kt index dfff93a40..22e99f62f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/MessageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/MessageTest.kt @@ -4,6 +4,7 @@ package com.openai.models.conversations import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.responses.ResponseInputText import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -19,7 +20,9 @@ internal class MessageTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -35,7 +38,9 @@ internal class MessageTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemListTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemListTest.kt index e3bd50710..fa8a73295 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemListTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemListTest.kt @@ -4,6 +4,7 @@ package com.openai.models.conversations.items import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.conversations.Message import com.openai.models.responses.ResponseInputText import org.assertj.core.api.Assertions.assertThat @@ -22,7 +23,9 @@ internal class ConversationItemListTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -45,7 +48,9 @@ internal class ConversationItemListTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt index a83e95222..69d142b66 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.ReasoningEffort import com.openai.models.conversations.Message import com.openai.models.responses.ComputerAction @@ -50,7 +51,9 @@ internal class ConversationItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -103,7 +106,9 @@ internal class ConversationItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/graders/gradermodels/EvalContentItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/graders/gradermodels/EvalContentItemTest.kt index 4a14e2982..73018c25c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/graders/gradermodels/EvalContentItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/graders/gradermodels/EvalContentItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.responses.ResponseInputAudio import com.openai.models.responses.ResponseInputText import org.assertj.core.api.Assertions.assertThat @@ -48,7 +49,11 @@ internal class EvalContentItemTest { val responseInputText = ResponseInputText.builder() .text("text") - .promptCacheBreakpoint(ResponseInputText.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val evalContentItem = EvalContentItem.ofResponseInputText(responseInputText) @@ -68,7 +73,9 @@ internal class EvalContentItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/ClientDelegationTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/ClientDelegationTest.kt index a428c0ba1..968c067e7 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/ClientDelegationTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/ClientDelegationTest.kt @@ -11,7 +11,9 @@ internal class ClientDelegationTest { @Test fun createAndRoundtrip() { - val clientDelegation = ClientDelegation.builder().build() + val clientDelegation = ClientDelegation.builder().acknowledgementDelayMs(0L).build() + + assertThat(clientDelegation.acknowledgementDelayMs()).contains(0L) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/ClientEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/ClientEventTest.kt index da2b261a6..f470332ae 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/ClientEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/ClientEventTest.kt @@ -42,7 +42,7 @@ internal class ClientEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -128,7 +128,9 @@ internal class ClientEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .addInput( InitialItem.Developer.builder() .addContent( @@ -187,6 +189,7 @@ internal class ClientEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( @@ -292,6 +295,7 @@ internal class ClientEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionConfigTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionConfigTest.kt index 3e62eeefa..c4e528fb6 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionConfigTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionConfigTest.kt @@ -31,6 +31,7 @@ internal class ForkSessionConfigTest { ) .delegation( ForkSessionConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -99,6 +100,7 @@ internal class ForkSessionConfigTest { assertThat(forkSessionConfig.delegation()) .contains( ForkSessionConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionStartEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionStartEventTest.kt index 92237d76a..c7ca290b4 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionStartEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionStartEventTest.kt @@ -33,6 +33,7 @@ internal class ForkSessionStartEventTest { ) .delegation( ForkSessionConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -113,6 +114,7 @@ internal class ForkSessionStartEventTest { ) .delegation( ForkSessionConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/LiveCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/LiveCreateParamsTest.kt index d5afa696c..8d8126afb 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/LiveCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/LiveCreateParamsTest.kt @@ -32,7 +32,7 @@ internal class LiveCreateParamsTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -95,7 +95,7 @@ internal class LiveCreateParamsTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -156,7 +156,7 @@ internal class LiveCreateParamsTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionConfigTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionConfigTest.kt index 90ce9848b..328ab876d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionConfigTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionConfigTest.kt @@ -34,7 +34,7 @@ internal class MediaSessionConfigTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -88,7 +88,11 @@ internal class MediaSessionConfigTest { .build() ) assertThat(mediaSessionConfig.delegation()) - .contains(MediaSessionConfig.Delegation.ofClient(ClientDelegation.builder().build())) + .contains( + MediaSessionConfig.Delegation.ofClient( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) + ) assertThat(mediaSessionConfig.input().getOrNull()) .containsExactly( InitialItem.ofDeveloper( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionForkConfigTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionForkConfigTest.kt index 7321a4159..3181ccb35 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionForkConfigTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionForkConfigTest.kt @@ -26,6 +26,7 @@ internal class MediaSessionForkConfigTest { ) .delegation( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -88,6 +89,7 @@ internal class MediaSessionForkConfigTest { assertThat(mediaSessionForkConfig.delegation()) .contains( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/ServerEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/ServerEventTest.kt index 1b6be28b7..e1d1356b9 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/ServerEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/ServerEventTest.kt @@ -45,7 +45,7 @@ internal class ServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -134,7 +134,9 @@ internal class ServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -203,32 +205,43 @@ internal class ServerEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort.NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -319,32 +332,45 @@ internal class ServerEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort + .NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice + .LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -1589,7 +1615,7 @@ internal class ServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -1680,7 +1706,9 @@ internal class ServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionClosedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionClosedEventTest.kt index 636aeff18..2d33e81e2 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionClosedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionClosedEventTest.kt @@ -40,7 +40,7 @@ internal class SessionClosedEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -95,7 +95,7 @@ internal class SessionClosedEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionConfigTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionConfigTest.kt index 4d734ca1a..85ad75fdb 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionConfigTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionConfigTest.kt @@ -33,7 +33,7 @@ internal class SessionConfigTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -86,7 +86,11 @@ internal class SessionConfigTest { .build() ) assertThat(sessionConfig.delegation()) - .contains(SessionConfig.Delegation.ofClient(ClientDelegation.builder().build())) + .contains( + SessionConfig.Delegation.ofClient( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) + ) assertThat(sessionConfig.input().getOrNull()) .containsExactly( InitialItem.ofDeveloper( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionResourceTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionResourceTest.kt index c89f5369f..990b70d9c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionResourceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionResourceTest.kt @@ -35,7 +35,7 @@ internal class SessionResourceTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -92,7 +92,11 @@ internal class SessionResourceTest { .build() ) assertThat(sessionResource.delegation()) - .contains(SessionResource.Delegation.ofClient(ClientDelegation.builder().build())) + .contains( + SessionResource.Delegation.ofClient( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) + ) assertThat(sessionResource.input().getOrNull()) .containsExactly( InitialItem.ofDeveloper( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartEventTest.kt index 7f5f10a1b..5dae318ca 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartEventTest.kt @@ -36,7 +36,7 @@ internal class SessionStartEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -98,7 +98,7 @@ internal class SessionStartEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartedEventTest.kt index 9e9e79424..1b9575bf3 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartedEventTest.kt @@ -39,7 +39,7 @@ internal class SessionStartedEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -92,7 +92,7 @@ internal class SessionStartedEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateConfigTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateConfigTest.kt index 5f588e1ec..ca497c96b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateConfigTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateConfigTest.kt @@ -14,7 +14,7 @@ internal class SessionUpdateConfigTest { fun createAndRoundtrip() { val sessionUpdateConfig = SessionUpdateConfig.builder() - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addTrigger( DecisionTrigger.builder() .decisions( @@ -33,7 +33,11 @@ internal class SessionUpdateConfigTest { .build() assertThat(sessionUpdateConfig.delegation()) - .contains(SessionUpdateConfig.Delegation.ofClient(ClientDelegation.builder().build())) + .contains( + SessionUpdateConfig.Delegation.ofClient( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) + ) assertThat(sessionUpdateConfig.triggers().getOrNull()) .containsExactly( DecisionTrigger.builder() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateEventTest.kt index aac9283d3..4c81daee8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateEventTest.kt @@ -18,6 +18,7 @@ internal class SessionUpdateEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( @@ -99,6 +100,7 @@ internal class SessionUpdateEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdatedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdatedEventTest.kt index eaa4edc7c..3610f70dc 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdatedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdatedEventTest.kt @@ -39,32 +39,43 @@ internal class SessionUpdatedEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort.NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -119,30 +130,37 @@ internal class SessionUpdatedEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary(ResponsesDelegationConfig.Reasoning.Summary.CONCISE) - .build() - ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." + ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) + .summary( + ResponsesDelegationConfig.Reasoning.Summary.CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO + ) + .tools(listOf()) .build() ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkClientEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkClientEventTest.kt index 2dcfabcda..194e5f4d5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkClientEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkClientEventTest.kt @@ -61,6 +61,7 @@ internal class ForkClientEventTest { ) .delegation( ForkSessionConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -165,6 +166,7 @@ internal class ForkClientEventTest { ) .delegation( ForkSessionConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -245,6 +247,7 @@ internal class ForkClientEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( @@ -350,6 +353,7 @@ internal class ForkClientEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkServerEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkServerEventTest.kt index 824f12c81..73d7db09c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkServerEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkServerEventTest.kt @@ -76,7 +76,7 @@ internal class ForkServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -165,7 +165,9 @@ internal class ForkServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -234,32 +236,43 @@ internal class ForkServerEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort.NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -350,32 +363,45 @@ internal class ForkServerEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort + .NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice + .LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -1625,7 +1651,7 @@ internal class ForkServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -1716,7 +1742,9 @@ internal class ForkServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionAcceptParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionAcceptParamsTest.kt index 88ee17985..6091bb79a 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionAcceptParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionAcceptParamsTest.kt @@ -27,7 +27,7 @@ internal class SessionAcceptParamsTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -97,7 +97,7 @@ internal class SessionAcceptParamsTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -147,7 +147,7 @@ internal class SessionAcceptParamsTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionForkParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionForkParamsTest.kt index 5fdc03886..6b998b828 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionForkParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionForkParamsTest.kt @@ -32,6 +32,7 @@ internal class SessionForkParamsTest { ) .delegation( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -121,6 +122,7 @@ internal class SessionForkParamsTest { ) .delegation( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") @@ -199,6 +201,7 @@ internal class SessionForkParamsTest { ) .delegation( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandClientEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandClientEventTest.kt index d055edf91..93723cf51 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandClientEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandClientEventTest.kt @@ -40,6 +40,7 @@ internal class SidebandClientEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( @@ -143,6 +144,7 @@ internal class SidebandClientEventTest { SessionUpdateConfig.builder() .delegation( SessionUpdateConfig.Delegation.Responses.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandServerEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandServerEventTest.kt index 8fe9414bb..6ba180961 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandServerEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandServerEventTest.kt @@ -76,7 +76,7 @@ internal class SidebandServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -165,7 +165,9 @@ internal class SidebandServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -234,32 +236,43 @@ internal class SidebandServerEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort.NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -350,32 +363,45 @@ internal class SidebandServerEventTest { ) .build() ) - .responsesDelegation( - ResponsesDelegationConfig.builder() - .model("gpt-6-astra") - .instructions( - "Check restaurant availability. Ask before confirming a booking." - ) - .maxOutputTokens(1024L) - .parallelToolCalls(true) - .reasoning( - ResponsesDelegationConfig.Reasoning.builder() - .effort(ResponsesDelegationConfig.Reasoning.Effort.NONE) - .summary( - ResponsesDelegationConfig.Reasoning.Summary.CONCISE + .delegation( + SessionResource.Delegation.Responses.builder() + .responses( + ResponsesDelegationConfig.builder() + .model("gpt-6-astra") + .instructions( + "Check restaurant availability. Ask before confirming a booking." ) + .maxOutputTokens(1024L) + .parallelToolCalls(true) + .reasoning( + ResponsesDelegationConfig.Reasoning.builder() + .effort( + ResponsesDelegationConfig.Reasoning.Effort + .NONE + ) + .summary( + ResponsesDelegationConfig.Reasoning.Summary + .CONCISE + ) + .build() + ) + .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) + .text( + ResponsesDelegationConfig.Text.builder() + .verbosity( + ResponsesDelegationConfig.Text.Verbosity.LOW + ) + .build() + ) + .toolChoice( + ResponsesDelegationConfig.ToolChoice + .LiveToolChoiceEnum + .AUTO + ) + .tools(listOf()) .build() ) - .serviceTier(ResponsesDelegationConfig.ServiceTier.AUTO) - .text( - ResponsesDelegationConfig.Text.builder() - .verbosity(ResponsesDelegationConfig.Text.Verbosity.LOW) - .build() - ) - .toolChoice( - ResponsesDelegationConfig.ToolChoice.LiveToolChoiceEnum.AUTO - ) - .tools(listOf()) + .acknowledgementDelayMs(0L) .build() ) .input(listOf()) @@ -1519,7 +1545,7 @@ internal class SidebandServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." @@ -1610,7 +1636,9 @@ internal class SidebandServerEventTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .input(listOf()) .instructions( "Help the caller plan a restaurant reservation. Confirm details before booking." diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt index f63b61278..88ef7dee1 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -19,7 +20,11 @@ internal class ResponseContentTest { val inputText = ResponseInputText.builder() .text("text") - .promptCacheBreakpoint(ResponseInputText.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val responseContent = ResponseContent.ofInputText(inputText) @@ -40,7 +45,9 @@ internal class ResponseContentTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -61,7 +68,11 @@ internal class ResponseContentTest { .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") .imageUrl("https://example.com") - .promptCacheBreakpoint(ResponseInputImage.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val responseContent = ResponseContent.ofInputImage(inputImage) @@ -84,7 +95,9 @@ internal class ResponseContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImage.PromptCacheBreakpoint.builder().build() + ResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -107,7 +120,11 @@ internal class ResponseContentTest { .fileId("file_id") .fileUrl("https://example.com") .filename("filename") - .promptCacheBreakpoint(ResponseInputFile.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val responseContent = ResponseContent.ofInputFile(inputFile) @@ -132,7 +149,9 @@ internal class ResponseContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFile.PromptCacheBreakpoint.builder().build() + ResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt index 46d18da3c..f5d5c88a5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class ResponseFunctionCallOutputItemTest { ResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - ResponseInputTextContent.PromptCacheBreakpoint.builder().build() + ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -39,7 +42,9 @@ internal class ResponseFunctionCallOutputItemTest { ResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - ResponseInputTextContent.PromptCacheBreakpoint.builder().build() + ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -62,7 +67,9 @@ internal class ResponseFunctionCallOutputItemTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImageContent.PromptCacheBreakpoint.builder().build() + ResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -83,7 +90,9 @@ internal class ResponseFunctionCallOutputItemTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImageContent.PromptCacheBreakpoint.builder().build() + ResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -108,7 +117,9 @@ internal class ResponseFunctionCallOutputItemTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFileContent.PromptCacheBreakpoint.builder().build() + ResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -131,7 +142,9 @@ internal class ResponseFunctionCallOutputItemTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFileContent.PromptCacheBreakpoint.builder().build() + ResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt index 664af4ca5..ef4cfaa70 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -19,7 +20,11 @@ internal class ResponseInputContentTest { val inputText = ResponseInputText.builder() .text("text") - .promptCacheBreakpoint(ResponseInputText.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val responseInputContent = ResponseInputContent.ofInputText(inputText) @@ -37,7 +42,9 @@ internal class ResponseInputContentTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -58,7 +65,11 @@ internal class ResponseInputContentTest { .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") .imageUrl("https://example.com") - .promptCacheBreakpoint(ResponseInputImage.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val responseInputContent = ResponseInputContent.ofInputImage(inputImage) @@ -78,7 +89,9 @@ internal class ResponseInputContentTest { .fileId("file_id") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImage.PromptCacheBreakpoint.builder().build() + ResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -101,7 +114,11 @@ internal class ResponseInputContentTest { .fileId("file_id") .fileUrl("https://example.com") .filename("filename") - .promptCacheBreakpoint(ResponseInputFile.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() val responseInputContent = ResponseInputContent.ofInputFile(inputFile) @@ -123,7 +140,9 @@ internal class ResponseInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFile.PromptCacheBreakpoint.builder().build() + ResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt index 570c2cfce..50ac6b1f8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -19,7 +20,9 @@ internal class ResponseInputFileContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFileContent.PromptCacheBreakpoint.builder().build() + ResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -29,7 +32,11 @@ internal class ResponseInputFileContentTest { assertThat(responseInputFileContent.fileUrl()).contains("https://example.com") assertThat(responseInputFileContent.filename()).contains("filename") assertThat(responseInputFileContent.promptCacheBreakpoint()) - .contains(ResponseInputFileContent.PromptCacheBreakpoint.builder().build()) + .contains( + ResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt index 58e2f1b20..17958acca 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,7 +19,11 @@ internal class ResponseInputFileTest { .fileId("file_id") .fileUrl("https://example.com") .filename("filename") - .promptCacheBreakpoint(ResponseInputFile.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() assertThat(responseInputFile.detail()).contains(ResponseInputFile.Detail.AUTO) @@ -27,7 +32,11 @@ internal class ResponseInputFileTest { assertThat(responseInputFile.fileUrl()).contains("https://example.com") assertThat(responseInputFile.filename()).contains("filename") assertThat(responseInputFile.promptCacheBreakpoint()) - .contains(ResponseInputFile.PromptCacheBreakpoint.builder().build()) + .contains( + ResponseInputFile.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt index c4798e78a..50d543813 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,7 +18,9 @@ internal class ResponseInputImageContentTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImageContent.PromptCacheBreakpoint.builder().build() + ResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -26,7 +29,11 @@ internal class ResponseInputImageContentTest { assertThat(responseInputImageContent.fileId()).contains("file-123") assertThat(responseInputImageContent.imageUrl()).contains("https://example.com") assertThat(responseInputImageContent.promptCacheBreakpoint()) - .contains(ResponseInputImageContent.PromptCacheBreakpoint.builder().build()) + .contains( + ResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt index df21c84b2..1a7709ee0 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -16,14 +17,22 @@ internal class ResponseInputImageTest { .detail(ResponseInputImage.Detail.LOW) .fileId("file_id") .imageUrl("https://example.com") - .promptCacheBreakpoint(ResponseInputImage.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() assertThat(responseInputImage.detail()).isEqualTo(ResponseInputImage.Detail.LOW) assertThat(responseInputImage.fileId()).contains("file_id") assertThat(responseInputImage.imageUrl()).contains("https://example.com") assertThat(responseInputImage.promptCacheBreakpoint()) - .contains(ResponseInputImage.PromptCacheBreakpoint.builder().build()) + .contains( + ResponseInputImage.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt index 4d515b794..cf2939b75 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.ReasoningEffort import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -92,7 +93,9 @@ internal class ResponseInputItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -148,7 +151,9 @@ internal class ResponseInputItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputMessageItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputMessageItemTest.kt index e1ddf74b6..6804ef10b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputMessageItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputMessageItemTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -18,7 +19,9 @@ internal class ResponseInputMessageItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -33,7 +36,9 @@ internal class ResponseInputMessageItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextContentTest.kt index 5ac85cd9c..bfc7c4ba0 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextContentTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,13 +16,19 @@ internal class ResponseInputTextContentTest { ResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - ResponseInputTextContent.PromptCacheBreakpoint.builder().build() + ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() assertThat(responseInputTextContent.text()).isEqualTo("text") assertThat(responseInputTextContent.promptCacheBreakpoint()) - .contains(ResponseInputTextContent.PromptCacheBreakpoint.builder().build()) + .contains( + ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextTest.kt index 6265f5382..fc173d456 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,12 +15,20 @@ internal class ResponseInputTextTest { val responseInputText = ResponseInputText.builder() .text("text") - .promptCacheBreakpoint(ResponseInputText.PromptCacheBreakpoint.builder().build()) + .promptCacheBreakpoint( + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) .build() assertThat(responseInputText.text()).isEqualTo("text") assertThat(responseInputText.promptCacheBreakpoint()) - .contains(ResponseInputText.PromptCacheBreakpoint.builder().build()) + .contains( + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() + ) val jsonMapper = jsonMapper() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt index 20c2f6cb2..a473f2c10 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.ReasoningEffort import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -24,7 +25,9 @@ internal class ResponseItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -77,7 +80,9 @@ internal class ResponseItemTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputContentTest.kt index d011bd7fd..6b620be11 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputContentTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -20,7 +21,9 @@ internal class ResponseSteerInputContentTest { ResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - ResponseInputTextContent.PromptCacheBreakpoint.builder().build() + ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -39,7 +42,9 @@ internal class ResponseSteerInputContentTest { ResponseInputTextContent.builder() .text("text") .promptCacheBreakpoint( - ResponseInputTextContent.PromptCacheBreakpoint.builder().build() + ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -61,7 +66,9 @@ internal class ResponseSteerInputContentTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImageContent.PromptCacheBreakpoint.builder().build() + ResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -82,7 +89,9 @@ internal class ResponseSteerInputContentTest { .fileId("file-123") .imageUrl("https://example.com") .promptCacheBreakpoint( - ResponseInputImageContent.PromptCacheBreakpoint.builder().build() + ResponseInputImageContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -106,7 +115,9 @@ internal class ResponseSteerInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFileContent.PromptCacheBreakpoint.builder().build() + ResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() @@ -129,7 +140,9 @@ internal class ResponseSteerInputContentTest { .fileUrl("https://example.com") .filename("filename") .promptCacheBreakpoint( - ResponseInputFileContent.PromptCacheBreakpoint.builder().build() + ResponseInputFileContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputTest.kt index c935eda79..ff5a2a4ef 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputTest.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.JsonValue import com.openai.core.jsonMapper import com.openai.errors.OpenAIInvalidDataException +import com.openai.models.PromptCacheBreakpointTtl import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -51,6 +52,7 @@ internal class ResponseSteerInputTest { .text("text") .promptCacheBreakpoint( ResponseInputTextContent.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) .build() ) .build() @@ -85,6 +87,7 @@ internal class ResponseSteerInputTest { .promptCacheBreakpoint( ResponseInputTextContent.PromptCacheBreakpoint .builder() + .ttl(PromptCacheBreakpointTtl._30M) .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/inputitems/ResponseItemListTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/inputitems/ResponseItemListTest.kt index 834677c44..d4068cc8e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/inputitems/ResponseItemListTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/inputitems/ResponseItemListTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses.inputitems import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import com.openai.models.PromptCacheBreakpointTtl import com.openai.models.responses.ResponseInputMessageItem import com.openai.models.responses.ResponseInputText import com.openai.models.responses.ResponseItem @@ -23,7 +24,9 @@ internal class ResponseItemListTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) @@ -45,7 +48,9 @@ internal class ResponseItemListTest { ResponseInputText.builder() .text("text") .promptCacheBreakpoint( - ResponseInputText.PromptCacheBreakpoint.builder().build() + ResponseInputText.PromptCacheBreakpoint.builder() + .ttl(PromptCacheBreakpointTtl._30M) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/LiveServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/LiveServiceAsyncTest.kt index 5b1704797..fb4c4d1c2 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/LiveServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/LiveServiceAsyncTest.kt @@ -53,7 +53,9 @@ internal class LiveServiceAsyncTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .addInput( InitialItem.Developer.builder() .addContent( diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/live/SessionServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/live/SessionServiceAsyncTest.kt index 10300ae4e..52f4c3e08 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/live/SessionServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/live/SessionServiceAsyncTest.kt @@ -60,7 +60,9 @@ internal class SessionServiceAsyncTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .addInput( InitialItem.Developer.builder() .addContent( @@ -148,6 +150,7 @@ internal class SessionServiceAsyncTest { ) .delegation( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/LiveServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/LiveServiceTest.kt index 24911cea7..b29d56971 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/LiveServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/LiveServiceTest.kt @@ -53,7 +53,9 @@ internal class LiveServiceTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation( + ClientDelegation.builder().acknowledgementDelayMs(0L).build() + ) .addInput( InitialItem.Developer.builder() .addContent( diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/live/SessionServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/live/SessionServiceTest.kt index e13a267c5..62f136fc5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/live/SessionServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/live/SessionServiceTest.kt @@ -59,7 +59,7 @@ internal class SessionServiceTest { ) .build() ) - .delegation(ClientDelegation.builder().build()) + .delegation(ClientDelegation.builder().acknowledgementDelayMs(0L).build()) .addInput( InitialItem.Developer.builder() .addContent( @@ -141,6 +141,7 @@ internal class SessionServiceTest { ) .delegation( MediaSessionForkConfig.Delegation.builder() + .acknowledgementDelayMs(0L) .responses( ResponsesDelegationUpdateConfig.builder() .instructions("instructions") diff --git a/scripts/castiron/CUSTOM_CODE.md b/scripts/castiron/CUSTOM_CODE.md index 2b5fcc967..50b102fd2 100644 --- a/scripts/castiron/CUSTOM_CODE.md +++ b/scripts/castiron/CUSTOM_CODE.md @@ -284,3 +284,5 @@ handler as their replacement. A failed invalidation or rerun must be investigate missing reporter runs remain pending until the normal trusted run is requested. Install and validate the review signal on the protected target before activating next policy checks, including actual PR and queue revocation after dismissal. + +The trusted selector also checks this exact active-checker contract before granting a pin-only review exemption. Legacy or unrecognized contracts retain the required exact-head review in the selection receipt, so the final publisher revalidates it even without a review-change event. diff --git a/scripts/castiron/custom_code_policy.py b/scripts/castiron/custom_code_policy.py index 5631fc5bf..59314c434 100755 --- a/scripts/castiron/custom_code_policy.py +++ b/scripts/castiron/custom_code_policy.py @@ -135,6 +135,18 @@ def next_policy_sha(repo: Path, repository: str, base: str, authenticated_main: return cast(str, policy) +def supports_effective_pin_review(repo: Path, revision: str) -> bool: + """Read the effective checker's inert contract; never execute its source.""" + revision = report.require_sha(revision) + path = "scripts/castiron/custom_code_policy.py" + entry = report.git(repo, "ls-tree", revision, "--", path).split() + if len(entry) != 4 or entry[0] not in (b"100644", b"100755") or entry[1] != b"blob": + return False + source = report.git(repo, "show", f"{revision}:{path}") + declarations = re.findall(rb"^PIN_REVIEW_POLICY = .*$", source, re.MULTILINE) + return declarations == [b'PIN_REVIEW_POLICY = "effective-policy-v1"'] + + class HumanReviewRules(TypedDict): version: int associations: list[str] @@ -209,6 +221,61 @@ def require_human_policy_review(repository: str, head: str) -> int: return int(pull["number"]) +def requires_human_policy_review( + repo: Path, repository: str, base: str, head: str, authenticated_main: str +) -> bool: + """Decide review requirements from Git data using the selector's policy rules.""" + base_policy = read_policy(repo, base) + candidate_policy = read_policy(repo, head) + candidate_base_policy = read_policy(repo, merge_base(repo, base, head)) + budget_increased = ( + candidate_policy["max_custom_patch_lines"] > candidate_base_policy["max_custom_patch_lines"] + ) + ratchet_activated = ( + candidate_policy.get("ratchet") == "go" and candidate_base_policy.get("ratchet") != "go" + ) + pin_changed = candidate_policy.get("next_policy") != candidate_base_policy.get("next_policy") + if not pin_changed: + return budget_increased or ratchet_activated + policy = ( + next_policy_sha(repo, repository, base, authenticated_main) + if "next_policy" in base_policy + else authenticated_main + ) + candidate = head + proposed = read_policy(repo, next_policy_sha(repo, repository, candidate, authenticated_main)) + # Authored changes come from the merge base, but their safety must be + # measured against the active policy: the protected target's pin, or + # authenticated main during bootstrap. + previous = read_policy(repo, policy) + # Bootstrap executes authenticated main; initial adoption must not silently + # replace it with older checker code, even when policy fields match. + previous_checker = ( + base_policy["next_policy"]["main_sha"] + if "next_policy" in base_policy + else authenticated_main + ) + rolled_back = bool( + report.git( + repo, + "rev-list", + "--first-parent", + f"{candidate_policy['next_policy']['main_sha']}..{previous_checker}", + ).strip() + ) + # Compare effective policies, not the candidate's unchanged local ceiling. + # Schema/strictness or ratchet transitions also retain human authorization. + pin_requires_human = ( + not supports_effective_pin_review(repo, previous_checker) + or rolled_back + or proposed["max_custom_patch_lines"] > previous["max_custom_patch_lines"] + or proposed["schema_version"] != previous["schema_version"] + or proposed.get("generated_files") != previous.get("generated_files") + or proposed.get("ratchet") != previous.get("ratchet") + ) + return budget_increased or ratchet_activated or pin_requires_human + + def select_policy( repo: Path, repository: str, @@ -274,40 +341,7 @@ def select_policy( repo, base, candidate ) != {POLICY.encode()}: raise ValueError("each next policy activation or increase must be policy-only") - pin_requires_human = False - if pin_changed: - proposed = read_policy( - repo, next_policy_sha(repo, repository, candidate, authenticated_main) - ) - # Authored changes come from the merge base, but their safety must be - # measured against the active policy: the protected target's pin, or - # authenticated main during bootstrap. - previous = read_policy(repo, policy) - # Bootstrap executes authenticated main; initial adoption must not silently - # replace it with older checker code, even when policy fields match. - previous_checker = ( - base_policy["next_policy"]["main_sha"] - if "next_policy" in base_policy - else authenticated_main - ) - rolled_back = bool( - report.git( - repo, - "rev-list", - "--first-parent", - f"{candidate_policy['next_policy']['main_sha']}..{previous_checker}", - ).strip() - ) - # Compare effective policies, not the candidate's unchanged local ceiling. - # Schema/strictness or ratchet transitions also retain human authorization. - pin_requires_human = ( - rolled_back - or proposed["max_custom_patch_lines"] > previous["max_custom_patch_lines"] - or proposed["schema_version"] != previous["schema_version"] - or proposed.get("generated_files") != previous.get("generated_files") - or proposed.get("ratchet") != previous.get("ratchet") - ) - if budget_increased or ratchet_activated or pin_requires_human: + if requires_human_policy_review(repo, repository, base, candidate, authenticated_main): number = require_human_policy_review(repository, candidate) policy_reviews.append({"number": number, "head_sha": candidate}) return { @@ -496,6 +530,12 @@ def queued_entries(repository: str, branch: str) -> list[tuple[str, str]]: def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser(description=__doc__) commands = parser.add_subparsers(dest="command", required=True) + review = commands.add_parser("review-required") + review.add_argument("--repo", type=Path, required=True) + review.add_argument("--repository", required=True) + review.add_argument("--base", required=True) + review.add_argument("--head", required=True) + review.add_argument("--main", required=True) selection = commands.add_parser("select-policy") selection.add_argument("--repo", type=Path, required=True) selection.add_argument("--repository", required=True) @@ -508,6 +548,39 @@ def main(argv: list[str] | None = None) -> int: default=".github/workflows/castiron-custom-code.yml", ) args = parser.parse_args(argv) + if args.command == "review-required": + if not report.REPOSITORY.fullmatch(args.repository): + raise ValueError("invalid policy repository") + base, head, main = map(report.require_sha, (args.base, args.head, args.main)) + if args.repo.exists(): + raise ValueError("policy object directory must be fresh") + args.repo.mkdir() + report.git(args.repo, "init", "--quiet", "--bare") + report.git( + args.repo, "remote", "add", "origin", f"https://github.com/{args.repository}.git" + ) + report.git( + args.repo, + "fetch", + "--quiet", + "--no-tags", + "origin", + "+refs/heads/main:refs/remotes/origin/main", + base, + head, + ) + if report.git(args.repo, "rev-parse", "refs/remotes/origin/main").decode().strip() != main: + raise ValueError("authenticated main changed during review evaluation; retry") + print( + json.dumps( + { + "requires_human": requires_human_policy_review( + args.repo, args.repository, base, head, main + ) + } + ) + ) + return 0 selected = select_github_policy( args.repo, args.repository, diff --git a/scripts/castiron/custom_code_test_support.py b/scripts/castiron/custom_code_test_support.py index bd7f1885d..9db89fd56 100644 --- a/scripts/castiron/custom_code_test_support.py +++ b/scripts/castiron/custom_code_test_support.py @@ -9,7 +9,7 @@ import tempfile import unittest from pathlib import Path -from typing import Any +from typing import Any, cast import custom_code_report as report @@ -73,3 +73,30 @@ def source_run(head: str, event: str = "pull_request") -> dict[str, Any]: "pull_requests": [{"number": 3}] if event == "pull_request" else [], "conclusion": "failure", # The candidate's result is deliberately ignored. } + + +WORKFLOW = ( + Path(__file__).resolve().parents[2] / ".github/workflows/castiron-custom-code-comment.yml" +) + + +def run_publisher(step: str, payload: dict[str, Any]) -> list[dict[str, Any]]: + section = WORKFLOW.read_text().split(f"- name: {step}\n", 1)[1] + script = section.split(" script: |\n", 1)[1] + lines: list[str] = [] + for line in script.splitlines(): + if line and not line.startswith(" "): + break + lines.append(line[12:]) + return run_workflow_script("\n".join(lines), payload) + + +def run_workflow_script(script: str, payload: dict[str, Any]) -> list[dict[str, Any]]: + output = subprocess.run( + ["node", str(Path(__file__).with_name("fixtures") / "github_publisher.cjs")], + input=json.dumps({**payload, "script": script}), + text=True, + capture_output=True, + check=True, + ) + return cast(list[dict[str, Any]], json.loads(output.stdout)) diff --git a/scripts/castiron/fixtures/github_publisher.cjs b/scripts/castiron/fixtures/github_publisher.cjs index 69664de46..f572c33c2 100644 --- a/scripts/castiron/fixtures/github_publisher.cjs +++ b/scripts/castiron/fixtures/github_publisher.cjs @@ -53,30 +53,6 @@ const github = { merge_base_commit: { sha: basehead.split('...')[0] }, }, }), - getContent: async ({ path, ref }) => { - let source; - if (path === 'scripts/castiron/custom_code_policy.py') { - if (data.checker_lookup_error) - throw Object.assign(new Error('Checker lookup failed'), { - status: data.checker_lookup_error, - }); - source = data.checker_sources_by_sha?.[ref]; - if (typeof source !== 'string') throw Object.assign(new Error('Missing checker'), { status: 404 }); - } else if (path === '.castiron-ratchet.json' && data.policies_by_sha?.[ref]) { - source = JSON.stringify(data.policies_by_sha[ref]); - } else { - throw new Error('Unexpected policy lookup'); - } - const content = Buffer.from(source); - return { - data: { - type: 'file', - encoding: 'base64', - size: content.length, - content: content.toString('base64'), - }, - }; - }, createCommitStatus: async (value) => { writes.push(value); data.statuses_by_sha ||= {}; @@ -138,12 +114,34 @@ const github = { throw new Error(`Unexpected GitHub lookup: ${method}`); }, }; +const exec = { + getExecOutput: async (command, args) => { + if ( + command !== 'python3' || + args[0] !== '-I' || + args[1] !== 'scripts/castiron/custom_code_policy.py' || + args[2] !== 'review-required' || + args[3] !== '--repository' || + args[4] !== 'openai/example' || + args[5] !== '--repo' || + args[7] !== '--base' || + args[9] !== '--head' || + args[11] !== '--main' || + ![args[8], args[10], args[12]].every((value) => /^[0-9a-f]{40}$/.test(value)) + ) { + throw new Error('Unexpected trusted policy invocation'); + } + if (data.policy_error_sequence?.shift() || data.policy_error) throw new Error('Trusted policy evaluation failed'); + return { stdout: JSON.stringify({ requires_human: data.requires_human ?? true }) }; + }, +}; const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; -new AsyncFunction('github', 'context', 'process', 'require', data.script)( +new AsyncFunction('github', 'context', 'process', 'require', 'exec', data.script)( github, data.context, - { env: data.env || {} }, + { env: { RUNNER_TEMP: require('node:os').tmpdir(), ...(data.env || {}) } }, require, + exec, ) .then(() => process.stdout.write(JSON.stringify(writes))) .catch((error) => { diff --git a/scripts/castiron/generated-files.json b/scripts/castiron/generated-files.json index 2f15e39b7..474a9fe37 100644 --- a/scripts/castiron/generated-files.json +++ b/scripts/castiron/generated-files.json @@ -3,7 +3,7 @@ "files": { ".github/workflows/castiron-custom-code-comment.yml": { "mode": "100644", - "sha256": "87fdffd260f458095f3a0e13e1290a80d9ce484e516092b7fbf5f34fb3847fb3" + "sha256": "db521f2e39d1c39ad2edacedc9903954471308e660e6df5b4ba8ca7615e5a5a8" }, ".github/workflows/castiron-custom-code.yml": { "mode": "100644", @@ -89,6 +89,10 @@ "mode": "100644", "sha256": "612ef78a8907f769384b19e043c413ac399784ef16f3517d8087a4ead1199572" }, + "openai-java-core/src/main/kotlin/com/openai/models/PromptCacheBreakpointTtl.kt": { + "mode": "100644", + "sha256": "3379c286def7077493bc37ae05a0cbdf32b5e341c5ba6677c42514c4a716fe54" + }, "openai-java-core/src/main/kotlin/com/openai/models/Reasoning.kt": { "mode": "100644", "sha256": "e13876205a7ebdc91be036bc26cc83b540e9859344c09cc1003f4e0f11fe65b3" @@ -1487,7 +1491,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/Agent.kt": { "mode": "100644", - "sha256": "91eca14c6b5cffde296df98bf531468d6286fa5356cd2348c0bde3e320cda826" + "sha256": "9bcc3c838f76e3c654965feaff56345712fd3760392748839134f44864cd238f" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentBrowserAuthenticationCancelParam.kt": { "mode": "100644", @@ -1515,7 +1519,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentCreateParams.kt": { "mode": "100644", - "sha256": "60ac8923009f0499113f62ea3889aa0755e15daeb64d90038d2518e341c16d1b" + "sha256": "867615b833153e30bd9071f225c1bc4bb086bf57238c09ed8528b484ab1dc2f2" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentCreateSubagentCallItem.kt": { "mode": "100644", @@ -1607,7 +1611,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentSession.kt": { "mode": "100644", - "sha256": "30e1dfec79a7fcbdc0938848108901a05639dbd701ce00f286d1327e542c9087" + "sha256": "b8a03d0264e27a1b85ddf59b320c475049d93fa83991b8d7036970ebdd2872ce" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentSessionAssistantMessage.kt": { "mode": "100644", @@ -1783,15 +1787,15 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentTool.kt": { "mode": "100644", - "sha256": "8f926b7ac1f828646603dad38eda0bec36c3ef3a8143f5bfa68fb73590dbf67c" + "sha256": "92aef370a4c4fb86451efe7510b378773dedfb98933ddc7ffbbaf040179d3117" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentToolParam.kt": { "mode": "100644", - "sha256": "478058491439507a548adbd16a2051beb7cdb69a068c4d3ea2f814b2eb1623e7" + "sha256": "ab1f8ec048c3fc588feb23db5a9d37c148d3bc03e4855989eaa374096aeea71e" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentUpdateParams.kt": { "mode": "100644", - "sha256": "8b11e7eeae7c4db106e75e02e947adb0b6e68129a216574651e9bda794fa2060" + "sha256": "b8017ce84bdef5894b54eef0800be1fa7a97eb5e4130f2f55213be450c35d5f2" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/AgentWaitForSubagentsCallItem.kt": { "mode": "100644", @@ -1875,11 +1879,11 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentTool.kt": { "mode": "100644", - "sha256": "6de2c7e9d56ea21791a928d9475dbf21e3d09bde18a6fc79ed1a9faa3dd2b82f" + "sha256": "f5bc083071d177032082a2c6b9fa296a7d4f6a839d9ddbe4e73feed3b4700037" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedAgentToolParam.kt": { "mode": "100644", - "sha256": "2e1f0d40531ebca7a7f710a5e0c48487bfd8c34a18b5564d39d1f395df5cb6b4" + "sha256": "d2db5befc4218cb145e1586ecb425ea76532909e26e0990aa9a57174fd69901d" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/PersistedMcpTransport.kt": { "mode": "100644", @@ -2019,7 +2023,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/sessions/SessionCreateParams.kt": { "mode": "100644", - "sha256": "1c616a661c1def336e8ee9096224e2c0a59f24f7875611bb23b67185982051df" + "sha256": "67c29520b8e86618f10b616d9fb6a2855b484fa52e7aa406066b251ff450765b" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/agents/sessions/SessionDeleteParams.kt": { "mode": "100644", @@ -2907,19 +2911,19 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFile.kt": { "mode": "100644", - "sha256": "9977f142a236d78a0ef468c6158d6cc29510fa77b5a34afb1ed760f5d314a40c" + "sha256": "927ff42dd5977852ad24fe74aa66735357c038316c2edd4dde182288042e9184" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContent.kt": { "mode": "100644", - "sha256": "ad586fbc75248551b6a5df17925d814ee2983afd93849e548f6877b674ff44cd" + "sha256": "b9b1c9b2e4feed0c42b4e2c440eb24cc61ac4e8e1a722feb1f482438638005fd" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImage.kt": { "mode": "100644", - "sha256": "dd4183bdfd375fd76a022a21aaeed9bac712b720764f2025a5133017c0e54229" + "sha256": "e8d8b12d686604a56ab4e4927e0212cf6070f50cb9395e127737828005ebfd01" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContent.kt": { "mode": "100644", - "sha256": "24031662bf7f03ba4debe6f2df53da87d021bfc4446126db9cfb953d8996ced2" + "sha256": "70c1efb58a5cfbe82357a2c2773d3fe99f3fd86f91eed3ec4883b9d40c8ff839" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputItem.kt": { "mode": "100644", @@ -2931,15 +2935,15 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputText.kt": { "mode": "100644", - "sha256": "394c26ffbb12605f303c3f758efeb45506224b65d2cd089321491ed79b9ccf11" + "sha256": "1addcc0bb9c9d9ad3b0fca30cc97b15d8a1ae34aaff99a2151aa627fe432c249" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContent.kt": { "mode": "100644", - "sha256": "d34e66a7e0b7d195eaa893e56c09eda9d50a94747fa2ef74e56bbc34db7b7809" + "sha256": "0f28678e95ca083c8ef6a18eccc3e8a181092eba662f5522710bf382f0e90371" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseItem.kt": { "mode": "100644", - "sha256": "3c641a621b4c1782073a7abde2cd0ba970197b9480b3f3ed8467b50ecc05c052" + "sha256": "cae3edfa1e04e56389b107be412601fc2a3748465c5650a22cf0cdc720c25261" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseLocalEnvironment.kt": { "mode": "100644", @@ -2983,7 +2987,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseOutputItem.kt": { "mode": "100644", - "sha256": "a30c06bf621e5bc5ce20f8b9c08665c3fcadafb0f1dc4849de528d6294412349" + "sha256": "b4d43904cc4241cd7db4f624154302431a95ffb886c8c00b5dd591cf6a008646" }, "openai-java-core/src/main/kotlin/com/openai/models/beta/responses/BetaResponseOutputItemAddedEvent.kt": { "mode": "100644", @@ -3627,15 +3631,15 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPart.kt": { "mode": "100644", - "sha256": "453fb5596d353bceed9a27c0af45f6017781cedf14f35a610573bbc618f3d60a" + "sha256": "2348f153078ea3d8f91f8872acf7619927f7a7f86b625d921b57fa99b23468c0" }, "openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImage.kt": { "mode": "100644", - "sha256": "646902743a19b19843215b561ec1d10a6fcbbc7b5d1445b8610e606e22c60ef5" + "sha256": "1e9bde75cdde11a2f66960ef04d406cb9991063044409b490fc2b3482cded718" }, "openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudio.kt": { "mode": "100644", - "sha256": "8b636172410d4697957798b67c248b24883278b77ab85c219fe8dc682aa048c7" + "sha256": "4641fe2891e42158c2ee57babacf26d3ac68bff78f36df9e350de582238ad1a3" }, "openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartRefusal.kt": { "mode": "100644", @@ -3643,7 +3647,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartText.kt": { "mode": "100644", - "sha256": "8bb28e8139d1ed9d1dee78fcabd94444faf00068fab85191736a517531d61b87" + "sha256": "79d702a768a761f59573780fad95d6133886e1f8f5c8ff1196ba40b001c3c3d5" }, "openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt": { "mode": "100644", @@ -3899,7 +3903,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/conversations/ComputerScreenshotContent.kt": { "mode": "100644", - "sha256": "9c0509d755869e4a2dffbd0d1ff888e7229c34e70fe35c4a3ea99c00b5ec396a" + "sha256": "5450222d73ff889380d8a1077bff158208e8f5e4f9c8b1092e3be630cb71ad7c" }, "openai-java-core/src/main/kotlin/com/openai/models/conversations/Conversation.kt": { "mode": "100644", @@ -4499,7 +4503,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/live/ClientDelegation.kt": { "mode": "100644", - "sha256": "68c1702ad631335ffe7a1257cb2cdac5a34add5b2cb758ed7cc258535e435ea8" + "sha256": "420f3951dae1e2af2fedc1ab7f05d70ddc692aa1ae4188f6150ecea5ef257645" }, "openai-java-core/src/main/kotlin/com/openai/models/live/ClientEvent.kt": { "mode": "100644", @@ -4571,7 +4575,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/live/ForkSessionConfig.kt": { "mode": "100644", - "sha256": "fcccb600f825df5997c63685d499c9f1dc01fa8a4db0593fb73f21cd36a14dcb" + "sha256": "ee4e9b15a249400c0742ee5625fc6aa4247cb20c07ce7a2159a2da75ec6aef40" }, "openai-java-core/src/main/kotlin/com/openai/models/live/ForkSessionStartEvent.kt": { "mode": "100644", @@ -4635,11 +4639,11 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionConfig.kt": { "mode": "100644", - "sha256": "3392a7b8fa5d08f25cca51985ff2eb7cee2bee7d47c419ad1979a499940a8c93" + "sha256": "ab1e3cc143480d8fe90d6453f2af5e0a6703881194235ba9f914d44526244b0c" }, "openai-java-core/src/main/kotlin/com/openai/models/live/MediaSessionForkConfig.kt": { "mode": "100644", - "sha256": "a2000adeda78f85aaeec338ff1f2e2de958529171ec766f051ef0a825422228c" + "sha256": "7ce2869fb55fff959b372c1ec52e21cbd4149ac9f6330714369579992d5fb70e" }, "openai-java-core/src/main/kotlin/com/openai/models/live/OutputAudioDeltaEvent.kt": { "mode": "100644", @@ -4699,11 +4703,11 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/live/SessionConfig.kt": { "mode": "100644", - "sha256": "595f6e30d28e96ada4ca6402185ad64fad07e5f22d9ef54c7756892e0e30d8e9" + "sha256": "317f6a29bce8fe6c341f7aba92626639bc8635841a48b1a7aa85ef88bf7700bb" }, "openai-java-core/src/main/kotlin/com/openai/models/live/SessionResource.kt": { "mode": "100644", - "sha256": "770dcd17549995c6643a57cb2b283bf9af0643c3c2a9b7d944ce71f281124bf0" + "sha256": "632a96f7e25e54cecece4de0bc40d16a0ff763b14e88afb6e289781b15a6030b" }, "openai-java-core/src/main/kotlin/com/openai/models/live/SessionStartEvent.kt": { "mode": "100644", @@ -4715,7 +4719,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/live/SessionUpdateConfig.kt": { "mode": "100644", - "sha256": "96bb44edae4f4234b99675120fde318f74775132e081ea71876b098d0fc14e83" + "sha256": "73bdf706d88fc79590840c3e572a2e003f070023e897512dada567fc176758b3" }, "openai-java-core/src/main/kotlin/com/openai/models/live/SessionUpdateEvent.kt": { "mode": "100644", @@ -4755,7 +4759,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/live/sessions/SessionAcceptParams.kt": { "mode": "100644", - "sha256": "753d6006e129ad4d10f2ef6394f4731d4efd95f393c5863edab55748c0367ca6" + "sha256": "601a8b33c2a08629541a788e582baf67173b08bc8e663b73d5350360d6880f6e" }, "openai-java-core/src/main/kotlin/com/openai/models/live/sessions/SessionDownloadRecordingParams.kt": { "mode": "100644", @@ -4895,7 +4899,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionDeltaEvent.kt": { "mode": "100644", - "sha256": "8428ca1f30e3bff4d251f64ab15fd8f722a6f8515208a0ad02e4fdcfd98ff80f" + "sha256": "011a73d7ff2952ee5ae63b7f049bf2ba8dc251cd19ffb8493206c514bd75f870" }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemInputAudioTranscriptionFailedEvent.kt": { "mode": "100644", @@ -5035,7 +5039,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeErrorEvent.kt": { "mode": "100644", - "sha256": "4b967c77b7632b90f0035d698131adb114e6bd906ed03bdbc75440288f29d75b" + "sha256": "a76dd824564b9f3d2f20e3f69a8e7b162545e7d1b7e4db2cc0680b9a3ea73fc0" }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeFunctionTool.kt": { "mode": "100644", @@ -5111,7 +5115,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt": { "mode": "100644", - "sha256": "251d7b6b3af65b9b8e673b7d41d616002aeeec35257406b7d1df82ddd0845c92" + "sha256": "87daa3699f993158ec5d54bbfd04c5cd188e85ef15277cdd00f1a683ba98996a" }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeSession.kt": { "mode": "100644", @@ -5179,7 +5183,7 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranslationServerEvent.kt": { "mode": "100644", - "sha256": "c3e5939eb5c40605b1574294e693d69fda224eb7142d0ea4003f20c601877e12" + "sha256": "a5955182ec54160501ff3ffc5cca64cd8e6554070fcdc746dd2afe5532403b22" }, "openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeTranslationSession.kt": { "mode": "100644", @@ -5727,19 +5731,19 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFile.kt": { "mode": "100644", - "sha256": "d6ae6d52f08550cf0b2eb640819848ea93695ca700281fb1a2d341cf7cdd7661" + "sha256": "9ce4a742595fef0481b737e44ca81c70eceeecfc43b77cbcdf9ac18fbd81fab1" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputFileContent.kt": { "mode": "100644", - "sha256": "8e7af4f5d0e0fc891797c055dc8e7a38d6355265b7fbfd6bf3b86795f2476b93" + "sha256": "82d9dec4cfa83adb2c339507bd3afede94f008b268c086c3e9f726b3f72296f8" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImage.kt": { "mode": "100644", - "sha256": "e709b642e0e232d2cac6a4da1504b0840a11dcb8dc1a6954c71d5fbafa3b3b9e" + "sha256": "d57a560c7efb52f087ffce9d9815e473313e3eaacf5706c662b43ee0ee484752" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputImageContent.kt": { "mode": "100644", - "sha256": "4ecbcb9dcb24be71ecf11e658b19aae863553fd06069f1396c946afb8d06f0b5" + "sha256": "514999ec2d2eb2a865fc50fdc4eb7d218cf9e51f10dd6b181dedabe0aa5a5851" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt": { "mode": "100644", @@ -5751,11 +5755,11 @@ }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputText.kt": { "mode": "100644", - "sha256": "9b32a6bdb007f0ad1ed97481703fb0173a13fc886c234027c568b2885e8ed13d" + "sha256": "7fd57f6087d070fd1990b03147871aef4a5522d09474dba295637a4f34f1876e" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputTextContent.kt": { "mode": "100644", - "sha256": "623bae6e9f9613b830e8ec4343919e438ddadd8865430deb8de068ea1e3e4dde" + "sha256": "fec43fdd99845b8aa598256b4ca792805bbab70dab85af8858cdbde8e7a0bd66" }, "openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseItem.kt": { "mode": "100644", @@ -10119,11 +10123,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolParamTest.kt": { "mode": "100644", - "sha256": "2c46cc59a52acde7ade6af2e45a4f6dc4cf9706e8c8dad779c74e665171fc643" + "sha256": "1b59ae561829b3aba79a80beeb5973755b680bdbe83929ae1e91dde6f26cb233" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentToolTest.kt": { "mode": "100644", - "sha256": "c4a749f77f11c3dbda841975c77729d2771d0c5d1e6f51388bd3303786cd445e" + "sha256": "08a3f22c097d53878280b88fb03f8fe358bf478587c524065468a21584d1512e" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/agents/AgentUpdateParamsTest.kt": { "mode": "100644", @@ -10211,11 +10215,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolParamTest.kt": { "mode": "100644", - "sha256": "0a75f3749a754bdf848d668148866dd554343c508e4c7a6d4b9584ded33f391f" + "sha256": "f8c3d6fdd3dce1b71885b3ece2dc1482b3622d14541b0209c93fdee219e5dd87" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedAgentToolTest.kt": { "mode": "100644", - "sha256": "ad14f1f5f0bdc4b9f58847a3b8aac0284ed8fb05d87499af7aa6919c0e89c4b0" + "sha256": "74b098f29c217b3f00f71f8a0a6947e71828f9e5af4701b7f93e1676f4d6f14f" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/agents/PersistedMcpTransportParamTest.kt": { "mode": "100644", @@ -10927,7 +10931,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseContentTest.kt": { "mode": "100644", - "sha256": "164038834e65dcc136963c423cf2ca79a39a74d83ca6bdcc3a8af294d30e06a6" + "sha256": "d3f84a6f5beadc8819a0be1d3907f83ec3d3f6378513c810b786d5b7309efa13" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseConversationParamTest.kt": { "mode": "100644", @@ -11007,7 +11011,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionCallOutputItemTest.kt": { "mode": "100644", - "sha256": "08316c07d7e793281ab4696dab15136e50f4a4689e0849c7f843e37d6132f919" + "sha256": "14468fd4c708bf37f9524aaa560e3406b3dc350c40da75904a5a1cd6577c9782" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseFunctionShellCallOutputContentTest.kt": { "mode": "100644", @@ -11079,43 +11083,43 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputContentTest.kt": { "mode": "100644", - "sha256": "2478b6be7db90592bdec1dc64c2cc5f4c0ef1d40c8294539fdd0773b865e5b1d" + "sha256": "a859a32899c32ef4e89f3e247d4bd0883a36f559fd43d6f1ad96876a3532117f" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileContentTest.kt": { "mode": "100644", - "sha256": "592a3e0c55296abd2b889704137ee4aa9596d5c218a25be0c87dceef497d5695" + "sha256": "871b6fd25758aedbce5daf9e6007ff59ceac9d8e1aadfdd6640f52cf9e9c997b" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputFileTest.kt": { "mode": "100644", - "sha256": "a50f703dfe928e75eb8535d0cd2662615e7bedd24926ed8d7d268a1cd4ac53d5" + "sha256": "1526a3cf29a0e5f7fc4bcae3a44901fd8301396b9aff99491d853d26923e81a1" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageContentTest.kt": { "mode": "100644", - "sha256": "b2c7f9f6f0cf8144dcd03bcb9c38d2ea9daf4bd8b8080eacf7ca813c26cba495" + "sha256": "a99f306de300a017671032b58495cc933c8a8c6dc036e6bbdf4b9c5744501ae5" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputImageTest.kt": { "mode": "100644", - "sha256": "8746fa4d970b603502f5010abc38aaeff63a5bf56e80927863a58108082278fd" + "sha256": "c8f3a350f8a78c95b3066893ac7ccf8871ece6a8fba59785fee2c9dd284264f2" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputItemTest.kt": { "mode": "100644", - "sha256": "e6902e34d7b581483c294430fbfac638d363385781fbc24d1ee23ffc6707b260" + "sha256": "94b2c2194d61f6ad240768cdb8eddf59fbec3752463db9d4b6e55b29d60c0084" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputMessageItemTest.kt": { "mode": "100644", - "sha256": "f6d3113bd9a8d2a8fd3c7029ac92a1f9b95bf5b0c6c42596dfaf1e478f214f21" + "sha256": "59bdcb4b8c67b43efff4de367cf186559e3acf09a068f4d766828bfd2ad31fba" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextContentTest.kt": { "mode": "100644", - "sha256": "a7e1eb3dd028f9e003eb1245ad3f2afbd63728846c9b91a5efa9bffd2056f0a9" + "sha256": "d531e33a2ca9b1bbd819189d4ea16b5bdb20f675bc91091483f73d50d03784e9" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseInputTextTest.kt": { "mode": "100644", - "sha256": "488e75473ba87147d4d4ab3e03f9259aabca0202e8074ad932b16ad4e782ae8e" + "sha256": "1488f4610bb7c0da667ae04030da6adf962e944cf53dfc3a244d9ddc5348da23" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseItemTest.kt": { "mode": "100644", - "sha256": "3fe1048def7f9f2c05f7adc022a718a590eacd84307e129d67efd135400d97ca" + "sha256": "194a5f0950d469baa6973e55f4f225616d4f7edf59321d5ecd73adab9531ebff" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseLocalEnvironmentTest.kt": { "mode": "100644", @@ -11167,7 +11171,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseOutputItemTest.kt": { "mode": "100644", - "sha256": "3ae973870cef0416523c49a4795448fe6872ba180cdacec43731ca864e099f33" + "sha256": "0ab3223e209555bca63db065042d44de20f98f05e9e8066c54e893874590a1cb" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseOutputMessageTest.kt": { "mode": "100644", @@ -11263,11 +11267,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputContentTest.kt": { "mode": "100644", - "sha256": "8d593aec6bd6473f0cf021abc18625c5c3fdb37b3033d7e23b364c4355565656" + "sha256": "8505b8a4520d73a55016495aafafc8a96de39169c58c1cb4c891f9e9e34705b9" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerInputTest.kt": { "mode": "100644", - "sha256": "a1b8a14580f0627a3ef6a274b268856935d5a9c5ffa45e1c6f13c205f674d153" + "sha256": "780da67375e078d618599a5350cc14f6ad927eca4c9190be902643f6725e25a3" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponseSteerPendingEventTest.kt": { "mode": "100644", @@ -11407,7 +11411,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/inputitems/BetaResponseItemListTest.kt": { "mode": "100644", - "sha256": "c31aa3ce261137d3abad8c66651949d41763aa3cd7d4ff237844c0be0ab7ae7d" + "sha256": "61aab1a8a54b253031f39725c999752cfcd097861582f15b494af03302b4d2dc" }, "openai-java-core/src/test/kotlin/com/openai/models/beta/responses/inputitems/InputItemListParamsTest.kt": { "mode": "100644", @@ -11743,11 +11747,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartImageTest.kt": { "mode": "100644", - "sha256": "b51786389deba6d76b1d09b50e55724c9b9955a413bf65480e9aa9467ab60ea8" + "sha256": "541568d358f95739f5ec7abfbcbea59dece6be65b3d981ea22127e0103786af1" }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartInputAudioTest.kt": { "mode": "100644", - "sha256": "f45d2e913867290ec936e84bc476feb8d5355badfd4c11da2f281e458a623cfc" + "sha256": "68d6d4dbaf223ab715846958bb9ae5dd20f564d2784ee8d03472f29cba7d040c" }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartRefusalTest.kt": { "mode": "100644", @@ -11755,11 +11759,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTest.kt": { "mode": "100644", - "sha256": "a5a18140be12b6731b810d13b4e7b0240ff7673c5d6e8dcc36615364a7e39fbe" + "sha256": "fe7fca0af5e6e765542d7dc90e0c6cbc4f3a09fa6831f0c6e04369853a598305" }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionContentPartTextTest.kt": { "mode": "100644", - "sha256": "9ddd618d28f711d3c5839621a9c882f499ab950540c7747586d22d1d6edb0e8c" + "sha256": "d8d60b0657f7da53a981377d4c90882ee4b3a88ff09af9c163895b48c08be5fa" }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParamsTest.kt": { "mode": "100644", @@ -11839,7 +11843,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionStoreMessageTest.kt": { "mode": "100644", - "sha256": "b9cb5ff273ea934936040807a9de9b6d4f606730cabb0506d10075e5504b928a" + "sha256": "9abd92dcabef3a70e00d025cb53c33481854122a7b797c71098e1e8ee425a775" }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/ChatCompletionStreamOptionsTest.kt": { "mode": "100644", @@ -11879,7 +11883,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/messages/MessageListPageResponseTest.kt": { "mode": "100644", - "sha256": "8836c775b50819002c849a1ad800511d61b7a6d3cb3d2ab57a1f47d83a040252" + "sha256": "9455c43df79d222e22b4e708b6201b70af1bcebed3141079087f93cf31994b91" }, "openai-java-core/src/test/kotlin/com/openai/models/chat/completions/messages/MessageListParamsTest.kt": { "mode": "100644", @@ -11979,7 +11983,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/ComputerScreenshotContentTest.kt": { "mode": "100644", - "sha256": "5542144056b3012a4a1dfead7d6e51584c843facec0e930aed7842ccc9e385b8" + "sha256": "c8fb46fda01f531495e37771f43e62b4d8867c55c0ceb44f99d70d0bdc5029f0" }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/ConversationCreateParamsTest.kt": { "mode": "100644", @@ -12011,7 +12015,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/MessageTest.kt": { "mode": "100644", - "sha256": "49ef54b16e38866d07ca5ad96657c04fb6cf2e1502fb6ea35c0a66669efe4e88" + "sha256": "5828183d21e32378fb73ae2949d78d615c39a1ac1a1999d909c6b86f84e0de0f" }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/SummaryTextContentTest.kt": { "mode": "100644", @@ -12023,11 +12027,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemListTest.kt": { "mode": "100644", - "sha256": "2030c18cefc9c80da68ba4ae7030d0ae86c124f06086c96154035d8153a1957d" + "sha256": "32b98c59ef39f28b2a31059f924cccbdee74722671b83e6d720742279b3f1128" }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ConversationItemTest.kt": { "mode": "100644", - "sha256": "612705ab8f97055d2f247d2250350fe20b68e81d490a634250ee0438273db130" + "sha256": "26b56e2c6e00ddd0c36835d7ec4cce3c051d470a2823caec18365a8c8eed6986" }, "openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ItemCreateParamsTest.kt": { "mode": "100644", @@ -12403,7 +12407,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/graders/gradermodels/EvalContentItemTest.kt": { "mode": "100644", - "sha256": "f60f7d9e7fa2c2accee9957d603ff0173d2bb36d72236c540fd6e6a1d7052643" + "sha256": "0e4dcc11f9c54b0969d7f709a7c82615d694e19af087147738ade2936cd39353" }, "openai-java-core/src/test/kotlin/com/openai/models/graders/gradermodels/LabelModelGraderTest.kt": { "mode": "100644", @@ -12483,11 +12487,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/ClientDelegationTest.kt": { "mode": "100644", - "sha256": "a1cb0a614c5d54f6dad3c9b489d885f588d3331fb72c291866e178e1985328f0" + "sha256": "836ab6c1f18c88e429ae0b1fdd1cc4eda89f267ea43d786c377439c50b14c53e" }, "openai-java-core/src/test/kotlin/com/openai/models/live/ClientEventTest.kt": { "mode": "100644", - "sha256": "5e3beb4424dea99afda7b8d2480527d355006defba3232a5b7e0af2d1250e973" + "sha256": "f81bb3f9fbe50982a118a94160fed04e87849346d71c3369762c699255fea855" }, "openai-java-core/src/test/kotlin/com/openai/models/live/CommentaryAppendEventTest.kt": { "mode": "100644", @@ -12555,11 +12559,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionConfigTest.kt": { "mode": "100644", - "sha256": "13557f980f8d5209664caceb8453bd686b862182a72f1c133efaa4d51e4ed460" + "sha256": "f6b6bf1d02e2679346dfcee8eddd09e135d7f3f20187f4b2a3888595722ad5df" }, "openai-java-core/src/test/kotlin/com/openai/models/live/ForkSessionStartEventTest.kt": { "mode": "100644", - "sha256": "dda95a006b9febdf325414ef3fe62734f547f101407c6fc21ff38b65f7343318" + "sha256": "18b402b8131ed0598b3ac62718b3006c33aad947b8aeca13c838cc5ddf963329" }, "openai-java-core/src/test/kotlin/com/openai/models/live/FunctionToolTest.kt": { "mode": "100644", @@ -12607,7 +12611,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/LiveCreateParamsTest.kt": { "mode": "100644", - "sha256": "09922e622b1fde8489b0edd61187eb91a7b24d68b98cac7efe9a8aef2ba0ae74" + "sha256": "8227e53431482a1fa2c4f09bdafc34d5d75da3cf7e5a4f65103bebadfc9ce716" }, "openai-java-core/src/test/kotlin/com/openai/models/live/LiveCreateResponseTest.kt": { "mode": "100644", @@ -12615,11 +12619,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionConfigTest.kt": { "mode": "100644", - "sha256": "17f29bef574c6144b634fca8d70978f8182b23198ecf958fce3a20b125287670" + "sha256": "942b87a813b00bcd0c0b51390d153a180a3b4d376f79f7f4ecb835b65e71ceee" }, "openai-java-core/src/test/kotlin/com/openai/models/live/MediaSessionForkConfigTest.kt": { "mode": "100644", - "sha256": "009668af74074e8c2e2f5bec763f8f8528667c4b5befd419556762687206345f" + "sha256": "4fd599dbcb675732de9f09a97d15cf11a641c619418842ac8bdbec261e08334c" }, "openai-java-core/src/test/kotlin/com/openai/models/live/OutputAudioDeltaEventTest.kt": { "mode": "100644", @@ -12667,7 +12671,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/ServerEventTest.kt": { "mode": "100644", - "sha256": "5cb5b46d322aafadacc6c19f8d21c05f65b5d60822b6727b46aeed918891ffe2" + "sha256": "58a7f2b07e9ae04254d5984fd8ce611638269fef264c2c978fc00587062aa1e8" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionCloseEventTest.kt": { "mode": "100644", @@ -12675,35 +12679,35 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionClosedEventTest.kt": { "mode": "100644", - "sha256": "d600097dc858aba3baef15cdf5ad65f75b41e155a37b0568c798c9745b660169" + "sha256": "032ebf3fdc5dcde223d1fb5f873de2e986dddd70dc1f08e5e7896473fcdb5361" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionConfigTest.kt": { "mode": "100644", - "sha256": "0c0d46668eff01df223e37206db02c035d69deb408ac334353dd8353a1ade374" + "sha256": "552b365fb8968ab6475c022338c696cb13200efb20fbfcc1f77e0308fecdbb72" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionResourceTest.kt": { "mode": "100644", - "sha256": "abeac9560e41d59677f81aeacdacd3683a5d22fdae311b3329334e4f7e11f0b8" + "sha256": "aea747116ac52193d4ad76ed58f73e748e1b84218a66cb00dd56bf459fe295c6" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartEventTest.kt": { "mode": "100644", - "sha256": "cc1e9d1ab53ceedf0a48789e27a5e679a5cf922084b5e29ee9d7c61ff9ae2918" + "sha256": "54cca4dc61df707a399ec207c703d4fb2e68372eecfb537dd76130c55115f234" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionStartedEventTest.kt": { "mode": "100644", - "sha256": "7e156904c9ce231ab5889170db7ef1e0f7c70dbe78cad1d1a937a2805b35d8f2" + "sha256": "fcf9e71e6fbfcfb0ff6132e91e1ae43333d1b179fe4e9c0ccd382a42b983c944" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateConfigTest.kt": { "mode": "100644", - "sha256": "10e48964a3a123a1dd6e9ec75b8873487eb54fcd15ef8ad3dc48cece63955e5c" + "sha256": "4d16a4428318f6110a6d031fe6a92f2019c01ac448cc7a4b00c09f55f5571262" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdateEventTest.kt": { "mode": "100644", - "sha256": "aa6511c1db945ea316ca15b841f0860cd09c3859d0b686abd78e837b08ddc08c" + "sha256": "556dff15d948d7af5d5d4dc520cc1a46e8b4001484b221bd816c7ef01c7a0bdb" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionUpdatedEventTest.kt": { "mode": "100644", - "sha256": "366208110d2de9069385823d2a61b29e79724d417a7834f0a146493ab3ed0f11" + "sha256": "7c9670c57d54430750b1beee7a123e483a91cd853e99f2aeaaa0ce526e9829c4" }, "openai-java-core/src/test/kotlin/com/openai/models/live/SessionUsageTest.kt": { "mode": "100644", @@ -12723,15 +12727,15 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkClientEventTest.kt": { "mode": "100644", - "sha256": "acb95174048e322dabf75074c3cdd9071a48134d0cbea59efe31603e408807d6" + "sha256": "d562e87073d9b338dca22568c922b309969dd997db03a4fb40fe588223939e6d" }, "openai-java-core/src/test/kotlin/com/openai/models/live/forks/ForkServerEventTest.kt": { "mode": "100644", - "sha256": "79c2d43a1d2a23746c53810c0baa6b128529b392ece51639b2125c2cba7a6302" + "sha256": "2a20ebb17078d7d1a5c4d144cf3587d909c3265793739e5ea8332902dbf5f29f" }, "openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionAcceptParamsTest.kt": { "mode": "100644", - "sha256": "a4cc5c49af7ce30359038e57fd52eefac47d9598562cf86def963bb773ada3f5" + "sha256": "2cd4d70d91efcc198e3a2c0fa85c253ed437b2dab30a974f22036ad8114e3e60" }, "openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionDownloadRecordingParamsTest.kt": { "mode": "100644", @@ -12739,7 +12743,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionForkParamsTest.kt": { "mode": "100644", - "sha256": "fda1db94589dbc7ca9adefbd4e4ef6ee9c4c1d2468207c91ea594f6a845c2c0b" + "sha256": "b2982d59d7652579a4c0ea7418fad2fdc15e66bfdcbae738b589eea20ff1df89" }, "openai-java-core/src/test/kotlin/com/openai/models/live/sessions/SessionForkResponseTest.kt": { "mode": "100644", @@ -12759,11 +12763,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandClientEventTest.kt": { "mode": "100644", - "sha256": "c810f8438fbd22fa1a4ae134b0db01f2a584ef1e3d52e094b4737db29949ef64" + "sha256": "df14a38a8acc158ac99ee4a416b660e0b9e75d651028a2033d1c8c60b144f5e0" }, "openai-java-core/src/test/kotlin/com/openai/models/live/sideband/SidebandServerEventTest.kt": { "mode": "100644", - "sha256": "8a80c488712d695d73cc7c6cd856e19690c572b901ee245c7e6bf3051edd541e" + "sha256": "f584c51c6a9b226064524c7fcb30adcae2ecdeeb80b1f9d670639935035a3a46" }, "openai-java-core/src/test/kotlin/com/openai/models/models/ModelDeleteParamsTest.kt": { "mode": "100644", @@ -13511,7 +13515,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt": { "mode": "100644", - "sha256": "9b8c2cb0d49eea2bb28c74f53b16e5893ba43b87d00398d92b808992658a6460" + "sha256": "133e51f0aac8cad7b49e954f74d1c52e11a2107626449ea59078c90d76fd19a8" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseConversationParamTest.kt": { "mode": "100644", @@ -13599,7 +13603,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionCallOutputItemTest.kt": { "mode": "100644", - "sha256": "ac58a63666933940f1a92e81b278ac044b8201991012db028ada5209923d0853" + "sha256": "79faafd0c5e7a0ea2f804e54c235b03a233609677bcd74d2fedd40dc20b00195" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFunctionShellCallOutputContentTest.kt": { "mode": "100644", @@ -13659,43 +13663,43 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputContentTest.kt": { "mode": "100644", - "sha256": "0ba0120f711f85d05f2edd140524b03b255f4a55df43590f284486aceeccb77f" + "sha256": "ff432156775537ca5352eb2c725591e50a455bfb0662b7c5e8f95f63a7d674fa" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileContentTest.kt": { "mode": "100644", - "sha256": "cba2e2821c98f7ffbd6017c4774f858695ee9693fd8da758f4d63efb7d5dc88b" + "sha256": "6e0a493f189c88cbabd60544ea4483b74dc28687a63f4f3341fdca373842b215" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputFileTest.kt": { "mode": "100644", - "sha256": "668107756156e04c0155944226f73532752c6e7b8062ff5d1a0c242665da1f32" + "sha256": "e45801735fb7e44947b6eeda322195fd87828697d3d322bb038e66fa5d525bdb" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageContentTest.kt": { "mode": "100644", - "sha256": "355b05ee03ef7a862d5ad2e90f51c116d013491ef8896e2a66b35853e6e37b61" + "sha256": "3285002508a36ed8aac2999391adb4be57034f27c21086b6f8bc6cb6558f5eb9" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputImageTest.kt": { "mode": "100644", - "sha256": "738e911499044a5f8bb9f5a640f334366eed746b6438da07c930bc4f95ab82b4" + "sha256": "89f1a63420932b8ea98430a6a4b489f57c2fd423ba013852791d48386392a50e" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt": { "mode": "100644", - "sha256": "dc9afa2e8fa563efb1ef2c77ec5f29ed40ac22a598564228d1740c7924a49948" + "sha256": "1ba0035681c06060ef33e05d55cb517b8beb1c7fea3abfe4e52d98e76c831d48" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputMessageItemTest.kt": { "mode": "100644", - "sha256": "38be8af2278aabb99c699aa7bf7a5dd61e6d3cdfc70f0e54e698178e6828c207" + "sha256": "e674c3b04badb80ded95caa50cf763ef5e137c54b8700087dfbe295f857f5f3e" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextContentTest.kt": { "mode": "100644", - "sha256": "501a27ab67483a42e8855f98a99c9ffa03988a7205a86f069b49e341c647d6f1" + "sha256": "086fe41a9ff50644c2d1da23e1b3d14edfeaad27793ff56685c01e36704c2210" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputTextTest.kt": { "mode": "100644", - "sha256": "afdf156211bd1f7f6c462083fdf1675fe6bd09af5689896029ecc84357cedbcf" + "sha256": "6fee240a4a197a81a918b4de33ce5b9078b6b0ffb0dba1c12c09527d703e91b4" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt": { "mode": "100644", - "sha256": "7382b9bfeae047f963413af9b4b211e06c59bdf640e62c8925b468d77767d63d" + "sha256": "b49a79c740dac33d0d195840d895def2965426b387887667669f2969335bbf0b" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseLocalEnvironmentTest.kt": { "mode": "100644", @@ -13847,11 +13851,11 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputContentTest.kt": { "mode": "100644", - "sha256": "cbb55350ff34d65e3cf4e80bc76bc14261cd4e5c818db2378d94ca46aa149420" + "sha256": "3b37c9586f4771b35d9cde6224613eed1fb6a6688d4be3aa5ff99e667e43aa2a" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerInputTest.kt": { "mode": "100644", - "sha256": "93567eebb866105e3c57dc89e9e888bedead56ba3c46a5fef6982b422b455ce1" + "sha256": "1ce4645c8bd18613efae5b858e7ea2fb411443b86c16ef11e0e751437dbd6963" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseSteerPendingEventTest.kt": { "mode": "100644", @@ -13975,7 +13979,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/responses/inputitems/ResponseItemListTest.kt": { "mode": "100644", - "sha256": "9016d07b62bc402b3057e49e412b71b98917077a1711852ff3ed92c0c1c4bbeb" + "sha256": "11b833a4ee448b6172eb18fb50599c7c5e7f0c88f9fd47eae7d926fca5727843" }, "openai-java-core/src/test/kotlin/com/openai/models/responses/inputtokens/InputTokenCountParamsTest.kt": { "mode": "100644", @@ -14551,7 +14555,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/services/async/LiveServiceAsyncTest.kt": { "mode": "100644", - "sha256": "ea2fee3976f8cee30dc98d779cef79f5c562681209eba039907ec3c946dc462a" + "sha256": "7c94efdbc9e244325240b73dfeda7858d17e6b165440e9607da166e857ed8722" }, "openai-java-core/src/test/kotlin/com/openai/services/async/ModelServiceAsyncTest.kt": { "mode": "100644", @@ -15143,7 +15147,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/services/async/live/SessionServiceAsyncTest.kt": { "mode": "100644", - "sha256": "94e322f45b797f037eaa24c1b3f2f49d596fd97cd56f7d7fa92162a608b37b3c" + "sha256": "1002c0dadbbb6142ec07bc1752209a52552b66270771502cc4704d865145432a" }, "openai-java-core/src/test/kotlin/com/openai/services/async/realtime/CallServiceAsyncTest.kt": { "mode": "100644", @@ -15283,7 +15287,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/services/blocking/LiveServiceTest.kt": { "mode": "100644", - "sha256": "6df9a025b883cff15cf3be005d7186e9b17a961ca3d073ac04baf33ff5338d11" + "sha256": "e7cd2a1c1377c28ebd2fd8d0c8dc8abc7ee81d8e543733681e31829de51dfb62" }, "openai-java-core/src/test/kotlin/com/openai/services/blocking/ModelServiceTest.kt": { "mode": "100644", @@ -15875,7 +15879,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/services/blocking/live/SessionServiceTest.kt": { "mode": "100644", - "sha256": "fd5333ccc790d6597c2a0700a0c674fe745e5fc3c0a29cf2302f5d95dbe815d8" + "sha256": "9cb1291ca81a3d094d352b3e42d75558efa967ece98197b4767d8a188bad5642" }, "openai-java-core/src/test/kotlin/com/openai/services/blocking/realtime/CallServiceTest.kt": { "mode": "100644", @@ -15951,7 +15955,7 @@ }, "scripts/castiron/CUSTOM_CODE.md": { "mode": "100644", - "sha256": "ee7bd6b2e0da275985a3309393063ac1fa5946d024575d228ae4979ec03e6417" + "sha256": "8464fb28964ae0f7bec38ae7ba8107e97287d4118657a3017a2712e753d4c608" }, "scripts/castiron/README.md": { "mode": "100644", @@ -15963,7 +15967,7 @@ }, "scripts/castiron/custom_code_policy.py": { "mode": "100755", - "sha256": "8d7abe615f3cf8e43f1db7ed9674264f0e0fffea39b093a145731783a343a1d7" + "sha256": "e16c211407c9d236e3bdf0c00a5fe252e4509a14a0fdfe4dacbb891e33a55c57" }, "scripts/castiron/custom_code_report.py": { "mode": "100755", @@ -15971,11 +15975,11 @@ }, "scripts/castiron/custom_code_test_support.py": { "mode": "100644", - "sha256": "15b2c1243f1cbec53b73707e5806a8566d40f78763fe85c4ab7dc48bc1405a6c" + "sha256": "8fc5147352025e2c874ae855ac8f3ac649d531d2c1bd80c532bc4e9ec4fafa3f" }, "scripts/castiron/fixtures/github_publisher.cjs": { "mode": "100644", - "sha256": "232fd17ff25eb0680f71f82a04d210e9b2da4dd7fae6071058dc7108e3deecc6" + "sha256": "3f77c368ed668bb6ddcde1f2e806e3f307d64cb68cc45fe4c4968adfe1f7c0fe" }, "scripts/castiron/ruff.toml": { "mode": "100644", @@ -15991,15 +15995,19 @@ }, "scripts/castiron/test_custom_code_policy.py": { "mode": "100644", - "sha256": "22405957bac59e79943a3ea5c72a5657cea5ae3b3b7a5d9ed80966edf2e94b23" + "sha256": "a9b4dcabec71c66e1e280fd54f46f78eea9bc664f8dca500f5da418e27114602" }, "scripts/castiron/test_custom_code_publication.py": { "mode": "100644", - "sha256": "dc4492599c1c1b6cf9403b200ab105de10cc95ba91a45e566eb1bb673024d9fa" + "sha256": "0e7628d6906153029fea156273094a3d0b17846abd0894a91ab0833241bfdf31" }, "scripts/castiron/test_custom_code_report.py": { "mode": "100644", "sha256": "f4d90fd38b17aac59096488391b65ef9da5493d2049d4c038d5926a960257ca7" + }, + "scripts/castiron/test_custom_code_review_revocation.py": { + "mode": "100644", + "sha256": "2ad322e7e7b2cbd425f6647edc1cde98d4354b989dfb0b61f326030292e9c460" } } } diff --git a/scripts/castiron/test_custom_code_policy.py b/scripts/castiron/test_custom_code_policy.py index 909d29f60..00517cb54 100644 --- a/scripts/castiron/test_custom_code_policy.py +++ b/scripts/castiron/test_custom_code_policy.py @@ -4,6 +4,7 @@ from __future__ import annotations import copy +import io import json import sys import tempfile @@ -29,6 +30,9 @@ def setUp(self) -> None: # pyright: ignore[reportImplicitOverride] checker = self.repo / "scripts/castiron/custom_code_budget.py" checker.parent.mkdir(parents=True) checker.write_text("NEXT_POLICY_VERSION = 1\n") + checker.with_name("custom_code_policy.py").write_text( + 'PIN_REVIEW_POLICY = "effective-policy-v1"\n' + ) self.main = self.commit("main policy") self.git("update-ref", "refs/remotes/origin/main", self.main) self.pin = {"repository": REPO, "main_sha": self.main} @@ -38,6 +42,52 @@ def setUp(self) -> None: # pyright: ignore[reportImplicitOverride] (self.repo / "sdk.txt").write_text("candidate SDK bytes") self.head = self.commit("sdk change") + def test_review_command_uses_git_policies_and_rejects_stale_main(self) -> None: + git: Callable[..., bytes] = selector.report.git + + def local_fetch(repo: Path, *args: str, **kwargs: Any) -> bytes: + if args[0] == "fetch": + return git( + repo, + "fetch", + "--quiet", + str(self.repo), + f"{self.main}:refs/remotes/origin/main", + self.base, + self.head, + ) + return git(repo, *args, **kwargs) + + with ( + tempfile.TemporaryDirectory() as directory, + mock.patch.object(selector.report, "git", side_effect=local_fetch), + ): + for stale in (False, True): + with ( + self.subTest(stale=stale), + mock.patch("sys.stdout", new_callable=io.StringIO) as output, + ): + args = [ + "review-required", + "--repo", + str(Path(directory) / str(stale)), + "--repository", + REPO, + "--base", + self.base, + "--head", + self.head, + "--main", + self.base if stale else self.main, + ] + if stale: + with self.assertRaisesRegex(ValueError, "authenticated main changed"): + selector.main(args) + self.assertEqual(output.getvalue(), "") + else: + self.assertEqual(selector.main(args), 0) + self.assertEqual(json.loads(output.getvalue()), {"requires_human": False}) + def write_policy(self, value: dict[str, Any]) -> None: (self.repo / ".castiron-ratchet.json").write_text(json.dumps(value)) @@ -500,6 +550,48 @@ def test_pin_effective_policy_review_for_pr_and_queue(self) -> None: result["policy_reviews"], [{"number": 3, "head_sha": self.head}] ) + def test_legacy_checker_pin_review_receipt_for_pr_and_queue(self) -> None: + declarations = ( + None, + 'PIN_REVIEW_POLICY = "unknown"\n', + 'PIN_REVIEW_POLICY = "effective-policy-v1"\n' * 2, + ) + for declaration in declarations: + self.git("checkout", "-q", "--detach", self.main) + checker = self.repo / "scripts/castiron/custom_code_policy.py" + if declaration is None: + checker.unlink() + else: + checker.write_text(declaration) + legacy = self.commit("legacy review contract") + checker.write_text('PIN_REVIEW_POLICY = "effective-policy-v1"\n') + newer = self.commit("modern review contract") + self.git("update-ref", "refs/remotes/origin/main", newer) + self.git("checkout", "-q", "--detach", legacy) + self.write_policy( + {**self.policy, "next_policy": {"repository": REPO, "main_sha": legacy}} + ) + base = self.commit("protected legacy checker") + self.write_policy( + {**self.policy, "next_policy": {"repository": REPO, "main_sha": newer}} + ) + self.head = self.commit("forward same-budget pin") + for heads in (None, [self.head]): + with self.subTest(declaration=declaration, heads=heads): + with ( + mock.patch.object(selector.report, "api", side_effect=self.review_api([])), + self.assertRaisesRegex(ValueError, "human"), + ): + self.select(base=base, main=newer, pull_heads=heads) + with mock.patch.object( + selector.report, "api", side_effect=self.review_api([self.approved()]) + ): + result = self.select(base=base, main=newer, pull_heads=heads) + self.assertEqual(result["policy_sha"], legacy) + self.assertEqual( + result["policy_reviews"], [{"number": 3, "head_sha": self.head}] + ) + def test_rollback_pin_keeps_human_proof_for_pr_and_queue(self) -> None: self.git("checkout", "-q", "--detach", self.main) (self.repo / "checker-fix.txt").write_text("reviewed checker fix") diff --git a/scripts/castiron/test_custom_code_publication.py b/scripts/castiron/test_custom_code_publication.py index 15069d795..4387e6cd9 100644 --- a/scripts/castiron/test_custom_code_publication.py +++ b/scripts/castiron/test_custom_code_publication.py @@ -6,44 +6,22 @@ import hashlib import json import shutil -import subprocess -import tempfile import unittest from pathlib import Path -from typing import Any, cast +from typing import Any from unittest import mock import custom_code_policy as policy import custom_code_report as report -from custom_code_test_support import GitTestCase, source_run - -WORKFLOW = ( - Path(__file__).resolve().parents[2] / ".github/workflows/castiron-custom-code-comment.yml" +from custom_code_test_support import ( + WORKFLOW, + GitTestCase, + run_publisher, + run_workflow_script, + source_run, ) -def run_publisher(step: str, payload: dict[str, Any]) -> list[dict[str, Any]]: - section = WORKFLOW.read_text().split(f"- name: {step}\n", 1)[1] - script = section.split(" script: |\n", 1)[1] - lines: list[str] = [] - for line in script.splitlines(): - if line and not line.startswith(" "): - break - lines.append(line[12:]) - return run_workflow_script("\n".join(lines), payload) - - -def run_workflow_script(script: str, payload: dict[str, Any]) -> list[dict[str, Any]]: - output = subprocess.run( - ["node", str(Path(__file__).with_name("fixtures") / "github_publisher.cjs")], - input=json.dumps({**payload, "script": script}), - text=True, - capture_output=True, - check=True, - ) - return cast(list[dict[str, Any]], json.loads(output.stdout)) - - class WorkflowTests(unittest.TestCase): @unittest.skipUnless(shutil.which("node"), "GitHub Actions JavaScript runtime") def test_workflow_path_filters_accept_refs_without_accepting_other_files(self) -> None: @@ -984,704 +962,5 @@ def test_publication_guard_allows_current_retry_and_ignores_unrelated_statuses(s self.assertTrue(all(len(r["description"]) <= 140 for r in results)) -@unittest.skipUnless( - shutil.which("node"), "Node is needed to execute the review-revocation fixture" -) -class ReviewRevocationTests(unittest.TestCase): - def payload(self) -> dict[str, Any]: - head, base, queue = "a" * 40, "b" * 40, "c" * 40 - pull = { - "number": 3, - "user": {"login": "author"}, - "state": "open", - "head": {"sha": head}, - "base": {"ref": "next", "sha": base, "repo": {"full_name": "openai/example"}}, - } - run = { - **source_run(head), - "id": 20, - "actor": {"login": "outsider", "type": "User"}, - "event": "pull_request_review", - "status": "completed", - "pull_requests": [{"number": 3, "head": {"sha": head}}], - } - - def original(sha: str, event: str, identity: int) -> dict[str, Any]: - return {**run, "head_sha": sha, "id": identity, "event": event} - - return { - "run": run, - "policies_by_sha": { - base: {"schema_version": 1, "max_custom_patch_lines": 0}, - head: {"schema_version": 1, "max_custom_patch_lines": 1}, - }, - "previous_statuses": [ - { - "context": name, - "state": "success", - "creator": {"login": "github-actions[bot]"}, - "target_url": "https://github.com/openai/example/actions/runs/19", - } - for name in ( - "Castiron next / budget-only change", - "Castiron next / custom-code budget", - ) - ], - "current": pull, - "queue_nodes": [ - {"headCommit": {"oid": queue}, "pullRequest": {"number": 3, "headRefOid": head}} - ], - "runs_by_sha": { - head: [original(head, "pull_request", 12)], - queue: [original(queue, "merge_group", 14)], - }, - "context": { - "payload": {"workflow_run": dict(run)}, - "runId": 21, - "repo": {"owner": "openai", "repo": "example"}, - "serverUrl": "https://github.com", - }, - } - - def invoke(self, payload: dict[str, Any]) -> list[dict[str, Any]]: - return run_publisher("Re-evaluate current PR and queue after review changes", payload) - - def test_revokes_pr_and_queue_before_requesting_normal_re_evaluation(self) -> None: - result = self.invoke(self.payload()) - self.assertEqual([item.get("state") for item in result[:4]], ["pending"] * 4) - self.assertEqual({item["sha"] for item in result[:4]}, {"a" * 40, "c" * 40}) - self.assertTrue(all(item["context"].startswith("Castiron next /") for item in result[:4])) - self.assertEqual([item["run_id"] for item in result[4:]], [12, 14]) - self.assertNotIn("success", [item.get("state") for item in result]) - - def approval(self) -> dict[str, Any]: - return { - "fullDatabaseId": "101", - "state": "APPROVED", - "body": policy.HUMAN_REVIEW_RULES["attestation_prefix"] + "a" * 40, - "author": {"login": "reviewer", "__typename": "User"}, - "authorAssociation": "MEMBER", - "commit": {"oid": "a" * 40}, - "updatedAt": "2026-10-22T01:00:00Z", - } - - def recovery(self) -> dict[str, Any]: - payload = self.payload() - payload["review_nodes"] = [self.approval()] - payload["run"]["actor"] = {"login": "reviewer", "type": "User"} - for status in payload["previous_statuses"]: - status["state"] = "failure" - return payload - - def history(self, payload: dict[str, Any], writes: list[dict[str, Any]]) -> None: - payload["statuses_by_sha"] = { - sha: [ - {**item, "creator": {"login": "github-actions[bot]"}} - for item in writes - if item.get("sha") == sha - ] - for sha in ("a" * 40, "c" * 40) - } - payload["runs_by_id"] = { - "21": { - "id": 21, - "workflow_id": 789, - "status": "completed", - "conclusion": "success", - "repository": {"full_name": "openai/example"}, - "event": "workflow_run", - } - } - - def test_unrelated_comment_cannot_invalidate_valid_approval_or_request_recovery(self) -> None: - for state in ("success", "failure", "pending"): - payload = self.recovery() - payload["run"]["actor"]["login"] = "outsider" - payload["review_nodes"].append( - { - **self.approval(), - "fullDatabaseId": "102", - "author": {"login": "outsider", "__typename": "User"}, - "state": "COMMENTED", - "body": "hello", - } - ) - for status in payload["previous_statuses"]: - status["state"] = state - payload["forbid_queue"] = True - self.assertEqual(self.invoke(payload), []) - - def test_ineligible_review_cannot_request_recovery(self) -> None: - for overrides in ( - {"state": "COMMENTED"}, - {"body": ""}, - {"authorAssociation": "CONTRIBUTOR"}, - {"commit": {"oid": "b" * 40}}, - {"author": {"login": "author", "__typename": "User"}}, - {"author": {"login": "reviewer", "__typename": "Bot"}}, - ): - with self.subTest(overrides=overrides): - payload = self.recovery() - payload["review_nodes"][0].update(overrides) - self.assertEqual(self.invoke(payload), []) - - def test_repeated_invalid_signals_do_not_rerun_already_revoked_heads(self) -> None: - payload = self.payload() - writes = self.invoke(payload) - self.history(payload, writes) - self.assertEqual(self.invoke(payload), []) - for statuses in payload["statuses_by_sha"].values(): - for status in statuses: - status["state"] = "failure" - self.assertEqual(self.invoke(payload), []) - - def test_approval_recovery_coalesces_and_edited_restoration_recovers_again(self) -> None: - payload = self.recovery() - writes = self.invoke(payload) - self.assertEqual(len(writes), 6) - self.assertTrue(all(len(item["description"]) <= 140 for item in writes[:4])) - self.history(payload, writes) - self.assertEqual(self.invoke(payload), []) - payload["review_nodes"][0]["updatedAt"] = "2026-10-22T01:02:00Z" - restored = self.invoke(payload) - self.assertEqual(len(restored), 6) - self.assertNotEqual(writes[0]["description"], restored[0]["description"]) - - def test_new_revocation_supersedes_old_recovery_even_with_equal_edit_timestamp(self) -> None: - payload = self.recovery() - approved = self.invoke(payload) - self.history(payload, approved) - for statuses in payload["statuses_by_sha"].values(): - statuses[:0] = [ - {**status, "state": "success", "description": "Successful evaluation"} - for status in statuses - ] - payload["review_nodes"][0]["body"] = "" - revoked = self.invoke(payload) - self.assertEqual(len(revoked), 6) - self.history(payload, revoked) - for sha, statuses in payload["statuses_by_sha"].items(): - statuses.extend( - {**item, "creator": {"login": "github-actions[bot]"}} - for item in approved - if item.get("sha") == sha - ) - payload["review_nodes"][0] = ( - self.approval() - ) # Same ID, body and second-precision update time. - self.assertEqual(len(self.invoke(payload)), 6) - - def test_full_review_id_handles_current_and_beyond_safe_integer_ids(self) -> None: - payload = self.recovery() - payload["review_nodes"][0].update(databaseId=None, fullDatabaseId="5614624241") - self.assertEqual(len(self.invoke(payload)), 6) - payload = self.payload() - payload["review_nodes"] = [ - {**self.approval(), "databaseId": None, "fullDatabaseId": "9007199254740992"}, - { - **self.approval(), - "databaseId": None, - "fullDatabaseId": "9007199254740993", - "state": "COMMENTED", - }, - ] - self.assertEqual(len(self.invoke(payload)), 6) - payload["review_nodes"][0]["fullDatabaseId"] = 9007199254740992 - with self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - - def test_publisher_failure_supersedes_recovery_without_observed_revocation(self) -> None: - payload = self.recovery() - approved = self.invoke(payload) - self.history(payload, approved) - for statuses in payload["statuses_by_sha"].values(): - statuses[:0] = [ - {**status, "state": "failure", "description": "Approval missing during publication"} - for status in statuses - ] - # Publisher observed invalid body; review jobs only see its same-second restoration. - # No new review identity/timestamp and no review-handler revocation marker exists. - recovered = self.invoke(payload) - self.assertEqual(len(recovered), 6) - self.history(payload, recovered) - self.assertEqual(self.invoke(payload), []) - - def test_deleted_marker_writer_is_untrusted_but_service_errors_propagate(self) -> None: - payload = self.recovery() - approved = self.invoke(payload) - self.history(payload, approved) - payload["run_errors"] = {"21": 404} - self.assertEqual(len(self.invoke(payload)), 6) - for status in (403, 429, 500): - payload["run_errors"]["21"] = status - with self.subTest(status=status), self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - - def test_failed_partial_dispatch_is_retried_before_signals_coalesce(self) -> None: - for authorized in (False, True): - for conclusion in ("failure", "cancelled", "timed_out"): - payload = self.recovery() if authorized else self.payload() - payload["fail_rerun"] = True - # The fixture persists actual pending writes before the simulated API error. - with tempfile.TemporaryDirectory() as directory: - capture = Path(directory) / "pending.json" - payload["capture_writes"] = str(capture) - with self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - pending = json.loads(capture.read_text()) - self.assertEqual(len(pending), 4) - self.history(payload, pending) - payload.pop("capture_writes") - payload.pop("fail_rerun") - payload["runs_by_id"]["21"]["conclusion"] = conclusion - payload["context"]["runId"] = 22 - retried = self.invoke(payload) - self.assertEqual([item["run_id"] for item in retried if "run_id" in item], [12, 14]) - self.history(payload, retried) - payload["runs_by_id"]["22"] = {**payload["runs_by_id"]["21"], "id": 22} - self.assertEqual(self.invoke(payload), []) - - def test_untrusted_marker_cannot_suppress_recovery(self) -> None: - for field, value in ( - ("workflow_id", 999), - ("event", "pull_request"), - ("repository", {"full_name": "attacker/example"}), - ): - payload = self.recovery() - self.history(payload, self.invoke(payload)) - payload["runs_by_id"]["21"][field] = value - self.assertEqual(len(self.invoke(payload)), 6) - - def test_dismissal_edit_away_and_later_comment_revoke_even_for_other_signal_actor(self) -> None: - for changed in ( - {"state": "DISMISSED"}, - {"body": ""}, - {"state": "COMMENTED", "fullDatabaseId": "102"}, - ): - payload = self.payload() - payload["review_nodes"] = [{**self.approval(), **changed}] - self.assertEqual(len(self.invoke(payload)), 6) - payload = self.payload() - payload["review_pages"] = [ - { - "expected_cursor": None, - "nodes": [{**self.approval(), "fullDatabaseId": "102", "state": "COMMENTED"}], - "pageInfo": {"hasNextPage": True, "endCursor": "more"}, - }, - { - "expected_cursor": "more", - "nodes": [self.approval()], - "pageInfo": {"hasNextPage": False}, - }, - ] - self.assertEqual(len(self.invoke(payload)), 6) - - def test_missing_authoritative_edit_time_rejects_recovery(self) -> None: - payload = self.recovery() - payload["review_nodes"][0]["updatedAt"] = None - with self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - - def test_review_signal_requires_canonical_workflow_identity_before_writes(self) -> None: - for identity in (None, "456", 999): - for path in ( - ".github/workflows/castiron-custom-code.yml", - ".github/workflows/castiron-custom-code.yml@evil.yml", - ): - with self.subTest(identity=identity, path=path): - payload = self.payload() - payload["run"].update({"workflow_id": identity, "path": path}) - payload["context"]["payload"]["workflow_run"] = dict(payload["run"]) - self.assertEqual(self.invoke(payload), []) - - def test_rejects_forged_or_superseded_review_signals(self) -> None: - for field, value in [ - ("path", ".github/workflows/other.yml"), - ("run_attempt", 9), - ("head_sha", "d" * 40), - ("event", "pull_request"), - ]: - with self.subTest(field=field): - payload = self.payload() - payload["run"][field] = value - with self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - payload = self.payload() - payload["run"]["repository"] = {"full_name": "attacker/example"} - with self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - - def test_head_change_keeps_observed_statuses_revoked_without_stale_reruns(self) -> None: - payload = self.payload() - changed = {**payload["current"], "head": {"sha": "d" * 40}} - payload["current_sequence"] = [payload["current"], changed] - payload["current"] = changed - result = self.invoke(payload) - self.assertEqual(len(result), 4) - self.assertTrue(all(item["state"] == "pending" for item in result)) - self.assertNotIn("d" * 40, {item["sha"] for item in result}) - - def test_queue_change_retries_and_invalidates_new_snapshot(self) -> None: - payload = self.payload() - old = list(payload["queue_nodes"]) - payload["queue_nodes"].append( - { - "headCommit": {"oid": "d" * 40}, - "pullRequest": {"number": 4, "headRefOid": "e" * 40}, - } - ) - payload["runs_by_sha"]["d" * 40] = [ - { - **payload["runs_by_sha"]["c" * 40][0], - "head_sha": "d" * 40, - "id": 16, - } - ] - payload["queue_pages"] = [ - { - "expected_cursor": None, - "nodes": old, - "pageInfo": {"hasNextPage": False}, - } - ] - result = self.invoke(payload) - pending = [item for item in result if item.get("state") == "pending"] - self.assertEqual({item["sha"] for item in pending}, {"a" * 40, "c" * 40, "d" * 40}) - self.assertEqual([item["run_id"] for item in result if "run_id" in item], [12, 14, 16]) - self.assertTrue(all(item.get("state") == "pending" for item in result[:-3])) - - def test_empty_review_pr_list_uses_authenticated_fork_discovery(self) -> None: - for associated in ([], [{"number": 3}]): - payload = self.payload() - payload["run"].update( - { - "pull_requests": [], - "head_repository": {"owner": {"login": "contributor"}}, - "head_branch": "sdk", - } - ) - payload["associated_pulls"] = associated - payload["fallback_pulls"] = [{"number": 3}] - self.assertEqual(len(self.invoke(payload)), 6) - payload["current"]["head"]["sha"] = "d" * 40 - payload["merge_sha"] = "e" * 40 - payload["merge_commit"] = {"parents": []} - self.assertEqual(self.invoke(payload), []) - - def test_shared_head_revokes_the_run_source_pr(self) -> None: - payload = self.payload() - payload["run"]["pull_requests"] = [] - payload["run"]["head_repository"]["id"] = 101 - payload["current"]["head"].update(ref="sdk", repo={"id": 101}) - payload["associated_pulls"] = [{"number": number} for number in (3, 4, 5)] - payload["pulls_by_number"] = { - str(number): { - **payload["current"], - "number": number, - "head": {**payload["current"]["head"], **change}, - } - for number, change in ((4, {"ref": "other"}), (5, {"repo": {"id": 102}})) - } - result = self.invoke(payload) - self.assertEqual([item.get("state") for item in result[:4]], ["pending"] * 4) - self.assertEqual({item["sha"] for item in result[:4]}, {"a" * 40, "c" * 40}) - - def test_branch_only_merge_signal_requires_current_merge_and_base(self) -> None: - payload = self.payload() - payload["run"]["pull_requests"] = [] - payload["run"]["head_sha"] = payload["context"]["payload"]["workflow_run"]["head_sha"] = ( - "e" * 40 - ) - payload["fallback_pulls"] = [{"number": 3}] - payload["merge_commit"] = {"parents": [{"sha": "b" * 40}, {"sha": "a" * 40}]} - payload["merge_sha"] = "f" * 40 - self.assertEqual(self.invoke(payload), []) - - payload["merge_sha"] = "e" * 40 - self.assertEqual(len(self.invoke(payload)), 6) - payload["current"]["base"]["sha"] = "d" * 40 - payload["comparisons"] = { - f"{'d' * 40}...{'a' * 40}": {"merge_base_commit": {"sha": "b" * 40}} - } - self.assertEqual(self.invoke(payload), []) - - def test_merge_sha_signal_survives_base_advance_and_rejects_wrong_parents(self) -> None: - payload = self.payload() - payload["run"]["head_sha"] = payload["context"]["payload"]["workflow_run"]["head_sha"] = ( - "e" * 40 - ) - payload["current"]["base"]["sha"] = "d" * 40 - payload["comparisons"] = { - f"{'d' * 40}...{'a' * 40}": {"merge_base_commit": {"sha": "b" * 40}} - } - payload["merge_commit"] = {"parents": [{"sha": "b" * 40}, {"sha": "a" * 40}]} - self.assertEqual(len(self.invoke(payload)), 6) - payload["comparisons"][f"{'b' * 40}...{'d' * 40}"] = { - "merge_base_commit": {"sha": "f" * 40} - } - self.assertEqual(self.invoke(payload), []) - payload["merge_commit"]["parents"].reverse() - self.assertEqual(self.invoke(payload), []) - - def test_policy_changes_without_human_attestation_do_not_invalidate_statuses(self) -> None: - cases = ( - ( - {"schema_version": 1, "max_custom_patch_lines": 2}, - {"schema_version": 1, "max_custom_patch_lines": 1}, - ), - ( - {"schema_version": 1, "max_custom_patch_lines": 0}, - {"schema_version": 2, "max_custom_patch_lines": 0, "generated_files": "strict"}, - ), - ) - for base_policy, head_policy in cases: - with self.subTest(base_policy=base_policy, head_policy=head_policy): - payload = self.payload() - payload["policies_by_sha"] = {"b" * 40: base_policy, "a" * 40: head_policy} - self.assertEqual(self.invoke(payload), []) - - def test_go_ratchet_activation_invalidates_statuses(self) -> None: - payload = self.payload() - payload["policies_by_sha"]["a" * 40] = { - **payload["policies_by_sha"]["b" * 40], - "ratchet": "go", - } - self.assertEqual(len(self.invoke(payload)), 6) - - def test_policy_pin_reviews_follow_effective_protected_target(self) -> None: - historical_checker, target_checker, proposed_checker = "e" * 40, "f" * 40, "0" * 40 - target = "d" * 40 - - def pinned(checker: str) -> dict[str, Any]: - return { - "schema_version": 1, - "max_custom_patch_lines": 0, - "next_policy": {"repository": "openai/example", "main_sha": checker}, - } - - payload = self.payload() - payload["current"]["base"]["sha"] = target - payload["main_sha"] = proposed_checker - payload["comparisons"] = { - f"{target}...{'a' * 40}": {"merge_base_commit": {"sha": "b" * 40}} - } - payload["policies_by_sha"] = { - "a" * 40: pinned(proposed_checker), - "b" * 40: pinned(historical_checker), - target: pinned(target_checker), - historical_checker: {"schema_version": 1, "max_custom_patch_lines": 10}, - target_checker: {"schema_version": 1, "max_custom_patch_lines": 5}, - proposed_checker: {"schema_version": 1, "max_custom_patch_lines": 5}, - } - payload["checker_sources_by_sha"] = {target_checker: Path(policy.__file__).read_text()} - self.assertEqual(self.invoke(payload), []) - payload["policies_by_sha"][proposed_checker]["max_custom_patch_lines"] = 7 - self.assertEqual(len(self.invoke(payload)), 6) - payload["policies_by_sha"][proposed_checker]["max_custom_patch_lines"] = 5 - payload["comparisons"][f"{target_checker}...{proposed_checker}"] = { - "merge_base_commit": {"sha": proposed_checker} - } - self.assertEqual(len(self.invoke(payload)), 6) - - def test_legacy_checker_pin_reviews_still_invalidate_statuses(self) -> None: - previous, proposed = "e" * 40, "f" * 40 - for changed in ({"state": "DISMISSED"}, {"body": ""}): - with self.subTest(changed=changed): - payload = self.payload() - payload["main_sha"] = proposed - unchanged_policy = {"schema_version": 1, "max_custom_patch_lines": 0} - payload["policies_by_sha"] = { - "b" * 40: { - **unchanged_policy, - "next_policy": {"repository": "openai/example", "main_sha": previous}, - }, - "a" * 40: { - **unchanged_policy, - "next_policy": {"repository": "openai/example", "main_sha": proposed}, - }, - previous: unchanged_policy, - proposed: unchanged_policy, - } - payload["checker_sources_by_sha"] = { - previous: "NEXT_POLICY_VERSION = 1\n", - proposed: Path(policy.__file__).read_text(), - } - payload["review_nodes"] = [{**self.approval(), **changed}] - writes = self.invoke(payload) - self.assertCountEqual( - [(item["sha"], item["state"]) for item in writes if "state" in item], - [("a" * 40, "pending")] * 2 + [("c" * 40, "pending")] * 2, - ) - self.assertCountEqual( - [item["run_id"] for item in writes if "run_id" in item], [12, 14] - ) - - def test_unknown_or_missing_checker_contract_retains_review(self) -> None: - previous, proposed = "e" * 40, "f" * 40 - for source in ( - None, - 'PIN_REVIEW_POLICY = "unknown"\n', - 'PIN_REVIEW_POLICY = "effective-policy-v1"\n' * 2, - ): - with self.subTest(source=source): - payload = self.payload() - payload["main_sha"] = proposed - unchanged = {"schema_version": 1, "max_custom_patch_lines": 0} - payload["policies_by_sha"] = { - "b" * 40: { - **unchanged, - "next_policy": {"repository": "openai/example", "main_sha": previous}, - }, - "a" * 40: { - **unchanged, - "next_policy": {"repository": "openai/example", "main_sha": proposed}, - }, - previous: unchanged, - proposed: unchanged, - } - payload["checker_sources_by_sha"] = {} if source is None else {previous: source} - self.assertEqual(len(self.invoke(payload)), 6) - for status in (403, 429, 500): - payload["checker_lookup_error"] = status - with self.assertRaises(subprocess.CalledProcessError): - self.invoke(payload) - - def test_initial_pin_at_current_main_keeps_statuses(self) -> None: - payload = self.payload() - checker = "f" * 40 - payload["main_sha"] = checker - payload["policies_by_sha"]["b" * 40] = { - "schema_version": 1, - "max_custom_patch_lines": 4000, - } - payload["policies_by_sha"][checker] = { - "schema_version": 2, - "max_custom_patch_lines": 0, - "generated_files": "strict", - } - payload["policies_by_sha"]["a" * 40] = { - **payload["policies_by_sha"]["b" * 40], - "next_policy": {"repository": "openai/example", "main_sha": checker}, - } - payload["checker_sources_by_sha"] = {checker: Path(policy.__file__).read_text()} - self.assertEqual(self.invoke(payload), []) - advanced_main = "e" * 40 - payload["checker_sources_by_sha"][advanced_main] = Path(policy.__file__).read_text() - payload["policies_by_sha"][advanced_main] = payload["policies_by_sha"][checker] - payload["main_sha_sequence"] = [checker, advanced_main] - payload["main_sha"] = advanced_main - payload["comparisons"] = { - f"{advanced_main}...{checker}": {"merge_base_commit": {"sha": checker}} - } - self.assertEqual(len(self.invoke(payload)), 6) - - def test_revoked_go_ratchet_activation_invalidates_pr_and_queue_statuses(self) -> None: - for changed in ({"state": "DISMISSED"}, {"body": ""}): - with self.subTest(changed=changed): - payload = self.payload() - payload["policies_by_sha"]["a" * 40] = { - **payload["policies_by_sha"]["b" * 40], - "ratchet": "go", - } - payload["review_nodes"] = [{**self.approval(), **changed}] - writes = self.invoke(payload) - self.assertCountEqual( - [(item["sha"], item["state"]) for item in writes if "state" in item], - [("a" * 40, "pending")] * 2 + [("c" * 40, "pending")] * 2, - ) - self.assertCountEqual( - [item["run_id"] for item in writes if "run_id" in item], [12, 14] - ) - - def test_closed_or_superseded_review_is_a_no_op(self) -> None: - for changed in ({"state": "closed"}, {"head": {"sha": "f" * 40}}): - payload = self.payload() - payload["current"].update(changed) - self.assertEqual(self.invoke(payload), []) - - def test_null_queue_association_does_not_block_revocation(self) -> None: - payload = self.payload() - payload["queue_nodes"].insert(0, {"headCommit": {"oid": "f" * 40}, "pullRequest": None}) - result = self.invoke(payload) - self.assertEqual(len(result), 6) - self.assertNotIn("f" * 40, {item.get("sha") for item in result}) - payload["queue_nodes"] = payload["queue_nodes"][:1] - self.assertEqual(len(self.invoke(payload)), 3) - - def test_rerun_requires_the_reviewed_pr_not_just_shared_head(self) -> None: - payload = self.payload() - correct = payload["runs_by_sha"]["a" * 40][0] - main = { - **payload["current"], - "number": 4, - "base": {**payload["current"]["base"], "ref": "main"}, - } - payload["pulls_by_number"] = {"4": main} - other: dict[str, Any] = { - **correct, - "id": 30, - "pull_requests": [{"number": 4, "head": {"sha": "a" * 40}}], - } - payload["runs_by_sha"]["a" * 40].append(other) - result = self.invoke(payload) - self.assertEqual([item["run_id"] for item in result if "run_id" in item], [12, 14]) - # Empty fork associations may rerun only if canonical discovery selects this next PR. - fork: dict[str, Any] = { - **correct, - "pull_requests": [], - "head_repository": {"owner": {"login": "contributor"}}, - "head_branch": "sdk", - } - payload["fallback_pulls"] = [{"number": 3}] - payload["runs_by_sha"]["a" * 40] = [fork, other] - result = self.invoke(payload) - self.assertEqual([item["run_id"] for item in result if "run_id" in item], [12, 14]) - association_cases: tuple[list[dict[str, Any]], ...] = ( - [], - [*correct["pull_requests"], *other["pull_requests"]], - ) - for associations in association_cases: - payload["associated_pulls"] = [{"number": 3}, {"number": 4}] - payload["runs_by_sha"]["a" * 40] = [{**fork, "pull_requests": associations}, other] - result = self.invoke(payload) - self.assertEqual([item["run_id"] for item in result if "run_id" in item], [14]) - self.assertTrue(all(item["state"] == "pending" for item in result[:4])) - - def test_unprepared_queue_entry_still_revokes_pr_statuses(self) -> None: - payload = self.payload() - payload["queue_nodes"][0]["headCommit"] = None - result = self.invoke(payload) - self.assertEqual([item.get("state") for item in result], ["pending", "pending", None]) - self.assertEqual(result[-1]["run_id"], 12) - - def test_unrelated_review_does_not_restart_reporter(self) -> None: - payload = self.payload() - payload["files"] = [{"filename": "src/client.ts"}] - self.assertEqual(self.invoke(payload), []) - - def test_no_success_or_foreign_run_can_be_published(self) -> None: - payload = self.payload() - payload["runs_by_sha"]["a" * 40][0]["repository"] = {"full_name": "other/repo"} - result = self.invoke(payload) - self.assertEqual( - [item["run_id"] for item in result if item.get("operation") == "rerun"], [14] - ) - self.assertTrue(all(item.get("state") != "success" for item in result)) - - def test_signal_is_unprivileged_and_writers_serialize(self) -> None: - producer = (WORKFLOW.parent / "castiron-custom-code.yml").read_text() - self.assertIn("pull_request_review:\n types: [submitted, edited, dismissed]", producer) - signal = producer.split(" queue-signal:\n", 1)[1].split(" candidate-tests:\n", 1)[0] - self.assertIn("permissions: {}", signal) - self.assertNotIn("checkout@", signal) - handler = WORKFLOW.read_text() - revoke = handler.split(" review-change:\n", 1)[1].split(" compute:\n", 1)[0] - self.assertNotIn("checkout@", revoke) - self.assertNotIn("download-artifact", revoke) - self.assertEqual( - handler.count("group: castiron-budget-writes-${{ github.repository_id }}"), 2 - ) - - if __name__ == "__main__": unittest.main() diff --git a/scripts/castiron/test_custom_code_review_revocation.py b/scripts/castiron/test_custom_code_review_revocation.py new file mode 100644 index 000000000..5170e6f2a --- /dev/null +++ b/scripts/castiron/test_custom_code_review_revocation.py @@ -0,0 +1,596 @@ +# File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details. +"""Exercise review revocation and target freshness against offline GitHub state.""" + +from __future__ import annotations + +import json +import shutil +import subprocess +import tempfile +import unittest +from pathlib import Path +from typing import Any + +import custom_code_policy as policy +from custom_code_test_support import WORKFLOW, run_publisher, source_run + + +@unittest.skipUnless( + shutil.which("node"), "Node is needed to execute the review-revocation fixture" +) +class ReviewRevocationTests(unittest.TestCase): + def payload(self) -> dict[str, Any]: + head, base, queue = "a" * 40, "b" * 40, "c" * 40 + pull = { + "number": 3, + "user": {"login": "author"}, + "state": "open", + "head": {"sha": head}, + "base": {"ref": "next", "sha": base, "repo": {"full_name": "openai/example"}}, + } + run = { + **source_run(head), + "id": 20, + "actor": {"login": "outsider", "type": "User"}, + "event": "pull_request_review", + "status": "completed", + "pull_requests": [{"number": 3, "head": {"sha": head}}], + } + + def original(sha: str, event: str, identity: int) -> dict[str, Any]: + return {**run, "head_sha": sha, "id": identity, "event": event} + + return { + "run": run, + "policies_by_sha": { + base: {"schema_version": 1, "max_custom_patch_lines": 0}, + head: {"schema_version": 1, "max_custom_patch_lines": 1}, + }, + "previous_statuses": [ + { + "context": name, + "state": "success", + "creator": {"login": "github-actions[bot]"}, + "target_url": "https://github.com/openai/example/actions/runs/19", + } + for name in ( + "Castiron next / budget-only change", + "Castiron next / custom-code budget", + ) + ], + "current": pull, + "queue_nodes": [ + {"headCommit": {"oid": queue}, "pullRequest": {"number": 3, "headRefOid": head}} + ], + "runs_by_sha": { + head: [original(head, "pull_request", 12)], + queue: [original(queue, "merge_group", 14)], + }, + "context": { + "payload": {"workflow_run": dict(run)}, + "runId": 21, + "repo": {"owner": "openai", "repo": "example"}, + "serverUrl": "https://github.com", + }, + } + + def invoke(self, payload: dict[str, Any]) -> list[dict[str, Any]]: + return run_publisher("Re-evaluate current PR and queue after review changes", payload) + + def test_revokes_pr_and_queue_before_requesting_normal_re_evaluation(self) -> None: + result = self.invoke(self.payload()) + self.assertEqual([item.get("state") for item in result[:4]], ["pending"] * 4) + self.assertEqual({item["sha"] for item in result[:4]}, {"a" * 40, "c" * 40}) + self.assertTrue(all(item["context"].startswith("Castiron next /") for item in result[:4])) + self.assertEqual([item["run_id"] for item in result[4:]], [12, 14]) + self.assertNotIn("success", [item.get("state") for item in result]) + + def test_retries_policy_failure_when_main_advances_before_revocation(self) -> None: + payload = self.payload() + payload["main_sha_sequence"] = ["d" * 40, "e" * 40] + payload["main_sha"] = "e" * 40 + payload["policy_error_sequence"] = [True, False] + result = self.invoke(payload) + self.assertEqual([item.get("state") for item in result[:4]], ["pending"] * 4) + self.assertEqual({item["sha"] for item in result[:4]}, {"a" * 40, "c" * 40}) + self.assertEqual([item["run_id"] for item in result[4:]], [12, 14]) + + def approval(self) -> dict[str, Any]: + return { + "fullDatabaseId": "101", + "state": "APPROVED", + "body": policy.HUMAN_REVIEW_RULES["attestation_prefix"] + "a" * 40, + "author": {"login": "reviewer", "__typename": "User"}, + "authorAssociation": "MEMBER", + "commit": {"oid": "a" * 40}, + "updatedAt": "2026-10-22T01:00:00Z", + } + + def recovery(self) -> dict[str, Any]: + payload = self.payload() + payload["review_nodes"] = [self.approval()] + payload["run"]["actor"] = {"login": "reviewer", "type": "User"} + for status in payload["previous_statuses"]: + status["state"] = "failure" + return payload + + def history(self, payload: dict[str, Any], writes: list[dict[str, Any]]) -> None: + payload["statuses_by_sha"] = { + sha: [ + {**item, "creator": {"login": "github-actions[bot]"}} + for item in writes + if item.get("sha") == sha + ] + for sha in ("a" * 40, "c" * 40) + } + payload["runs_by_id"] = { + "21": { + "id": 21, + "workflow_id": 789, + "status": "completed", + "conclusion": "success", + "repository": {"full_name": "openai/example"}, + "event": "workflow_run", + } + } + + def test_unrelated_comment_cannot_invalidate_valid_approval_or_request_recovery(self) -> None: + for state in ("success", "failure", "pending"): + payload = self.recovery() + payload["run"]["actor"]["login"] = "outsider" + payload["review_nodes"].append( + { + **self.approval(), + "fullDatabaseId": "102", + "author": {"login": "outsider", "__typename": "User"}, + "state": "COMMENTED", + "body": "hello", + } + ) + for status in payload["previous_statuses"]: + status["state"] = state + payload["forbid_queue"] = True + self.assertEqual(self.invoke(payload), []) + + def test_ineligible_review_cannot_request_recovery(self) -> None: + for overrides in ( + {"state": "COMMENTED"}, + {"body": ""}, + {"authorAssociation": "CONTRIBUTOR"}, + {"commit": {"oid": "b" * 40}}, + {"author": {"login": "author", "__typename": "User"}}, + {"author": {"login": "reviewer", "__typename": "Bot"}}, + ): + with self.subTest(overrides=overrides): + payload = self.recovery() + payload["review_nodes"][0].update(overrides) + self.assertEqual(self.invoke(payload), []) + + def test_repeated_invalid_signals_do_not_rerun_already_revoked_heads(self) -> None: + payload = self.payload() + writes = self.invoke(payload) + self.history(payload, writes) + self.assertEqual(self.invoke(payload), []) + for statuses in payload["statuses_by_sha"].values(): + for status in statuses: + status["state"] = "failure" + self.assertEqual(self.invoke(payload), []) + + def test_approval_recovery_coalesces_and_edited_restoration_recovers_again(self) -> None: + payload = self.recovery() + writes = self.invoke(payload) + self.assertEqual(len(writes), 6) + self.assertTrue(all(len(item["description"]) <= 140 for item in writes[:4])) + self.history(payload, writes) + self.assertEqual(self.invoke(payload), []) + payload["review_nodes"][0]["updatedAt"] = "2026-10-22T01:02:00Z" + restored = self.invoke(payload) + self.assertEqual(len(restored), 6) + self.assertNotEqual(writes[0]["description"], restored[0]["description"]) + + def test_new_revocation_supersedes_old_recovery_even_with_equal_edit_timestamp(self) -> None: + payload = self.recovery() + approved = self.invoke(payload) + self.history(payload, approved) + for statuses in payload["statuses_by_sha"].values(): + statuses[:0] = [ + {**status, "state": "success", "description": "Successful evaluation"} + for status in statuses + ] + payload["review_nodes"][0]["body"] = "" + revoked = self.invoke(payload) + self.assertEqual(len(revoked), 6) + self.history(payload, revoked) + for sha, statuses in payload["statuses_by_sha"].items(): + statuses.extend( + {**item, "creator": {"login": "github-actions[bot]"}} + for item in approved + if item.get("sha") == sha + ) + payload["review_nodes"][0] = ( + self.approval() + ) # Same ID, body and second-precision update time. + self.assertEqual(len(self.invoke(payload)), 6) + + def test_full_review_id_handles_current_and_beyond_safe_integer_ids(self) -> None: + payload = self.recovery() + payload["review_nodes"][0].update(databaseId=None, fullDatabaseId="5614624241") + self.assertEqual(len(self.invoke(payload)), 6) + payload = self.payload() + payload["review_nodes"] = [ + {**self.approval(), "databaseId": None, "fullDatabaseId": "9007199254740992"}, + { + **self.approval(), + "databaseId": None, + "fullDatabaseId": "9007199254740993", + "state": "COMMENTED", + }, + ] + self.assertEqual(len(self.invoke(payload)), 6) + payload["review_nodes"][0]["fullDatabaseId"] = 9007199254740992 + with self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + + def test_publisher_failure_supersedes_recovery_without_observed_revocation(self) -> None: + payload = self.recovery() + approved = self.invoke(payload) + self.history(payload, approved) + for statuses in payload["statuses_by_sha"].values(): + statuses[:0] = [ + {**status, "state": "failure", "description": "Approval missing during publication"} + for status in statuses + ] + # Publisher observed invalid body; review jobs only see its same-second restoration. + # No new review identity/timestamp and no review-handler revocation marker exists. + recovered = self.invoke(payload) + self.assertEqual(len(recovered), 6) + self.history(payload, recovered) + self.assertEqual(self.invoke(payload), []) + + def test_deleted_marker_writer_is_untrusted_but_service_errors_propagate(self) -> None: + payload = self.recovery() + approved = self.invoke(payload) + self.history(payload, approved) + payload["run_errors"] = {"21": 404} + self.assertEqual(len(self.invoke(payload)), 6) + for status in (403, 429, 500): + payload["run_errors"]["21"] = status + with self.subTest(status=status), self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + + def test_failed_partial_dispatch_is_retried_before_signals_coalesce(self) -> None: + for authorized in (False, True): + for conclusion in ("failure", "cancelled", "timed_out"): + payload = self.recovery() if authorized else self.payload() + payload["fail_rerun"] = True + # The fixture persists actual pending writes before the simulated API error. + with tempfile.TemporaryDirectory() as directory: + capture = Path(directory) / "pending.json" + payload["capture_writes"] = str(capture) + with self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + pending = json.loads(capture.read_text()) + self.assertEqual(len(pending), 4) + self.history(payload, pending) + payload.pop("capture_writes") + payload.pop("fail_rerun") + payload["runs_by_id"]["21"]["conclusion"] = conclusion + payload["context"]["runId"] = 22 + retried = self.invoke(payload) + self.assertEqual([item["run_id"] for item in retried if "run_id" in item], [12, 14]) + self.history(payload, retried) + payload["runs_by_id"]["22"] = {**payload["runs_by_id"]["21"], "id": 22} + self.assertEqual(self.invoke(payload), []) + + def test_untrusted_marker_cannot_suppress_recovery(self) -> None: + for field, value in ( + ("workflow_id", 999), + ("event", "pull_request"), + ("repository", {"full_name": "attacker/example"}), + ): + payload = self.recovery() + self.history(payload, self.invoke(payload)) + payload["runs_by_id"]["21"][field] = value + self.assertEqual(len(self.invoke(payload)), 6) + + def test_dismissal_edit_away_and_later_comment_revoke_even_for_other_signal_actor(self) -> None: + for changed in ( + {"state": "DISMISSED"}, + {"body": ""}, + {"state": "COMMENTED", "fullDatabaseId": "102"}, + ): + payload = self.payload() + payload["review_nodes"] = [{**self.approval(), **changed}] + self.assertEqual(len(self.invoke(payload)), 6) + payload = self.payload() + payload["review_pages"] = [ + { + "expected_cursor": None, + "nodes": [{**self.approval(), "fullDatabaseId": "102", "state": "COMMENTED"}], + "pageInfo": {"hasNextPage": True, "endCursor": "more"}, + }, + { + "expected_cursor": "more", + "nodes": [self.approval()], + "pageInfo": {"hasNextPage": False}, + }, + ] + self.assertEqual(len(self.invoke(payload)), 6) + + def test_missing_authoritative_edit_time_rejects_recovery(self) -> None: + payload = self.recovery() + payload["review_nodes"][0]["updatedAt"] = None + with self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + + def test_review_signal_requires_canonical_workflow_identity_before_writes(self) -> None: + for identity in (None, "456", 999): + for path in ( + ".github/workflows/castiron-custom-code.yml", + ".github/workflows/castiron-custom-code.yml@evil.yml", + ): + with self.subTest(identity=identity, path=path): + payload = self.payload() + payload["run"].update({"workflow_id": identity, "path": path}) + payload["context"]["payload"]["workflow_run"] = dict(payload["run"]) + self.assertEqual(self.invoke(payload), []) + + def test_rejects_forged_or_superseded_review_signals(self) -> None: + for field, value in [ + ("path", ".github/workflows/other.yml"), + ("run_attempt", 9), + ("head_sha", "d" * 40), + ("event", "pull_request"), + ]: + with self.subTest(field=field): + payload = self.payload() + payload["run"][field] = value + with self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + payload = self.payload() + payload["run"]["repository"] = {"full_name": "attacker/example"} + with self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + + def test_head_change_keeps_observed_statuses_revoked_without_stale_reruns(self) -> None: + payload = self.payload() + changed = {**payload["current"], "head": {"sha": "d" * 40}} + payload["current_sequence"] = [payload["current"], changed] + payload["current"] = changed + result = self.invoke(payload) + self.assertEqual(len(result), 4) + self.assertTrue(all(item["state"] == "pending" for item in result)) + self.assertNotIn("d" * 40, {item["sha"] for item in result}) + + def test_queue_change_retries_and_invalidates_new_snapshot(self) -> None: + payload = self.payload() + old = list(payload["queue_nodes"]) + payload["queue_nodes"].append( + { + "headCommit": {"oid": "d" * 40}, + "pullRequest": {"number": 4, "headRefOid": "e" * 40}, + } + ) + payload["runs_by_sha"]["d" * 40] = [ + { + **payload["runs_by_sha"]["c" * 40][0], + "head_sha": "d" * 40, + "id": 16, + } + ] + payload["queue_pages"] = [ + { + "expected_cursor": None, + "nodes": old, + "pageInfo": {"hasNextPage": False}, + } + ] + result = self.invoke(payload) + pending = [item for item in result if item.get("state") == "pending"] + self.assertEqual({item["sha"] for item in pending}, {"a" * 40, "c" * 40, "d" * 40}) + self.assertEqual([item["run_id"] for item in result if "run_id" in item], [12, 14, 16]) + self.assertTrue(all(item.get("state") == "pending" for item in result[:-3])) + + def test_empty_review_pr_list_uses_authenticated_fork_discovery(self) -> None: + for associated in ([], [{"number": 3}]): + payload = self.payload() + payload["run"].update( + { + "pull_requests": [], + "head_repository": {"owner": {"login": "contributor"}}, + "head_branch": "sdk", + } + ) + payload["associated_pulls"] = associated + payload["fallback_pulls"] = [{"number": 3}] + self.assertEqual(len(self.invoke(payload)), 6) + payload["current"]["head"]["sha"] = "d" * 40 + payload["merge_sha"] = "e" * 40 + payload["merge_commit"] = {"parents": []} + self.assertEqual(self.invoke(payload), []) + + def test_shared_head_revokes_the_run_source_pr(self) -> None: + payload = self.payload() + payload["run"]["pull_requests"] = [] + payload["run"]["head_repository"]["id"] = 101 + payload["current"]["head"].update(ref="sdk", repo={"id": 101}) + payload["associated_pulls"] = [{"number": number} for number in (3, 4, 5)] + payload["pulls_by_number"] = { + str(number): { + **payload["current"], + "number": number, + "head": {**payload["current"]["head"], **change}, + } + for number, change in ((4, {"ref": "other"}), (5, {"repo": {"id": 102}})) + } + result = self.invoke(payload) + self.assertEqual([item.get("state") for item in result[:4]], ["pending"] * 4) + self.assertEqual({item["sha"] for item in result[:4]}, {"a" * 40, "c" * 40}) + + def test_branch_only_merge_signal_requires_current_merge_and_base(self) -> None: + payload = self.payload() + payload["run"]["pull_requests"] = [] + payload["run"]["head_sha"] = payload["context"]["payload"]["workflow_run"]["head_sha"] = ( + "e" * 40 + ) + payload["fallback_pulls"] = [{"number": 3}] + payload["merge_commit"] = {"parents": [{"sha": "b" * 40}, {"sha": "a" * 40}]} + payload["merge_sha"] = "f" * 40 + self.assertEqual(self.invoke(payload), []) + + payload["merge_sha"] = "e" * 40 + self.assertEqual(len(self.invoke(payload)), 6) + payload["current"]["base"]["sha"] = "d" * 40 + payload["comparisons"] = { + f"{'d' * 40}...{'a' * 40}": {"merge_base_commit": {"sha": "b" * 40}} + } + self.assertEqual(self.invoke(payload), []) + + def test_merge_sha_signal_survives_base_advance_and_rejects_wrong_parents(self) -> None: + payload = self.payload() + payload["run"]["head_sha"] = payload["context"]["payload"]["workflow_run"]["head_sha"] = ( + "e" * 40 + ) + payload["current"]["base"]["sha"] = "d" * 40 + payload["comparisons"] = { + f"{'d' * 40}...{'a' * 40}": {"merge_base_commit": {"sha": "b" * 40}} + } + payload["merge_commit"] = {"parents": [{"sha": "b" * 40}, {"sha": "a" * 40}]} + self.assertEqual(len(self.invoke(payload)), 6) + payload["comparisons"][f"{'b' * 40}...{'d' * 40}"] = { + "merge_base_commit": {"sha": "f" * 40} + } + self.assertEqual(self.invoke(payload), []) + payload["merge_commit"]["parents"].reverse() + self.assertEqual(self.invoke(payload), []) + + def test_trusted_policy_decision_controls_revocation(self) -> None: + payload = self.payload() + payload["requires_human"] = False + self.assertEqual(self.invoke(payload), []) + payload["requires_human"] = True + self.assertEqual(len(self.invoke(payload)), 6) + + def test_policy_failure_or_malformed_decision_cannot_write_statuses(self) -> None: + for result in ({"policy_error": True}, {"requires_human": "false"}): + with self.subTest(result=result), tempfile.TemporaryDirectory() as directory: + payload = {**self.payload(), **result} + capture = Path(directory) / "writes.json" + payload["capture_writes"] = str(capture) + with self.assertRaises(subprocess.CalledProcessError): + self.invoke(payload) + self.assertEqual(json.loads(capture.read_text()), []) + + def test_revoked_go_ratchet_activation_invalidates_pr_and_queue_statuses(self) -> None: + for changed in ({"state": "DISMISSED"}, {"body": ""}): + with self.subTest(changed=changed): + payload = self.payload() + payload["policies_by_sha"]["a" * 40] = { + **payload["policies_by_sha"]["b" * 40], + "ratchet": "go", + } + payload["review_nodes"] = [{**self.approval(), **changed}] + writes = self.invoke(payload) + self.assertCountEqual( + [(item["sha"], item["state"]) for item in writes if "state" in item], + [("a" * 40, "pending")] * 2 + [("c" * 40, "pending")] * 2, + ) + self.assertCountEqual( + [item["run_id"] for item in writes if "run_id" in item], [12, 14] + ) + + def test_closed_or_superseded_review_is_a_no_op(self) -> None: + for changed in ({"state": "closed"}, {"head": {"sha": "f" * 40}}): + payload = self.payload() + payload["current"].update(changed) + self.assertEqual(self.invoke(payload), []) + + def test_null_queue_association_does_not_block_revocation(self) -> None: + payload = self.payload() + payload["queue_nodes"].insert(0, {"headCommit": {"oid": "f" * 40}, "pullRequest": None}) + result = self.invoke(payload) + self.assertEqual(len(result), 6) + self.assertNotIn("f" * 40, {item.get("sha") for item in result}) + payload["queue_nodes"] = payload["queue_nodes"][:1] + self.assertEqual(len(self.invoke(payload)), 3) + + def test_rerun_requires_the_reviewed_pr_not_just_shared_head(self) -> None: + payload = self.payload() + correct = payload["runs_by_sha"]["a" * 40][0] + main = { + **payload["current"], + "number": 4, + "base": {**payload["current"]["base"], "ref": "main"}, + } + payload["pulls_by_number"] = {"4": main} + other: dict[str, Any] = { + **correct, + "id": 30, + "pull_requests": [{"number": 4, "head": {"sha": "a" * 40}}], + } + payload["runs_by_sha"]["a" * 40].append(other) + result = self.invoke(payload) + self.assertEqual([item["run_id"] for item in result if "run_id" in item], [12, 14]) + # Empty fork associations may rerun only if canonical discovery selects this next PR. + fork: dict[str, Any] = { + **correct, + "pull_requests": [], + "head_repository": {"owner": {"login": "contributor"}}, + "head_branch": "sdk", + } + payload["fallback_pulls"] = [{"number": 3}] + payload["runs_by_sha"]["a" * 40] = [fork, other] + result = self.invoke(payload) + self.assertEqual([item["run_id"] for item in result if "run_id" in item], [12, 14]) + association_cases: tuple[list[dict[str, Any]], ...] = ( + [], + [*correct["pull_requests"], *other["pull_requests"]], + ) + for associations in association_cases: + payload["associated_pulls"] = [{"number": 3}, {"number": 4}] + payload["runs_by_sha"]["a" * 40] = [{**fork, "pull_requests": associations}, other] + result = self.invoke(payload) + self.assertEqual([item["run_id"] for item in result if "run_id" in item], [14]) + self.assertTrue(all(item["state"] == "pending" for item in result[:4])) + + def test_unprepared_queue_entry_still_revokes_pr_statuses(self) -> None: + payload = self.payload() + payload["queue_nodes"][0]["headCommit"] = None + result = self.invoke(payload) + self.assertEqual([item.get("state") for item in result], ["pending", "pending", None]) + self.assertEqual(result[-1]["run_id"], 12) + + def test_unrelated_review_does_not_restart_reporter(self) -> None: + payload = self.payload() + payload["files"] = [{"filename": "src/client.ts"}] + self.assertEqual(self.invoke(payload), []) + + def test_no_success_or_foreign_run_can_be_published(self) -> None: + payload = self.payload() + payload["runs_by_sha"]["a" * 40][0]["repository"] = {"full_name": "other/repo"} + result = self.invoke(payload) + self.assertEqual( + [item["run_id"] for item in result if item.get("operation") == "rerun"], [14] + ) + self.assertTrue(all(item.get("state") != "success" for item in result)) + + def test_signal_is_unprivileged_and_writers_serialize(self) -> None: + producer = (WORKFLOW.parent / "castiron-custom-code.yml").read_text() + self.assertIn("pull_request_review:\n types: [submitted, edited, dismissed]", producer) + signal = producer.split(" queue-signal:\n", 1)[1].split(" candidate-tests:\n", 1)[0] + self.assertIn("permissions: {}", signal) + self.assertNotIn("checkout@", signal) + handler = WORKFLOW.read_text() + revoke = handler.split(" review-change:\n", 1)[1].split(" compute:\n", 1)[0] + self.assertIn("ref: ${{ github.workflow_sha }}", revoke) + self.assertIn("persist-credentials: false", revoke) + self.assertNotIn("ref: ${{ github.event", revoke) + self.assertIn("custom_code_policy.py', 'review-required'", revoke) + self.assertNotIn("download-artifact", revoke) + self.assertEqual( + handler.count("group: castiron-budget-writes-${{ github.repository_id }}"), 2 + ) + + +if __name__ == "__main__": + unittest.main()