diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 3a2f436..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": [ - "standard", - "plugin:jsdoc/recommended-typescript-flavor" - ], - "rules": { - "dot-notation": "off", - "quote-props": "off", - "jsdoc/require-returns": "off", - "jsdoc/require-returns-description": "off", - "jsdoc/require-param-description": "off", - "jsdoc/valid-types": "off", - "jsdoc/require-jsdoc": "off" - } -} diff --git a/.github/assets/logo.webp b/.github/assets/logo.webp new file mode 100644 index 0000000..7dd715c Binary files /dev/null and b/.github/assets/logo.webp differ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d53c3b9..c2c87af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,19 +1,19 @@ name: Tests on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: test: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - - name: Install dependencies - run: npm install - - name: Run tests - run: npm test + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..91c8696 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.defaultFormatter": "dbaeumer.vscode-eslint" +} diff --git a/README.md b/README.md index aa0aff0..7856538 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ +![Types for your OpenAPI](.github/assets/logo.webp 'Types for your OpenAPI') + # openapi-box Generate [TypeBox](https://github.com/sinclairzx81/typebox) types from OpenApi `V3` IDL + End-to-end typesafe HTTP client library. > It works for TypeScript and JavaScript. ![Tests](https://github.com/geut/openapi-box/actions/workflows/test.yml/badge.svg) -[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat)](https://standardjs.com) +[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard--ext-05ae89.svg)](https://github.com/tinchoz49/eslint-config-standard-ext) [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat)](https://github.com/RichardLitt/standard-readme) [![Made by GEUT][geut-badge]][geut-url] @@ -17,7 +19,6 @@ $ npm install @geut/openapi-box @sinclair/typebox ## Usage - 1. Generate the schema from an OpenApi url (it can a be filepath too): ```bash $ openapi-box https://petstore3.swagger.io/api/v3/openapi.json @@ -25,8 +26,8 @@ $ openapi-box https://petstore3.swagger.io/api/v3/openapi.json 2. Load your schemas into the End-to-end typesafe `fetch` client: ```js -import { createClient } from './src/client.js' import { schema } from './schema.js' +import { createClient } from './src/client.js' const client = createClient({ schema, diff --git a/bin/cli.js b/bin/cli.js index d4bd466..86060e2 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -1,7 +1,9 @@ #!/usr/bin/env node -import { writeFile } from 'fs/promises' -import ora from 'ora' +import { writeFile } from 'node:fs/promises' + import meow from 'meow' +import ora from 'ora' + import { write } from '../src/writer.js' const cli = meow(` @@ -26,22 +28,22 @@ const cli = meow(` output: { type: 'string', shortFlag: 'o', - default: 'schema.js' + default: 'schema.js', }, header: { type: 'string', shortFlag: 'h', - isMultiple: true + isMultiple: true, }, cjs: { type: 'boolean', - default: false + default: false, }, removePrefix: { type: 'string', - shortFlag: 'r' - } - } + shortFlag: 'r', + }, + }, }) if (cli.input.length === 0) { @@ -53,7 +55,7 @@ const input = cli.input[0] const spinner = ora(`Generating schema from ${input}`).start() const headers = {} -cli.flags.header.forEach(header => { +cli.flags.header.forEach((header) => { const splitIdx = header.indexOf('=') if (splitIdx === -1) { spinner.fail('Fetch: the header provided is not valid, it must be: key=value') @@ -69,7 +71,7 @@ try { schema = await write(input, { cjs: cli.flags.cjs, headers, - removePrefix: cli.flags.removePrefix + removePrefix: cli.flags.removePrefix, }) } catch (err) { spinner.fail(err.message) diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..425bcca --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import { standard } from 'eslint-config-standard-ext' + +export default standard() diff --git a/package.json b/package.json index 189fdff..33ea1f8 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,51 @@ { "name": "@geut/openapi-box", + "type": "module", "version": "4.0.0", "description": "Generate TypeBox types from OpenApi IDL + End-to-end typesafe HTTP client library.", - "type": "module", "browser": "./dist/client.cjs", - "main": "./dist/client.cjs", - "bin": "./bin/cli.js", + "author": { + "name": "GEUT", + "email": "contact@geutstudio.com" + }, + "license": "MIT", + "homepage": "https://github.com/geut/openapi-box#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/geut/openapi-box.git" + }, + "bugs": { + "url": "https://github.com/geut/openapi-box/issues" + }, + "keywords": [ + "create", + "geut", + "module" + ], "exports": { ".": { - "require": "./dist/client.cjs", - "import": "./dist/client.js" + "import": "./dist/client.js", + "require": "./dist/client.cjs" }, "./writer": { - "require": "./dist/writer.cjs", - "import": "./dist/writer.js" + "import": "./dist/writer.js", + "require": "./dist/writer.cjs" }, "./package.json": "./package.json" }, + "main": "./dist/client.cjs", + "bin": "./bin/cli.js", "files": [ - "src", + "bin", "dist", - "bin" + "src" ], "scripts": { "start": "node index.js", "build": "tsup src/client.js src/writer.js --dts --format esm,cjs", "test": "node --test", "posttest": "npm run lint", - "lint": "eslint", + "lint": "eslint .", "test:types": "tsc", "prepublishOnly": "npm test && npm run build" }, @@ -49,6 +67,7 @@ "@sinclair/typebox": "^0.31.17", "@types/node": "^20.6.2", "eslint": "^8.46.0", + "eslint-config-standard-ext": "^0.0.27", "eslint-plugin-jsdoc": "^46.8.1", "expect-type": "^0.16.0", "fastify": "^4.21.0", @@ -64,24 +83,6 @@ "browser" ] }, - "repository": { - "type": "git", - "url": "git+https://github.com/geut/openapi-box.git" - }, - "keywords": [ - "create", - "geut", - "module" - ], - "author": { - "name": "GEUT", - "email": "contact@geutstudio.com" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/geut/openapi-box/issues" - }, - "homepage": "https://github.com/geut/openapi-box#readme", "publishConfig": { "access": "public" } diff --git a/schema.js b/schema.js new file mode 100644 index 0000000..d0b5eb9 --- /dev/null +++ b/schema.js @@ -0,0 +1,4523 @@ +/* eslint-disable */ +// This document was generated automatically by openapi-box + +/** + * @typedef {import('@sinclair/typebox').TSchema} TSchema + */ + +/** + * @template {TSchema} T + * @typedef {import('@sinclair/typebox').Static} Static + */ + +/** + * @typedef {{ + * [Path in keyof typeof schema]: { + * [Method in keyof typeof schema[Path]]: { + * [Prop in keyof typeof schema[Path][Method]]: typeof schema[Path][Method][Prop] extends TSchema ? + * Static : + * undefined + * } + * } + * }} SchemaType + */ + +/** + * @typedef {{ + * [ComponentType in keyof typeof _components]: { + * [ComponentName in keyof typeof _components[ComponentType]]: typeof _components[ComponentType][ComponentName] extends TSchema ? + * Static : + * undefined + * } + * }} ComponentType + */ + +/** @typedef {Json[]} JsonArray */ +/** @typedef {{ [key: string | number]: Json }} JsonRecord */ +/** @typedef {string} JsonString */ +/** @typedef {number} JsonNumber */ +/** @typedef {boolean} JsonBoolean */ +/** @typedef {null} JsonNull */ +/** @typedef {JsonArray | JsonRecord | JsonString | JsonNumber | JsonBoolean | JsonNull} Json */ + +import { Type as T } from '@sinclair/typebox' + +/** + * @param {JsonArray | JsonRecord} [options] + * @returns {ReturnType>} + */ +const Json = (options) => T.Unsafe(T.Any(options)) + +const cache = {} +cache['20c72cefd4115c5920c89a5193a743ac'] = T.Any() +cache['6afc2f3de56499317e8d80e2cba2c553'] = [ + T.Literal('gpt-4o'), + T.Literal('gpt-4o-2024-05-13'), + T.Literal('gpt-4o-mini'), + T.Literal('gpt-4o-mini-2024-07-18'), + T.Literal('gpt-4-turbo'), + T.Literal('gpt-4-turbo-2024-04-09'), + T.Literal('gpt-4-0125-preview'), + T.Literal('gpt-4-turbo-preview'), + T.Literal('gpt-4-1106-preview'), + T.Literal('gpt-4-vision-preview'), + T.Literal('gpt-4'), + T.Literal('gpt-4-0314'), + T.Literal('gpt-4-0613'), + T.Literal('gpt-4-32k'), + T.Literal('gpt-4-32k-0314'), + T.Literal('gpt-4-32k-0613'), + T.Literal('gpt-3.5-turbo'), + T.Literal('gpt-3.5-turbo-16k'), + T.Literal('gpt-3.5-turbo-0301'), + T.Literal('gpt-3.5-turbo-0613'), + T.Literal('gpt-3.5-turbo-1106'), + T.Literal('gpt-3.5-turbo-0125'), + T.Literal('gpt-3.5-turbo-16k-0613') +] +cache['583c58b4f91750353b4839ef195a45e7'] = [ + T.String(), + T.Union(cache['6afc2f3de56499317e8d80e2cba2c553']) +] +cache['8b0e105455b8873220c3f6768304fb8c'] = [ + T.Literal('text'), + T.Literal('json_object') +] +cache['a78b3d57182ec82d9a9cc20e003f1569'] = { + type: T.Optional( + T.Union(cache['8b0e105455b8873220c3f6768304fb8c'], { default: 'text' }) + ) +} +cache['e2128d8ebeddc50aaab8b8dc0c18eac2'] = [ + T.Literal('auto'), + T.Literal('default') +] +cache['35aebd667abc35dedb7a3bb43497761e'] = { + include_usage: T.Optional(T.Boolean()) +} +cache['78a70c640dc014fc048915402571c97d'] = [T.Literal('function')] +cache['8a0e72bd020a90249508a3d6f36a7983'] = { + description: T.Optional(T.String()), + name: T.String(), + parameters: T.Optional(Json({ additionalProperties: true })) +} +cache['a3ce909949dc5ef8380a9acaeba1efc9'] = { + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Object(cache['8a0e72bd020a90249508a3d6f36a7983']) +} +cache['69c83e993b83a184c6641fcad3e2fa79'] = T.Object( + cache['a3ce909949dc5ef8380a9acaeba1efc9'] +) +cache['ab96fa8a32fc1d3f3c8ebfa94ced647b'] = T.Object( + cache['8a0e72bd020a90249508a3d6f36a7983'] +) +cache['533ef2a989ee66dde5feefb7207aadef'] = { + messages: T.Array(cache['20c72cefd4115c5920c89a5193a743ac'], { minItems: 1 }), + model: T.Union(cache['583c58b4f91750353b4839ef195a45e7']), + frequency_penalty: T.Optional( + T.Number({ default: 0, minimum: -2, maximum: 2 }) + ), + logit_bias: T.Optional( + Json({ default: null, additionalProperties: { type: 'integer' } }) + ), + logprobs: T.Optional(T.Boolean({ default: false })), + top_logprobs: T.Optional(T.Integer({ minimum: 0, maximum: 20 })), + max_tokens: T.Optional(T.Integer()), + n: T.Optional(T.Integer({ minimum: 1, maximum: 128, default: 1 })), + presence_penalty: T.Optional( + T.Number({ default: 0, minimum: -2, maximum: 2 }) + ), + response_format: T.Optional( + T.Object(cache['a78b3d57182ec82d9a9cc20e003f1569']) + ), + seed: T.Optional( + T.Integer({ minimum: -9223372036854776000, maximum: 9223372036854776000 }) + ), + service_tier: T.Optional( + T.Union(cache['e2128d8ebeddc50aaab8b8dc0c18eac2'], { default: null }) + ), + stop: T.Any(), + stream: T.Optional(T.Boolean({ default: false })), + stream_options: T.Optional( + T.Object(cache['35aebd667abc35dedb7a3bb43497761e'], { default: null }) + ), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + tools: T.Optional(T.Array(cache['69c83e993b83a184c6641fcad3e2fa79'])), + tool_choice: T.Any(), + parallel_tool_calls: T.Optional(T.Boolean({ default: true })), + user: T.Optional(T.String()), + function_call: T.Any(), + functions: T.Optional( + T.Array(cache['ab96fa8a32fc1d3f3c8ebfa94ced647b'], { + minItems: 1, + maxItems: 128 + }) + ) +} +cache['80f632106afbb77a2a122509e0f8a574'] = [ + T.Literal('stop'), + T.Literal('length'), + T.Literal('tool_calls'), + T.Literal('content_filter'), + T.Literal('function_call') +] +cache['05ff07bcc9e465866a065f014be2b0d0'] = { + name: T.String(), + arguments: T.String() +} +cache['9856d7691d59a2ed419325465faf362a'] = { + id: T.String(), + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Object(cache['05ff07bcc9e465866a065f014be2b0d0']) +} +cache['0834704c8cede1f92348ff754bdd80f6'] = T.Object( + cache['9856d7691d59a2ed419325465faf362a'] +) +cache['9539c841c419e9057d56191a46591cf8'] = [T.Literal('assistant')] +cache['899461ac8356aa55071c26ee56ef1c92'] = { + arguments: T.String(), + name: T.String() +} +cache['c69b0c46ff5553dbc0c5254e9e735ca5'] = { + content: T.String(), + tool_calls: T.Optional(T.Array(cache['0834704c8cede1f92348ff754bdd80f6'])), + role: T.Union(cache['9539c841c419e9057d56191a46591cf8']), + function_call: T.Optional(T.Object(cache['899461ac8356aa55071c26ee56ef1c92'])) +} +cache['987434f426a7002fc01406e2ac533c03'] = T.Integer() +cache['19d1098a9e291245a8f0e63ced10d0f6'] = { + token: T.String(), + logprob: T.Number(), + bytes: T.Array(cache['987434f426a7002fc01406e2ac533c03']) +} +cache['bb5fdb78b0869fada28b0e4f32b6fd19'] = T.Object( + cache['19d1098a9e291245a8f0e63ced10d0f6'] +) +cache['32aecf538dc34400550f8feaa639c90b'] = { + token: T.String(), + logprob: T.Number(), + bytes: T.Array(cache['987434f426a7002fc01406e2ac533c03']), + top_logprobs: T.Array(cache['bb5fdb78b0869fada28b0e4f32b6fd19']) +} +cache['0f9a43f024a72d82be5df274008c89b5'] = T.Object( + cache['32aecf538dc34400550f8feaa639c90b'] +) +cache['17d3e5e8d5448d06d73754b3715983b8'] = { + content: T.Array(cache['0f9a43f024a72d82be5df274008c89b5']) +} +cache['cd04bd14d22539d28b5c8c09faa12996'] = { + finish_reason: T.Union(cache['80f632106afbb77a2a122509e0f8a574']), + index: T.Integer(), + message: T.Object(cache['c69b0c46ff5553dbc0c5254e9e735ca5']), + logprobs: T.Object(cache['17d3e5e8d5448d06d73754b3715983b8']) +} +cache['d53fb9768e628d20b49a9e7a51b221c2'] = T.Object( + cache['cd04bd14d22539d28b5c8c09faa12996'] +) +cache['197d31a87efdf23d5275a95185387ba2'] = [ + T.Literal('scale'), + T.Literal('default') +] +cache['6d34b7b60d069faa302d136f5f9af1e5'] = [T.Literal('chat.completion')] +cache['26b974e6ea7bd3e6b1a26b3f0b24db14'] = { + completion_tokens: T.Integer(), + prompt_tokens: T.Integer(), + total_tokens: T.Integer() +} +cache['b4247ecaa0539243e803718b73c0ea20'] = { + id: T.String(), + choices: T.Array(cache['d53fb9768e628d20b49a9e7a51b221c2']), + created: T.Integer(), + model: T.String(), + service_tier: T.Optional(T.Union(cache['197d31a87efdf23d5275a95185387ba2'])), + system_fingerprint: T.Optional(T.String()), + object: T.Union(cache['6d34b7b60d069faa302d136f5f9af1e5']), + usage: T.Optional(T.Object(cache['26b974e6ea7bd3e6b1a26b3f0b24db14'])) +} +cache['e327ee8056d7b68441b772b9a15a5fde'] = [ + T.Literal('gpt-3.5-turbo-instruct'), + T.Literal('davinci-002'), + T.Literal('babbage-002') +] +cache['dd6bc9c8e7384816c01976c2d7fa016f'] = [ + T.String(), + T.Union(cache['e327ee8056d7b68441b772b9a15a5fde']) +] +cache['ab1eaa61a000e22a30970151a2dbdae3'] = { + model: T.Union(cache['dd6bc9c8e7384816c01976c2d7fa016f']), + prompt: T.Any(), + best_of: T.Optional(T.Integer({ default: 1, minimum: 0, maximum: 20 })), + echo: T.Optional(T.Boolean({ default: false })), + frequency_penalty: T.Optional( + T.Number({ default: 0, minimum: -2, maximum: 2 }) + ), + logit_bias: T.Optional( + Json({ default: null, additionalProperties: { type: 'integer' } }) + ), + logprobs: T.Optional(T.Integer({ minimum: 0, maximum: 5, default: null })), + max_tokens: T.Optional(T.Integer({ minimum: 0, default: 16 })), + n: T.Optional(T.Integer({ minimum: 1, maximum: 128, default: 1 })), + presence_penalty: T.Optional( + T.Number({ default: 0, minimum: -2, maximum: 2 }) + ), + seed: T.Optional( + T.Integer({ minimum: -9223372036854776000, maximum: 9223372036854776000 }) + ), + stop: T.Any(), + stream: T.Optional(T.Boolean({ default: false })), + stream_options: T.Optional( + T.Object(cache['35aebd667abc35dedb7a3bb43497761e'], { default: null }) + ), + suffix: T.Optional(T.String({ default: null })), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + user: T.Optional(T.String()) +} +cache['55ff9a246f01e0bb7cdf862681370e23'] = [ + T.Literal('stop'), + T.Literal('length'), + T.Literal('content_filter') +] +cache['9f6218431a69f9e8706d01336b3e9914'] = T.Number() +cache['2809284b6e54d0d34017715ffe5636bd'] = T.String() +cache['2a0d563490dcb656be5c27a37522d189'] = Json({ + additionalProperties: { type: 'number' } +}) +cache['8be09a57cc7ea8597f4677ca8f15b829'] = { + text_offset: T.Optional(T.Array(cache['987434f426a7002fc01406e2ac533c03'])), + token_logprobs: T.Optional( + T.Array(cache['9f6218431a69f9e8706d01336b3e9914']) + ), + tokens: T.Optional(T.Array(cache['2809284b6e54d0d34017715ffe5636bd'])), + top_logprobs: T.Optional(T.Array(cache['2a0d563490dcb656be5c27a37522d189'])) +} +cache['3912fcbceb20c5f962b9478449425fc3'] = { + finish_reason: T.Union(cache['55ff9a246f01e0bb7cdf862681370e23']), + index: T.Integer(), + logprobs: T.Object(cache['8be09a57cc7ea8597f4677ca8f15b829']), + text: T.String() +} +cache['85304f864074a694ca6802605d36bd81'] = T.Object( + cache['3912fcbceb20c5f962b9478449425fc3'] +) +cache['4801d4d5414b9271bcfd61c4c3e2f430'] = [T.Literal('text_completion')] +cache['9e6c4887192a2980da29dc808136228b'] = { + id: T.String(), + choices: T.Array(cache['85304f864074a694ca6802605d36bd81']), + created: T.Integer(), + model: T.String(), + system_fingerprint: T.Optional(T.String()), + object: T.Union(cache['4801d4d5414b9271bcfd61c4c3e2f430']), + usage: T.Optional(T.Object(cache['26b974e6ea7bd3e6b1a26b3f0b24db14'])) +} +cache['73267142d4c574e0823dc51fcd6a57e7'] = [ + T.Literal('dall-e-2'), + T.Literal('dall-e-3') +] +cache['9b289227759b563d23f835a8bc596164'] = [ + T.String(), + T.Union(cache['73267142d4c574e0823dc51fcd6a57e7']) +] +cache['e9bb5370ea73196421042c48a824e1d9'] = [ + T.Literal('standard'), + T.Literal('hd') +] +cache['3d8c5e31bbb404d3340ad2a0580333a5'] = [ + T.Literal('url'), + T.Literal('b64_json') +] +cache['28cdc44e95a72ac61e6c6cffdc0bcde6'] = [ + T.Literal('256x256'), + T.Literal('512x512'), + T.Literal('1024x1024'), + T.Literal('1792x1024'), + T.Literal('1024x1792') +] +cache['6fdf3f4e3432e4f6e19bd82bad74f4ab'] = [ + T.Literal('vivid'), + T.Literal('natural') +] +cache['378c1a1d01596ebee6b7df5e0e964c34'] = { + prompt: T.String(), + model: T.Optional( + T.Union(cache['9b289227759b563d23f835a8bc596164'], { default: 'dall-e-2' }) + ), + n: T.Optional(T.Integer({ minimum: 1, maximum: 10, default: 1 })), + quality: T.Optional( + T.Union(cache['e9bb5370ea73196421042c48a824e1d9'], { default: 'standard' }) + ), + response_format: T.Optional( + T.Union(cache['3d8c5e31bbb404d3340ad2a0580333a5'], { default: 'url' }) + ), + size: T.Optional( + T.Union(cache['28cdc44e95a72ac61e6c6cffdc0bcde6'], { default: '1024x1024' }) + ), + style: T.Optional( + T.Union(cache['6fdf3f4e3432e4f6e19bd82bad74f4ab'], { default: 'vivid' }) + ), + user: T.Optional(T.String()) +} +cache['11a791cdcf68079c8dfbde956e16407a'] = { + b64_json: T.Optional(T.String()), + url: T.Optional(T.String()), + revised_prompt: T.Optional(T.String()) +} +cache['74c7df8ff1614c30b313941d4e08c592'] = T.Object( + cache['11a791cdcf68079c8dfbde956e16407a'] +) +cache['6a214a678d3d983724191d71f53d3882'] = { + created: T.Integer(), + data: T.Array(cache['74c7df8ff1614c30b313941d4e08c592']) +} +cache['6a9bfd1893562361f46f3b50873bc5bc'] = [T.Literal('dall-e-2')] +cache['71c7fec47e3132ba29f0626344fd01e0'] = [ + T.String(), + T.Union(cache['6a9bfd1893562361f46f3b50873bc5bc']) +] +cache['51be0f8aba8aba708eb29175d7efbe20'] = [ + T.Literal('256x256'), + T.Literal('512x512'), + T.Literal('1024x1024') +] +cache['e8f2c6f7f880ca40d8d13f2c1b49b320'] = { + image: T.String({ format: 'binary' }), + prompt: T.String(), + mask: T.Optional(T.String({ format: 'binary' })), + model: T.Optional( + T.Union(cache['71c7fec47e3132ba29f0626344fd01e0'], { default: 'dall-e-2' }) + ), + n: T.Optional(T.Integer({ minimum: 1, maximum: 10, default: 1 })), + size: T.Optional( + T.Union(cache['51be0f8aba8aba708eb29175d7efbe20'], { default: '1024x1024' }) + ), + response_format: T.Optional( + T.Union(cache['3d8c5e31bbb404d3340ad2a0580333a5'], { default: 'url' }) + ), + user: T.Optional(T.String()) +} +cache['fb2088789c6c61b655eb04b8ce15611a'] = { + image: T.String({ format: 'binary' }), + model: T.Optional( + T.Union(cache['71c7fec47e3132ba29f0626344fd01e0'], { default: 'dall-e-2' }) + ), + n: T.Optional(T.Integer({ minimum: 1, maximum: 10, default: 1 })), + response_format: T.Optional( + T.Union(cache['3d8c5e31bbb404d3340ad2a0580333a5'], { default: 'url' }) + ), + size: T.Optional( + T.Union(cache['51be0f8aba8aba708eb29175d7efbe20'], { default: '1024x1024' }) + ), + user: T.Optional(T.String()) +} +cache['f94c445fd23a9f2f7f928b706d768ca0'] = [ + T.Literal('text-embedding-ada-002'), + T.Literal('text-embedding-3-small'), + T.Literal('text-embedding-3-large') +] +cache['cfc82e1b60db51227078abafff30bbae'] = [ + T.String(), + T.Union(cache['f94c445fd23a9f2f7f928b706d768ca0']) +] +cache['c78dba0818b79736ec95c780f0ea6993'] = [ + T.Literal('float'), + T.Literal('base64') +] +cache['ccdf2e80da8a26530863685b9ab4c67f'] = { + input: T.Any(), + model: T.Union(cache['cfc82e1b60db51227078abafff30bbae']), + encoding_format: T.Optional( + T.Union(cache['c78dba0818b79736ec95c780f0ea6993'], { default: 'float' }) + ), + dimensions: T.Optional(T.Integer({ minimum: 1 })), + user: T.Optional(T.String()) +} +cache['fcb63603ee8609e6d3a054eb7f349098'] = [T.Literal('embedding')] +cache['92a40676f0c5249d788d0e90b23dafbb'] = { + index: T.Integer(), + embedding: T.Array(cache['9f6218431a69f9e8706d01336b3e9914']), + object: T.Union(cache['fcb63603ee8609e6d3a054eb7f349098']) +} +cache['e90fe15253bc1b90ba267533d7f956ea'] = T.Object( + cache['92a40676f0c5249d788d0e90b23dafbb'] +) +cache['5f46a9600fba15d8b3f7142887fe8a93'] = [T.Literal('list')] +cache['be8c408a576c6ef5c33c5f0ae4bc0f02'] = { + prompt_tokens: T.Integer(), + total_tokens: T.Integer() +} +cache['341d2859131bfedcf2f42ec4742cbf17'] = { + data: T.Array(cache['e90fe15253bc1b90ba267533d7f956ea']), + model: T.String(), + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']), + usage: T.Object(cache['be8c408a576c6ef5c33c5f0ae4bc0f02']) +} +cache['c1b0e5573b4bd39b7ece2a4180008ccb'] = [ + T.Literal('tts-1'), + T.Literal('tts-1-hd') +] +cache['4035a692ee87970f329933944443ecf4'] = [ + T.String(), + T.Union(cache['c1b0e5573b4bd39b7ece2a4180008ccb']) +] +cache['ac6a2db31cc84e4b3a5852c0c90bbecb'] = [ + T.Literal('alloy'), + T.Literal('echo'), + T.Literal('fable'), + T.Literal('onyx'), + T.Literal('nova'), + T.Literal('shimmer') +] +cache['b67ac286f9e64d825f3788c2e7e9a6a9'] = [ + T.Literal('mp3'), + T.Literal('opus'), + T.Literal('aac'), + T.Literal('flac'), + T.Literal('wav'), + T.Literal('pcm') +] +cache['0e5d01026ac12129c45911b934c108dc'] = { + model: T.Union(cache['4035a692ee87970f329933944443ecf4']), + input: T.String({ maxLength: 4096 }), + voice: T.Union(cache['ac6a2db31cc84e4b3a5852c0c90bbecb']), + response_format: T.Optional( + T.Union(cache['b67ac286f9e64d825f3788c2e7e9a6a9'], { default: 'mp3' }) + ), + speed: T.Optional(T.Number({ default: 1, minimum: 0.25, maximum: 4 })) +} +cache['ec3af709c721c5bbff825c4abc74b2f0'] = [T.Literal('whisper-1')] +cache['44957ef563e38d529e41fbf392f6291b'] = [ + T.String(), + T.Union(cache['ec3af709c721c5bbff825c4abc74b2f0']) +] +cache['69fde07c72b934b7c91a2c1808b4bc59'] = [ + T.Literal('json'), + T.Literal('text'), + T.Literal('srt'), + T.Literal('verbose_json'), + T.Literal('vtt') +] +cache['d1037681caebe1d375a94366e4c14369'] = [ + T.Literal('word'), + T.Literal('segment') +] +cache['1272a49c80b3dc8bc038af92e19f1d72'] = T.Union( + cache['d1037681caebe1d375a94366e4c14369'] +) +cache['cd1a2b32e62b1991943ff6a10cfe92a0'] = { + file: T.String({ format: 'binary' }), + model: T.Union(cache['44957ef563e38d529e41fbf392f6291b']), + language: T.Optional(T.String()), + prompt: T.Optional(T.String()), + response_format: T.Optional( + T.Union(cache['69fde07c72b934b7c91a2c1808b4bc59'], { default: 'json' }) + ), + temperature: T.Optional(T.Number({ default: 0 })), + 'timestamp_granularities[]': T.Optional( + T.Array(cache['1272a49c80b3dc8bc038af92e19f1d72'], { default: ['segment'] }) + ) +} +cache['ce56d7a02eda5fc5e1e6ae8f44b7df4d'] = { + file: T.String({ format: 'binary' }), + model: T.Union(cache['44957ef563e38d529e41fbf392f6291b']), + prompt: T.Optional(T.String()), + response_format: T.Optional(T.String({ default: 'json' })), + temperature: T.Optional(T.Number({ default: 0 })) +} +cache['687890d30356063331d525bf9ed5b29d'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['5d9fccb5a3f83bf58e7a31f78fa56600'] = { + purpose: cache['687890d30356063331d525bf9ed5b29d'] +} +cache['347e609825e54ae0c940829bad5df8fd'] = [T.Literal('file')] +cache['a9ebcdee336c4c695563c0306c9e2e69'] = [ + T.Literal('assistants'), + T.Literal('assistants_output'), + T.Literal('batch'), + T.Literal('batch_output'), + T.Literal('fine-tune'), + T.Literal('fine-tune-results'), + T.Literal('vision') +] +cache['49606adc5a8e7f6f10e3724ffc1ceff2'] = [ + T.Literal('uploaded'), + T.Literal('processed'), + T.Literal('error') +] +cache['b251863b7c08fef2022f1521498922e9'] = { + id: T.String(), + bytes: T.Integer(), + created_at: T.Integer(), + filename: T.String(), + object: T.Union(cache['347e609825e54ae0c940829bad5df8fd']), + purpose: T.Union(cache['a9ebcdee336c4c695563c0306c9e2e69']), + status: T.Union(cache['49606adc5a8e7f6f10e3724ffc1ceff2']), + status_details: T.Optional(T.String()) +} +cache['26b47708df7edec531d517fc5a5e717c'] = T.Object( + cache['b251863b7c08fef2022f1521498922e9'] +) +cache['69f3d06cf36beecb7106015b2019bf32'] = { + data: T.Array(cache['26b47708df7edec531d517fc5a5e717c']), + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']) +} +cache['060b46fe2e77bfc0f3c72ecf966b57be'] = [ + T.Literal('assistants'), + T.Literal('batch'), + T.Literal('fine-tune'), + T.Literal('vision') +] +cache['f1eaf98b29e72deca8f81354ebeefab6'] = { + file: T.String({ format: 'binary' }), + purpose: T.Union(cache['060b46fe2e77bfc0f3c72ecf966b57be']) +} +cache['a662c973d3053ed7848eb1e93cac2672'] = T.String({ 'x-in': 'path' }) +cache['313598d7345ad28e456238f5691a68c8'] = { + file_id: cache['a662c973d3053ed7848eb1e93cac2672'] +} +cache['dbc502a1e44b3958fc05e41fc329da59'] = { + id: T.String(), + object: T.Union(cache['347e609825e54ae0c940829bad5df8fd']), + deleted: T.Boolean() +} +cache['63d9466b04243ae34500477a25205563'] = { + filename: T.String(), + purpose: T.Union(cache['060b46fe2e77bfc0f3c72ecf966b57be']), + bytes: T.Integer(), + mime_type: T.String() +} +cache['d4daf5598dae08c72881b5b45d11c78d'] = [ + T.Literal('pending'), + T.Literal('completed'), + T.Literal('cancelled'), + T.Literal('expired') +] +cache['6eaa1abf18342f31e7d2a49e7efe1b39'] = [T.Literal('upload')] +cache['3b836fb3a52aee8a6648db9e30836db5'] = { + id: T.String(), + created_at: T.Integer(), + filename: T.String(), + bytes: T.Integer(), + purpose: T.String(), + status: T.Union(cache['d4daf5598dae08c72881b5b45d11c78d']), + expires_at: T.Integer(), + object: T.Optional(T.Union(cache['6eaa1abf18342f31e7d2a49e7efe1b39'])), + file: T.Optional(T.Object(cache['b251863b7c08fef2022f1521498922e9'])) +} +cache['f179d6089d4d41101ce4e93294e45fde'] = T.String({ 'x-in': 'path' }) +cache['498cc1453eb8ac1a69c74aa2abee6e25'] = { + upload_id: cache['f179d6089d4d41101ce4e93294e45fde'] +} +cache['8fb04687877d6ff4d083f397e24371cb'] = { + data: T.String({ format: 'binary' }) +} +cache['0d027544bc62bf989cf61938922b926d'] = [T.Literal('upload.part')] +cache['82b9938da6f29f2a4cd7fdcc660e811d'] = { + id: T.String(), + created_at: T.Integer(), + upload_id: T.String(), + object: T.Union(cache['0d027544bc62bf989cf61938922b926d']) +} +cache['664528ed31bd165f0169bbcf2e28621a'] = { + part_ids: T.Array(cache['2809284b6e54d0d34017715ffe5636bd']), + md5: T.Optional(T.String()) +} +cache['77d6e381ad173ff9058164c41a6d2013'] = [ + T.Literal('babbage-002'), + T.Literal('davinci-002'), + T.Literal('gpt-3.5-turbo') +] +cache['ac0bc35a5a8d2ca7db96e3b42bba78df'] = [ + T.String(), + T.Union(cache['77d6e381ad173ff9058164c41a6d2013']) +] +cache['8a3123f5f76b0f17e6dd45dd2963d769'] = { + batch_size: T.Any(), + learning_rate_multiplier: T.Any(), + n_epochs: T.Any() +} +cache['72e6ce84058bb6dc775e0522008e21af'] = T.String() +cache['5a1f01942ae3adf72aecdda74971c37c'] = { + project: T.String(), + name: T.Optional(T.String()), + entity: T.Optional(T.String()), + tags: T.Optional(T.Array(cache['72e6ce84058bb6dc775e0522008e21af'])) +} +cache['009aa3392ec9843a62adb45ca4d9f544'] = { + type: T.Any(), + wandb: T.Object(cache['5a1f01942ae3adf72aecdda74971c37c']) +} +cache['1ed17ce64d8ebb75a28e7cc2e381a89b'] = T.Object( + cache['009aa3392ec9843a62adb45ca4d9f544'] +) +cache['cf2647be9ed63bc5488a87cb0d563e61'] = { + model: T.Union(cache['ac0bc35a5a8d2ca7db96e3b42bba78df']), + training_file: T.String(), + hyperparameters: T.Optional( + T.Object(cache['8a3123f5f76b0f17e6dd45dd2963d769']) + ), + suffix: T.Optional(T.String({ minLength: 1, maxLength: 40, default: null })), + validation_file: T.Optional(T.String()), + integrations: T.Optional(T.Array(cache['1ed17ce64d8ebb75a28e7cc2e381a89b'])), + seed: T.Optional(T.Integer({ minimum: 0, maximum: 2147483647 })) +} +cache['3b4dcf2f8303b8126a86443e329103e8'] = { + code: T.String(), + message: T.String(), + param: T.String() +} +cache['c611ae99e1deaae7df8f2c87c8048dfd'] = { + n_epochs: T.Any() +} +cache['86352d48fd767d6e1d6ca84afa74204c'] = [T.Literal('fine_tuning.job')] +cache['92595595f109f0542ed9142bd219ed77'] = T.String() +cache['71a1ce6d2b616ce38c6b7c7f168ee9bf'] = [ + T.Literal('validating_files'), + T.Literal('queued'), + T.Literal('running'), + T.Literal('succeeded'), + T.Literal('failed'), + T.Literal('cancelled') +] +cache['c4721d3b9d9fe2c665e72b80c8274641'] = T.Any() +cache['f4831f54ade0faa46894bc4ab7d4ae34'] = { + id: T.String(), + created_at: T.Integer(), + error: T.Object(cache['3b4dcf2f8303b8126a86443e329103e8']), + fine_tuned_model: T.String(), + finished_at: T.Integer(), + hyperparameters: T.Object(cache['c611ae99e1deaae7df8f2c87c8048dfd']), + model: T.String(), + object: T.Union(cache['86352d48fd767d6e1d6ca84afa74204c']), + organization_id: T.String(), + result_files: T.Array(cache['92595595f109f0542ed9142bd219ed77']), + status: T.Union(cache['71a1ce6d2b616ce38c6b7c7f168ee9bf']), + trained_tokens: T.Integer(), + training_file: T.String(), + validation_file: T.String(), + integrations: T.Optional( + T.Array(cache['c4721d3b9d9fe2c665e72b80c8274641'], { maxItems: 5 }) + ), + seed: T.Integer(), + estimated_finish: T.Optional(T.Integer()) +} +cache['9e384591635946e4611666b2da56b59b'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['2a39eecb56691eeeac6395fb10305bbd'] = T.Optional( + T.Integer({ default: 20, 'x-in': 'query' }) +) +cache['58953d15fba8bb0f5cd2c53aa3671d3a'] = { + after: cache['9e384591635946e4611666b2da56b59b'], + limit: cache['2a39eecb56691eeeac6395fb10305bbd'] +} +cache['ce0748757b67dbb532fbcd96ed8ca4f0'] = T.Object( + cache['f4831f54ade0faa46894bc4ab7d4ae34'] +) +cache['424ddce3d1697042396663ce3e79c1db'] = { + data: T.Array(cache['ce0748757b67dbb532fbcd96ed8ca4f0']), + has_more: T.Boolean(), + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']) +} +cache['3548c4f535001b022fe3eace94bfa748'] = T.String({ 'x-in': 'path' }) +cache['ef40b414cabe5d4a15d94b716cd9c2fc'] = { + fine_tuning_job_id: cache['3548c4f535001b022fe3eace94bfa748'] +} +cache['a7b9661a3a89d2d2f2a93cbf4deb72ed'] = T.String({ 'x-in': 'path' }) +cache['aed544d9d14acecd14e47c8658fe8b0c'] = { + fine_tuning_job_id: cache['a7b9661a3a89d2d2f2a93cbf4deb72ed'] +} +cache['3c4bae5eb73e56aec18443c457bcbb69'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['58c603b37db63402810e111f249f0403'] = T.Optional( + T.Integer({ default: 20, 'x-in': 'query' }) +) +cache['47c4bbca653892d1d09e97b759ad3e7c'] = { + after: cache['3c4bae5eb73e56aec18443c457bcbb69'], + limit: cache['58c603b37db63402810e111f249f0403'] +} +cache['d76fa98815c459c7ec1f682e813c40b5'] = [ + T.Literal('info'), + T.Literal('warn'), + T.Literal('error') +] +cache['25a7e1b7ece011822eabcab043d60dad'] = [T.Literal('fine_tuning.job.event')] +cache['bd0d77a8375da70d1dfa3094714766c5'] = { + id: T.String(), + created_at: T.Integer(), + level: T.Union(cache['d76fa98815c459c7ec1f682e813c40b5']), + message: T.String(), + object: T.Union(cache['25a7e1b7ece011822eabcab043d60dad']) +} +cache['4a8a8237ce1b0907fbcca47a800f07bd'] = T.Object( + cache['bd0d77a8375da70d1dfa3094714766c5'] +) +cache['dc5e7404879b229d546a560a0ee7a760'] = { + data: T.Array(cache['4a8a8237ce1b0907fbcca47a800f07bd']), + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']) +} +cache['4f8096b16a142d7589f874faaeed21d1'] = T.String({ 'x-in': 'path' }) +cache['b34d480db9bee03d5900078d6818a239'] = { + fine_tuning_job_id: cache['4f8096b16a142d7589f874faaeed21d1'] +} +cache['dbb324123a0c26bbb6c23b446bf3fba0'] = T.String({ 'x-in': 'path' }) +cache['f1f8bea1fa0038e1df2de20991ae76b4'] = { + fine_tuning_job_id: cache['dbb324123a0c26bbb6c23b446bf3fba0'] +} +cache['6ea10a2b4bba2129439debe8cadb9234'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['36d969d769c50def238c1f9265a0fbe6'] = T.Optional( + T.Integer({ default: 10, 'x-in': 'query' }) +) +cache['f4cfae83a3a8d31fd15057b5f6ec1cbc'] = { + after: cache['6ea10a2b4bba2129439debe8cadb9234'], + limit: cache['36d969d769c50def238c1f9265a0fbe6'] +} +cache['90595ffcb768df1e2dd360e017792a4e'] = { + step: T.Optional(T.Number()), + train_loss: T.Optional(T.Number()), + train_mean_token_accuracy: T.Optional(T.Number()), + valid_loss: T.Optional(T.Number()), + valid_mean_token_accuracy: T.Optional(T.Number()), + full_valid_loss: T.Optional(T.Number()), + full_valid_mean_token_accuracy: T.Optional(T.Number()) +} +cache['f3fada57397d693a5b6f623e1d2e8f34'] = [ + T.Literal('fine_tuning.job.checkpoint') +] +cache['9c2939363b31d0970ce00ec483070c0d'] = { + id: T.String(), + created_at: T.Integer(), + fine_tuned_model_checkpoint: T.String(), + step_number: T.Integer(), + metrics: T.Object(cache['90595ffcb768df1e2dd360e017792a4e']), + fine_tuning_job_id: T.String(), + object: T.Union(cache['f3fada57397d693a5b6f623e1d2e8f34']) +} +cache['fd2037850a7c5e8280fc4fe3328e91f6'] = T.Object( + cache['9c2939363b31d0970ce00ec483070c0d'] +) +cache['6400230492b2b2d36b76ab9c249e9a54'] = { + data: T.Array(cache['fd2037850a7c5e8280fc4fe3328e91f6']), + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']), + first_id: T.Optional(T.String()), + last_id: T.Optional(T.String()), + has_more: T.Boolean() +} +cache['34af3ce325db0daf825221217147924a'] = [T.Literal('model')] +cache['f985d5a3b7e93f0e5e42a79b59dd70b0'] = { + id: T.String(), + created: T.Integer(), + object: T.Union(cache['34af3ce325db0daf825221217147924a']), + owned_by: T.String() +} +cache['b8020ac66bac8ef549300aa7e3ecc5f9'] = T.Object( + cache['f985d5a3b7e93f0e5e42a79b59dd70b0'] +) +cache['de1770e98bcba00d335a758af486f2c0'] = { + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']), + data: T.Array(cache['b8020ac66bac8ef549300aa7e3ecc5f9']) +} +cache['8bbbedaa27f05bea69e02053211e4905'] = T.String({ 'x-in': 'path' }) +cache['ea5e0eb15decade39819bf8d1158e96c'] = { + model: cache['8bbbedaa27f05bea69e02053211e4905'] +} +cache['a27925e77dad43c46f3bef1e2d898e0b'] = T.String({ 'x-in': 'path' }) +cache['60a9ef36d1ebefc9c74cb7fbf067b274'] = { + model: cache['a27925e77dad43c46f3bef1e2d898e0b'] +} +cache['3acb79c99fce6f7610e051543d60a3e1'] = { + id: T.String(), + deleted: T.Boolean(), + object: T.String() +} +cache['c13cd0b8ea9918622c46e50c3ab2fb41'] = [ + T.Literal('text-moderation-latest'), + T.Literal('text-moderation-stable') +] +cache['2998149294d38b61ee7fd34e5d9d9ba8'] = [ + T.String(), + T.Union(cache['c13cd0b8ea9918622c46e50c3ab2fb41']) +] +cache['1e0461f5f1cdeb8cd7b5e3d707433c23'] = { + input: T.Any(), + model: T.Optional( + T.Union(cache['2998149294d38b61ee7fd34e5d9d9ba8'], { + default: 'text-moderation-latest' + }) + ) +} +cache['e29d271a1b6fdc63e8fe47e1070664ab'] = { + hate: T.Boolean(), + 'hate/threatening': T.Boolean(), + harassment: T.Boolean(), + 'harassment/threatening': T.Boolean(), + 'self-harm': T.Boolean(), + 'self-harm/intent': T.Boolean(), + 'self-harm/instructions': T.Boolean(), + sexual: T.Boolean(), + 'sexual/minors': T.Boolean(), + violence: T.Boolean(), + 'violence/graphic': T.Boolean() +} +cache['a0764114359f0544e421407afd5970be'] = { + hate: T.Number(), + 'hate/threatening': T.Number(), + harassment: T.Number(), + 'harassment/threatening': T.Number(), + 'self-harm': T.Number(), + 'self-harm/intent': T.Number(), + 'self-harm/instructions': T.Number(), + sexual: T.Number(), + 'sexual/minors': T.Number(), + violence: T.Number(), + 'violence/graphic': T.Number() +} +cache['190b29588b5379b5272a6e0cc23181b4'] = { + flagged: T.Boolean(), + categories: T.Object(cache['e29d271a1b6fdc63e8fe47e1070664ab']), + category_scores: T.Object(cache['a0764114359f0544e421407afd5970be']) +} +cache['7e0ec6556b81d3eccda11208465d7c04'] = T.Object( + cache['190b29588b5379b5272a6e0cc23181b4'] +) +cache['ca8dc0f3835cc7ceb7c69b0bcd79a64f'] = { + id: T.String(), + model: T.String(), + results: T.Array(cache['7e0ec6556b81d3eccda11208465d7c04']) +} +cache['f623a9bcd22b23749f54a4c743f14723'] = T.Optional( + T.Integer({ default: 20, 'x-in': 'query' }) +) +cache['ef6372dbaa3ff1171b434dd2e8fee402'] = [ + T.Literal('asc'), + T.Literal('desc') +] +cache['9232c4e0b51327472bc06783662d5340'] = T.Optional( + T.Union(cache['ef6372dbaa3ff1171b434dd2e8fee402'], { + default: 'desc', + 'x-in': 'query' + }) +) +cache['669dbe0c40a956bfaa0cc2edba3b679d'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['2fb3c631e3d98df924a69d7696a653cf'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['00ed673da5f8d0f8bdc2aec27c0d32f9'] = { + limit: cache['f623a9bcd22b23749f54a4c743f14723'], + order: cache['9232c4e0b51327472bc06783662d5340'], + after: cache['669dbe0c40a956bfaa0cc2edba3b679d'], + before: cache['2fb3c631e3d98df924a69d7696a653cf'] +} +cache['1a940c74617f188b00495cc5646b35c3'] = T.Any() +cache['3e367ff7017c69420ad2ca6a167715eb'] = { + file_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { + default: [], + maxItems: 20 + }) + ) +} +cache['5cd5b5093f76769f8b5e7f5aa5b0fc95'] = { + vector_store_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 1 }) + ) +} +cache['58cd8880cabfc621a1ff44cb6d731dd5'] = { + code_interpreter: T.Optional( + T.Object(cache['3e367ff7017c69420ad2ca6a167715eb']) + ), + file_search: T.Optional(T.Object(cache['5cd5b5093f76769f8b5e7f5aa5b0fc95'])) +} +cache['7882b5109074218a773e2d39166a7be5'] = { + id: T.String(), + object: T.Union(cache['9539c841c419e9057d56191a46591cf8']), + created_at: T.Integer(), + name: T.String({ maxLength: 256 }), + description: T.String({ maxLength: 512 }), + model: T.String(), + instructions: T.String({ maxLength: 256000 }), + tools: T.Array(cache['1a940c74617f188b00495cc5646b35c3'], { + default: [], + maxItems: 128 + }), + tool_resources: T.Optional( + T.Object(cache['58cd8880cabfc621a1ff44cb6d731dd5']) + ), + metadata: Json(), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + response_format: T.Any() +} +cache['27994ed8d447de9c1abb16832c1573c7'] = T.Object( + cache['7882b5109074218a773e2d39166a7be5'] +) +cache['9081c315ba1338b89748aa0b6479391d'] = { + object: T.String(), + data: T.Array(cache['27994ed8d447de9c1abb16832c1573c7']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['daa36173b6ea025ef524518979260c40'] = [ + T.Literal('gpt-4o'), + T.Literal('gpt-4o-2024-05-13'), + T.Literal('gpt-4o-mini'), + T.Literal('gpt-4o-mini-2024-07-18'), + T.Literal('gpt-4-turbo'), + T.Literal('gpt-4-turbo-2024-04-09'), + T.Literal('gpt-4-0125-preview'), + T.Literal('gpt-4-turbo-preview'), + T.Literal('gpt-4-1106-preview'), + T.Literal('gpt-4-vision-preview'), + T.Literal('gpt-4'), + T.Literal('gpt-4-0314'), + T.Literal('gpt-4-0613'), + T.Literal('gpt-4-32k'), + T.Literal('gpt-4-32k-0314'), + T.Literal('gpt-4-32k-0613'), + T.Literal('gpt-3.5-turbo'), + T.Literal('gpt-3.5-turbo-16k'), + T.Literal('gpt-3.5-turbo-0613'), + T.Literal('gpt-3.5-turbo-1106'), + T.Literal('gpt-3.5-turbo-0125'), + T.Literal('gpt-3.5-turbo-16k-0613') +] +cache['885cb050b3b9ed2b0e21615861668056'] = [ + T.String(), + T.Union(cache['daa36173b6ea025ef524518979260c40']) +] +cache['dd13372e4cad0d92178b435a3c9ab80a'] = { + file_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { + default: [], + maxItems: 20 + }) + ) +} +cache['e4fcdbc97059dd13fbdd9af6b0596815'] = { + file_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 10000 }) + ), + chunking_strategy: T.Optional( + Json({ + oneOf: [ + { + type: 'object', + title: 'Auto Chunking Strategy', + description: + 'The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `auto`.', + enum: ['auto'] + } + }, + required: ['type'] + }, + { + type: 'object', + title: 'Static Chunking Strategy', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `static`.', + enum: ['static'] + }, + static: { + type: 'object', + additionalProperties: false, + properties: { + max_chunk_size_tokens: { + type: 'integer', + minimum: 100, + maximum: 4096, + description: + 'The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.' + }, + chunk_overlap_tokens: { + type: 'integer', + description: + 'The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n' + } + }, + required: ['max_chunk_size_tokens', 'chunk_overlap_tokens'] + } + }, + required: ['type', 'static'] + } + ] + }) + ), + metadata: T.Optional(Json()) +} +cache['478f2248a8d1afbac14c83f27aa737b0'] = T.Object( + cache['e4fcdbc97059dd13fbdd9af6b0596815'] +) +cache['0fabae221780a23691a4bac9d8e41ad6'] = { + vector_store_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 1 }) + ), + vector_stores: T.Optional( + T.Array(cache['478f2248a8d1afbac14c83f27aa737b0'], { maxItems: 1 }) + ) +} +cache['4044533822793c67d69dc65af3a9f770'] = { + code_interpreter: T.Optional( + T.Object(cache['dd13372e4cad0d92178b435a3c9ab80a']) + ), + file_search: T.Optional( + T.Object(cache['0fabae221780a23691a4bac9d8e41ad6'], { + oneOf: [ + { required: ['vector_store_ids'] }, + { required: ['vector_stores'] } + ] + }) + ) +} +cache['7520e1a7c95f8ccdef2c8eda02751aaa'] = { + model: T.Union(cache['885cb050b3b9ed2b0e21615861668056']), + name: T.Optional(T.String({ maxLength: 256 })), + description: T.Optional(T.String({ maxLength: 512 })), + instructions: T.Optional(T.String({ maxLength: 256000 })), + tools: T.Optional( + T.Array(cache['1a940c74617f188b00495cc5646b35c3'], { + default: [], + maxItems: 128 + }) + ), + tool_resources: T.Optional( + T.Object(cache['4044533822793c67d69dc65af3a9f770']) + ), + metadata: T.Optional(Json()), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + response_format: T.Any() +} +cache['b7c88f3b10b7ecd5c207a5605e52b0b7'] = T.String({ 'x-in': 'path' }) +cache['f5eef158e61c2b13755b4f05c38af46a'] = { + assistant_id: cache['b7c88f3b10b7ecd5c207a5605e52b0b7'] +} +cache['4e450c0dd9a6db15230240cf25ceb576'] = T.String({ 'x-in': 'path' }) +cache['dd0e49988a038fbe96bb85ce7b811637'] = { + assistant_id: cache['4e450c0dd9a6db15230240cf25ceb576'] +} +cache['d1a31e0bb35010b7ee10521b4ca26315'] = [T.String()] +cache['f0e98ca620611bea264da8a491976734'] = { + file_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { + default: [], + maxItems: 20 + }) + ) +} +cache['7458f51864f4030b8a07e70af0030b97'] = { + vector_store_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 1 }) + ) +} +cache['c22b57ff451a3589c71824fde7c2c9b4'] = { + code_interpreter: T.Optional( + T.Object(cache['f0e98ca620611bea264da8a491976734']) + ), + file_search: T.Optional(T.Object(cache['7458f51864f4030b8a07e70af0030b97'])) +} +cache['95ecfc7eed16d50c8a786902f0c3fed8'] = { + model: T.Optional(T.Union(cache['d1a31e0bb35010b7ee10521b4ca26315'])), + name: T.Optional(T.String({ maxLength: 256 })), + description: T.Optional(T.String({ maxLength: 512 })), + instructions: T.Optional(T.String({ maxLength: 256000 })), + tools: T.Optional( + T.Array(cache['1a940c74617f188b00495cc5646b35c3'], { + default: [], + maxItems: 128 + }) + ), + tool_resources: T.Optional( + T.Object(cache['c22b57ff451a3589c71824fde7c2c9b4']) + ), + metadata: T.Optional(Json()), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + response_format: T.Any() +} +cache['7636420f358ab07dd4e6b6d371fcb946'] = T.String({ 'x-in': 'path' }) +cache['dd97105ffc02ac90d008a244359fe4ac'] = { + assistant_id: cache['7636420f358ab07dd4e6b6d371fcb946'] +} +cache['188571b3511c8f2957256a19aff14098'] = [T.Literal('assistant.deleted')] +cache['83c5a807ac0ebfe253fb808ae9798153'] = { + id: T.String(), + deleted: T.Boolean(), + object: T.Union(cache['188571b3511c8f2957256a19aff14098']) +} +cache['ce7338e23aeb865b84c76f56c481b024'] = [ + T.Literal('user'), + T.Literal('assistant') +] +cache['b630310d6509c394b7780963684a46f2'] = T.Any() +cache['7302deba548cb00bbf945f0cb4ecbbcd'] = { + file_id: T.Optional(T.String()), + tools: T.Optional(T.Array(cache['b630310d6509c394b7780963684a46f2'])) +} +cache['958b7fe18327e1ed7b7acb451f7ea8dc'] = T.Object( + cache['7302deba548cb00bbf945f0cb4ecbbcd'] +) +cache['dfc91097389707b177bd01c35e017eaa'] = { + role: T.Union(cache['ce7338e23aeb865b84c76f56c481b024']), + content: T.Any(), + attachments: T.Optional( + T.Array(cache['958b7fe18327e1ed7b7acb451f7ea8dc'], { + required: ['file_id', 'tools'] + }) + ), + metadata: T.Optional(Json()) +} +cache['84bbb7752a10f5d44dccd8f211b233db'] = T.Object( + cache['dfc91097389707b177bd01c35e017eaa'], + { additionalProperties: false } +) +cache['76f4fd16d972dea0b736e091df7d7d8a'] = T.Object( + cache['e4fcdbc97059dd13fbdd9af6b0596815'] +) +cache['5c0235548e6b10c471dd2a5c9f8b9f4e'] = { + vector_store_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 1 }) + ), + vector_stores: T.Optional( + T.Array(cache['76f4fd16d972dea0b736e091df7d7d8a'], { maxItems: 1 }) + ) +} +cache['4b8355c7a5062583c425a4a3a164eb53'] = { + code_interpreter: T.Optional( + T.Object(cache['dd13372e4cad0d92178b435a3c9ab80a']) + ), + file_search: T.Optional( + T.Object(cache['5c0235548e6b10c471dd2a5c9f8b9f4e'], { + oneOf: [ + { required: ['vector_store_ids'] }, + { required: ['vector_stores'] } + ] + }) + ) +} +cache['12819c881a5e74b6f58a9f0891043262'] = { + messages: T.Optional(T.Array(cache['84bbb7752a10f5d44dccd8f211b233db'])), + tool_resources: T.Optional( + T.Object(cache['4b8355c7a5062583c425a4a3a164eb53']) + ), + metadata: T.Optional(Json()) +} +cache['bbb1d862e64955ff1dd9f455d78be593'] = [T.Literal('thread')] +cache['de654a817f6b54fa2d02abc80e4636b9'] = { + vector_store_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 1 }) + ) +} +cache['33ab457cd0c7df9ae54ed29b00daa2a5'] = { + code_interpreter: T.Optional( + T.Object(cache['dd13372e4cad0d92178b435a3c9ab80a']) + ), + file_search: T.Optional(T.Object(cache['de654a817f6b54fa2d02abc80e4636b9'])) +} +cache['843eeaceedb08259af683687a0aa2bdf'] = { + id: T.String(), + object: T.Union(cache['bbb1d862e64955ff1dd9f455d78be593']), + created_at: T.Integer(), + tool_resources: T.Object(cache['33ab457cd0c7df9ae54ed29b00daa2a5']), + metadata: Json() +} +cache['c9c0f3922b08f76f62ba333db5535ad8'] = T.String({ 'x-in': 'path' }) +cache['2366494be21ce9b8eb9877111fdec21a'] = { + thread_id: cache['c9c0f3922b08f76f62ba333db5535ad8'] +} +cache['9b6699eac27d8d122c499d600740a1fd'] = T.String({ 'x-in': 'path' }) +cache['7273293413ffa9055c2481b1cd3d4642'] = { + thread_id: cache['9b6699eac27d8d122c499d600740a1fd'] +} +cache['1c720356a35580bcf8e4b9b5a920ed57'] = { + tool_resources: T.Optional( + T.Object(cache['33ab457cd0c7df9ae54ed29b00daa2a5']) + ), + metadata: T.Optional(Json()) +} +cache['21295d4738240c124db4bd98da432e17'] = T.String({ 'x-in': 'path' }) +cache['73c04a68437b0c946c43407635b42e71'] = { + thread_id: cache['21295d4738240c124db4bd98da432e17'] +} +cache['d1b42a05e36b0e76b99ef3ec801504be'] = [T.Literal('thread.deleted')] +cache['9939d1955732b534db457a6302c78878'] = { + id: T.String(), + deleted: T.Boolean(), + object: T.Union(cache['d1b42a05e36b0e76b99ef3ec801504be']) +} +cache['7ff93907ac7c63221f924a8cd3763015'] = T.String({ 'x-in': 'path' }) +cache['3611c4f70d67730538f1c94ff6f6cb93'] = { + thread_id: cache['7ff93907ac7c63221f924a8cd3763015'] +} +cache['fd55bb2580269555667cb9fb3d170471'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['be683abc499e874ff4a72d3af0b7804b'] = { + limit: cache['f623a9bcd22b23749f54a4c743f14723'], + order: cache['9232c4e0b51327472bc06783662d5340'], + after: cache['669dbe0c40a956bfaa0cc2edba3b679d'], + before: cache['2fb3c631e3d98df924a69d7696a653cf'], + run_id: cache['fd55bb2580269555667cb9fb3d170471'] +} +cache['fdf81bca7aa68ea2b22cb1d7325ff0f0'] = [T.Literal('thread.message')] +cache['2b3b190a0295db2c6da9292a7b0fea9a'] = [ + T.Literal('in_progress'), + T.Literal('incomplete'), + T.Literal('completed') +] +cache['d1a4e9430b353499a6af819e4e7a03c4'] = [ + T.Literal('content_filter'), + T.Literal('max_tokens'), + T.Literal('run_cancelled'), + T.Literal('run_expired'), + T.Literal('run_failed') +] +cache['3835f4fb661aeafd731a61629ea32dd2'] = { + reason: T.Union(cache['d1a4e9430b353499a6af819e4e7a03c4']) +} +cache['8bd4ecb40e2fe58622f63200040f870f'] = T.Any() +cache['9919ce439b06e6cb45eba3bc75cbb9a6'] = { + id: T.String(), + object: T.Union(cache['fdf81bca7aa68ea2b22cb1d7325ff0f0']), + created_at: T.Integer(), + thread_id: T.String(), + status: T.Union(cache['2b3b190a0295db2c6da9292a7b0fea9a']), + incomplete_details: T.Object(cache['3835f4fb661aeafd731a61629ea32dd2']), + completed_at: T.Integer(), + incomplete_at: T.Integer(), + role: T.Union(cache['ce7338e23aeb865b84c76f56c481b024']), + content: T.Array(cache['8bd4ecb40e2fe58622f63200040f870f']), + assistant_id: T.String(), + run_id: T.String(), + attachments: T.Array(cache['958b7fe18327e1ed7b7acb451f7ea8dc']), + metadata: Json() +} +cache['217c0a904514b4777748af4100f32f79'] = T.Object( + cache['9919ce439b06e6cb45eba3bc75cbb9a6'] +) +cache['59d3dec5b533735db4e2f3a3e16561d7'] = { + object: T.String(), + data: T.Array(cache['217c0a904514b4777748af4100f32f79']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['8d6dbeaa028d1150d3d0795d6367d765'] = T.String({ 'x-in': 'path' }) +cache['41d908fb513fb358207880c572c1af3e'] = { + thread_id: cache['8d6dbeaa028d1150d3d0795d6367d765'] +} +cache['d74dea2dcc9909e2d598bfa18b7d253c'] = T.String({ 'x-in': 'path' }) +cache['5d6e1e9a550f7e73bd7c216141a5bd45'] = T.String({ 'x-in': 'path' }) +cache['d4d12030e061f44c9c55afbdf463eafd'] = { + thread_id: cache['d74dea2dcc9909e2d598bfa18b7d253c'], + message_id: cache['5d6e1e9a550f7e73bd7c216141a5bd45'] +} +cache['c804d4c22a18a14eafb37e9b1bb3a662'] = T.String({ 'x-in': 'path' }) +cache['03e8dae332db8c97ea1a82678ea4824e'] = T.String({ 'x-in': 'path' }) +cache['fbca0ddc436612e084f356472689bcb2'] = { + thread_id: cache['c804d4c22a18a14eafb37e9b1bb3a662'], + message_id: cache['03e8dae332db8c97ea1a82678ea4824e'] +} +cache['e72516203ab15db84c83493e3c34ce40'] = { + metadata: T.Optional(Json()) +} +cache['eba8acd44e15850a2c6904ad2e52f9dd'] = T.String({ 'x-in': 'path' }) +cache['117a5a0b2e983845bfea3395f50556a3'] = { + thread_id: cache['c804d4c22a18a14eafb37e9b1bb3a662'], + message_id: cache['eba8acd44e15850a2c6904ad2e52f9dd'] +} +cache['ffa535f0ed6a2ee3b82c73c77b1f8614'] = [ + T.Literal('thread.message.deleted') +] +cache['9abc628d8039f81daf13b967df78ff44'] = { + id: T.String(), + deleted: T.Boolean(), + object: T.Union(cache['ffa535f0ed6a2ee3b82c73c77b1f8614']) +} +cache['9851d512f6dcdc5167bb2cd5a8d2253d'] = T.Any() +cache['e553d962202ad98c892ef51b0eafe9ce'] = { + code_interpreter: T.Optional( + T.Object(cache['dd13372e4cad0d92178b435a3c9ab80a']) + ), + file_search: T.Optional(T.Object(cache['5cd5b5093f76769f8b5e7f5aa5b0fc95'])) +} +cache['9e99b0691b0131d0d941a69d10a2e05f'] = [ + T.Literal('auto'), + T.Literal('last_messages') +] +cache['b6d4dbea7badacde9ce3f7c625314a5e'] = { + type: T.Union(cache['9e99b0691b0131d0d941a69d10a2e05f']), + last_messages: T.Optional(T.Integer({ minimum: 1 })) +} +cache['2aa38b2cf412659a625c062134f34400'] = { + assistant_id: T.String(), + thread: T.Optional( + T.Object(cache['12819c881a5e74b6f58a9f0891043262'], { + additionalProperties: false + }) + ), + model: T.Optional(T.Union(cache['885cb050b3b9ed2b0e21615861668056'])), + instructions: T.Optional(T.String()), + tools: T.Optional( + T.Array(cache['9851d512f6dcdc5167bb2cd5a8d2253d'], { maxItems: 20 }) + ), + tool_resources: T.Optional( + T.Object(cache['e553d962202ad98c892ef51b0eafe9ce']) + ), + metadata: T.Optional(Json()), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + stream: T.Optional(T.Boolean()), + max_prompt_tokens: T.Optional(T.Integer({ minimum: 256 })), + max_completion_tokens: T.Optional(T.Integer({ minimum: 256 })), + truncation_strategy: T.Optional( + T.Object(cache['b6d4dbea7badacde9ce3f7c625314a5e']) + ), + tool_choice: T.Any(), + parallel_tool_calls: T.Optional(T.Boolean({ default: true })), + response_format: T.Any() +} +cache['d80cd1e3854ba5e2381c884bdf57e959'] = [T.Literal('thread.run')] +cache['481f05b4d377451bdfb2f5cf8f395e30'] = [ + T.Literal('queued'), + T.Literal('in_progress'), + T.Literal('requires_action'), + T.Literal('cancelling'), + T.Literal('cancelled'), + T.Literal('failed'), + T.Literal('completed'), + T.Literal('incomplete'), + T.Literal('expired') +] +cache['55c90b25f00a0ed4f22d5fbc39898723'] = [T.Literal('submit_tool_outputs')] +cache['84d980d57129ff6adae923adaa41bf39'] = { + name: T.String(), + arguments: T.String() +} +cache['93c4cc2f26696eb059d1c44f9ea0aa71'] = { + id: T.String(), + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Object(cache['84d980d57129ff6adae923adaa41bf39']) +} +cache['fd8ea5c756c895c97bb9d94a6dad1953'] = T.Object( + cache['93c4cc2f26696eb059d1c44f9ea0aa71'] +) +cache['6d5f636dabd9e7c26ccfcff2b650f03f'] = { + tool_calls: T.Array(cache['fd8ea5c756c895c97bb9d94a6dad1953']) +} +cache['d6bee616b9f201ce36eda0b48344334e'] = { + type: T.Union(cache['55c90b25f00a0ed4f22d5fbc39898723']), + submit_tool_outputs: T.Object(cache['6d5f636dabd9e7c26ccfcff2b650f03f']) +} +cache['1b961c4dacd4513a507a2aac77bd709d'] = [ + T.Literal('server_error'), + T.Literal('rate_limit_exceeded'), + T.Literal('invalid_prompt') +] +cache['038bfc78cf96da4d063225a6226f5ff1'] = { + code: T.Union(cache['1b961c4dacd4513a507a2aac77bd709d']), + message: T.String() +} +cache['bfbcef97039e90367afef3a1cc90d39d'] = [ + T.Literal('max_completion_tokens'), + T.Literal('max_prompt_tokens') +] +cache['cb88684ef27ac4eac5a3c46739d70b17'] = { + reason: T.Optional(T.Union(cache['bfbcef97039e90367afef3a1cc90d39d'])) +} +cache['da66f4ee7c397f4a92cad313900752ae'] = { + completion_tokens: T.Integer(), + prompt_tokens: T.Integer(), + total_tokens: T.Integer() +} +cache['ca4149ebb610524f2504d5efcb933037'] = { + id: T.String(), + object: T.Union(cache['d80cd1e3854ba5e2381c884bdf57e959']), + created_at: T.Integer(), + thread_id: T.String(), + assistant_id: T.String(), + status: T.Union(cache['481f05b4d377451bdfb2f5cf8f395e30']), + required_action: T.Object(cache['d6bee616b9f201ce36eda0b48344334e']), + last_error: T.Object(cache['038bfc78cf96da4d063225a6226f5ff1']), + expires_at: T.Integer(), + started_at: T.Integer(), + cancelled_at: T.Integer(), + failed_at: T.Integer(), + completed_at: T.Integer(), + incomplete_details: T.Object(cache['cb88684ef27ac4eac5a3c46739d70b17']), + model: T.String(), + instructions: T.String(), + tools: T.Array(cache['1a940c74617f188b00495cc5646b35c3'], { + default: [], + maxItems: 20 + }), + metadata: Json(), + usage: T.Object(cache['da66f4ee7c397f4a92cad313900752ae']), + temperature: T.Optional(T.Number()), + top_p: T.Optional(T.Number()), + max_prompt_tokens: T.Integer({ minimum: 256 }), + max_completion_tokens: T.Integer({ minimum: 256 }), + truncation_strategy: T.Object(cache['b6d4dbea7badacde9ce3f7c625314a5e']), + tool_choice: T.Any(), + parallel_tool_calls: T.Boolean({ default: true }), + response_format: T.Any() +} +cache['4f60a62fee58ff3fcf3e34fc26bb647f'] = T.String({ 'x-in': 'path' }) +cache['a0ec30453187155d4ab35c046259e40e'] = { + thread_id: cache['4f60a62fee58ff3fcf3e34fc26bb647f'] +} +cache['bcf801333f75c675748501c283538208'] = T.Object( + cache['ca4149ebb610524f2504d5efcb933037'] +) +cache['a7527aec923b3c24c4a77e5b5b347ee3'] = { + object: T.String(), + data: T.Array(cache['bcf801333f75c675748501c283538208']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['c0f34bdee90baa543e7b47f6dea7899f'] = T.String({ 'x-in': 'path' }) +cache['51e260731530a59a0cb37faedb5f0a6f'] = { + thread_id: cache['c0f34bdee90baa543e7b47f6dea7899f'] +} +cache['889c497d349b903ef8b7e66f1f7f1f78'] = { + assistant_id: T.String(), + model: T.Optional(T.Union(cache['885cb050b3b9ed2b0e21615861668056'])), + instructions: T.Optional(T.String()), + additional_instructions: T.Optional(T.String()), + additional_messages: T.Optional( + T.Array(cache['84bbb7752a10f5d44dccd8f211b233db']) + ), + tools: T.Optional( + T.Array(cache['1a940c74617f188b00495cc5646b35c3'], { maxItems: 20 }) + ), + metadata: T.Optional(Json()), + temperature: T.Optional(T.Number({ minimum: 0, maximum: 2, default: 1 })), + top_p: T.Optional(T.Number({ minimum: 0, maximum: 1, default: 1 })), + stream: T.Optional(T.Boolean()), + max_prompt_tokens: T.Optional(T.Integer({ minimum: 256 })), + max_completion_tokens: T.Optional(T.Integer({ minimum: 256 })), + truncation_strategy: T.Optional( + T.Object(cache['b6d4dbea7badacde9ce3f7c625314a5e']) + ), + tool_choice: T.Any(), + parallel_tool_calls: T.Optional(T.Boolean({ default: true })), + response_format: T.Any() +} +cache['afa42f2f59920bf647a27ce48ffe34a3'] = T.String({ 'x-in': 'path' }) +cache['1b8e1630be39d43903dd51079dadef20'] = T.String({ 'x-in': 'path' }) +cache['c4e7dad4927de29148261c74707a24be'] = { + thread_id: cache['afa42f2f59920bf647a27ce48ffe34a3'], + run_id: cache['1b8e1630be39d43903dd51079dadef20'] +} +cache['11f687ec7d991d230b5e84b66d9217f0'] = T.String({ 'x-in': 'path' }) +cache['b088e7f74ac7e36a1e9ed8d96aa142e7'] = { + thread_id: cache['afa42f2f59920bf647a27ce48ffe34a3'], + run_id: cache['11f687ec7d991d230b5e84b66d9217f0'] +} +cache['3a98d3941f8338263eef602de1762764'] = T.String({ 'x-in': 'path' }) +cache['9bad9520030a881c32d037aa916c63f6'] = T.String({ 'x-in': 'path' }) +cache['c6c4bc41389d1b97c63f61351e7e2e40'] = { + thread_id: cache['3a98d3941f8338263eef602de1762764'], + run_id: cache['9bad9520030a881c32d037aa916c63f6'] +} +cache['901eb3a4908361a7eff5380fcfbfd71f'] = { + tool_call_id: T.Optional(T.String()), + output: T.Optional(T.String()) +} +cache['be2ce82b121d2ed57f519d746b8a99c7'] = T.Object( + cache['901eb3a4908361a7eff5380fcfbfd71f'] +) +cache['2a39b62dc91107419a6b6b45a2fd3cde'] = { + tool_outputs: T.Array(cache['be2ce82b121d2ed57f519d746b8a99c7']), + stream: T.Optional(T.Boolean()) +} +cache['b8fa4d8479ac5abd1cfc197c3d1e89fc'] = T.String({ 'x-in': 'path' }) +cache['2b4f29ad4596b4b37f2ac1d18d9e7be2'] = T.String({ 'x-in': 'path' }) +cache['919a50c78f95a064b8ce8888e5a7feb8'] = { + thread_id: cache['b8fa4d8479ac5abd1cfc197c3d1e89fc'], + run_id: cache['2b4f29ad4596b4b37f2ac1d18d9e7be2'] +} +cache['8e1a2d12820c1077344fd4e46f67df71'] = T.String({ 'x-in': 'path' }) +cache['b0ccf23ea751641f28efae3adfec8e12'] = T.String({ 'x-in': 'path' }) +cache['a98f3716ff05056e3907ed6dd04dd57d'] = { + thread_id: cache['8e1a2d12820c1077344fd4e46f67df71'], + run_id: cache['b0ccf23ea751641f28efae3adfec8e12'] +} +cache['ef9486a38d654f5f38ec49f1230a02e4'] = [T.Literal('thread.run.step')] +cache['4b72ddf772b8f929ad40da16f255d2aa'] = [ + T.Literal('message_creation'), + T.Literal('tool_calls') +] +cache['786dab01211818739dbe99a3d78923a7'] = [ + T.Literal('in_progress'), + T.Literal('cancelled'), + T.Literal('failed'), + T.Literal('completed'), + T.Literal('expired') +] +cache['bf6c2412c5bf4f94845247a8cce557cd'] = [ + T.Literal('server_error'), + T.Literal('rate_limit_exceeded') +] +cache['201e31be95293f5196342cea86419bc4'] = { + code: T.Union(cache['bf6c2412c5bf4f94845247a8cce557cd']), + message: T.String() +} +cache['22b945819fb99309d5bf225b5d31281b'] = { + completion_tokens: T.Integer(), + prompt_tokens: T.Integer(), + total_tokens: T.Integer() +} +cache['854aaaa64b1e916bcd12f8e453be1319'] = { + id: T.String(), + object: T.Union(cache['ef9486a38d654f5f38ec49f1230a02e4']), + created_at: T.Integer(), + assistant_id: T.String(), + thread_id: T.String(), + run_id: T.String(), + type: T.Union(cache['4b72ddf772b8f929ad40da16f255d2aa']), + status: T.Union(cache['786dab01211818739dbe99a3d78923a7']), + step_details: Json({ + oneOf: [ + { + title: 'Message creation', + type: 'object', + description: 'Details of the message creation by the run step.', + properties: { + type: { + description: 'Always `message_creation`.', + type: 'string', + enum: ['message_creation'] + }, + message_creation: { + type: 'object', + properties: { + message_id: { + type: 'string', + description: + 'The ID of the message that was created by this run step.' + } + }, + required: ['message_id'] + } + }, + required: ['type', 'message_creation'] + }, + { + title: 'Tool calls', + type: 'object', + description: 'Details of the tool call.', + properties: { + type: { + description: 'Always `tool_calls`.', + type: 'string', + enum: ['tool_calls'] + }, + tool_calls: { + type: 'array', + description: + 'An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n', + items: { + oneOf: [ + { + title: 'Code Interpreter tool call', + type: 'object', + description: + 'Details of the Code Interpreter tool call the run step was involved in.', + properties: { + id: { + type: 'string', + description: 'The ID of the tool call.' + }, + type: { + type: 'string', + description: + 'The type of tool call. This is always going to be `code_interpreter` for this type of tool call.', + enum: ['code_interpreter'] + }, + code_interpreter: { + type: 'object', + description: 'The Code Interpreter tool call definition.', + required: ['input', 'outputs'], + properties: { + input: { + type: 'string', + description: + 'The input to the Code Interpreter tool call.' + }, + outputs: { + type: 'array', + description: + 'The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.', + items: { + type: 'object', + oneOf: [ + { + title: 'Code Interpreter log output', + type: 'object', + description: + 'Text output from the Code Interpreter tool call as part of a run step.', + properties: { + type: { + description: 'Always `logs`.', + type: 'string', + enum: ['logs'] + }, + logs: { + type: 'string', + description: + 'The text output from the Code Interpreter tool call.' + } + }, + required: ['type', 'logs'] + }, + { + title: 'Code Interpreter image output', + type: 'object', + properties: { + type: { + description: 'Always `image`.', + type: 'string', + enum: ['image'] + }, + image: { + type: 'object', + properties: { + file_id: { + description: + 'The [file](/docs/api-reference/files) ID of the image.', + type: 'string' + } + }, + required: ['file_id'] + } + }, + required: ['type', 'image'] + } + ], + 'x-oaiExpandable': true + } + } + } + } + }, + required: ['id', 'type', 'code_interpreter'] + }, + { + title: 'File search tool call', + type: 'object', + properties: { + id: { + type: 'string', + description: 'The ID of the tool call object.' + }, + type: { + type: 'string', + description: + 'The type of tool call. This is always going to be `file_search` for this type of tool call.', + enum: ['file_search'] + }, + file_search: { + type: 'object', + description: + 'For now, this is always going to be an empty object.', + 'x-oaiTypeLabel': 'map' + } + }, + required: ['id', 'type', 'file_search'] + }, + { + type: 'object', + title: 'Function tool call', + properties: { + id: { + type: 'string', + description: 'The ID of the tool call object.' + }, + type: { + type: 'string', + description: + 'The type of tool call. This is always going to be `function` for this type of tool call.', + enum: ['function'] + }, + function: { + type: 'object', + description: + 'The definition of the function that was called.', + properties: { + name: { + type: 'string', + description: 'The name of the function.' + }, + arguments: { + type: 'string', + description: 'The arguments passed to the function.' + }, + output: { + type: 'string', + description: + 'The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.', + nullable: true + } + }, + required: ['name', 'arguments', 'output'] + } + }, + required: ['id', 'type', 'function'] + } + ], + 'x-oaiExpandable': true + } + } + }, + required: ['type', 'tool_calls'] + } + ] + }), + last_error: T.Object(cache['201e31be95293f5196342cea86419bc4']), + expired_at: T.Integer(), + cancelled_at: T.Integer(), + failed_at: T.Integer(), + completed_at: T.Integer(), + metadata: Json(), + usage: T.Object(cache['22b945819fb99309d5bf225b5d31281b']) +} +cache['2fd32906f26b5b603425d209d4c99a6d'] = T.Object( + cache['854aaaa64b1e916bcd12f8e453be1319'] +) +cache['e52dccee327d5a8f917ad2553f54a22a'] = { + object: T.String(), + data: T.Array(cache['2fd32906f26b5b603425d209d4c99a6d']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['d7d14d8e9933d4d108ae66ba947c36bd'] = T.String({ 'x-in': 'path' }) +cache['4c789c6f1a7a402296754482bc32674c'] = T.String({ 'x-in': 'path' }) +cache['ea67c805244048f4a48bf01091f132e7'] = T.String({ 'x-in': 'path' }) +cache['29990e860512d3007a6d0821f2df00d8'] = { + thread_id: cache['d7d14d8e9933d4d108ae66ba947c36bd'], + run_id: cache['4c789c6f1a7a402296754482bc32674c'], + step_id: cache['ea67c805244048f4a48bf01091f132e7'] +} +cache['05d1a1996a558960fbaa3be8d8e85500'] = [T.Literal('vector_store')] +cache['ddd7a08133c6b889a4a0c77e525fd546'] = { + in_progress: T.Integer(), + completed: T.Integer(), + failed: T.Integer(), + cancelled: T.Integer(), + total: T.Integer() +} +cache['e9cc3adfc5e29a0eccf7202b069faff4'] = [ + T.Literal('expired'), + T.Literal('in_progress'), + T.Literal('completed') +] +cache['2f0a8c3aacfb4e9d031fe1c2262fcacc'] = [T.Literal('last_active_at')] +cache['497041f3f833dcb471822d03a9157276'] = { + anchor: T.Union(cache['2f0a8c3aacfb4e9d031fe1c2262fcacc']), + days: T.Integer({ minimum: 1, maximum: 365 }) +} +cache['106f91aac5881e610e7179d48348abbb'] = { + id: T.String(), + object: T.Union(cache['05d1a1996a558960fbaa3be8d8e85500']), + created_at: T.Integer(), + name: T.String(), + usage_bytes: T.Integer(), + file_counts: T.Object(cache['ddd7a08133c6b889a4a0c77e525fd546']), + status: T.Union(cache['e9cc3adfc5e29a0eccf7202b069faff4']), + expires_after: T.Optional( + T.Object(cache['497041f3f833dcb471822d03a9157276']) + ), + expires_at: T.Optional(T.Integer()), + last_active_at: T.Integer(), + metadata: Json() +} +cache['592b5b927009dc4e09a1bd9679ce786f'] = T.Object( + cache['106f91aac5881e610e7179d48348abbb'] +) +cache['ff74fee0b40c9e2f94ce4aaa9f863cc9'] = { + object: T.String(), + data: T.Array(cache['592b5b927009dc4e09a1bd9679ce786f']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['bb490d308693e8cdd597c0ee42323db6'] = { + file_ids: T.Optional( + T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { maxItems: 500 }) + ), + name: T.Optional(T.String()), + expires_after: T.Optional( + T.Object(cache['497041f3f833dcb471822d03a9157276']) + ), + chunking_strategy: T.Optional( + Json({ + oneOf: [ + { + type: 'object', + title: 'Auto Chunking Strategy', + description: + 'The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `auto`.', + enum: ['auto'] + } + }, + required: ['type'] + }, + { + type: 'object', + title: 'Static Chunking Strategy', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `static`.', + enum: ['static'] + }, + static: { + type: 'object', + additionalProperties: false, + properties: { + max_chunk_size_tokens: { + type: 'integer', + minimum: 100, + maximum: 4096, + description: + 'The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.' + }, + chunk_overlap_tokens: { + type: 'integer', + description: + 'The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n' + } + }, + required: ['max_chunk_size_tokens', 'chunk_overlap_tokens'] + } + }, + required: ['type', 'static'] + } + ] + }) + ), + metadata: T.Optional(Json()) +} +cache['f775700f71bd2f9fd0258515a217188e'] = T.String({ 'x-in': 'path' }) +cache['e4b1b7dd4b14d50e5bd0c9ddd5d33286'] = { + vector_store_id: cache['f775700f71bd2f9fd0258515a217188e'] +} +cache['3a8ed5caa6f5fb006d49f7b5d4906742'] = T.String({ 'x-in': 'path' }) +cache['f65d5eea2ede29c9d262a74b9f49d055'] = { + vector_store_id: cache['3a8ed5caa6f5fb006d49f7b5d4906742'] +} +cache['89224ea2a0ac9d6f9f0f50a60a5780dd'] = { + name: T.Optional(T.String()), + expires_after: T.Optional( + T.Object(cache['497041f3f833dcb471822d03a9157276']) + ), + metadata: T.Optional(Json()) +} +cache['bafac01022af26da32632c3b8917d043'] = T.String({ 'x-in': 'path' }) +cache['8dd11ad92b9242f0285cf92d0b1c0286'] = { + vector_store_id: cache['bafac01022af26da32632c3b8917d043'] +} +cache['f06aface639e6662cada449f97d7f26b'] = [T.Literal('vector_store.deleted')] +cache['3cf239f84a4a43b6d81c8ef36c8b3c6c'] = { + id: T.String(), + deleted: T.Boolean(), + object: T.Union(cache['f06aface639e6662cada449f97d7f26b']) +} +cache['48ab5d84cc248a10dc3dba1be8d5adb2'] = T.String({ 'x-in': 'path' }) +cache['546de948e6308c89852c9c106d58d9d3'] = { + vector_store_id: cache['48ab5d84cc248a10dc3dba1be8d5adb2'] +} +cache['9d6cdc7c9d20318fd32b1f6a21bd0c57'] = [ + T.Literal('in_progress'), + T.Literal('completed'), + T.Literal('failed'), + T.Literal('cancelled') +] +cache['471e5155ceb0591516d1b3a7629ae934'] = T.Optional( + T.Union(cache['9d6cdc7c9d20318fd32b1f6a21bd0c57'], { 'x-in': 'query' }) +) +cache['cbe79cc9e800b0f7dedcc853786f0dda'] = { + limit: cache['f623a9bcd22b23749f54a4c743f14723'], + order: cache['9232c4e0b51327472bc06783662d5340'], + after: cache['669dbe0c40a956bfaa0cc2edba3b679d'], + before: cache['2fb3c631e3d98df924a69d7696a653cf'], + filter: cache['471e5155ceb0591516d1b3a7629ae934'] +} +cache['97ada83595b60664d42d1f2f31bd95a9'] = [T.Literal('vector_store.file')] +cache['75b309b7794910e5e9a46c00da0fe984'] = [ + T.Literal('in_progress'), + T.Literal('completed'), + T.Literal('cancelled'), + T.Literal('failed') +] +cache['062aceea97acdbd054e3c63a65c40e74'] = [ + T.Literal('internal_error'), + T.Literal('file_not_found'), + T.Literal('parsing_error'), + T.Literal('unhandled_mime_type') +] +cache['0ef437eec8c9ce7400debe5b9a12603a'] = { + code: T.Union(cache['062aceea97acdbd054e3c63a65c40e74']), + message: T.String() +} +cache['4cfbe31ffd0b4e4eb1b22150bb0f2967'] = { + id: T.String(), + object: T.Union(cache['97ada83595b60664d42d1f2f31bd95a9']), + usage_bytes: T.Integer(), + created_at: T.Integer(), + vector_store_id: T.String(), + status: T.Union(cache['75b309b7794910e5e9a46c00da0fe984']), + last_error: T.Object(cache['0ef437eec8c9ce7400debe5b9a12603a']), + chunking_strategy: T.Optional( + Json({ + oneOf: [ + { + type: 'object', + title: 'Static Chunking Strategy', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `static`.', + enum: ['static'] + }, + static: { + type: 'object', + additionalProperties: false, + properties: { + max_chunk_size_tokens: { + type: 'integer', + minimum: 100, + maximum: 4096, + description: + 'The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.' + }, + chunk_overlap_tokens: { + type: 'integer', + description: + 'The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n' + } + }, + required: ['max_chunk_size_tokens', 'chunk_overlap_tokens'] + } + }, + required: ['type', 'static'] + }, + { + type: 'object', + title: 'Other Chunking Strategy', + description: + 'This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API.', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `other`.', + enum: ['other'] + } + }, + required: ['type'] + } + ] + }) + ) +} +cache['1203eca8fdf456c023808b630b7f98ee'] = T.Object( + cache['4cfbe31ffd0b4e4eb1b22150bb0f2967'] +) +cache['fe5638ea0024ceb6efb6cd1bb3123c9e'] = { + object: T.String(), + data: T.Array(cache['1203eca8fdf456c023808b630b7f98ee']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['95f72ad2c46850bd8a34359285f3d312'] = T.String({ 'x-in': 'path' }) +cache['05e213dbdf2ba57e4f5cb6c66d23b9e6'] = { + vector_store_id: cache['95f72ad2c46850bd8a34359285f3d312'] +} +cache['ea7e7440bc7428abf277aa8ee93183ae'] = { + file_id: T.String(), + chunking_strategy: T.Optional( + Json({ + oneOf: [ + { + type: 'object', + title: 'Auto Chunking Strategy', + description: + 'The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `auto`.', + enum: ['auto'] + } + }, + required: ['type'] + }, + { + type: 'object', + title: 'Static Chunking Strategy', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `static`.', + enum: ['static'] + }, + static: { + type: 'object', + additionalProperties: false, + properties: { + max_chunk_size_tokens: { + type: 'integer', + minimum: 100, + maximum: 4096, + description: + 'The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.' + }, + chunk_overlap_tokens: { + type: 'integer', + description: + 'The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n' + } + }, + required: ['max_chunk_size_tokens', 'chunk_overlap_tokens'] + } + }, + required: ['type', 'static'] + } + ] + }) + ) +} +cache['b03a68099ba91b0b1eac8146f51545b0'] = T.String({ 'x-in': 'path' }) +cache['1af9aedafe6952148a34e472e409704b'] = T.String({ 'x-in': 'path' }) +cache['9cbf3bf0882e6bb4e57e7af6642167f9'] = { + vector_store_id: cache['b03a68099ba91b0b1eac8146f51545b0'], + file_id: cache['1af9aedafe6952148a34e472e409704b'] +} +cache['9a69d8abbdfc9ec84e9ccfb271e94a61'] = T.String({ 'x-in': 'path' }) +cache['084575d0af9070aed91dd52595c3881b'] = T.String({ 'x-in': 'path' }) +cache['2b5166643e372af6b57c8654ca24f390'] = { + vector_store_id: cache['9a69d8abbdfc9ec84e9ccfb271e94a61'], + file_id: cache['084575d0af9070aed91dd52595c3881b'] +} +cache['b39a8ddceba3925b621d76cb3967f287'] = [ + T.Literal('vector_store.file.deleted') +] +cache['6ea46d7ad422330b1c96d02366583a97'] = { + id: T.String(), + deleted: T.Boolean(), + object: T.Union(cache['b39a8ddceba3925b621d76cb3967f287']) +} +cache['1a40f7b03cf50a49b40fc25ec02cb887'] = T.String({ 'x-in': 'path' }) +cache['3ecd3793a6bef4c614966479c9b8fe2b'] = { + vector_store_id: cache['1a40f7b03cf50a49b40fc25ec02cb887'] +} +cache['cd92fc6b54146a71b64b6ef1f72c6e7f'] = { + file_ids: T.Array(cache['2809284b6e54d0d34017715ffe5636bd'], { + minItems: 1, + maxItems: 500 + }), + chunking_strategy: T.Optional( + Json({ + oneOf: [ + { + type: 'object', + title: 'Auto Chunking Strategy', + description: + 'The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `auto`.', + enum: ['auto'] + } + }, + required: ['type'] + }, + { + type: 'object', + title: 'Static Chunking Strategy', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `static`.', + enum: ['static'] + }, + static: { + type: 'object', + additionalProperties: false, + properties: { + max_chunk_size_tokens: { + type: 'integer', + minimum: 100, + maximum: 4096, + description: + 'The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.' + }, + chunk_overlap_tokens: { + type: 'integer', + description: + 'The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n' + } + }, + required: ['max_chunk_size_tokens', 'chunk_overlap_tokens'] + } + }, + required: ['type', 'static'] + } + ] + }) + ) +} +cache['6b07278a919a0e5978da21aaba65fe9f'] = [ + T.Literal('vector_store.files_batch') +] +cache['47e563ed83e5abf9378c427950ee773d'] = { + in_progress: T.Integer(), + completed: T.Integer(), + failed: T.Integer(), + cancelled: T.Integer(), + total: T.Integer() +} +cache['faab15370c6ceb87be31157f86ef9c4d'] = { + id: T.String(), + object: T.Union(cache['6b07278a919a0e5978da21aaba65fe9f']), + created_at: T.Integer(), + vector_store_id: T.String(), + status: T.Union(cache['75b309b7794910e5e9a46c00da0fe984']), + file_counts: T.Object(cache['47e563ed83e5abf9378c427950ee773d']) +} +cache['812f4f608083f647b81dad0ac8512677'] = T.String({ 'x-in': 'path' }) +cache['5a48685fffe6a434b7e8f8f16212be72'] = T.String({ 'x-in': 'path' }) +cache['7382cf97dd9361e7496fe62a161eafe0'] = { + vector_store_id: cache['812f4f608083f647b81dad0ac8512677'], + batch_id: cache['5a48685fffe6a434b7e8f8f16212be72'] +} +cache['cdf578e693f32d38ea5aa0115e58efff'] = T.String({ 'x-in': 'path' }) +cache['66fac73e951f9609f22a7e2fdc135fa8'] = T.String({ 'x-in': 'path' }) +cache['18dfbefad078b465ca74296519cb3530'] = { + vector_store_id: cache['cdf578e693f32d38ea5aa0115e58efff'], + batch_id: cache['66fac73e951f9609f22a7e2fdc135fa8'] +} +cache['3aaeb6e63fd96e0c8e07114481e955b8'] = T.String({ 'x-in': 'path' }) +cache['4ec6fe4f9d647e7cd6bb799f76d53b87'] = { + vector_store_id: cache['48ab5d84cc248a10dc3dba1be8d5adb2'], + batch_id: cache['3aaeb6e63fd96e0c8e07114481e955b8'] +} +cache['5c78ac2de94c8fae39862e59409f6e18'] = [ + T.Literal('/v1/chat/completions'), + T.Literal('/v1/embeddings'), + T.Literal('/v1/completions') +] +cache['8d56c6797c654494367f27ae344227b2'] = [T.Literal('24h')] +cache['36d0e17dc9401aaf7fedb03cb865e3b0'] = { + input_file_id: T.String(), + endpoint: T.Union(cache['5c78ac2de94c8fae39862e59409f6e18']), + completion_window: T.Union(cache['8d56c6797c654494367f27ae344227b2']), + metadata: T.Optional(Json({ additionalProperties: { type: 'string' } })) +} +cache['82c296b1522d7c43a5f3acf37dee9ab9'] = [T.Literal('batch')] +cache['3cadd5cbab9ace62453e4d27fb82d5a1'] = { + code: T.Optional(T.String()), + message: T.Optional(T.String()), + param: T.Optional(T.String()), + line: T.Optional(T.Integer()) +} +cache['cd24d00d9ee54e135ff0182095534b79'] = T.Object( + cache['3cadd5cbab9ace62453e4d27fb82d5a1'] +) +cache['81ecf40b53dfd53f7a32a064b64a6932'] = { + object: T.Optional(T.String()), + data: T.Optional(T.Array(cache['cd24d00d9ee54e135ff0182095534b79'])) +} +cache['d92acdff5d31a3449a699bd7b02eccd0'] = [ + T.Literal('validating'), + T.Literal('failed'), + T.Literal('in_progress'), + T.Literal('finalizing'), + T.Literal('completed'), + T.Literal('expired'), + T.Literal('cancelling'), + T.Literal('cancelled') +] +cache['d169ced30659fecdbc2d014b7cc3f527'] = { + total: T.Integer(), + completed: T.Integer(), + failed: T.Integer() +} +cache['fd4c666117c585b3f0057a20ad2d2eb7'] = { + id: T.String(), + object: T.Union(cache['82c296b1522d7c43a5f3acf37dee9ab9']), + endpoint: T.String(), + errors: T.Optional(T.Object(cache['81ecf40b53dfd53f7a32a064b64a6932'])), + input_file_id: T.String(), + completion_window: T.String(), + status: T.Union(cache['d92acdff5d31a3449a699bd7b02eccd0']), + output_file_id: T.Optional(T.String()), + error_file_id: T.Optional(T.String()), + created_at: T.Integer(), + in_progress_at: T.Optional(T.Integer()), + expires_at: T.Optional(T.Integer()), + finalizing_at: T.Optional(T.Integer()), + completed_at: T.Optional(T.Integer()), + failed_at: T.Optional(T.Integer()), + expired_at: T.Optional(T.Integer()), + cancelling_at: T.Optional(T.Integer()), + cancelled_at: T.Optional(T.Integer()), + request_counts: T.Optional( + T.Object(cache['d169ced30659fecdbc2d014b7cc3f527']) + ), + metadata: T.Optional(Json()) +} +cache['03dea8f6c5546b269d815b0685f22fc2'] = T.Optional( + T.String({ 'x-in': 'query' }) +) +cache['42149f01eabed9777658c18b7af0f013'] = { + after: cache['03dea8f6c5546b269d815b0685f22fc2'], + limit: cache['f623a9bcd22b23749f54a4c743f14723'] +} +cache['4e68c128552525324d51096b5bb9f7a0'] = T.Object( + cache['fd4c666117c585b3f0057a20ad2d2eb7'] +) +cache['e76a3aeddcfcbc86b8cc209163cac0e0'] = { + data: T.Array(cache['4e68c128552525324d51096b5bb9f7a0']), + first_id: T.Optional(T.String()), + last_id: T.Optional(T.String()), + has_more: T.Boolean(), + object: T.Union(cache['5f46a9600fba15d8b3f7142887fe8a93']) +} +cache['b5c8cc4b92b86ba5d7dda414e29f6a77'] = T.String({ 'x-in': 'path' }) +cache['98a516d4a5d3ab2209b07207210f3e27'] = { + batch_id: cache['b5c8cc4b92b86ba5d7dda414e29f6a77'] +} +cache['f5fb255641d20e003c628633ab3889cd'] = T.String({ 'x-in': 'path' }) +cache['9742c95ee2abb542c28a4b5930635248'] = { + batch_id: cache['f5fb255641d20e003c628633ab3889cd'] +} +cache['ab1d6b5dfdbaadf9a17ec394b68df07b'] = { + code: T.String(), + message: T.String(), + param: T.String(), + type: T.String() +} +cache['1cb9916667a80bc36e1d5ce7545abfab'] = { + error: T.Object(cache['ab1d6b5dfdbaadf9a17ec394b68df07b']) +} +cache['e1d87ce7f2ba3e461f4b247c81666007'] = [T.Literal('image_url')] +cache['b6e923bf33eb0750767826c1d9964735'] = [ + T.Literal('auto'), + T.Literal('low'), + T.Literal('high') +] +cache['05f745c651342114776178272b5195ec'] = { + url: T.String({ format: 'uri' }), + detail: T.Optional( + T.Union(cache['b6e923bf33eb0750767826c1d9964735'], { default: 'auto' }) + ) +} +cache['73e8204042ebb8e1ae7fcd4b97cb0b6a'] = { + type: T.Union(cache['e1d87ce7f2ba3e461f4b247c81666007']), + image_url: T.Object(cache['05f745c651342114776178272b5195ec']) +} +cache['c42dc14ef7b27cca8ac3b833a00c7de8'] = [T.Literal('text')] +cache['1d65ed0800bcbfa572f19b20e4e05d8c'] = { + type: T.Union(cache['c42dc14ef7b27cca8ac3b833a00c7de8']), + text: T.String() +} +cache['3388ce813f8cac6b4b9a4250cf426b51'] = [T.Literal('system')] +cache['92698f76445604b7a0396447b24f1d64'] = { + content: T.String(), + role: T.Union(cache['3388ce813f8cac6b4b9a4250cf426b51']), + name: T.Optional(T.String()) +} +cache['1079ec62efbb25de8599c427f09bc8c3'] = [T.Literal('user')] +cache['7edd3994414548b4a3436df93b2a8fb4'] = { + content: T.Any(), + role: T.Union(cache['1079ec62efbb25de8599c427f09bc8c3']), + name: T.Optional(T.String()) +} +cache['c65e7ad433d29322b42585c7ee972dee'] = { + arguments: T.String(), + name: T.String() +} +cache['209b2c57d56a0f28263eb42ae0ee8744'] = { + content: T.Optional(T.String()), + role: T.Union(cache['9539c841c419e9057d56191a46591cf8']), + name: T.Optional(T.String()), + tool_calls: T.Optional(T.Array(cache['0834704c8cede1f92348ff754bdd80f6'])), + function_call: T.Optional(T.Object(cache['c65e7ad433d29322b42585c7ee972dee'])) +} +cache['b3d84f48448a73495935cdfe19532308'] = [T.Literal(0), T.Literal(1)] +cache['845cb15f3132c9f9777f181e464d381a'] = { + weight: T.Optional(T.Union(cache['b3d84f48448a73495935cdfe19532308'])) +} +cache['52ce0e478a37e2607bad51d33f1423a5'] = [ + T.Object(cache['845cb15f3132c9f9777f181e464d381a']), + T.Object(cache['209b2c57d56a0f28263eb42ae0ee8744']) +] +cache['a0e04cf91460917013c9c1ec31195e1b'] = [T.Literal('tool')] +cache['5be546f119a7ef874b54d6c255894974'] = { + role: T.Union(cache['a0e04cf91460917013c9c1ec31195e1b']), + content: T.String(), + tool_call_id: T.String() +} +cache['535476e8458c1c85126986c7953ac5ed'] = { + role: T.Union(cache['78a70c640dc014fc048915402571c97d']), + content: T.String(), + name: T.String() +} +cache['58244a1afb20970b3d9cbb13f1afbd6e'] = { + name: T.String() +} +cache['59511b612909655f97ba812e3284d0ab'] = { + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Object(cache['58244a1afb20970b3d9cbb13f1afbd6e']) +} +cache['b884ce8aa17c1c5141473acdb1984ccf'] = { + name: T.Optional(T.String()), + arguments: T.Optional(T.String()) +} +cache['183cada67ebb813c671460d3f81035e7'] = { + index: T.Integer(), + id: T.Optional(T.String()), + type: T.Optional(T.Union(cache['78a70c640dc014fc048915402571c97d'])), + function: T.Optional(T.Object(cache['b884ce8aa17c1c5141473acdb1984ccf'])) +} +cache['a3edd7eb6af65b9b3342569390f07650'] = [ + T.Literal('system'), + T.Literal('user'), + T.Literal('assistant'), + T.Literal('tool'), + T.Literal('function') +] +cache['fb9e0b55f1f02033592cb82f24b922eb'] = { + arguments: T.Optional(T.String()), + name: T.Optional(T.String()) +} +cache['5884dbd52e02e2485844d9a38e9d7b62'] = T.Object( + cache['183cada67ebb813c671460d3f81035e7'] +) +cache['263c11f3840d0ca795fc30f9f1445471'] = [ + T.Literal('system'), + T.Literal('user'), + T.Literal('assistant'), + T.Literal('tool') +] +cache['295e059c1295854543a1b718fedc01f4'] = { + content: T.Optional(T.String()), + function_call: T.Optional( + T.Object(cache['fb9e0b55f1f02033592cb82f24b922eb']) + ), + tool_calls: T.Optional(T.Array(cache['5884dbd52e02e2485844d9a38e9d7b62'])), + role: T.Optional(T.Union(cache['263c11f3840d0ca795fc30f9f1445471'])) +} +cache['8132156de7bb8327008ac6c1d57fe20f'] = [ + T.Literal('stop'), + T.Literal('length'), + T.Literal('function_call'), + T.Literal('content_filter') +] +cache['e31114baa7397c51f57be4f675f44739'] = { + finish_reason: T.Union(cache['8132156de7bb8327008ac6c1d57fe20f']), + index: T.Integer(), + message: T.Object(cache['c69b0c46ff5553dbc0c5254e9e735ca5']) +} +cache['dbfdb6d4dae87ee6ae9e28ccd84b803a'] = T.Object( + cache['e31114baa7397c51f57be4f675f44739'] +) +cache['6302c061cd828bcc8af26231e0a6023d'] = { + id: T.String(), + choices: T.Array(cache['dbfdb6d4dae87ee6ae9e28ccd84b803a']), + created: T.Integer(), + model: T.String(), + system_fingerprint: T.Optional(T.String()), + object: T.Union(cache['6d34b7b60d069faa302d136f5f9af1e5']), + usage: T.Optional(T.Object(cache['26b974e6ea7bd3e6b1a26b3f0b24db14'])) +} +cache['100a17a68129062b5ae179bce66a8121'] = { + delta: T.Object(cache['295e059c1295854543a1b718fedc01f4']), + logprobs: T.Optional(T.Object(cache['17d3e5e8d5448d06d73754b3715983b8'])), + finish_reason: T.Union(cache['80f632106afbb77a2a122509e0f8a574']), + index: T.Integer() +} +cache['536b36a33c9d50bfd6665e10650d3720'] = T.Object( + cache['100a17a68129062b5ae179bce66a8121'] +) +cache['38f79ecd5ffc528eb44ce3feca577bdd'] = [T.Literal('chat.completion.chunk')] +cache['858ab29c2873cd9af7d9e26e0a387d74'] = { + id: T.String(), + choices: T.Array(cache['536b36a33c9d50bfd6665e10650d3720']), + created: T.Integer(), + model: T.String(), + service_tier: T.Optional(T.Union(cache['197d31a87efdf23d5275a95185387ba2'])), + system_fingerprint: T.Optional(T.String()), + object: T.Union(cache['38f79ecd5ffc528eb44ce3feca577bdd']), + usage: T.Optional(T.Object(cache['26b974e6ea7bd3e6b1a26b3f0b24db14'])) +} +cache['6057c21d25418b1df74f7d1f40564832'] = { + text: T.String() +} +cache['9997baee46d5a11c20b29a44c2da1cdd'] = { + id: T.Integer(), + seek: T.Integer(), + start: T.Number({ format: 'float' }), + end: T.Number({ format: 'float' }), + text: T.String(), + tokens: T.Array(cache['987434f426a7002fc01406e2ac533c03']), + temperature: T.Number({ format: 'float' }), + avg_logprob: T.Number({ format: 'float' }), + compression_ratio: T.Number({ format: 'float' }), + no_speech_prob: T.Number({ format: 'float' }) +} +cache['7d40fe46e77cf9210b9e49ff02cd11df'] = { + word: T.String(), + start: T.Number({ format: 'float' }), + end: T.Number({ format: 'float' }) +} +cache['94a2da5e1fb58e44e64bfedfa99f8fb1'] = T.Object( + cache['7d40fe46e77cf9210b9e49ff02cd11df'] +) +cache['419e2fe24dcd1ac5c3215c1595fcc04f'] = T.Object( + cache['9997baee46d5a11c20b29a44c2da1cdd'] +) +cache['99336b435aaca4e9b904674efb05eef1'] = { + language: T.String(), + duration: T.String(), + text: T.String(), + words: T.Optional(T.Array(cache['94a2da5e1fb58e44e64bfedfa99f8fb1'])), + segments: T.Optional(T.Array(cache['419e2fe24dcd1ac5c3215c1595fcc04f'])) +} +cache['b8b74809e88818c33b81e19060b02636'] = { + text: T.String() +} +cache['e844cb0a671d7eb4e3d747c1620f1fb4'] = { + language: T.String(), + duration: T.String(), + text: T.String(), + segments: T.Optional(T.Array(cache['419e2fe24dcd1ac5c3215c1595fcc04f'])) +} +cache['04ab457d8dbdb4f37ae6ed89ec41abde'] = [T.Literal('wandb')] +cache['61ff1a654058a8a4ae59b13ff2adaddc'] = { + type: T.Union(cache['04ab457d8dbdb4f37ae6ed89ec41abde']), + wandb: T.Object(cache['5a1f01942ae3adf72aecdda74971c37c']) +} +cache['c0ef8282ef155ca92cb2d4fb93640a88'] = T.Any() +cache['7af5e4ab950a3ef6eddaf9254506e227'] = { + messages: T.Optional( + T.Array(cache['c0ef8282ef155ca92cb2d4fb93640a88'], { minItems: 1 }) + ), + tools: T.Optional(T.Array(cache['69c83e993b83a184c6641fcad3e2fa79'])), + parallel_tool_calls: T.Optional(T.Boolean({ default: true })), + functions: T.Optional( + T.Array(cache['ab96fa8a32fc1d3f3c8ebfa94ced647b'], { + minItems: 1, + maxItems: 128 + }) + ) +} +cache['dd2f2ceaeeb00ce3974684abd1d00df3'] = { + prompt: T.Optional(T.String()), + completion: T.Optional(T.String()) +} +cache['2d4711c91803ab303abfd256fdb1170f'] = [T.Literal('code_interpreter')] +cache['6ba7f0abfc044550413da560fa4e703c'] = { + type: T.Union(cache['2d4711c91803ab303abfd256fdb1170f']) +} +cache['3452c54e2704cafa4fe01757eef52cc2'] = [T.Literal('file_search')] +cache['6c5fac46ab8f95fec1fae879a1c84f42'] = { + max_num_results: T.Optional(T.Integer({ minimum: 1, maximum: 50 })) +} +cache['d54cc671bec33fda68c9e56a26092c3b'] = { + type: T.Union(cache['3452c54e2704cafa4fe01757eef52cc2']), + file_search: T.Optional(T.Object(cache['6c5fac46ab8f95fec1fae879a1c84f42'])) +} +cache['f56074624619b5dae66c88acf4bc359b'] = { + type: T.Union(cache['3452c54e2704cafa4fe01757eef52cc2']) +} +cache['144a45ac135d53cd2172c86dcbee741a'] = { + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Object(cache['8a0e72bd020a90249508a3d6f36a7983']) +} +cache['fce7d2141607a403e6120ebda148c5ff'] = [ + T.Literal('function'), + T.Literal('code_interpreter'), + T.Literal('file_search') +] +cache['952d397f2e2cc6bd8e8a7ff5b554f7c1'] = { + type: T.Union(cache['fce7d2141607a403e6120ebda148c5ff']), + function: T.Optional(T.Object(cache['58244a1afb20970b3d9cbb13f1afbd6e'])) +} +cache['40440b734481584a468c8335c6acdadb'] = T.Object( + cache['843eeaceedb08259af683687a0aa2bdf'] +) +cache['48c6b645f5107275bc015bcd2114b1ae'] = { + object: T.String(), + data: T.Array(cache['40440b734481584a468c8335c6acdadb']), + first_id: T.String(), + last_id: T.String(), + has_more: T.Boolean() +} +cache['642a6c44b21705d7474aeba76da121fc'] = [T.Literal('thread.message.delta')] +cache['fc41dc638547d233500551b618f6cf9f'] = T.Any() +cache['0128cb0bfb393ee807c99869a35f813b'] = { + role: T.Optional(T.Union(cache['ce7338e23aeb865b84c76f56c481b024'])), + content: T.Optional(T.Array(cache['fc41dc638547d233500551b618f6cf9f'])) +} +cache['bd3753ba84267f249a84f4ad186a25d6'] = { + id: T.String(), + object: T.Union(cache['642a6c44b21705d7474aeba76da121fc']), + delta: T.Object(cache['0128cb0bfb393ee807c99869a35f813b']) +} +cache['8df0c81d3ca064c9306f9021ceb3c8e0'] = [T.Literal('image_file')] +cache['8416cfea4f5cd25ff14298572301f73d'] = { + file_id: T.String(), + detail: T.Optional( + T.Union(cache['b6e923bf33eb0750767826c1d9964735'], { default: 'auto' }) + ) +} +cache['057e362af536dff5c62509e7c0d26217'] = { + type: T.Union(cache['8df0c81d3ca064c9306f9021ceb3c8e0']), + image_file: T.Object(cache['8416cfea4f5cd25ff14298572301f73d']) +} +cache['50cbad2c0dfa1004b35701a2b347bcc3'] = { + file_id: T.Optional(T.String()), + detail: T.Optional( + T.Union(cache['b6e923bf33eb0750767826c1d9964735'], { default: 'auto' }) + ) +} +cache['dd7e756c08a427be9b6c8e981b6f21f3'] = { + index: T.Integer(), + type: T.Union(cache['8df0c81d3ca064c9306f9021ceb3c8e0']), + image_file: T.Optional(T.Object(cache['50cbad2c0dfa1004b35701a2b347bcc3'])) +} +cache['15f1b9fcfb5bf62173fb8539d6755c2e'] = { + url: T.String({ format: 'uri' }), + detail: T.Optional( + T.Union(cache['b6e923bf33eb0750767826c1d9964735'], { default: 'auto' }) + ) +} +cache['eafa27404f5be1f4e0c7382dcac6aa1b'] = { + type: T.Union(cache['e1d87ce7f2ba3e461f4b247c81666007']), + image_url: T.Object(cache['15f1b9fcfb5bf62173fb8539d6755c2e']) +} +cache['48a01a42814b90f2a5defdd56618b9a6'] = { + url: T.Optional(T.String()), + detail: T.Optional( + T.Union(cache['b6e923bf33eb0750767826c1d9964735'], { default: 'auto' }) + ) +} +cache['68a79dee45eaed0dd6ee52bf9dbfb3fe'] = { + index: T.Integer(), + type: T.Union(cache['e1d87ce7f2ba3e461f4b247c81666007']), + image_url: T.Optional(T.Object(cache['48a01a42814b90f2a5defdd56618b9a6'])) +} +cache['8d1c447e0cb817cb5dae36a1bd9534b8'] = T.Any() +cache['96c1158217e9f95cef7e04fc15f0abf0'] = { + value: T.String(), + annotations: T.Array(cache['8d1c447e0cb817cb5dae36a1bd9534b8']) +} +cache['8a6b960cacf351db2aeb36df07bd437f'] = { + type: T.Union(cache['c42dc14ef7b27cca8ac3b833a00c7de8']), + text: T.Object(cache['96c1158217e9f95cef7e04fc15f0abf0']) +} +cache['8721d6be86e9e1099dff9fb1547d5fe4'] = { + type: T.Union(cache['c42dc14ef7b27cca8ac3b833a00c7de8']), + text: T.String() +} +cache['2f6e6687d4a7b009489f47f846edb873'] = [T.Literal('file_citation')] +cache['e8d6861efa4be94c0182a9701c37688e'] = { + file_id: T.String() +} +cache['b451fd37b4d64d72fd7b3eda45094708'] = { + type: T.Union(cache['2f6e6687d4a7b009489f47f846edb873']), + text: T.String(), + file_citation: T.Object(cache['e8d6861efa4be94c0182a9701c37688e']), + start_index: T.Integer({ minimum: 0 }), + end_index: T.Integer({ minimum: 0 }) +} +cache['4584091a0faf66f9266c50d0181f406e'] = [T.Literal('file_path')] +cache['59b88bffcdb1ef8492a5dd5b25d76723'] = { + file_id: T.String() +} +cache['923b42080f94604245ea25b07159bf56'] = { + type: T.Union(cache['4584091a0faf66f9266c50d0181f406e']), + text: T.String(), + file_path: T.Object(cache['59b88bffcdb1ef8492a5dd5b25d76723']), + start_index: T.Integer({ minimum: 0 }), + end_index: T.Integer({ minimum: 0 }) +} +cache['4c2225e32aff9ad377bc554bb8395659'] = T.Any() +cache['a75886ebc7f37b47aa2d7d4c1fbf0c16'] = { + value: T.Optional(T.String()), + annotations: T.Optional(T.Array(cache['4c2225e32aff9ad377bc554bb8395659'])) +} +cache['68a741d3ab394ef49caa56ef9c82e38f'] = { + index: T.Integer(), + type: T.Union(cache['c42dc14ef7b27cca8ac3b833a00c7de8']), + text: T.Optional(T.Object(cache['a75886ebc7f37b47aa2d7d4c1fbf0c16'])) +} +cache['1c48d99c0a4a1a263051ab97d52eb782'] = { + file_id: T.Optional(T.String()), + quote: T.Optional(T.String()) +} +cache['0d6193811156f8b80dd1da6cc1333c6d'] = { + index: T.Integer(), + type: T.Union(cache['2f6e6687d4a7b009489f47f846edb873']), + text: T.Optional(T.String()), + file_citation: T.Optional( + T.Object(cache['1c48d99c0a4a1a263051ab97d52eb782']) + ), + start_index: T.Optional(T.Integer({ minimum: 0 })), + end_index: T.Optional(T.Integer({ minimum: 0 })) +} +cache['37af01bc420d4903097374bde4902232'] = { + file_id: T.Optional(T.String()) +} +cache['5996d6360d41a346ed65bff1ad934c12'] = { + index: T.Integer(), + type: T.Union(cache['4584091a0faf66f9266c50d0181f406e']), + text: T.Optional(T.String()), + file_path: T.Optional(T.Object(cache['37af01bc420d4903097374bde4902232'])), + start_index: T.Optional(T.Integer({ minimum: 0 })), + end_index: T.Optional(T.Integer({ minimum: 0 })) +} +cache['401d8a91954d3dda41bf4fa780fa8f41'] = [T.Literal('thread.run.step.delta')] +cache['8deb50e71928cfc58d6543c2b6616ec0'] = { + step_details: T.Optional( + Json({ + oneOf: [ + { + title: 'Message creation', + type: 'object', + description: 'Details of the message creation by the run step.', + properties: { + type: { + description: 'Always `message_creation`.', + type: 'string', + enum: ['message_creation'] + }, + message_creation: { + type: 'object', + properties: { + message_id: { + type: 'string', + description: + 'The ID of the message that was created by this run step.' + } + } + } + }, + required: ['type'] + }, + { + title: 'Tool calls', + type: 'object', + description: 'Details of the tool call.', + properties: { + type: { + description: 'Always `tool_calls`.', + type: 'string', + enum: ['tool_calls'] + }, + tool_calls: { + type: 'array', + description: + 'An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`.\n', + items: { + oneOf: [ + { + title: 'Code interpreter tool call', + type: 'object', + description: + 'Details of the Code Interpreter tool call the run step was involved in.', + properties: { + index: { + type: 'integer', + description: + 'The index of the tool call in the tool calls array.' + }, + id: { + type: 'string', + description: 'The ID of the tool call.' + }, + type: { + type: 'string', + description: + 'The type of tool call. This is always going to be `code_interpreter` for this type of tool call.', + enum: ['code_interpreter'] + }, + code_interpreter: { + type: 'object', + description: + 'The Code Interpreter tool call definition.', + properties: { + input: { + type: 'string', + description: + 'The input to the Code Interpreter tool call.' + }, + outputs: { + type: 'array', + description: + 'The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.', + items: { + type: 'object', + oneOf: [ + { + title: 'Code interpreter log output', + type: 'object', + description: + 'Text output from the Code Interpreter tool call as part of a run step.', + properties: { + index: { + type: 'integer', + description: + 'The index of the output in the outputs array.' + }, + type: { + description: 'Always `logs`.', + type: 'string', + enum: ['logs'] + }, + logs: { + type: 'string', + description: + 'The text output from the Code Interpreter tool call.' + } + }, + required: ['index', 'type'] + }, + { + title: 'Code interpreter image output', + type: 'object', + properties: { + index: { + type: 'integer', + description: + 'The index of the output in the outputs array.' + }, + type: { + description: 'Always `image`.', + type: 'string', + enum: ['image'] + }, + image: { + type: 'object', + properties: { + file_id: { + description: + 'The [file](/docs/api-reference/files) ID of the image.', + type: 'string' + } + } + } + }, + required: ['index', 'type'] + } + ], + 'x-oaiExpandable': true + } + } + } + } + }, + required: ['index', 'type'] + }, + { + title: 'File search tool call', + type: 'object', + properties: { + index: { + type: 'integer', + description: + 'The index of the tool call in the tool calls array.' + }, + id: { + type: 'string', + description: 'The ID of the tool call object.' + }, + type: { + type: 'string', + description: + 'The type of tool call. This is always going to be `file_search` for this type of tool call.', + enum: ['file_search'] + }, + file_search: { + type: 'object', + description: + 'For now, this is always going to be an empty object.', + 'x-oaiTypeLabel': 'map' + } + }, + required: ['index', 'type', 'file_search'] + }, + { + type: 'object', + title: 'Function tool call', + properties: { + index: { + type: 'integer', + description: + 'The index of the tool call in the tool calls array.' + }, + id: { + type: 'string', + description: 'The ID of the tool call object.' + }, + type: { + type: 'string', + description: + 'The type of tool call. This is always going to be `function` for this type of tool call.', + enum: ['function'] + }, + function: { + type: 'object', + description: + 'The definition of the function that was called.', + properties: { + name: { + type: 'string', + description: 'The name of the function.' + }, + arguments: { + type: 'string', + description: 'The arguments passed to the function.' + }, + output: { + type: 'string', + description: + 'The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet.', + nullable: true + } + } + } + }, + required: ['index', 'type'] + } + ], + 'x-oaiExpandable': true + } + } + }, + required: ['type'] + } + ] + }) + ) +} +cache['4a8085256bc70defb23fb255e39169b1'] = { + id: T.String(), + object: T.Union(cache['401d8a91954d3dda41bf4fa780fa8f41']), + delta: T.Object(cache['8deb50e71928cfc58d6543c2b6616ec0']) +} +cache['b20564ad044bd9504bd100e6cab1b7d6'] = [T.Literal('message_creation')] +cache['84622944795035f0c072d60c4a698814'] = { + message_id: T.String() +} +cache['7341a2e6b5b7ef84dae480cd8e7ee1e9'] = { + type: T.Union(cache['b20564ad044bd9504bd100e6cab1b7d6']), + message_creation: T.Object(cache['84622944795035f0c072d60c4a698814']) +} +cache['29f9d17dafbb944c6bbec104fe6b1ba4'] = { + message_id: T.Optional(T.String()) +} +cache['a740499823065c2d5fe19d94d9d29016'] = { + type: T.Union(cache['b20564ad044bd9504bd100e6cab1b7d6']), + message_creation: T.Optional( + T.Object(cache['29f9d17dafbb944c6bbec104fe6b1ba4']) + ) +} +cache['29d983b1b08e777df7766537f30bbc8b'] = [T.Literal('tool_calls')] +cache['d66db088d4466dc3406c1ccf975823db'] = T.Any() +cache['9f3aa0a0196de37a7ffc5353ea27fa3a'] = { + type: T.Union(cache['29d983b1b08e777df7766537f30bbc8b']), + tool_calls: T.Array(cache['d66db088d4466dc3406c1ccf975823db']) +} +cache['76e7933c1544bbb6b2e39f3e49e22903'] = T.Any() +cache['d91c599917ea16662d0bc6ae28e39c69'] = { + type: T.Union(cache['29d983b1b08e777df7766537f30bbc8b']), + tool_calls: T.Optional(T.Array(cache['76e7933c1544bbb6b2e39f3e49e22903'])) +} +cache['6bc25b3d9244096867769f32cf993103'] = Json({ + oneOf: [ + { + title: 'Code Interpreter log output', + type: 'object', + description: + 'Text output from the Code Interpreter tool call as part of a run step.', + properties: { + type: { description: 'Always `logs`.', type: 'string', enum: ['logs'] }, + logs: { + type: 'string', + description: 'The text output from the Code Interpreter tool call.' + } + }, + required: ['type', 'logs'] + }, + { + title: 'Code Interpreter image output', + type: 'object', + properties: { + type: { + description: 'Always `image`.', + type: 'string', + enum: ['image'] + }, + image: { + type: 'object', + properties: { + file_id: { + description: + 'The [file](/docs/api-reference/files) ID of the image.', + type: 'string' + } + }, + required: ['file_id'] + } + }, + required: ['type', 'image'] + } + ] +}) +cache['dca9dc4ede560556314dfdf333b2b7c7'] = { + input: T.String(), + outputs: T.Array(cache['6bc25b3d9244096867769f32cf993103']) +} +cache['530736f08989089adcfcd56bf3259f4e'] = { + id: T.String(), + type: T.Union(cache['2d4711c91803ab303abfd256fdb1170f']), + code_interpreter: T.Object(cache['dca9dc4ede560556314dfdf333b2b7c7']) +} +cache['14c2341711858bb7a6cb0d8004c993c5'] = Json({ + oneOf: [ + { + title: 'Code interpreter log output', + type: 'object', + description: + 'Text output from the Code Interpreter tool call as part of a run step.', + properties: { + index: { + type: 'integer', + description: 'The index of the output in the outputs array.' + }, + type: { description: 'Always `logs`.', type: 'string', enum: ['logs'] }, + logs: { + type: 'string', + description: 'The text output from the Code Interpreter tool call.' + } + }, + required: ['index', 'type'] + }, + { + title: 'Code interpreter image output', + type: 'object', + properties: { + index: { + type: 'integer', + description: 'The index of the output in the outputs array.' + }, + type: { + description: 'Always `image`.', + type: 'string', + enum: ['image'] + }, + image: { + type: 'object', + properties: { + file_id: { + description: + 'The [file](/docs/api-reference/files) ID of the image.', + type: 'string' + } + } + } + }, + required: ['index', 'type'] + } + ] +}) +cache['273971d0eef67ec38fe88334b3c73468'] = { + input: T.Optional(T.String()), + outputs: T.Optional(T.Array(cache['14c2341711858bb7a6cb0d8004c993c5'])) +} +cache['90fb45ee9d24e812f2bce870f6437f19'] = { + index: T.Integer(), + id: T.Optional(T.String()), + type: T.Union(cache['2d4711c91803ab303abfd256fdb1170f']), + code_interpreter: T.Optional( + T.Object(cache['273971d0eef67ec38fe88334b3c73468']) + ) +} +cache['784ff3ff024857449af0bbed9b0edefe'] = [T.Literal('logs')] +cache['2dae3289e35ff93bd96a0ab44c7e38b9'] = { + type: T.Union(cache['784ff3ff024857449af0bbed9b0edefe']), + logs: T.String() +} +cache['859c500bbee11e8939ff5cd2cb221489'] = { + index: T.Integer(), + type: T.Union(cache['784ff3ff024857449af0bbed9b0edefe']), + logs: T.Optional(T.String()) +} +cache['9dd10c71f1b76291165a18f47086a7c1'] = [T.Literal('image')] +cache['fd930a3dddbcda9b855f6ca95865f495'] = { + file_id: T.String() +} +cache['1095c9779fbfeb9a60166770440713c5'] = { + type: T.Union(cache['9dd10c71f1b76291165a18f47086a7c1']), + image: T.Object(cache['fd930a3dddbcda9b855f6ca95865f495']) +} +cache['09821ac9122d28023efcc2e130b9ad7b'] = { + file_id: T.Optional(T.String()) +} +cache['8931e2f6296928a3271a232a025fe035'] = { + index: T.Integer(), + type: T.Union(cache['9dd10c71f1b76291165a18f47086a7c1']), + image: T.Optional(T.Object(cache['09821ac9122d28023efcc2e130b9ad7b'])) +} +cache['2f188caf7404c22c7e647eefaf915f1a'] = { + id: T.String(), + type: T.Union(cache['3452c54e2704cafa4fe01757eef52cc2']), + file_search: Json() +} +cache['d763f7e67bae401d784edd02e5d7f1d5'] = { + index: T.Integer(), + id: T.Optional(T.String()), + type: T.Union(cache['3452c54e2704cafa4fe01757eef52cc2']), + file_search: Json() +} +cache['8340f0b94fe566d8ae9b0a61093917da'] = { + name: T.String(), + arguments: T.String(), + output: T.String() +} +cache['fac4366cb736fe71dcaa3d14deb14c5f'] = { + id: T.String(), + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Object(cache['8340f0b94fe566d8ae9b0a61093917da']) +} +cache['6b5f4d414b738a1bd7db268a7fe7070f'] = { + name: T.Optional(T.String()), + arguments: T.Optional(T.String()), + output: T.Optional(T.String()) +} +cache['527f17af52d8fe7a26829282496400c5'] = { + index: T.Integer(), + id: T.Optional(T.String()), + type: T.Union(cache['78a70c640dc014fc048915402571c97d']), + function: T.Optional(T.Object(cache['6b5f4d414b738a1bd7db268a7fe7070f'])) +} +cache['b137bbcba6187c63705ed403bc551593'] = [T.Literal('other')] +cache['1fec2e9d01288cd17b5bfa655df4a3eb'] = { + type: T.Union(cache['b137bbcba6187c63705ed403bc551593']) +} +cache['1eafa3b2f869a5ebf4639aa9ca63fd49'] = [T.Literal('static')] +cache['29c111f913b37f58cdbde793f02345b5'] = { + max_chunk_size_tokens: T.Integer({ minimum: 100, maximum: 4096 }), + chunk_overlap_tokens: T.Integer() +} +cache['1d8e536284b22230424471ec1eaa0afa'] = { + type: T.Union(cache['1eafa3b2f869a5ebf4639aa9ca63fd49']), + static: T.Object(cache['29c111f913b37f58cdbde793f02345b5'], { + additionalProperties: false + }) +} +cache['bb7de6ef53ae40c684589415e01adfb9'] = [T.Literal('auto')] +cache['22d359b68212ad54c64a4e3a3b548024'] = { + type: T.Union(cache['bb7de6ef53ae40c684589415e01adfb9']) +} +cache['3f32fbcc9f0eca88dbd842608b4dfcf7'] = [T.Literal('error')] +cache['8dac0bc5f136e9037b8071c21579f9f7'] = { + event: T.Union(cache['3f32fbcc9f0eca88dbd842608b4dfcf7']), + data: T.Object(cache['ab1d6b5dfdbaadf9a17ec394b68df07b']) +} +cache['9faad0899cc60e569a106c46704a0fab'] = [T.Literal('done')] +cache['de4f75293b1bbafe78664caabf3a4d25'] = [T.Literal('[DONE]')] +cache['309e13e70aef96c338656e1ffd6106e1'] = { + event: T.Union(cache['9faad0899cc60e569a106c46704a0fab']), + data: T.Union(cache['de4f75293b1bbafe78664caabf3a4d25']) +} +cache['5467f3eaf89ef5ec2614485e5ede6c3b'] = [T.Literal('POST')] +cache['a1a4e5ba50917aa2fc6f201c45ee9585'] = { + custom_id: T.Optional(T.String()), + method: T.Optional(T.Union(cache['5467f3eaf89ef5ec2614485e5ede6c3b'])), + url: T.Optional(T.String()) +} +cache['4c605f2eb40c3f3f60ab806feb638fcb'] = { + status_code: T.Optional(T.Integer()), + request_id: T.Optional(T.String()), + body: T.Optional(Json()) +} +cache['c43fab43aab287169915fe17fb2e1971'] = { + code: T.Optional(T.String()), + message: T.Optional(T.String()) +} +cache['876c76c736c0c1e61fa06f9f1bf7cf36'] = { + id: T.Optional(T.String()), + custom_id: T.Optional(T.String()), + response: T.Optional(T.Object(cache['4c605f2eb40c3f3f60ab806feb638fcb'])), + error: T.Optional(T.Object(cache['c43fab43aab287169915fe17fb2e1971'])) +} + +const schema = { + '/chat/completions': { + POST: { + args: T.Object({ + body: T.Object(cache['533ef2a989ee66dde5feefb7207aadef'], { + 'x-content-type': 'application/json' + }) + }), + data: T.Object(cache['b4247ecaa0539243e803718b73c0ea20'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/completions': { + POST: { + args: T.Object({ + body: T.Object(cache['ab1eaa61a000e22a30970151a2dbdae3'], { + 'x-content-type': 'application/json' + }) + }), + data: T.Object(cache['9e6c4887192a2980da29dc808136228b'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/images/generations': { + POST: { + args: T.Object({ + body: T.Object(cache['378c1a1d01596ebee6b7df5e0e964c34'], { + 'x-content-type': 'application/json' + }) + }), + data: T.Object(cache['6a214a678d3d983724191d71f53d3882'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/images/edits': { + POST: { + args: T.Object({ + body: T.Object(cache['e8f2c6f7f880ca40d8d13f2c1b49b320'], { + 'x-content-type': 'multipart/form-data' + }) + }), + data: T.Object(cache['6a214a678d3d983724191d71f53d3882'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/images/variations': { + POST: { + args: T.Object({ + body: T.Object(cache['fb2088789c6c61b655eb04b8ce15611a'], { + 'x-content-type': 'multipart/form-data' + }) + }), + data: T.Object(cache['6a214a678d3d983724191d71f53d3882'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/embeddings': { + POST: { + args: T.Object({ + body: T.Object(cache['ccdf2e80da8a26530863685b9ab4c67f'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['341d2859131bfedcf2f42ec4742cbf17'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/audio/speech': { + POST: { + args: T.Object({ + body: T.Object(cache['0e5d01026ac12129c45911b934c108dc'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.String({ + 'x-status-code': '200', + 'x-content-type': 'application/octet-stream', + format: 'binary' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/audio/transcriptions': { + POST: { + args: T.Object({ + body: T.Object(cache['cd1a2b32e62b1991943ff6a10cfe92a0'], { + 'x-content-type': 'multipart/form-data', + additionalProperties: false + }) + }), + data: T.Any(), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/audio/translations': { + POST: { + args: T.Object({ + body: T.Object(cache['ce56d7a02eda5fc5e1e6ae8f44b7df4d'], { + 'x-content-type': 'multipart/form-data', + additionalProperties: false + }) + }), + data: T.Any(), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/files': { + GET: { + args: T.Optional( + T.Object({ + query: T.Optional(T.Object(cache['5d9fccb5a3f83bf58e7a31f78fa56600'])) + }) + ), + data: T.Object(cache['69f3d06cf36beecb7106015b2019bf32'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + body: T.Object(cache['f1eaf98b29e72deca8f81354ebeefab6'], { + 'x-content-type': 'multipart/form-data', + additionalProperties: false + }) + }), + data: T.Object(cache['b251863b7c08fef2022f1521498922e9'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/files/{file_id}': { + DELETE: { + args: T.Object({ + params: T.Object(cache['313598d7345ad28e456238f5691a68c8']) + }), + data: T.Object(cache['dbc502a1e44b3958fc05e41fc329da59'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + GET: { + args: T.Object({ + params: T.Object(cache['313598d7345ad28e456238f5691a68c8']) + }), + data: T.Object(cache['b251863b7c08fef2022f1521498922e9'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/files/{file_id}/content': { + GET: { + args: T.Object({ + params: T.Object(cache['313598d7345ad28e456238f5691a68c8']) + }), + data: T.String({ + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/uploads': { + POST: { + args: T.Object({ + body: T.Object(cache['63d9466b04243ae34500477a25205563'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['3b836fb3a52aee8a6648db9e30836db5'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/uploads/{upload_id}/parts': { + POST: { + args: T.Object({ + params: T.Object(cache['498cc1453eb8ac1a69c74aa2abee6e25']), + body: T.Object(cache['8fb04687877d6ff4d083f397e24371cb'], { + 'x-content-type': 'multipart/form-data', + additionalProperties: false + }) + }), + data: T.Object(cache['82b9938da6f29f2a4cd7fdcc660e811d'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/uploads/{upload_id}/complete': { + POST: { + args: T.Object({ + params: T.Object(cache['498cc1453eb8ac1a69c74aa2abee6e25']), + body: T.Object(cache['664528ed31bd165f0169bbcf2e28621a'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['3b836fb3a52aee8a6648db9e30836db5'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/uploads/{upload_id}/cancel': { + POST: { + args: T.Object({ + params: T.Object(cache['498cc1453eb8ac1a69c74aa2abee6e25']) + }), + data: T.Object(cache['3b836fb3a52aee8a6648db9e30836db5'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/fine_tuning/jobs': { + POST: { + args: T.Object({ + body: T.Object(cache['cf2647be9ed63bc5488a87cb0d563e61'], { + 'x-content-type': 'application/json' + }) + }), + data: T.Object(cache['f4831f54ade0faa46894bc4ab7d4ae34'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + GET: { + args: T.Optional( + T.Object({ + query: T.Optional(T.Object(cache['58953d15fba8bb0f5cd2c53aa3671d3a'])) + }) + ), + data: T.Object(cache['424ddce3d1697042396663ce3e79c1db'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/fine_tuning/jobs/{fine_tuning_job_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['ef40b414cabe5d4a15d94b716cd9c2fc']) + }), + data: T.Object(cache['f4831f54ade0faa46894bc4ab7d4ae34'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/fine_tuning/jobs/{fine_tuning_job_id}/events': { + GET: { + args: T.Object({ + params: T.Object(cache['aed544d9d14acecd14e47c8658fe8b0c']), + query: T.Optional(T.Object(cache['47c4bbca653892d1d09e97b759ad3e7c'])) + }), + data: T.Object(cache['dc5e7404879b229d546a560a0ee7a760'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/fine_tuning/jobs/{fine_tuning_job_id}/cancel': { + POST: { + args: T.Object({ + params: T.Object(cache['b34d480db9bee03d5900078d6818a239']) + }), + data: T.Object(cache['f4831f54ade0faa46894bc4ab7d4ae34'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints': { + GET: { + args: T.Object({ + params: T.Object(cache['f1f8bea1fa0038e1df2de20991ae76b4']), + query: T.Optional(T.Object(cache['f4cfae83a3a8d31fd15057b5f6ec1cbc'])) + }), + data: T.Object(cache['6400230492b2b2d36b76ab9c249e9a54'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/models': { + GET: { + args: T.Void(), + data: T.Object(cache['de1770e98bcba00d335a758af486f2c0'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/models/{model}': { + GET: { + args: T.Object({ + params: T.Object(cache['ea5e0eb15decade39819bf8d1158e96c']) + }), + data: T.Object(cache['f985d5a3b7e93f0e5e42a79b59dd70b0'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + DELETE: { + args: T.Object({ + params: T.Object(cache['60a9ef36d1ebefc9c74cb7fbf067b274']) + }), + data: T.Object(cache['3acb79c99fce6f7610e051543d60a3e1'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/moderations': { + POST: { + args: T.Object({ + body: T.Object(cache['1e0461f5f1cdeb8cd7b5e3d707433c23'], { + 'x-content-type': 'application/json' + }) + }), + data: T.Object(cache['ca8dc0f3835cc7ceb7c69b0bcd79a64f'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/assistants': { + GET: { + args: T.Optional( + T.Object({ + query: T.Optional(T.Object(cache['00ed673da5f8d0f8bdc2aec27c0d32f9'])) + }) + ), + data: T.Object(cache['9081c315ba1338b89748aa0b6479391d'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + body: T.Object(cache['7520e1a7c95f8ccdef2c8eda02751aaa'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['7882b5109074218a773e2d39166a7be5'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/assistants/{assistant_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['f5eef158e61c2b13755b4f05c38af46a']) + }), + data: T.Object(cache['7882b5109074218a773e2d39166a7be5'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['dd0e49988a038fbe96bb85ce7b811637']), + body: T.Object(cache['95ecfc7eed16d50c8a786902f0c3fed8'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['7882b5109074218a773e2d39166a7be5'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + DELETE: { + args: T.Object({ + params: T.Object(cache['dd97105ffc02ac90d008a244359fe4ac']) + }), + data: T.Object(cache['83c5a807ac0ebfe253fb808ae9798153'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads': { + POST: { + args: T.Optional( + T.Object({ + body: T.Optional( + T.Object(cache['12819c881a5e74b6f58a9f0891043262'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + ) + }) + ), + data: T.Object(cache['843eeaceedb08259af683687a0aa2bdf'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['2366494be21ce9b8eb9877111fdec21a']) + }), + data: T.Object(cache['843eeaceedb08259af683687a0aa2bdf'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['7273293413ffa9055c2481b1cd3d4642']), + body: T.Object(cache['1c720356a35580bcf8e4b9b5a920ed57'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['843eeaceedb08259af683687a0aa2bdf'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + DELETE: { + args: T.Object({ + params: T.Object(cache['73c04a68437b0c946c43407635b42e71']) + }), + data: T.Object(cache['9939d1955732b534db457a6302c78878'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/messages': { + GET: { + args: T.Object({ + params: T.Object(cache['3611c4f70d67730538f1c94ff6f6cb93']), + query: T.Optional(T.Object(cache['be683abc499e874ff4a72d3af0b7804b'])) + }), + data: T.Object(cache['59d3dec5b533735db4e2f3a3e16561d7'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['41d908fb513fb358207880c572c1af3e']), + body: T.Object(cache['dfc91097389707b177bd01c35e017eaa'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['9919ce439b06e6cb45eba3bc75cbb9a6'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/messages/{message_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['d4d12030e061f44c9c55afbdf463eafd']) + }), + data: T.Object(cache['9919ce439b06e6cb45eba3bc75cbb9a6'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['fbca0ddc436612e084f356472689bcb2']), + body: T.Object(cache['e72516203ab15db84c83493e3c34ce40'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['9919ce439b06e6cb45eba3bc75cbb9a6'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + DELETE: { + args: T.Object({ + params: T.Object(cache['117a5a0b2e983845bfea3395f50556a3']) + }), + data: T.Object(cache['9abc628d8039f81daf13b967df78ff44'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/runs': { + POST: { + args: T.Object({ + body: T.Object(cache['2aa38b2cf412659a625c062134f34400'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['ca4149ebb610524f2504d5efcb933037'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/runs': { + GET: { + args: T.Object({ + params: T.Object(cache['a0ec30453187155d4ab35c046259e40e']), + query: T.Optional(T.Object(cache['00ed673da5f8d0f8bdc2aec27c0d32f9'])) + }), + data: T.Object(cache['a7527aec923b3c24c4a77e5b5b347ee3'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['51e260731530a59a0cb37faedb5f0a6f']), + body: T.Object(cache['889c497d349b903ef8b7e66f1f7f1f78'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['ca4149ebb610524f2504d5efcb933037'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/runs/{run_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['c4e7dad4927de29148261c74707a24be']) + }), + data: T.Object(cache['ca4149ebb610524f2504d5efcb933037'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['b088e7f74ac7e36a1e9ed8d96aa142e7']), + body: T.Object(cache['e72516203ab15db84c83493e3c34ce40'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['ca4149ebb610524f2504d5efcb933037'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/runs/{run_id}/submit_tool_outputs': { + POST: { + args: T.Object({ + params: T.Object(cache['c6c4bc41389d1b97c63f61351e7e2e40']), + body: T.Object(cache['2a39b62dc91107419a6b6b45a2fd3cde'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['ca4149ebb610524f2504d5efcb933037'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/runs/{run_id}/cancel': { + POST: { + args: T.Object({ + params: T.Object(cache['919a50c78f95a064b8ce8888e5a7feb8']) + }), + data: T.Object(cache['ca4149ebb610524f2504d5efcb933037'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/runs/{run_id}/steps': { + GET: { + args: T.Object({ + params: T.Object(cache['a98f3716ff05056e3907ed6dd04dd57d']), + query: T.Optional(T.Object(cache['00ed673da5f8d0f8bdc2aec27c0d32f9'])) + }), + data: T.Object(cache['e52dccee327d5a8f917ad2553f54a22a'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/threads/{thread_id}/runs/{run_id}/steps/{step_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['29990e860512d3007a6d0821f2df00d8']) + }), + data: T.Object(cache['854aaaa64b1e916bcd12f8e453be1319'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores': { + GET: { + args: T.Optional( + T.Object({ + query: T.Optional(T.Object(cache['00ed673da5f8d0f8bdc2aec27c0d32f9'])) + }) + ), + data: T.Object(cache['ff74fee0b40c9e2f94ce4aaa9f863cc9'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + body: T.Object(cache['bb490d308693e8cdd597c0ee42323db6'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['106f91aac5881e610e7179d48348abbb'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['e4b1b7dd4b14d50e5bd0c9ddd5d33286']) + }), + data: T.Object(cache['106f91aac5881e610e7179d48348abbb'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['f65d5eea2ede29c9d262a74b9f49d055']), + body: T.Object(cache['89224ea2a0ac9d6f9f0f50a60a5780dd'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['106f91aac5881e610e7179d48348abbb'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + DELETE: { + args: T.Object({ + params: T.Object(cache['8dd11ad92b9242f0285cf92d0b1c0286']) + }), + data: T.Object(cache['3cf239f84a4a43b6d81c8ef36c8b3c6c'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}/files': { + GET: { + args: T.Object({ + params: T.Object(cache['546de948e6308c89852c9c106d58d9d3']), + query: T.Optional(T.Object(cache['cbe79cc9e800b0f7dedcc853786f0dda'])) + }), + data: T.Object(cache['fe5638ea0024ceb6efb6cd1bb3123c9e'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + POST: { + args: T.Object({ + params: T.Object(cache['05e213dbdf2ba57e4f5cb6c66d23b9e6']), + body: T.Object(cache['ea7e7440bc7428abf277aa8ee93183ae'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['4cfbe31ffd0b4e4eb1b22150bb0f2967'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}/files/{file_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['9cbf3bf0882e6bb4e57e7af6642167f9']) + }), + data: T.Object(cache['4cfbe31ffd0b4e4eb1b22150bb0f2967'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + DELETE: { + args: T.Object({ + params: T.Object(cache['2b5166643e372af6b57c8654ca24f390']) + }), + data: T.Object(cache['6ea46d7ad422330b1c96d02366583a97'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}/file_batches': { + POST: { + args: T.Object({ + params: T.Object(cache['3ecd3793a6bef4c614966479c9b8fe2b']), + body: T.Object(cache['cd92fc6b54146a71b64b6ef1f72c6e7f'], { + 'x-content-type': 'application/json', + additionalProperties: false + }) + }), + data: T.Object(cache['faab15370c6ceb87be31157f86ef9c4d'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}/file_batches/{batch_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['7382cf97dd9361e7496fe62a161eafe0']) + }), + data: T.Object(cache['faab15370c6ceb87be31157f86ef9c4d'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel': { + POST: { + args: T.Object({ + params: T.Object(cache['18dfbefad078b465ca74296519cb3530']) + }), + data: T.Object(cache['faab15370c6ceb87be31157f86ef9c4d'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/vector_stores/{vector_store_id}/file_batches/{batch_id}/files': { + GET: { + args: T.Object({ + params: T.Object(cache['4ec6fe4f9d647e7cd6bb799f76d53b87']), + query: T.Optional(T.Object(cache['cbe79cc9e800b0f7dedcc853786f0dda'])) + }), + data: T.Object(cache['fe5638ea0024ceb6efb6cd1bb3123c9e'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/batches': { + POST: { + args: T.Object({ + body: T.Object(cache['36d0e17dc9401aaf7fedb03cb865e3b0'], { + 'x-content-type': 'application/json' + }) + }), + data: T.Object(cache['fd4c666117c585b3f0057a20ad2d2eb7'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + }, + GET: { + args: T.Optional( + T.Object({ + query: T.Optional(T.Object(cache['42149f01eabed9777658c18b7af0f013'])) + }) + ), + data: T.Object(cache['e76a3aeddcfcbc86b8cc209163cac0e0'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/batches/{batch_id}': { + GET: { + args: T.Object({ + params: T.Object(cache['98a516d4a5d3ab2209b07207210f3e27']) + }), + data: T.Object(cache['fd4c666117c585b3f0057a20ad2d2eb7'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + }, + '/batches/{batch_id}/cancel': { + POST: { + args: T.Object({ + params: T.Object(cache['9742c95ee2abb542c28a4b5930635248']) + }), + data: T.Object(cache['fd4c666117c585b3f0057a20ad2d2eb7'], { + 'x-status-code': '200', + 'x-content-type': 'application/json' + }), + error: T.Union([T.Any({ 'x-status-code': 'default' })]) + } + } +} + +const _components = { + schemas: { + Error: T.Object(cache['ab1d6b5dfdbaadf9a17ec394b68df07b']), + ErrorResponse: T.Object(cache['1cb9916667a80bc36e1d5ce7545abfab']), + ListModelsResponse: T.Object(cache['de1770e98bcba00d335a758af486f2c0']), + DeleteModelResponse: T.Object(cache['3acb79c99fce6f7610e051543d60a3e1']), + CreateCompletionRequest: T.Object( + cache['ab1eaa61a000e22a30970151a2dbdae3'] + ), + CreateCompletionResponse: T.Object( + cache['9e6c4887192a2980da29dc808136228b'] + ), + ChatCompletionRequestMessageContentPart: T.Any(), + ChatCompletionRequestMessageContentPartImage: T.Object( + cache['73e8204042ebb8e1ae7fcd4b97cb0b6a'] + ), + ChatCompletionRequestMessageContentPartText: T.Object( + cache['1d65ed0800bcbfa572f19b20e4e05d8c'] + ), + ChatCompletionRequestMessage: T.Any(), + ChatCompletionRequestSystemMessage: T.Object( + cache['92698f76445604b7a0396447b24f1d64'] + ), + ChatCompletionRequestUserMessage: T.Object( + cache['7edd3994414548b4a3436df93b2a8fb4'] + ), + ChatCompletionRequestAssistantMessage: T.Object( + cache['209b2c57d56a0f28263eb42ae0ee8744'] + ), + FineTuneChatCompletionRequestAssistantMessage: T.Intersect( + cache['52ce0e478a37e2607bad51d33f1423a5'], + { required: ['role'] } + ), + ChatCompletionRequestToolMessage: T.Object( + cache['5be546f119a7ef874b54d6c255894974'] + ), + ChatCompletionRequestFunctionMessage: T.Object( + cache['535476e8458c1c85126986c7953ac5ed'] + ), + FunctionParameters: Json({ additionalProperties: true }), + ChatCompletionFunctions: T.Object( + cache['8a0e72bd020a90249508a3d6f36a7983'] + ), + ChatCompletionFunctionCallOption: T.Object( + cache['58244a1afb20970b3d9cbb13f1afbd6e'] + ), + ChatCompletionTool: T.Object(cache['a3ce909949dc5ef8380a9acaeba1efc9']), + FunctionObject: T.Object(cache['8a0e72bd020a90249508a3d6f36a7983']), + ChatCompletionToolChoiceOption: T.Any(), + ChatCompletionNamedToolChoice: T.Object( + cache['59511b612909655f97ba812e3284d0ab'] + ), + ParallelToolCalls: T.Boolean({ default: true }), + ChatCompletionMessageToolCalls: T.Array( + cache['0834704c8cede1f92348ff754bdd80f6'] + ), + ChatCompletionMessageToolCall: T.Object( + cache['9856d7691d59a2ed419325465faf362a'] + ), + ChatCompletionMessageToolCallChunk: T.Object( + cache['183cada67ebb813c671460d3f81035e7'] + ), + ChatCompletionRole: T.Union(cache['a3edd7eb6af65b9b3342569390f07650']), + ChatCompletionStreamOptions: T.Object( + cache['35aebd667abc35dedb7a3bb43497761e'], + { default: null } + ), + ChatCompletionResponseMessage: T.Object( + cache['c69b0c46ff5553dbc0c5254e9e735ca5'] + ), + ChatCompletionStreamResponseDelta: T.Object( + cache['295e059c1295854543a1b718fedc01f4'] + ), + CreateChatCompletionRequest: T.Object( + cache['533ef2a989ee66dde5feefb7207aadef'] + ), + CreateChatCompletionResponse: T.Object( + cache['b4247ecaa0539243e803718b73c0ea20'] + ), + CreateChatCompletionFunctionResponse: T.Object( + cache['6302c061cd828bcc8af26231e0a6023d'] + ), + ChatCompletionTokenLogprob: T.Object( + cache['32aecf538dc34400550f8feaa639c90b'] + ), + ListPaginatedFineTuningJobsResponse: T.Object( + cache['424ddce3d1697042396663ce3e79c1db'] + ), + CreateChatCompletionStreamResponse: T.Object( + cache['858ab29c2873cd9af7d9e26e0a387d74'] + ), + CreateChatCompletionImageResponse: Json(), + CreateImageRequest: T.Object(cache['378c1a1d01596ebee6b7df5e0e964c34']), + ImagesResponse: T.Object(cache['6a214a678d3d983724191d71f53d3882']), + Image: T.Object(cache['11a791cdcf68079c8dfbde956e16407a']), + CreateImageEditRequest: T.Object(cache['e8f2c6f7f880ca40d8d13f2c1b49b320']), + CreateImageVariationRequest: T.Object( + cache['fb2088789c6c61b655eb04b8ce15611a'] + ), + CreateModerationRequest: T.Object( + cache['1e0461f5f1cdeb8cd7b5e3d707433c23'] + ), + CreateModerationResponse: T.Object( + cache['ca8dc0f3835cc7ceb7c69b0bcd79a64f'] + ), + ListFilesResponse: T.Object(cache['69f3d06cf36beecb7106015b2019bf32']), + CreateFileRequest: T.Object(cache['f1eaf98b29e72deca8f81354ebeefab6'], { + additionalProperties: false + }), + DeleteFileResponse: T.Object(cache['dbc502a1e44b3958fc05e41fc329da59']), + CreateUploadRequest: T.Object(cache['63d9466b04243ae34500477a25205563'], { + additionalProperties: false + }), + AddUploadPartRequest: T.Object(cache['8fb04687877d6ff4d083f397e24371cb'], { + additionalProperties: false + }), + CompleteUploadRequest: T.Object(cache['664528ed31bd165f0169bbcf2e28621a'], { + additionalProperties: false + }), + CancelUploadRequest: Json({ additionalProperties: false }), + CreateFineTuningJobRequest: T.Object( + cache['cf2647be9ed63bc5488a87cb0d563e61'] + ), + ListFineTuningJobEventsResponse: T.Object( + cache['dc5e7404879b229d546a560a0ee7a760'] + ), + ListFineTuningJobCheckpointsResponse: T.Object( + cache['6400230492b2b2d36b76ab9c249e9a54'] + ), + CreateEmbeddingRequest: T.Object( + cache['ccdf2e80da8a26530863685b9ab4c67f'], + { additionalProperties: false } + ), + CreateEmbeddingResponse: T.Object( + cache['341d2859131bfedcf2f42ec4742cbf17'] + ), + CreateTranscriptionRequest: T.Object( + cache['cd1a2b32e62b1991943ff6a10cfe92a0'], + { additionalProperties: false } + ), + CreateTranscriptionResponseJson: T.Object( + cache['6057c21d25418b1df74f7d1f40564832'] + ), + TranscriptionSegment: T.Object(cache['9997baee46d5a11c20b29a44c2da1cdd']), + TranscriptionWord: T.Object(cache['7d40fe46e77cf9210b9e49ff02cd11df']), + CreateTranscriptionResponseVerboseJson: T.Object( + cache['99336b435aaca4e9b904674efb05eef1'] + ), + CreateTranslationRequest: T.Object( + cache['ce56d7a02eda5fc5e1e6ae8f44b7df4d'], + { additionalProperties: false } + ), + CreateTranslationResponseJson: T.Object( + cache['b8b74809e88818c33b81e19060b02636'] + ), + CreateTranslationResponseVerboseJson: T.Object( + cache['e844cb0a671d7eb4e3d747c1620f1fb4'] + ), + CreateSpeechRequest: T.Object(cache['0e5d01026ac12129c45911b934c108dc'], { + additionalProperties: false + }), + Model: T.Object(cache['f985d5a3b7e93f0e5e42a79b59dd70b0']), + OpenAIFile: T.Object(cache['b251863b7c08fef2022f1521498922e9']), + Upload: T.Object(cache['3b836fb3a52aee8a6648db9e30836db5']), + UploadPart: T.Object(cache['82b9938da6f29f2a4cd7fdcc660e811d']), + Embedding: T.Object(cache['92a40676f0c5249d788d0e90b23dafbb']), + FineTuningJob: T.Object(cache['f4831f54ade0faa46894bc4ab7d4ae34']), + FineTuningIntegration: T.Object(cache['61ff1a654058a8a4ae59b13ff2adaddc']), + FineTuningJobEvent: T.Object(cache['bd0d77a8375da70d1dfa3094714766c5']), + FineTuningJobCheckpoint: T.Object( + cache['9c2939363b31d0970ce00ec483070c0d'] + ), + FinetuneChatRequestInput: T.Object( + cache['7af5e4ab950a3ef6eddaf9254506e227'] + ), + FinetuneCompletionRequestInput: T.Object( + cache['dd2f2ceaeeb00ce3974684abd1d00df3'] + ), + CompletionUsage: T.Object(cache['26b974e6ea7bd3e6b1a26b3f0b24db14']), + RunCompletionUsage: T.Object(cache['da66f4ee7c397f4a92cad313900752ae']), + RunStepCompletionUsage: T.Object(cache['22b945819fb99309d5bf225b5d31281b']), + AssistantsApiResponseFormatOption: T.Any(), + AssistantsApiResponseFormat: T.Object( + cache['a78b3d57182ec82d9a9cc20e003f1569'] + ), + AssistantObject: T.Object(cache['7882b5109074218a773e2d39166a7be5']), + CreateAssistantRequest: T.Object( + cache['7520e1a7c95f8ccdef2c8eda02751aaa'], + { additionalProperties: false } + ), + ModifyAssistantRequest: T.Object( + cache['95ecfc7eed16d50c8a786902f0c3fed8'], + { additionalProperties: false } + ), + DeleteAssistantResponse: T.Object( + cache['83c5a807ac0ebfe253fb808ae9798153'] + ), + ListAssistantsResponse: T.Object(cache['9081c315ba1338b89748aa0b6479391d']), + AssistantToolsCode: T.Object(cache['6ba7f0abfc044550413da560fa4e703c']), + AssistantToolsFileSearch: T.Object( + cache['d54cc671bec33fda68c9e56a26092c3b'] + ), + AssistantToolsFileSearchTypeOnly: T.Object( + cache['f56074624619b5dae66c88acf4bc359b'] + ), + AssistantToolsFunction: T.Object(cache['144a45ac135d53cd2172c86dcbee741a']), + TruncationObject: T.Object(cache['b6d4dbea7badacde9ce3f7c625314a5e']), + AssistantsApiToolChoiceOption: T.Any(), + AssistantsNamedToolChoice: T.Object( + cache['952d397f2e2cc6bd8e8a7ff5b554f7c1'] + ), + RunObject: T.Object(cache['ca4149ebb610524f2504d5efcb933037']), + CreateRunRequest: T.Object(cache['889c497d349b903ef8b7e66f1f7f1f78'], { + additionalProperties: false + }), + ListRunsResponse: T.Object(cache['a7527aec923b3c24c4a77e5b5b347ee3']), + ModifyRunRequest: T.Object(cache['e72516203ab15db84c83493e3c34ce40'], { + additionalProperties: false + }), + SubmitToolOutputsRunRequest: T.Object( + cache['2a39b62dc91107419a6b6b45a2fd3cde'], + { additionalProperties: false } + ), + RunToolCallObject: T.Object(cache['93c4cc2f26696eb059d1c44f9ea0aa71']), + CreateThreadAndRunRequest: T.Object( + cache['2aa38b2cf412659a625c062134f34400'], + { additionalProperties: false } + ), + ThreadObject: T.Object(cache['843eeaceedb08259af683687a0aa2bdf']), + CreateThreadRequest: T.Object(cache['12819c881a5e74b6f58a9f0891043262'], { + additionalProperties: false + }), + ModifyThreadRequest: T.Object(cache['1c720356a35580bcf8e4b9b5a920ed57'], { + additionalProperties: false + }), + DeleteThreadResponse: T.Object(cache['9939d1955732b534db457a6302c78878']), + ListThreadsResponse: T.Object(cache['48c6b645f5107275bc015bcd2114b1ae']), + MessageObject: T.Object(cache['9919ce439b06e6cb45eba3bc75cbb9a6']), + MessageDeltaObject: T.Object(cache['bd3753ba84267f249a84f4ad186a25d6']), + CreateMessageRequest: T.Object(cache['dfc91097389707b177bd01c35e017eaa'], { + additionalProperties: false + }), + ModifyMessageRequest: T.Object(cache['e72516203ab15db84c83493e3c34ce40'], { + additionalProperties: false + }), + DeleteMessageResponse: T.Object(cache['9abc628d8039f81daf13b967df78ff44']), + ListMessagesResponse: T.Object(cache['59d3dec5b533735db4e2f3a3e16561d7']), + MessageContentImageFileObject: T.Object( + cache['057e362af536dff5c62509e7c0d26217'] + ), + MessageDeltaContentImageFileObject: T.Object( + cache['dd7e756c08a427be9b6c8e981b6f21f3'] + ), + MessageContentImageUrlObject: T.Object( + cache['eafa27404f5be1f4e0c7382dcac6aa1b'] + ), + MessageDeltaContentImageUrlObject: T.Object( + cache['68a79dee45eaed0dd6ee52bf9dbfb3fe'] + ), + MessageContentTextObject: T.Object( + cache['8a6b960cacf351db2aeb36df07bd437f'] + ), + MessageRequestContentTextObject: T.Object( + cache['8721d6be86e9e1099dff9fb1547d5fe4'] + ), + MessageContentTextAnnotationsFileCitationObject: T.Object( + cache['b451fd37b4d64d72fd7b3eda45094708'] + ), + MessageContentTextAnnotationsFilePathObject: T.Object( + cache['923b42080f94604245ea25b07159bf56'] + ), + MessageDeltaContentTextObject: T.Object( + cache['68a741d3ab394ef49caa56ef9c82e38f'] + ), + MessageDeltaContentTextAnnotationsFileCitationObject: T.Object( + cache['0d6193811156f8b80dd1da6cc1333c6d'] + ), + MessageDeltaContentTextAnnotationsFilePathObject: T.Object( + cache['5996d6360d41a346ed65bff1ad934c12'] + ), + RunStepObject: T.Object(cache['854aaaa64b1e916bcd12f8e453be1319']), + RunStepDeltaObject: T.Object(cache['4a8085256bc70defb23fb255e39169b1']), + ListRunStepsResponse: T.Object(cache['e52dccee327d5a8f917ad2553f54a22a']), + RunStepDetailsMessageCreationObject: T.Object( + cache['7341a2e6b5b7ef84dae480cd8e7ee1e9'] + ), + RunStepDeltaStepDetailsMessageCreationObject: T.Object( + cache['a740499823065c2d5fe19d94d9d29016'] + ), + RunStepDetailsToolCallsObject: T.Object( + cache['9f3aa0a0196de37a7ffc5353ea27fa3a'] + ), + RunStepDeltaStepDetailsToolCallsObject: T.Object( + cache['d91c599917ea16662d0bc6ae28e39c69'] + ), + RunStepDetailsToolCallsCodeObject: T.Object( + cache['530736f08989089adcfcd56bf3259f4e'] + ), + RunStepDeltaStepDetailsToolCallsCodeObject: T.Object( + cache['90fb45ee9d24e812f2bce870f6437f19'] + ), + RunStepDetailsToolCallsCodeOutputLogsObject: T.Object( + cache['2dae3289e35ff93bd96a0ab44c7e38b9'] + ), + RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: T.Object( + cache['859c500bbee11e8939ff5cd2cb221489'] + ), + RunStepDetailsToolCallsCodeOutputImageObject: T.Object( + cache['1095c9779fbfeb9a60166770440713c5'] + ), + RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: T.Object( + cache['8931e2f6296928a3271a232a025fe035'] + ), + RunStepDetailsToolCallsFileSearchObject: T.Object( + cache['2f188caf7404c22c7e647eefaf915f1a'] + ), + RunStepDeltaStepDetailsToolCallsFileSearchObject: T.Object( + cache['d763f7e67bae401d784edd02e5d7f1d5'] + ), + RunStepDetailsToolCallsFunctionObject: T.Object( + cache['fac4366cb736fe71dcaa3d14deb14c5f'] + ), + RunStepDeltaStepDetailsToolCallsFunctionObject: T.Object( + cache['527f17af52d8fe7a26829282496400c5'] + ), + VectorStoreExpirationAfter: T.Object( + cache['497041f3f833dcb471822d03a9157276'] + ), + VectorStoreObject: T.Object(cache['106f91aac5881e610e7179d48348abbb']), + CreateVectorStoreRequest: T.Object( + cache['bb490d308693e8cdd597c0ee42323db6'], + { additionalProperties: false } + ), + UpdateVectorStoreRequest: T.Object( + cache['89224ea2a0ac9d6f9f0f50a60a5780dd'], + { additionalProperties: false } + ), + ListVectorStoresResponse: T.Object( + cache['ff74fee0b40c9e2f94ce4aaa9f863cc9'] + ), + DeleteVectorStoreResponse: T.Object( + cache['3cf239f84a4a43b6d81c8ef36c8b3c6c'] + ), + VectorStoreFileObject: T.Object(cache['4cfbe31ffd0b4e4eb1b22150bb0f2967']), + OtherChunkingStrategyResponseParam: T.Object( + cache['1fec2e9d01288cd17b5bfa655df4a3eb'], + { additionalProperties: false } + ), + StaticChunkingStrategyResponseParam: T.Object( + cache['1d8e536284b22230424471ec1eaa0afa'], + { additionalProperties: false } + ), + StaticChunkingStrategy: T.Object( + cache['29c111f913b37f58cdbde793f02345b5'], + { additionalProperties: false } + ), + AutoChunkingStrategyRequestParam: T.Object( + cache['22d359b68212ad54c64a4e3a3b548024'], + { additionalProperties: false } + ), + StaticChunkingStrategyRequestParam: T.Object( + cache['1d8e536284b22230424471ec1eaa0afa'], + { additionalProperties: false } + ), + ChunkingStrategyRequestParam: Json({ + oneOf: [ + { + type: 'object', + title: 'Auto Chunking Strategy', + description: + 'The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `auto`.', + enum: ['auto'] + } + }, + required: ['type'] + }, + { + type: 'object', + title: 'Static Chunking Strategy', + additionalProperties: false, + properties: { + type: { + type: 'string', + description: 'Always `static`.', + enum: ['static'] + }, + static: { + type: 'object', + additionalProperties: false, + properties: { + max_chunk_size_tokens: { + type: 'integer', + minimum: 100, + maximum: 4096, + description: + 'The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.' + }, + chunk_overlap_tokens: { + type: 'integer', + description: + 'The number of tokens that overlap between chunks. The default value is `400`.\n\nNote that the overlap must not exceed half of `max_chunk_size_tokens`.\n' + } + }, + required: ['max_chunk_size_tokens', 'chunk_overlap_tokens'] + } + }, + required: ['type', 'static'] + } + ] + }), + CreateVectorStoreFileRequest: T.Object( + cache['ea7e7440bc7428abf277aa8ee93183ae'], + { additionalProperties: false } + ), + ListVectorStoreFilesResponse: T.Object( + cache['fe5638ea0024ceb6efb6cd1bb3123c9e'] + ), + DeleteVectorStoreFileResponse: T.Object( + cache['6ea46d7ad422330b1c96d02366583a97'] + ), + VectorStoreFileBatchObject: T.Object( + cache['faab15370c6ceb87be31157f86ef9c4d'] + ), + CreateVectorStoreFileBatchRequest: T.Object( + cache['cd92fc6b54146a71b64b6ef1f72c6e7f'], + { additionalProperties: false } + ), + AssistantStreamEvent: T.Any(), + ThreadStreamEvent: T.Any(), + RunStreamEvent: T.Any(), + RunStepStreamEvent: T.Any(), + MessageStreamEvent: T.Any(), + ErrorEvent: T.Object(cache['8dac0bc5f136e9037b8071c21579f9f7']), + DoneEvent: T.Object(cache['309e13e70aef96c338656e1ffd6106e1']), + Batch: T.Object(cache['fd4c666117c585b3f0057a20ad2d2eb7']), + BatchRequestInput: T.Object(cache['a1a4e5ba50917aa2fc6f201c45ee9585']), + BatchRequestOutput: T.Object(cache['876c76c736c0c1e61fa06f9f1bf7cf36']), + ListBatchesResponse: T.Object(cache['e76a3aeddcfcbc86b8cc209163cac0e0']) + } +} + +export { schema, _components as components } diff --git a/src/cleanup.js b/src/cleanup.js index 82a728f..96ff6a9 100644 --- a/src/cleanup.js +++ b/src/cleanup.js @@ -26,10 +26,10 @@ const validFields = new Set([ 'allOf', 'oneOf', 'anyOf', - 'not' + 'not', ]) -export function cleanupSchema (val) { +export function cleanupSchema(val) { const out = {} // null let k for (k in val) { diff --git a/src/client.js b/src/client.js index 2d02428..57ab149 100644 --- a/src/client.js +++ b/src/client.js @@ -68,11 +68,12 @@ * }} RequestInfo */ -import './formats.js' import { Value } from '@sinclair/typebox/value' import qs from 'fast-querystring' -const defaultQueryParser = (value) => qs.stringify(value) +import './formats.js' + +const defaultQueryParser = value => qs.stringify(value) const defaultGetRequestContentType = (body, endpoint) => { const contentType = endpoint?.args?.properties?.body?.['x-content-type'] @@ -115,13 +116,13 @@ const parseResponse = async (endpoint, res) => { if (res.ok) { return { - data: await parseContentType(res, endpoint.data, contentType) + data: await parseContentType(res, endpoint.data, contentType), } } return { data: null, - error: await parseContentType(res, endpoint.error, contentType) + error: await parseContentType(res, endpoint.error, contentType), } } @@ -137,7 +138,7 @@ const defaultArgsValidator = async (req) => { return [...Value.Errors(endpoint.args, args)].map(error => ({ message: error.message, path: error.path, - value: error.value + value: error.value, })) } @@ -164,7 +165,7 @@ export const createClient = (options) => { queryParser = defaultQueryParser, bodyParser = defaultBodyParser, argsValidator = defaultArgsValidator, - preValidation + preValidation, } = options if (!schema) throw new Error('schema is required') @@ -216,7 +217,7 @@ export const createClient = (options) => { * @param {Request} req * @returns {Promise>>} */ - async function openapiFetch (req) { + async function openapiFetch(req) { const { path, method, args, ...fetchInit } = /** @type {{ path: string, method: string, args: Args } & FetchInit} */(req) const endpoint = schema[path][method] @@ -227,8 +228,8 @@ export const createClient = (options) => { error: null, clientError: { code: 'ERR_ENDPOINT_NOT_FOUND', - message: `endpoint not found: ${path} ${method}` - } + message: `endpoint not found: ${path} ${method}`, + }, } } @@ -248,7 +249,7 @@ export const createClient = (options) => { headers, endpoint, args, - contentType + contentType, } if (preValidation) await preValidation(reqInfo) @@ -262,21 +263,21 @@ export const createClient = (options) => { clientError: { code: 'ERR_CLIENT_VALIDATION', message: 'client validation error', - errors - } + errors, + }, } } } if (args?.headers) { - Object.keys(args.headers).forEach(prop => { + Object.keys(args.headers).forEach((prop) => { headers.set(prop, args.headers[prop]) }) } let urlString = baseUrl + path if (args?.params) { - Object.keys(args.params).forEach(param => { + Object.keys(args.params).forEach((param) => { urlString = urlString.replace(`{${param}}`, args.params[param]) }) } @@ -287,7 +288,7 @@ export const createClient = (options) => { ...fetchInit, method, headers: reqInfo.headers, - body: await bodyParser(reqInfo) + body: await bodyParser(reqInfo), }) const result = await parseResponse(endpoint, res) @@ -295,7 +296,7 @@ export const createClient = (options) => { return { data: result?.data, error: result?.error, - res + res, } } catch (err) { return { @@ -304,8 +305,8 @@ export const createClient = (options) => { clientError: { code: 'ERR_FETCH_CLIENT', message: err.message, - stack: err.stack - } + stack: err.stack, + }, } } } @@ -321,7 +322,7 @@ export const createClient = (options) => { * (args: Paths[Path][Method]['args'], fetchInit?: FetchInit) => Promise>> * } */ - function openapiFetchBind (endpoint) { + function openapiFetchBind(endpoint) { return async (args, fetchInit = {}) => { const headers = new Headers() const headersA = new Headers(endpoint?.headers) @@ -342,13 +343,13 @@ export const createClient = (options) => { headers, path: endpoint.path, method: endpoint.method, - args + args, }) } } return { fetch: openapiFetch, - bind: openapiFetchBind + bind: openapiFetchBind, } } diff --git a/src/formats.js b/src/formats.js index 663455f..16403d2 100644 --- a/src/formats.js +++ b/src/formats.js @@ -3,12 +3,12 @@ import { FormatRegistry } from '@sinclair/typebox' // ------------------------------------------------------------------------------------------- // Format Registration // ------------------------------------------------------------------------------------------- -FormatRegistry.Set('date-time', (value) => IsDateTime(value, true)) -FormatRegistry.Set('date', (value) => IsDate(value)) -FormatRegistry.Set('time', (value) => IsTime(value)) -FormatRegistry.Set('email', (value) => IsEmail(value)) -FormatRegistry.Set('uuid', (value) => IsUuid(value)) -FormatRegistry.Set('url', (value) => IsUrl(value)) +FormatRegistry.Set('date-time', value => IsDateTime(value, true)) +FormatRegistry.Set('date', value => IsDate(value)) +FormatRegistry.Set('time', value => IsTime(value)) +FormatRegistry.Set('email', value => IsEmail(value)) +FormatRegistry.Set('uuid', value => IsUuid(value)) +FormatRegistry.Set('url', value => IsUrl(value)) // ------------------------------------------------------------------------------------------- // https://github.com/ajv-validator/ajv-formats/blob/master/src/formats.ts @@ -19,12 +19,12 @@ const DATE_TIME_SEPARATOR = /t|\s/i const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] -const URL = /^(?:https?|wss?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu -const EMAIL = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i -function IsLeapYear (year) { +const URL = /^(?:https?|wss?|ftp):\/\/(?:\S+@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[01])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4])|(?:[a-z0-9\u{00A1}-\u{FFFF}]+-)*[a-z0-9\u{00A1}-\u{FFFF}]+(?:\.(?:[a-z0-9\u{00A1}-\u{FFFF}]+-)*[a-z0-9\u{00A1}-\u{FFFF}]+)*\.[a-z\u{00A1}-\u{FFFF}]{2,})(?::\d{2,5})?(?:\/\S*)?$/iu +const EMAIL = /^[\w!#$%&'*+/=?^`{|}~-]+(?:\.[\w!#$%&'*+/=?^`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i +function IsLeapYear(year) { return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) } -function IsDate (str) { +function IsDate(str) { const matches = DATE.exec(str) if (!matches) return false const year = +matches[1] @@ -32,7 +32,7 @@ function IsDate (str) { const day = +matches[3] return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && IsLeapYear(year) ? 29 : DAYS[month]) } -function IsTime (str, strictTimeZone) { +function IsTime(str, strictTimeZone) { const matches = TIME.exec(str) if (!matches) return false const hr = +matches[1] @@ -48,16 +48,16 @@ function IsTime (str, strictTimeZone) { const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0) return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61 } -function IsDateTime (value, strictTimeZone) { +function IsDateTime(value, strictTimeZone) { const dateTime = value.split(DATE_TIME_SEPARATOR) return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1], strictTimeZone) } -function IsEmail (value) { +function IsEmail(value) { return EMAIL.test(value) } -function IsUuid (value) { +function IsUuid(value) { return UUID.test(value) } -function IsUrl (value) { +function IsUrl(value) { return URL.test(value) } diff --git a/src/resolver.js b/src/resolver.js index 20abf0e..0bda436 100644 --- a/src/resolver.js +++ b/src/resolver.js @@ -13,13 +13,13 @@ export default (headers, onError) => ({ }) return fetch(file.url, { redirect: 'follow', - headers + headers, }) - .catch(err => { + .catch((err) => { onError(new Error(`FetchError: ${err.message}`)) throw err }) - .then(res => { + .then((res) => { if (res.ok) return res const fetchError = new Error(`FetchError: [${res.status}] ${res.statusText}`) onError(fetchError) @@ -27,6 +27,6 @@ export default (headers, onError) => ({ }) .then(res => res.arrayBuffer()) .then(buf => Buffer.from(buf)) - } - } + }, + }, }) diff --git a/src/writer.js b/src/writer.js index ac65e55..5ef04b6 100644 --- a/src/writer.js +++ b/src/writer.js @@ -1,20 +1,21 @@ /** @typedef {import('openapi-types').OpenAPI.Document} Document */ import { createHash } from 'node:crypto' + import SwaggerParser from '@apidevtools/swagger-parser' +import safeStringify from '@sindresorhus/safe-stringify' import CodeBlockWriter from 'code-block-writer' import * as prettier from 'prettier' -import safeStringify from '@sindresorhus/safe-stringify' -import resolver from './resolver.js' import { cleanupSchema } from './cleanup.js' +import resolver from './resolver.js' const scalarTypes = { string: 'String', number: 'Number', boolean: 'Boolean', integer: 'Integer', - null: 'Null' + null: 'Null', } const checksum = str => createHash('md5').update(str).digest('hex') @@ -24,12 +25,12 @@ const createCodeBlockWriter = () => new CodeBlockWriter({ newLine: '\r\n', // default: "\n" indentNumberOfSpaces: 2, // default: 4 useTabs: false, // default: false - useSingleQuote: true + useSingleQuote: true, }) /** * - * @param {string | URL} path + * @param {string | URL | Document} path * @param {{ * cjs?: boolean * headers?: object @@ -49,8 +50,8 @@ export const write = async (path, opts = {}) => { const openapi = await SwaggerParser.validate(/** @type {string} */(path), { resolve: resolver(headers, (err) => { fetchError = err - }) - }).catch(err => { + }), + }).catch((err) => { if (fetchError) throw fetchError throw err }) @@ -120,17 +121,17 @@ export const write = async (path, opts = {}) => { const { paths, components } = openapi if (paths) { - Object.keys(paths).forEach(pathKey => { - Object.keys(paths[pathKey]).forEach(method => { + Object.keys(paths).forEach((pathKey) => { + Object.keys(paths[pathKey]).forEach((method) => { buildSchema(paths, pathKey, method) }) }) w.write('const schema = ').inlineBlock(() => { - Object.keys(paths).forEach(pathKey => { + Object.keys(paths).forEach((pathKey) => { const pathStr = removePrefix ? pathKey.replace(removePrefix, '') : pathKey w.write(`'${pathStr}': `).inlineBlock(() => { - Object.keys(paths[pathKey]).forEach(method => { + Object.keys(paths[pathKey]).forEach((method) => { w.write(`${method.toUpperCase()}: `).inlineBlock(() => { const request = requestSchemas.find(r => r.pathKey === pathKey && r.method === method) if (request.args.size > 0) { @@ -161,7 +162,7 @@ export const write = async (path, opts = {}) => { if (components) { w.write('const _components = ').inlineBlock(() => { - Object.keys(components).forEach(componentType => { + Object.keys(components).forEach((componentType) => { writeComponents(componentType, components[componentType]) }) }) @@ -185,10 +186,10 @@ export const write = async (path, opts = {}) => { semi: false, singleQuote: true, parser: 'typescript', - trailingComma: 'none' + trailingComma: 'none', }) - function getWriterString (handler) { + function getWriterString(handler) { const parentW = w w = createCodeBlockWriter() handler() @@ -197,7 +198,7 @@ export const write = async (path, opts = {}) => { return str } - function writeType (schema, isRequired = false) { + function writeType(schema, isRequired = false) { schema = cleanupSchema(schema) if (schema.const) { @@ -208,7 +209,7 @@ export const write = async (path, opts = {}) => { if (schema.enum) { writeCompound({ ...schema, - anyOf: schema.enum + anyOf: schema.enum, }, isRequired) return } @@ -242,7 +243,7 @@ export const write = async (path, opts = {}) => { } } - function writeLiteral (schema, isRequired = false) { + function writeLiteral(schema, isRequired = false) { let { const: value, type, ...options } = schema value = JSON.stringify(value) @@ -256,7 +257,7 @@ export const write = async (path, opts = {}) => { w.write(`${isRequired ? '' : 'T.Optional('}T.Literal(${value}${options})${isRequired ? '' : ')'}`) } - function writeCompound (schema, isRequired = false) { + function writeCompound(schema, isRequired = false) { const { enum: _, type, anyOf, allOf, ...options } = schema if (!isRequired) w.write('T.Optional(') @@ -271,7 +272,7 @@ export const write = async (path, opts = {}) => { if (!cache.has(hash)) { cache.set(hash, getWriterString(() => { w.write('[') - list.forEach(subSchema => { + list.forEach((subSchema) => { if (typeof subSchema !== 'object') { w.write(`T.Literal(${JSON.stringify(subSchema)})`) } else { @@ -297,7 +298,7 @@ export const write = async (path, opts = {}) => { if (!isRequired) w.write(')') } - function writeObject (schema, isRequired = false) { + function writeObject(schema, isRequired = false) { const { type, properties = {}, required = [], ...options } = schema if (!isRequired) w.write('T.Optional(') @@ -318,9 +319,9 @@ export const write = async (path, opts = {}) => { cache.set(hash, getWriterString(() => { if (Object.keys(properties).length > 0) { w.inlineBlock(() => { - Object.keys(properties).forEach(subSchemaKey => { + Object.keys(properties).forEach((subSchemaKey) => { const subSchema = properties[subSchemaKey] - w.write(`${subSchemaKey}: `) + w.write(`'${subSchemaKey}': `) writeType(subSchema, required.includes(subSchemaKey)) w.write(',\n') }) @@ -343,7 +344,7 @@ export const write = async (path, opts = {}) => { if (!isRequired) w.write(')') } - function writeScalar (schema, isRequired = false) { + function writeScalar(schema, isRequired = false) { let { type, ...options } = schema if (Object.keys(options).length) { @@ -355,7 +356,7 @@ export const write = async (path, opts = {}) => { w.write(`${isRequired ? '' : 'T.Optional('}T.${scalarTypes[type]}(${options})${isRequired ? '' : ')'}`) } - function writeArray (schema, isRequired = false) { + function writeArray(schema, isRequired = false) { const { type, items, ...options } = schema if (!isRequired) w.write('T.Optional(') @@ -375,7 +376,7 @@ export const write = async (path, opts = {}) => { w.write('T.Tuple(') cache.set(hash, getWriterString(() => { w.write('[') - items.forEach(subSchema => { + items.forEach((subSchema) => { writeType(subSchema, true) w.write(',') }) @@ -400,7 +401,7 @@ export const write = async (path, opts = {}) => { if (!isRequired) w.write(')') } - function buildSchema (paths, pathKey, method) { + function buildSchema(paths, pathKey, method) { const endpoint = paths[pathKey][method] const { responses, parameters = [], requestBody } = endpoint @@ -442,7 +443,7 @@ export const write = async (path, opts = {}) => { if (responses) { const responsesWithCode = Object.keys(responses).map(code => ({ code, - ...responses[code] + ...responses[code], })) const defaultResponse = responsesWithCode.find(res => res.code === 'default') || { code: 'default' } @@ -452,7 +453,7 @@ export const write = async (path, opts = {}) => { const pushResponse = (success, response) => { responseList.push({ success, - text: getWriterString(() => writeResponse(response)) + text: getWriterString(() => writeResponse(response)), }) } @@ -467,15 +468,15 @@ export const write = async (path, opts = {}) => { responseSchemas.push({ pathKey, method, list: responseList }) } - function writeRequestBody (requestBody) { + function writeRequestBody(requestBody) { const contentType = 'application/json' in requestBody.content ? 'application/json' : Object.keys(requestBody.content)[0] const schema = requestBody.content[contentType].schema writeType({ 'x-content-type': contentType, - ...schema + ...schema, }, requestBody.required) } - function writeResponse (response) { + function writeResponse(response) { const obj = {} if ('code' in response) { @@ -490,14 +491,14 @@ export const write = async (path, opts = {}) => { return writeType({ ...obj, 'x-content-type': contentType, - ...content[contentType].schema + ...content[contentType].schema, }, true) } if (response.schema) { return writeType({ ...obj, - ...response.schema + ...response.schema, }, true) } @@ -507,7 +508,7 @@ export const write = async (path, opts = {}) => { } } - function writeParameters (parameters) { + function writeParameters(parameters) { if (parameters.length === 0) return const isRequired = parameters.find(p => p.required) @@ -521,7 +522,7 @@ export const write = async (path, opts = {}) => { if (!cache.has(hash)) { cache.set(hash, getWriterString(() => { w.inlineBlock(() => { - parameters.forEach(param => { + parameters.forEach((param) => { w.write(`'${param.name}': `) writeParameter(param) w.write(',\n') @@ -537,11 +538,11 @@ export const write = async (path, opts = {}) => { if (!isRequired) w.write(')') } - function writeParameter (param) { + function writeParameter(param) { if (!param.schema) { param.schema = { items: param.items, - type: param.type + type: param.type, } if (param.format && param.format !== 'string') { param.schema.format = param.format @@ -565,7 +566,7 @@ export const write = async (path, opts = {}) => { w.write(`cache['${hash}']`) } - function writeComponents (componentType, components) { + function writeComponents(componentType, components) { switch (componentType) { case 'schemas': { writeComponent(componentType, components, c => writeType(c, true)) @@ -580,7 +581,7 @@ export const write = async (path, opts = {}) => { break } case 'requestBodies': { - writeComponent(componentType, components, c => { + writeComponent(componentType, components, (c) => { c.required = true writeRequestBody(c) }) @@ -593,11 +594,11 @@ export const write = async (path, opts = {}) => { } } - function writeComponent (componentType, components, cb) { + function writeComponent(componentType, components, cb) { const list = Object.keys(components) if (list.length === 0) return w.write(`'${componentType}': `).inlineBlock(() => { - list.forEach(name => { + list.forEach((name) => { w.write(`'${name}': `) cb(components[name]) w.write(',\n') diff --git a/test/index.js b/test/index.js index da2b492..1134f5b 100644 --- a/test/index.js +++ b/test/index.js @@ -1,19 +1,19 @@ -import test, { after } from 'node:test' import assert from 'node:assert' -import { readFile, writeFile, mkdir } from 'node:fs/promises' +import { mkdir, readFile, writeFile } from 'node:fs/promises' +import test, { after } from 'node:test' -import fastify from 'fastify' import fastifySwagger from '@fastify/swagger' import { Type } from '@sinclair/typebox' -import qs from 'qs' import { expectTypeOf } from 'expect-type' +import fastify from 'fastify' +import qs from 'qs' -import { write } from '../src/writer.js' import { createClient } from '../src/client.js' +import { write } from '../src/writer.js' const app = fastify({ logger: false, - querystringParser: str => qs.parse(str) + querystringParser: str => qs.parse(str), }) await app.register(fastifySwagger, { @@ -21,12 +21,12 @@ await app.register(fastifySwagger, { info: { title: 'Test swagger', description: 'testing the fastify swagger api', - version: '0.1.0' + version: '0.1.0', }, servers: [{ - url: 'http://localhost' - }] - } + url: 'http://localhost', + }], + }, }) app.get('/hello', () => { @@ -37,13 +37,13 @@ app.get('/hello-typed', { schema: { response: { 200: Type.Object({ - hello: Type.Boolean() + hello: Type.Boolean(), }), 404: Type.Object({ - error: Type.String() - }) - } - } + error: Type.String(), + }), + }, + }, }, () => { return { hello: true } }) @@ -55,39 +55,39 @@ app.get('/multiple-content', { content: { 'application/json': { schema: Type.Object({ - name: Type.String() - }) + name: Type.String(), + }), }, 'application/vnd.v1+json': { schema: Type.Object({ - title: Type.String() - }) - } - } + title: Type.String(), + }), + }, + }, }, 404: Type.Object({ - error: Type.String() - }) - } - } + error: Type.String(), + }), + }, + }, }, () => { return { name: 'test' } }) const headers = Type.Object({ - auth: Type.String() + auth: Type.String(), }) const params = Type.Object({ - id: Type.Optional(Type.String()) + id: Type.Optional(Type.String()), }) const querystring = Type.Object({ filter: Type.String(), address: Type.Array(Type.String()), deep: Type.Object({ - deepTitle: Type.String() - }) + deepTitle: Type.String(), + }), }) const body = Type.Object({ @@ -96,16 +96,16 @@ const body = Type.Object({ age: Type.Optional(Type.Number()), gender: Type.Union([ Type.Literal('batman'), - Type.Literal('joker') - ]) + Type.Literal('joker'), + ]), }), address: Type.Array( Type.Object({ title: Type.String(), - address: Type.String() + address: Type.String(), }) ), - recursive: Type.Object({}) + recursive: Type.Object({}), }) app.post('/some-route/:id', { @@ -120,17 +120,17 @@ app.post('/some-route/:id', { 201: Type.Object({ params, query: querystring, - body - }, { description: 'description response' }) - } - } + body, + }, { description: 'description response' }), + }, + }, }, (req, reply) => ({ headers: { - auth: req.headers.auth + auth: req.headers.auth, }, params: req.params, query: req.query, - body: req.body + body: req.body, })) test('basic test', async () => { @@ -157,13 +157,13 @@ test('basic test', async () => { const client = createClient({ schema, baseUrl: address, - queryParser: qs.stringify + queryParser: qs.stringify, }) await test('client.fetch /hello', async () => { const { data } = await client.fetch({ path: '/hello', - method: 'GET' + method: 'GET', }) expectTypeOf(data).toEqualTypeOf(/** @type {any} */({ hello: true })) @@ -172,7 +172,7 @@ test('basic test', async () => { await test('client.fetch /hello-typed', async () => { const { data } = await client.fetch({ path: '/hello-typed', - method: 'GET' + method: 'GET', }) expectTypeOf(data).toEqualTypeOf({ hello: true }) @@ -181,7 +181,7 @@ test('basic test', async () => { await test('client.fetch /multiple-content', async () => { const { data } = await client.fetch({ path: '/multiple-content', - method: 'GET' + method: 'GET', }) expectTypeOf(data).toEqualTypeOf(/** @type {{ name: string }} */({ name: 'test' })) @@ -194,9 +194,9 @@ test('basic test', async () => { args: { params: { // @ts-ignore - id: 2 - } - } + id: 2, + }, + }, }) assert.equal(data, null) @@ -209,77 +209,77 @@ test('basic test', async () => { { message: 'Expected object', path: '/headers', - value: undefined + value: undefined, }, { message: 'Expected string', path: '/params/id', - value: 2 + value: 2, }, { message: 'Expected object', path: '/query', - value: undefined + value: undefined, }, { message: 'Expected object', path: '/body', - value: undefined + value: undefined, }, { message: 'Expected required property', path: '/headers', - value: undefined + value: undefined, }, { message: 'Expected required property', path: '/query', - value: undefined + value: undefined, }, { message: 'Expected required property', path: '/body', - value: undefined - } - ] + value: undefined, + }, + ], })) }) await test('client.bind', async () => { const postRoute = client.bind({ path: '/some-route/{id}', - method: 'POST' + method: 'POST', }) /** @type {Parameters[0]} */ const args = { headers: { - auth: 'test' + auth: 'test', }, params: { - id: '1' + id: '1', }, query: { filter: 'some filter', address: ['addres'], deep: { - deepTitle: 'test' - } + deepTitle: 'test', + }, }, body: { human: { age: 30, name: 'bruce', - gender: 'batman' + gender: 'batman', }, address: [{ address: 'addres1', - title: 'test' + title: 'test', }], recursive: { - testing: true - } - } + testing: true, + }, + }, } const { data, error, clientError } = await postRoute(args) @@ -290,41 +290,84 @@ test('basic test', async () => { }) }) -test('petstore', async () => { - const petstore = JSON.parse(await readFile('./test/petstore.json', 'utf-8')) - await writeFile('./tmp/petstore.js', await write(petstore)) +test('petstore.json', async () => { + await writeFile('./tmp/petstore.js', await write('./test/petstore.json')) assert.equal(await readFile('./tmp/petstore.js', 'utf8'), await readFile('./test/petstore.txt', 'utf8')) const { components } = await import('../tmp/petstore.js') assert.ok('schemas' in components) - assert.ok(Object.keys(components['schemas']).length > 0) - assert.deepEqual(components['schemas']['Pet'], Type.Object({ + assert.ok(Object.keys(components.schemas).length > 0) + assert.deepEqual(components.schemas.Pet, Type.Object({ id: Type.Integer({ format: 'int64' }), name: Type.String(), - tag: Type.Optional(Type.String()) + tag: Type.Optional(Type.String()), })) assert.ok('parameters' in components) - assert.ok(Object.keys(components['parameters']).length > 0) - assert.deepEqual(components['parameters']['limitParam'], Type.Integer({ format: 'int32', 'x-in': 'query' })) + assert.ok(Object.keys(components.parameters).length > 0) + assert.deepEqual(components.parameters.limitParam, Type.Integer({ 'format': 'int32', 'x-in': 'query' })) assert.ok('responses' in components) - assert.ok(Object.keys(components['responses']).length > 0) - assert.deepEqual(components['responses']['GeneralError'], Type.Object({ + assert.ok(Object.keys(components.responses).length > 0) + assert.deepEqual(components.responses.GeneralError, Type.Object({ code: Type.Integer({ format: 'int32' }), - message: Type.String() + message: Type.String(), }, { - 'x-content-type': 'application/json' + 'x-content-type': 'application/json', })) assert.ok('requestBodies' in components) - assert.ok(Object.keys(components['requestBodies']).length > 0) - assert.deepEqual(components['requestBodies']['Pet'], Type.Object({ + assert.ok(Object.keys(components.requestBodies).length > 0) + assert.deepEqual(components.requestBodies.Pet, Type.Object({ id: Type.Integer({ format: 'int64' }), name: Type.String(), - tag: Type.Optional(Type.String()) + tag: Type.Optional(Type.String()), }, { - 'x-content-type': 'application/json' + 'x-content-type': 'application/json', + })) +}) + +test('petstore.yaml', async () => { + await writeFile('./tmp/petstore.yaml.js', await write('./test/petstore.json')) + assert.equal(await readFile('./tmp/petstore.yaml.js', 'utf8'), await readFile('./test/petstore.txt', 'utf8')) + + const { components } = await import('../tmp/petstore.yaml.js') + + assert.ok('schemas' in components) + assert.ok(Object.keys(components.schemas).length > 0) + assert.deepEqual(components.schemas.Pet, Type.Object({ + id: Type.Integer({ format: 'int64' }), + name: Type.String(), + tag: Type.Optional(Type.String()), })) + + assert.ok('parameters' in components) + assert.ok(Object.keys(components.parameters).length > 0) + assert.deepEqual(components.parameters.limitParam, Type.Integer({ 'format': 'int32', 'x-in': 'query' })) + + assert.ok('responses' in components) + assert.ok(Object.keys(components.responses).length > 0) + assert.deepEqual(components.responses.GeneralError, Type.Object({ + code: Type.Integer({ format: 'int32' }), + message: Type.String(), + }, { + 'x-content-type': 'application/json', + })) + + assert.ok('requestBodies' in components) + assert.ok(Object.keys(components.requestBodies).length > 0) + assert.deepEqual(components.requestBodies.Pet, Type.Object({ + id: Type.Integer({ format: 'int64' }), + name: Type.String(), + tag: Type.Optional(Type.String()), + }, { + 'x-content-type': 'application/json', + })) +}) + +test('parse some openapi examples', async (t) => { + await t.test('parse https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml', async () => { + await write('https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml') + }) }) diff --git a/test/petstore.json b/test/petstore.json index 4438318..af67726 100644 --- a/test/petstore.json +++ b/test/petstore.json @@ -16,7 +16,7 @@ "in": "query", "description": "max records to return", "required": true, - "schema" : { + "schema": { "type": "integer", "format": "int32" } diff --git a/test/petstore.yaml b/test/petstore.yaml new file mode 100644 index 0000000..98f62c1 --- /dev/null +++ b/test/petstore.yaml @@ -0,0 +1,119 @@ +openapi: 3.0.0 +info: + version: 1.0.0 + title: Swagger Petstore + license: + name: MIT +servers: + - url: http://petstore.swagger.io/v1 +paths: + /pets: + get: + summary: List all pets + operationId: listPets + tags: + - pets + parameters: + - name: limit + in: query + description: How many items to return at one time (max 100) + required: false + schema: + type: integer + maximum: 100 + format: int32 + responses: + '200': + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + summary: Create a pet + operationId: createPets + tags: + - pets + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + required: true + responses: + '201': + description: Null response + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /pets/{petId}: + get: + summary: Info for a specific pet + operationId: showPetById + tags: + - pets + parameters: + - name: petId + in: path + required: true + description: The id of the pet to retrieve + schema: + type: string + responses: + '200': + description: Expected response to a valid request + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' +components: + schemas: + Pet: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + Pets: + type: array + maxItems: 100 + items: + $ref: '#/components/schemas/Pet' + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/tsconfig.json b/tsconfig.json index 106447e..7723410 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,13 @@ { "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", "allowJs": true, "checkJs": true, "noEmit": true, - "module": "NodeNext", - "target": "ES2022", - "moduleResolution": "NodeNext", - "esModuleInterop": true, "allowSyntheticDefaultImports": true, + "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "skipLibCheck": true },