feat: moar generated goodness

This commit is contained in:
Travis Fischer
2023-11-10 02:47:40 -06:00
parent 25c2aedab7
commit 1c0a56bf21
9 changed files with 709 additions and 286 deletions
+2 -1
View File
@@ -13,9 +13,10 @@ jobs:
- 21
- 20
- 18
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
+3 -1
View File
@@ -52,4 +52,6 @@ next-env.d.ts
.env.test.local
.env.production.local
.turbo
.turbo
dist/
+112 -7
View File
@@ -2,6 +2,7 @@ import fs from 'node:fs/promises'
import * as prettier from 'prettier'
import SwaggerParser from '@apidevtools/swagger-parser'
import { convertParametersToJSONSchema } from 'openapi-jsonschema-parameters'
import type { OpenAPIV3 } from 'openapi-types'
import {
FetchingJSONSchemaStore,
@@ -64,7 +65,7 @@ const openaiOpenAPIPaths: Record<string, boolean> = {
async function main() {
const srcFile = './openai-openapi/openapi.yaml'
const destFile = './src/generated-types.ts'
const destFile = './src/oai.ts'
const parser = new SwaggerParser()
const spec = (await parser.bundle(srcFile)) as OpenAPIV3.Document
@@ -78,6 +79,8 @@ async function main() {
const pathsToProcess: string[] = []
for (const path in spec.paths) {
// if (!path.startsWith('/threads/{thread_id}/messages')) continue // TODO
const openaiOpenAPIPath = openaiOpenAPIPaths[path]
if (openaiOpenAPIPath === undefined) {
console.error(`Unexpected OpenAI OpenAPI path: ${path}`)
@@ -98,7 +101,10 @@ async function main() {
}
}
// console.log(pathsToProcess)
const componentsToProcess = new Set<string>()
const schemaInput = new JSONSchemaInput(new FetchingJSONSchemaStore())
for (const path of pathsToProcess) {
const pathItem = spec.paths[path]
@@ -116,6 +122,7 @@ async function main() {
['requestBody', 'content', jsonContentType, 'schema'],
['requestBody', 'content', 'multipart/form-data', 'schema']
]
for (const path of paths) {
const resolved = new Set<string>()
getAndResolve(operation, path, parser.$refs, resolved)
@@ -124,6 +131,81 @@ async function main() {
componentsToProcess.add(ref)
}
}
if (operation.parameters) {
const name = `${operation.operationId
.slice(0, 1)
.toUpperCase()}${operation.operationId.slice(1)}Params`
const params = convertParametersToJSONSchema(operation.parameters)
if (params.body) {
const schema = JSON.stringify(
dereference(params.body, parser.$refs),
null,
2
)
// console.log(name, 'body', schema)
await schemaInput.addSource({
name: `${name}Body`,
schema
})
}
if (params.formData) {
const schema = JSON.stringify(
dereference(params.formData, parser.$refs),
null,
2
)
// console.log(name, 'formData', schema)
await schemaInput.addSource({
name: `${name}FormData`,
schema
})
}
if (params.headers) {
const schema = JSON.stringify(
dereference(params.headers, parser.$refs),
null,
2
)
// console.log(name, 'headers', schema)
await schemaInput.addSource({
name: `${name}Headers`,
schema
})
}
if (params.path) {
const schema = JSON.stringify(
dereference(params.path, parser.$refs),
null,
2
)
// console.log(name, 'path', schema)
await schemaInput.addSource({
name: `${name}Path`,
schema
})
}
if (params.query) {
const schema = JSON.stringify(
dereference(params.query, parser.$refs),
null,
2
)
if (name === 'ListFilesParams') {
console.log(name, 'query', schema)
}
await schemaInput.addSource({
name: `${name}Query`,
schema
})
}
}
}
}
@@ -154,8 +236,6 @@ async function main() {
(a, b) => componentToRefs[b].refs.size - componentToRefs[a].refs.size
)
const schemaInput = new JSONSchemaInput(new FetchingJSONSchemaStore())
for (const ref of sortedComponents) {
const name = ref.split('/').pop()!
if (!name) throw new Error()
@@ -175,6 +255,7 @@ async function main() {
proccessedComponents.add(ref)
// console.log(ref, name)
await schemaInput.addSource({
name,
schema: JSON.stringify(dereferenced, null, 2)
@@ -189,12 +270,38 @@ async function main() {
lang: 'TypeScript Zod'
})
const output = res.lines
const header = `/**
* This file is auto-generated by OpenOpenAI/src/generate.ts using OpenAI's
* OpenAPI spec as a source of truth.
*
* DO NOT EDIT THIS FILE MANUALLY if you want your changes to persist.
*/`
const output = [header]
.concat(res.lines)
.join('\n')
.replace(
'import * as z from "zod"',
"import { z } from '@hono/zod-openapi'"
)
.replaceAll(/OpenAi/g, 'OpenAI')
// remove inferred types, as we don't use them
.replaceAll(/^.* = z.infer<[^>]*>;?$/gm, '')
.trim()
const prettyOutput = prettier.format(output, {
const prettyOutput0 = prettify(output)
// simplify a lot of the unnecessary nullable unions
.replaceAll(/z\s*\.union\(\[\s*z\.null\(\),\s*([^\]]*)\s*\]\)/gm, '$1')
.replaceAll(/z\s*\.union\(\[\s*([^,]*),\s*z\.null\(\)\s*\]\)/gm, '$1')
// replace single value enums with literals
.replaceAll(/z\s*\.enum\(\[\s*('[^']*')\s*\]\)/gm, 'z.literal($1)')
const prettyOutput = prettify(prettyOutput0)
await fs.writeFile(destFile, prettyOutput)
}
function prettify(source: string): string {
return prettier.format(source, {
parser: 'typescript',
semi: false,
singleQuote: true,
@@ -204,8 +311,6 @@ async function main() {
arrowParens: 'always',
trailingComma: 'none'
})
await fs.writeFile(destFile, prettyOutput)
}
function getAndResolve<T extends any = any>(
+5 -3
View File
@@ -11,15 +11,15 @@
"node": ">=18"
},
"scripts": {
"build": "tsc --project tsconfig.dist.json",
"build": "tsc --project tsconfig.json",
"prebuild": "run-s clean",
"clean": "del dist",
"dev": "tsc --watch",
"prepare": "husky install",
"release": "np",
"test": "run-p test:*",
"test:lint": "eslint .",
"test:format": "prettier --check \"**/*.{js,ts,tsx}\"",
"test:lint": "eslint .",
"test:typecheck": "tsc --noEmit"
},
"dependencies": {
@@ -39,10 +39,12 @@
"lint-staged": "^15.0.2",
"np": "^8.0.4",
"npm-run-all": "^4.1.5",
"openai": "^4.17.3",
"openapi-jsonschema-parameters": "^12.1.3",
"openapi-types": "^12.1.3",
"prettier": "^2.8.8",
"quicktype-core": "^23.0.77",
"tsx": "^3.14.0",
"tsx": "^4.0.0",
"typescript": "^5.2.2"
},
"lint-staged": {
+245 -71
View File
@@ -49,6 +49,12 @@ devDependencies:
npm-run-all:
specifier: ^4.1.5
version: 4.1.5
openai:
specifier: ^4.17.3
version: 4.17.3
openapi-jsonschema-parameters:
specifier: ^12.1.3
version: 12.1.3
openapi-types:
specifier: ^12.1.3
version: 12.1.3
@@ -59,8 +65,8 @@ devDependencies:
specifier: ^23.0.77
version: 23.0.77
tsx:
specifier: ^3.14.0
version: 3.14.0
specifier: ^4.0.0
version: 4.0.0
typescript:
specifier: ^5.2.2
version: 5.2.2
@@ -129,25 +135,25 @@ packages:
chalk: 2.4.2
dev: true
/@babel/compat-data@7.23.2:
resolution: {integrity: sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==}
/@babel/compat-data@7.23.3:
resolution: {integrity: sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/core@7.23.2:
resolution: {integrity: sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==}
/@babel/core@7.23.3:
resolution: {integrity: sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==}
engines: {node: '>=6.9.0'}
dependencies:
'@ampproject/remapping': 2.2.1
'@babel/code-frame': 7.22.13
'@babel/generator': 7.23.0
'@babel/generator': 7.23.3
'@babel/helper-compilation-targets': 7.22.15
'@babel/helper-module-transforms': 7.23.0(@babel/core@7.23.2)
'@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.3)
'@babel/helpers': 7.23.2
'@babel/parser': 7.23.0
'@babel/parser': 7.23.3
'@babel/template': 7.22.15
'@babel/traverse': 7.23.2
'@babel/types': 7.23.0
'@babel/traverse': 7.23.3
'@babel/types': 7.23.3
convert-source-map: 2.0.0
debug: 4.3.4
gensync: 1.0.0-beta.2
@@ -157,14 +163,14 @@ packages:
- supports-color
dev: true
/@babel/eslint-parser@7.22.15(@babel/core@7.23.2)(eslint@8.53.0):
resolution: {integrity: sha512-yc8OOBIQk1EcRrpizuARSQS0TWAcOMpEJ1aafhNznaeYkeL+OhqnDObGFylB8ka8VFF/sZc+S4RzHyO+3LjQxg==}
/@babel/eslint-parser@7.23.3(@babel/core@7.23.3)(eslint@8.53.0):
resolution: {integrity: sha512-9bTuNlyx7oSstodm1cR1bECj4fkiknsDa1YniISkJemMY3DGhJNYBECbe6QD/q54mp2J8VO66jW3/7uP//iFCw==}
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
peerDependencies:
'@babel/core': ^7.11.0
eslint: ^7.5.0 || ^8.0.0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1
eslint: 8.53.0
eslint-visitor-keys: 2.1.0
@@ -180,11 +186,11 @@ packages:
source-map: 0.5.7
dev: true
/@babel/generator@7.23.0:
resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==}
/@babel/generator@7.23.3:
resolution: {integrity: sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.3
'@jridgewell/gen-mapping': 0.3.3
'@jridgewell/trace-mapping': 0.3.20
jsesc: 2.5.2
@@ -194,14 +200,14 @@ packages:
resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.3
dev: true
/@babel/helper-compilation-targets@7.22.15:
resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/compat-data': 7.23.2
'@babel/compat-data': 7.23.3
'@babel/helper-validator-option': 7.22.15
browserslist: 4.22.1
lru-cache: 5.1.1
@@ -218,30 +224,30 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.22.15
'@babel/types': 7.23.0
'@babel/types': 7.23.3
dev: true
/@babel/helper-hoist-variables@7.22.5:
resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.3
dev: true
/@babel/helper-module-imports@7.22.15:
resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.3
dev: true
/@babel/helper-module-transforms@7.23.0(@babel/core@7.23.2):
resolution: {integrity: sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==}
/@babel/helper-module-transforms@7.23.3(@babel/core@7.23.3):
resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@babel/helper-environment-visitor': 7.22.20
'@babel/helper-module-imports': 7.22.15
'@babel/helper-simple-access': 7.22.5
@@ -258,14 +264,14 @@ packages:
resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.3
dev: true
/@babel/helper-split-export-declaration@7.22.6:
resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.23.0
'@babel/types': 7.23.3
dev: true
/@babel/helper-string-parser@7.22.5:
@@ -288,8 +294,8 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.22.15
'@babel/traverse': 7.23.2
'@babel/types': 7.23.0
'@babel/traverse': 7.23.3
'@babel/types': 7.23.3
transitivePeerDependencies:
- supports-color
dev: true
@@ -303,82 +309,82 @@ packages:
js-tokens: 4.0.0
dev: true
/@babel/parser@7.23.0:
resolution: {integrity: sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==}
/@babel/parser@7.23.3:
resolution: {integrity: sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.17.0
dev: true
/@babel/plugin-syntax-jsx@7.22.5(@babel/core@7.23.2):
resolution: {integrity: sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==}
/@babel/plugin-syntax-jsx@7.23.3(@babel/core@7.23.3):
resolution: {integrity: sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@babel/helper-plugin-utils': 7.22.5
dev: true
/@babel/plugin-transform-react-display-name@7.22.5(@babel/core@7.23.2):
resolution: {integrity: sha512-PVk3WPYudRF5z4GKMEYUrLjPl38fJSKNaEOkFuoprioowGuWN6w2RKznuFNSlJx7pzzXXStPUnNSOEO0jL5EVw==}
/@babel/plugin-transform-react-display-name@7.23.3(@babel/core@7.23.3):
resolution: {integrity: sha512-GnvhtVfA2OAtzdX58FJxU19rhoGeQzyVndw3GgtdECQvQFXPEZIOVULHVZGAYmOgmqjXpVpfocAbSjh99V/Fqw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@babel/helper-plugin-utils': 7.22.5
dev: true
/@babel/plugin-transform-react-jsx-development@7.22.5(@babel/core@7.23.2):
/@babel/plugin-transform-react-jsx-development@7.22.5(@babel/core@7.23.3):
resolution: {integrity: sha512-bDhuzwWMuInwCYeDeMzyi7TaBgRQei6DqxhbyniL7/VG4RSS7HtSL2QbY4eESy1KJqlWt8g3xeEBGPuo+XqC8A==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.23.2
'@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.23.2)
'@babel/core': 7.23.3
'@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.23.3)
dev: true
/@babel/plugin-transform-react-jsx@7.22.15(@babel/core@7.23.2):
/@babel/plugin-transform-react-jsx@7.22.15(@babel/core@7.23.3):
resolution: {integrity: sha512-oKckg2eZFa8771O/5vi7XeTvmM6+O9cxZu+kanTU7tD4sin5nO/G8jGJhq8Hvt2Z0kUoEDRayuZLaUlYl8QuGA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@babel/helper-annotate-as-pure': 7.22.5
'@babel/helper-module-imports': 7.22.15
'@babel/helper-plugin-utils': 7.22.5
'@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.23.2)
'@babel/types': 7.23.0
'@babel/plugin-syntax-jsx': 7.23.3(@babel/core@7.23.3)
'@babel/types': 7.23.3
dev: true
/@babel/plugin-transform-react-pure-annotations@7.22.5(@babel/core@7.23.2):
resolution: {integrity: sha512-gP4k85wx09q+brArVinTXhWiyzLl9UpmGva0+mWyKxk6JZequ05x3eUcIUE+FyttPKJFRRVtAvQaJ6YF9h1ZpA==}
/@babel/plugin-transform-react-pure-annotations@7.23.3(@babel/core@7.23.3):
resolution: {integrity: sha512-qMFdSS+TUhB7Q/3HVPnEdYJDQIk57jkntAwSuz9xfSE4n+3I+vHYCli3HoHawN1Z3RfCz/y1zXA/JXjG6cVImQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@babel/helper-annotate-as-pure': 7.22.5
'@babel/helper-plugin-utils': 7.22.5
dev: true
/@babel/preset-react@7.22.15(@babel/core@7.23.2):
resolution: {integrity: sha512-Csy1IJ2uEh/PecCBXXoZGAZBeCATTuePzCSB7dLYWS0vOEj6CNpjxIhW4duWwZodBNueH7QO14WbGn8YyeuN9w==}
/@babel/preset-react@7.23.3(@babel/core@7.23.3):
resolution: {integrity: sha512-tbkHOS9axH6Ysf2OUEqoSZ6T3Fa2SrNH6WTWSPBboxKzdxNc9qOICeLXkNG0ZEwbQ1HY8liwOce4aN/Ceyuq6w==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.23.2
'@babel/core': 7.23.3
'@babel/helper-plugin-utils': 7.22.5
'@babel/helper-validator-option': 7.22.15
'@babel/plugin-transform-react-display-name': 7.22.5(@babel/core@7.23.2)
'@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.23.2)
'@babel/plugin-transform-react-jsx-development': 7.22.5(@babel/core@7.23.2)
'@babel/plugin-transform-react-pure-annotations': 7.22.5(@babel/core@7.23.2)
'@babel/plugin-transform-react-display-name': 7.23.3(@babel/core@7.23.3)
'@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.23.3)
'@babel/plugin-transform-react-jsx-development': 7.22.5(@babel/core@7.23.3)
'@babel/plugin-transform-react-pure-annotations': 7.23.3(@babel/core@7.23.3)
dev: true
/@babel/runtime@7.23.2:
@@ -393,8 +399,8 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.22.13
'@babel/parser': 7.23.0
'@babel/types': 7.23.0
'@babel/parser': 7.23.3
'@babel/types': 7.23.3
dev: true
/@babel/traverse@7.23.2:
@@ -402,13 +408,31 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.22.13
'@babel/generator': 7.23.0
'@babel/generator': 7.23.3
'@babel/helper-environment-visitor': 7.22.20
'@babel/helper-function-name': 7.23.0
'@babel/helper-hoist-variables': 7.22.5
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.23.0
'@babel/types': 7.23.0
'@babel/parser': 7.23.3
'@babel/types': 7.23.3
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/traverse@7.23.3:
resolution: {integrity: sha512-+K0yF1/9yR0oHdE0StHuEj3uTPzwwbrLGfNOndVJVV2TqA5+j3oljJUb4nmB954FLGjNem976+B+eDuLIjesiQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.22.13
'@babel/generator': 7.23.3
'@babel/helper-environment-visitor': 7.22.20
'@babel/helper-function-name': 7.23.0
'@babel/helper-hoist-variables': 7.22.5
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.23.3
'@babel/types': 7.23.3
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
@@ -423,8 +447,8 @@ packages:
to-fast-properties: 2.0.0
dev: true
/@babel/types@7.23.0:
resolution: {integrity: sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==}
/@babel/types@7.23.3:
resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-string-parser': 7.22.5
@@ -450,9 +474,9 @@ packages:
typescript:
optional: true
dependencies:
'@babel/core': 7.23.2
'@babel/eslint-parser': 7.22.15(@babel/core@7.23.2)(eslint@8.53.0)
'@babel/preset-react': 7.22.15(@babel/core@7.23.2)
'@babel/core': 7.23.3
'@babel/eslint-parser': 7.23.3(@babel/core@7.23.3)(eslint@8.53.0)
'@babel/preset-react': 7.23.3(@babel/core@7.23.3)
'@rushstack/eslint-patch': 1.5.1
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.53.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.53.0)(typescript@5.2.2)
@@ -920,7 +944,7 @@ packages:
optional: true
dependencies:
'@babel/generator': 7.17.7
'@babel/parser': 7.23.0
'@babel/parser': 7.23.3
'@babel/traverse': 7.23.2
'@babel/types': 7.17.0
javascript-natural-sort: 0.7.1
@@ -965,6 +989,19 @@ packages:
resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==}
dev: true
/@types/node-fetch@2.6.9:
resolution: {integrity: sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==}
dependencies:
'@types/node': 20.9.0
form-data: 4.0.0
dev: true
/@types/node@18.18.9:
resolution: {integrity: sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==}
dependencies:
undici-types: 5.26.5
dev: true
/@types/node@20.9.0:
resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==}
dependencies:
@@ -1144,6 +1181,13 @@ packages:
hasBin: true
dev: true
/agentkeepalive@4.5.0:
resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==}
engines: {node: '>= 8.0.0'}
dependencies:
humanize-ms: 1.2.1
dev: true
/aggregate-error@4.0.1:
resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==}
engines: {node: '>=12'}
@@ -1400,6 +1444,10 @@ packages:
has-symbols: 1.0.3
dev: true
/asynckit@0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
dev: true
/available-typed-arrays@1.0.5:
resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==}
engines: {node: '>= 0.4'}
@@ -1420,6 +1468,10 @@ packages:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
dev: true
/base-64@0.1.0:
resolution: {integrity: sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==}
dev: true
/base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
dev: true
@@ -1488,7 +1540,7 @@ packages:
hasBin: true
dependencies:
caniuse-lite: 1.0.30001561
electron-to-chromium: 1.4.579
electron-to-chromium: 1.4.580
node-releases: 2.0.13
update-browserslist-db: 1.0.13(browserslist@4.22.1)
dev: true
@@ -1641,6 +1693,10 @@ packages:
resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}
dev: true
/charenc@0.0.2:
resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==}
dev: true
/ci-info@3.9.0:
resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==}
engines: {node: '>=8'}
@@ -1759,6 +1815,13 @@ packages:
resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==}
dev: true
/combined-stream@1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
dependencies:
delayed-stream: 1.0.0
dev: true
/commander-version@1.1.0:
resolution: {integrity: sha512-9aNW4N6q6EPDUszLRH6k9IwO6OoGYh3HRgUF/fA7Zs+Mz1v1x5akSqT7QGB8JsGY7AG7qMA7oRRB/4yyn33FYA==}
dependencies:
@@ -1846,6 +1909,10 @@ packages:
which: 2.0.2
dev: true
/crypt@0.0.2:
resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==}
dev: true
/crypto-random-string@4.0.0:
resolution: {integrity: sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==}
engines: {node: '>=12'}
@@ -2017,11 +2084,23 @@ packages:
slash: 4.0.0
dev: true
/delayed-stream@1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
dev: true
/dequal@2.0.3:
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
dev: true
/digest-fetch@1.3.0:
resolution: {integrity: sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==}
dependencies:
base-64: 0.1.0
md5: 2.3.0
dev: true
/dir-glob@3.0.1:
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
engines: {node: '>=8'}
@@ -2065,8 +2144,8 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
dev: true
/electron-to-chromium@1.4.579:
resolution: {integrity: sha512-bJKvA+awBIzYR0xRced7PrQuRIwGQPpo6ZLP62GAShahU9fWpsNN2IP6BSP1BLDDSbxvBVRGAMWlvVVq3npmLA==}
/electron-to-chromium@1.4.580:
resolution: {integrity: sha512-T5q3pjQon853xxxHUq3ZP68ZpvJHuSMY2+BZaW3QzjS4HvNuvsMmZ/+lU+nCrftre1jFZ+OSlExynXWBihnXzw==}
dev: true
/elegant-spinner@1.0.1:
@@ -2833,11 +2912,32 @@ packages:
is-callable: 1.2.7
dev: true
/form-data-encoder@1.7.2:
resolution: {integrity: sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==}
dev: true
/form-data-encoder@2.1.4:
resolution: {integrity: sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==}
engines: {node: '>= 14.17'}
dev: true
/form-data@4.0.0:
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
engines: {node: '>= 6'}
dependencies:
asynckit: 0.4.0
combined-stream: 1.0.8
mime-types: 2.1.35
dev: true
/formdata-node@4.4.1:
resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==}
engines: {node: '>= 12.20'}
dependencies:
node-domexception: 1.0.0
web-streams-polyfill: 4.0.0-beta.3
dev: true
/fs.realpath@1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
dev: true
@@ -3162,6 +3262,12 @@ packages:
engines: {node: '>=16.17.0'}
dev: true
/humanize-ms@1.2.1:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
dependencies:
ms: 2.1.3
dev: true
/husky@8.0.3:
resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==}
engines: {node: '>=14'}
@@ -3365,6 +3471,10 @@ packages:
has-tostringtag: 1.0.0
dev: true
/is-buffer@1.1.6:
resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==}
dev: true
/is-callable@1.2.7:
resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==}
engines: {node: '>= 0.4'}
@@ -4038,6 +4148,14 @@ packages:
engines: {node: '>=8'}
dev: true
/md5@2.3.0:
resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==}
dependencies:
charenc: 0.0.2
crypt: 0.0.2
is-buffer: 1.1.6
dev: true
/memorystream@0.3.1:
resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==}
engines: {node: '>= 0.10.0'}
@@ -4083,6 +4201,18 @@ packages:
picomatch: 2.3.1
dev: true
/mime-db@1.52.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
engines: {node: '>= 0.6'}
dev: true
/mime-types@2.1.35:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'}
dependencies:
mime-db: 1.52.0
dev: true
/mimic-fn@1.2.0:
resolution: {integrity: sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==}
engines: {node: '>=4'}
@@ -4184,6 +4314,11 @@ packages:
resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==}
dev: true
/node-domexception@1.0.0:
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
engines: {node: '>=10.5.0'}
dev: true
/node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
@@ -4439,6 +4574,29 @@ packages:
is-wsl: 2.2.0
dev: true
/openai@4.17.3:
resolution: {integrity: sha512-Gx9wzl9HWX5pjagkgXVu6U2BTFEPkQFdkppNnAX2n2Rpjtn2zt152wXh7NnZ5eJuVxUGYzRe66JmayAEGjzqAg==}
hasBin: true
dependencies:
'@types/node': 18.18.9
'@types/node-fetch': 2.6.9
abort-controller: 3.0.0
agentkeepalive: 4.5.0
digest-fetch: 1.3.0
form-data-encoder: 1.7.2
formdata-node: 4.4.1
node-fetch: 2.7.0
web-streams-polyfill: 3.2.1
transitivePeerDependencies:
- encoding
dev: true
/openapi-jsonschema-parameters@12.1.3:
resolution: {integrity: sha512-aHypKxWHwu2lVqfCIOCZeJA/2NTDiP63aPwuoIC+5ksLK5/IQZ3oKTz7GiaIegz5zFvpMDxDvLR2DMQQSkOAug==}
dependencies:
openapi-types: 12.1.3
dev: true
/openapi-types@12.1.3:
resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}
dev: true
@@ -4820,7 +4978,7 @@ packages:
unicode-properties: 1.4.1
urijs: 1.19.11
wordwrap: 1.0.0
yaml: 2.3.3
yaml: 2.3.4
transitivePeerDependencies:
- encoding
dev: true
@@ -5603,8 +5761,9 @@ packages:
typescript: 5.2.2
dev: true
/tsx@3.14.0:
resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==}
/tsx@4.0.0:
resolution: {integrity: sha512-jd3C5kw9tR68gtvqHUYo/2IwxaA46/CyKvcVQ4DsKRAPb19/vWgl7zF9mYNjFRY6KcGKiwne41RU91ll31IggQ==}
engines: {node: '>=18.0.0'}
hasBin: true
dependencies:
esbuild: 0.18.20
@@ -5821,6 +5980,16 @@ packages:
defaults: 1.0.4
dev: true
/web-streams-polyfill@3.2.1:
resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==}
engines: {node: '>= 8'}
dev: true
/web-streams-polyfill@4.0.0-beta.3:
resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==}
engines: {node: '>= 14'}
dev: true
/webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
dev: true
@@ -5962,6 +6131,11 @@ packages:
resolution: {integrity: sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==}
engines: {node: '>= 14'}
/yaml@2.3.4:
resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==}
engines: {node: '>= 14'}
dev: true
/yargs-parser@20.2.9:
resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==}
engines: {node: '>=10'}
+89
View File
@@ -0,0 +1,89 @@
import { OpenAPIHono, createRoute } from '@hono/zod-openapi'
import * as oai from './oai'
const app: OpenAPIHono = new OpenAPIHono()
const ListFilesResponseSchema =
oai.ListFilesResponseSchema.openapi('ListFilesResponse')
const listFiles = createRoute({
method: 'get',
path: '',
summary: 'Retrieve the user',
request: {
query: oai.ListFilesParamsQueryClassSchema
// query: z.object({
// purpose: z.union([z.null(), z.string()]).optional()
// // .openapi({
// // param: {
// // in: 'query',
// // name: 'purpose'
// // }
// // })
// })
},
responses: {
200: {
description: 'OK',
content: {
'application/json': {
schema: ListFilesResponseSchema
}
}
}
}
})
app.openapi(listFiles, (c) => {
// TODO: this should work
// const { purpose } = c.req.valid('query')
const purpose = c.req.query('purpose')
console.log({ purpose })
return c.jsonT({
data: [],
object: 'list' as const
})
})
const CreateFileRequest =
oai.CreateFileRequestSchema.openapi('CreateFileRequest')
const OpenAIFileSchema = oai.OpenAIFileClassSchema.openapi('OpenAIFile')
const createFile = createRoute({
method: 'post',
path: '',
summary:
'Upload a file that can be used across various endpoints/features. The size of all the files uploaded by one organization can be up to 100 GB.',
request: {
body: {
required: true,
content: {
'multipart/form-data': {
schema: CreateFileRequest
}
}
}
},
responses: {
200: {
description: 'OK',
content: {
'application/json': {
schema: OpenAIFileSchema
}
}
}
}
})
app.openapi(createFile, (c) => {
const body = c.req.valid('form')
console.log(body)
return c.jsonT({} as any)
})
export default app
+13 -3
View File
@@ -1,7 +1,17 @@
import { serve } from '@hono/node-server'
import { Hono } from 'hono'
import { OpenAPIHono } from '@hono/zod-openapi'
const app = new Hono()
app.get('/', (c) => c.text('Hello Hono!'))
import files from './files'
const app = new OpenAPIHono()
app.route('/files', files)
app.doc('/openapi', {
openapi: '3.0.0',
info: {
version: '2.0.0',
title: 'OpenAPI'
}
})
serve(app)
+239 -200
View File
@@ -1,14 +1,20 @@
import * as z from 'zod'
/**
* This file is auto-generated by OpenOpenAI/src/generate.ts using OpenAI's
* OpenAPI spec as a source of truth.
*
* DO NOT EDIT THIS FILE MANUALLY if you want your changes to persist.
*/
import { z } from '@hono/zod-openapi'
export const OrderSchema = z.enum(['asc', 'desc'])
// One of `server_error` or `rate_limit_exceeded`.
export const CodeSchema = z.enum(['rate_limit_exceeded', 'server_error'])
export type Code = z.infer<typeof CodeSchema>
// The object type, which is always `thread.run.step``.
export const PurpleObjectSchema = z.enum(['thread.run.step'])
export type PurpleObject = z.infer<typeof PurpleObjectSchema>
export const PurpleObjectSchema = z.literal('thread.run.step')
// The status of the run step, which can be either `in_progress`, `cancelled`, `failed`,
// `completed`, or `expired`.
@@ -20,14 +26,12 @@ export const PurpleStatusSchema = z.enum([
'failed',
'in_progress'
])
export type PurpleStatus = z.infer<typeof PurpleStatusSchema>
// Always `logs`.
//
// Always `image`.
export const OutputTypeSchema = z.enum(['image', 'logs'])
export type OutputType = z.infer<typeof OutputTypeSchema>
// The type of tool call. This is always going to be `code_interpreter` for this type of
// tool call.
@@ -48,7 +52,6 @@ export const ToolTypeSchema = z.enum([
'function',
'retrieval'
])
export type ToolType = z.infer<typeof ToolTypeSchema>
// Always `message_creation``.
//
@@ -57,27 +60,22 @@ export type ToolType = z.infer<typeof ToolTypeSchema>
// The type of run step, which can be either `message_creation` or `tool_calls`.
export const StepDetailsTypeSchema = z.enum(['message_creation', 'tool_calls'])
export type StepDetailsType = z.infer<typeof StepDetailsTypeSchema>
// The role of the entity that is creating the message. Currently only `user` is supported.
export const MessageRoleSchema = z.enum(['user'])
export type MessageRole = z.infer<typeof MessageRoleSchema>
export const MessageRoleSchema = z.literal('user')
// The object type, which is always `thread.run`.
export const FluffyObjectSchema = z.enum(['thread.run'])
export type FluffyObject = z.infer<typeof FluffyObjectSchema>
export const FluffyObjectSchema = z.literal('thread.run')
// The type of tool call the output is required for. For now, this is always `function`.
export const PurpleTypeSchema = z.enum(['function'])
export type PurpleType = z.infer<typeof PurpleTypeSchema>
export const PurpleTypeSchema = z.literal('function')
// For now, this is always `submit_tool_outputs`.
export const RequiredActionTypeSchema = z.enum(['submit_tool_outputs'])
export type RequiredActionType = z.infer<typeof RequiredActionTypeSchema>
export const RequiredActionTypeSchema = z.literal('submit_tool_outputs')
// The status of the run, which can be either `queued`, `in_progress`, `requires_action`,
// `cancelling`, `cancelled`, `failed`, `completed`, or `expired`.
@@ -92,41 +90,34 @@ export const FluffyStatusSchema = z.enum([
'queued',
'requires_action'
])
export type FluffyStatus = z.infer<typeof FluffyStatusSchema>
// The object type, which is always `assistant`.
export const TentacledObjectSchema = z.enum(['assistant'])
export type TentacledObject = z.infer<typeof TentacledObjectSchema>
export const TentacledObjectSchema = z.literal('assistant')
// Always `file_citation`.
//
// Always `file_path`.
export const AnnotationTypeSchema = z.enum(['file_citation', 'file_path'])
export type AnnotationType = z.infer<typeof AnnotationTypeSchema>
// Always `image_file`.
//
// Always `text`.
export const ContentTypeSchema = z.enum(['image_file', 'text'])
export type ContentType = z.infer<typeof ContentTypeSchema>
// The object type, which is always `thread.message`.
export const StickyObjectSchema = z.enum(['thread.message'])
export type StickyObject = z.infer<typeof StickyObjectSchema>
export const StickyObjectSchema = z.literal('thread.message')
// The entity that produced the message. One of `user` or `assistant`.
export const DatumRoleSchema = z.enum(['assistant', 'user'])
export type DatumRole = z.infer<typeof DatumRoleSchema>
// The object type, which is always `file`.
export const OpenAIFileObjectSchema = z.enum(['file'])
export type OpenAIFileObject = z.infer<typeof OpenAIFileObjectSchema>
export const OpenAIFileObjectSchema = z.literal('file')
// The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`,
// `assistants`, and `assistants_output`.
@@ -137,28 +128,21 @@ export const OpenAIFilePurposeSchema = z.enum([
'fine-tune',
'fine-tune-results'
])
export type OpenAIFilePurpose = z.infer<typeof OpenAIFilePurposeSchema>
// Deprecated. The current status of the file, which can be either `uploaded`, `processed`,
// or `error`.
export const OpenAIFileStatusSchema = z.enum(['error', 'processed', 'uploaded'])
export type OpenAIFileStatus = z.infer<typeof OpenAIFileStatusSchema>
export const ListFilesResponseObjectSchema = z.enum(['list'])
export type ListFilesResponseObject = z.infer<
typeof ListFilesResponseObjectSchema
>
export const ListFilesResponseObjectSchema = z.literal('list')
// The object type, which is always `assistant.file`.
export const IndigoObjectSchema = z.enum(['assistant.file'])
export type IndigoObject = z.infer<typeof IndigoObjectSchema>
export const IndigoObjectSchema = z.literal('assistant.file')
// The object type, which is always `thread.message.file`.
export const IndecentObjectSchema = z.enum(['thread.message.file'])
export type IndecentObject = z.infer<typeof IndecentObjectSchema>
export const IndecentObjectSchema = z.literal('thread.message.file')
// The intended purpose of the uploaded file.
//
@@ -171,82 +155,56 @@ export const CreateFileRequestPurposeSchema = z.enum([
'assistants',
'fine-tune'
])
export type CreateFileRequestPurpose = z.infer<
typeof CreateFileRequestPurposeSchema
>
export const DeleteAssistantResponseObjectSchema = z.enum(['assistant.deleted'])
export type DeleteAssistantResponseObject = z.infer<
typeof DeleteAssistantResponseObjectSchema
>
export const DeleteAssistantResponseObjectSchema =
z.literal('assistant.deleted')
// The object type, which is always `thread`.
export const ThreadObjectSchema = z.enum(['thread'])
export type ThreadObject = z.infer<typeof ThreadObjectSchema>
export const ThreadObjectSchema = z.literal('thread')
export const DeleteThreadResponseObjectSchema = z.enum(['thread.deleted'])
export type DeleteThreadResponseObject = z.infer<
typeof DeleteThreadResponseObjectSchema
>
export const DeleteThreadResponseObjectSchema = z.literal('thread.deleted')
export const DeleteAssistantFileResponseObjectSchema = z.enum([
export const DeleteAssistantFileResponseObjectSchema = z.literal(
'assistant.file.deleted'
])
export type DeleteAssistantFileResponseObject = z.infer<
typeof DeleteAssistantFileResponseObjectSchema
>
)
export const DeleteAssistantFileResponseSchema = z.object({
deleted: z.boolean(),
id: z.string(),
object: DeleteAssistantFileResponseObjectSchema
})
export type DeleteAssistantFileResponse = z.infer<
typeof DeleteAssistantFileResponseSchema
>
export const CreateAssistantFileRequestSchema = z.object({
file_id: z.string()
})
export type CreateAssistantFileRequest = z.infer<
typeof CreateAssistantFileRequestSchema
>
export const ToolOutputSchema = z.object({
output: z.union([z.null(), z.string()]).optional(),
tool_call_id: z.union([z.null(), z.string()]).optional()
output: z.string().optional(),
tool_call_id: z.string().optional()
})
export type ToolOutput = z.infer<typeof ToolOutputSchema>
export const SubmitToolOutputsRunRequestSchema = z.object({
tool_outputs: z.array(ToolOutputSchema)
})
export type SubmitToolOutputsRunRequest = z.infer<
typeof SubmitToolOutputsRunRequestSchema
>
export const ModifyRunRequestSchema = z.object({
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional()
})
export type ModifyRunRequest = z.infer<typeof ModifyRunRequestSchema>
export const ModifyMessageRequestSchema = z.object({
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional()
})
export type ModifyMessageRequest = z.infer<typeof ModifyMessageRequestSchema>
export const DeleteThreadResponseSchema = z.object({
deleted: z.boolean(),
id: z.string(),
object: DeleteThreadResponseObjectSchema
})
export type DeleteThreadResponse = z.infer<typeof DeleteThreadResponseSchema>
export const ModifyThreadRequestSchema = z.object({
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional()
})
export type ModifyThreadRequest = z.infer<typeof ModifyThreadRequestSchema>
export const ThreadSchema = z.object({
created_at: z.number(),
@@ -254,29 +212,23 @@ export const ThreadSchema = z.object({
metadata: z.record(z.string(), z.any()),
object: ThreadObjectSchema
})
export type Thread = z.infer<typeof ThreadSchema>
export const DeleteAssistantResponseSchema = z.object({
deleted: z.boolean(),
id: z.string(),
object: DeleteAssistantResponseObjectSchema
})
export type DeleteAssistantResponse = z.infer<
typeof DeleteAssistantResponseSchema
>
export const DeleteFileResponseSchema = z.object({
deleted: z.boolean(),
id: z.string(),
object: OpenAIFileObjectSchema
})
export type DeleteFileResponse = z.infer<typeof DeleteFileResponseSchema>
export const CreateFileRequestSchema = z.object({
file: z.string(),
purpose: CreateFileRequestPurposeSchema
})
export type CreateFileRequest = z.infer<typeof CreateFileRequestSchema>
export const MessageFilesSchema = z.object({
created_at: z.number(),
@@ -284,7 +236,6 @@ export const MessageFilesSchema = z.object({
message_id: z.string(),
object: IndecentObjectSchema
})
export type MessageFiles = z.infer<typeof MessageFilesSchema>
export const ListMessageFilesResponseClassSchema = z.object({
data: z.array(MessageFilesSchema),
@@ -294,9 +245,6 @@ export const ListMessageFilesResponseClassSchema = z.object({
object: z.string(),
items: z.any()
})
export type ListMessageFilesResponseClass = z.infer<
typeof ListMessageFilesResponseClassSchema
>
export const AssistantFilesSchema = z.object({
assistant_id: z.string(),
@@ -304,7 +252,6 @@ export const AssistantFilesSchema = z.object({
id: z.string(),
object: IndigoObjectSchema
})
export type AssistantFiles = z.infer<typeof AssistantFilesSchema>
export const ListAssistantFilesResponseClassSchema = z.object({
data: z.array(AssistantFilesSchema),
@@ -314,9 +261,6 @@ export const ListAssistantFilesResponseClassSchema = z.object({
object: z.string(),
items: z.any()
})
export type ListAssistantFilesResponseClass = z.infer<
typeof ListAssistantFilesResponseClassSchema
>
export const OpenAIFileClassSchema = z.object({
bytes: z.number(),
@@ -326,9 +270,8 @@ export const OpenAIFileClassSchema = z.object({
object: OpenAIFileObjectSchema,
purpose: OpenAIFilePurposeSchema,
status: OpenAIFileStatusSchema,
status_details: z.union([z.null(), z.string()]).optional()
status_details: z.string().optional()
})
export type OpenAIFileClass = z.infer<typeof OpenAIFileClassSchema>
export const ListFilesResponseSchema = z.object({
data: z.array(
@@ -344,68 +287,58 @@ export const ListFilesResponseSchema = z.object({
),
object: ListFilesResponseObjectSchema
})
export type ListFilesResponse = z.infer<typeof ListFilesResponseSchema>
export const AmbitiousFunctionSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
name: z.string(),
parameters: z.record(z.string(), z.any())
})
export type AmbitiousFunction = z.infer<typeof AmbitiousFunctionSchema>
export const CreateRunRequestToolSchema = z.object({
type: ToolTypeSchema,
function: z.union([AmbitiousFunctionSchema, z.null()]).optional()
function: AmbitiousFunctionSchema.optional()
})
export type CreateRunRequestTool = z.infer<typeof CreateRunRequestToolSchema>
export const CreateRunRequestSchema = z.object({
assistant_id: z.string(),
instructions: z.union([z.null(), z.string()]).optional(),
instructions: z.string().optional(),
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
model: z.union([z.null(), z.string()]).optional(),
tools: z.union([z.array(CreateRunRequestToolSchema), z.null()]).optional()
model: z.string().optional(),
tools: z.array(CreateRunRequestToolSchema).optional()
})
export type CreateRunRequest = z.infer<typeof CreateRunRequestSchema>
export const FilePathSchema = z.object({
file_id: z.string()
})
export type FilePath = z.infer<typeof FilePathSchema>
export const FileCitationSchema = z.object({
file_id: z.string(),
quote: z.string()
})
export type FileCitation = z.infer<typeof FileCitationSchema>
export const FileSchema = z.object({
end_index: z.number(),
file_citation: z.union([FileCitationSchema, z.null()]).optional(),
file_citation: FileCitationSchema.optional(),
start_index: z.number(),
text: z.string(),
type: AnnotationTypeSchema,
file_path: z.union([FilePathSchema, z.null()]).optional()
file_path: FilePathSchema.optional()
})
export type File = z.infer<typeof FileSchema>
export const TextSchema = z.object({
annotations: z.array(FileSchema),
value: z.string()
})
export type Text = z.infer<typeof TextSchema>
export const ImageFileClassSchema = z.object({
file_id: z.string()
})
export type ImageFileClass = z.infer<typeof ImageFileClassSchema>
export const ContentElementSchema = z.object({
image_file: z.union([ImageFileClassSchema, z.null()]).optional(),
image_file: ImageFileClassSchema.optional(),
type: ContentTypeSchema,
text: z.union([TextSchema, z.null()]).optional()
text: TextSchema.optional()
})
export type ContentElement = z.infer<typeof ContentElementSchema>
export const TheMessageObjectSchema = z.object({
assistant_id: z.string(),
@@ -419,7 +352,6 @@ export const TheMessageObjectSchema = z.object({
run_id: z.string(),
thread_id: z.string()
})
export type TheMessageObject = z.infer<typeof TheMessageObjectSchema>
export const ListMessagesResponseClassSchema = z.object({
data: z.array(TheMessageObjectSchema),
@@ -428,82 +360,59 @@ export const ListMessagesResponseClassSchema = z.object({
last_id: z.string(),
object: z.string()
})
export type ListMessagesResponseClass = z.infer<
typeof ListMessagesResponseClassSchema
>
export const HilariousFunctionSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
name: z.string(),
parameters: z.record(z.string(), z.any())
})
export type HilariousFunction = z.infer<typeof HilariousFunctionSchema>
export const ModifyAssistantRequestToolSchema = z.object({
type: ToolTypeSchema,
function: z.union([HilariousFunctionSchema, z.null()]).optional()
function: HilariousFunctionSchema.optional()
})
export type ModifyAssistantRequestTool = z.infer<
typeof ModifyAssistantRequestToolSchema
>
export const ModifyAssistantRequestSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
file_ids: z.union([z.array(z.string()), z.null()]).optional(),
instructions: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
file_ids: z.array(z.string()).optional(),
instructions: z.string().optional(),
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
model: z.union([z.null(), z.string()]).optional(),
name: z.union([z.null(), z.string()]).optional(),
tools: z
.union([z.array(ModifyAssistantRequestToolSchema), z.null()])
.optional()
model: z.string().optional(),
name: z.string().optional(),
tools: z.array(ModifyAssistantRequestToolSchema).optional()
})
export type ModifyAssistantRequest = z.infer<
typeof ModifyAssistantRequestSchema
>
export const IndecentFunctionSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
name: z.string(),
parameters: z.record(z.string(), z.any())
})
export type IndecentFunction = z.infer<typeof IndecentFunctionSchema>
export const CreateAssistantRequestToolSchema = z.object({
type: ToolTypeSchema,
function: z.union([IndecentFunctionSchema, z.null()]).optional()
function: IndecentFunctionSchema.optional()
})
export type CreateAssistantRequestTool = z.infer<
typeof CreateAssistantRequestToolSchema
>
export const CreateAssistantRequestSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
file_ids: z.union([z.array(z.string()), z.null()]).optional(),
instructions: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
file_ids: z.array(z.string()).optional(),
instructions: z.string().optional(),
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
model: z.string(),
name: z.union([z.null(), z.string()]).optional(),
tools: z
.union([z.array(CreateAssistantRequestToolSchema), z.null()])
.optional()
name: z.string().optional(),
tools: z.array(CreateAssistantRequestToolSchema).optional()
})
export type CreateAssistantRequest = z.infer<
typeof CreateAssistantRequestSchema
>
export const IndigoFunctionSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
name: z.string(),
parameters: z.record(z.string(), z.any())
})
export type IndigoFunction = z.infer<typeof IndigoFunctionSchema>
export const FluffyToolSchema = z.object({
type: ToolTypeSchema,
function: z.union([IndigoFunctionSchema, z.null()]).optional()
function: IndigoFunctionSchema.optional()
})
export type FluffyTool = z.infer<typeof FluffyToolSchema>
export const AssistantSchema = z.object({
created_at: z.number(),
@@ -517,7 +426,6 @@ export const AssistantSchema = z.object({
object: TentacledObjectSchema,
tools: z.array(FluffyToolSchema)
})
export type Assistant = z.infer<typeof AssistantSchema>
export const ListAssistantsResponseSchema = z.object({
data: z.array(AssistantSchema),
@@ -526,54 +434,42 @@ export const ListAssistantsResponseSchema = z.object({
last_id: z.string(),
object: z.string()
})
export type ListAssistantsResponse = z.infer<
typeof ListAssistantsResponseSchema
>
export const StickyFunctionSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
name: z.string(),
parameters: z.record(z.string(), z.any())
})
export type StickyFunction = z.infer<typeof StickyFunctionSchema>
export const PurpleToolSchema = z.object({
type: ToolTypeSchema,
function: z.union([StickyFunctionSchema, z.null()]).optional()
function: StickyFunctionSchema.optional()
})
export type PurpleTool = z.infer<typeof PurpleToolSchema>
export const TentacledFunctionSchema = z.object({
arguments: z.string(),
name: z.string()
})
export type TentacledFunction = z.infer<typeof TentacledFunctionSchema>
export const SubmitToolOutputsToolCallSchema = z.object({
function: TentacledFunctionSchema,
id: z.string(),
type: PurpleTypeSchema
})
export type SubmitToolOutputsToolCall = z.infer<
typeof SubmitToolOutputsToolCallSchema
>
export const SubmitToolOutputsSchema = z.object({
tool_calls: z.array(SubmitToolOutputsToolCallSchema)
})
export type SubmitToolOutputs = z.infer<typeof SubmitToolOutputsSchema>
export const RequiredActionSchema = z.object({
submit_tool_outputs: SubmitToolOutputsSchema,
type: RequiredActionTypeSchema
})
export type RequiredAction = z.infer<typeof RequiredActionSchema>
export const FluffyLastErrorSchema = z.object({
code: CodeSchema,
message: z.string()
})
export type FluffyLastError = z.infer<typeof FluffyLastErrorSchema>
export const ARunOnAThreadSchema = z.object({
assistant_id: z.string(),
@@ -595,7 +491,6 @@ export const ARunOnAThreadSchema = z.object({
thread_id: z.string(),
tools: z.array(PurpleToolSchema)
})
export type ARunOnAThread = z.infer<typeof ARunOnAThreadSchema>
export const ListRunsResponseSchema = z.object({
data: z.array(ARunOnAThreadSchema),
@@ -604,102 +499,82 @@ export const ListRunsResponseSchema = z.object({
last_id: z.string(),
object: z.string()
})
export type ListRunsResponse = z.infer<typeof ListRunsResponseSchema>
export const FluffyFunctionSchema = z.object({
description: z.union([z.null(), z.string()]).optional(),
description: z.string().optional(),
name: z.string(),
parameters: z.record(z.string(), z.any())
})
export type FluffyFunction = z.infer<typeof FluffyFunctionSchema>
export const CreateThreadAndRunRequestToolSchema = z.object({
type: ToolTypeSchema,
function: z.union([FluffyFunctionSchema, z.null()]).optional()
function: FluffyFunctionSchema.optional()
})
export type CreateThreadAndRunRequestTool = z.infer<
typeof CreateThreadAndRunRequestToolSchema
>
export const MessageSchema = z.object({
content: z.string(),
file_ids: z.union([z.array(z.string()), z.null()]).optional(),
file_ids: z.array(z.string()).optional(),
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
role: MessageRoleSchema
})
export type Message = z.infer<typeof MessageSchema>
export const ThreadClassSchema = z.object({
messages: z.union([z.array(MessageSchema), z.null()]).optional(),
messages: z.array(MessageSchema).optional(),
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional()
})
export type ThreadClass = z.infer<typeof ThreadClassSchema>
export const CreateThreadAndRunRequestSchema = z.object({
assistant_id: z.string(),
instructions: z.union([z.null(), z.string()]).optional(),
instructions: z.string().optional(),
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
model: z.union([z.null(), z.string()]).optional(),
thread: z.union([ThreadClassSchema, z.null()]).optional(),
tools: z
.union([z.array(CreateThreadAndRunRequestToolSchema), z.null()])
.optional()
model: z.string().optional(),
thread: ThreadClassSchema.optional(),
tools: z.array(CreateThreadAndRunRequestToolSchema).optional()
})
export type CreateThreadAndRunRequest = z.infer<
typeof CreateThreadAndRunRequestSchema
>
export const PurpleFunctionSchema = z.object({
arguments: z.string(),
name: z.string(),
output: z.string()
})
export type PurpleFunction = z.infer<typeof PurpleFunctionSchema>
export const ImageSchema = z.object({
file_id: z.string()
})
export type Image = z.infer<typeof ImageSchema>
export const CodeInterpreterOutputSchema = z.object({
logs: z.union([z.null(), z.string()]).optional(),
logs: z.string().optional(),
type: OutputTypeSchema,
image: z.union([ImageSchema, z.null()]).optional()
image: ImageSchema.optional()
})
export type CodeInterpreterOutput = z.infer<typeof CodeInterpreterOutputSchema>
export const CodeInterpreterSchema = z.object({
input: z.string(),
outputs: z.array(CodeInterpreterOutputSchema)
})
export type CodeInterpreter = z.infer<typeof CodeInterpreterSchema>
export const ToolCallSchema = z.object({
code_interpreter: z.union([CodeInterpreterSchema, z.null()]).optional(),
code_interpreter: CodeInterpreterSchema.optional(),
id: z.string(),
type: ToolTypeSchema,
retrieval: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
function: z.union([PurpleFunctionSchema, z.null()]).optional()
function: PurpleFunctionSchema.optional()
})
export type ToolCall = z.infer<typeof ToolCallSchema>
export const MessageCreationSchema = z.object({
message_id: z.string()
})
export type MessageCreation = z.infer<typeof MessageCreationSchema>
export const StepDetailsSchema = z.object({
message_creation: z.union([MessageCreationSchema, z.null()]).optional(),
message_creation: MessageCreationSchema.optional(),
type: StepDetailsTypeSchema,
tool_calls: z.union([z.array(ToolCallSchema), z.null()]).optional()
tool_calls: z.array(ToolCallSchema).optional()
})
export type StepDetails = z.infer<typeof StepDetailsSchema>
export const PurpleLastErrorSchema = z.object({
code: CodeSchema,
message: z.string()
})
export type PurpleLastError = z.infer<typeof PurpleLastErrorSchema>
export const RunStepsSchema = z.object({
assistant_id: z.string(),
@@ -718,7 +593,6 @@ export const RunStepsSchema = z.object({
thread_id: z.string(),
type: StepDetailsTypeSchema
})
export type RunSteps = z.infer<typeof RunStepsSchema>
export const ListRunStepsResponseClassSchema = z.object({
data: z.array(RunStepsSchema),
@@ -727,6 +601,171 @@ export const ListRunStepsResponseClassSchema = z.object({
last_id: z.string(),
object: z.string()
})
export type ListRunStepsResponseClass = z.infer<
typeof ListRunStepsResponseClassSchema
>
export const GetMessageFileParamsPathClassSchema = z.object({
file_id: z.string(),
message_id: z.string(),
thread_id: z.string()
})
export const ListMessageFilesParamsQueryClassSchema = z.object({
after: z.string().optional(),
before: z.string().optional(),
limit: z.number().optional(),
order: OrderSchema.optional()
})
export const ListMessageFilesParamsPathClassSchema = z.object({
message_id: z.string(),
thread_id: z.string()
})
export const DeleteAssistantFileParamsPathClassSchema = z.object({
assistant_id: z.string(),
file_id: z.string()
})
export const GetAssistantFileParamsPathClassSchema = z.object({
assistant_id: z.string(),
file_id: z.string()
})
export const CreateAssistantFileParamsPathClassSchema = z.object({
assistant_id: z.string()
})
export const ListAssistantFilesParamsQueryClassSchema = z.object({
after: z.string().optional(),
before: z.string().optional(),
limit: z.number().optional(),
order: OrderSchema.optional()
})
export const ListAssistantFilesParamsPathClassSchema = z.object({
assistant_id: z.string()
})
export const GetRunStepParamsPathClassSchema = z.object({
run_id: z.string(),
step_id: z.string(),
thread_id: z.string()
})
export const ListRunStepsParamsQueryClassSchema = z.object({
after: z.string().optional(),
before: z.string().optional(),
limit: z.number().optional(),
order: OrderSchema.optional()
})
export const ListRunStepsParamsPathClassSchema = z.object({
run_id: z.string(),
thread_id: z.string()
})
export const CancelRunParamsPathClassSchema = z.object({
run_id: z.string(),
thread_id: z.string()
})
export const SubmitToolOuputsToRunParamsPathClassSchema = z.object({
run_id: z.string(),
thread_id: z.string()
})
export const ModifyRunParamsPathClassSchema = z.object({
run_id: z.string(),
thread_id: z.string()
})
export const GetRunParamsPathClassSchema = z.object({
run_id: z.string(),
thread_id: z.string()
})
export const CreateRunParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const ListRunsParamsQueryClassSchema = z.object({
after: z.string().optional(),
before: z.string().optional(),
limit: z.number().optional(),
order: OrderSchema.optional()
})
export const ListRunsParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const ModifyMessageParamsPathClassSchema = z.object({
message_id: z.string(),
thread_id: z.string()
})
export const GetMessageParamsPathClassSchema = z.object({
message_id: z.string(),
thread_id: z.string()
})
export const CreateMessageParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const ListMessagesParamsQueryClassSchema = z.object({
after: z.string().optional(),
before: z.string().optional(),
limit: z.number().optional(),
order: OrderSchema.optional()
})
export const ListMessagesParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const DeleteThreadParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const ModifyThreadParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const GetThreadParamsPathClassSchema = z.object({
thread_id: z.string()
})
export const DeleteAssistantParamsPathClassSchema = z.object({
assistant_id: z.string()
})
export const ModifyAssistantParamsPathClassSchema = z.object({
assistant_id: z.string()
})
export const GetAssistantParamsPathClassSchema = z.object({
assistant_id: z.string()
})
export const ListAssistantsParamsQueryClassSchema = z.object({
after: z.string().optional(),
before: z.string().optional(),
limit: z.number().optional(),
order: OrderSchema.optional()
})
export const DownloadFileParamsPathClassSchema = z.object({
file_id: z.string()
})
export const RetrieveFileParamsPathClassSchema = z.object({
file_id: z.string()
})
export const DeleteFileParamsPathClassSchema = z.object({
file_id: z.string()
})
export const ListFilesParamsQueryClassSchema = z.object({
purpose: z.string().optional()
})
+1
View File
@@ -1,5 +1,6 @@
{
"include": ["src", "bin"],
"exclude": ["node_modules", "dist", "openai-openapi"],
"compilerOptions": {
"target": "es2020",
"lib": ["ESNext", "DOM"],