@humeai/audio-decisions 0.0.1 → 0.1.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/LICENSE +21 -0
- package/README.md +411 -2
- package/dist/cjs/BaseClient.d.ts +54 -0
- package/dist/cjs/BaseClient.js +77 -0
- package/dist/cjs/Client.d.ts +29 -0
- package/dist/cjs/Client.js +88 -0
- package/dist/cjs/api/errors/BadRequestError.d.ts +7 -0
- package/dist/cjs/api/errors/BadRequestError.js +54 -0
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +7 -0
- package/dist/cjs/api/errors/ContentTooLargeError.js +54 -0
- package/dist/cjs/api/errors/ForbiddenError.d.ts +7 -0
- package/dist/cjs/api/errors/ForbiddenError.js +54 -0
- package/dist/cjs/api/errors/InternalServerError.d.ts +7 -0
- package/dist/cjs/api/errors/InternalServerError.js +54 -0
- package/dist/cjs/api/errors/NotFoundError.d.ts +7 -0
- package/dist/cjs/api/errors/NotFoundError.js +54 -0
- package/dist/cjs/api/errors/PaymentRequiredError.d.ts +7 -0
- package/dist/cjs/api/errors/PaymentRequiredError.js +54 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.d.ts +7 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.js +54 -0
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +7 -0
- package/dist/cjs/api/errors/TooManyRequestsError.js +54 -0
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +7 -0
- package/dist/cjs/api/errors/UnauthorizedError.js +54 -0
- package/dist/cjs/api/errors/UnsupportedMediaTypeError.d.ts +7 -0
- package/dist/cjs/api/errors/UnsupportedMediaTypeError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +10 -0
- package/dist/cjs/api/errors/index.js +26 -0
- package/dist/cjs/api/index.d.ts +3 -0
- package/dist/cjs/api/index.js +19 -0
- package/dist/cjs/api/resources/decisions/client/Client.d.ts +284 -0
- package/dist/cjs/api/resources/decisions/client/Client.js +564 -0
- package/dist/cjs/api/resources/decisions/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/decisions/client/index.js +17 -0
- package/dist/cjs/api/resources/decisions/client/requests/DecisionsUpload.d.ts +118 -0
- package/dist/cjs/api/resources/decisions/client/requests/DecisionsUpload.js +3 -0
- package/dist/cjs/api/resources/decisions/client/requests/InputTokensRequest.d.ts +44 -0
- package/dist/cjs/api/resources/decisions/client/requests/InputTokensRequest.js +3 -0
- package/dist/cjs/api/resources/decisions/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/decisions/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/decisions/exports.d.ts +2 -0
- package/dist/cjs/api/resources/decisions/exports.js +21 -0
- package/dist/cjs/api/resources/decisions/index.d.ts +1 -0
- package/dist/cjs/api/resources/decisions/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/index.js +43 -0
- package/dist/cjs/api/resources/runs/client/Client.d.ts +60 -0
- package/dist/cjs/api/resources/runs/client/Client.js +306 -0
- package/dist/cjs/api/resources/runs/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/runs/client/index.js +17 -0
- package/dist/cjs/api/resources/runs/client/requests/GetRunsRequest.d.ts +10 -0
- package/dist/cjs/api/resources/runs/client/requests/GetRunsRequest.js +3 -0
- package/dist/cjs/api/resources/runs/client/requests/ListRunsRequest.d.ts +19 -0
- package/dist/cjs/api/resources/runs/client/requests/ListRunsRequest.js +3 -0
- package/dist/cjs/api/resources/runs/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/runs/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/runs/exports.d.ts +2 -0
- package/dist/cjs/api/resources/runs/exports.js +21 -0
- package/dist/cjs/api/resources/runs/index.d.ts +1 -0
- package/dist/cjs/api/resources/runs/index.js +17 -0
- package/dist/cjs/api/types/Answer.d.ts +19 -0
- package/dist/cjs/api/types/Answer.js +3 -0
- package/dist/cjs/api/types/Answers.d.ts +7 -0
- package/dist/cjs/api/types/Answers.js +3 -0
- package/dist/cjs/api/types/ChoiceAnswer.d.ts +11 -0
- package/dist/cjs/api/types/ChoiceAnswer.js +3 -0
- package/dist/cjs/api/types/ChoiceQuestion.d.ts +10 -0
- package/dist/cjs/api/types/ChoiceQuestion.js +3 -0
- package/dist/cjs/api/types/Criterion.d.ts +9 -0
- package/dist/cjs/api/types/Criterion.js +3 -0
- package/dist/cjs/api/types/DecisionsRequest.d.ts +9 -0
- package/dist/cjs/api/types/DecisionsRequest.js +3 -0
- package/dist/cjs/api/types/DecisionsResponse.d.ts +10 -0
- package/dist/cjs/api/types/DecisionsResponse.js +3 -0
- package/dist/cjs/api/types/ErrorCode.d.ts +58 -0
- package/dist/cjs/api/types/ErrorCode.js +61 -0
- package/dist/cjs/api/types/ErrorType.d.ts +5 -0
- package/dist/cjs/api/types/ErrorType.js +8 -0
- package/dist/cjs/api/types/Error_.d.ts +15 -0
- package/dist/cjs/api/types/Error_.js +3 -0
- package/dist/cjs/api/types/GatewayError.d.ts +9 -0
- package/dist/cjs/api/types/GatewayError.js +3 -0
- package/dist/cjs/api/types/InputTokensResponse.d.ts +7 -0
- package/dist/cjs/api/types/InputTokensResponse.js +3 -0
- package/dist/cjs/api/types/Moment.d.ts +11 -0
- package/dist/cjs/api/types/Moment.js +3 -0
- package/dist/cjs/api/types/MomentAnswer.d.ts +8 -0
- package/dist/cjs/api/types/MomentAnswer.js +3 -0
- package/dist/cjs/api/types/MomentQuestion.d.ts +7 -0
- package/dist/cjs/api/types/MomentQuestion.js +3 -0
- package/dist/cjs/api/types/NoulAnswer.d.ts +7 -0
- package/dist/cjs/api/types/NoulAnswer.js +3 -0
- package/dist/cjs/api/types/NoulCriteria.d.ts +9 -0
- package/dist/cjs/api/types/NoulCriteria.js +3 -0
- package/dist/cjs/api/types/NoulQuestion.d.ts +9 -0
- package/dist/cjs/api/types/NoulQuestion.js +3 -0
- package/dist/cjs/api/types/Question.d.ts +19 -0
- package/dist/cjs/api/types/Question.js +3 -0
- package/dist/cjs/api/types/Questions.d.ts +7 -0
- package/dist/cjs/api/types/Questions.js +3 -0
- package/dist/cjs/api/types/Received.d.ts +7 -0
- package/dist/cjs/api/types/Received.js +3 -0
- package/dist/cjs/api/types/Run.d.ts +18 -0
- package/dist/cjs/api/types/Run.js +3 -0
- package/dist/cjs/api/types/RunReceived.d.ts +9 -0
- package/dist/cjs/api/types/RunReceived.js +3 -0
- package/dist/cjs/api/types/RunStatus.d.ts +6 -0
- package/dist/cjs/api/types/RunStatus.js +9 -0
- package/dist/cjs/api/types/RunSummary.d.ts +16 -0
- package/dist/cjs/api/types/RunSummary.js +3 -0
- package/dist/cjs/api/types/RunsPage.d.ts +10 -0
- package/dist/cjs/api/types/RunsPage.js +3 -0
- package/dist/cjs/api/types/ScoreAnswer.d.ts +13 -0
- package/dist/cjs/api/types/ScoreAnswer.js +3 -0
- package/dist/cjs/api/types/ScoreQuestion.d.ts +9 -0
- package/dist/cjs/api/types/ScoreQuestion.js +3 -0
- package/dist/cjs/api/types/index.d.ts +28 -0
- package/dist/cjs/api/types/index.js +44 -0
- package/dist/cjs/audio-helpers/bytes.d.ts +6 -0
- package/dist/cjs/audio-helpers/bytes.js +38 -0
- package/dist/cjs/audio-helpers/checks.d.ts +2 -0
- package/dist/cjs/audio-helpers/checks.js +25 -0
- package/dist/cjs/audio-helpers/chunks.d.ts +160 -0
- package/dist/cjs/audio-helpers/chunks.js +350 -0
- package/dist/cjs/audio-helpers/downmix.d.ts +17 -0
- package/dist/cjs/audio-helpers/downmix.js +291 -0
- package/dist/cjs/audio-helpers/errors.d.ts +4 -0
- package/dist/cjs/audio-helpers/errors.js +12 -0
- package/dist/cjs/audio-helpers/files.d.ts +27 -0
- package/dist/cjs/audio-helpers/files.js +178 -0
- package/dist/cjs/audio-helpers/index.d.ts +4 -0
- package/dist/cjs/audio-helpers/index.js +11 -0
- package/dist/cjs/audio-helpers/integers.d.ts +3 -0
- package/dist/cjs/audio-helpers/integers.js +26 -0
- package/dist/cjs/audio-helpers/mp3.d.ts +24 -0
- package/dist/cjs/audio-helpers/mp3.js +245 -0
- package/dist/cjs/audio-helpers/results.d.ts +74 -0
- package/dist/cjs/audio-helpers/results.js +187 -0
- package/dist/cjs/audio-helpers/wav.d.ts +21 -0
- package/dist/cjs/audio-helpers/wav.js +167 -0
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +20 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +83 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +8 -0
- package/dist/cjs/core/auth/AuthProvider.js +9 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +33 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
- package/dist/cjs/core/auth/BearerToken.js +16 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +5 -0
- package/dist/cjs/core/auth/index.js +11 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/exports.d.ts +2 -0
- package/dist/cjs/core/exports.js +18 -0
- package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/cjs/core/fetcher/APIResponse.js +2 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/cjs/core/fetcher/Fetcher.js +275 -0
- package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
- package/dist/cjs/core/fetcher/Headers.js +84 -0
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/cjs/core/fetcher/RawResponse.js +44 -0
- package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
- package/dist/cjs/core/fetcher/Supplier.js +22 -0
- package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +58 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
- package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
- package/dist/cjs/core/fetcher/getHeader.js +11 -0
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
- package/dist/cjs/core/fetcher/getResponseBody.d.ts +17 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +85 -0
- package/dist/cjs/core/fetcher/index.d.ts +13 -0
- package/dist/cjs/core/fetcher/index.js +19 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +173 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +11 -0
- package/dist/cjs/core/fetcher/makeRequest.js +94 -0
- package/dist/cjs/core/fetcher/redactUrl.d.ts +2 -0
- package/dist/cjs/core/fetcher/redactUrl.js +88 -0
- package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/cjs/core/fetcher/requestWithRetries.js +91 -0
- package/dist/cjs/core/fetcher/signals.d.ts +6 -0
- package/dist/cjs/core/fetcher/signals.js +33 -0
- package/dist/cjs/core/file/exports.d.ts +1 -0
- package/dist/cjs/core/file/exports.js +2 -0
- package/dist/cjs/core/file/file.d.ts +10 -0
- package/dist/cjs/core/file/file.js +225 -0
- package/dist/cjs/core/file/index.d.ts +2 -0
- package/dist/cjs/core/file/index.js +18 -0
- package/dist/cjs/core/file/types.d.ts +66 -0
- package/dist/cjs/core/file/types.js +2 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.js +192 -0
- package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
- package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
- package/dist/cjs/core/form-data-utils/index.js +20 -0
- package/dist/cjs/core/headers.d.ts +2 -0
- package/dist/cjs/core/headers.js +31 -0
- package/dist/cjs/core/index.d.ts +9 -0
- package/dist/cjs/core/index.js +48 -0
- package/dist/cjs/core/json.d.ts +15 -0
- package/dist/cjs/core/json.js +24 -0
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/requestBody.d.ts +12 -0
- package/dist/cjs/core/requestBody.js +26 -0
- package/dist/cjs/core/runtime/index.d.ts +1 -0
- package/dist/cjs/core/runtime/index.js +6 -0
- package/dist/cjs/core/runtime/runtime.d.ts +28 -0
- package/dist/cjs/core/runtime/runtime.js +176 -0
- package/dist/cjs/core/schemas/Schema.d.ts +88 -0
- package/dist/cjs/core/schemas/Schema.js +25 -0
- package/dist/cjs/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/bigint/bigint.js +53 -0
- package/dist/cjs/core/schemas/builders/bigint/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/bigint/index.js +5 -0
- package/dist/cjs/core/schemas/builders/date/date.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/date/date.js +62 -0
- package/dist/cjs/core/schemas/builders/date/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/date/index.js +5 -0
- package/dist/cjs/core/schemas/builders/enum/enum.d.ts +3 -0
- package/dist/cjs/core/schemas/builders/enum/enum.js +45 -0
- package/dist/cjs/core/schemas/builders/enum/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/enum/index.js +6 -0
- package/dist/cjs/core/schemas/builders/index.d.ts +14 -0
- package/dist/cjs/core/schemas/builders/index.js +30 -0
- package/dist/cjs/core/schemas/builders/lazy/index.d.ts +3 -0
- package/dist/cjs/core/schemas/builders/lazy/index.js +7 -0
- package/dist/cjs/core/schemas/builders/lazy/lazy.d.ts +5 -0
- package/dist/cjs/core/schemas/builders/lazy/lazy.js +24 -0
- package/dist/cjs/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/dist/cjs/core/schemas/builders/lazy/lazyObject.js +11 -0
- package/dist/cjs/core/schemas/builders/list/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/list/index.js +5 -0
- package/dist/cjs/core/schemas/builders/list/list.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/list/list.js +49 -0
- package/dist/cjs/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/literals/booleanLiteral.js +28 -0
- package/dist/cjs/core/schemas/builders/literals/index.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/literals/index.js +7 -0
- package/dist/cjs/core/schemas/builders/literals/stringLiteral.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/literals/stringLiteral.js +28 -0
- package/dist/cjs/core/schemas/builders/object/index.d.ts +6 -0
- package/dist/cjs/core/schemas/builders/object/index.js +11 -0
- package/dist/cjs/core/schemas/builders/object/object.d.ts +3 -0
- package/dist/cjs/core/schemas/builders/object/object.js +354 -0
- package/dist/cjs/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/dist/cjs/core/schemas/builders/object/objectWithoutOptionalProperties.js +7 -0
- package/dist/cjs/core/schemas/builders/object/property.d.ts +8 -0
- package/dist/cjs/core/schemas/builders/object/property.js +15 -0
- package/dist/cjs/core/schemas/builders/object/types.d.ts +31 -0
- package/dist/cjs/core/schemas/builders/object/types.js +2 -0
- package/dist/cjs/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +9 -0
- package/dist/cjs/core/schemas/builders/object-like/getObjectLikeUtils.js +60 -0
- package/dist/cjs/core/schemas/builders/object-like/index.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/object-like/index.js +6 -0
- package/dist/cjs/core/schemas/builders/object-like/types.d.ts +7 -0
- package/dist/cjs/core/schemas/builders/object-like/types.js +2 -0
- package/dist/cjs/core/schemas/builders/primitives/any.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/any.js +9 -0
- package/dist/cjs/core/schemas/builders/primitives/boolean.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/boolean.js +25 -0
- package/dist/cjs/core/schemas/builders/primitives/index.d.ts +6 -0
- package/dist/cjs/core/schemas/builders/primitives/index.js +15 -0
- package/dist/cjs/core/schemas/builders/primitives/never.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/never.js +14 -0
- package/dist/cjs/core/schemas/builders/primitives/number.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/number.js +25 -0
- package/dist/cjs/core/schemas/builders/primitives/string.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/string.js +25 -0
- package/dist/cjs/core/schemas/builders/primitives/unknown.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/unknown.js +6 -0
- package/dist/cjs/core/schemas/builders/record/index.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/record/index.js +6 -0
- package/dist/cjs/core/schemas/builders/record/record.d.ts +4 -0
- package/dist/cjs/core/schemas/builders/record/record.js +131 -0
- package/dist/cjs/core/schemas/builders/record/types.d.ts +6 -0
- package/dist/cjs/core/schemas/builders/record/types.js +2 -0
- package/dist/cjs/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
- package/dist/cjs/core/schemas/builders/schema-utils/JsonError.js +13 -0
- package/dist/cjs/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
- package/dist/cjs/core/schemas/builders/schema-utils/ParseError.js +13 -0
- package/dist/cjs/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +21 -0
- package/dist/cjs/core/schemas/builders/schema-utils/getSchemaUtils.js +145 -0
- package/dist/cjs/core/schemas/builders/schema-utils/index.d.ts +4 -0
- package/dist/cjs/core/schemas/builders/schema-utils/index.js +11 -0
- package/dist/cjs/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/schema-utils/stringifyValidationErrors.js +9 -0
- package/dist/cjs/core/schemas/builders/set/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/set/index.js +5 -0
- package/dist/cjs/core/schemas/builders/set/set.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/set/set.js +43 -0
- package/dist/cjs/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/dist/cjs/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
- package/dist/cjs/core/schemas/builders/undiscriminated-union/types.js +2 -0
- package/dist/cjs/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
- package/dist/cjs/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +39 -0
- package/dist/cjs/core/schemas/builders/union/discriminant.d.ts +5 -0
- package/dist/cjs/core/schemas/builders/union/discriminant.js +9 -0
- package/dist/cjs/core/schemas/builders/union/index.d.ts +4 -0
- package/dist/cjs/core/schemas/builders/union/index.js +7 -0
- package/dist/cjs/core/schemas/builders/union/types.d.ts +13 -0
- package/dist/cjs/core/schemas/builders/union/types.js +2 -0
- package/dist/cjs/core/schemas/builders/union/union.d.ts +4 -0
- package/dist/cjs/core/schemas/builders/union/union.js +126 -0
- package/dist/cjs/core/schemas/index.d.ts +2 -0
- package/dist/cjs/core/schemas/index.js +17 -0
- package/dist/cjs/core/schemas/utils/MaybePromise.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/MaybePromise.js +2 -0
- package/dist/cjs/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
- package/dist/cjs/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
- package/dist/cjs/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
- package/dist/cjs/core/schemas/utils/createIdentitySchemaCreator.js +15 -0
- package/dist/cjs/core/schemas/utils/entries.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/entries.js +6 -0
- package/dist/cjs/core/schemas/utils/filterObject.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/filterObject.js +13 -0
- package/dist/cjs/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/getErrorMessageForIncorrectType.js +27 -0
- package/dist/cjs/core/schemas/utils/isPlainObject.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/isPlainObject.js +15 -0
- package/dist/cjs/core/schemas/utils/keys.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/keys.js +6 -0
- package/dist/cjs/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/dist/cjs/core/schemas/utils/maybeSkipValidation.js +27 -0
- package/dist/cjs/core/schemas/utils/partition.d.ts +1 -0
- package/dist/cjs/core/schemas/utils/partition.js +15 -0
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
- package/dist/cjs/core/url/encodePathParam.d.ts +3 -0
- package/dist/cjs/core/url/encodePathParam.js +27 -0
- package/dist/cjs/core/url/index.d.ts +4 -0
- package/dist/cjs/core/url/index.js +11 -0
- package/dist/cjs/core/url/join.d.ts +1 -0
- package/dist/cjs/core/url/join.js +68 -0
- package/dist/cjs/core/url/qs.d.ts +7 -0
- package/dist/cjs/core/url/qs.js +76 -0
- package/dist/cjs/environments.d.ts +4 -0
- package/dist/cjs/environments.js +7 -0
- package/dist/cjs/errors/DecisionsError.d.ts +15 -0
- package/dist/cjs/errors/DecisionsError.js +53 -0
- package/dist/cjs/errors/DecisionsTimeoutError.d.ts +6 -0
- package/dist/cjs/errors/DecisionsTimeoutError.js +52 -0
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +68 -0
- package/dist/cjs/errors/index.d.ts +2 -0
- package/dist/cjs/errors/index.js +7 -0
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/serialization/index.d.ts +2 -0
- package/dist/cjs/serialization/index.js +18 -0
- package/dist/cjs/serialization/resources/decisions/client/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/decisions/client/index.js +17 -0
- package/dist/cjs/serialization/resources/decisions/client/requests/InputTokensRequest.d.ts +12 -0
- package/dist/cjs/serialization/resources/decisions/client/requests/InputTokensRequest.js +44 -0
- package/dist/cjs/serialization/resources/decisions/client/requests/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/decisions/client/requests/index.js +5 -0
- package/dist/cjs/serialization/resources/decisions/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/decisions/index.js +17 -0
- package/dist/cjs/serialization/resources/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/index.js +41 -0
- package/dist/cjs/serialization/types/Answer.d.ts +23 -0
- package/dist/cjs/serialization/types/Answer.js +53 -0
- package/dist/cjs/serialization/types/Answers.d.ts +10 -0
- package/dist/cjs/serialization/types/Answers.js +40 -0
- package/dist/cjs/serialization/types/ChoiceAnswer.d.ts +11 -0
- package/dist/cjs/serialization/types/ChoiceAnswer.js +43 -0
- package/dist/cjs/serialization/types/ChoiceQuestion.d.ts +11 -0
- package/dist/cjs/serialization/types/ChoiceQuestion.js +43 -0
- package/dist/cjs/serialization/types/Criterion.d.ts +10 -0
- package/dist/cjs/serialization/types/Criterion.js +42 -0
- package/dist/cjs/serialization/types/DecisionsRequest.d.ts +11 -0
- package/dist/cjs/serialization/types/DecisionsRequest.js +43 -0
- package/dist/cjs/serialization/types/DecisionsResponse.d.ts +13 -0
- package/dist/cjs/serialization/types/DecisionsResponse.js +45 -0
- package/dist/cjs/serialization/types/ErrorCode.d.ts +7 -0
- package/dist/cjs/serialization/types/ErrorCode.js +54 -0
- package/dist/cjs/serialization/types/ErrorType.d.ts +7 -0
- package/dist/cjs/serialization/types/ErrorType.js +39 -0
- package/dist/cjs/serialization/types/Error_.d.ts +15 -0
- package/dist/cjs/serialization/types/Error_.js +47 -0
- package/dist/cjs/serialization/types/GatewayError.d.ts +10 -0
- package/dist/cjs/serialization/types/GatewayError.js +42 -0
- package/dist/cjs/serialization/types/InputTokensResponse.d.ts +9 -0
- package/dist/cjs/serialization/types/InputTokensResponse.js +41 -0
- package/dist/cjs/serialization/types/Moment.d.ts +11 -0
- package/dist/cjs/serialization/types/Moment.js +43 -0
- package/dist/cjs/serialization/types/MomentAnswer.d.ts +10 -0
- package/dist/cjs/serialization/types/MomentAnswer.js +42 -0
- package/dist/cjs/serialization/types/MomentQuestion.d.ts +9 -0
- package/dist/cjs/serialization/types/MomentQuestion.js +41 -0
- package/dist/cjs/serialization/types/NoulAnswer.d.ts +9 -0
- package/dist/cjs/serialization/types/NoulAnswer.js +41 -0
- package/dist/cjs/serialization/types/NoulCriteria.d.ts +10 -0
- package/dist/cjs/serialization/types/NoulCriteria.js +42 -0
- package/dist/cjs/serialization/types/NoulQuestion.d.ts +11 -0
- package/dist/cjs/serialization/types/NoulQuestion.js +43 -0
- package/dist/cjs/serialization/types/Question.d.ts +23 -0
- package/dist/cjs/serialization/types/Question.js +53 -0
- package/dist/cjs/serialization/types/Questions.d.ts +10 -0
- package/dist/cjs/serialization/types/Questions.js +40 -0
- package/dist/cjs/serialization/types/Received.d.ts +9 -0
- package/dist/cjs/serialization/types/Received.js +41 -0
- package/dist/cjs/serialization/types/Run.d.ts +18 -0
- package/dist/cjs/serialization/types/Run.js +50 -0
- package/dist/cjs/serialization/types/RunReceived.d.ts +10 -0
- package/dist/cjs/serialization/types/RunReceived.js +42 -0
- package/dist/cjs/serialization/types/RunStatus.d.ts +7 -0
- package/dist/cjs/serialization/types/RunStatus.js +39 -0
- package/dist/cjs/serialization/types/RunSummary.d.ts +16 -0
- package/dist/cjs/serialization/types/RunSummary.js +48 -0
- package/dist/cjs/serialization/types/RunsPage.d.ts +11 -0
- package/dist/cjs/serialization/types/RunsPage.js +43 -0
- package/dist/cjs/serialization/types/ScoreAnswer.d.ts +12 -0
- package/dist/cjs/serialization/types/ScoreAnswer.js +44 -0
- package/dist/cjs/serialization/types/ScoreQuestion.d.ts +10 -0
- package/dist/cjs/serialization/types/ScoreQuestion.js +42 -0
- package/dist/cjs/serialization/types/index.d.ts +28 -0
- package/dist/cjs/serialization/types/index.js +44 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +4 -0
- package/dist/esm/BaseClient.d.mts +54 -0
- package/dist/esm/BaseClient.mjs +40 -0
- package/dist/esm/Client.d.mts +29 -0
- package/dist/esm/Client.mjs +51 -0
- package/dist/esm/api/errors/BadRequestError.d.mts +7 -0
- package/dist/esm/api/errors/BadRequestError.mjs +17 -0
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +7 -0
- package/dist/esm/api/errors/ContentTooLargeError.mjs +17 -0
- package/dist/esm/api/errors/ForbiddenError.d.mts +7 -0
- package/dist/esm/api/errors/ForbiddenError.mjs +17 -0
- package/dist/esm/api/errors/InternalServerError.d.mts +7 -0
- package/dist/esm/api/errors/InternalServerError.mjs +17 -0
- package/dist/esm/api/errors/NotFoundError.d.mts +7 -0
- package/dist/esm/api/errors/NotFoundError.mjs +17 -0
- package/dist/esm/api/errors/PaymentRequiredError.d.mts +7 -0
- package/dist/esm/api/errors/PaymentRequiredError.mjs +17 -0
- package/dist/esm/api/errors/ServiceUnavailableError.d.mts +7 -0
- package/dist/esm/api/errors/ServiceUnavailableError.mjs +17 -0
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +7 -0
- package/dist/esm/api/errors/TooManyRequestsError.mjs +17 -0
- package/dist/esm/api/errors/UnauthorizedError.d.mts +7 -0
- package/dist/esm/api/errors/UnauthorizedError.mjs +17 -0
- package/dist/esm/api/errors/UnsupportedMediaTypeError.d.mts +7 -0
- package/dist/esm/api/errors/UnsupportedMediaTypeError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +10 -0
- package/dist/esm/api/errors/index.mjs +10 -0
- package/dist/esm/api/index.d.mts +3 -0
- package/dist/esm/api/index.mjs +3 -0
- package/dist/esm/api/resources/decisions/client/Client.d.mts +284 -0
- package/dist/esm/api/resources/decisions/client/Client.mjs +527 -0
- package/dist/esm/api/resources/decisions/client/index.d.mts +1 -0
- package/dist/esm/api/resources/decisions/client/index.mjs +1 -0
- package/dist/esm/api/resources/decisions/client/requests/DecisionsUpload.d.mts +118 -0
- package/dist/esm/api/resources/decisions/client/requests/DecisionsUpload.mjs +2 -0
- package/dist/esm/api/resources/decisions/client/requests/InputTokensRequest.d.mts +44 -0
- package/dist/esm/api/resources/decisions/client/requests/InputTokensRequest.mjs +2 -0
- package/dist/esm/api/resources/decisions/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/decisions/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/decisions/exports.d.mts +2 -0
- package/dist/esm/api/resources/decisions/exports.mjs +3 -0
- package/dist/esm/api/resources/decisions/index.d.mts +1 -0
- package/dist/esm/api/resources/decisions/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/index.mjs +4 -0
- package/dist/esm/api/resources/runs/client/Client.d.mts +60 -0
- package/dist/esm/api/resources/runs/client/Client.mjs +269 -0
- package/dist/esm/api/resources/runs/client/index.d.mts +1 -0
- package/dist/esm/api/resources/runs/client/index.mjs +1 -0
- package/dist/esm/api/resources/runs/client/requests/GetRunsRequest.d.mts +10 -0
- package/dist/esm/api/resources/runs/client/requests/GetRunsRequest.mjs +2 -0
- package/dist/esm/api/resources/runs/client/requests/ListRunsRequest.d.mts +19 -0
- package/dist/esm/api/resources/runs/client/requests/ListRunsRequest.mjs +2 -0
- package/dist/esm/api/resources/runs/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/runs/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/runs/exports.d.mts +2 -0
- package/dist/esm/api/resources/runs/exports.mjs +3 -0
- package/dist/esm/api/resources/runs/index.d.mts +1 -0
- package/dist/esm/api/resources/runs/index.mjs +1 -0
- package/dist/esm/api/types/Answer.d.mts +19 -0
- package/dist/esm/api/types/Answer.mjs +2 -0
- package/dist/esm/api/types/Answers.d.mts +7 -0
- package/dist/esm/api/types/Answers.mjs +2 -0
- package/dist/esm/api/types/ChoiceAnswer.d.mts +11 -0
- package/dist/esm/api/types/ChoiceAnswer.mjs +2 -0
- package/dist/esm/api/types/ChoiceQuestion.d.mts +10 -0
- package/dist/esm/api/types/ChoiceQuestion.mjs +2 -0
- package/dist/esm/api/types/Criterion.d.mts +9 -0
- package/dist/esm/api/types/Criterion.mjs +2 -0
- package/dist/esm/api/types/DecisionsRequest.d.mts +9 -0
- package/dist/esm/api/types/DecisionsRequest.mjs +2 -0
- package/dist/esm/api/types/DecisionsResponse.d.mts +10 -0
- package/dist/esm/api/types/DecisionsResponse.mjs +2 -0
- package/dist/esm/api/types/ErrorCode.d.mts +58 -0
- package/dist/esm/api/types/ErrorCode.mjs +58 -0
- package/dist/esm/api/types/ErrorType.d.mts +5 -0
- package/dist/esm/api/types/ErrorType.mjs +5 -0
- package/dist/esm/api/types/Error_.d.mts +15 -0
- package/dist/esm/api/types/Error_.mjs +2 -0
- package/dist/esm/api/types/GatewayError.d.mts +9 -0
- package/dist/esm/api/types/GatewayError.mjs +2 -0
- package/dist/esm/api/types/InputTokensResponse.d.mts +7 -0
- package/dist/esm/api/types/InputTokensResponse.mjs +2 -0
- package/dist/esm/api/types/Moment.d.mts +11 -0
- package/dist/esm/api/types/Moment.mjs +2 -0
- package/dist/esm/api/types/MomentAnswer.d.mts +8 -0
- package/dist/esm/api/types/MomentAnswer.mjs +2 -0
- package/dist/esm/api/types/MomentQuestion.d.mts +7 -0
- package/dist/esm/api/types/MomentQuestion.mjs +2 -0
- package/dist/esm/api/types/NoulAnswer.d.mts +7 -0
- package/dist/esm/api/types/NoulAnswer.mjs +2 -0
- package/dist/esm/api/types/NoulCriteria.d.mts +9 -0
- package/dist/esm/api/types/NoulCriteria.mjs +2 -0
- package/dist/esm/api/types/NoulQuestion.d.mts +9 -0
- package/dist/esm/api/types/NoulQuestion.mjs +2 -0
- package/dist/esm/api/types/Question.d.mts +19 -0
- package/dist/esm/api/types/Question.mjs +2 -0
- package/dist/esm/api/types/Questions.d.mts +7 -0
- package/dist/esm/api/types/Questions.mjs +2 -0
- package/dist/esm/api/types/Received.d.mts +7 -0
- package/dist/esm/api/types/Received.mjs +2 -0
- package/dist/esm/api/types/Run.d.mts +18 -0
- package/dist/esm/api/types/Run.mjs +2 -0
- package/dist/esm/api/types/RunReceived.d.mts +9 -0
- package/dist/esm/api/types/RunReceived.mjs +2 -0
- package/dist/esm/api/types/RunStatus.d.mts +6 -0
- package/dist/esm/api/types/RunStatus.mjs +6 -0
- package/dist/esm/api/types/RunSummary.d.mts +16 -0
- package/dist/esm/api/types/RunSummary.mjs +2 -0
- package/dist/esm/api/types/RunsPage.d.mts +10 -0
- package/dist/esm/api/types/RunsPage.mjs +2 -0
- package/dist/esm/api/types/ScoreAnswer.d.mts +13 -0
- package/dist/esm/api/types/ScoreAnswer.mjs +2 -0
- package/dist/esm/api/types/ScoreQuestion.d.mts +9 -0
- package/dist/esm/api/types/ScoreQuestion.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +28 -0
- package/dist/esm/api/types/index.mjs +28 -0
- package/dist/esm/audio-helpers/bytes.d.mts +6 -0
- package/dist/esm/audio-helpers/bytes.mjs +32 -0
- package/dist/esm/audio-helpers/checks.d.mts +2 -0
- package/dist/esm/audio-helpers/checks.mjs +21 -0
- package/dist/esm/audio-helpers/chunks.d.mts +160 -0
- package/dist/esm/audio-helpers/chunks.mjs +346 -0
- package/dist/esm/audio-helpers/downmix.d.mts +17 -0
- package/dist/esm/audio-helpers/downmix.mjs +287 -0
- package/dist/esm/audio-helpers/errors.d.mts +4 -0
- package/dist/esm/audio-helpers/errors.mjs +8 -0
- package/dist/esm/audio-helpers/files.d.mts +27 -0
- package/dist/esm/audio-helpers/files.mjs +173 -0
- package/dist/esm/audio-helpers/index.d.mts +4 -0
- package/dist/esm/audio-helpers/index.mjs +5 -0
- package/dist/esm/audio-helpers/integers.d.mts +3 -0
- package/dist/esm/audio-helpers/integers.mjs +21 -0
- package/dist/esm/audio-helpers/mp3.d.mts +24 -0
- package/dist/esm/audio-helpers/mp3.mjs +239 -0
- package/dist/esm/audio-helpers/results.d.mts +74 -0
- package/dist/esm/audio-helpers/results.mjs +181 -0
- package/dist/esm/audio-helpers/wav.d.mts +21 -0
- package/dist/esm/audio-helpers/wav.mjs +161 -0
- package/dist/esm/auth/HeaderAuthProvider.d.mts +20 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +46 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +8 -0
- package/dist/esm/core/auth/AuthProvider.mjs +6 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +30 -0
- package/dist/esm/core/auth/BearerToken.d.mts +7 -0
- package/dist/esm/core/auth/BearerToken.mjs +13 -0
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +5 -0
- package/dist/esm/core/auth/index.mjs +4 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/exports.d.mts +2 -0
- package/dist/esm/core/exports.mjs +2 -0
- package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
- package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
- package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +56 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +271 -0
- package/dist/esm/core/fetcher/Headers.d.mts +2 -0
- package/dist/esm/core/fetcher/Headers.mjs +82 -0
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
- package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
- package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
- package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
- package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
- package/dist/esm/core/fetcher/Supplier.mjs +19 -0
- package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
- package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +55 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
- package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
- package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
- package/dist/esm/core/fetcher/getHeader.mjs +8 -0
- package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
- package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
- package/dist/esm/core/fetcher/getResponseBody.d.mts +17 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +81 -0
- package/dist/esm/core/fetcher/index.d.mts +13 -0
- package/dist/esm/core/fetcher/index.mjs +7 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +170 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +11 -0
- package/dist/esm/core/fetcher/makeRequest.mjs +87 -0
- package/dist/esm/core/fetcher/redactUrl.d.mts +2 -0
- package/dist/esm/core/fetcher/redactUrl.mjs +84 -0
- package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +88 -0
- package/dist/esm/core/fetcher/signals.d.mts +6 -0
- package/dist/esm/core/fetcher/signals.mjs +28 -0
- package/dist/esm/core/file/exports.d.mts +1 -0
- package/dist/esm/core/file/exports.mjs +1 -0
- package/dist/esm/core/file/file.d.mts +10 -0
- package/dist/esm/core/file/file.mjs +188 -0
- package/dist/esm/core/file/index.d.mts +2 -0
- package/dist/esm/core/file/index.mjs +2 -0
- package/dist/esm/core/file/types.d.mts +66 -0
- package/dist/esm/core/file/types.mjs +1 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +154 -0
- package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
- package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
- package/dist/esm/core/form-data-utils/index.d.mts +2 -0
- package/dist/esm/core/form-data-utils/index.mjs +2 -0
- package/dist/esm/core/headers.d.mts +2 -0
- package/dist/esm/core/headers.mjs +27 -0
- package/dist/esm/core/index.d.mts +9 -0
- package/dist/esm/core/index.mjs +9 -0
- package/dist/esm/core/json.d.mts +15 -0
- package/dist/esm/core/json.mjs +19 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/requestBody.d.mts +12 -0
- package/dist/esm/core/requestBody.mjs +23 -0
- package/dist/esm/core/runtime/index.d.mts +1 -0
- package/dist/esm/core/runtime/index.mjs +1 -0
- package/dist/esm/core/runtime/runtime.d.mts +28 -0
- package/dist/esm/core/runtime/runtime.mjs +172 -0
- package/dist/esm/core/schemas/Schema.d.mts +88 -0
- package/dist/esm/core/schemas/Schema.mjs +22 -0
- package/dist/esm/core/schemas/builders/bigint/bigint.d.mts +2 -0
- package/dist/esm/core/schemas/builders/bigint/bigint.mjs +50 -0
- package/dist/esm/core/schemas/builders/bigint/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/bigint/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/date/date.d.mts +2 -0
- package/dist/esm/core/schemas/builders/date/date.mjs +59 -0
- package/dist/esm/core/schemas/builders/date/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/date/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/enum/enum.d.mts +3 -0
- package/dist/esm/core/schemas/builders/enum/enum.mjs +41 -0
- package/dist/esm/core/schemas/builders/enum/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/enum/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/index.d.mts +14 -0
- package/dist/esm/core/schemas/builders/index.mjs +14 -0
- package/dist/esm/core/schemas/builders/lazy/index.d.mts +3 -0
- package/dist/esm/core/schemas/builders/lazy/index.mjs +2 -0
- package/dist/esm/core/schemas/builders/lazy/lazy.d.mts +5 -0
- package/dist/esm/core/schemas/builders/lazy/lazy.mjs +19 -0
- package/dist/esm/core/schemas/builders/lazy/lazyObject.d.mts +3 -0
- package/dist/esm/core/schemas/builders/lazy/lazyObject.mjs +8 -0
- package/dist/esm/core/schemas/builders/list/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/list/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/list/list.d.mts +2 -0
- package/dist/esm/core/schemas/builders/list/list.mjs +46 -0
- package/dist/esm/core/schemas/builders/literals/booleanLiteral.d.mts +2 -0
- package/dist/esm/core/schemas/builders/literals/booleanLiteral.mjs +25 -0
- package/dist/esm/core/schemas/builders/literals/index.d.mts +2 -0
- package/dist/esm/core/schemas/builders/literals/index.mjs +2 -0
- package/dist/esm/core/schemas/builders/literals/stringLiteral.d.mts +2 -0
- package/dist/esm/core/schemas/builders/literals/stringLiteral.mjs +25 -0
- package/dist/esm/core/schemas/builders/object/index.d.mts +6 -0
- package/dist/esm/core/schemas/builders/object/index.mjs +3 -0
- package/dist/esm/core/schemas/builders/object/object.d.mts +3 -0
- package/dist/esm/core/schemas/builders/object/object.mjs +350 -0
- package/dist/esm/core/schemas/builders/object/objectWithoutOptionalProperties.d.mts +6 -0
- package/dist/esm/core/schemas/builders/object/objectWithoutOptionalProperties.mjs +4 -0
- package/dist/esm/core/schemas/builders/object/property.d.mts +8 -0
- package/dist/esm/core/schemas/builders/object/property.mjs +11 -0
- package/dist/esm/core/schemas/builders/object/types.d.mts +31 -0
- package/dist/esm/core/schemas/builders/object/types.mjs +1 -0
- package/dist/esm/core/schemas/builders/object-like/getObjectLikeUtils.d.mts +9 -0
- package/dist/esm/core/schemas/builders/object-like/getObjectLikeUtils.mjs +56 -0
- package/dist/esm/core/schemas/builders/object-like/index.d.mts +2 -0
- package/dist/esm/core/schemas/builders/object-like/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/object-like/types.d.mts +7 -0
- package/dist/esm/core/schemas/builders/object-like/types.mjs +1 -0
- package/dist/esm/core/schemas/builders/primitives/any.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/any.mjs +6 -0
- package/dist/esm/core/schemas/builders/primitives/boolean.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/boolean.mjs +22 -0
- package/dist/esm/core/schemas/builders/primitives/index.d.mts +6 -0
- package/dist/esm/core/schemas/builders/primitives/index.mjs +6 -0
- package/dist/esm/core/schemas/builders/primitives/never.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/never.mjs +11 -0
- package/dist/esm/core/schemas/builders/primitives/number.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/number.mjs +22 -0
- package/dist/esm/core/schemas/builders/primitives/string.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/string.mjs +22 -0
- package/dist/esm/core/schemas/builders/primitives/unknown.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/unknown.mjs +3 -0
- package/dist/esm/core/schemas/builders/record/index.d.mts +2 -0
- package/dist/esm/core/schemas/builders/record/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/record/record.d.mts +4 -0
- package/dist/esm/core/schemas/builders/record/record.mjs +127 -0
- package/dist/esm/core/schemas/builders/record/types.d.mts +6 -0
- package/dist/esm/core/schemas/builders/record/types.mjs +1 -0
- package/dist/esm/core/schemas/builders/schema-utils/JsonError.d.mts +5 -0
- package/dist/esm/core/schemas/builders/schema-utils/JsonError.mjs +9 -0
- package/dist/esm/core/schemas/builders/schema-utils/ParseError.d.mts +5 -0
- package/dist/esm/core/schemas/builders/schema-utils/ParseError.mjs +9 -0
- package/dist/esm/core/schemas/builders/schema-utils/getSchemaUtils.d.mts +21 -0
- package/dist/esm/core/schemas/builders/schema-utils/getSchemaUtils.mjs +138 -0
- package/dist/esm/core/schemas/builders/schema-utils/index.d.mts +4 -0
- package/dist/esm/core/schemas/builders/schema-utils/index.mjs +3 -0
- package/dist/esm/core/schemas/builders/schema-utils/stringifyValidationErrors.d.mts +2 -0
- package/dist/esm/core/schemas/builders/schema-utils/stringifyValidationErrors.mjs +6 -0
- package/dist/esm/core/schemas/builders/set/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/set/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/set/set.d.mts +2 -0
- package/dist/esm/core/schemas/builders/set/set.mjs +40 -0
- package/dist/esm/core/schemas/builders/undiscriminated-union/index.d.mts +2 -0
- package/dist/esm/core/schemas/builders/undiscriminated-union/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/undiscriminated-union/types.d.mts +4 -0
- package/dist/esm/core/schemas/builders/undiscriminated-union/types.mjs +1 -0
- package/dist/esm/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.mts +3 -0
- package/dist/esm/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.mjs +36 -0
- package/dist/esm/core/schemas/builders/union/discriminant.d.mts +5 -0
- package/dist/esm/core/schemas/builders/union/discriminant.mjs +6 -0
- package/dist/esm/core/schemas/builders/union/index.d.mts +4 -0
- package/dist/esm/core/schemas/builders/union/index.mjs +2 -0
- package/dist/esm/core/schemas/builders/union/types.d.mts +13 -0
- package/dist/esm/core/schemas/builders/union/types.mjs +1 -0
- package/dist/esm/core/schemas/builders/union/union.d.mts +4 -0
- package/dist/esm/core/schemas/builders/union/union.mjs +123 -0
- package/dist/esm/core/schemas/index.d.mts +2 -0
- package/dist/esm/core/schemas/index.mjs +1 -0
- package/dist/esm/core/schemas/utils/MaybePromise.d.mts +1 -0
- package/dist/esm/core/schemas/utils/MaybePromise.mjs +1 -0
- package/dist/esm/core/schemas/utils/addQuestionMarksToNullableProperties.d.mts +7 -0
- package/dist/esm/core/schemas/utils/addQuestionMarksToNullableProperties.mjs +1 -0
- package/dist/esm/core/schemas/utils/createIdentitySchemaCreator.d.mts +2 -0
- package/dist/esm/core/schemas/utils/createIdentitySchemaCreator.mjs +12 -0
- package/dist/esm/core/schemas/utils/entries.d.mts +1 -0
- package/dist/esm/core/schemas/utils/entries.mjs +3 -0
- package/dist/esm/core/schemas/utils/filterObject.d.mts +1 -0
- package/dist/esm/core/schemas/utils/filterObject.mjs +10 -0
- package/dist/esm/core/schemas/utils/getErrorMessageForIncorrectType.d.mts +1 -0
- package/dist/esm/core/schemas/utils/getErrorMessageForIncorrectType.mjs +24 -0
- package/dist/esm/core/schemas/utils/isPlainObject.d.mts +1 -0
- package/dist/esm/core/schemas/utils/isPlainObject.mjs +12 -0
- package/dist/esm/core/schemas/utils/keys.d.mts +1 -0
- package/dist/esm/core/schemas/utils/keys.mjs +3 -0
- package/dist/esm/core/schemas/utils/maybeSkipValidation.d.mts +2 -0
- package/dist/esm/core/schemas/utils/maybeSkipValidation.mjs +24 -0
- package/dist/esm/core/schemas/utils/partition.d.mts +1 -0
- package/dist/esm/core/schemas/utils/partition.mjs +12 -0
- package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
- package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
- package/dist/esm/core/url/encodePathParam.d.mts +3 -0
- package/dist/esm/core/url/encodePathParam.mjs +24 -0
- package/dist/esm/core/url/index.d.mts +4 -0
- package/dist/esm/core/url/index.mjs +4 -0
- package/dist/esm/core/url/join.d.mts +1 -0
- package/dist/esm/core/url/join.mjs +65 -0
- package/dist/esm/core/url/qs.d.mts +7 -0
- package/dist/esm/core/url/qs.mjs +73 -0
- package/dist/esm/environments.d.mts +4 -0
- package/dist/esm/environments.mjs +4 -0
- package/dist/esm/errors/DecisionsError.d.mts +15 -0
- package/dist/esm/errors/DecisionsError.mjs +49 -0
- package/dist/esm/errors/DecisionsTimeoutError.d.mts +6 -0
- package/dist/esm/errors/DecisionsTimeoutError.mjs +15 -0
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +32 -0
- package/dist/esm/errors/index.d.mts +2 -0
- package/dist/esm/errors/index.mjs +2 -0
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +7 -0
- package/dist/esm/index.mjs +6 -0
- package/dist/esm/serialization/index.d.mts +2 -0
- package/dist/esm/serialization/index.mjs +2 -0
- package/dist/esm/serialization/resources/decisions/client/index.d.mts +1 -0
- package/dist/esm/serialization/resources/decisions/client/index.mjs +1 -0
- package/dist/esm/serialization/resources/decisions/client/requests/InputTokensRequest.d.mts +12 -0
- package/dist/esm/serialization/resources/decisions/client/requests/InputTokensRequest.mjs +8 -0
- package/dist/esm/serialization/resources/decisions/client/requests/index.d.mts +1 -0
- package/dist/esm/serialization/resources/decisions/client/requests/index.mjs +1 -0
- package/dist/esm/serialization/resources/decisions/index.d.mts +1 -0
- package/dist/esm/serialization/resources/decisions/index.mjs +1 -0
- package/dist/esm/serialization/resources/index.d.mts +2 -0
- package/dist/esm/serialization/resources/index.mjs +2 -0
- package/dist/esm/serialization/types/Answer.d.mts +23 -0
- package/dist/esm/serialization/types/Answer.mjs +17 -0
- package/dist/esm/serialization/types/Answers.d.mts +10 -0
- package/dist/esm/serialization/types/Answers.mjs +4 -0
- package/dist/esm/serialization/types/ChoiceAnswer.d.mts +11 -0
- package/dist/esm/serialization/types/ChoiceAnswer.mjs +7 -0
- package/dist/esm/serialization/types/ChoiceQuestion.d.mts +11 -0
- package/dist/esm/serialization/types/ChoiceQuestion.mjs +7 -0
- package/dist/esm/serialization/types/Criterion.d.mts +10 -0
- package/dist/esm/serialization/types/Criterion.mjs +6 -0
- package/dist/esm/serialization/types/DecisionsRequest.d.mts +11 -0
- package/dist/esm/serialization/types/DecisionsRequest.mjs +7 -0
- package/dist/esm/serialization/types/DecisionsResponse.d.mts +13 -0
- package/dist/esm/serialization/types/DecisionsResponse.mjs +9 -0
- package/dist/esm/serialization/types/ErrorCode.d.mts +7 -0
- package/dist/esm/serialization/types/ErrorCode.mjs +18 -0
- package/dist/esm/serialization/types/ErrorType.d.mts +7 -0
- package/dist/esm/serialization/types/ErrorType.mjs +3 -0
- package/dist/esm/serialization/types/Error_.d.mts +15 -0
- package/dist/esm/serialization/types/Error_.mjs +11 -0
- package/dist/esm/serialization/types/GatewayError.d.mts +10 -0
- package/dist/esm/serialization/types/GatewayError.mjs +6 -0
- package/dist/esm/serialization/types/InputTokensResponse.d.mts +9 -0
- package/dist/esm/serialization/types/InputTokensResponse.mjs +5 -0
- package/dist/esm/serialization/types/Moment.d.mts +11 -0
- package/dist/esm/serialization/types/Moment.mjs +7 -0
- package/dist/esm/serialization/types/MomentAnswer.d.mts +10 -0
- package/dist/esm/serialization/types/MomentAnswer.mjs +6 -0
- package/dist/esm/serialization/types/MomentQuestion.d.mts +9 -0
- package/dist/esm/serialization/types/MomentQuestion.mjs +5 -0
- package/dist/esm/serialization/types/NoulAnswer.d.mts +9 -0
- package/dist/esm/serialization/types/NoulAnswer.mjs +5 -0
- package/dist/esm/serialization/types/NoulCriteria.d.mts +10 -0
- package/dist/esm/serialization/types/NoulCriteria.mjs +6 -0
- package/dist/esm/serialization/types/NoulQuestion.d.mts +11 -0
- package/dist/esm/serialization/types/NoulQuestion.mjs +7 -0
- package/dist/esm/serialization/types/Question.d.mts +23 -0
- package/dist/esm/serialization/types/Question.mjs +17 -0
- package/dist/esm/serialization/types/Questions.d.mts +10 -0
- package/dist/esm/serialization/types/Questions.mjs +4 -0
- package/dist/esm/serialization/types/Received.d.mts +9 -0
- package/dist/esm/serialization/types/Received.mjs +5 -0
- package/dist/esm/serialization/types/Run.d.mts +18 -0
- package/dist/esm/serialization/types/Run.mjs +14 -0
- package/dist/esm/serialization/types/RunReceived.d.mts +10 -0
- package/dist/esm/serialization/types/RunReceived.mjs +6 -0
- package/dist/esm/serialization/types/RunStatus.d.mts +7 -0
- package/dist/esm/serialization/types/RunStatus.mjs +3 -0
- package/dist/esm/serialization/types/RunSummary.d.mts +16 -0
- package/dist/esm/serialization/types/RunSummary.mjs +12 -0
- package/dist/esm/serialization/types/RunsPage.d.mts +11 -0
- package/dist/esm/serialization/types/RunsPage.mjs +7 -0
- package/dist/esm/serialization/types/ScoreAnswer.d.mts +12 -0
- package/dist/esm/serialization/types/ScoreAnswer.mjs +8 -0
- package/dist/esm/serialization/types/ScoreQuestion.d.mts +10 -0
- package/dist/esm/serialization/types/ScoreQuestion.mjs +6 -0
- package/dist/esm/serialization/types/index.d.mts +28 -0
- package/dist/esm/serialization/types/index.mjs +28 -0
- package/dist/esm/version.d.mts +1 -0
- package/dist/esm/version.mjs +1 -0
- package/package.json +114 -8
- package/reference.md +327 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hume AI, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,412 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Audio Decisions TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The official TypeScript client for the [Audio Decisions API](https://dev.hume.ai/audio-decisions/docs/overview). The API answers questions about audio that you write in plain language. Send a recording with your questions, and each answer comes back as probabilities that estimate how human raters would respond, which your code can threshold, rank, or combine.
|
|
4
|
+
|
|
5
|
+
The SDK provides clients for the decisions and run endpoints, TypeScript types for every question, answer, and response, and API key authentication. It ships CommonJS and ES module builds.
|
|
6
|
+
|
|
7
|
+
1. [Documentation](https://dev.hume.ai/audio-decisions/docs/overview)
|
|
8
|
+
2. [TypeScript quickstart](https://dev.hume.ai/audio-decisions/docs/quickstart/typescript)
|
|
9
|
+
3. [Writing questions](https://dev.hume.ai/audio-decisions/docs/writing-questions)
|
|
10
|
+
4. [Primitives](https://dev.hume.ai/audio-decisions/docs/primitives)
|
|
11
|
+
5. [Interpreting answers](https://dev.hume.ai/audio-decisions/docs/interpreting-answers)
|
|
12
|
+
6. [Runs guide](https://dev.hume.ai/audio-decisions/docs/runs)
|
|
13
|
+
7. [Cookbooks](https://dev.hume.ai/audio-decisions/cookbooks/overview)
|
|
14
|
+
8. [API reference](https://dev.hume.ai/audio-decisions/reference)
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
Node.js 18 or later.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @humeai/audio-decisions
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Authentication
|
|
27
|
+
|
|
28
|
+
Every request carries your API key in the `X-Hume-Api-Key` header. Pass the key to the client, or set the `HUME_API_KEY` environment variable and construct the client without arguments.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { DecisionsClient } from "@humeai/audio-decisions";
|
|
32
|
+
|
|
33
|
+
const client = new DecisionsClient({ apiKey: "YOUR_API_KEY" });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Keep API keys on a server. To use the API from a web page, relay through your server. See [Authentication](https://dev.hume.ai/audio-decisions/docs/authentication).
|
|
37
|
+
|
|
38
|
+
## Preparing audio
|
|
39
|
+
|
|
40
|
+
Each request takes one MP3 or WAV file up to 5 minutes long. Send one request per recording, and split a longer recording as described in [Long recordings](#long-recordings).
|
|
41
|
+
|
|
42
|
+
The model hears audio at 16 kHz in one channel: the API resamples every file and mixes its channels into one before the model processes it. To make uploads smaller, the SDK does the same to a WAV file before sending it, in `create` and in the chunked methods. Resampled audio is written as 32-bit floating point, the format the API converts every file to, so loud audio is not clipped. `downmixStrategy` sets how:
|
|
43
|
+
|
|
44
|
+
1. `"mix"`, the default, resamples audio above 16 kHz to 16 kHz and mixes two channels into one the way the API does, so the model hears the same audio apart from rounding. A file that this would not make smaller, such as 16-bit mono at 16 kHz, is sent as it is, and so is a file with more than two channels, or with two channels its header places anywhere but front left and front right, because the API weighs those channels by the speaker positions the header declares.
|
|
45
|
+
2. `"first_channel"` keeps only the first channel of a file with more than one. The channel is copied exactly in the file's own sample format when that is no larger than resampling it, as it is at 16 kHz or below for every sample format but 64-bit floating point, and is otherwise converted the same way as by `"mix"`. Use it to judge one speaker of a call who is on the first channel; for any other channel, send that channel as its own file.
|
|
46
|
+
3. `"none"` sends the file as it is.
|
|
47
|
+
|
|
48
|
+
MP3 files and WAV files the SDK cannot read, such as compressed WAV, are always sent as they are. Unless `downmixStrategy` is `"none"`, `create` reads the whole file into memory before sending it.
|
|
49
|
+
|
|
50
|
+
## Quickstart
|
|
51
|
+
|
|
52
|
+
This request asks two questions about a simulated call with a voice AI agent: whether the agent talks over the caller, and how natural the agent sounds on a five-point scale.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { DecisionsClient } from "@humeai/audio-decisions";
|
|
56
|
+
|
|
57
|
+
const client = new DecisionsClient();
|
|
58
|
+
|
|
59
|
+
const response = await client.decisions.create({
|
|
60
|
+
file: { path: "test_call.wav", contentType: "audio/wav" },
|
|
61
|
+
request: {
|
|
62
|
+
context: "A simulated test call in which a voice AI agent helps a caller reschedule an appointment. Both voices are synthetic, and the agent speaks first.",
|
|
63
|
+
questions: {
|
|
64
|
+
talks_over_caller: {
|
|
65
|
+
type: "noul",
|
|
66
|
+
instructions: "Does the agent talk over the caller?",
|
|
67
|
+
},
|
|
68
|
+
agent_naturalness: {
|
|
69
|
+
type: "score",
|
|
70
|
+
instructions: "How natural does the agent sound?",
|
|
71
|
+
criteria: ["Not at all", "2", "3", "4", "Extremely"],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
for (const [questionId, answer] of Object.entries(response.answers)) {
|
|
78
|
+
switch (answer.type) {
|
|
79
|
+
case "noul":
|
|
80
|
+
console.log(`${questionId}: ${Math.round(answer.noul * 100)}% of raters would answer yes`);
|
|
81
|
+
break;
|
|
82
|
+
case "score": {
|
|
83
|
+
const [mostLikely] = Object.entries(answer.probabilities).reduce((top, level) => (level[1] > top[1] ? level : top));
|
|
84
|
+
console.log(`${questionId}: mean level ${answer.score.toFixed(2)}, most often "${answer.legend[mostLikely]}"`);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`contentType` labels the file part; for an MP3 file, pass `audio/mpeg`. The response returns each answer under the ID you gave its question, with the `runId` of the model run that produced the answers. A probability estimates the share of human raters who would give that answer, so a `noul` near 0.5 means raters would split on the audio, not that the model is unsure. `score` is the mean level, counted from 0, and `legend` maps each level index back to the text you gave it. The [TypeScript quickstart](https://dev.hume.ai/audio-decisions/docs/quickstart/typescript) walks through the request and the response.
|
|
92
|
+
|
|
93
|
+
## Questions
|
|
94
|
+
|
|
95
|
+
Each question is keyed by an ID you choose, and its `type` names its primitive, which sets the `criteria` it takes and the form of its answer. One request can mix primitives.
|
|
96
|
+
|
|
97
|
+
| Primitive | Asks | `criteria` |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `noul` | Whether something is true of the audio. | Optional. What counts as `true` and as `false`. |
|
|
100
|
+
| `choice` | Which of several options applies. | Two or more options, each with a unique `name` and an optional `description`. |
|
|
101
|
+
| `score` | Where the audio falls on an ordered scale. | Two or more levels, from lowest to highest. |
|
|
102
|
+
| `span` | When an event occurs. | None. |
|
|
103
|
+
|
|
104
|
+
Request and response types are exported under the `Decisions` namespace.
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import type { Decisions } from "@humeai/audio-decisions";
|
|
108
|
+
|
|
109
|
+
const request: Decisions.DecisionsRequest = {
|
|
110
|
+
context: "A simulated test call in which a voice AI agent helps a caller reschedule an appointment. Both voices are synthetic, and the agent speaks first.",
|
|
111
|
+
questions: {
|
|
112
|
+
talks_over_caller: {
|
|
113
|
+
type: "noul",
|
|
114
|
+
instructions: "Does the agent talk over the caller?",
|
|
115
|
+
},
|
|
116
|
+
interruptions: {
|
|
117
|
+
type: "span",
|
|
118
|
+
instructions: "When does the agent interrupt the caller?",
|
|
119
|
+
},
|
|
120
|
+
agent_naturalness: {
|
|
121
|
+
type: "score",
|
|
122
|
+
instructions: "How natural does the agent sound?",
|
|
123
|
+
criteria: ["Not at all", "2", "3", "4", "Extremely"],
|
|
124
|
+
},
|
|
125
|
+
agent_tone: {
|
|
126
|
+
type: "choice",
|
|
127
|
+
instructions: "Which best describes the tone of the agent?",
|
|
128
|
+
criteria: [
|
|
129
|
+
{ name: "warm", description: "Warm and friendly toward the caller" },
|
|
130
|
+
{ name: "neutral", description: "Polite but impersonal" },
|
|
131
|
+
{ name: "curt", description: "Short or dismissive with the caller" },
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
All the questions in a request are answered in one model inference, so an answer can change when other questions are added, removed, or reordered. Ask every question about a recording in one request, and to compare answers across recordings, send the same questions in the same order. [Writing questions](https://dev.hume.ai/audio-decisions/docs/writing-questions) covers how to word instructions and criteria.
|
|
139
|
+
|
|
140
|
+
## Reading answers
|
|
141
|
+
|
|
142
|
+
`response.answers` maps each question ID to an answer whose `type` matches the question's primitive, and checking `type` in a `switch` narrows the answer to that primitive's fields.
|
|
143
|
+
|
|
144
|
+
| `type` | Fields |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `noul` | `noul`, the share of raters who would answer yes. |
|
|
147
|
+
| `choice` | `choice`, the option most raters would choose; `probabilities`, keyed by option name; and `confidence`. |
|
|
148
|
+
| `score` | `score`, the mean level; `probabilities` and `legend`, keyed by level index as a string; and `confidence`. |
|
|
149
|
+
| `span` | `spans`, each with `audioStartMs`, `audioEndMs`, and `probability`. An empty list means the event was not found. |
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
for (const [questionId, answer] of Object.entries(response.answers)) {
|
|
153
|
+
switch (answer.type) {
|
|
154
|
+
case "noul":
|
|
155
|
+
console.log(`${questionId}: ${answer.noul.toFixed(2)}`);
|
|
156
|
+
break;
|
|
157
|
+
case "choice":
|
|
158
|
+
console.log(`${questionId}: ${answer.choice}, confidence ${answer.confidence.toFixed(2)}`);
|
|
159
|
+
break;
|
|
160
|
+
case "score":
|
|
161
|
+
console.log(`${questionId}: ${answer.score.toFixed(2)} of ${Object.keys(answer.legend).length - 1}, confidence ${answer.confidence.toFixed(2)}`);
|
|
162
|
+
break;
|
|
163
|
+
case "span":
|
|
164
|
+
for (const span of answer.spans) {
|
|
165
|
+
console.log(`${questionId}: ${span.audioStartMs} to ${span.audioEndMs} ms, ${span.probability.toFixed(2)}`);
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`confidence` measures how much raters would agree, not how certain the model is. A `span` answer gives times but no share of raters, so to ask whether an event occurs as well as when, add a `noul` question. [Primitives](https://dev.hume.ai/audio-decisions/docs/primitives) defines every field, and [Interpreting answers](https://dev.hume.ai/audio-decisions/docs/interpreting-answers) covers setting thresholds for acting on them.
|
|
173
|
+
|
|
174
|
+
## Counting input tokens
|
|
175
|
+
|
|
176
|
+
`decisions.inputTokens` counts the input tokens a decisions request would be billed for, from its context, its questions, and the duration of its audio. It takes no audio file, so you can count a request before sending it.
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
const count = await client.decisions.inputTokens({
|
|
180
|
+
audioDurationMs: 135_000,
|
|
181
|
+
context: request.context,
|
|
182
|
+
questions: request.questions,
|
|
183
|
+
});
|
|
184
|
+
console.log(`${count.inputTokens} input tokens`);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`audioDurationMs` is the duration of the file the request would send. A duration over 5 minutes is rejected with `audio_too_long`, so count a long recording one chunk at a time; each chunk is billed as its own request.
|
|
188
|
+
|
|
189
|
+
## Long recordings
|
|
190
|
+
|
|
191
|
+
`decisions.createChunked` cuts a recording into chunks no longer than `maxChunkMs` and sends each chunk in its own `create` request, one at a time and in order, with the same questions, context, and request options. The model hears only the chunk it answers about, and each chunk gets its own response, `runId`, and bill. Nothing combines the answers across chunks.
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { DecisionsClient } from "@humeai/audio-decisions";
|
|
195
|
+
|
|
196
|
+
const client = new DecisionsClient();
|
|
197
|
+
|
|
198
|
+
const result = await client.decisions.createChunked({
|
|
199
|
+
file: { path: "long_call.wav", contentType: "audio/wav" },
|
|
200
|
+
request: {
|
|
201
|
+
context: "A call in which a voice AI agent helps a caller reschedule an appointment.",
|
|
202
|
+
questions: {
|
|
203
|
+
agent_glitches: {
|
|
204
|
+
type: "moment",
|
|
205
|
+
instructions: "Where does the agent glitch, slur or sound robotic?",
|
|
206
|
+
},
|
|
207
|
+
talks_over_caller: {
|
|
208
|
+
type: "noul",
|
|
209
|
+
instructions: "Does the agent talk over the caller?",
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
maxChunkMs: 300_000,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
for (const chunk of result.chunks) {
|
|
217
|
+
if (chunk.status !== "succeeded") {
|
|
218
|
+
console.log(`chunk ${chunk.index} (${chunk.startMs} to ${chunk.endMs} ms): ${chunk.status}, ${chunk.error}`);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const answer = chunk.response.answers.agent_glitches;
|
|
222
|
+
if (answer.type === "moment") {
|
|
223
|
+
for (const moment of answer.moments) {
|
|
224
|
+
// Moments are measured from the start of the chunk.
|
|
225
|
+
console.log(`${chunk.startMs + moment.audioStartMs} to ${chunk.startMs + moment.audioEndMs} ms`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Each chunk's `startMs` and `endMs` give where it starts and ends in the recording, so add its `startMs` to a moment's times to place the moment in the recording. Pass `startMs` and `endMs` to `createChunked` to send only part of the recording.
|
|
232
|
+
|
|
233
|
+
### Chunk length
|
|
234
|
+
|
|
235
|
+
`maxChunkMs` has no default, because it decides how many requests the job sends, and each request is billed for its own audio, context, and questions.
|
|
236
|
+
|
|
237
|
+
1. Use 300000, the longest chunk the API accepts, for the fewest requests.
|
|
238
|
+
2. Use shorter chunks for answers about shorter stretches of the call. A `noul` or `score` answer describes its whole chunk, so with 60000 ms chunks each answer covers at most one minute.
|
|
239
|
+
|
|
240
|
+
By default, the recording is cut into the fewest chunks that fit, of equal length, so the last chunk is not a short remainder: a 32-minute call at 300000 ms becomes 7 chunks of about 4 minutes 34 seconds, not 6 of 5 minutes and 1 of 2 minutes. Pass `split: "fixed"` when chunks must be the same length in every recording, for example to count per 5 minutes across calls. Every chunk is then `maxChunkMs` long except the last, which holds what remains and is billed like any other.
|
|
241
|
+
|
|
242
|
+
A WAV recording takes its duration divided by `maxChunkMs` requests, rounded up: a 32-minute call takes 7 at 300000 ms and 32 at 60000 ms. Each chunk must also fit the API's limit of 25,000,000 bytes per request. With the default `downmixStrategy`, 5 minutes of mono or stereo WAV always fits. A file that does not fit is cut into shorter chunks that do, so 16-bit stereo sent with `downmixStrategy: "none"` is cut into chunks of at most 136054 ms at 44.1 kHz and 124999 ms at 48 kHz. With `split: "fixed"`, `createChunked` instead rejects with a `RangeError` naming the largest `maxChunkMs` that fits, before it sends anything.
|
|
243
|
+
|
|
244
|
+
An MP3 recording can take more requests, because each chunk repeats a little audio from the chunk before, as described under [Where cuts fall](#where-cuts-fall). At 300000 ms this adds at most one request for recordings shorter than several hours, and only when the recording is at or just under a multiple of 5 minutes. Shorter chunks lose a larger share to repeated audio, so they can add several.
|
|
245
|
+
|
|
246
|
+
### Writing questions for chunks
|
|
247
|
+
|
|
248
|
+
The model answers about each chunk as if it were the whole recording, so write the context and questions to hold for any part of the call:
|
|
249
|
+
|
|
250
|
+
1. Describe in the context what is true throughout the call, such as who is speaking and what the call is for. A detail about one part of the call, such as "the agent speaks first", is true of the first chunk only, and in every other chunk it describes audio the model cannot hear.
|
|
251
|
+
2. Ask about what can be heard within a single chunk. "Does the agent talk over the caller?" can be answered from any stretch of the call. "Is the caller's appointment rescheduled by the end of the call?" cannot, because the end of the call is in only one chunk.
|
|
252
|
+
|
|
253
|
+
### Combining answers
|
|
254
|
+
|
|
255
|
+
The answers are not combined for you, because the right way to combine them depends on the question. To ask whether something happens anywhere in the call, take the highest `noul` across the chunks:
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
if (result.complete) {
|
|
259
|
+
const nouls = result.responses.flatMap((response) => {
|
|
260
|
+
const answer = response?.answers.talks_over_caller;
|
|
261
|
+
return answer?.type === "noul" ? [answer.noul] : [];
|
|
262
|
+
});
|
|
263
|
+
const highest = Math.max(...nouls);
|
|
264
|
+
console.log(`In the chunk most likely to show it, ${Math.round(highest * 100)}% of raters would say the agent talks over the caller.`);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
To ask how much of the call something describes, count the chunks whose `noul` passes a threshold instead. A `moment` answer needs no combining once its times are placed in the recording.
|
|
269
|
+
|
|
270
|
+
### Where cuts fall
|
|
271
|
+
|
|
272
|
+
1. A WAV file is cut between samples, after it is mixed down.
|
|
273
|
+
2. An MP3 file is cut between frames, without being decoded, so chunks can differ in length by a frame or more; a frame lasts 24 to 72 ms. A frame can depend on the frames before it, so every chunk after the first starts with frames repeated from the end of the chunk before, usually a fraction of a second and up to about 2 seconds at the lowest bitrates. They count toward `maxChunkMs` and are included in the chunk's `startMs`, so a moment near a cut can appear in both chunks. Most MP3 files also start with a few tens of milliseconds of silence that the encoder added and players skip. Times are measured from where a player starts the file, so the first chunk's `startMs` can be below 0.
|
|
274
|
+
|
|
275
|
+
In both formats, an event that crosses a cut, such as the agent talking over the caller for a second or two around it, is heard in part by each chunk. A `moment` question can return it as two shorter moments, as one that ends or starts at the cut, or not at all, and a `noul` answer about it can come out lower in both chunks than for audio that holds the whole event. The frames an MP3 chunk repeats are there so it can be decoded, and cannot be relied on to cover an event at a cut.
|
|
276
|
+
|
|
277
|
+
### Failures and resuming
|
|
278
|
+
|
|
279
|
+
A request the API rejects, or whose connection fails, does not reject. Its error is recorded on the chunk, and `createChunked` resolves with the responses it received, so check `result.complete` before relying on the result.
|
|
280
|
+
|
|
281
|
+
1. A chunk whose audio cannot be decoded (`audio_decode_failed`) fails on its own, and the remaining chunks are still sent, as long as an earlier chunk succeeded. Until one has, the whole file is the likely cause, so the job stops.
|
|
282
|
+
2. Any other error stops the job, such as running out of tokens (402), an invalid request, or a dropped connection. The chunks after it have the status `"not_attempted"`: no request was sent for them, so they were not billed.
|
|
283
|
+
3. Rate limits and server errors are retried first, as for any request, so they stop the job only once the retries run out. Pass `maxRetries` in the request options to allow more.
|
|
284
|
+
4. Aborting the `abortSignal` in the request options is not recorded on a chunk. `createChunked` rejects with the same `DecisionsError` as an aborted `create`, no further chunk is sent, and the responses already received are lost, so use `iterCreateChunked` to keep them.
|
|
285
|
+
|
|
286
|
+
To resume a job that stopped, call `createChunked` again with `startMs: result.resumeMs` and the same `endMs`. `resumeMs` is where the chunk before the one that stopped the job ends, or undefined when no chunk stopped the job. The new job sends the audio of the chunk that stopped the job and everything after it, in no more chunks than the stopped job had left. It does not resend earlier chunks that failed because their audio could not be decoded, so its `complete` covers only the range it sent. With the default `split: "even"`, its cuts after the first chunk can fall a few MP3 frames or a millisecond of WAV from the stopped job's. A WAV chunk's `startMs` is rounded to the millisecond, so the resumed job can skip or repeat a few samples where it starts.
|
|
287
|
+
|
|
288
|
+
### Memory
|
|
289
|
+
|
|
290
|
+
The whole recording is read into memory, and a WAV file is mixed down, before the first request, so a file that cannot be split is rejected before anything is billed, with an `UnsupportedAudioError` from `@humeai/audio-decisions/audio-helpers` when it is empty or not a supported MP3 or WAV file. An hour of 16-bit stereo WAV at 48 kHz is about 690 MB, plus about 230 MB for the mixed-down copy.
|
|
291
|
+
|
|
292
|
+
### Saving results as they arrive
|
|
293
|
+
|
|
294
|
+
`createChunked` resolves only once every chunk is done, so if your process stops partway through a long job, the responses it received are lost, although they were billed. `decisions.iterCreateChunked` cuts and sends the chunks the same way, but yields each chunk's result as soon as its request is done, so you can save each response before the next chunk is sent:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { writeFile } from "node:fs/promises";
|
|
298
|
+
import { DecisionsClient } from "@humeai/audio-decisions";
|
|
299
|
+
|
|
300
|
+
const client = new DecisionsClient();
|
|
301
|
+
|
|
302
|
+
for await (const chunk of client.decisions.iterCreateChunked({
|
|
303
|
+
file: { path: "long_call.wav", contentType: "audio/wav" },
|
|
304
|
+
request: {
|
|
305
|
+
questions: {
|
|
306
|
+
agent_glitches: {
|
|
307
|
+
type: "moment",
|
|
308
|
+
instructions: "Where does the agent glitch, slur or sound robotic?",
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
maxChunkMs: 300_000,
|
|
313
|
+
})) {
|
|
314
|
+
if (chunk.status === "succeeded") {
|
|
315
|
+
await writeFile(`chunk_${chunk.index}_${chunk.startMs}.json`, JSON.stringify(chunk.response));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
`iterCreateChunked` checks its options when it is called, but reads the recording only when iteration starts, so a stream passed as `file` must stay open until then.
|
|
321
|
+
|
|
322
|
+
To resume such a job, keep the results it yields.
|
|
323
|
+
|
|
324
|
+
1. When a chunk stopped the job, `new ChunkedDecisionsResult(results, startMs).resumeMs` gives where to resume, with `ChunkedDecisionsResult` from `@humeai/audio-decisions/audio-helpers` and the `startMs` the job was given.
|
|
325
|
+
2. When your process stopped instead, `resumeMs` is undefined. Resume at the `endMs` of the last chunk you have a result for, not at the `startMs` of the chunk after it, which for an MP3 file includes frames repeated from the chunk you already have.
|
|
326
|
+
|
|
327
|
+
In both cases, pass the same `endMs` as the job that stopped. Chunks that failed because their audio could not be decoded are not sent again, including the last chunk you have a result for, so check your saved results for them.
|
|
328
|
+
|
|
329
|
+
### Sending chunks yourself
|
|
330
|
+
|
|
331
|
+
`iterAudioChunks` in `@humeai/audio-decisions/audio-helpers` cuts a recording the same way, mixdown included, and yields each chunk's bytes with its `startMs` and `endMs`. Use it to send chunks some other way, such as several at a time:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { type Decisions, DecisionsClient } from "@humeai/audio-decisions";
|
|
335
|
+
import { type AudioChunk, iterAudioChunks } from "@humeai/audio-decisions/audio-helpers";
|
|
336
|
+
|
|
337
|
+
const client = new DecisionsClient();
|
|
338
|
+
|
|
339
|
+
const chunks: AudioChunk[] = [];
|
|
340
|
+
for await (const chunk of iterAudioChunks({ path: "long_call.wav" }, { maxChunkMs: 300_000 })) {
|
|
341
|
+
chunks.push(chunk);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const results: PromiseSettledResult<Decisions.DecisionsResponse>[] = [];
|
|
345
|
+
for (let first = 0; first < chunks.length; first += 4) {
|
|
346
|
+
const batch = chunks.slice(first, first + 4).map((chunk) =>
|
|
347
|
+
client.decisions.create({
|
|
348
|
+
file: { data: chunk.data, filename: "chunk.wav", contentType: "audio/wav" },
|
|
349
|
+
request,
|
|
350
|
+
// The chunk is already mixed down, so it is sent as it is.
|
|
351
|
+
downmixStrategy: "none",
|
|
352
|
+
}),
|
|
353
|
+
);
|
|
354
|
+
results.push(...(await Promise.allSettled(batch)));
|
|
355
|
+
}
|
|
356
|
+
for (const chunk of chunks) {
|
|
357
|
+
console.log(chunk.index, chunk.startMs, results[chunk.index]);
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Sending several chunks at once reaches rate limits sooner, and a failure does not stop the requests already in flight, which are still billed. `createChunked` sends one chunk at a time for these reasons.
|
|
362
|
+
|
|
363
|
+
### In a browser
|
|
364
|
+
|
|
365
|
+
The audio helpers import no Node.js modules, so `iterAudioChunks` can also cut a recording in a web page, for example before uploading each chunk to your server, which sends it to the API with your key. Pass the recording as a `File` or `Blob`, such as one from a file input; `{ path }` reads from the file system, which browsers do not offer. The mixdown runs on the page's main thread and pauses regularly to let the page handle other events. The recording and its mixed-down copy are both held in the page's memory, as described under [Memory](#memory).
|
|
366
|
+
|
|
367
|
+
## Runs
|
|
368
|
+
|
|
369
|
+
Every successful decisions request is recorded as a run, identified by the `runId` of its response. The run endpoints return a run's status, when it started and ended, and the request it evaluated. They do not return answers, so keep the answers you need from the response.
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
import { DecisionsClient } from "@humeai/audio-decisions";
|
|
373
|
+
|
|
374
|
+
const client = new DecisionsClient();
|
|
375
|
+
|
|
376
|
+
const page = await client.runs.list({ status: "ended", pageSize: 20 });
|
|
377
|
+
for (const summary of page.runs) {
|
|
378
|
+
console.log(summary.runId, summary.status, summary.startedAt.toISOString());
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const run = await client.runs.get({ runId: "019a1f3c-7d2e-7b41-9c58-2e6f4a1d8b03" });
|
|
382
|
+
console.log(run.status, Object.keys(run.request.questions));
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`runs.list` returns your organization's runs, newest first, one page at a time, and filters by `userId`, `status`, `startedAfter`, and `startedBefore`. Pass a page's `nextCursor` back as `cursor`, with the same filters, to fetch the next one; the last page has none. The [runs guide](https://dev.hume.ai/audio-decisions/docs/runs) covers run status and the filters.
|
|
386
|
+
|
|
387
|
+
## Errors
|
|
388
|
+
|
|
389
|
+
The client methods reject with a `DecisionsError` when a request fails. `statusCode` holds the HTTP status, and `body` holds the error body, whose `code` says what went wrong and whose `param` points to the field it concerns, when there is one. A `401` body has no `code`; it carries a `message` and, when an API key was rejected, a `requestId`.
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
import { DecisionsError } from "@humeai/audio-decisions";
|
|
393
|
+
|
|
394
|
+
try {
|
|
395
|
+
await client.decisions.create({ file: { path: "test_call.wav", contentType: "audio/wav" }, request });
|
|
396
|
+
} catch (error) {
|
|
397
|
+
if (!(error instanceof DecisionsError)) throw error;
|
|
398
|
+
console.error(`${error.statusCode}: ${JSON.stringify(error.body)}`);
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
The client retries a request that fails with a 408, 429, or 5xx status up to 2 times, waiting as long as the response's `Retry-After` header asks when it has one. Pass `maxRetries` to the client, or in the request options for one request, to change the limit. Requests time out after 60 seconds unless you pass a different `timeoutInSeconds` the same way.
|
|
403
|
+
|
|
404
|
+
[Errors](https://dev.hume.ai/audio-decisions/docs/errors) lists every code and whether to retry.
|
|
405
|
+
|
|
406
|
+
## Contributing
|
|
407
|
+
|
|
408
|
+
Most of this SDK is generated by [Fern](https://buildwithfern.com) from the API definition, and edits to generated files are overwritten on the next generation. [CONTRIBUTING.md](https://github.com/HumeAI/hume-audio-decisions-typescript-sdk/blob/main/CONTRIBUTING.md) explains how to build and test the project and how to add code that persists across regenerations. To report a problem, open an issue in this repository.
|
|
409
|
+
|
|
410
|
+
## License
|
|
411
|
+
|
|
412
|
+
MIT
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js";
|
|
2
|
+
import * as core from "./core/index.js";
|
|
3
|
+
import type * as environments from "./environments.js";
|
|
4
|
+
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | HeaderAuthProvider.AuthOptions;
|
|
5
|
+
export type BaseClientOptions = {
|
|
6
|
+
environment?: core.Supplier<environments.DecisionsEnvironment | string>;
|
|
7
|
+
/** Specify a custom URL to connect the client to. */
|
|
8
|
+
baseUrl?: core.Supplier<string>;
|
|
9
|
+
/** Additional headers to include in requests. */
|
|
10
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
11
|
+
/** The default maximum time to wait for a response in seconds. */
|
|
12
|
+
timeoutInSeconds?: number;
|
|
13
|
+
/** The default number of times to retry the request. Defaults to 2. */
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
/** Configure logging for the client. */
|
|
18
|
+
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
19
|
+
/** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
|
|
20
|
+
stream?: {
|
|
21
|
+
reconnectionEnabled?: boolean;
|
|
22
|
+
maxReconnectionAttempts?: number;
|
|
23
|
+
};
|
|
24
|
+
/** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
|
|
25
|
+
auth?: AuthOption;
|
|
26
|
+
} & HeaderAuthProvider.AuthOptions;
|
|
27
|
+
export interface BaseRequestOptions {
|
|
28
|
+
/** The maximum time to wait for a response in seconds. */
|
|
29
|
+
timeoutInSeconds?: number;
|
|
30
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
31
|
+
maxRetries?: number;
|
|
32
|
+
/** A hook to abort the request. */
|
|
33
|
+
abortSignal?: AbortSignal;
|
|
34
|
+
/** Additional query string parameters to include in the request. */
|
|
35
|
+
queryParams?: Record<string, unknown>;
|
|
36
|
+
/** A dictionary containing additional parameters to spread into the request's body. */
|
|
37
|
+
additionalBodyParameters?: Record<string, unknown>;
|
|
38
|
+
/** Additional headers to include in the request. */
|
|
39
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
40
|
+
/** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
|
|
41
|
+
stream?: {
|
|
42
|
+
reconnectionEnabled?: boolean;
|
|
43
|
+
maxReconnectionAttempts?: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
47
|
+
logging: core.logging.Logger;
|
|
48
|
+
authProvider?: core.AuthProvider;
|
|
49
|
+
};
|
|
50
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
51
|
+
authProvider: core.AuthProvider;
|
|
52
|
+
};
|
|
53
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
54
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.normalizeClientOptions = normalizeClientOptions;
|
|
38
|
+
exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
|
|
39
|
+
const HeaderAuthProvider_js_1 = require("./auth/HeaderAuthProvider.js");
|
|
40
|
+
const headers_js_1 = require("./core/headers.js");
|
|
41
|
+
const core = __importStar(require("./core/index.js"));
|
|
42
|
+
function normalizeClientOptions(options) {
|
|
43
|
+
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
|
+
"X-Fern-Language": "JavaScript",
|
|
45
|
+
"X-Fern-SDK-Name": "@humeai/audio-decisions",
|
|
46
|
+
"X-Fern-SDK-Version": "0.1.0",
|
|
47
|
+
"User-Agent": "@humeai/audio-decisions/0.1.0",
|
|
48
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
|
+
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
51
|
+
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
52
|
+
}
|
|
53
|
+
function normalizeClientOptionsWithAuth(options) {
|
|
54
|
+
var _a;
|
|
55
|
+
const normalized = normalizeClientOptions(options);
|
|
56
|
+
if (options.auth === false) {
|
|
57
|
+
normalized.authProvider = new core.NoOpAuthProvider();
|
|
58
|
+
return normalized;
|
|
59
|
+
}
|
|
60
|
+
if (options.auth != null) {
|
|
61
|
+
if (typeof options.auth === "function") {
|
|
62
|
+
normalized.authProvider = { getAuthRequest: options.auth };
|
|
63
|
+
return normalized;
|
|
64
|
+
}
|
|
65
|
+
if (core.isAuthProvider(options.auth)) {
|
|
66
|
+
normalized.authProvider = options.auth;
|
|
67
|
+
return normalized;
|
|
68
|
+
}
|
|
69
|
+
Object.assign(normalized, options.auth);
|
|
70
|
+
}
|
|
71
|
+
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
|
|
72
|
+
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider_js_1.HeaderAuthProvider(normalizedWithNoOpAuthProvider));
|
|
73
|
+
return normalized;
|
|
74
|
+
}
|
|
75
|
+
function withNoOpAuthProvider(options) {
|
|
76
|
+
return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
|
|
77
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DecisionsClient as DecisionsClient_ } from "./api/resources/decisions/client/Client.js";
|
|
2
|
+
import { RunsClient } from "./api/resources/runs/client/Client.js";
|
|
3
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
4
|
+
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
5
|
+
import * as core from "./core/index.js";
|
|
6
|
+
export declare namespace DecisionsClient {
|
|
7
|
+
type Options = BaseClientOptions;
|
|
8
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare class DecisionsClient {
|
|
12
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<DecisionsClient.Options>;
|
|
13
|
+
protected _decisions: DecisionsClient_ | undefined;
|
|
14
|
+
protected _runs: RunsClient | undefined;
|
|
15
|
+
constructor(options?: DecisionsClient.Options);
|
|
16
|
+
get decisions(): DecisionsClient_;
|
|
17
|
+
get runs(): RunsClient;
|
|
18
|
+
/**
|
|
19
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
20
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
21
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
22
|
+
*
|
|
23
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
24
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
25
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
26
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
27
|
+
*/
|
|
28
|
+
fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
|
|
29
|
+
}
|