@superinterface/react 5.1.3 → 5.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +8 -6
- package/types/index.d.ts +4 -0
- package/types/node_modules/openai/LICENSE +201 -0
- package/types/node_modules/openai/_vendor/partial-json-parser/parser.d.mts +7 -0
- package/types/node_modules/openai/_vendor/partial-json-parser/parser.d.ts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/Options.d.mts +32 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/Options.d.ts +32 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/Refs.d.mts +21 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/Refs.d.ts +21 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/errorMessages.d.mts +12 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/errorMessages.d.ts +12 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/index.d.mts +38 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/index.d.ts +38 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parseDef.d.mts +38 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parseDef.d.ts +38 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/any.d.mts +3 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/any.d.ts +3 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.d.mts +13 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.d.ts +13 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/bigint.d.mts +15 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/bigint.d.ts +15 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/boolean.d.mts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/boolean.d.ts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.mts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.ts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.mts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.ts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/date.d.mts +16 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/date.d.ts +16 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.mts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.ts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/effects.d.mts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/effects.d.ts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/enum.d.mts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/enum.d.ts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/intersection.d.mts +9 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/intersection.d.ts +9 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/literal.d.mts +10 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/literal.d.ts +10 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/map.d.mts +16 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/map.d.ts +16 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/nativeEnum.d.mts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/nativeEnum.d.ts +7 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/never.d.mts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/never.d.ts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/null.d.mts +6 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/null.d.ts +6 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.mts +11 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.ts +11 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/number.d.mts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/number.d.ts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/object.d.mts +11 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/object.d.ts +11 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.mts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.ts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.mts +6 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.ts +6 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.mts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.ts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.mts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.ts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/record.d.mts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/record.d.ts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/set.d.mts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/set.d.ts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/string.d.mts +70 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/string.d.ts +70 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/tuple.d.mts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/tuple.d.ts +14 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/undefined.d.mts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/undefined.d.ts +5 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/union.d.mts +24 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/union.d.ts +24 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/unknown.d.mts +3 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/parsers/unknown.d.ts +3 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/util.d.mts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/util.d.ts +4 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/zodToJsonSchema.d.mts +11 -0
- package/types/node_modules/openai/_vendor/zod-to-json-schema/zodToJsonSchema.d.ts +11 -0
- package/types/node_modules/openai/api-promise.d.mts +2 -0
- package/types/node_modules/openai/api-promise.d.ts +2 -0
- package/types/node_modules/openai/azure.d.mts +63 -0
- package/types/node_modules/openai/azure.d.ts +63 -0
- package/types/node_modules/openai/beta/realtime/index.d.mts +2 -0
- package/types/node_modules/openai/beta/realtime/index.d.ts +2 -0
- package/types/node_modules/openai/beta/realtime/internal-base.d.mts +45 -0
- package/types/node_modules/openai/beta/realtime/internal-base.d.ts +45 -0
- package/types/node_modules/openai/beta/realtime/websocket.d.mts +36 -0
- package/types/node_modules/openai/beta/realtime/websocket.d.ts +36 -0
- package/types/node_modules/openai/beta/realtime/ws.d.mts +27 -0
- package/types/node_modules/openai/beta/realtime/ws.d.ts +27 -0
- package/types/node_modules/openai/client.d.mts +297 -0
- package/types/node_modules/openai/client.d.ts +297 -0
- package/types/node_modules/openai/core/api-promise.d.mts +49 -0
- package/types/node_modules/openai/core/api-promise.d.ts +49 -0
- package/types/node_modules/openai/core/error.d.mts +59 -0
- package/types/node_modules/openai/core/error.d.ts +59 -0
- package/types/node_modules/openai/core/pagination.d.mts +89 -0
- package/types/node_modules/openai/core/pagination.d.ts +89 -0
- package/types/node_modules/openai/core/resource.d.mts +6 -0
- package/types/node_modules/openai/core/resource.d.ts +6 -0
- package/types/node_modules/openai/core/streaming.d.mts +33 -0
- package/types/node_modules/openai/core/streaming.d.ts +33 -0
- package/types/node_modules/openai/core/uploads.d.mts +3 -0
- package/types/node_modules/openai/core/uploads.d.ts +3 -0
- package/types/node_modules/openai/error.d.mts +2 -0
- package/types/node_modules/openai/error.d.ts +2 -0
- package/types/node_modules/openai/helpers/audio.d.mts +9 -0
- package/types/node_modules/openai/helpers/audio.d.ts +9 -0
- package/types/node_modules/openai/helpers/zod.d.mts +70 -0
- package/types/node_modules/openai/helpers/zod.d.ts +70 -0
- package/types/node_modules/openai/index.d.mts +8 -0
- package/types/node_modules/openai/index.d.ts +8 -0
- package/types/node_modules/openai/internal/builtin-types.d.mts +73 -0
- package/types/node_modules/openai/internal/builtin-types.d.ts +73 -0
- package/types/node_modules/openai/internal/decoders/line.d.mts +17 -0
- package/types/node_modules/openai/internal/decoders/line.d.ts +17 -0
- package/types/node_modules/openai/internal/detect-platform.d.mts +15 -0
- package/types/node_modules/openai/internal/detect-platform.d.ts +15 -0
- package/types/node_modules/openai/internal/errors.d.mts +3 -0
- package/types/node_modules/openai/internal/errors.d.ts +3 -0
- package/types/node_modules/openai/internal/headers.d.mts +20 -0
- package/types/node_modules/openai/internal/headers.d.ts +20 -0
- package/types/node_modules/openai/internal/parse.d.mts +17 -0
- package/types/node_modules/openai/internal/parse.d.ts +17 -0
- package/types/node_modules/openai/internal/qs/formats.d.mts +7 -0
- package/types/node_modules/openai/internal/qs/formats.d.ts +7 -0
- package/types/node_modules/openai/internal/qs/index.d.mts +10 -0
- package/types/node_modules/openai/internal/qs/index.d.ts +10 -0
- package/types/node_modules/openai/internal/qs/stringify.d.mts +3 -0
- package/types/node_modules/openai/internal/qs/stringify.d.ts +3 -0
- package/types/node_modules/openai/internal/qs/types.d.mts +57 -0
- package/types/node_modules/openai/internal/qs/types.d.ts +57 -0
- package/types/node_modules/openai/internal/qs/utils.d.mts +15 -0
- package/types/node_modules/openai/internal/qs/utils.d.ts +15 -0
- package/types/node_modules/openai/internal/request-options.d.mts +78 -0
- package/types/node_modules/openai/internal/request-options.d.ts +78 -0
- package/types/node_modules/openai/internal/shim-types.d.mts +17 -0
- package/types/node_modules/openai/internal/shim-types.d.ts +17 -0
- package/types/node_modules/openai/internal/shims.d.mts +20 -0
- package/types/node_modules/openai/internal/shims.d.ts +20 -0
- package/types/node_modules/openai/internal/stream-utils.d.mts +8 -0
- package/types/node_modules/openai/internal/stream-utils.d.ts +8 -0
- package/types/node_modules/openai/internal/to-file.d.mts +45 -0
- package/types/node_modules/openai/internal/to-file.d.ts +45 -0
- package/types/node_modules/openai/internal/types.d.mts +69 -0
- package/types/node_modules/openai/internal/types.d.ts +69 -0
- package/types/node_modules/openai/internal/uploads.d.mts +42 -0
- package/types/node_modules/openai/internal/uploads.d.ts +42 -0
- package/types/node_modules/openai/internal/utils/base64.d.mts +9 -0
- package/types/node_modules/openai/internal/utils/base64.d.ts +9 -0
- package/types/node_modules/openai/internal/utils/bytes.d.mts +4 -0
- package/types/node_modules/openai/internal/utils/bytes.d.ts +4 -0
- package/types/node_modules/openai/internal/utils/env.d.mts +9 -0
- package/types/node_modules/openai/internal/utils/env.d.ts +9 -0
- package/types/node_modules/openai/internal/utils/log.d.mts +37 -0
- package/types/node_modules/openai/internal/utils/log.d.ts +37 -0
- package/types/node_modules/openai/internal/utils/path.d.mts +15 -0
- package/types/node_modules/openai/internal/utils/path.d.ts +15 -0
- package/types/node_modules/openai/internal/utils/sleep.d.mts +2 -0
- package/types/node_modules/openai/internal/utils/sleep.d.ts +2 -0
- package/types/node_modules/openai/internal/utils/uuid.d.mts +5 -0
- package/types/node_modules/openai/internal/utils/uuid.d.ts +5 -0
- package/types/node_modules/openai/internal/utils/values.d.mts +18 -0
- package/types/node_modules/openai/internal/utils/values.d.ts +18 -0
- package/types/node_modules/openai/internal/utils.d.mts +7 -0
- package/types/node_modules/openai/internal/utils.d.ts +7 -0
- package/types/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts +59 -0
- package/types/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts +59 -0
- package/types/node_modules/openai/lib/AssistantStream.d.mts +60 -0
- package/types/node_modules/openai/lib/AssistantStream.d.ts +60 -0
- package/types/node_modules/openai/lib/ChatCompletionRunner.d.mts +16 -0
- package/types/node_modules/openai/lib/ChatCompletionRunner.d.ts +16 -0
- package/types/node_modules/openai/lib/ChatCompletionStream.d.mts +208 -0
- package/types/node_modules/openai/lib/ChatCompletionStream.d.ts +208 -0
- package/types/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts +19 -0
- package/types/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts +19 -0
- package/types/node_modules/openai/lib/EventEmitter.d.mts +45 -0
- package/types/node_modules/openai/lib/EventEmitter.d.ts +45 -0
- package/types/node_modules/openai/lib/EventStream.d.mts +62 -0
- package/types/node_modules/openai/lib/EventStream.d.ts +62 -0
- package/types/node_modules/openai/lib/ResponsesParser.d.mts +36 -0
- package/types/node_modules/openai/lib/ResponsesParser.d.ts +36 -0
- package/types/node_modules/openai/lib/RunnableFunction.d.mts +83 -0
- package/types/node_modules/openai/lib/RunnableFunction.d.ts +83 -0
- package/types/node_modules/openai/lib/Util.d.mts +5 -0
- package/types/node_modules/openai/lib/Util.d.ts +5 -0
- package/types/node_modules/openai/lib/chatCompletionUtils.d.mts +5 -0
- package/types/node_modules/openai/lib/chatCompletionUtils.d.ts +5 -0
- package/types/node_modules/openai/lib/jsonschema.d.mts +106 -0
- package/types/node_modules/openai/lib/jsonschema.d.ts +106 -0
- package/types/node_modules/openai/lib/parser.d.mts +47 -0
- package/types/node_modules/openai/lib/parser.d.ts +47 -0
- package/types/node_modules/openai/lib/responses/EventTypes.d.mts +9 -0
- package/types/node_modules/openai/lib/responses/EventTypes.d.ts +9 -0
- package/types/node_modules/openai/lib/responses/ResponseStream.d.mts +59 -0
- package/types/node_modules/openai/lib/responses/ResponseStream.d.ts +59 -0
- package/types/node_modules/openai/package.json +233 -0
- package/types/node_modules/openai/pagination.d.mts +2 -0
- package/types/node_modules/openai/pagination.d.ts +2 -0
- package/types/node_modules/openai/realtime/index.d.mts +2 -0
- package/types/node_modules/openai/realtime/index.d.ts +2 -0
- package/types/node_modules/openai/realtime/internal-base.d.mts +45 -0
- package/types/node_modules/openai/realtime/internal-base.d.ts +45 -0
- package/types/node_modules/openai/realtime/websocket.d.mts +36 -0
- package/types/node_modules/openai/realtime/websocket.d.ts +36 -0
- package/types/node_modules/openai/realtime/ws.d.mts +27 -0
- package/types/node_modules/openai/realtime/ws.d.ts +27 -0
- package/types/node_modules/openai/resource.d.mts +2 -0
- package/types/node_modules/openai/resource.d.ts +2 -0
- package/types/node_modules/openai/resources/audio/audio.d.mts +26 -0
- package/types/node_modules/openai/resources/audio/audio.d.ts +26 -0
- package/types/node_modules/openai/resources/audio/index.d.mts +5 -0
- package/types/node_modules/openai/resources/audio/index.d.ts +5 -0
- package/types/node_modules/openai/resources/audio/speech.d.mts +64 -0
- package/types/node_modules/openai/resources/audio/speech.d.ts +64 -0
- package/types/node_modules/openai/resources/audio/transcriptions.d.mts +485 -0
- package/types/node_modules/openai/resources/audio/transcriptions.d.ts +485 -0
- package/types/node_modules/openai/resources/audio/translations.d.mts +81 -0
- package/types/node_modules/openai/resources/audio/translations.d.ts +81 -0
- package/types/node_modules/openai/resources/audio.d.mts +2 -0
- package/types/node_modules/openai/resources/audio.d.ts +2 -0
- package/types/node_modules/openai/resources/batches.d.mts +279 -0
- package/types/node_modules/openai/resources/batches.d.ts +279 -0
- package/types/node_modules/openai/resources/beta/assistants.d.mts +1232 -0
- package/types/node_modules/openai/resources/beta/assistants.d.ts +1232 -0
- package/types/node_modules/openai/resources/beta/beta.d.mts +18 -0
- package/types/node_modules/openai/resources/beta/beta.d.ts +18 -0
- package/types/node_modules/openai/resources/beta/index.d.mts +5 -0
- package/types/node_modules/openai/resources/beta/index.d.ts +5 -0
- package/types/node_modules/openai/resources/beta/realtime/index.d.mts +4 -0
- package/types/node_modules/openai/resources/beta/realtime/index.d.ts +4 -0
- package/types/node_modules/openai/resources/beta/realtime/realtime.d.mts +2332 -0
- package/types/node_modules/openai/resources/beta/realtime/realtime.d.ts +2332 -0
- package/types/node_modules/openai/resources/beta/realtime/sessions.d.mts +744 -0
- package/types/node_modules/openai/resources/beta/realtime/sessions.d.ts +744 -0
- package/types/node_modules/openai/resources/beta/realtime/transcription-sessions.d.mts +299 -0
- package/types/node_modules/openai/resources/beta/realtime/transcription-sessions.d.ts +299 -0
- package/types/node_modules/openai/resources/beta/realtime.d.mts +2 -0
- package/types/node_modules/openai/resources/beta/realtime.d.ts +2 -0
- package/types/node_modules/openai/resources/beta/threads/index.d.mts +4 -0
- package/types/node_modules/openai/resources/beta/threads/index.d.ts +4 -0
- package/types/node_modules/openai/resources/beta/threads/messages.d.mts +594 -0
- package/types/node_modules/openai/resources/beta/threads/messages.d.ts +594 -0
- package/types/node_modules/openai/resources/beta/threads/runs/index.d.mts +3 -0
- package/types/node_modules/openai/resources/beta/threads/runs/index.d.ts +3 -0
- package/types/node_modules/openai/resources/beta/threads/runs/runs.d.mts +733 -0
- package/types/node_modules/openai/resources/beta/threads/runs/runs.d.ts +733 -0
- package/types/node_modules/openai/resources/beta/threads/runs/steps.d.mts +615 -0
- package/types/node_modules/openai/resources/beta/threads/runs/steps.d.ts +615 -0
- package/types/node_modules/openai/resources/beta/threads/runs.d.mts +2 -0
- package/types/node_modules/openai/resources/beta/threads/runs.d.ts +2 -0
- package/types/node_modules/openai/resources/beta/threads/threads.d.mts +1044 -0
- package/types/node_modules/openai/resources/beta/threads/threads.d.ts +1044 -0
- package/types/node_modules/openai/resources/beta/threads.d.mts +2 -0
- package/types/node_modules/openai/resources/beta/threads.d.ts +2 -0
- package/types/node_modules/openai/resources/beta.d.mts +2 -0
- package/types/node_modules/openai/resources/beta.d.ts +2 -0
- package/types/node_modules/openai/resources/chat/chat.d.mts +13 -0
- package/types/node_modules/openai/resources/chat/chat.d.ts +13 -0
- package/types/node_modules/openai/resources/chat/completions/completions.d.mts +1627 -0
- package/types/node_modules/openai/resources/chat/completions/completions.d.ts +1627 -0
- package/types/node_modules/openai/resources/chat/completions/index.d.mts +4 -0
- package/types/node_modules/openai/resources/chat/completions/index.d.ts +4 -0
- package/types/node_modules/openai/resources/chat/completions/messages.d.mts +34 -0
- package/types/node_modules/openai/resources/chat/completions/messages.d.ts +34 -0
- package/types/node_modules/openai/resources/chat/completions.d.mts +2 -0
- package/types/node_modules/openai/resources/chat/completions.d.ts +2 -0
- package/types/node_modules/openai/resources/chat/index.d.mts +3 -0
- package/types/node_modules/openai/resources/chat/index.d.ts +3 -0
- package/types/node_modules/openai/resources/chat.d.mts +2 -0
- package/types/node_modules/openai/resources/chat.d.ts +2 -0
- package/types/node_modules/openai/resources/completions.d.mts +329 -0
- package/types/node_modules/openai/resources/completions.d.ts +329 -0
- package/types/node_modules/openai/resources/containers/containers.d.mts +200 -0
- package/types/node_modules/openai/resources/containers/containers.d.ts +200 -0
- package/types/node_modules/openai/resources/containers/files/content.d.mts +16 -0
- package/types/node_modules/openai/resources/containers/files/content.d.ts +16 -0
- package/types/node_modules/openai/resources/containers/files/files.d.mts +148 -0
- package/types/node_modules/openai/resources/containers/files/files.d.ts +148 -0
- package/types/node_modules/openai/resources/containers/files/index.d.mts +3 -0
- package/types/node_modules/openai/resources/containers/files/index.d.ts +3 -0
- package/types/node_modules/openai/resources/containers/files.d.mts +2 -0
- package/types/node_modules/openai/resources/containers/files.d.ts +2 -0
- package/types/node_modules/openai/resources/containers/index.d.mts +3 -0
- package/types/node_modules/openai/resources/containers/index.d.ts +3 -0
- package/types/node_modules/openai/resources/containers.d.mts +2 -0
- package/types/node_modules/openai/resources/containers.d.ts +2 -0
- package/types/node_modules/openai/resources/conversations/conversations.d.mts +176 -0
- package/types/node_modules/openai/resources/conversations/conversations.d.ts +176 -0
- package/types/node_modules/openai/resources/conversations/index.d.mts +3 -0
- package/types/node_modules/openai/resources/conversations/index.d.ts +3 -0
- package/types/node_modules/openai/resources/conversations/items.d.mts +367 -0
- package/types/node_modules/openai/resources/conversations/items.d.ts +367 -0
- package/types/node_modules/openai/resources/conversations.d.mts +2 -0
- package/types/node_modules/openai/resources/conversations.d.ts +2 -0
- package/types/node_modules/openai/resources/embeddings.d.mts +113 -0
- package/types/node_modules/openai/resources/embeddings.d.ts +113 -0
- package/types/node_modules/openai/resources/evals/evals.d.mts +735 -0
- package/types/node_modules/openai/resources/evals/evals.d.ts +735 -0
- package/types/node_modules/openai/resources/evals/index.d.mts +3 -0
- package/types/node_modules/openai/resources/evals/index.d.ts +3 -0
- package/types/node_modules/openai/resources/evals/runs/index.d.mts +3 -0
- package/types/node_modules/openai/resources/evals/runs/index.d.ts +3 -0
- package/types/node_modules/openai/resources/evals/runs/output-items.d.mts +382 -0
- package/types/node_modules/openai/resources/evals/runs/output-items.d.ts +382 -0
- package/types/node_modules/openai/resources/evals/runs/runs.d.mts +2290 -0
- package/types/node_modules/openai/resources/evals/runs/runs.d.ts +2290 -0
- package/types/node_modules/openai/resources/evals/runs.d.mts +2 -0
- package/types/node_modules/openai/resources/evals/runs.d.ts +2 -0
- package/types/node_modules/openai/resources/evals.d.mts +2 -0
- package/types/node_modules/openai/resources/evals.d.ts +2 -0
- package/types/node_modules/openai/resources/files.d.mts +164 -0
- package/types/node_modules/openai/resources/files.d.ts +164 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha/alpha.d.mts +10 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha/alpha.d.ts +10 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha/graders.d.mts +119 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha/graders.d.ts +119 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha/index.d.mts +3 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha/index.d.ts +3 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha.d.mts +2 -0
- package/types/node_modules/openai/resources/fine-tuning/alpha.d.ts +2 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.d.mts +10 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.d.ts +10 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints/index.d.mts +3 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints/index.d.ts +3 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints/permissions.d.mts +160 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints/permissions.d.ts +160 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints.d.mts +2 -0
- package/types/node_modules/openai/resources/fine-tuning/checkpoints.d.ts +2 -0
- package/types/node_modules/openai/resources/fine-tuning/fine-tuning.d.mts +22 -0
- package/types/node_modules/openai/resources/fine-tuning/fine-tuning.d.ts +22 -0
- package/types/node_modules/openai/resources/fine-tuning/index.d.mts +6 -0
- package/types/node_modules/openai/resources/fine-tuning/index.d.ts +6 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs/checkpoints.d.mts +74 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs/checkpoints.d.ts +74 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs/index.d.mts +3 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs/index.d.ts +3 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs/jobs.d.mts +528 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs/jobs.d.ts +528 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs.d.mts +2 -0
- package/types/node_modules/openai/resources/fine-tuning/jobs.d.ts +2 -0
- package/types/node_modules/openai/resources/fine-tuning/methods.d.mts +120 -0
- package/types/node_modules/openai/resources/fine-tuning/methods.d.ts +120 -0
- package/types/node_modules/openai/resources/fine-tuning.d.mts +2 -0
- package/types/node_modules/openai/resources/fine-tuning.d.ts +2 -0
- package/types/node_modules/openai/resources/graders/grader-models.d.mts +304 -0
- package/types/node_modules/openai/resources/graders/grader-models.d.ts +304 -0
- package/types/node_modules/openai/resources/graders/graders.d.mts +10 -0
- package/types/node_modules/openai/resources/graders/graders.d.ts +10 -0
- package/types/node_modules/openai/resources/graders/index.d.mts +3 -0
- package/types/node_modules/openai/resources/graders/index.d.ts +3 -0
- package/types/node_modules/openai/resources/graders.d.mts +2 -0
- package/types/node_modules/openai/resources/graders.d.ts +2 -0
- package/types/node_modules/openai/resources/images.d.mts +653 -0
- package/types/node_modules/openai/resources/images.d.ts +653 -0
- package/types/node_modules/openai/resources/index.d.mts +22 -0
- package/types/node_modules/openai/resources/index.d.ts +22 -0
- package/types/node_modules/openai/resources/models.d.mts +52 -0
- package/types/node_modules/openai/resources/models.d.ts +52 -0
- package/types/node_modules/openai/resources/moderations.d.mts +295 -0
- package/types/node_modules/openai/resources/moderations.d.ts +295 -0
- package/types/node_modules/openai/resources/realtime/client-secrets.d.mts +594 -0
- package/types/node_modules/openai/resources/realtime/client-secrets.d.ts +594 -0
- package/types/node_modules/openai/resources/realtime/index.d.mts +3 -0
- package/types/node_modules/openai/resources/realtime/index.d.ts +3 -0
- package/types/node_modules/openai/resources/realtime/realtime.d.mts +3828 -0
- package/types/node_modules/openai/resources/realtime/realtime.d.ts +3828 -0
- package/types/node_modules/openai/resources/realtime.d.mts +2 -0
- package/types/node_modules/openai/resources/realtime.d.ts +2 -0
- package/types/node_modules/openai/resources/responses/index.d.mts +3 -0
- package/types/node_modules/openai/resources/responses/index.d.ts +3 -0
- package/types/node_modules/openai/resources/responses/input-items.d.mts +65 -0
- package/types/node_modules/openai/resources/responses/input-items.d.ts +65 -0
- package/types/node_modules/openai/resources/responses/responses.d.mts +4705 -0
- package/types/node_modules/openai/resources/responses/responses.d.ts +4705 -0
- package/types/node_modules/openai/resources/responses.d.mts +2 -0
- package/types/node_modules/openai/resources/responses.d.ts +2 -0
- package/types/node_modules/openai/resources/shared.d.mts +265 -0
- package/types/node_modules/openai/resources/shared.d.ts +265 -0
- package/types/node_modules/openai/resources/uploads/index.d.mts +3 -0
- package/types/node_modules/openai/resources/uploads/index.d.ts +3 -0
- package/types/node_modules/openai/resources/uploads/parts.d.mts +51 -0
- package/types/node_modules/openai/resources/uploads/parts.d.ts +51 -0
- package/types/node_modules/openai/resources/uploads/uploads.d.mts +157 -0
- package/types/node_modules/openai/resources/uploads/uploads.d.ts +157 -0
- package/types/node_modules/openai/resources/uploads.d.mts +2 -0
- package/types/node_modules/openai/resources/uploads.d.ts +2 -0
- package/types/node_modules/openai/resources/vector-stores/file-batches.d.mts +172 -0
- package/types/node_modules/openai/resources/vector-stores/file-batches.d.ts +172 -0
- package/types/node_modules/openai/resources/vector-stores/files.d.mts +231 -0
- package/types/node_modules/openai/resources/vector-stores/files.d.ts +231 -0
- package/types/node_modules/openai/resources/vector-stores/index.d.mts +4 -0
- package/types/node_modules/openai/resources/vector-stores/index.d.ts +4 -0
- package/types/node_modules/openai/resources/vector-stores/vector-stores.d.mts +373 -0
- package/types/node_modules/openai/resources/vector-stores/vector-stores.d.ts +373 -0
- package/types/node_modules/openai/resources/vector-stores.d.mts +2 -0
- package/types/node_modules/openai/resources/vector-stores.d.ts +2 -0
- package/types/node_modules/openai/resources/webhooks.d.mts +587 -0
- package/types/node_modules/openai/resources/webhooks.d.ts +587 -0
- package/types/node_modules/openai/resources.d.mts +2 -0
- package/types/node_modules/openai/resources.d.ts +2 -0
- package/types/node_modules/openai/src/_vendor/zod-to-json-schema/LICENSE +15 -0
- package/types/node_modules/openai/streaming.d.mts +2 -0
- package/types/node_modules/openai/streaming.d.ts +2 -0
- package/types/node_modules/openai/uploads.d.mts +2 -0
- package/types/node_modules/openai/uploads.d.ts +2 -0
- package/types/node_modules/openai/version.d.mts +2 -0
- package/types/node_modules/openai/version.d.ts +2 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import OpenAI from "../index.js";
|
|
2
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
3
|
+
import { type ReadableStream } from "../internal/shim-types.js";
|
|
4
|
+
import { ParsedChatCompletion } from "../resources/chat/completions.js";
|
|
5
|
+
import { ChatCompletionTokenLogprob, type ChatCompletion, type ChatCompletionChunk, type ChatCompletionCreateParams, type ChatCompletionCreateParamsBase, type ChatCompletionRole } from "../resources/chat/completions/completions.js";
|
|
6
|
+
import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents } from "./AbstractChatCompletionRunner.js";
|
|
7
|
+
export interface ContentDeltaEvent {
|
|
8
|
+
delta: string;
|
|
9
|
+
snapshot: string;
|
|
10
|
+
parsed: unknown | null;
|
|
11
|
+
}
|
|
12
|
+
export interface ContentDoneEvent<ParsedT = null> {
|
|
13
|
+
content: string;
|
|
14
|
+
parsed: ParsedT | null;
|
|
15
|
+
}
|
|
16
|
+
export interface RefusalDeltaEvent {
|
|
17
|
+
delta: string;
|
|
18
|
+
snapshot: string;
|
|
19
|
+
}
|
|
20
|
+
export interface RefusalDoneEvent {
|
|
21
|
+
refusal: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FunctionToolCallArgumentsDeltaEvent {
|
|
24
|
+
name: string;
|
|
25
|
+
index: number;
|
|
26
|
+
arguments: string;
|
|
27
|
+
parsed_arguments: unknown;
|
|
28
|
+
arguments_delta: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FunctionToolCallArgumentsDoneEvent {
|
|
31
|
+
name: string;
|
|
32
|
+
index: number;
|
|
33
|
+
arguments: string;
|
|
34
|
+
parsed_arguments: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface LogProbsContentDeltaEvent {
|
|
37
|
+
content: Array<ChatCompletionTokenLogprob>;
|
|
38
|
+
snapshot: Array<ChatCompletionTokenLogprob>;
|
|
39
|
+
}
|
|
40
|
+
export interface LogProbsContentDoneEvent {
|
|
41
|
+
content: Array<ChatCompletionTokenLogprob>;
|
|
42
|
+
}
|
|
43
|
+
export interface LogProbsRefusalDeltaEvent {
|
|
44
|
+
refusal: Array<ChatCompletionTokenLogprob>;
|
|
45
|
+
snapshot: Array<ChatCompletionTokenLogprob>;
|
|
46
|
+
}
|
|
47
|
+
export interface LogProbsRefusalDoneEvent {
|
|
48
|
+
refusal: Array<ChatCompletionTokenLogprob>;
|
|
49
|
+
}
|
|
50
|
+
export interface ChatCompletionStreamEvents<ParsedT = null> extends AbstractChatCompletionRunnerEvents {
|
|
51
|
+
content: (contentDelta: string, contentSnapshot: string) => void;
|
|
52
|
+
chunk: (chunk: ChatCompletionChunk, snapshot: ChatCompletionSnapshot) => void;
|
|
53
|
+
'content.delta': (props: ContentDeltaEvent) => void;
|
|
54
|
+
'content.done': (props: ContentDoneEvent<ParsedT>) => void;
|
|
55
|
+
'refusal.delta': (props: RefusalDeltaEvent) => void;
|
|
56
|
+
'refusal.done': (props: RefusalDoneEvent) => void;
|
|
57
|
+
'tool_calls.function.arguments.delta': (props: FunctionToolCallArgumentsDeltaEvent) => void;
|
|
58
|
+
'tool_calls.function.arguments.done': (props: FunctionToolCallArgumentsDoneEvent) => void;
|
|
59
|
+
'logprobs.content.delta': (props: LogProbsContentDeltaEvent) => void;
|
|
60
|
+
'logprobs.content.done': (props: LogProbsContentDoneEvent) => void;
|
|
61
|
+
'logprobs.refusal.delta': (props: LogProbsRefusalDeltaEvent) => void;
|
|
62
|
+
'logprobs.refusal.done': (props: LogProbsRefusalDoneEvent) => void;
|
|
63
|
+
}
|
|
64
|
+
export type ChatCompletionStreamParams = Omit<ChatCompletionCreateParamsBase, 'stream'> & {
|
|
65
|
+
stream?: true;
|
|
66
|
+
};
|
|
67
|
+
export declare class ChatCompletionStream<ParsedT = null> extends AbstractChatCompletionRunner<ChatCompletionStreamEvents<ParsedT>, ParsedT> implements AsyncIterable<ChatCompletionChunk> {
|
|
68
|
+
#private;
|
|
69
|
+
constructor(params: ChatCompletionCreateParams | null);
|
|
70
|
+
get currentChatCompletionSnapshot(): ChatCompletionSnapshot | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Intended for use on the frontend, consuming a stream produced with
|
|
73
|
+
* `.toReadableStream()` on the backend.
|
|
74
|
+
*
|
|
75
|
+
* Note that messages sent to the model do not appear in `.on('message')`
|
|
76
|
+
* in this context.
|
|
77
|
+
*/
|
|
78
|
+
static fromReadableStream(stream: ReadableStream): ChatCompletionStream<null>;
|
|
79
|
+
static createChatCompletion<ParsedT>(client: OpenAI, params: ChatCompletionStreamParams, options?: RequestOptions): ChatCompletionStream<ParsedT>;
|
|
80
|
+
protected _createChatCompletion(client: OpenAI, params: ChatCompletionCreateParams, options?: RequestOptions): Promise<ParsedChatCompletion<ParsedT>>;
|
|
81
|
+
protected _fromReadableStream(readableStream: ReadableStream, options?: RequestOptions): Promise<ChatCompletion>;
|
|
82
|
+
[Symbol.asyncIterator](this: ChatCompletionStream<ParsedT>): AsyncIterator<ChatCompletionChunk>;
|
|
83
|
+
toReadableStream(): ReadableStream;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Represents a streamed chunk of a chat completion response returned by model,
|
|
87
|
+
* based on the provided input.
|
|
88
|
+
*/
|
|
89
|
+
export interface ChatCompletionSnapshot {
|
|
90
|
+
/**
|
|
91
|
+
* A unique identifier for the chat completion.
|
|
92
|
+
*/
|
|
93
|
+
id: string;
|
|
94
|
+
/**
|
|
95
|
+
* A list of chat completion choices. Can be more than one if `n` is greater
|
|
96
|
+
* than 1.
|
|
97
|
+
*/
|
|
98
|
+
choices: Array<ChatCompletionSnapshot.Choice>;
|
|
99
|
+
/**
|
|
100
|
+
* The Unix timestamp (in seconds) of when the chat completion was created.
|
|
101
|
+
*/
|
|
102
|
+
created: number;
|
|
103
|
+
/**
|
|
104
|
+
* The model to generate the completion.
|
|
105
|
+
*/
|
|
106
|
+
model: string;
|
|
107
|
+
/**
|
|
108
|
+
* This fingerprint represents the backend configuration that the model runs with.
|
|
109
|
+
*
|
|
110
|
+
* Can be used in conjunction with the `seed` request parameter to understand when
|
|
111
|
+
* backend changes have been made that might impact determinism.
|
|
112
|
+
*/
|
|
113
|
+
system_fingerprint?: string;
|
|
114
|
+
}
|
|
115
|
+
export declare namespace ChatCompletionSnapshot {
|
|
116
|
+
interface Choice {
|
|
117
|
+
/**
|
|
118
|
+
* A chat completion delta generated by streamed model responses.
|
|
119
|
+
*/
|
|
120
|
+
message: Choice.Message;
|
|
121
|
+
/**
|
|
122
|
+
* The reason the model stopped generating tokens. This will be `stop` if the model
|
|
123
|
+
* hit a natural stop point or a provided stop sequence, `length` if the maximum
|
|
124
|
+
* number of tokens specified in the request was reached, `content_filter` if
|
|
125
|
+
* content was omitted due to a flag from our content filters, or `function_call`
|
|
126
|
+
* if the model called a function.
|
|
127
|
+
*/
|
|
128
|
+
finish_reason: ChatCompletion.Choice['finish_reason'] | null;
|
|
129
|
+
/**
|
|
130
|
+
* Log probability information for the choice.
|
|
131
|
+
*/
|
|
132
|
+
logprobs: ChatCompletion.Choice.Logprobs | null;
|
|
133
|
+
/**
|
|
134
|
+
* The index of the choice in the list of choices.
|
|
135
|
+
*/
|
|
136
|
+
index: number;
|
|
137
|
+
}
|
|
138
|
+
namespace Choice {
|
|
139
|
+
/**
|
|
140
|
+
* A chat completion delta generated by streamed model responses.
|
|
141
|
+
*/
|
|
142
|
+
interface Message {
|
|
143
|
+
/**
|
|
144
|
+
* The contents of the chunk message.
|
|
145
|
+
*/
|
|
146
|
+
content?: string | null;
|
|
147
|
+
refusal?: string | null;
|
|
148
|
+
parsed?: unknown | null;
|
|
149
|
+
/**
|
|
150
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
151
|
+
* model.
|
|
152
|
+
*/
|
|
153
|
+
function_call?: Message.FunctionCall;
|
|
154
|
+
tool_calls?: Array<Message.ToolCall>;
|
|
155
|
+
/**
|
|
156
|
+
* The role of the author of this message.
|
|
157
|
+
*/
|
|
158
|
+
role?: ChatCompletionRole;
|
|
159
|
+
}
|
|
160
|
+
namespace Message {
|
|
161
|
+
interface ToolCall {
|
|
162
|
+
/**
|
|
163
|
+
* The ID of the tool call.
|
|
164
|
+
*/
|
|
165
|
+
id: string;
|
|
166
|
+
function: ToolCall.Function;
|
|
167
|
+
/**
|
|
168
|
+
* The type of the tool.
|
|
169
|
+
*/
|
|
170
|
+
type: 'function';
|
|
171
|
+
}
|
|
172
|
+
namespace ToolCall {
|
|
173
|
+
interface Function {
|
|
174
|
+
/**
|
|
175
|
+
* The arguments to call the function with, as generated by the model in JSON
|
|
176
|
+
* format. Note that the model does not always generate valid JSON, and may
|
|
177
|
+
* hallucinate parameters not defined by your function schema. Validate the
|
|
178
|
+
* arguments in your code before calling your function.
|
|
179
|
+
*/
|
|
180
|
+
arguments: string;
|
|
181
|
+
parsed_arguments?: unknown;
|
|
182
|
+
/**
|
|
183
|
+
* The name of the function to call.
|
|
184
|
+
*/
|
|
185
|
+
name: string;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The name and arguments of a function that should be called, as generated by the
|
|
190
|
+
* model.
|
|
191
|
+
*/
|
|
192
|
+
interface FunctionCall {
|
|
193
|
+
/**
|
|
194
|
+
* The arguments to call the function with, as generated by the model in JSON
|
|
195
|
+
* format. Note that the model does not always generate valid JSON, and may
|
|
196
|
+
* hallucinate parameters not defined by your function schema. Validate the
|
|
197
|
+
* arguments in your code before calling your function.
|
|
198
|
+
*/
|
|
199
|
+
arguments?: string;
|
|
200
|
+
/**
|
|
201
|
+
* The name of the function to call.
|
|
202
|
+
*/
|
|
203
|
+
name?: string;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=ChatCompletionStream.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ChatCompletionChunk, type ChatCompletionCreateParamsStreaming } from "../resources/chat/completions.mjs";
|
|
2
|
+
import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from "./AbstractChatCompletionRunner.mjs";
|
|
3
|
+
import { type ReadableStream } from "../internal/shim-types.mjs";
|
|
4
|
+
import { RunnableTools, type BaseFunctionsArgs } from "./RunnableFunction.mjs";
|
|
5
|
+
import { ChatCompletionSnapshot, ChatCompletionStream } from "./ChatCompletionStream.mjs";
|
|
6
|
+
import OpenAI from "../index.mjs";
|
|
7
|
+
import { AutoParseableTool } from "../lib/parser.mjs";
|
|
8
|
+
export interface ChatCompletionStreamEvents extends AbstractChatCompletionRunnerEvents {
|
|
9
|
+
content: (contentDelta: string, contentSnapshot: string) => void;
|
|
10
|
+
chunk: (chunk: ChatCompletionChunk, snapshot: ChatCompletionSnapshot) => void;
|
|
11
|
+
}
|
|
12
|
+
export type ChatCompletionStreamingToolRunnerParams<FunctionsArgs extends BaseFunctionsArgs> = Omit<ChatCompletionCreateParamsStreaming, 'tools'> & {
|
|
13
|
+
tools: RunnableTools<FunctionsArgs> | AutoParseableTool<any, true>[];
|
|
14
|
+
};
|
|
15
|
+
export declare class ChatCompletionStreamingRunner<ParsedT = null> extends ChatCompletionStream<ParsedT> implements AsyncIterable<ChatCompletionChunk> {
|
|
16
|
+
static fromReadableStream(stream: ReadableStream): ChatCompletionStreamingRunner<null>;
|
|
17
|
+
static runTools<T extends (string | object)[], ParsedT = null>(client: OpenAI, params: ChatCompletionStreamingToolRunnerParams<T>, options?: RunnerOptions): ChatCompletionStreamingRunner<ParsedT>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ChatCompletionStreamingRunner.d.mts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ChatCompletionChunk, type ChatCompletionCreateParamsStreaming } from "../resources/chat/completions.js";
|
|
2
|
+
import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from "./AbstractChatCompletionRunner.js";
|
|
3
|
+
import { type ReadableStream } from "../internal/shim-types.js";
|
|
4
|
+
import { RunnableTools, type BaseFunctionsArgs } from "./RunnableFunction.js";
|
|
5
|
+
import { ChatCompletionSnapshot, ChatCompletionStream } from "./ChatCompletionStream.js";
|
|
6
|
+
import OpenAI from "../index.js";
|
|
7
|
+
import { AutoParseableTool } from "../lib/parser.js";
|
|
8
|
+
export interface ChatCompletionStreamEvents extends AbstractChatCompletionRunnerEvents {
|
|
9
|
+
content: (contentDelta: string, contentSnapshot: string) => void;
|
|
10
|
+
chunk: (chunk: ChatCompletionChunk, snapshot: ChatCompletionSnapshot) => void;
|
|
11
|
+
}
|
|
12
|
+
export type ChatCompletionStreamingToolRunnerParams<FunctionsArgs extends BaseFunctionsArgs> = Omit<ChatCompletionCreateParamsStreaming, 'tools'> & {
|
|
13
|
+
tools: RunnableTools<FunctionsArgs> | AutoParseableTool<any, true>[];
|
|
14
|
+
};
|
|
15
|
+
export declare class ChatCompletionStreamingRunner<ParsedT = null> extends ChatCompletionStream<ParsedT> implements AsyncIterable<ChatCompletionChunk> {
|
|
16
|
+
static fromReadableStream(stream: ReadableStream): ChatCompletionStreamingRunner<null>;
|
|
17
|
+
static runTools<T extends (string | object)[], ParsedT = null>(client: OpenAI, params: ChatCompletionStreamingToolRunnerParams<T>, options?: RunnerOptions): ChatCompletionStreamingRunner<ParsedT>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ChatCompletionStreamingRunner.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type EventListener<Events, EventType extends keyof Events> = Events[EventType];
|
|
2
|
+
export type EventParameters<Events, EventType extends keyof Events> = {
|
|
3
|
+
[Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any ? P : never;
|
|
4
|
+
}[EventType];
|
|
5
|
+
export declare class EventEmitter<EventTypes extends Record<string, (...args: any) => any>> {
|
|
6
|
+
#private;
|
|
7
|
+
/**
|
|
8
|
+
* Adds the listener function to the end of the listeners array for the event.
|
|
9
|
+
* No checks are made to see if the listener has already been added. Multiple calls passing
|
|
10
|
+
* the same combination of event and listener will result in the listener being added, and
|
|
11
|
+
* called, multiple times.
|
|
12
|
+
* @returns this, so that calls can be chained
|
|
13
|
+
*/
|
|
14
|
+
on<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
15
|
+
/**
|
|
16
|
+
* Removes the specified listener from the listener array for the event.
|
|
17
|
+
* off() will remove, at most, one instance of a listener from the listener array. If any single
|
|
18
|
+
* listener has been added multiple times to the listener array for the specified event, then
|
|
19
|
+
* off() must be called multiple times to remove each instance.
|
|
20
|
+
* @returns this, so that calls can be chained
|
|
21
|
+
*/
|
|
22
|
+
off<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
23
|
+
/**
|
|
24
|
+
* Adds a one-time listener function for the event. The next time the event is triggered,
|
|
25
|
+
* this listener is removed and then invoked.
|
|
26
|
+
* @returns this, so that calls can be chained
|
|
27
|
+
*/
|
|
28
|
+
once<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
29
|
+
/**
|
|
30
|
+
* This is similar to `.once()`, but returns a Promise that resolves the next time
|
|
31
|
+
* the event is triggered, instead of calling a listener callback.
|
|
32
|
+
* @returns a Promise that resolves the next time given event is triggered,
|
|
33
|
+
* or rejects if an error is emitted. (If you request the 'error' event,
|
|
34
|
+
* returns a promise that resolves with the error).
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
*
|
|
38
|
+
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
39
|
+
*/
|
|
40
|
+
emitted<Event extends keyof EventTypes>(event: Event): Promise<EventParameters<EventTypes, Event> extends [infer Param] ? Param : EventParameters<EventTypes, Event> extends [] ? void : EventParameters<EventTypes, Event>>;
|
|
41
|
+
protected _emit<Event extends keyof EventTypes>(this: EventEmitter<EventTypes>, event: Event, ...args: EventParameters<EventTypes, Event>): void;
|
|
42
|
+
protected _hasListener(event: keyof EventTypes): boolean;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=EventEmitter.d.mts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type EventListener<Events, EventType extends keyof Events> = Events[EventType];
|
|
2
|
+
export type EventParameters<Events, EventType extends keyof Events> = {
|
|
3
|
+
[Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any ? P : never;
|
|
4
|
+
}[EventType];
|
|
5
|
+
export declare class EventEmitter<EventTypes extends Record<string, (...args: any) => any>> {
|
|
6
|
+
#private;
|
|
7
|
+
/**
|
|
8
|
+
* Adds the listener function to the end of the listeners array for the event.
|
|
9
|
+
* No checks are made to see if the listener has already been added. Multiple calls passing
|
|
10
|
+
* the same combination of event and listener will result in the listener being added, and
|
|
11
|
+
* called, multiple times.
|
|
12
|
+
* @returns this, so that calls can be chained
|
|
13
|
+
*/
|
|
14
|
+
on<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
15
|
+
/**
|
|
16
|
+
* Removes the specified listener from the listener array for the event.
|
|
17
|
+
* off() will remove, at most, one instance of a listener from the listener array. If any single
|
|
18
|
+
* listener has been added multiple times to the listener array for the specified event, then
|
|
19
|
+
* off() must be called multiple times to remove each instance.
|
|
20
|
+
* @returns this, so that calls can be chained
|
|
21
|
+
*/
|
|
22
|
+
off<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
23
|
+
/**
|
|
24
|
+
* Adds a one-time listener function for the event. The next time the event is triggered,
|
|
25
|
+
* this listener is removed and then invoked.
|
|
26
|
+
* @returns this, so that calls can be chained
|
|
27
|
+
*/
|
|
28
|
+
once<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
29
|
+
/**
|
|
30
|
+
* This is similar to `.once()`, but returns a Promise that resolves the next time
|
|
31
|
+
* the event is triggered, instead of calling a listener callback.
|
|
32
|
+
* @returns a Promise that resolves the next time given event is triggered,
|
|
33
|
+
* or rejects if an error is emitted. (If you request the 'error' event,
|
|
34
|
+
* returns a promise that resolves with the error).
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
*
|
|
38
|
+
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
39
|
+
*/
|
|
40
|
+
emitted<Event extends keyof EventTypes>(event: Event): Promise<EventParameters<EventTypes, Event> extends [infer Param] ? Param : EventParameters<EventTypes, Event> extends [] ? void : EventParameters<EventTypes, Event>>;
|
|
41
|
+
protected _emit<Event extends keyof EventTypes>(this: EventEmitter<EventTypes>, event: Event, ...args: EventParameters<EventTypes, Event>): void;
|
|
42
|
+
protected _hasListener(event: keyof EventTypes): boolean;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=EventEmitter.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { APIUserAbortError, OpenAIError } from "../error.mjs";
|
|
2
|
+
export declare class EventStream<EventTypes extends BaseEvents> {
|
|
3
|
+
#private;
|
|
4
|
+
controller: AbortController;
|
|
5
|
+
constructor();
|
|
6
|
+
protected _run(this: EventStream<EventTypes>, executor: () => Promise<any>): void;
|
|
7
|
+
protected _connected(this: EventStream<EventTypes>): void;
|
|
8
|
+
get ended(): boolean;
|
|
9
|
+
get errored(): boolean;
|
|
10
|
+
get aborted(): boolean;
|
|
11
|
+
abort(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Adds the listener function to the end of the listeners array for the event.
|
|
14
|
+
* No checks are made to see if the listener has already been added. Multiple calls passing
|
|
15
|
+
* the same combination of event and listener will result in the listener being added, and
|
|
16
|
+
* called, multiple times.
|
|
17
|
+
* @returns this ChatCompletionStream, so that calls can be chained
|
|
18
|
+
*/
|
|
19
|
+
on<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
20
|
+
/**
|
|
21
|
+
* Removes the specified listener from the listener array for the event.
|
|
22
|
+
* off() will remove, at most, one instance of a listener from the listener array. If any single
|
|
23
|
+
* listener has been added multiple times to the listener array for the specified event, then
|
|
24
|
+
* off() must be called multiple times to remove each instance.
|
|
25
|
+
* @returns this ChatCompletionStream, so that calls can be chained
|
|
26
|
+
*/
|
|
27
|
+
off<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
28
|
+
/**
|
|
29
|
+
* Adds a one-time listener function for the event. The next time the event is triggered,
|
|
30
|
+
* this listener is removed and then invoked.
|
|
31
|
+
* @returns this ChatCompletionStream, so that calls can be chained
|
|
32
|
+
*/
|
|
33
|
+
once<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
34
|
+
/**
|
|
35
|
+
* This is similar to `.once()`, but returns a Promise that resolves the next time
|
|
36
|
+
* the event is triggered, instead of calling a listener callback.
|
|
37
|
+
* @returns a Promise that resolves the next time given event is triggered,
|
|
38
|
+
* or rejects if an error is emitted. (If you request the 'error' event,
|
|
39
|
+
* returns a promise that resolves with the error).
|
|
40
|
+
*
|
|
41
|
+
* Example:
|
|
42
|
+
*
|
|
43
|
+
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
44
|
+
*/
|
|
45
|
+
emitted<Event extends keyof EventTypes>(event: Event): Promise<EventParameters<EventTypes, Event> extends [infer Param] ? Param : EventParameters<EventTypes, Event> extends [] ? void : EventParameters<EventTypes, Event>>;
|
|
46
|
+
done(): Promise<void>;
|
|
47
|
+
_emit<Event extends keyof BaseEvents>(event: Event, ...args: EventParameters<BaseEvents, Event>): void;
|
|
48
|
+
_emit<Event extends keyof EventTypes>(event: Event, ...args: EventParameters<EventTypes, Event>): void;
|
|
49
|
+
protected _emitFinal(): void;
|
|
50
|
+
}
|
|
51
|
+
type EventListener<Events, EventType extends keyof Events> = Events[EventType];
|
|
52
|
+
export type EventParameters<Events, EventType extends keyof Events> = {
|
|
53
|
+
[Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any ? P : never;
|
|
54
|
+
}[EventType];
|
|
55
|
+
export interface BaseEvents {
|
|
56
|
+
connect: () => void;
|
|
57
|
+
error: (error: OpenAIError) => void;
|
|
58
|
+
abort: (error: APIUserAbortError) => void;
|
|
59
|
+
end: () => void;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=EventStream.d.mts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { APIUserAbortError, OpenAIError } from "../error.js";
|
|
2
|
+
export declare class EventStream<EventTypes extends BaseEvents> {
|
|
3
|
+
#private;
|
|
4
|
+
controller: AbortController;
|
|
5
|
+
constructor();
|
|
6
|
+
protected _run(this: EventStream<EventTypes>, executor: () => Promise<any>): void;
|
|
7
|
+
protected _connected(this: EventStream<EventTypes>): void;
|
|
8
|
+
get ended(): boolean;
|
|
9
|
+
get errored(): boolean;
|
|
10
|
+
get aborted(): boolean;
|
|
11
|
+
abort(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Adds the listener function to the end of the listeners array for the event.
|
|
14
|
+
* No checks are made to see if the listener has already been added. Multiple calls passing
|
|
15
|
+
* the same combination of event and listener will result in the listener being added, and
|
|
16
|
+
* called, multiple times.
|
|
17
|
+
* @returns this ChatCompletionStream, so that calls can be chained
|
|
18
|
+
*/
|
|
19
|
+
on<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
20
|
+
/**
|
|
21
|
+
* Removes the specified listener from the listener array for the event.
|
|
22
|
+
* off() will remove, at most, one instance of a listener from the listener array. If any single
|
|
23
|
+
* listener has been added multiple times to the listener array for the specified event, then
|
|
24
|
+
* off() must be called multiple times to remove each instance.
|
|
25
|
+
* @returns this ChatCompletionStream, so that calls can be chained
|
|
26
|
+
*/
|
|
27
|
+
off<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
28
|
+
/**
|
|
29
|
+
* Adds a one-time listener function for the event. The next time the event is triggered,
|
|
30
|
+
* this listener is removed and then invoked.
|
|
31
|
+
* @returns this ChatCompletionStream, so that calls can be chained
|
|
32
|
+
*/
|
|
33
|
+
once<Event extends keyof EventTypes>(event: Event, listener: EventListener<EventTypes, Event>): this;
|
|
34
|
+
/**
|
|
35
|
+
* This is similar to `.once()`, but returns a Promise that resolves the next time
|
|
36
|
+
* the event is triggered, instead of calling a listener callback.
|
|
37
|
+
* @returns a Promise that resolves the next time given event is triggered,
|
|
38
|
+
* or rejects if an error is emitted. (If you request the 'error' event,
|
|
39
|
+
* returns a promise that resolves with the error).
|
|
40
|
+
*
|
|
41
|
+
* Example:
|
|
42
|
+
*
|
|
43
|
+
* const message = await stream.emitted('message') // rejects if the stream errors
|
|
44
|
+
*/
|
|
45
|
+
emitted<Event extends keyof EventTypes>(event: Event): Promise<EventParameters<EventTypes, Event> extends [infer Param] ? Param : EventParameters<EventTypes, Event> extends [] ? void : EventParameters<EventTypes, Event>>;
|
|
46
|
+
done(): Promise<void>;
|
|
47
|
+
_emit<Event extends keyof BaseEvents>(event: Event, ...args: EventParameters<BaseEvents, Event>): void;
|
|
48
|
+
_emit<Event extends keyof EventTypes>(event: Event, ...args: EventParameters<EventTypes, Event>): void;
|
|
49
|
+
protected _emitFinal(): void;
|
|
50
|
+
}
|
|
51
|
+
type EventListener<Events, EventType extends keyof Events> = Events[EventType];
|
|
52
|
+
export type EventParameters<Events, EventType extends keyof Events> = {
|
|
53
|
+
[Event in EventType]: EventListener<Events, EventType> extends (...args: infer P) => any ? P : never;
|
|
54
|
+
}[EventType];
|
|
55
|
+
export interface BaseEvents {
|
|
56
|
+
connect: () => void;
|
|
57
|
+
error: (error: OpenAIError) => void;
|
|
58
|
+
abort: (error: APIUserAbortError) => void;
|
|
59
|
+
end: () => void;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=EventStream.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ChatCompletionTool } from "../resources/chat/completions.mjs";
|
|
2
|
+
import { ResponseTextConfig, type FunctionTool, type ParsedResponse, type Response, type ResponseCreateParamsBase, type ResponseCreateParamsNonStreaming, type ResponseFunctionToolCall, type Tool } from "../resources/responses/responses.mjs";
|
|
3
|
+
import { type AutoParseableTextFormat } from "../lib/parser.mjs";
|
|
4
|
+
export type ParseableToolsParams = Array<Tool> | ChatCompletionTool | null;
|
|
5
|
+
export type ResponseCreateParamsWithTools = ResponseCreateParamsBase & {
|
|
6
|
+
tools?: ParseableToolsParams;
|
|
7
|
+
};
|
|
8
|
+
type TextConfigParams = {
|
|
9
|
+
text?: ResponseTextConfig;
|
|
10
|
+
};
|
|
11
|
+
export type ExtractParsedContentFromParams<Params extends TextConfigParams> = NonNullable<Params['text']>['format'] extends AutoParseableTextFormat<infer P> ? P : null;
|
|
12
|
+
export declare function maybeParseResponse<Params extends ResponseCreateParamsBase | null, ParsedT = Params extends null ? null : ExtractParsedContentFromParams<NonNullable<Params>>>(response: Response, params: Params): ParsedResponse<ParsedT>;
|
|
13
|
+
export declare function parseResponse<Params extends ResponseCreateParamsBase, ParsedT = ExtractParsedContentFromParams<Params>>(response: Response, params: Params): ParsedResponse<ParsedT>;
|
|
14
|
+
export declare function hasAutoParseableInput(params: ResponseCreateParamsWithTools): boolean;
|
|
15
|
+
type ToolOptions = {
|
|
16
|
+
name: string;
|
|
17
|
+
arguments: any;
|
|
18
|
+
function?: ((args: any) => any) | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type AutoParseableResponseTool<OptionsT extends ToolOptions, HasFunction = OptionsT['function'] extends Function ? true : false> = FunctionTool & {
|
|
21
|
+
__arguments: OptionsT['arguments'];
|
|
22
|
+
__name: OptionsT['name'];
|
|
23
|
+
$brand: 'auto-parseable-tool';
|
|
24
|
+
$callback: ((args: OptionsT['arguments']) => any) | undefined;
|
|
25
|
+
$parseRaw(args: string): OptionsT['arguments'];
|
|
26
|
+
};
|
|
27
|
+
export declare function makeParseableResponseTool<OptionsT extends ToolOptions>(tool: FunctionTool, { parser, callback, }: {
|
|
28
|
+
parser: (content: string) => OptionsT['arguments'];
|
|
29
|
+
callback: ((args: any) => any) | undefined;
|
|
30
|
+
}): AutoParseableResponseTool<OptionsT['arguments']>;
|
|
31
|
+
export declare function isAutoParsableTool(tool: any): tool is AutoParseableResponseTool<any>;
|
|
32
|
+
export declare function shouldParseToolCall(params: ResponseCreateParamsNonStreaming | null | undefined, toolCall: ResponseFunctionToolCall): boolean;
|
|
33
|
+
export declare function validateInputTools(tools: ChatCompletionTool[] | undefined): void;
|
|
34
|
+
export declare function addOutputText(rsp: Response): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=ResponsesParser.d.mts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ChatCompletionTool } from "../resources/chat/completions.js";
|
|
2
|
+
import { ResponseTextConfig, type FunctionTool, type ParsedResponse, type Response, type ResponseCreateParamsBase, type ResponseCreateParamsNonStreaming, type ResponseFunctionToolCall, type Tool } from "../resources/responses/responses.js";
|
|
3
|
+
import { type AutoParseableTextFormat } from "../lib/parser.js";
|
|
4
|
+
export type ParseableToolsParams = Array<Tool> | ChatCompletionTool | null;
|
|
5
|
+
export type ResponseCreateParamsWithTools = ResponseCreateParamsBase & {
|
|
6
|
+
tools?: ParseableToolsParams;
|
|
7
|
+
};
|
|
8
|
+
type TextConfigParams = {
|
|
9
|
+
text?: ResponseTextConfig;
|
|
10
|
+
};
|
|
11
|
+
export type ExtractParsedContentFromParams<Params extends TextConfigParams> = NonNullable<Params['text']>['format'] extends AutoParseableTextFormat<infer P> ? P : null;
|
|
12
|
+
export declare function maybeParseResponse<Params extends ResponseCreateParamsBase | null, ParsedT = Params extends null ? null : ExtractParsedContentFromParams<NonNullable<Params>>>(response: Response, params: Params): ParsedResponse<ParsedT>;
|
|
13
|
+
export declare function parseResponse<Params extends ResponseCreateParamsBase, ParsedT = ExtractParsedContentFromParams<Params>>(response: Response, params: Params): ParsedResponse<ParsedT>;
|
|
14
|
+
export declare function hasAutoParseableInput(params: ResponseCreateParamsWithTools): boolean;
|
|
15
|
+
type ToolOptions = {
|
|
16
|
+
name: string;
|
|
17
|
+
arguments: any;
|
|
18
|
+
function?: ((args: any) => any) | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type AutoParseableResponseTool<OptionsT extends ToolOptions, HasFunction = OptionsT['function'] extends Function ? true : false> = FunctionTool & {
|
|
21
|
+
__arguments: OptionsT['arguments'];
|
|
22
|
+
__name: OptionsT['name'];
|
|
23
|
+
$brand: 'auto-parseable-tool';
|
|
24
|
+
$callback: ((args: OptionsT['arguments']) => any) | undefined;
|
|
25
|
+
$parseRaw(args: string): OptionsT['arguments'];
|
|
26
|
+
};
|
|
27
|
+
export declare function makeParseableResponseTool<OptionsT extends ToolOptions>(tool: FunctionTool, { parser, callback, }: {
|
|
28
|
+
parser: (content: string) => OptionsT['arguments'];
|
|
29
|
+
callback: ((args: any) => any) | undefined;
|
|
30
|
+
}): AutoParseableResponseTool<OptionsT['arguments']>;
|
|
31
|
+
export declare function isAutoParsableTool(tool: any): tool is AutoParseableResponseTool<any>;
|
|
32
|
+
export declare function shouldParseToolCall(params: ResponseCreateParamsNonStreaming | null | undefined, toolCall: ResponseFunctionToolCall): boolean;
|
|
33
|
+
export declare function validateInputTools(tools: ChatCompletionTool[] | undefined): void;
|
|
34
|
+
export declare function addOutputText(rsp: Response): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=ResponsesParser.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type ChatCompletionRunner } from "./ChatCompletionRunner.mjs";
|
|
2
|
+
import { type ChatCompletionStreamingRunner } from "./ChatCompletionStreamingRunner.mjs";
|
|
3
|
+
import { JSONSchema } from "./jsonschema.mjs";
|
|
4
|
+
type PromiseOrValue<T> = T | Promise<T>;
|
|
5
|
+
export type RunnableFunctionWithParse<Args extends object> = {
|
|
6
|
+
/**
|
|
7
|
+
* @param args the return value from `parse`.
|
|
8
|
+
* @param runner the runner evaluating this callback.
|
|
9
|
+
* @returns a string to send back to OpenAI.
|
|
10
|
+
*/
|
|
11
|
+
function: (args: Args, runner: ChatCompletionRunner<unknown> | ChatCompletionStreamingRunner<unknown>) => PromiseOrValue<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* @param input the raw args from the OpenAI function call.
|
|
14
|
+
* @returns the parsed arguments to pass to `function`
|
|
15
|
+
*/
|
|
16
|
+
parse: (input: string) => PromiseOrValue<Args>;
|
|
17
|
+
/**
|
|
18
|
+
* The parameters the function accepts, describes as a JSON Schema object.
|
|
19
|
+
*/
|
|
20
|
+
parameters: JSONSchema;
|
|
21
|
+
/**
|
|
22
|
+
* A description of what the function does, used by the model to choose when and how to call the function.
|
|
23
|
+
*/
|
|
24
|
+
description: string;
|
|
25
|
+
/**
|
|
26
|
+
* The name of the function to be called. Will default to function.name if omitted.
|
|
27
|
+
*/
|
|
28
|
+
name?: string | undefined;
|
|
29
|
+
strict?: boolean | undefined;
|
|
30
|
+
};
|
|
31
|
+
export type RunnableFunctionWithoutParse = {
|
|
32
|
+
/**
|
|
33
|
+
* @param args the raw args from the OpenAI function call.
|
|
34
|
+
* @returns a string to send back to OpenAI
|
|
35
|
+
*/
|
|
36
|
+
function: (args: string, runner: ChatCompletionRunner<unknown> | ChatCompletionStreamingRunner<unknown>) => PromiseOrValue<unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* The parameters the function accepts, describes as a JSON Schema object.
|
|
39
|
+
*/
|
|
40
|
+
parameters: JSONSchema;
|
|
41
|
+
/**
|
|
42
|
+
* A description of what the function does, used by the model to choose when and how to call the function.
|
|
43
|
+
*/
|
|
44
|
+
description: string;
|
|
45
|
+
/**
|
|
46
|
+
* The name of the function to be called. Will default to function.name if omitted.
|
|
47
|
+
*/
|
|
48
|
+
name?: string | undefined;
|
|
49
|
+
strict?: boolean | undefined;
|
|
50
|
+
};
|
|
51
|
+
export type RunnableFunction<Args extends object | string> = Args extends string ? RunnableFunctionWithoutParse : Args extends object ? RunnableFunctionWithParse<Args> : never;
|
|
52
|
+
export type RunnableToolFunction<Args extends object | string> = Args extends string ? RunnableToolFunctionWithoutParse : Args extends object ? RunnableToolFunctionWithParse<Args> : never;
|
|
53
|
+
export type RunnableToolFunctionWithoutParse = {
|
|
54
|
+
type: 'function';
|
|
55
|
+
function: RunnableFunctionWithoutParse;
|
|
56
|
+
};
|
|
57
|
+
export type RunnableToolFunctionWithParse<Args extends object> = {
|
|
58
|
+
type: 'function';
|
|
59
|
+
function: RunnableFunctionWithParse<Args>;
|
|
60
|
+
};
|
|
61
|
+
export declare function isRunnableFunctionWithParse<Args extends object>(fn: any): fn is RunnableFunctionWithParse<Args>;
|
|
62
|
+
export type BaseFunctionsArgs = readonly (object | string)[];
|
|
63
|
+
export type RunnableFunctions<FunctionsArgs extends BaseFunctionsArgs> = [
|
|
64
|
+
any[]
|
|
65
|
+
] extends [FunctionsArgs] ? readonly RunnableFunction<any>[] : {
|
|
66
|
+
[Index in keyof FunctionsArgs]: Index extends number ? RunnableFunction<FunctionsArgs[Index]> : FunctionsArgs[Index];
|
|
67
|
+
};
|
|
68
|
+
export type RunnableTools<FunctionsArgs extends BaseFunctionsArgs> = [
|
|
69
|
+
any[]
|
|
70
|
+
] extends [FunctionsArgs] ? readonly RunnableToolFunction<any>[] : {
|
|
71
|
+
[Index in keyof FunctionsArgs]: Index extends number ? RunnableToolFunction<FunctionsArgs[Index]> : FunctionsArgs[Index];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* This is helper class for passing a `function` and `parse` where the `function`
|
|
75
|
+
* argument type matches the `parse` return type.
|
|
76
|
+
*/
|
|
77
|
+
export declare class ParsingToolFunction<Args extends object> {
|
|
78
|
+
type: 'function';
|
|
79
|
+
function: RunnableFunctionWithParse<Args>;
|
|
80
|
+
constructor(input: RunnableFunctionWithParse<Args>);
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=RunnableFunction.d.mts.map
|