From 0ff12c8c5b2609cef81cc0c35695aa918abbe975 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:49:41 +0000 Subject: [PATCH] Release 0.0.1 --- .fernignore | 1 + .github/workflows/ci.yml | 55 + .gitignore | 3 + .mock/definition/__package__.yml | 2544 +++++++ .mock/definition/api.yml | 14 + .mock/definition/datasets.yml | 807 +++ .mock/definition/directories.yml | 200 + .mock/definition/evaluations.yml | 589 ++ .mock/definition/evaluators.yml | 943 +++ .mock/definition/logs.yml | 270 + .mock/definition/prompts.yml | 1443 ++++ .mock/definition/sessions.yml | 165 + .mock/definition/tools.yml | 864 +++ .mock/fern.config.json | 4 + .npmignore | 9 + .prettierrc.yml | 2 + README.md | 161 + jest.config.js | 5 + package.json | 33 + reference.md | 6156 +++++++++++++++++ src/Client.ts | 80 + src/api/errors/UnprocessableEntityError.ts | 17 + src/api/errors/index.ts | 1 + src/api/index.ts | 3 + src/api/resources/datasets/client/Client.ts | 1160 ++++ src/api/resources/datasets/client/index.ts | 1 + .../BodyDatasetsCreateDatapointsFromLogs.ts | 25 + .../client/requests/DatasetsGetRequest.ts | 22 + .../requests/DatasetsListDatapointsRequest.ts | 26 + .../client/requests/DatasetsListRequest.ts | 36 + .../requests/DatasetsListVersionsRequest.ts | 21 + .../client/requests/DatasetsRequest.ts | 40 + ...sIdEnvironmentsEnvironmentIdPostRequest.ts | 16 + .../client/requests/UpdateDatasetRequest.ts | 14 + .../datasets/client/requests/index.ts | 8 + src/api/resources/datasets/index.ts | 1 + .../resources/directories/client/Client.ts | 424 ++ src/api/resources/directories/client/index.ts | 1 + .../client/requests/CreateDirectoryRequest.ts | 17 + .../client/requests/UpdateDirectoryRequest.ts | 14 + .../directories/client/requests/index.ts | 2 + src/api/resources/directories/index.ts | 1 + .../resources/evaluations/client/Client.ts | 652 ++ src/api/resources/evaluations/client/index.ts | 1 + .../client/requests/EvaluationsListRequest.ts | 24 + .../requests/UpdateEvaluationStatusRequest.ts | 15 + .../evaluations/client/requests/index.ts | 2 + src/api/resources/evaluations/index.ts | 1 + src/api/resources/evaluators/client/Client.ts | 1069 +++ src/api/resources/evaluators/client/index.ts | 1 + ...sIdEnvironmentsEnvironmentIdPostRequest.ts | 16 + .../client/requests/EvaluatorsGetRequest.ts | 18 + .../client/requests/EvaluatorsListRequest.ts | 36 + .../requests/EvaluatorsListVersionsRequest.ts | 21 + .../client/requests/EvaluatorsRequest.ts | 24 + .../requests/RunSyncEvaluationRequest.ts | 29 + .../client/requests/UpdateEvaluatorRequest.ts | 14 + .../evaluators/client/requests/index.ts | 7 + src/api/resources/evaluators/index.ts | 2 + .../RunSyncEvaluationRequestEvaluator.ts | 10 + ...pModelsV5EvaluatorsEvaluatorRequestSpec.ts | 10 + src/api/resources/evaluators/types/index.ts | 2 + src/api/resources/index.ts | 18 + src/api/resources/logs/client/Client.ts | 325 + src/api/resources/logs/client/index.ts | 1 + .../requests/ListLogsForFileLogsGetRequest.ts | 50 + .../logs/client/requests/LogsDeleteRequest.ts | 16 + .../resources/logs/client/requests/index.ts | 2 + src/api/resources/logs/index.ts | 1 + src/api/resources/prompts/client/Client.ts | 1217 ++++ src/api/resources/prompts/client/index.ts | 1 + ...sIdEnvironmentsEnvironmentIdPostRequest.ts | 16 + .../client/requests/PromptCallRequest.ts | 68 + .../client/requests/PromptLogRequest.ts | 82 + .../prompts/client/requests/PromptRequest.ts | 50 + .../client/requests/PromptsGetRequest.ts | 18 + .../requests/PromptsListPromptsRequest.ts | 36 + .../requests/PromptsListVersionsRequest.ts | 21 + .../client/requests/UpdatePromptRequest.ts | 14 + .../prompts/client/requests/index.ts | 8 + src/api/resources/prompts/index.ts | 2 + .../types/PromptCallRequestToolChoice.ts | 15 + .../types/PromptLogRequestToolChoice.ts | 15 + .../prompts/types/PromptRequestStop.ts | 8 + .../prompts/types/PromptRequestTemplate.ts | 10 + .../prompts/types/PromptsCallResponse.ts | 7 + src/api/resources/prompts/types/index.ts | 5 + src/api/resources/sessions/client/Client.ts | 291 + src/api/resources/sessions/client/index.ts | 1 + .../client/requests/SessionsListRequest.ts | 26 + .../sessions/client/requests/index.ts | 1 + src/api/resources/sessions/index.ts | 1 + src/api/resources/tools/client/Client.ts | 1089 +++ src/api/resources/tools/client/index.ts | 1 + ...sIdEnvironmentsEnvironmentIdPostRequest.ts | 16 + .../tools/client/requests/ToolLogRequest.ts | 60 + .../tools/client/requests/ToolRequest.ts | 26 + .../tools/client/requests/ToolsGetRequest.ts | 18 + .../tools/client/requests/ToolsListRequest.ts | 36 + .../requests/ToolsListVersionsRequest.ts | 21 + .../client/requests/UpdateToolRequest.ts | 14 + .../resources/tools/client/requests/index.ts | 7 + src/api/resources/tools/index.ts | 1 + src/api/types/AgentConfigResponse.ts | 27 + src/api/types/BaseMetricResponse.ts | 20 + src/api/types/BaseModelsUserResponse.ts | 14 + src/api/types/BooleanEvaluatorVersionStats.ts | 24 + src/api/types/CategoricalFeedbackLabel.ts | 13 + src/api/types/ChatMessage.ts | 18 + src/api/types/ChatMessageContent.ts | 10 + src/api/types/ChatMessageContentItem.ts | 7 + src/api/types/ChatMessageWithToolCall.ts | 20 + .../types/ChatMessageWithToolCallContent.ts | 10 + .../ChatMessageWithToolCallContentItem.ts | 7 + src/api/types/ChatRole.ts | 15 + src/api/types/ChatToolType.ts | 8 + src/api/types/CodeEvaluatorRequest.ts | 15 + src/api/types/CommitRequest.ts | 8 + src/api/types/ConfigResponse.ts | 12 + src/api/types/ConfigToolResponse.ts | 16 + src/api/types/CreateDatapointRequest.ts | 14 + .../CreateDatapointRequestTargetValue.ts | 11 + src/api/types/CreateEvaluationRequest.ts | 21 + src/api/types/CreatePromptLogResponse.ts | 14 + src/api/types/CreateToolLogResponse.ts | 14 + src/api/types/DashboardConfiguration.ts | 11 + src/api/types/DatapointResponse.ts | 16 + src/api/types/DatapointResponseTargetValue.ts | 5 + src/api/types/DatasetResponse.ts | 38 + src/api/types/DirectoryResponse.ts | 14 + ...DirectoryWithParentsAndChildrenResponse.ts | 22 + ...WithParentsAndChildrenResponseFilesItem.ts | 11 + src/api/types/EnvironmentResponse.ts | 12 + src/api/types/EnvironmentTag.ts | 13 + src/api/types/EvaluatedVersionResponse.ts | 7 + src/api/types/EvaluateeRequest.ts | 12 + src/api/types/EvaluateeResponse.ts | 13 + .../types/EvaluationDebugResultResponse.ts | 19 + .../EvaluationDebugResultResponseValue.ts | 5 + src/api/types/EvaluationEvaluatorResponse.ts | 11 + src/api/types/EvaluationResponse.ts | 28 + src/api/types/EvaluationResultResponse.ts | 21 + .../types/EvaluationResultResponseValue.ts | 5 + src/api/types/EvaluationStats.ts | 12 + src/api/types/EvaluationStatus.ts | 16 + src/api/types/EvaluationsDatasetRequest.ts | 8 + src/api/types/EvaluationsRequest.ts | 10 + .../EvaluatorActivationDeactivationRequest.ts | 12 + ...tivationRequestEvaluatorsToActivateItem.ts | 9 + ...vationRequestEvaluatorsToDeactivateItem.ts | 9 + src/api/types/EvaluatorAggregate.ts | 14 + src/api/types/EvaluatorArgumentsType.ts | 13 + src/api/types/EvaluatorConfigResponse.ts | 31 + src/api/types/EvaluatorResponse.ts | 39 + src/api/types/EvaluatorResponseSpec.ts | 10 + src/api/types/EvaluatorReturnTypeEnum.ts | 13 + src/api/types/ExperimentResponse.ts | 24 + src/api/types/ExperimentStatus.ts | 13 + src/api/types/ExperimentVersionResponse.ts | 22 + src/api/types/FeedbackClass.ts | 15 + src/api/types/FeedbackLabelStatus.ts | 14 + src/api/types/FeedbackResponse.ts | 20 + src/api/types/FeedbackResponseType.ts | 10 + src/api/types/FeedbackResponseValue.ts | 8 + src/api/types/FeedbackType.ts | 16 + src/api/types/FeedbackTypeModel.ts | 12 + src/api/types/FeedbackTypeModelType.ts | 10 + src/api/types/FeedbackTypes.ts | 7 + src/api/types/FileEnvironmentResponse.ts | 19 + src/api/types/FileEnvironmentResponseFile.ts | 14 + src/api/types/FilesToolType.ts | 17 + src/api/types/FunctionTool.ts | 11 + src/api/types/FunctionToolChoice.ts | 10 + src/api/types/GenericConfigResponse.ts | 21 + src/api/types/HttpValidationError.ts | 9 + src/api/types/HumanEvaluatorRequest.ts | 13 + src/api/types/ImageChatContent.ts | 11 + src/api/types/ImageUrl.ts | 12 + src/api/types/ImageUrlDetail.ts | 14 + src/api/types/InputResponse.ts | 8 + src/api/types/LabelSentiment.ts | 17 + src/api/types/LinkedToolRequest.ts | 16 + src/api/types/LinkedToolResponse.ts | 16 + src/api/types/ListDatasets.ts | 10 + src/api/types/ListEvaluators.ts | 10 + src/api/types/ListPrompts.ts | 10 + src/api/types/ListTools.ts | 10 + src/api/types/LlmEvaluatorRequest.ts | 15 + src/api/types/LogResponse.ts | 89 + src/api/types/LogResponseJudgment.ts | 5 + src/api/types/LogResponseToolChoice.ts | 10 + src/api/types/MetricValueResponse.ts | 9 + src/api/types/ModelConfigRequest.ts | 46 + src/api/types/ModelConfigRequestStop.ts | 8 + src/api/types/ModelConfigRequestToolsItem.ts | 7 + src/api/types/ModelConfigResponse.ts | 52 + src/api/types/ModelConfigResponseStop.ts | 8 + src/api/types/ModelConfigToolRequest.ts | 28 + src/api/types/ModelEndpoints.ts | 14 + src/api/types/ModelProviders.ts | 31 + .../MonitoringEvaluatorEnvironmentRequest.ts | 10 + src/api/types/MonitoringEvaluatorResponse.ts | 16 + src/api/types/MonitoringEvaluatorState.ts | 13 + .../MonitoringEvaluatorVersionRequest.ts | 8 + src/api/types/NumericEvaluatorVersionStats.ts | 23 + src/api/types/ObservabilityStatus.ts | 17 + src/api/types/OverallStats.ts | 12 + src/api/types/PaginatedDatapointResponse.ts | 12 + src/api/types/PaginatedDatasetResponse.ts | 12 + src/api/types/PaginatedEvaluationResponse.ts | 12 + src/api/types/PaginatedPromptLogResponse.ts | 12 + src/api/types/PaginatedSessionResponse.ts | 12 + src/api/types/PlatformAccessEnum.ts | 14 + src/api/types/PositiveLabel.ts | 8 + src/api/types/ProjectSortBy.ts | 14 + src/api/types/PromptCallLogResponse.ts | 35 + src/api/types/PromptCallResponse.ts | 48 + src/api/types/PromptCallResponseToolChoice.ts | 15 + src/api/types/PromptCallStreamResponse.ts | 41 + src/api/types/PromptKernelRequest.ts | 38 + src/api/types/PromptKernelRequestStop.ts | 8 + src/api/types/PromptKernelRequestTemplate.ts | 10 + src/api/types/PromptLogResponse.ts | 72 + src/api/types/PromptLogResponseToolChoice.ts | 15 + src/api/types/PromptResponse.ts | 69 + src/api/types/PromptResponseStop.ts | 8 + src/api/types/PromptResponseTemplate.ts | 10 + src/api/types/ProviderApiKeys.ts | 13 + src/api/types/ResponseFormat.ts | 10 + src/api/types/SessionResponse.ts | 14 + src/api/types/SortOrder.ts | 13 + src/api/types/TextChatContent.ts | 9 + src/api/types/TimeUnit.ts | 14 + src/api/types/ToolCall.ts | 14 + src/api/types/ToolChoice.ts | 13 + src/api/types/ToolConfigRequest.ts | 29 + src/api/types/ToolConfigResponse.ts | 35 + src/api/types/ToolFunction.ts | 12 + src/api/types/ToolKernelRequest.ts | 14 + src/api/types/ToolResponse.ts | 49 + src/api/types/ToolResultResponse.ts | 13 + src/api/types/ToolSource.ts | 15 + src/api/types/UpdateDatesetAction.ts | 14 + src/api/types/UserResponse.ts | 12 + src/api/types/ValidationError.ts | 11 + src/api/types/ValidationErrorLocItem.ts | 5 + src/api/types/VersionDeploymentResponse.ts | 16 + .../types/VersionDeploymentResponseFile.ts | 14 + src/api/types/VersionIdResponse.ts | 14 + src/api/types/VersionIdResponseVersion.ts | 14 + src/api/types/VersionReferenceResponse.ts | 7 + src/api/types/VersionStats.ts | 17 + .../VersionStatsEvaluatorVersionStatsItem.ts | 9 + src/api/types/VersionStatus.ts | 14 + src/api/types/index.ts | 151 + src/core/fetcher/APIResponse.ts | 12 + src/core/fetcher/Fetcher.ts | 282 + src/core/fetcher/Supplier.ts | 11 + src/core/fetcher/getHeader.ts | 8 + src/core/fetcher/index.ts | 5 + src/core/index.ts | 3 + src/core/runtime/index.ts | 1 + src/core/runtime/runtime.ts | 124 + src/core/schemas/Schema.ts | 94 + src/core/schemas/builders/date/date.ts | 65 + src/core/schemas/builders/date/index.ts | 1 + src/core/schemas/builders/enum/enum.ts | 43 + src/core/schemas/builders/enum/index.ts | 1 + src/core/schemas/builders/index.ts | 13 + src/core/schemas/builders/lazy/index.ts | 3 + src/core/schemas/builders/lazy/lazy.ts | 34 + src/core/schemas/builders/lazy/lazyObject.ts | 20 + src/core/schemas/builders/list/index.ts | 1 + src/core/schemas/builders/list/list.ts | 74 + .../builders/literals/booleanLiteral.ts | 29 + src/core/schemas/builders/literals/index.ts | 2 + .../builders/literals/stringLiteral.ts | 29 + .../object-like/getObjectLikeUtils.ts | 79 + .../schemas/builders/object-like/index.ts | 2 + .../schemas/builders/object-like/types.ts | 11 + src/core/schemas/builders/object/index.ts | 22 + src/core/schemas/builders/object/object.ts | 333 + .../object/objectWithoutOptionalProperties.ts | 18 + src/core/schemas/builders/object/property.ts | 23 + src/core/schemas/builders/object/types.ts | 72 + src/core/schemas/builders/primitives/any.ts | 4 + .../schemas/builders/primitives/boolean.ts | 25 + src/core/schemas/builders/primitives/index.ts | 5 + .../schemas/builders/primitives/number.ts | 25 + .../schemas/builders/primitives/string.ts | 25 + .../schemas/builders/primitives/unknown.ts | 4 + src/core/schemas/builders/record/index.ts | 2 + src/core/schemas/builders/record/record.ts | 131 + src/core/schemas/builders/record/types.ts | 17 + .../builders/schema-utils/JsonError.ts | 9 + .../builders/schema-utils/ParseError.ts | 9 + .../builders/schema-utils/getSchemaUtils.ts | 99 + .../schemas/builders/schema-utils/index.ts | 4 + .../schema-utils/stringifyValidationErrors.ts | 8 + src/core/schemas/builders/set/index.ts | 1 + src/core/schemas/builders/set/set.ts | 43 + .../builders/undiscriminated-union/index.ts | 6 + .../builders/undiscriminated-union/types.ts | 10 + .../undiscriminatedUnion.ts | 61 + .../schemas/builders/union/discriminant.ts | 14 + src/core/schemas/builders/union/index.ts | 10 + src/core/schemas/builders/union/types.ts | 26 + src/core/schemas/builders/union/union.ts | 173 + src/core/schemas/index.ts | 2 + src/core/schemas/utils/MaybePromise.ts | 1 + .../addQuestionMarksToNullableProperties.ts | 15 + .../utils/createIdentitySchemaCreator.ts | 21 + src/core/schemas/utils/entries.ts | 3 + src/core/schemas/utils/filterObject.ts | 10 + .../utils/getErrorMessageForIncorrectType.ts | 21 + src/core/schemas/utils/isPlainObject.ts | 17 + src/core/schemas/utils/keys.ts | 3 + src/core/schemas/utils/maybeSkipValidation.ts | 39 + src/core/schemas/utils/partition.ts | 12 + src/environments.ts | 9 + src/errors/HumanloopError.ts | 45 + src/errors/HumanloopTimeoutError.ts | 10 + src/errors/index.ts | 2 + src/index.ts | 4 + src/serialization/index.ts | 2 + .../resources/datasets/client/index.ts | 2 + .../datasets/client/listEnvironments.ts | 17 + .../BodyDatasetsCreateDatapointsFromLogs.ts | 22 + .../client/requests/DatasetsRequest.ts | 30 + .../client/requests/UpdateDatasetRequest.ts | 22 + .../datasets/client/requests/index.ts | 3 + src/serialization/resources/datasets/index.ts | 1 + .../resources/directories/client/index.ts | 2 + .../resources/directories/client/list.ts | 17 + .../client/requests/CreateDirectoryRequest.ts | 22 + .../client/requests/UpdateDirectoryRequest.ts | 22 + .../directories/client/requests/index.ts | 2 + .../resources/directories/index.ts | 1 + .../resources/evaluations/client/index.ts | 1 + .../requests/UpdateEvaluationStatusRequest.ts | 21 + .../evaluations/client/requests/index.ts | 1 + .../resources/evaluations/index.ts | 1 + .../resources/evaluators/client/debug.ts | 17 + .../resources/evaluators/client/index.ts | 4 + .../evaluators/client/listEnvironments.ts | 17 + .../evaluators/client/listdefault.ts | 17 + .../client/requests/EvaluatorsRequest.ts | 27 + .../requests/RunSyncEvaluationRequest.ts | 34 + .../client/requests/UpdateEvaluatorRequest.ts | 22 + .../evaluators/client/requests/index.ts | 3 + .../resources/evaluators/index.ts | 2 + .../RunSyncEvaluationRequestEvaluator.ts | 19 + ...pModelsV5EvaluatorsEvaluatorRequestSpec.ts | 19 + .../resources/evaluators/types/index.ts | 2 + src/serialization/resources/index.ts | 14 + .../resources/prompts/client/index.ts | 2 + .../prompts/client/listEnvironments.ts | 17 + .../client/requests/PromptCallRequest.ts | 64 + .../client/requests/PromptLogRequest.ts | 83 + .../prompts/client/requests/PromptRequest.ts | 61 + .../client/requests/UpdatePromptRequest.ts | 22 + .../prompts/client/requests/index.ts | 4 + src/serialization/resources/prompts/index.ts | 2 + .../types/PromptCallRequestToolChoice.ts | 22 + .../types/PromptLogRequestToolChoice.ts | 22 + .../prompts/types/PromptRequestStop.ts | 19 + .../prompts/types/PromptRequestTemplate.ts | 17 + .../prompts/types/PromptsCallResponse.ts | 18 + .../resources/prompts/types/index.ts | 5 + .../resources/tools/client/index.ts | 2 + .../tools/client/listEnvironments.ts | 17 + .../tools/client/requests/ToolLogRequest.ts | 65 + .../tools/client/requests/ToolRequest.ts | 35 + .../client/requests/UpdateToolRequest.ts | 22 + .../resources/tools/client/requests/index.ts | 3 + src/serialization/resources/tools/index.ts | 1 + .../types/AgentConfigResponse.ts | 41 + src/serialization/types/BaseMetricResponse.ts | 34 + .../types/BaseModelsUserResponse.ts | 26 + .../types/BooleanEvaluatorVersionStats.ts | 32 + .../types/CategoricalFeedbackLabel.ts | 26 + src/serialization/types/ChatMessage.ts | 29 + src/serialization/types/ChatMessageContent.ts | 20 + .../types/ChatMessageContentItem.ts | 18 + .../types/ChatMessageWithToolCall.ts | 34 + .../types/ChatMessageWithToolCallContent.ts | 20 + .../ChatMessageWithToolCallContentItem.ts | 18 + src/serialization/types/ChatRole.ts | 14 + src/serialization/types/ChatToolType.ts | 14 + .../types/CodeEvaluatorRequest.ts | 28 + src/serialization/types/CommitRequest.ts | 18 + src/serialization/types/ConfigResponse.ts | 30 + src/serialization/types/ConfigToolResponse.ts | 28 + .../types/CreateDatapointRequest.ts | 26 + .../CreateDatapointRequestTargetValue.ts | 23 + .../types/CreateEvaluationRequest.ts | 27 + .../types/CreatePromptLogResponse.ts | 26 + .../types/CreateToolLogResponse.ts | 26 + .../types/DashboardConfiguration.ts | 28 + src/serialization/types/DatapointResponse.ts | 28 + .../types/DatapointResponseTargetValue.ts | 23 + src/serialization/types/DatasetResponse.ts | 50 + src/serialization/types/DirectoryResponse.ts | 28 + ...DirectoryWithParentsAndChildrenResponse.ts | 36 + ...WithParentsAndChildrenResponseFilesItem.ts | 20 + .../types/EnvironmentResponse.ts | 27 + src/serialization/types/EnvironmentTag.ts | 14 + .../types/EvaluatedVersionResponse.ts | 18 + src/serialization/types/EvaluateeRequest.ts | 24 + src/serialization/types/EvaluateeResponse.ts | 25 + .../types/EvaluationDebugResultResponse.ts | 34 + .../EvaluationDebugResultResponseValue.ts | 16 + .../types/EvaluationEvaluatorResponse.ts | 23 + src/serialization/types/EvaluationResponse.ts | 39 + .../types/EvaluationResultResponse.ts | 48 + .../types/EvaluationResultResponseValue.ts | 16 + src/serialization/types/EvaluationStats.ts | 24 + src/serialization/types/EvaluationStatus.ts | 14 + .../types/EvaluationsDatasetRequest.ts | 20 + src/serialization/types/EvaluationsRequest.ts | 22 + .../EvaluatorActivationDeactivationRequest.ts | 30 + ...tivationRequestEvaluatorsToActivateItem.ts | 18 + ...vationRequestEvaluatorsToDeactivateItem.ts | 18 + src/serialization/types/EvaluatorAggregate.ts | 28 + .../types/EvaluatorArgumentsType.ts | 16 + .../types/EvaluatorConfigResponse.ts | 46 + src/serialization/types/EvaluatorResponse.ts | 61 + .../types/EvaluatorResponseSpec.ts | 19 + .../types/EvaluatorReturnTypeEnum.ts | 16 + src/serialization/types/ExperimentResponse.ts | 40 + src/serialization/types/ExperimentStatus.ts | 14 + .../types/ExperimentVersionResponse.ts | 36 + src/serialization/types/FeedbackClass.ts | 14 + .../types/FeedbackLabelStatus.ts | 16 + src/serialization/types/FeedbackResponse.ts | 32 + .../types/FeedbackResponseType.ts | 17 + .../types/FeedbackResponseValue.ts | 16 + src/serialization/types/FeedbackType.ts | 14 + src/serialization/types/FeedbackTypeModel.ts | 24 + .../types/FeedbackTypeModelType.ts | 17 + src/serialization/types/FeedbackTypes.ts | 15 + .../types/FileEnvironmentResponse.ts | 30 + .../types/FileEnvironmentResponseFile.ts | 20 + src/serialization/types/FilesToolType.ts | 14 + src/serialization/types/FunctionTool.ts | 20 + src/serialization/types/FunctionToolChoice.ts | 20 + .../types/GenericConfigResponse.ts | 33 + .../types/HttpValidationError.ts | 21 + .../types/HumanEvaluatorRequest.ts | 26 + src/serialization/types/ImageChatContent.ts | 23 + src/serialization/types/ImageUrl.ts | 21 + src/serialization/types/ImageUrlDetail.ts | 14 + src/serialization/types/InputResponse.ts | 18 + src/serialization/types/LabelSentiment.ts | 14 + src/serialization/types/LinkedToolRequest.ts | 28 + src/serialization/types/LinkedToolResponse.ts | 28 + src/serialization/types/ListDatasets.ts | 19 + src/serialization/types/ListEvaluators.ts | 19 + src/serialization/types/ListPrompts.ts | 19 + src/serialization/types/ListTools.ts | 19 + .../types/LlmEvaluatorRequest.ts | 29 + src/serialization/types/LogResponse.ts | 127 + .../types/LogResponseJudgment.ts | 16 + .../types/LogResponseToolChoice.ts | 22 + .../types/MetricValueResponse.ts | 24 + src/serialization/types/ModelConfigRequest.ts | 63 + .../types/ModelConfigRequestStop.ts | 19 + .../types/ModelConfigRequestToolsItem.ts | 18 + .../types/ModelConfigResponse.ts | 68 + .../types/ModelConfigResponseStop.ts | 19 + .../types/ModelConfigToolRequest.ts | 33 + src/serialization/types/ModelEndpoints.ts | 14 + src/serialization/types/ModelProviders.ts | 35 + .../MonitoringEvaluatorEnvironmentRequest.ts | 22 + .../types/MonitoringEvaluatorResponse.ts | 31 + .../types/MonitoringEvaluatorState.ts | 16 + .../MonitoringEvaluatorVersionRequest.ts | 20 + .../types/NumericEvaluatorVersionStats.ts | 34 + .../types/ObservabilityStatus.ts | 16 + src/serialization/types/OverallStats.ts | 22 + .../types/PaginatedDatapointResponse.ts | 27 + .../types/PaginatedDatasetResponse.ts | 27 + .../types/PaginatedEvaluationResponse.ts | 27 + .../types/PaginatedPromptLogResponse.ts | 27 + .../types/PaginatedSessionResponse.ts | 27 + src/serialization/types/PlatformAccessEnum.ts | 16 + src/serialization/types/PositiveLabel.ts | 20 + src/serialization/types/ProjectSortBy.ts | 14 + .../types/PromptCallLogResponse.ts | 43 + src/serialization/types/PromptCallResponse.ts | 52 + .../types/PromptCallResponseToolChoice.ts | 22 + .../types/PromptCallStreamResponse.ts | 49 + .../types/PromptKernelRequest.ts | 57 + .../types/PromptKernelRequestStop.ts | 19 + .../types/PromptKernelRequestTemplate.ts | 17 + src/serialization/types/PromptLogResponse.ts | 81 + .../types/PromptLogResponseToolChoice.ts | 22 + src/serialization/types/PromptResponse.ts | 96 + src/serialization/types/PromptResponseStop.ts | 19 + .../types/PromptResponseTemplate.ts | 17 + src/serialization/types/ProviderApiKeys.ts | 32 + src/serialization/types/ResponseFormat.ts | 18 + src/serialization/types/SessionResponse.ts | 27 + src/serialization/types/SortOrder.ts | 14 + src/serialization/types/TextChatContent.ts | 22 + src/serialization/types/TimeUnit.ts | 14 + src/serialization/types/ToolCall.ts | 24 + src/serialization/types/ToolChoice.ts | 22 + src/serialization/types/ToolConfigRequest.ts | 35 + src/serialization/types/ToolConfigResponse.ts | 51 + src/serialization/types/ToolFunction.ts | 22 + src/serialization/types/ToolKernelRequest.ts | 28 + src/serialization/types/ToolResponse.ts | 71 + src/serialization/types/ToolResultResponse.ts | 26 + src/serialization/types/ToolSource.ts | 14 + .../types/UpdateDatesetAction.ts | 16 + src/serialization/types/UserResponse.ts | 22 + src/serialization/types/ValidationError.ts | 25 + .../types/ValidationErrorLocItem.ts | 16 + .../types/VersionDeploymentResponse.ts | 26 + .../types/VersionDeploymentResponseFile.ts | 20 + src/serialization/types/VersionIdResponse.ts | 23 + .../types/VersionIdResponseVersion.ts | 20 + .../types/VersionReferenceResponse.ts | 18 + src/serialization/types/VersionStats.ts | 26 + .../VersionStatsEvaluatorVersionStatsItem.ts | 18 + src/serialization/types/VersionStatus.ts | 14 + src/serialization/types/index.ts | 151 + tests/custom.test.ts | 13 + tsconfig.json | 17 + yarn.lock | 2705 ++++++++ 531 files changed, 34568 insertions(+) create mode 100644 .fernignore create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .mock/definition/__package__.yml create mode 100644 .mock/definition/api.yml create mode 100644 .mock/definition/datasets.yml create mode 100644 .mock/definition/directories.yml create mode 100644 .mock/definition/evaluations.yml create mode 100644 .mock/definition/evaluators.yml create mode 100644 .mock/definition/logs.yml create mode 100644 .mock/definition/prompts.yml create mode 100644 .mock/definition/sessions.yml create mode 100644 .mock/definition/tools.yml create mode 100644 .mock/fern.config.json create mode 100644 .npmignore create mode 100644 .prettierrc.yml create mode 100644 README.md create mode 100644 jest.config.js create mode 100644 package.json create mode 100644 reference.md create mode 100644 src/Client.ts create mode 100644 src/api/errors/UnprocessableEntityError.ts create mode 100644 src/api/errors/index.ts create mode 100644 src/api/index.ts create mode 100644 src/api/resources/datasets/client/Client.ts create mode 100644 src/api/resources/datasets/client/index.ts create mode 100644 src/api/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts create mode 100644 src/api/resources/datasets/client/requests/DatasetsGetRequest.ts create mode 100644 src/api/resources/datasets/client/requests/DatasetsListDatapointsRequest.ts create mode 100644 src/api/resources/datasets/client/requests/DatasetsListRequest.ts create mode 100644 src/api/resources/datasets/client/requests/DatasetsListVersionsRequest.ts create mode 100644 src/api/resources/datasets/client/requests/DatasetsRequest.ts create mode 100644 src/api/resources/datasets/client/requests/DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest.ts create mode 100644 src/api/resources/datasets/client/requests/UpdateDatasetRequest.ts create mode 100644 src/api/resources/datasets/client/requests/index.ts create mode 100644 src/api/resources/datasets/index.ts create mode 100644 src/api/resources/directories/client/Client.ts create mode 100644 src/api/resources/directories/client/index.ts create mode 100644 src/api/resources/directories/client/requests/CreateDirectoryRequest.ts create mode 100644 src/api/resources/directories/client/requests/UpdateDirectoryRequest.ts create mode 100644 src/api/resources/directories/client/requests/index.ts create mode 100644 src/api/resources/directories/index.ts create mode 100644 src/api/resources/evaluations/client/Client.ts create mode 100644 src/api/resources/evaluations/client/index.ts create mode 100644 src/api/resources/evaluations/client/requests/EvaluationsListRequest.ts create mode 100644 src/api/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts create mode 100644 src/api/resources/evaluations/client/requests/index.ts create mode 100644 src/api/resources/evaluations/index.ts create mode 100644 src/api/resources/evaluators/client/Client.ts create mode 100644 src/api/resources/evaluators/client/index.ts create mode 100644 src/api/resources/evaluators/client/requests/DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/EvaluatorsGetRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/EvaluatorsListRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/EvaluatorsListVersionsRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/EvaluatorsRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts create mode 100644 src/api/resources/evaluators/client/requests/index.ts create mode 100644 src/api/resources/evaluators/index.ts create mode 100644 src/api/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts create mode 100644 src/api/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts create mode 100644 src/api/resources/evaluators/types/index.ts create mode 100644 src/api/resources/index.ts create mode 100644 src/api/resources/logs/client/Client.ts create mode 100644 src/api/resources/logs/client/index.ts create mode 100644 src/api/resources/logs/client/requests/ListLogsForFileLogsGetRequest.ts create mode 100644 src/api/resources/logs/client/requests/LogsDeleteRequest.ts create mode 100644 src/api/resources/logs/client/requests/index.ts create mode 100644 src/api/resources/logs/index.ts create mode 100644 src/api/resources/prompts/client/Client.ts create mode 100644 src/api/resources/prompts/client/index.ts create mode 100644 src/api/resources/prompts/client/requests/DeployPromptsIdEnvironmentsEnvironmentIdPostRequest.ts create mode 100644 src/api/resources/prompts/client/requests/PromptCallRequest.ts create mode 100644 src/api/resources/prompts/client/requests/PromptLogRequest.ts create mode 100644 src/api/resources/prompts/client/requests/PromptRequest.ts create mode 100644 src/api/resources/prompts/client/requests/PromptsGetRequest.ts create mode 100644 src/api/resources/prompts/client/requests/PromptsListPromptsRequest.ts create mode 100644 src/api/resources/prompts/client/requests/PromptsListVersionsRequest.ts create mode 100644 src/api/resources/prompts/client/requests/UpdatePromptRequest.ts create mode 100644 src/api/resources/prompts/client/requests/index.ts create mode 100644 src/api/resources/prompts/index.ts create mode 100644 src/api/resources/prompts/types/PromptCallRequestToolChoice.ts create mode 100644 src/api/resources/prompts/types/PromptLogRequestToolChoice.ts create mode 100644 src/api/resources/prompts/types/PromptRequestStop.ts create mode 100644 src/api/resources/prompts/types/PromptRequestTemplate.ts create mode 100644 src/api/resources/prompts/types/PromptsCallResponse.ts create mode 100644 src/api/resources/prompts/types/index.ts create mode 100644 src/api/resources/sessions/client/Client.ts create mode 100644 src/api/resources/sessions/client/index.ts create mode 100644 src/api/resources/sessions/client/requests/SessionsListRequest.ts create mode 100644 src/api/resources/sessions/client/requests/index.ts create mode 100644 src/api/resources/sessions/index.ts create mode 100644 src/api/resources/tools/client/Client.ts create mode 100644 src/api/resources/tools/client/index.ts create mode 100644 src/api/resources/tools/client/requests/DeployToolsIdEnvironmentsEnvironmentIdPostRequest.ts create mode 100644 src/api/resources/tools/client/requests/ToolLogRequest.ts create mode 100644 src/api/resources/tools/client/requests/ToolRequest.ts create mode 100644 src/api/resources/tools/client/requests/ToolsGetRequest.ts create mode 100644 src/api/resources/tools/client/requests/ToolsListRequest.ts create mode 100644 src/api/resources/tools/client/requests/ToolsListVersionsRequest.ts create mode 100644 src/api/resources/tools/client/requests/UpdateToolRequest.ts create mode 100644 src/api/resources/tools/client/requests/index.ts create mode 100644 src/api/resources/tools/index.ts create mode 100644 src/api/types/AgentConfigResponse.ts create mode 100644 src/api/types/BaseMetricResponse.ts create mode 100644 src/api/types/BaseModelsUserResponse.ts create mode 100644 src/api/types/BooleanEvaluatorVersionStats.ts create mode 100644 src/api/types/CategoricalFeedbackLabel.ts create mode 100644 src/api/types/ChatMessage.ts create mode 100644 src/api/types/ChatMessageContent.ts create mode 100644 src/api/types/ChatMessageContentItem.ts create mode 100644 src/api/types/ChatMessageWithToolCall.ts create mode 100644 src/api/types/ChatMessageWithToolCallContent.ts create mode 100644 src/api/types/ChatMessageWithToolCallContentItem.ts create mode 100644 src/api/types/ChatRole.ts create mode 100644 src/api/types/ChatToolType.ts create mode 100644 src/api/types/CodeEvaluatorRequest.ts create mode 100644 src/api/types/CommitRequest.ts create mode 100644 src/api/types/ConfigResponse.ts create mode 100644 src/api/types/ConfigToolResponse.ts create mode 100644 src/api/types/CreateDatapointRequest.ts create mode 100644 src/api/types/CreateDatapointRequestTargetValue.ts create mode 100644 src/api/types/CreateEvaluationRequest.ts create mode 100644 src/api/types/CreatePromptLogResponse.ts create mode 100644 src/api/types/CreateToolLogResponse.ts create mode 100644 src/api/types/DashboardConfiguration.ts create mode 100644 src/api/types/DatapointResponse.ts create mode 100644 src/api/types/DatapointResponseTargetValue.ts create mode 100644 src/api/types/DatasetResponse.ts create mode 100644 src/api/types/DirectoryResponse.ts create mode 100644 src/api/types/DirectoryWithParentsAndChildrenResponse.ts create mode 100644 src/api/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts create mode 100644 src/api/types/EnvironmentResponse.ts create mode 100644 src/api/types/EnvironmentTag.ts create mode 100644 src/api/types/EvaluatedVersionResponse.ts create mode 100644 src/api/types/EvaluateeRequest.ts create mode 100644 src/api/types/EvaluateeResponse.ts create mode 100644 src/api/types/EvaluationDebugResultResponse.ts create mode 100644 src/api/types/EvaluationDebugResultResponseValue.ts create mode 100644 src/api/types/EvaluationEvaluatorResponse.ts create mode 100644 src/api/types/EvaluationResponse.ts create mode 100644 src/api/types/EvaluationResultResponse.ts create mode 100644 src/api/types/EvaluationResultResponseValue.ts create mode 100644 src/api/types/EvaluationStats.ts create mode 100644 src/api/types/EvaluationStatus.ts create mode 100644 src/api/types/EvaluationsDatasetRequest.ts create mode 100644 src/api/types/EvaluationsRequest.ts create mode 100644 src/api/types/EvaluatorActivationDeactivationRequest.ts create mode 100644 src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts create mode 100644 src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts create mode 100644 src/api/types/EvaluatorAggregate.ts create mode 100644 src/api/types/EvaluatorArgumentsType.ts create mode 100644 src/api/types/EvaluatorConfigResponse.ts create mode 100644 src/api/types/EvaluatorResponse.ts create mode 100644 src/api/types/EvaluatorResponseSpec.ts create mode 100644 src/api/types/EvaluatorReturnTypeEnum.ts create mode 100644 src/api/types/ExperimentResponse.ts create mode 100644 src/api/types/ExperimentStatus.ts create mode 100644 src/api/types/ExperimentVersionResponse.ts create mode 100644 src/api/types/FeedbackClass.ts create mode 100644 src/api/types/FeedbackLabelStatus.ts create mode 100644 src/api/types/FeedbackResponse.ts create mode 100644 src/api/types/FeedbackResponseType.ts create mode 100644 src/api/types/FeedbackResponseValue.ts create mode 100644 src/api/types/FeedbackType.ts create mode 100644 src/api/types/FeedbackTypeModel.ts create mode 100644 src/api/types/FeedbackTypeModelType.ts create mode 100644 src/api/types/FeedbackTypes.ts create mode 100644 src/api/types/FileEnvironmentResponse.ts create mode 100644 src/api/types/FileEnvironmentResponseFile.ts create mode 100644 src/api/types/FilesToolType.ts create mode 100644 src/api/types/FunctionTool.ts create mode 100644 src/api/types/FunctionToolChoice.ts create mode 100644 src/api/types/GenericConfigResponse.ts create mode 100644 src/api/types/HttpValidationError.ts create mode 100644 src/api/types/HumanEvaluatorRequest.ts create mode 100644 src/api/types/ImageChatContent.ts create mode 100644 src/api/types/ImageUrl.ts create mode 100644 src/api/types/ImageUrlDetail.ts create mode 100644 src/api/types/InputResponse.ts create mode 100644 src/api/types/LabelSentiment.ts create mode 100644 src/api/types/LinkedToolRequest.ts create mode 100644 src/api/types/LinkedToolResponse.ts create mode 100644 src/api/types/ListDatasets.ts create mode 100644 src/api/types/ListEvaluators.ts create mode 100644 src/api/types/ListPrompts.ts create mode 100644 src/api/types/ListTools.ts create mode 100644 src/api/types/LlmEvaluatorRequest.ts create mode 100644 src/api/types/LogResponse.ts create mode 100644 src/api/types/LogResponseJudgment.ts create mode 100644 src/api/types/LogResponseToolChoice.ts create mode 100644 src/api/types/MetricValueResponse.ts create mode 100644 src/api/types/ModelConfigRequest.ts create mode 100644 src/api/types/ModelConfigRequestStop.ts create mode 100644 src/api/types/ModelConfigRequestToolsItem.ts create mode 100644 src/api/types/ModelConfigResponse.ts create mode 100644 src/api/types/ModelConfigResponseStop.ts create mode 100644 src/api/types/ModelConfigToolRequest.ts create mode 100644 src/api/types/ModelEndpoints.ts create mode 100644 src/api/types/ModelProviders.ts create mode 100644 src/api/types/MonitoringEvaluatorEnvironmentRequest.ts create mode 100644 src/api/types/MonitoringEvaluatorResponse.ts create mode 100644 src/api/types/MonitoringEvaluatorState.ts create mode 100644 src/api/types/MonitoringEvaluatorVersionRequest.ts create mode 100644 src/api/types/NumericEvaluatorVersionStats.ts create mode 100644 src/api/types/ObservabilityStatus.ts create mode 100644 src/api/types/OverallStats.ts create mode 100644 src/api/types/PaginatedDatapointResponse.ts create mode 100644 src/api/types/PaginatedDatasetResponse.ts create mode 100644 src/api/types/PaginatedEvaluationResponse.ts create mode 100644 src/api/types/PaginatedPromptLogResponse.ts create mode 100644 src/api/types/PaginatedSessionResponse.ts create mode 100644 src/api/types/PlatformAccessEnum.ts create mode 100644 src/api/types/PositiveLabel.ts create mode 100644 src/api/types/ProjectSortBy.ts create mode 100644 src/api/types/PromptCallLogResponse.ts create mode 100644 src/api/types/PromptCallResponse.ts create mode 100644 src/api/types/PromptCallResponseToolChoice.ts create mode 100644 src/api/types/PromptCallStreamResponse.ts create mode 100644 src/api/types/PromptKernelRequest.ts create mode 100644 src/api/types/PromptKernelRequestStop.ts create mode 100644 src/api/types/PromptKernelRequestTemplate.ts create mode 100644 src/api/types/PromptLogResponse.ts create mode 100644 src/api/types/PromptLogResponseToolChoice.ts create mode 100644 src/api/types/PromptResponse.ts create mode 100644 src/api/types/PromptResponseStop.ts create mode 100644 src/api/types/PromptResponseTemplate.ts create mode 100644 src/api/types/ProviderApiKeys.ts create mode 100644 src/api/types/ResponseFormat.ts create mode 100644 src/api/types/SessionResponse.ts create mode 100644 src/api/types/SortOrder.ts create mode 100644 src/api/types/TextChatContent.ts create mode 100644 src/api/types/TimeUnit.ts create mode 100644 src/api/types/ToolCall.ts create mode 100644 src/api/types/ToolChoice.ts create mode 100644 src/api/types/ToolConfigRequest.ts create mode 100644 src/api/types/ToolConfigResponse.ts create mode 100644 src/api/types/ToolFunction.ts create mode 100644 src/api/types/ToolKernelRequest.ts create mode 100644 src/api/types/ToolResponse.ts create mode 100644 src/api/types/ToolResultResponse.ts create mode 100644 src/api/types/ToolSource.ts create mode 100644 src/api/types/UpdateDatesetAction.ts create mode 100644 src/api/types/UserResponse.ts create mode 100644 src/api/types/ValidationError.ts create mode 100644 src/api/types/ValidationErrorLocItem.ts create mode 100644 src/api/types/VersionDeploymentResponse.ts create mode 100644 src/api/types/VersionDeploymentResponseFile.ts create mode 100644 src/api/types/VersionIdResponse.ts create mode 100644 src/api/types/VersionIdResponseVersion.ts create mode 100644 src/api/types/VersionReferenceResponse.ts create mode 100644 src/api/types/VersionStats.ts create mode 100644 src/api/types/VersionStatsEvaluatorVersionStatsItem.ts create mode 100644 src/api/types/VersionStatus.ts create mode 100644 src/api/types/index.ts create mode 100644 src/core/fetcher/APIResponse.ts create mode 100644 src/core/fetcher/Fetcher.ts create mode 100644 src/core/fetcher/Supplier.ts create mode 100644 src/core/fetcher/getHeader.ts create mode 100644 src/core/fetcher/index.ts create mode 100644 src/core/index.ts create mode 100644 src/core/runtime/index.ts create mode 100644 src/core/runtime/runtime.ts create mode 100644 src/core/schemas/Schema.ts create mode 100644 src/core/schemas/builders/date/date.ts create mode 100644 src/core/schemas/builders/date/index.ts create mode 100644 src/core/schemas/builders/enum/enum.ts create mode 100644 src/core/schemas/builders/enum/index.ts create mode 100644 src/core/schemas/builders/index.ts create mode 100644 src/core/schemas/builders/lazy/index.ts create mode 100644 src/core/schemas/builders/lazy/lazy.ts create mode 100644 src/core/schemas/builders/lazy/lazyObject.ts create mode 100644 src/core/schemas/builders/list/index.ts create mode 100644 src/core/schemas/builders/list/list.ts create mode 100644 src/core/schemas/builders/literals/booleanLiteral.ts create mode 100644 src/core/schemas/builders/literals/index.ts create mode 100644 src/core/schemas/builders/literals/stringLiteral.ts create mode 100644 src/core/schemas/builders/object-like/getObjectLikeUtils.ts create mode 100644 src/core/schemas/builders/object-like/index.ts create mode 100644 src/core/schemas/builders/object-like/types.ts create mode 100644 src/core/schemas/builders/object/index.ts create mode 100644 src/core/schemas/builders/object/object.ts create mode 100644 src/core/schemas/builders/object/objectWithoutOptionalProperties.ts create mode 100644 src/core/schemas/builders/object/property.ts create mode 100644 src/core/schemas/builders/object/types.ts create mode 100644 src/core/schemas/builders/primitives/any.ts create mode 100644 src/core/schemas/builders/primitives/boolean.ts create mode 100644 src/core/schemas/builders/primitives/index.ts create mode 100644 src/core/schemas/builders/primitives/number.ts create mode 100644 src/core/schemas/builders/primitives/string.ts create mode 100644 src/core/schemas/builders/primitives/unknown.ts create mode 100644 src/core/schemas/builders/record/index.ts create mode 100644 src/core/schemas/builders/record/record.ts create mode 100644 src/core/schemas/builders/record/types.ts create mode 100644 src/core/schemas/builders/schema-utils/JsonError.ts create mode 100644 src/core/schemas/builders/schema-utils/ParseError.ts create mode 100644 src/core/schemas/builders/schema-utils/getSchemaUtils.ts create mode 100644 src/core/schemas/builders/schema-utils/index.ts create mode 100644 src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts create mode 100644 src/core/schemas/builders/set/index.ts create mode 100644 src/core/schemas/builders/set/set.ts create mode 100644 src/core/schemas/builders/undiscriminated-union/index.ts create mode 100644 src/core/schemas/builders/undiscriminated-union/types.ts create mode 100644 src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts create mode 100644 src/core/schemas/builders/union/discriminant.ts create mode 100644 src/core/schemas/builders/union/index.ts create mode 100644 src/core/schemas/builders/union/types.ts create mode 100644 src/core/schemas/builders/union/union.ts create mode 100644 src/core/schemas/index.ts create mode 100644 src/core/schemas/utils/MaybePromise.ts create mode 100644 src/core/schemas/utils/addQuestionMarksToNullableProperties.ts create mode 100644 src/core/schemas/utils/createIdentitySchemaCreator.ts create mode 100644 src/core/schemas/utils/entries.ts create mode 100644 src/core/schemas/utils/filterObject.ts create mode 100644 src/core/schemas/utils/getErrorMessageForIncorrectType.ts create mode 100644 src/core/schemas/utils/isPlainObject.ts create mode 100644 src/core/schemas/utils/keys.ts create mode 100644 src/core/schemas/utils/maybeSkipValidation.ts create mode 100644 src/core/schemas/utils/partition.ts create mode 100644 src/environments.ts create mode 100644 src/errors/HumanloopError.ts create mode 100644 src/errors/HumanloopTimeoutError.ts create mode 100644 src/errors/index.ts create mode 100644 src/index.ts create mode 100644 src/serialization/index.ts create mode 100644 src/serialization/resources/datasets/client/index.ts create mode 100644 src/serialization/resources/datasets/client/listEnvironments.ts create mode 100644 src/serialization/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts create mode 100644 src/serialization/resources/datasets/client/requests/DatasetsRequest.ts create mode 100644 src/serialization/resources/datasets/client/requests/UpdateDatasetRequest.ts create mode 100644 src/serialization/resources/datasets/client/requests/index.ts create mode 100644 src/serialization/resources/datasets/index.ts create mode 100644 src/serialization/resources/directories/client/index.ts create mode 100644 src/serialization/resources/directories/client/list.ts create mode 100644 src/serialization/resources/directories/client/requests/CreateDirectoryRequest.ts create mode 100644 src/serialization/resources/directories/client/requests/UpdateDirectoryRequest.ts create mode 100644 src/serialization/resources/directories/client/requests/index.ts create mode 100644 src/serialization/resources/directories/index.ts create mode 100644 src/serialization/resources/evaluations/client/index.ts create mode 100644 src/serialization/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts create mode 100644 src/serialization/resources/evaluations/client/requests/index.ts create mode 100644 src/serialization/resources/evaluations/index.ts create mode 100644 src/serialization/resources/evaluators/client/debug.ts create mode 100644 src/serialization/resources/evaluators/client/index.ts create mode 100644 src/serialization/resources/evaluators/client/listEnvironments.ts create mode 100644 src/serialization/resources/evaluators/client/listdefault.ts create mode 100644 src/serialization/resources/evaluators/client/requests/EvaluatorsRequest.ts create mode 100644 src/serialization/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts create mode 100644 src/serialization/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts create mode 100644 src/serialization/resources/evaluators/client/requests/index.ts create mode 100644 src/serialization/resources/evaluators/index.ts create mode 100644 src/serialization/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts create mode 100644 src/serialization/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts create mode 100644 src/serialization/resources/evaluators/types/index.ts create mode 100644 src/serialization/resources/index.ts create mode 100644 src/serialization/resources/prompts/client/index.ts create mode 100644 src/serialization/resources/prompts/client/listEnvironments.ts create mode 100644 src/serialization/resources/prompts/client/requests/PromptCallRequest.ts create mode 100644 src/serialization/resources/prompts/client/requests/PromptLogRequest.ts create mode 100644 src/serialization/resources/prompts/client/requests/PromptRequest.ts create mode 100644 src/serialization/resources/prompts/client/requests/UpdatePromptRequest.ts create mode 100644 src/serialization/resources/prompts/client/requests/index.ts create mode 100644 src/serialization/resources/prompts/index.ts create mode 100644 src/serialization/resources/prompts/types/PromptCallRequestToolChoice.ts create mode 100644 src/serialization/resources/prompts/types/PromptLogRequestToolChoice.ts create mode 100644 src/serialization/resources/prompts/types/PromptRequestStop.ts create mode 100644 src/serialization/resources/prompts/types/PromptRequestTemplate.ts create mode 100644 src/serialization/resources/prompts/types/PromptsCallResponse.ts create mode 100644 src/serialization/resources/prompts/types/index.ts create mode 100644 src/serialization/resources/tools/client/index.ts create mode 100644 src/serialization/resources/tools/client/listEnvironments.ts create mode 100644 src/serialization/resources/tools/client/requests/ToolLogRequest.ts create mode 100644 src/serialization/resources/tools/client/requests/ToolRequest.ts create mode 100644 src/serialization/resources/tools/client/requests/UpdateToolRequest.ts create mode 100644 src/serialization/resources/tools/client/requests/index.ts create mode 100644 src/serialization/resources/tools/index.ts create mode 100644 src/serialization/types/AgentConfigResponse.ts create mode 100644 src/serialization/types/BaseMetricResponse.ts create mode 100644 src/serialization/types/BaseModelsUserResponse.ts create mode 100644 src/serialization/types/BooleanEvaluatorVersionStats.ts create mode 100644 src/serialization/types/CategoricalFeedbackLabel.ts create mode 100644 src/serialization/types/ChatMessage.ts create mode 100644 src/serialization/types/ChatMessageContent.ts create mode 100644 src/serialization/types/ChatMessageContentItem.ts create mode 100644 src/serialization/types/ChatMessageWithToolCall.ts create mode 100644 src/serialization/types/ChatMessageWithToolCallContent.ts create mode 100644 src/serialization/types/ChatMessageWithToolCallContentItem.ts create mode 100644 src/serialization/types/ChatRole.ts create mode 100644 src/serialization/types/ChatToolType.ts create mode 100644 src/serialization/types/CodeEvaluatorRequest.ts create mode 100644 src/serialization/types/CommitRequest.ts create mode 100644 src/serialization/types/ConfigResponse.ts create mode 100644 src/serialization/types/ConfigToolResponse.ts create mode 100644 src/serialization/types/CreateDatapointRequest.ts create mode 100644 src/serialization/types/CreateDatapointRequestTargetValue.ts create mode 100644 src/serialization/types/CreateEvaluationRequest.ts create mode 100644 src/serialization/types/CreatePromptLogResponse.ts create mode 100644 src/serialization/types/CreateToolLogResponse.ts create mode 100644 src/serialization/types/DashboardConfiguration.ts create mode 100644 src/serialization/types/DatapointResponse.ts create mode 100644 src/serialization/types/DatapointResponseTargetValue.ts create mode 100644 src/serialization/types/DatasetResponse.ts create mode 100644 src/serialization/types/DirectoryResponse.ts create mode 100644 src/serialization/types/DirectoryWithParentsAndChildrenResponse.ts create mode 100644 src/serialization/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts create mode 100644 src/serialization/types/EnvironmentResponse.ts create mode 100644 src/serialization/types/EnvironmentTag.ts create mode 100644 src/serialization/types/EvaluatedVersionResponse.ts create mode 100644 src/serialization/types/EvaluateeRequest.ts create mode 100644 src/serialization/types/EvaluateeResponse.ts create mode 100644 src/serialization/types/EvaluationDebugResultResponse.ts create mode 100644 src/serialization/types/EvaluationDebugResultResponseValue.ts create mode 100644 src/serialization/types/EvaluationEvaluatorResponse.ts create mode 100644 src/serialization/types/EvaluationResponse.ts create mode 100644 src/serialization/types/EvaluationResultResponse.ts create mode 100644 src/serialization/types/EvaluationResultResponseValue.ts create mode 100644 src/serialization/types/EvaluationStats.ts create mode 100644 src/serialization/types/EvaluationStatus.ts create mode 100644 src/serialization/types/EvaluationsDatasetRequest.ts create mode 100644 src/serialization/types/EvaluationsRequest.ts create mode 100644 src/serialization/types/EvaluatorActivationDeactivationRequest.ts create mode 100644 src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts create mode 100644 src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts create mode 100644 src/serialization/types/EvaluatorAggregate.ts create mode 100644 src/serialization/types/EvaluatorArgumentsType.ts create mode 100644 src/serialization/types/EvaluatorConfigResponse.ts create mode 100644 src/serialization/types/EvaluatorResponse.ts create mode 100644 src/serialization/types/EvaluatorResponseSpec.ts create mode 100644 src/serialization/types/EvaluatorReturnTypeEnum.ts create mode 100644 src/serialization/types/ExperimentResponse.ts create mode 100644 src/serialization/types/ExperimentStatus.ts create mode 100644 src/serialization/types/ExperimentVersionResponse.ts create mode 100644 src/serialization/types/FeedbackClass.ts create mode 100644 src/serialization/types/FeedbackLabelStatus.ts create mode 100644 src/serialization/types/FeedbackResponse.ts create mode 100644 src/serialization/types/FeedbackResponseType.ts create mode 100644 src/serialization/types/FeedbackResponseValue.ts create mode 100644 src/serialization/types/FeedbackType.ts create mode 100644 src/serialization/types/FeedbackTypeModel.ts create mode 100644 src/serialization/types/FeedbackTypeModelType.ts create mode 100644 src/serialization/types/FeedbackTypes.ts create mode 100644 src/serialization/types/FileEnvironmentResponse.ts create mode 100644 src/serialization/types/FileEnvironmentResponseFile.ts create mode 100644 src/serialization/types/FilesToolType.ts create mode 100644 src/serialization/types/FunctionTool.ts create mode 100644 src/serialization/types/FunctionToolChoice.ts create mode 100644 src/serialization/types/GenericConfigResponse.ts create mode 100644 src/serialization/types/HttpValidationError.ts create mode 100644 src/serialization/types/HumanEvaluatorRequest.ts create mode 100644 src/serialization/types/ImageChatContent.ts create mode 100644 src/serialization/types/ImageUrl.ts create mode 100644 src/serialization/types/ImageUrlDetail.ts create mode 100644 src/serialization/types/InputResponse.ts create mode 100644 src/serialization/types/LabelSentiment.ts create mode 100644 src/serialization/types/LinkedToolRequest.ts create mode 100644 src/serialization/types/LinkedToolResponse.ts create mode 100644 src/serialization/types/ListDatasets.ts create mode 100644 src/serialization/types/ListEvaluators.ts create mode 100644 src/serialization/types/ListPrompts.ts create mode 100644 src/serialization/types/ListTools.ts create mode 100644 src/serialization/types/LlmEvaluatorRequest.ts create mode 100644 src/serialization/types/LogResponse.ts create mode 100644 src/serialization/types/LogResponseJudgment.ts create mode 100644 src/serialization/types/LogResponseToolChoice.ts create mode 100644 src/serialization/types/MetricValueResponse.ts create mode 100644 src/serialization/types/ModelConfigRequest.ts create mode 100644 src/serialization/types/ModelConfigRequestStop.ts create mode 100644 src/serialization/types/ModelConfigRequestToolsItem.ts create mode 100644 src/serialization/types/ModelConfigResponse.ts create mode 100644 src/serialization/types/ModelConfigResponseStop.ts create mode 100644 src/serialization/types/ModelConfigToolRequest.ts create mode 100644 src/serialization/types/ModelEndpoints.ts create mode 100644 src/serialization/types/ModelProviders.ts create mode 100644 src/serialization/types/MonitoringEvaluatorEnvironmentRequest.ts create mode 100644 src/serialization/types/MonitoringEvaluatorResponse.ts create mode 100644 src/serialization/types/MonitoringEvaluatorState.ts create mode 100644 src/serialization/types/MonitoringEvaluatorVersionRequest.ts create mode 100644 src/serialization/types/NumericEvaluatorVersionStats.ts create mode 100644 src/serialization/types/ObservabilityStatus.ts create mode 100644 src/serialization/types/OverallStats.ts create mode 100644 src/serialization/types/PaginatedDatapointResponse.ts create mode 100644 src/serialization/types/PaginatedDatasetResponse.ts create mode 100644 src/serialization/types/PaginatedEvaluationResponse.ts create mode 100644 src/serialization/types/PaginatedPromptLogResponse.ts create mode 100644 src/serialization/types/PaginatedSessionResponse.ts create mode 100644 src/serialization/types/PlatformAccessEnum.ts create mode 100644 src/serialization/types/PositiveLabel.ts create mode 100644 src/serialization/types/ProjectSortBy.ts create mode 100644 src/serialization/types/PromptCallLogResponse.ts create mode 100644 src/serialization/types/PromptCallResponse.ts create mode 100644 src/serialization/types/PromptCallResponseToolChoice.ts create mode 100644 src/serialization/types/PromptCallStreamResponse.ts create mode 100644 src/serialization/types/PromptKernelRequest.ts create mode 100644 src/serialization/types/PromptKernelRequestStop.ts create mode 100644 src/serialization/types/PromptKernelRequestTemplate.ts create mode 100644 src/serialization/types/PromptLogResponse.ts create mode 100644 src/serialization/types/PromptLogResponseToolChoice.ts create mode 100644 src/serialization/types/PromptResponse.ts create mode 100644 src/serialization/types/PromptResponseStop.ts create mode 100644 src/serialization/types/PromptResponseTemplate.ts create mode 100644 src/serialization/types/ProviderApiKeys.ts create mode 100644 src/serialization/types/ResponseFormat.ts create mode 100644 src/serialization/types/SessionResponse.ts create mode 100644 src/serialization/types/SortOrder.ts create mode 100644 src/serialization/types/TextChatContent.ts create mode 100644 src/serialization/types/TimeUnit.ts create mode 100644 src/serialization/types/ToolCall.ts create mode 100644 src/serialization/types/ToolChoice.ts create mode 100644 src/serialization/types/ToolConfigRequest.ts create mode 100644 src/serialization/types/ToolConfigResponse.ts create mode 100644 src/serialization/types/ToolFunction.ts create mode 100644 src/serialization/types/ToolKernelRequest.ts create mode 100644 src/serialization/types/ToolResponse.ts create mode 100644 src/serialization/types/ToolResultResponse.ts create mode 100644 src/serialization/types/ToolSource.ts create mode 100644 src/serialization/types/UpdateDatesetAction.ts create mode 100644 src/serialization/types/UserResponse.ts create mode 100644 src/serialization/types/ValidationError.ts create mode 100644 src/serialization/types/ValidationErrorLocItem.ts create mode 100644 src/serialization/types/VersionDeploymentResponse.ts create mode 100644 src/serialization/types/VersionDeploymentResponseFile.ts create mode 100644 src/serialization/types/VersionIdResponse.ts create mode 100644 src/serialization/types/VersionIdResponseVersion.ts create mode 100644 src/serialization/types/VersionReferenceResponse.ts create mode 100644 src/serialization/types/VersionStats.ts create mode 100644 src/serialization/types/VersionStatsEvaluatorVersionStatsItem.ts create mode 100644 src/serialization/types/VersionStatus.ts create mode 100644 src/serialization/types/index.ts create mode 100644 tests/custom.test.ts create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/.fernignore b/.fernignore new file mode 100644 index 0000000..084a8eb --- /dev/null +++ b/.fernignore @@ -0,0 +1 @@ +# Specify files that shouldn't be modified by Fern diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c348128 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: ci + +on: [push] + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Compile + run: yarn && yarn build + + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Compile + run: yarn && yarn test + + publish: + needs: [ compile, test ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Install dependencies + run: yarn install + + - name: Build + run: yarn build + + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + npm publish --access public + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72271e0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +.DS_Store +/dist \ No newline at end of file diff --git a/.mock/definition/__package__.yml b/.mock/definition/__package__.yml new file mode 100644 index 0000000..a290f42 --- /dev/null +++ b/.mock/definition/__package__.yml @@ -0,0 +1,2544 @@ +errors: + UnprocessableEntityError: + status-code: 422 + type: HttpValidationError + docs: Validation Error +types: + AgentConfigResponse: + properties: + id: + type: string + docs: String ID of config. Starts with `config_`. + other: + type: optional> + docs: Other parameters that define the config. + type: literal<"agent"> + created_by: + type: optional + docs: The user who created the config. + status: + type: string + docs: Whether the config is committed or not. + name: + type: string + docs: Name of config. + description: + type: optional + docs: Description of config. + agent_class: + type: string + docs: Class of the agent. + tools: + type: optional> + docs: Tools associated with the agent. + model_config: + type: ModelConfigRequest + docs: Model config associated with the agent. + BaseMetricResponse: + properties: + id: + type: string + docs: ID of the metric. Starts with 'metric_'. + name: + type: string + docs: The name of the metric. + description: + type: string + docs: A description of what the metric measures. + code: + type: string + docs: Python code used to calculate a metric value on each logged datapoint. + default: + type: boolean + docs: >- + Whether the metric is a global default metric. Metrics with this flag + enabled cannot be deleted or modified. + active: + type: boolean + docs: If enabled, the metric is calculated for every logged datapoint. + created_at: datetime + updated_at: datetime + BooleanEvaluatorVersionStats: + docs: |- + Base attributes for stats for an Evaluator Version-Evaluated Version pair + in the Evaluation Report. + properties: + evaluator_version_id: + type: string + docs: Unique identifier for the Evaluator Version. + total_logs: + type: integer + docs: >- + The total number of Logs generated by this Evaluator Version on the + Evaluated Version's Logs. This includes Nulls and Errors. + num_judgments: + type: integer + docs: >- + The total number of Evaluator judgments for this Evaluator Version. + This excludes Nulls and Errors. + num_nulls: + type: integer + docs: >- + The total number of null judgments (i.e. abstentions) for this + Evaluator Version. + num_errors: + type: integer + docs: The total number of errored Evaluators for this Evaluator Version. + num_true: + type: integer + docs: The total number of `True` judgments for this Evaluator Version. + num_false: + type: integer + docs: The total number of `False` judgments for this Evaluator Version. + CategoricalFeedbackLabel: + properties: + value: string + sentiment: + type: LabelSentiment + docs: Whether the feedback sentiment is positive or negative. + status: + type: FeedbackLabelStatus + docs: Whether the feedback label is active or inactive. + ChatMessageContentItem: + discriminated: false + union: + - TextChatContent + - ImageChatContent + ChatMessageContent: + discriminated: false + docs: The content of the message. + union: + - string + - list + ChatMessage: + properties: + content: + type: optional + docs: The content of the message. + name: + type: optional + docs: Optional name of the message author. + tool_call_id: + type: optional + docs: Tool call that this message is responding to. + role: + type: ChatRole + docs: Role of the message author. + tool_calls: + type: optional> + docs: A list of tool calls requested by the assistant. + ChatMessageWithToolCallContentItem: + discriminated: false + union: + - TextChatContent + - ImageChatContent + ChatMessageWithToolCallContent: + discriminated: false + docs: The content of the message. + union: + - string + - list + ChatMessageWithToolCall: + properties: + content: + type: optional + docs: The content of the message. + name: + type: optional + docs: Optional name of the message author. + tool_call_id: + type: optional + docs: Tool call that this message is responding to. + role: + type: ChatRole + docs: Role of the message author. + tool_calls: + type: optional> + docs: A list of tool calls requested by the assistant. + tool_call: + type: optional + docs: >- + NB: Deprecated in favour of tool_calls. A tool call requested by the + assistant. + ChatRole: + enum: + - user + - assistant + - system + - tool + docs: An enumeration. + CodeEvaluatorRequest: + properties: + arguments_type: + type: EvaluatorArgumentsType + docs: Whether this evaluator is target-free or target-required. + return_type: + type: EvaluatorReturnTypeEnum + docs: The type of the return value of the evaluator. + evaluator_type: literal<"python"> + code: + type: optional + docs: >- + The code for the evaluator. This code will be executed in a sandboxed + environment. + CommitRequest: + properties: + commit_message: + type: string + docs: Message describing the changes made. + ConfigResponse: + discriminated: false + union: + - ModelConfigResponse + - ToolConfigResponse + - EvaluatorConfigResponse + - AgentConfigResponse + - GenericConfigResponse + CreateDatapointRequestTargetValue: + discriminated: false + union: + - string + - integer + - double + - boolean + - map + - list + CreateDatapointRequest: + properties: + inputs: + type: optional> + docs: The inputs to the prompt template. + messages: + type: optional> + docs: List of chat messages to provide to the model. + target: + type: optional> + docs: >- + Object with criteria necessary to evaluate generations with this + Datapoint. This is passed in as an argument to Evaluators when used in + an Evaluation. + CreateEvaluationRequest: + docs: >- + Request model for creating an Evaluation. + + + Evaluation benchmark your Prompt/Tool Versions. With the Datapoints in a + Dataset Version, + + Logs corresponding to the Datapoint and each Evaluated Version are + evaluated by the specified Evaluator Versions. + + Aggregated statistics are then calculated and presented in the Evaluation. + properties: + dataset: + type: EvaluationsDatasetRequest + docs: The Dataset Version to use in this Evaluation. + evaluatees: + docs: >- + Unique identifiers for the Prompt/Tool Versions to include in the + Evaluation Report. + type: list + evaluators: + docs: The Evaluators used to evaluate. + type: list + CreatePromptLogResponse: + properties: + id: + type: string + docs: String ID of log. + prompt_id: + type: string + docs: ID of the Prompt the log belongs to. + version_id: + type: string + docs: ID of the specific version of the Prompt. + session_id: + type: optional + docs: String ID of session the log belongs to. + CreateToolLogResponse: + properties: + id: + type: string + docs: String ID of log. + tool_id: + type: string + docs: ID of the Tool the log belongs to. + version_id: + type: string + docs: ID of the specific version of the Tool. + session_id: + type: optional + docs: String ID of session the log belongs to. + DashboardConfiguration: + properties: + time_unit: TimeUnit + time_range_days: integer + model_config_ids: list + DatapointResponseTargetValue: + discriminated: false + union: + - string + - integer + - double + - boolean + - map + - list + DatapointResponse: + properties: + inputs: + type: optional> + docs: The inputs to the prompt template. + messages: + type: optional> + docs: List of chat messages to provide to the model. + target: + type: optional> + docs: >- + Object with criteria necessary to evaluate generations with this + Datapoint. This is passed in as an argument to Evaluators when used in + an Evaluation. + id: + type: string + docs: Unique identifier for the Datapoint. Starts with `dp_`. + DatasetResponse: + docs: >- + Base type that all File Responses should inherit from. + + + Attributes defined here are common to all File Responses and should be + overridden + + in the inheriting classes with documentation and appropriate Field + definitions. + properties: + path: + type: string + docs: >- + Path of the Dataset, including the name, which is used as a unique + identifier. + id: + type: string + docs: Unique identifier for the Dataset. Starts with `ds_`. + name: + type: string + docs: Name of the Dataset, which is used as a unique identifier. + version_id: + type: string + docs: >- + Unique identifier for the specific Dataset Version. If no query params + provided, the default deployed Dataset Version is returned. Starts + with `dsv_`. + type: optional> + environments: + type: optional> + docs: The list of environments the Dataset Version is deployed to. + created_at: datetime + updated_at: datetime + created_by: + type: optional + docs: The user who created the Dataset. + status: + type: VersionStatus + docs: The status of the Dataset Version. + last_used_at: datetime + commit_message: + type: optional + docs: >- + Message describing the changes made. If provided, a committed version + of the Dataset is created. Otherwise, an uncommitted version is + created. + datapoints_count: + type: integer + docs: The number of Datapoints in this Dataset version. + datapoints: + type: optional> + docs: >- + The list of Datapoints in this Dataset version. Only provided if + explicitly requested. + DirectoryResponse: + properties: + name: + type: string + docs: Name of the directory to create. + parent_id: + type: optional + docs: >- + ID of the parent directory. Will be `None` if the directory is the + root directory. Starts with `dir_`. + id: + type: string + docs: String ID of directory. Starts with `dir_`. + created_at: datetime + updated_at: datetime + DirectoryWithParentsAndChildrenResponseFilesItem: + discriminated: false + union: + - PromptResponse + - ToolResponse + - EvaluatorResponse + - DatasetResponse + DirectoryWithParentsAndChildrenResponse: + properties: + name: + type: string + docs: Name of the directory to create. + parent_id: + type: optional + docs: >- + ID of the parent directory. Will be `None` if the directory is the + root directory. Starts with `dir_`. + id: + type: string + docs: String ID of directory. Starts with `dir_`. + created_at: datetime + updated_at: datetime + subdirectories: + docs: List of subdirectories in the directory. + type: list + files: + docs: List of files in the directory. + type: list + parents: + docs: List of parent directories of the directory. + type: list + EnvironmentResponse: + properties: + id: string + created_at: datetime + name: string + tag: EnvironmentTag + EnvironmentTag: + enum: + - default + - other + docs: An enumeration. + EvaluatedVersionResponse: + discriminated: false + union: + - PromptResponse + - ToolResponse + EvaluateeRequest: + properties: + version_id: + type: string + docs: >- + Unique identifier for the Prompt/Tool Version to include in the + Evaluation Report. Starts with `pv_` for Prompts and `tv_` for Tools. + batch_id: + type: optional + docs: >- + Unique identifier for the batch of Logs to include in the Evaluation + Report. + orchestrated: + type: optional + docs: >- + Whether the Prompt/Tool is orchestrated by Humanloop. Default is + `True`. If `False`, a log for the Prompt/Tool should be submitted by + the user via the API. + EvaluateeResponse: + properties: + version: EvaluatedVersionResponse + batch_id: + type: optional + docs: >- + Unique identifier for the batch of Logs to include in the Evaluation + Report. + orchestrated: + type: boolean + docs: >- + Whether the Prompt/Tool is orchestrated by Humanloop. Default is + `True`. If `False`, a log for the Prompt/Tool should be submitted by + the user via the API. + EvaluationDebugResultResponseValue: + discriminated: false + union: + - boolean + - double + EvaluationDebugResultResponse: + docs: >- + This is similar to an `EvaluationResult` but is ephemeral as it is only + for synchronous + + debug runs. It does not have an ID, or a reference to an evaluation run or + even an evaluation + + function. + properties: + log_id: string + log: LogResponse + datapoint_id: optional + llm_evaluation_log: optional + value: optional + error: optional + EvaluationEvaluatorResponse: + properties: + version: EvaluatorResponse + orchestrated: + type: boolean + docs: >- + Whether the Evaluator is orchestrated by Humanloop. Default is `True`. + If `False`, a log for the Evaluator should be submitted by the user + via the API. + EvaluationResponse: + properties: + id: + type: string + docs: Unique identifier for the Evaluation. Starts with `evr`. + dataset: + type: DatasetResponse + docs: The Dataset Version used in the Evaluation. + evaluatees: + docs: The Prompt/Tool Versions included in the Evaluation. + type: list + evaluators: + docs: The Evaluator Versions used to evaluate. + type: list + status: + type: EvaluationStatus + docs: > + The current status of the Evaluation. + + + - `"pending"`: The Evaluation has been created but is not actively + being worked on by Humanloop. + + - `"running"`: Humanloop is checking for any missing Logs and + Evaluator Logs, and will generate them where appropriate. + + - `"completed"`: All Logs an Evaluator Logs have been generated. + + - `"cancelled"`: The Evaluation has been cancelled by the user. + Humanloop will stop generating Logs and Evaluator Logs. + created_at: datetime + created_by: optional + updated_at: datetime + EvaluationResultResponseValue: + discriminated: false + union: + - boolean + - double + EvaluationResultResponse: + properties: + id: string + evaluator_id: string + evaluator_version_id: string + evaluation_id: optional + log_id: string + log: optional + version_id: optional + version: optional + value: optional + error: optional + updated_at: datetime + created_at: datetime + llm_evaluator_log: optional + EvaluationStats: + properties: + overall_stats: + type: OverallStats + docs: Stats for the Evaluation Report as a whole. + version_stats: + docs: Stats for each Evaluated Version in the Evaluation Report. + type: list + EvaluationStatus: + enum: + - pending + - running + - completed + - cancelled + - failed + docs: Status of an evaluation. + EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem: + discriminated: false + union: + - MonitoringEvaluatorVersionRequest + - MonitoringEvaluatorEnvironmentRequest + EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem: + discriminated: false + union: + - MonitoringEvaluatorVersionRequest + - MonitoringEvaluatorEnvironmentRequest + EvaluatorActivationDeactivationRequest: + properties: + evaluators_to_activate: + type: >- + optional> + docs: >- + Monitoring Evaluators to activate. These will be automatically run on + new Logs. + evaluators_to_deactivate: + type: >- + optional> + docs: Evaluators to deactivate. These will not be run on new Logs. + EvaluatorAggregate: + properties: + value: + type: double + docs: The aggregated value of the evaluator. + evaluator_id: + type: string + docs: ID of the evaluator. + evaluator_version_id: + type: string + docs: ID of the evaluator version. + created_at: datetime + updated_at: datetime + EvaluatorArgumentsType: + enum: + - target_free + - target_required + docs: Enum representing the possible argument types of an evaluator. + EvaluatorConfigResponse: + properties: + id: + type: string + docs: String ID of config. Starts with `config_`. + other: + type: optional> + docs: Other parameters that define the config. + type: literal<"evaluator"> + created_by: + type: optional + docs: The user who created the config. + status: + type: string + docs: Whether the config is committed or not. + name: + type: string + docs: Name of config. + description: + type: optional + docs: Description of config. + evaluator_type: + type: string + docs: Type of evaluator. + model_config: + type: optional + docs: The model config defining the LLM evaluator. + code: + type: optional + docs: >- + The code for the evaluator. This code will be executed in a sandboxed + environment. + arguments_type: + type: optional + docs: Whether this evaluator is target-free or target-required. + return_type: + type: optional + docs: The type of the return value of the evaluator. + EvaluatorResponseSpec: + discriminated: false + union: + - LlmEvaluatorRequest + - CodeEvaluatorRequest + - HumanEvaluatorRequest + EvaluatorResponse: + docs: Request model for creating a new Evaluator + properties: + path: + type: string + docs: >- + Path of the Dataset including the Dataset name, which is used as a + unique identifier. + id: + type: string + docs: Unique identifier for the Evaluator. + name: + type: string + docs: Name of the Evaluator, which is used as a unique identifier. + version_id: + type: string + docs: >- + Unique identifier for the specific Evaluator Version. If no query + params provided, the default deployed Evaluator Version is returned. + type: optional> + environments: + type: optional> + docs: The list of environments the Prompt Version is deployed to. + created_at: datetime + updated_at: datetime + created_by: + type: optional + docs: The user who created the Prompt. + status: VersionStatus + last_used_at: datetime + commit_message: + type: optional + docs: Message describing the changes made. + spec: EvaluatorResponseSpec + version_logs_count: + type: integer + docs: The number of logs that have been generated for this Prompt Version + total_logs_count: + type: integer + docs: The number of logs that have been generated across all Prompt Versions + inputs: + docs: >- + Inputs associated to the Prompt. Inputs correspond to any of the + variables used within the Prompt template. + type: list + evaluator_aggregates: + type: optional> + docs: Aggregation of Evaluator results for the Evaluator Version. + EvaluatorReturnTypeEnum: + enum: + - boolean + - number + docs: Enum representing the possible return types of an evaluator. + ExperimentResponse: + properties: + id: + type: string + docs: String ID of experiment. Starts with `exp_`. + file_id: + type: string + docs: String ID of file the experiment belongs to. + name: + type: string + docs: Name of experiment. + status: + type: ExperimentStatus + docs: Status of experiment. + versions: + type: optional> + docs: List of Versions associated to the experiment. + metric: + type: BaseMetricResponse + docs: Metric used as the experiment's objective. + positive_labels: + docs: >- + Feedback labels to treat as positive user feedback. Used to monitor + the performance of model configs in the experiment. + type: list + created_at: datetime + updated_at: datetime + ExperimentStatus: + enum: + - Initialized + - value: In progress + name: InProgress + docs: An enumeration. + ExperimentVersionResponse: + properties: + mean: + type: optional + docs: The mean performance of the Version. + spread: + type: optional + docs: The spread of performance of the Version. + trials_count: + type: integer + docs: Number of datapoints with feedback associated to the experiment. + active: + type: boolean + docs: >- + Whether the Version is active in the experiment. Only active model + configs can be sampled from the experiment. + id: + type: string + docs: String ID of Version. + commit_message: + type: optional + docs: Commit message of Version. + version_id: + type: string + docs: Version of the Prompt or Tool. + created_at: datetime + updated_at: datetime + FeedbackClass: + enum: + - select + - multi_select + - text + - number + docs: An enumeration. + FeedbackLabelStatus: + enum: + - unset + - active + - inactive + docs: Controls whether the label is displayed in the UI. + FeedbackResponseType: + discriminated: false + docs: >- + The type of feedback. The default feedback types available are 'rating', + 'action', 'issue', 'correction', and 'comment'. + union: + - FeedbackType + - string + FeedbackResponseValue: + discriminated: false + docs: >- + The feedback value to set. This would be the appropriate text for + 'correction' or 'comment', or a label to apply for 'rating', 'action', or + 'issue'. + union: + - double + - string + FeedbackResponse: + properties: + type: + type: FeedbackResponseType + docs: >- + The type of feedback. The default feedback types available are + 'rating', 'action', 'issue', 'correction', and 'comment'. + value: + type: FeedbackResponseValue + docs: >- + The feedback value to set. This would be the appropriate text for + 'correction' or 'comment', or a label to apply for 'rating', 'action', + or 'issue'. + data_id: + type: optional + docs: ID to associate the feedback to a previously logged datapoint. + user: + type: optional + docs: A unique identifier to who provided the feedback. + created_at: + type: optional + docs: 'User defined timestamp for when the feedback was created. ' + id: + type: string + docs: String ID of user feedback. Starts with `ann_`, short for annotation. + FeedbackTypeModelType: + discriminated: false + docs: >- + The type of feedback. The default feedback types available are 'rating', + 'action', 'issue', 'correction', and 'comment'. + union: + - FeedbackType + - string + FeedbackTypeModel: + properties: + type: + type: FeedbackTypeModelType + docs: >- + The type of feedback. The default feedback types available are + 'rating', 'action', 'issue', 'correction', and 'comment'. + values: + type: optional> + docs: >- + The allowed values for categorical feedback types. Not populated for + `correction` and `comment`. + FeedbackTypes: list + FileEnvironmentResponseFile: + discriminated: false + docs: >- + The version of the File that is deployed to the Environment, if one is + deployed. + union: + - PromptResponse + - ToolResponse + - DatasetResponse + - EvaluatorResponse + FileEnvironmentResponse: + docs: >- + Response model for the List Environments endpoint under Files. + + + Contains the deployed version of the File, if one is deployed to the + Environment. + properties: + id: string + created_at: datetime + name: string + tag: EnvironmentTag + file: + type: optional + docs: >- + The version of the File that is deployed to the Environment, if one is + deployed. + FunctionTool: + docs: A function tool to be called by the model where user owns runtime. + properties: + name: string + arguments: optional + FunctionToolChoice: + docs: A function tool to be called by the model where user owns runtime. + properties: + name: string + GenericConfigResponse: + properties: + id: + type: string + docs: String ID of config. Starts with `config_`. + other: + type: optional> + docs: Other parameters that define the config. + type: literal<"generic"> + created_by: + type: optional + docs: The user who created the config. + status: + type: string + docs: Whether the config is committed or not. + name: + type: string + docs: Name of config. + description: + type: optional + docs: Description of config. + HttpValidationError: + properties: + detail: optional> + HumanEvaluatorRequest: + properties: + arguments_type: + type: EvaluatorArgumentsType + docs: Whether this evaluator is target-free or target-required. + return_type: + type: EvaluatorReturnTypeEnum + docs: The type of the return value of the evaluator. + evaluator_type: literal<"human"> + ImageChatContent: + properties: + type: literal<"image_url"> + image_url: + type: ImageUrl + docs: The message's image content. + ImageUrlDetail: + enum: + - high + - low + - auto + docs: >- + Specify the detail level of the image provided to the model. For more + details see: + https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding + ImageUrl: + properties: + url: + type: string + docs: Either a URL of the image or the base64 encoded image data. + detail: + type: optional + docs: >- + Specify the detail level of the image provided to the model. For more + details see: + https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding + InputResponse: + properties: + name: + type: string + docs: Type of input. + LlmEvaluatorRequest: + properties: + arguments_type: + type: EvaluatorArgumentsType + docs: Whether this evaluator is target-free or target-required. + return_type: + type: EvaluatorReturnTypeEnum + docs: The type of the return value of the evaluator. + evaluator_type: literal<"llm"> + prompt: + type: optional + docs: The prompt parameters used to generate. + LabelSentiment: + enum: + - positive + - negative + - neutral + - unset + docs: |- + How a label should be treated in calculating Version performance. + + Used by a File's PAPV (Positive Action Per View) metric. + LinkedToolRequest: + properties: + id: + type: string + docs: The ID of the linked tool. Starts with "oc_" + source: + type: literal<"organization"> + docs: >- + The source of the linked tool. For a linked tool it should be + `organization` + name: + type: optional + docs: The name of the linked tool. + description: + type: optional + docs: The description of the linked tool. + parameters: + type: optional> + docs: The parameters of the linked tool. + LinkedToolResponse: + properties: + name: + type: string + docs: Name for the tool referenced by the model. + description: + type: string + docs: Description of the tool referenced by the model + parameters: + type: optional> + docs: >- + Parameters needed to run the Tool, defined in JSON Schema format: + https://json-schema.org/ + id: + type: string + docs: Unique identifier for the Tool linked. + version_id: + type: string + docs: Unique identifier for the Tool Version linked. + ListDatasets: + properties: + records: + docs: The list of Datasets. + type: list + ListEvaluators: + properties: + records: + docs: The list of Evaluators. + type: list + ListPrompts: + properties: + records: + docs: The list of Prompts. + type: list + ListTools: + properties: + records: + docs: The list of Tools. + type: list + LogResponseJudgment: + discriminated: false + union: + - boolean + - double + LogResponseToolChoice: + discriminated: false + docs: >- + Controls how the model uses tools. The following options are supported: + 'none' forces the model to not call a tool; the default when no tools are + provided as part of the model config. 'auto' the model can decide to call + one of the provided tools; the default when tools are provided as part of + the model config. Providing {'type': 'function', 'function': {name': + }} forces the model to use the named function. + union: + - literal<"none"> + - literal<"auto"> + - literal<"required"> + - ToolChoice + LogResponse: + docs: Request model for logging a datapoint. + properties: + project: + type: optional + docs: The name of the project associated with this log + project_id: + type: optional + docs: The unique ID of the project associated with this log. + session_id: + type: optional + docs: ID of the session to associate the datapoint. + session_reference_id: + type: optional + docs: >- + A unique string identifying the session to associate the datapoint to. + Allows you to log multiple datapoints to a session (using an ID kept + by your internal systems) by passing the same `session_reference_id` + in subsequent log requests. Specify at most one of this or + `session_id`. + parent_id: + type: optional + docs: ID associated to the parent datapoint in a session. + parent_reference_id: + type: optional + docs: >- + A unique string identifying the previously-logged parent datapoint in + a session. Allows you to log nested datapoints with your internal + system IDs by passing the same reference ID as `parent_id` in a prior + log request. Specify at most one of this or `parent_id`. Note that + this cannot refer to a datapoint being logged in the same request. + inputs: + type: optional> + docs: The inputs passed to the prompt template. + source: + type: optional + docs: Identifies where the model was called from. + metadata: + type: optional> + docs: Any additional metadata to record. + save: + type: optional + docs: Whether the request/response payloads will be stored on Humanloop. + source_datapoint_id: + type: optional + docs: >- + ID of the source datapoint if this is a log derived from a datapoint + in a dataset. + id: + type: string + docs: String ID of logged datapoint. Starts with `data_`. + reference_id: + type: optional + docs: Unique user-provided string identifying the datapoint. + trial_id: + type: optional + docs: Unique ID of an experiment trial to associate to the log. + messages: + type: optional> + docs: The messages passed to the to provider chat endpoint. + output: + type: optional + docs: >- + Generated output from your model for the provided inputs. Can be + `None` if logging an error, or if logging a parent datapoint with the + intention to populate it later + judgment: optional + config_id: + type: optional + docs: Unique ID of a config to associate to the log. + config: ConfigResponse + environment: + type: optional + docs: The environment name used to create the log. + feedback: optional> + created_at: + type: optional + docs: 'User defined timestamp for when the log was created. ' + error: + type: optional + docs: Error message if the log is an error. + duration: + type: optional + docs: Duration of the logged event in seconds. + output_message: + type: optional + docs: The message returned by the provider. + prompt_tokens: + type: optional + docs: Number of tokens in the prompt used to generate the output. + output_tokens: + type: optional + docs: Number of tokens in the output generated by the model. + prompt_cost: + type: optional + docs: Cost in dollars associated to the tokens in the prompt. + output_cost: + type: optional + docs: Cost in dollars associated to the tokens in the output. + provider_request: + type: optional> + docs: Raw request sent to provider. + provider_response: + type: optional> + docs: Raw response received the provider. + user: + type: optional + docs: User email address provided when creating the datapoint. + provider_latency: + type: optional + docs: Latency of provider response. + tokens: + type: optional + docs: Total number of tokens in the prompt and output. + raw_output: + type: optional + docs: Raw output from the provider. + finish_reason: + type: optional + docs: Reason the generation finished. + metric_values: optional> + tools: optional> + tool_choice: + type: optional + docs: >- + Controls how the model uses tools. The following options are + supported: 'none' forces the model to not call a tool; the default + when no tools are provided as part of the model config. 'auto' the + model can decide to call one of the provided tools; the default when + tools are provided as part of the model config. Providing {'type': + 'function', 'function': {name': }} forces the model to use + the named function. + evaluation_results: list + observability_status: ObservabilityStatus + updated_at: datetime + batch_ids: + type: optional> + docs: List of batch IDs the log belongs to. + MetricValueResponse: + properties: + metric_id: string + metric_name: string + metric_value: double + ModelConfigRequestStop: + discriminated: false + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + union: + - string + - list + ModelConfigRequestToolsItem: + discriminated: false + union: + - LinkedToolRequest + - ModelConfigToolRequest + ModelConfigRequest: + docs: Model config used for logging both chat and completion. + properties: + name: + type: optional + docs: >- + A friendly display name for the model config. If not provided, a name + will be generated. + description: + type: optional + docs: A description of the model config. + provider: + type: optional + docs: The company providing the underlying model service. + model: + type: string + docs: The model instance used. E.g. text-davinci-002. + max_tokens: + type: optional + docs: >- + The maximum number of tokens to generate. Provide max_tokens=-1 to + dynamically calculate the maximum number of tokens to generate given + the length of the prompt + default: -1 + temperature: + type: optional + docs: >- + What sampling temperature to use when making a generation. Higher + values means the model will be more creative. + default: 1 + top_p: + type: optional + docs: >- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p + probability mass. + default: 1 + stop: + type: optional + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + presence_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the generation so far. + default: 0 + frequency_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on how frequently they appear in the generation so far. + default: 0 + other: + type: optional> + docs: Other parameter values to be passed to the provider call. + seed: + type: optional + docs: >- + If specified, model will make a best effort to sample + deterministically, but it is not guaranteed. + response_format: + type: optional + docs: >- + The format of the response. Only type json_object is currently + supported for chat. + endpoint: + type: optional + docs: The provider model endpoint used. + prompt_template: + type: optional + docs: >- + Prompt template that will take your specified inputs to form your + final request to the model. Input variables within the prompt template + should be specified with syntax: {{INPUT_NAME}}. + chat_template: + type: optional> + docs: >- + Messages prepended to the list of messages sent to the provider. These + messages that will take your specified inputs to form your final + request to the provider model. Input variables within the template + should be specified with syntax: {{INPUT_NAME}}. + tools: + type: optional> + docs: Make tools available to OpenAIs chat model as functions. + type: optional> + ModelConfigResponseStop: + discriminated: false + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + union: + - string + - list + ModelConfigResponse: + docs: >- + Model config request. + + + Contains fields that are common to all (i.e. both chat and complete) + endpoints. + properties: + id: + type: string + docs: String ID of config. Starts with `config_`. + other: + type: optional> + docs: Other parameter values to be passed to the provider call. + type: literal<"model"> + name: + type: optional + docs: >- + A friendly display name for the model config. If not provided, a name + will be generated. + description: + type: optional + docs: A description of the model config. + provider: + type: optional + docs: The company providing the underlying model service. + model: + type: string + docs: The model instance used. E.g. text-davinci-002. + max_tokens: + type: optional + docs: >- + The maximum number of tokens to generate. Provide max_tokens=-1 to + dynamically calculate the maximum number of tokens to generate given + the length of the prompt + default: -1 + temperature: + type: optional + docs: >- + What sampling temperature to use when making a generation. Higher + values means the model will be more creative. + default: 1 + top_p: + type: optional + docs: >- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p + probability mass. + default: 1 + stop: + type: optional + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + presence_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the generation so far. + default: 0 + frequency_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on how frequently they appear in the generation so far. + default: 0 + seed: + type: optional + docs: >- + If specified, model will make a best effort to sample + deterministically, but it is not guaranteed. + response_format: + type: optional + docs: >- + The format of the response. Only type json_object is currently + supported for chat. + prompt_template: + type: optional + docs: >- + Prompt template that will take your specified inputs to form your + final request to the model. NB: Input variables within the prompt + template should be specified with syntax: {{INPUT_NAME}}. + chat_template: + type: optional> + docs: >- + Messages prepended to the list of messages sent to the provider. These + messages that will take your specified inputs to form your final + request to the provider model. NB: Input variables within the template + should be specified with syntax: {{INPUT_NAME}}. + tool_configs: + type: optional> + docs: >- + NB: Deprecated with tools field. Definition of tools shown to the + model. + tools: + type: optional> + docs: Tools shown to the model. + endpoint: + type: optional + docs: The provider model endpoint used. + ModelConfigToolRequest: + docs: |- + Definition of tool within a model config. + + The subset of ToolConfig parameters received by the chat endpoint. + Does not have things like the signature or setup schema. + properties: + name: + type: string + docs: The name of the tool shown to the model. + description: + type: optional + docs: The description of the tool shown to the model. + parameters: + type: optional> + docs: >- + Definition of parameters needed to run the tool. Provided in + jsonschema format: https://json-schema.org/ + source: + type: optional + docs: >- + Source of the tool. If defined at an organization level will be + 'organization' else 'inline'. + source_code: + type: optional + docs: Code source of the tool. + other: + type: optional> + docs: Other parameters that define the config. + preset_name: + type: optional + docs: >- + If is_preset = true, this is the name of the preset tool on Humanloop. + This is used as the key to look up the Humanloop runtime of the tool + ModelEndpoints: + enum: + - complete + - chat + - edit + docs: Supported model provider endpoints. + ModelProviders: + enum: + - openai + - openai_azure + - ai21 + - mock + - anthropic + - langchain + - cohere + - replicate + - google + - groq + docs: Supported model providers. + MonitoringEvaluatorEnvironmentRequest: + properties: + evaluator_id: + type: string + docs: Unique identifier for the Evaluator to be used for monitoring. + environment_id: + type: string + docs: >- + Unique identifier for the Environment. The Evaluator Version deployed + to this Environment will be used for monitoring. + MonitoringEvaluatorResponse: + properties: + version_reference: + type: VersionReferenceResponse + docs: >- + The Evaluator Version used for monitoring. This can be a specific + Version by ID, or a Version deployed to an Environment. + version: + type: optional + docs: The deployed Version. + state: + type: MonitoringEvaluatorState + docs: The state of the Monitoring Evaluator. Either `active` or `inactive` + created_at: datetime + updated_at: datetime + MonitoringEvaluatorState: + enum: + - active + - inactive + docs: State of an evaluator connected to a file + MonitoringEvaluatorVersionRequest: + properties: + evaluator_version_id: + type: string + docs: Unique identifier for the Evaluator Version to be used for monitoring. + NumericEvaluatorVersionStats: + docs: |- + Base attributes for stats for an Evaluator Version-Evaluated Version pair + in the Evaluation Report. + properties: + evaluator_version_id: + type: string + docs: Unique identifier for the Evaluator Version. + total_logs: + type: integer + docs: >- + The total number of Logs generated by this Evaluator Version on the + Evaluated Version's Logs. This includes Nulls and Errors. + num_judgments: + type: integer + docs: >- + The total number of Evaluator judgments for this Evaluator Version. + This excludes Nulls and Errors. + num_nulls: + type: integer + docs: >- + The total number of null judgments (i.e. abstentions) for this + Evaluator Version. + num_errors: + type: integer + docs: The total number of errored Evaluators for this Evaluator Version. + mean: optional + std: optional + percentiles: map + ObservabilityStatus: + enum: + - pending + - running + - completed + - failed + docs: |- + Status of a Log for observability. + + Observability is implemented by running monitoring Evaluators on Logs. + OverallStats: + properties: + num_datapoints: + type: integer + docs: >- + The total number of Datapoints in the Evaluation Report's Dataset + Version. + total_logs: + type: integer + docs: The total number of Logs in the Evaluation Report. + total_evaluator_logs: + type: integer + docs: The total number of Evaluator Logs in the Evaluation Report. + PaginatedDatapointResponse: + properties: + records: list + page: integer + size: integer + total: integer + PaginatedDatasetResponse: + properties: + records: list + page: integer + size: integer + total: integer + PaginatedEvaluationResponse: + properties: + records: list + page: integer + size: integer + total: integer + PaginatedPromptLogResponse: + properties: + records: list + page: integer + size: integer + total: integer + PaginatedSessionResponse: + properties: + records: list + page: integer + size: integer + total: integer + PlatformAccessEnum: + enum: + - superadmin + - supportadmin + - user + docs: An enumeration. + PositiveLabel: + properties: + type: string + value: string + ProjectSortBy: + enum: + - created_at + - updated_at + - name + docs: An enumeration. + PromptCallLogResponse: + docs: Sample specific response details for a Prompt call + properties: + output: + type: optional + docs: >- + Generated output from your model for the provided inputs. Can be + `None` if logging an error, or if creating a parent Log with the + intention to populate it later. + raw_output: + type: optional + docs: Raw output from the provider. + created_at: + type: optional + docs: 'User defined timestamp for when the log was created. ' + error: + type: optional + docs: Error message if the log is an error. + provider_latency: + type: optional + docs: Duration of the logged event in seconds. + output_message: + type: optional + docs: The message returned by the provider. + prompt_tokens: + type: optional + docs: Number of tokens in the prompt used to generate the output. + output_tokens: + type: optional + docs: Number of tokens in the output generated by the model. + prompt_cost: + type: optional + docs: Cost in dollars associated to the tokens in the prompt. + output_cost: + type: optional + docs: Cost in dollars associated to the tokens in the output. + finish_reason: + type: optional + docs: Reason the generation finished. + index: + type: integer + docs: The index of the sample in the batch. + PromptCallResponseToolChoice: + discriminated: false + docs: >- + Controls how the model uses tools. The following options are supported: + + - `'none'` means the model will not call any tool and instead generates a + message; this is the default when no tools are provided as part of the + Prompt. + + - `'auto'` means the model can decide to call one or more of the provided + tools; this is the default when tools are provided as part of the Prompt. + + - `'required'` means the model can decide to call one or more of the + provided tools. + + - `{'type': 'function', 'function': {name': }}` forces the + model to use the named function. + union: + - literal<"none"> + - literal<"auto"> + - literal<"required"> + - ToolChoice + PromptCallResponse: + docs: Response model for a Prompt call with potentially multiple log samples. + properties: + prompt: + type: PromptResponse + docs: Prompt details used to generate the log. + messages: + type: optional> + docs: The messages passed to the to provider chat endpoint. + tool_choice: + type: optional + docs: >- + Controls how the model uses tools. The following options are + supported: + + - `'none'` means the model will not call any tool and instead + generates a message; this is the default when no tools are provided as + part of the Prompt. + + - `'auto'` means the model can decide to call one or more of the + provided tools; this is the default when tools are provided as part of + the Prompt. + + - `'required'` means the model can decide to call one or more of the + provided tools. + + - `{'type': 'function', 'function': {name': }}` forces the + model to use the named function. + session_id: + type: optional + docs: >- + Unique identifier for the Session to associate the Log to. Allows you + to record multiple Logs to a Session (using an ID kept by your + internal systems) by passing the same `session_id` in subsequent log + requests. + parent_id: + type: optional + docs: >- + Unique identifier for the parent Log in a Session. Should only be + provided if `session_id` is provided. If provided, the Log will be + nested under the parent Log within the Session. + inputs: + type: optional> + docs: The inputs passed to the prompt template. + source: + type: optional + docs: Identifies where the model was called from. + metadata: + type: optional> + docs: Any additional metadata to record. + save: + type: optional + docs: Whether the request/response payloads will be stored on Humanloop. + source_datapoint_id: + type: optional + docs: >- + Unique identifier for the Datapoint that this Log is derived from. + This can be used by Humanloop to associate Logs to Evaluations. If + provided, Humanloop will automatically associate this Log to + Evaluations that require a Log for this Datapoint-Version pair. + batches: + type: optional> + docs: >- + Array of Batch Ids that this log is part of. Batches are used to group + Logs together for offline Evaluations + user: + type: optional + docs: End-user ID related to the Log. + environment: + type: optional + docs: The name of the Environment the Log is associated to. + id: + type: string + docs: ID of the log. + logs: + docs: The logs generated by the Prompt call. + type: list + PromptCallStreamResponse: + docs: Response model for calling Prompt in streaming mode. + properties: + output: + type: optional + docs: >- + Generated output from your model for the provided inputs. Can be + `None` if logging an error, or if creating a parent Log with the + intention to populate it later. + raw_output: + type: optional + docs: Raw output from the provider. + created_at: + type: optional + docs: 'User defined timestamp for when the log was created. ' + error: + type: optional + docs: Error message if the log is an error. + provider_latency: + type: optional + docs: Duration of the logged event in seconds. + output_message: + type: optional + docs: The message returned by the provider. + prompt_tokens: + type: optional + docs: Number of tokens in the prompt used to generate the output. + output_tokens: + type: optional + docs: Number of tokens in the output generated by the model. + prompt_cost: + type: optional + docs: Cost in dollars associated to the tokens in the prompt. + output_cost: + type: optional + docs: Cost in dollars associated to the tokens in the output. + finish_reason: + type: optional + docs: Reason the generation finished. + index: + type: integer + docs: The index of the sample in the batch. + id: + type: string + docs: ID of the log. + prompt_id: + type: string + docs: ID of the Prompt the log belongs to. + version_id: + type: string + docs: ID of the specific version of the Prompt. + PromptKernelRequestTemplate: + discriminated: false + docs: >- + For chat endpoint, provide a Chat template. For completion endpoint, + provide a Prompt template. Input variables within the template should be + specified with double curly bracket syntax: {{INPUT_NAME}}. + union: + - string + - list + PromptKernelRequestStop: + discriminated: false + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + union: + - string + - list + PromptKernelRequest: + properties: + model: + type: string + docs: >- + The model instance used, e.g. `gpt-4`. See [supported + models](https://humanloop.com/docs/supported-models) + endpoint: + type: optional + docs: The provider model endpoint used. + template: + type: optional + docs: >- + For chat endpoint, provide a Chat template. For completion endpoint, + provide a Prompt template. Input variables within the template should + be specified with double curly bracket syntax: {{INPUT_NAME}}. + provider: + type: optional + docs: The company providing the underlying model service. + max_tokens: + type: optional + docs: >- + The maximum number of tokens to generate. Provide max_tokens=-1 to + dynamically calculate the maximum number of tokens to generate given + the length of the prompt + default: -1 + temperature: + type: optional + docs: >- + What sampling temperature to use when making a generation. Higher + values means the model will be more creative. + default: 1 + top_p: + type: optional + docs: >- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p + probability mass. + default: 1 + stop: + type: optional + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + presence_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the generation so far. + default: 0 + frequency_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on how frequently they appear in the generation so far. + default: 0 + other: + type: optional> + docs: Other parameter values to be passed to the provider call. + seed: + type: optional + docs: >- + If specified, model will make a best effort to sample + deterministically, but it is not guaranteed. + response_format: + type: optional + docs: >- + The format of the response. Only `{"type": "json_object"}` is + currently supported for chat. + tools: + type: optional> + docs: >- + The tool specification that the model can choose to call if Tool + calling is supported. + linked_tools: + type: optional> + docs: >- + The IDs of the Tools in your organization that the model can choose to + call if Tool calling is supported. The default deployed version of + that tool is called. + PromptLogResponseToolChoice: + discriminated: false + docs: >- + Controls how the model uses tools. The following options are supported: + + - `'none'` means the model will not call any tool and instead generates a + message; this is the default when no tools are provided as part of the + Prompt. + + - `'auto'` means the model can decide to call one or more of the provided + tools; this is the default when tools are provided as part of the Prompt. + + - `'required'` means the model can decide to call one or more of the + provided tools. + + - `{'type': 'function', 'function': {name': }}` forces the + model to use the named function. + union: + - literal<"none"> + - literal<"auto"> + - literal<"required"> + - ToolChoice + PromptLogResponse: + docs: Request for creating a Prompt log. + properties: + id: + type: string + docs: Unique identifier for the Log. + output_message: + type: optional + docs: The message returned by the provider. + prompt_tokens: + type: optional + docs: Number of tokens in the prompt used to generate the output. + output_tokens: + type: optional + docs: Number of tokens in the output generated by the model. + prompt_cost: + type: optional + docs: Cost in dollars associated to the tokens in the prompt. + output_cost: + type: optional + docs: Cost in dollars associated to the tokens in the output. + finish_reason: + type: optional + docs: Reason the generation finished. + prompt: + type: PromptResponse + docs: Prompt details used to generate the log. + messages: + type: optional> + docs: The messages passed to the to provider chat endpoint. + tool_choice: + type: optional + docs: >- + Controls how the model uses tools. The following options are + supported: + + - `'none'` means the model will not call any tool and instead + generates a message; this is the default when no tools are provided as + part of the Prompt. + + - `'auto'` means the model can decide to call one or more of the + provided tools; this is the default when tools are provided as part of + the Prompt. + + - `'required'` means the model can decide to call one or more of the + provided tools. + + - `{'type': 'function', 'function': {name': }}` forces the + model to use the named function. + output: + type: optional + docs: >- + Generated output from your model for the provided inputs. Can be + `None` if logging an error, or if creating a parent Log with the + intention to populate it later. + raw_output: + type: optional + docs: Raw output from the provider. + created_at: + type: optional + docs: 'User defined timestamp for when the log was created. ' + error: + type: optional + docs: Error message if the log is an error. + provider_latency: + type: optional + docs: Duration of the logged event in seconds. + provider_request: + type: optional> + docs: Raw request sent to provider. + provider_response: + type: optional> + docs: Raw response received the provider. + session_id: + type: optional + docs: >- + Unique identifier for the Session to associate the Log to. Allows you + to record multiple Logs to a Session (using an ID kept by your + internal systems) by passing the same `session_id` in subsequent log + requests. + parent_id: + type: optional + docs: >- + Unique identifier for the parent Log in a Session. Should only be + provided if `session_id` is provided. If provided, the Log will be + nested under the parent Log within the Session. + inputs: + type: optional> + docs: The inputs passed to the prompt template. + source: + type: optional + docs: Identifies where the model was called from. + metadata: + type: optional> + docs: Any additional metadata to record. + save: + type: optional + docs: Whether the request/response payloads will be stored on Humanloop. + source_datapoint_id: + type: optional + docs: >- + Unique identifier for the Datapoint that this Log is derived from. + This can be used by Humanloop to associate Logs to Evaluations. If + provided, Humanloop will automatically associate this Log to + Evaluations that require a Log for this Datapoint-Version pair. + batches: + type: optional> + docs: >- + Array of Batch Ids that this log is part of. Batches are used to group + Logs together for offline Evaluations + user: + type: optional + docs: End-user ID related to the Log. + environment: + type: optional + docs: The name of the Environment the Log is associated to. + PromptResponseTemplate: + discriminated: false + docs: >- + For chat endpoint, provide a Chat template. For completion endpoint, + provide a Prompt template. Input variables within the template should be + specified with double curly bracket syntax: {{INPUT_NAME}}. + union: + - string + - list + PromptResponseStop: + discriminated: false + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + union: + - string + - list + PromptResponse: + docs: Request model for creating a new Prompt + properties: + path: + type: string + docs: >- + Path of the Prompt, including the name, which is used as a unique + identifier. + id: + type: string + docs: Unique identifier for the Prompt. + name: + type: string + docs: Name of the Prompt. + version_id: + type: string + docs: >- + Unique identifier for the specific Prompt Version. If no query params + provided, the default deployed Prompt Version is returned. + type: optional> + environments: + type: optional> + docs: The list of environments the Prompt Version is deployed to. + created_at: datetime + updated_at: datetime + created_by: + type: optional + docs: The user who created the Prompt. + status: + type: VersionStatus + docs: The status of the Prompt Version. + last_used_at: datetime + model: + type: string + docs: >- + The model instance used, e.g. `gpt-4`. See [supported + models](https://humanloop.com/docs/supported-models) + endpoint: + type: optional + docs: The provider model endpoint used. + template: + type: optional + docs: >- + For chat endpoint, provide a Chat template. For completion endpoint, + provide a Prompt template. Input variables within the template should + be specified with double curly bracket syntax: {{INPUT_NAME}}. + provider: + type: optional + docs: The company providing the underlying model service. + max_tokens: + type: optional + docs: >- + The maximum number of tokens to generate. Provide max_tokens=-1 to + dynamically calculate the maximum number of tokens to generate given + the length of the prompt + default: -1 + temperature: + type: optional + docs: >- + What sampling temperature to use when making a generation. Higher + values means the model will be more creative. + default: 1 + top_p: + type: optional + docs: >- + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p + probability mass. + default: 1 + stop: + type: optional + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + presence_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on whether they appear in the generation so far. + default: 0 + frequency_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens based + on how frequently they appear in the generation so far. + default: 0 + other: + type: optional> + docs: Other parameter values to be passed to the provider call. + seed: + type: optional + docs: >- + If specified, model will make a best effort to sample + deterministically, but it is not guaranteed. + response_format: + type: optional + docs: >- + The format of the response. Only `{"type": "json_object"}` is + currently supported for chat. + tools: + type: optional> + docs: >- + The tool specification that the model can choose to call if Tool + calling is supported. + linked_tools: + type: optional> + docs: The tools linked to your prompt that the model can call. + commit_message: + type: optional + docs: Message describing the changes made. + version_logs_count: + type: integer + docs: The number of logs that have been generated for this Prompt Version + total_logs_count: + type: integer + docs: The number of logs that have been generated across all Prompt Versions + inputs: + docs: >- + Inputs associated to the Prompt. Inputs correspond to any of the + variables used within the Prompt template. + type: list + evaluator_aggregates: + type: optional> + docs: Aggregation of Evaluator results for the Prompt Version. + ProviderApiKeys: + properties: + openai: optional + ai21: optional + mock: optional + anthropic: optional + cohere: optional + openai_azure: optional + openai_azure_endpoint: optional + ResponseFormat: + docs: Response format of the model. + properties: + type: literal<"json_object"> + SessionResponse: + properties: + id: + type: string + docs: Unique identifier for the Session. + created_at: datetime + updated_at: datetime + logs: + docs: List of Logs associated with this Session. + type: list + SortOrder: + enum: + - asc + - desc + docs: An enumeration. + TextChatContent: + properties: + type: literal<"text"> + text: + type: string + docs: The message's text content. + TimeUnit: + enum: + - day + - week + - month + docs: An enumeration. + ToolCall: + docs: A tool call to be made. + properties: + id: string + type: ChatToolType + function: FunctionTool + ToolChoice: + docs: Tool choice to force the model to use a tool. + properties: + type: ChatToolType + function: FunctionToolChoice + ToolConfigRequest: + docs: |- + Definition of tool within a model config. + + The subset of ToolConfig parameters received by the chat endpoint. + Does not have things like the signature or setup schema. + properties: + name: + type: string + docs: The name of the tool shown to the model. + description: + type: optional + docs: The description of the tool shown to the model. + parameters: + type: optional> + docs: >- + Definition of parameters needed to run the tool. Provided in + jsonschema format: https://json-schema.org/ + source: + type: optional + docs: >- + Source of the tool. If defined at an organization level will be + 'organization' else 'inline'. + source_code: + type: optional + docs: Code source of the tool. + other: + type: optional> + docs: Other parameters that define the config. + preset_name: + type: optional + docs: >- + If is_preset = true, this is the name of the preset tool on Humanloop. + This is used as the key to look up the Humanloop runtime of the tool + type: literal<"tool"> + ToolConfigResponse: + properties: + id: + type: string + docs: String ID of config. Starts with `config_`. + other: + type: optional> + docs: Other parameters that define the config. + type: literal<"tool"> + created_by: + type: optional + docs: The user who created the config. + status: + type: string + docs: Whether the config is committed or not. + name: + type: string + docs: Name for the tool referenced by the model. + description: + type: optional + docs: Description of the tool referenced by the model + source: + type: optional + docs: >- + Source of the tool. If defined at an organization level will be + 'organization' else 'inline'. + source_code: + type: optional + docs: Code source of the tool. + setup_schema: + type: optional> + docs: >- + Definition of parameters needed to run the tool. Provided in + jsonschema format: https://json-schema.org/ + parameters: + type: optional> + docs: >- + Definition of parameters needed to run the tool. Provided in + jsonschema format: https://json-schema.org/ + signature: + type: optional + docs: The function signature of the tool when being called. + is_preset: + type: optional + docs: Whether the tool is one where Humanloop defines runtime or not. + preset_name: + type: optional + docs: >- + If is_preset = true, this is the name of the preset tool on Humanloop. + This is used as the key to lookup the Humanloop runtime of the tool + ToolFunction: + properties: + name: + type: string + docs: Name for the tool referenced by the model. + description: + type: string + docs: Description of the tool referenced by the model + parameters: + type: optional> + docs: >- + Parameters needed to run the Tool, defined in JSON Schema format: + https://json-schema.org/ + ToolKernelRequest: + properties: + function: + type: optional + docs: >- + Callable function specification of the Tool shown to the model for + tool calling. + source_code: + type: optional + docs: Code source of the Tool. + setup_values: + type: optional> + docs: >- + Values needed to setup the Tool, defined in JSON Schema format: + https://json-schema.org/ + ToolResultResponse: + docs: A result from a tool used to populate the prompt template + properties: + id: string + name: string + signature: string + result: string + ToolSource: + enum: + - organization + - inline + docs: >- + Source of tool. Used to differentiate between tools and tool versions when + they are combined in a list. + + + V4 uses organization and inline. Those are deprecated and will be removed + in favour of tool and tool_version. + UpdateDatesetAction: + enum: + - set + - add + - remove + docs: An enumeration. + ValidationErrorLocItem: + discriminated: false + union: + - string + - integer + ValidationError: + properties: + loc: list + msg: string + type: string + VersionDeploymentResponseFile: + discriminated: false + docs: The File that the deployed Version belongs to. + union: + - PromptResponse + - ToolResponse + - DatasetResponse + - EvaluatorResponse + VersionDeploymentResponse: + docs: A variable reference to the Version deployed to an Environment + properties: + file: + type: VersionDeploymentResponseFile + docs: The File that the deployed Version belongs to. + environment: + type: EnvironmentResponse + docs: The Environment that the Version is deployed to. + type: literal<"environment"> + VersionIdResponseVersion: + discriminated: false + docs: The specific Version being referenced. + union: + - PromptResponse + - ToolResponse + - DatasetResponse + - EvaluatorResponse + VersionIdResponse: + docs: A reference to a specific Version by its ID + properties: + version: + type: VersionIdResponseVersion + docs: The specific Version being referenced. + type: literal<"version"> + VersionReferenceResponse: + discriminated: false + union: + - VersionDeploymentResponse + - VersionIdResponse + VersionStatsEvaluatorVersionStatsItem: + discriminated: false + union: + - NumericEvaluatorVersionStats + - BooleanEvaluatorVersionStats + VersionStats: + docs: Stats for an Evaluated Version in the Evaluation Report. + properties: + version_id: + type: string + docs: Unique identifier for the Evaluated Version. + num_logs: + type: integer + docs: >- + The total number of existing Logs for this Evaluated Version within + the Evaluation Report. These are Logs that have been generated by this + Evaluated Version on a Datapoint belonging to the Evaluation Report's + Dataset Version. + evaluator_version_stats: + docs: >- + Stats for each Evaluator Version used to evaluate this Evaluated + Version. + type: list + VersionStatus: + enum: + - uncommitted + - committed + - deleted + docs: An enumeration. + ChatToolType: + type: literal<"function"> + docs: The type of tool to call. + FilesToolType: + enum: + - pinecone_search + - google + - mock + - snippet + - json_schema + - get_api_call + docs: Type of tool. + ConfigToolResponse: + properties: + id: + type: string + docs: The ID of the tool. Starts with either `config_` or `oc_`. + name: + type: string + docs: Name for the tool referenced by the model. + description: + type: optional + docs: Description of the tool referenced by the model + parameters: + type: optional> + docs: >- + Definition of parameters needed to run the tool. Provided in + jsonschema format: https://json-schema.org/ + source: + type: optional + docs: The origin of the tool + FeedbackType: + enum: + - rating + - action + - issue + - correction + - comment + docs: An enumeration. + BaseModelsUserResponse: + properties: + id: + type: string + docs: String ID of user. Starts with `usr_`. + email_address: + type: string + docs: The user's email address. + full_name: + type: optional + docs: The user's full name. + verified: + type: boolean + docs: Whether the user has verified their email address. + EvaluationsDatasetRequest: + properties: + version_id: + type: string + docs: >- + Unique identifier for the Dataset Version to use in this evaluation. + Starts with `dsv_`. + EvaluationsRequest: + properties: + version_id: + type: string + docs: >- + Unique identifier for the Evaluator Version to use in this evaluation. + Starts with `evv_`. + orchestrated: + type: optional + docs: >- + Whether the Evaluator is orchestrated by Humanloop. Default is `True`. + If `False`, a log for the Evaluator should be submitted by the user + via the API. + ToolResponse: + docs: Request to create a new Tool. + properties: + path: + type: string + docs: >- + Path of the Tool, including the name, which is used as a unique + identifier. + id: + type: string + docs: Unique identifier for the Tool. + name: + type: string + docs: Name of the Tool, which is used as a unique identifier. + version_id: + type: string + docs: >- + Unique identifier for the specific Tool Version. If no query params + provided, the default deployed Tool Version is returned. + type: optional> + environments: + type: optional> + docs: The list of environments the Tool Version is deployed to. + created_at: datetime + updated_at: datetime + created_by: + type: optional + docs: The user who created the Tool. + status: + type: VersionStatus + docs: The status of the Tool Version. + last_used_at: datetime + function: + type: optional + docs: >- + Callable function specification of the Tool shown to the model for + tool calling. + source_code: + type: optional + docs: Code source of the Tool. + setup_values: + type: optional> + docs: >- + Values needed to setup the Tool, defined in JSON Schema format: + https://json-schema.org/ + tool_type: + type: optional + docs: Type of Tool. + commit_message: + type: optional + docs: Message describing the changes made. + version_logs_count: + type: integer + docs: The number of logs that have been generated for this Tool Version + total_logs_count: + type: integer + docs: The number of logs that have been generated across all Tool Versions + inputs: + docs: >- + Inputs associated to the Prompt. Inputs correspond to any of the + variables used within the Tool template. + type: list + signature: + type: optional + docs: Signature of the Tool. + evaluator_aggregates: + type: optional> + docs: Aggregation of Evaluator results for the Tool Version. + UserResponse: + properties: + id: + type: string + docs: Unique identifier for User. Starts with `usr`. + email_address: + type: string + docs: The User's email address. + full_name: + type: optional + docs: The User's full name. diff --git a/.mock/definition/api.yml b/.mock/definition/api.yml new file mode 100644 index 0000000..f57a035 --- /dev/null +++ b/.mock/definition/api.yml @@ -0,0 +1,14 @@ +name: api +error-discrimination: + strategy: status-code +display-name: Humanloop API +environments: + Default: https://api.humanloop.com/v5 +default-environment: Default +auth-schemes: + APIKeyHeader: + header: X-API-KEY + name: apiKey + type: string + env: HUMANLOOP_API_KEY +auth: APIKeyHeader diff --git a/.mock/definition/datasets.yml b/.mock/definition/datasets.yml new file mode 100644 index 0000000..7ac85e5 --- /dev/null +++ b/.mock/definition/datasets.yml @@ -0,0 +1,807 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /datasets + method: GET + auth: true + docs: Get a list of Datasets. + pagination: + offset: $request.page + results: $response.records + display-name: 'List ' + request: + name: DatasetsListRequest + query-parameters: + page: + type: optional + docs: Page offset for pagination. + size: + type: optional + docs: Page size for pagination. Number of Datasets to fetch. + name: + type: optional + docs: Case-insensitive filter for Dataset name. + user_filter: + type: optional + docs: >- + Case-insensitive filter for users in the Dataset. This filter + matches against both email address and name of users. + sort_by: + type: optional + docs: Field to sort Datasets by + order: + type: optional + docs: Direction to sort by. + response: + docs: Successful Response + type: root.PaginatedDatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - id: id + page: 1 + size: 1 + total: 1 + upsert: + path: /datasets + method: POST + auth: true + docs: >- + Create a Dataset or update it with a new version if it already exists. + + + Datasets are identified by the `ID` or their `path`. The datapoints + determine the versions of the Dataset. + + + By default, the new Dataset version will be set to the list of + Datapoints provided in + + the request. You can also create a new version by adding or removing + Datapoints from an existing version + + by specifying `action` as `add` or `remove` respectively. In this case, + you may specify + + the `version_id` or `environment` query parameters to identify the + existing version to base + + the new version on. If neither is provided, the default deployed version + will be used. + + + If you provide a commit message, then the new version will be committed; + + otherwise it will be uncommitted. If you try to commit an already + committed version, + + an exception will be raised. + + + Humanloop also deduplicates Datapoints. If you try to add a Datapoint + that already + + exists, it will be ignored. If you intentionally want to add a duplicate + Datapoint, + + you can add a unique identifier to the Datapoint's inputs such as + `{_dedupe_id: }`. + display-name: Upsert Dataset + request: + name: DatasetsRequest + query-parameters: + version_id: + type: optional + docs: >- + ID of the specific Dataset version to base the created Version on. + Only used when `action` is `"add"` or `"remove"`. + environment: + type: optional + docs: >- + Name of the Environment identifying a deployed Version to base the + created Version on. Only used when `action` is `"add"` or + `"remove"`. + body: + properties: + path: + type: optional + docs: >- + Path of the Dataset, including the name, which is used as a + unique identifier. + id: + type: optional + docs: ID for an existing Dataset to update. + datapoints: + docs: >- + The Datapoints to create this Dataset version with. Modify the + `action` field to determine how these Datapoints are used. + type: list + action: + type: optional + docs: >- + The action to take with the provided Datapoints. + + - If `"set"`, the created version will only contain the Datapoints provided in this request. + - If `"add"`, the created version will contain the Datapoints provided in this request in addition to the Datapoints in the target version. + - If `"remove"`, the created version will contain the Datapoints in the target version except for the Datapoints provided in this request. + + If `"add"` or `"remove"`, one of the `version_id` or + `environment` query parameters may be provided. + commit_message: + type: optional + docs: >- + Message describing the changes made. If provided, a committed + version of the Dataset is created. Otherwise, an uncommitted + version is created. + response: + docs: Successful Response + type: root.DatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - request: + datapoints: + - {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + get: + path: /datasets/{id} + method: GET + auth: true + docs: >- + Retrieve the Dataset with the given ID. + + + Unless `include_datapoints` is set to `true`, the response will not + include + + the Datapoints. + + Use the List Datapoints endpoint (`GET /{id}/datapoints`) to efficiently + + retrieve Datapoints for a large Dataset. + + + By default, the deployed version of the Dataset is returned. Use the + query parameters + + `version_id` or `environment` to target a specific version of the + Dataset. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + display-name: Get Dataset + request: + name: DatasetsGetRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Dataset to retrieve. + environment: + type: optional + docs: Name of the Environment to retrieve a deployed Version from. + include_datapoints: + type: optional + docs: >- + If set to `true`, include all Datapoints in the response. Defaults + to `false`. Consider using the paginated List Datapoints endpoint + instead. + response: + docs: Successful Response + type: root.DatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + delete: + path: /datasets/{id} + method: DELETE + auth: true + docs: Delete the Dataset with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + display-name: Delete Dataset + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + move: + path: /datasets/{id} + method: PATCH + auth: true + docs: Update the Dataset with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + display-name: Move Dataset + request: + name: UpdateDatasetRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Dataset including the Dataset name, which is used as + a unique identifier. + name: + type: optional + docs: Name of the Dataset, which is used as a unique identifier. + response: + docs: Successful Response + type: root.DatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + listdatapoints: + path: /datasets/{id}/datapoints + method: GET + auth: true + docs: List all Datapoints for the Dataset with the given ID. + pagination: + offset: $request.page + results: $response.records + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + display-name: List Datapoints + request: + name: DatasetsListDatapointsRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Dataset to retrieve. + environment: + type: optional + docs: Name of the Environment to retrieve a deployed Version from. + page: + type: optional + docs: Page number for pagination. + size: + type: optional + docs: Page size for pagination. Number of Datapoints to fetch. + response: + docs: Successful Response + type: root.PaginatedDatapointResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + records: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + page: 1 + size: 1 + total: 1 + listversions: + path: /datasets/{id}/versions + method: GET + auth: true + docs: Get a list of the versions for a Dataset. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + display-name: List Versions + request: + name: DatasetsListVersionsRequest + query-parameters: + status: + type: optional + docs: >- + Filter versions by status: 'uncommitted', 'committed'. If no + status is provided, all versions are returned. + environment: + type: optional + docs: >- + Name of the environment to filter versions by. If no environment + is provided, all versions are returned. + evaluation_aggregates: optional + response: + docs: Successful Response + type: root.ListDatasets + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - id: id + commit: + path: /datasets/{id}/versions/{version_id}/commit + method: POST + auth: true + docs: Commit the Dataset Version with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + version_id: + type: string + docs: Unique identifier for the specific version of the Dataset. + display-name: Commit + request: + body: root.CommitRequest + response: + docs: Successful Response + type: root.DatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + version_id: version_id + request: + commit_message: commit_message + response: + body: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + createdatapointsfromlogs: + path: /datasets/{id}/datapoints/logs + method: POST + auth: true + docs: >- + Add Datapoints from Logs to a Dataset. + + + This will create a new committed version of the Dataset with the + Datapoints from the Logs. + + + If either `version_id` or `environment` is provided, the new version + will be based on the specified version, + + with the Datapoints from the Logs added to the existing Datapoints in + the version. + + If neither `version_id` nor `environment` is provided, the new version + will be based on the version + + of the Dataset that is deployed to the default Environment. + path-parameters: + id: + type: string + docs: Unique identifier for the Dataset + display-name: Add Datapoints From Logs + request: + name: BodyDatasetsCreateDatapointsFromLogs + query-parameters: + version_id: + type: optional + docs: ID of the specific Dataset version to base the created Version on. + environment: + type: optional + docs: >- + Name of the Environment identifying a deployed Version to base the + created Version on. + body: + properties: + log_ids: + docs: List of Log IDs to create Datapoints from. + type: list + commit_message: + type: string + docs: Commit message for the new Dataset version. + response: + docs: Successful Response + type: root.DatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: + log_ids: + - log_ids + commit_message: commit_message + response: + body: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + deploy: + path: /datasets/{id}/environments/{environment_id} + method: POST + auth: true + docs: |- + Deploy Dataset to Environment. + + Set the deployed Version for the specified Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + environment_id: + type: string + docs: Unique identifier for the Environment to deploy the Version to. + display-name: Deploy + request: + name: DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest + query-parameters: + version_id: + type: string + docs: Unique identifier for the specific version of the Dataset. + response: + docs: Successful Response + type: root.DatasetResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + query-parameters: + version_id: version_id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - inputs: + inputs: inputs + messages: + - role: user + target: + target: target + id: id + removeDeployment: + path: /datasets/{id}/environments/{environment_id} + method: DELETE + auth: true + docs: |- + Remove deployment of Dataset from Environment. + + Remove the deployed Version for the specified Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + environment_id: + type: string + docs: Unique identifier for the Environment to remove the deployment from. + display-name: Remove Deployment + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + listEnvironments: + path: /datasets/{id}/environments + method: GET + auth: true + docs: List all Environments and their deployed versions for the Dataset. + path-parameters: + id: + type: string + docs: Unique identifier for Dataset. + display-name: List Environments + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + file: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + display-name: Datasets +docs: >+ + Datasets are collections of input-output pairs that you can use within + Humanloop for Evaluations. + + + #### What is a Dataset? + + + A Dataset is a collection of unique Datapoints. These Datapoints contain + `inputs` and `target` fields. The `inputs` + + are used to populate a Prompt's template and the `target` can be referenced by + Evaluators to evaluate the quality of + + the generated output. + + + Note that Humanloop automatically deduplicates Datapoints. If you try to add a + Datapoint that already exists, it will + + be ignored. If you intentionally want to add a duplicate Datapoint, you can + add a unique identifier to the Datapoint's + + inputs such as `{_dedupe_id: }`. + + + #### Creating Dataset versions + + + Datasets have immutable versions. To add/remove Datapoint to/from an existing + version, use the **Create** endpoint + + and specify `action` as `"add"` or `"remove"` respectively. You may also + specify the `version_id` or `environment` + + query parameters to identify the existing version to base the new version on. + If neither is provided, the version + + deployed to the default Environment will be used. + diff --git a/.mock/definition/directories.yml b/.mock/definition/directories.yml new file mode 100644 index 0000000..f3163a2 --- /dev/null +++ b/.mock/definition/directories.yml @@ -0,0 +1,200 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /directories + method: GET + auth: true + docs: Retrieve a list of all Directories. + display-name: List Directories + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + - name: name + parent_id: parent_id + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + create: + path: /directories + method: POST + auth: true + docs: Creates a Directory. + display-name: 'Create Directory ' + request: + name: CreateDirectoryRequest + body: + properties: + name: + type: string + docs: Name of the directory to create. + parent_id: + type: string + docs: ID of the parent directory. Starts with `dir_`. + response: + docs: Successful Response + type: root.DirectoryResponse + errors: + - root.UnprocessableEntityError + examples: + - request: + name: name + parent_id: parent_id + response: + body: + name: name + parent_id: parent_id + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + get: + path: /directories/{id} + method: GET + auth: true + docs: Fetches a directory by ID. + path-parameters: + id: + type: string + docs: String ID of directory. Starts with `dir_`. + display-name: Get Directory + response: + docs: Successful Response + type: root.DirectoryWithParentsAndChildrenResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + name: name + parent_id: parent_id + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + subdirectories: + - name: name + parent_id: parent_id + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + files: + - path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + parents: + - name: name + parent_id: parent_id + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + delete: + path: /directories/{id} + method: DELETE + auth: true + docs: |- + Delete the Directory with the given ID. + + The Directory must be empty (i.e. contain no Directories or Files). + path-parameters: + id: + type: string + docs: Unique identifier for Directory. Starts with `dir_`. + display-name: 'Delete Directory ' + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + update: + path: /directories/{id} + method: PATCH + auth: true + docs: Update the Directory with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Directory. Starts with `dir_`. + display-name: 'Update Directory ' + request: + name: UpdateDirectoryRequest + body: + properties: + name: + type: optional + docs: Name to set for the directory. + parent_id: + type: optional + docs: >- + ID of the parent directory. Specify this to move directories. + Starts with `dir_`. + response: + docs: Successful Response + type: root.DirectoryResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + name: name + parent_id: parent_id + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' diff --git a/.mock/definition/evaluations.yml b/.mock/definition/evaluations.yml new file mode 100644 index 0000000..d5d3ae3 --- /dev/null +++ b/.mock/definition/evaluations.yml @@ -0,0 +1,589 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /evaluations + method: GET + auth: true + docs: >- + List Evaluations for the given File. + + + Retrieve a list of Evaluations that evaluate versions of the specified + File. + pagination: + offset: $request.page + results: $response.records + display-name: List Evaluations for File + request: + name: EvaluationsListRequest + query-parameters: + file_id: + type: string + docs: >- + Filter by File ID. If provided, only Evaluation for the specified + File will be returned. + page: + type: optional + docs: Page number for pagination. + size: + type: optional + docs: Page size for pagination. Number of Evaluations to fetch. + response: + docs: Successful Response + type: root.PaginatedEvaluationResponse + errors: + - root.UnprocessableEntityError + examples: + - query-parameters: + file_id: file_id + response: + body: + records: + - id: id + dataset: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + datapoints_count: 1 + evaluatees: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + orchestrated: true + evaluators: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + orchestrated: true + status: pending + created_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + updated_at: '2024-01-15T09:30:00Z' + page: 1 + size: 1 + total: 1 + create: + path: /evaluations + method: POST + auth: true + docs: >- + Create an Evaluation. + + + Create a new Evaluation by specifying the Dataset, Evaluatees, and + Evaluators. + + Humanloop will automatically start generating Logs and running + Evaluators. + + + To keep updated on the progress of the Evaluation, you can poll the + Evaluation + + and check its status. + display-name: Create Evaluation + request: + body: root.CreateEvaluationRequest + response: + docs: Successful Response + type: root.EvaluationResponse + errors: + - root.UnprocessableEntityError + examples: + - request: + dataset: + version_id: version_id + evaluatees: + - version_id: version_id + evaluators: + - version_id: version_id + response: + body: + id: id + dataset: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - id: id + evaluatees: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + batch_id: batch_id + orchestrated: true + evaluators: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + orchestrated: true + status: pending + created_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + updated_at: '2024-01-15T09:30:00Z' + get: + path: /evaluations/{id} + method: GET + auth: true + docs: |- + Get an Evaluation. + + Retrieve the Evaluation with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluation. + display-name: Get Evaluation + response: + docs: Successful Response + type: root.EvaluationResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + id: id + dataset: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - id: id + evaluatees: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + batch_id: batch_id + orchestrated: true + evaluators: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + orchestrated: true + status: pending + created_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + updated_at: '2024-01-15T09:30:00Z' + delete: + path: /evaluations/{id} + method: DELETE + auth: true + docs: >- + Delete an Evaluation. + + + Remove an Evaluation from Humanloop. The Logs and Versions used in the + Evaluation + + will not be deleted. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluation. + display-name: Delete Evaluation + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + update: + path: /evaluations/{id} + method: PATCH + auth: true + docs: >- + Update an Evaluation. + + + Update the setup of an Evaluation by specifying the Dataset, Evaluatees, + and Evaluators. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluation. + display-name: Update Evaluation + request: + body: root.CreateEvaluationRequest + response: + docs: Successful Response + type: root.EvaluationResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: + dataset: + version_id: version_id + evaluatees: + - version_id: version_id + evaluators: + - version_id: version_id + response: + body: + id: id + dataset: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - id: id + evaluatees: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + batch_id: batch_id + orchestrated: true + evaluators: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + orchestrated: true + status: pending + created_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + updated_at: '2024-01-15T09:30:00Z' + updatestatus: + path: /evaluations/{id}/status + method: PATCH + auth: true + docs: >- + Update the status of an Evaluation. + + + Can be used to cancel a running Evaluation, or mark an Evaluation that + uses external or human evaluators + + as completed. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluation. + display-name: Update Status + request: + name: UpdateEvaluationStatusRequest + body: + properties: + status: root.EvaluationStatus + response: + docs: Successful Response + type: root.EvaluationResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: + status: pending + response: + body: + id: id + dataset: + path: path + id: id + name: name + version_id: version_id + type: dataset + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + datapoints_count: 1 + datapoints: + - id: id + evaluatees: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + batch_id: batch_id + orchestrated: true + evaluators: + - version: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + orchestrated: true + status: pending + created_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + updated_at: '2024-01-15T09:30:00Z' + getstats: + path: /evaluations/{id}/stats + method: GET + auth: true + docs: >- + Get Evaluation Stats. + + + Retrieve aggregate stats for the specified Evaluation. + + This includes the number of generated Logs for every evaluatee and + Evaluator metrics + + (such as the mean and percentiles for numeric Evaluators for every + evaluatee). + path-parameters: + id: + type: string + docs: Unique identifier for Evaluation. + display-name: Get Evaluation Stats + response: + docs: Successful Response + type: root.EvaluationStats + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + overall_stats: + num_datapoints: 1 + total_logs: 1 + total_evaluator_logs: 1 + version_stats: + - version_id: version_id + num_logs: 1 + evaluator_version_stats: + - evaluator_version_id: evaluator_version_id + total_logs: 1 + num_judgments: 1 + num_nulls: 1 + num_errors: 1 + mean: 0 + std: 1 + percentiles: + '0': -2.5 + '25': -0.6745 + '50': 0 + '75': 0.6745 + '100': 2.5 + display-name: Evaluations +docs: >+ + Evaluations help you measure the performance of your Prompts, Tools and LLM + Evaluators. + + + An Evaluation consists of a Dataset, Evaluatees (i.e. Versions to evaluate), + and Evaluators. + + When an Evaluation is created, Humanloop will start generating Logs, iterating + through Datapoints in the Dataset, + + for each Evaluatee. The Evaluators will then be run on these Logs. + + + Aggregate stats can be viewed in the Humanloop app or retrieved with the **Get + Evaluation Stats** endpoint. + + + Note that when an Evaluation is created, Humanloop will attempt to reuse any + existing Logs for each Datapoint-Evaluatee + + pair. This means that you can create multiple Evaluations without generating + new Logs unnecessarily. + diff --git a/.mock/definition/evaluators.yml b/.mock/definition/evaluators.yml new file mode 100644 index 0000000..66e3d41 --- /dev/null +++ b/.mock/definition/evaluators.yml @@ -0,0 +1,943 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /evaluators + method: GET + auth: true + docs: Get a list of Evaluators. + pagination: + offset: $request.page + results: $response.records + display-name: 'List ' + request: + name: EvaluatorsListRequest + query-parameters: + page: + type: optional + docs: Page offset for pagination. + size: + type: optional + docs: Page size for pagination. Number of Evaluators to fetch. + name: + type: optional + docs: Case-insensitive filter for Evaluator name. + user_filter: + type: optional + docs: >- + Case-insensitive filter for users in the Evaluator. This filter + matches against both email address and name of users. + sort_by: + type: optional + docs: Field to sort Evaluators by + order: + type: optional + docs: Direction to sort by. + response: + docs: Successful Response + type: root.ListEvaluators + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + upsert: + path: /evaluators + method: POST + auth: true + docs: >- + Create an Evaluator or update it with a new version if it already + exists. + + + Evaluators are identified by the `ID` or their `path`. The spec provided + determines the version of the Evaluator. + + + If you provide a commit message, then the new version will be committed; + + otherwise it will be uncommitted. If you try to commit an already + committed version, + + an exception will be raised. + display-name: Upsert Evaluator + request: + name: EvaluatorsRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Evaluator, including the name, which is used as a + unique identifier. + id: + type: optional + docs: ID for an existing Evaluator to update. + commit_message: + type: optional + docs: Message describing the changes made. + spec: SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec + response: + docs: Successful Response + type: root.EvaluatorResponse + errors: + - root.UnprocessableEntityError + examples: + - request: + spec: + arguments_type: target_free + return_type: boolean + response: + body: + path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + evaluator_type: llm + prompt: + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - linked_tools + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + get: + path: /evaluators/{id} + method: GET + auth: true + docs: >- + Retrieve the Evaluator with the given ID. + + + By default, the deployed version of the Evaluator is returned. Use the + query parameters + + `version_id` or `environment` to target a specific version of the + Evaluator. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluator. + display-name: Get Evaluator + request: + name: EvaluatorsGetRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Evaluator to retrieve. + environment: + type: optional + docs: Name of the Environment to retrieve a deployed Version from. + response: + docs: Successful Response + type: root.EvaluatorResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + evaluator_type: llm + prompt: + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - linked_tools + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + delete: + path: /evaluators/{id} + method: DELETE + auth: true + docs: Delete the Evaluator with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluator. + display-name: Delete Evaluator + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + move: + path: /evaluators/{id} + method: PATCH + auth: true + docs: Move the Evaluator to a different path or change the name. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluator. + display-name: Move Evaluator + request: + name: UpdateEvaluatorRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Evaluator including the Evaluator name, which is + used as a unique identifier. + name: + type: optional + docs: Name of the Evaluator, which is used as a unique identifier. + response: + docs: Successful Response + type: root.EvaluatorResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + evaluator_type: llm + prompt: + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - linked_tools + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + listversions: + path: /evaluators/{id}/versions + method: GET + auth: true + docs: Get a list of all the versions of an Evaluator. + path-parameters: + id: + type: string + docs: Unique identifier for the Evaluator. + display-name: List Versions + request: + name: EvaluatorsListVersionsRequest + query-parameters: + status: + type: optional + docs: >- + Filter versions by status: 'uncommitted', 'committed'. If no + status is provided, all versions are returned. + environment: + type: optional + docs: >- + Name of the environment to filter versions by. If no environment + is provided, all versions are returned. + evaluator_aggregates: optional + response: + docs: Successful Response + type: root.ListEvaluators + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + commit: + path: /evaluators/{id}/versions/{version_id}/commit + method: POST + auth: true + docs: Commit the Evaluator Version with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + version_id: + type: string + docs: Unique identifier for the specific version of the Evaluator. + display-name: Commit + request: + body: root.CommitRequest + response: + docs: Successful Response + type: root.EvaluatorResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + version_id: version_id + request: + commit_message: commit_message + response: + body: + path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + evaluator_type: llm + prompt: + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - linked_tools + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + listdefault: + path: /evaluators/default + method: GET + auth: true + docs: Get a list of default evaluators for the organization. + display-name: List Default Evaluators + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + - path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + evaluator_type: llm + prompt: + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + debug: + path: /evaluators/debug + method: POST + auth: true + docs: Run a synchronous evaluator execution on a collection of datapoints. + display-name: Debug + request: + name: RunSyncEvaluationRequest + body: + properties: + file_id: + type: string + docs: The ID of the Dataset that the datapoints belong to. + evaluator: RunSyncEvaluationRequestEvaluator + evaluator_version_id: + type: optional + docs: >- + The ID of the Evaluator Version being debugged if it already + exists and is being edited. + log_ids: + type: optional> + docs: >- + The IDs of the logs on which to run the draft evaluator.Provide + one of `log_ids` or `datapoint_ids`. + datapoint_ids: + type: optional> + docs: >- + The IDs of the evaluation datapoints on which to run the draft + evaluator. + prompt_version_id: + type: optional + docs: >- + The ID of the Prompt Version to use generate datapoints for the + evaluation datapoints. Only required if `datapoint_ids` is + provided; has no effect otherwise. + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - request: + file_id: file_id + evaluator: + arguments_type: target_free + return_type: boolean + response: + body: + - log_id: log_id + log: + project: project + project_id: project_id + session_id: session_id + session_reference_id: session_reference_id + parent_id: parent_id + parent_reference_id: parent_reference_id + source: source + save: true + source_datapoint_id: source_datapoint_id + id: id + reference_id: reference_id + trial_id: trial_id + messages: + - role: user + output: output + judgment: true + config_id: config_id + config: + id: id + type: model + model: model + environment: environment + feedback: + - type: rating + value: 1.1 + id: id + created_at: '2024-01-15T09:30:00Z' + error: error + duration: 1.1 + output_message: + role: user + prompt_tokens: 1 + output_tokens: 1 + prompt_cost: 1.1 + output_cost: 1.1 + user: user + provider_latency: 1.1 + tokens: 1 + raw_output: raw_output + finish_reason: finish_reason + metric_values: + - metric_id: metric_id + metric_name: metric_name + metric_value: 1.1 + tools: + - id: id + name: name + signature: signature + result: result + tool_choice: none + evaluation_results: + - id: id + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + log_id: log_id + updated_at: '2024-01-15T09:30:00Z' + created_at: '2024-01-15T09:30:00Z' + observability_status: pending + updated_at: '2024-01-15T09:30:00Z' + batch_ids: + - batch_ids + datapoint_id: datapoint_id + llm_evaluation_log: + project: project + project_id: project_id + session_id: session_id + session_reference_id: session_reference_id + parent_id: parent_id + parent_reference_id: parent_reference_id + source: source + save: true + source_datapoint_id: source_datapoint_id + id: id + reference_id: reference_id + trial_id: trial_id + messages: + - role: user + output: output + judgment: true + config_id: config_id + config: + id: id + type: model + model: model + environment: environment + feedback: + - type: rating + value: 1.1 + id: id + created_at: '2024-01-15T09:30:00Z' + error: error + duration: 1.1 + output_message: + role: user + prompt_tokens: 1 + output_tokens: 1 + prompt_cost: 1.1 + output_cost: 1.1 + user: user + provider_latency: 1.1 + tokens: 1 + raw_output: raw_output + finish_reason: finish_reason + metric_values: + - metric_id: metric_id + metric_name: metric_name + metric_value: 1.1 + tools: + - id: id + name: name + signature: signature + result: result + tool_choice: none + evaluation_results: + - id: id + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + log_id: log_id + updated_at: '2024-01-15T09:30:00Z' + created_at: '2024-01-15T09:30:00Z' + observability_status: pending + updated_at: '2024-01-15T09:30:00Z' + batch_ids: + - batch_ids + value: true + error: error + deploy: + path: /evaluators/{id}/environments/{environment_id} + method: POST + auth: true + docs: >- + Deploy Evaluator to Environment. + + + Set the deployed Version for the specified Environment. This Evaluator + Version + + will be used for calls made to the Evaluator in this Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluator. + environment_id: + type: string + docs: Unique identifier for the Environment to deploy the Version to. + display-name: Deploy + request: + name: DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest + query-parameters: + version_id: + type: string + docs: Unique identifier for the specific version of the Evaluator. + response: + docs: Successful Response + type: root.EvaluatorResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + query-parameters: + version_id: version_id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: evaluator + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + commit_message: commit_message + spec: + arguments_type: target_free + return_type: boolean + evaluator_type: llm + prompt: + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - linked_tools + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + removeDeployment: + path: /evaluators/{id}/environments/{environment_id} + method: DELETE + auth: true + docs: >- + Remove deployment of Evaluator from Environment. + + + Remove the deployed Version for the specified Environment. This + Evaluator Version + + will no longer be used for calls made to the Evaluator in this + Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluator. + environment_id: + type: string + docs: Unique identifier for the Environment to remove the deployment from. + display-name: Remove Deployment + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + listEnvironments: + path: /evaluators/{id}/environments + method: GET + auth: true + docs: List all Environments and their deployed versions for the Evaluator. + path-parameters: + id: + type: string + docs: Unique identifier for Evaluator. + display-name: List Environments + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + file: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' +types: + SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec: + discriminated: false + union: + - root.LlmEvaluatorRequest + - root.CodeEvaluatorRequest + - root.HumanEvaluatorRequest + RunSyncEvaluationRequestEvaluator: + discriminated: false + union: + - root.LlmEvaluatorRequest + - root.CodeEvaluatorRequest + - root.HumanEvaluatorRequest diff --git a/.mock/definition/logs.yml b/.mock/definition/logs.yml new file mode 100644 index 0000000..f2f710e --- /dev/null +++ b/.mock/definition/logs.yml @@ -0,0 +1,270 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + listLogsForFile: + path: /logs + method: GET + auth: true + docs: List Logs. + pagination: + offset: $request.page + results: $response.records + display-name: List + request: + name: ListLogsForFileLogsGetRequest + query-parameters: + file_id: + type: string + docs: Unique identifier for the File to list Logs for. + page: + type: optional + docs: Page number for pagination. + size: + type: optional + docs: Page size for pagination. Number of Logs to fetch. + version_id: + type: optional + docs: >- + If provided, only Logs belonging to the specified Version will be + returned. + version_status: + type: optional + docs: >- + If provided, only Logs belonging to Versions with the specified + status will be returned. + search: + type: optional + docs: >- + If provided, only Logs that contain the provided string in its + inputs and output will be returned. + metadata_search: + type: optional + docs: >- + If provided, only Logs that contain the provided string in its + metadata will be returned. + start_date: + type: optional + docs: >- + If provided, only Logs created after the specified date will be + returned. + end_date: + type: optional + docs: >- + If provided, only Logs created before the specified date will be + returned. + response: + docs: Successful Response + type: root.PaginatedPromptLogResponse + errors: + - root.UnprocessableEntityError + examples: + - query-parameters: + file_id: file_id + response: + body: + records: + - id: id + output_message: + role: user + prompt_tokens: 1 + output_tokens: 1 + prompt_cost: 1.1 + output_cost: 1.1 + finish_reason: finish_reason + prompt: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + messages: + - role: user + tool_choice: none + output: output + raw_output: raw_output + created_at: '2024-01-15T09:30:00Z' + error: error + provider_latency: 1.1 + session_id: session_id + parent_id: parent_id + source: source + save: true + source_datapoint_id: source_datapoint_id + batches: + - batches + user: user + environment: environment + page: 1 + size: 1 + total: 1 + delete: + path: /logs + method: DELETE + auth: true + docs: Delete Logs with the given IDs. + display-name: Delete + request: + name: LogsDeleteRequest + query-parameters: + id: + type: optional + allow-multiple: true + docs: Unique identifiers for the Logs to delete. + errors: + - root.UnprocessableEntityError + get: + path: /logs/{id} + method: GET + auth: true + docs: Retrieve the Log with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Log. + display-name: Get Log + response: + docs: Successful Response + type: root.PromptLogResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + id: id + output_message: + content: content + name: name + tool_call_id: tool_call_id + role: user + tool_calls: + - id: id + type: function + function: + name: name + prompt_tokens: 1 + output_tokens: 1 + prompt_cost: 1.1 + output_cost: 1.1 + finish_reason: finish_reason + prompt: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + messages: + - content: content + name: name + tool_call_id: tool_call_id + role: user + tool_calls: + - id: id + type: function + function: + name: name + tool_choice: none + output: output + raw_output: raw_output + created_at: '2024-01-15T09:30:00Z' + error: error + provider_latency: 1.1 + provider_request: + provider_request: + key: value + provider_response: + provider_response: + key: value + session_id: session_id + parent_id: parent_id + inputs: + inputs: + key: value + source: source + metadata: + metadata: + key: value + save: true + source_datapoint_id: source_datapoint_id + batches: + - batches + user: user + environment: environment + display-name: Logs +docs: >+ + Logs contain the inputs and outputs of each time a Prompt, Tool or Evaluator + is called. + + + Humanloop automatically records the inputs and outputs when you Call a Prompt + or Tool and saves a Log. + + Evaluator Logs are also created when an Evaluator is run on a Log. + + + You can manually create Logs through the API. + + + ... + + diff --git a/.mock/definition/prompts.yml b/.mock/definition/prompts.yml new file mode 100644 index 0000000..4a23d6c --- /dev/null +++ b/.mock/definition/prompts.yml @@ -0,0 +1,1443 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + listPrompts: + path: /prompts + method: GET + auth: true + docs: Get a list of Prompts. + pagination: + offset: $request.page + results: $response.records + display-name: List Prompts + request: + name: PromptsListPromptsRequest + query-parameters: + page: + type: optional + docs: Page number for pagination. + size: + type: optional + docs: Page size for pagination. Number of Prompts to fetch. + name: + type: optional + docs: Case-insensitive filter for Prompt name. + user_filter: + type: optional + docs: >- + Case-insensitive filter for users in the Prompt. This filter + matches against both email address and name of users. + sort_by: + type: optional + docs: Field to sort Prompts by + order: + type: optional + docs: Direction to sort by. + response: + docs: Successful Response + type: root.ListPrompts + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + upsert: + path: /prompts + method: POST + auth: true + docs: >- + Create a Prompt or update it with a new version if it already exists. + + + Prompts are identified by the `ID` or their `path`. The parameters (i.e. + the prompt template, temperature, model etc.) determine the versions of + the Prompt. + + + If you provide a commit message, then the new version will be committed; + + otherwise it will be uncommitted. If you try to commit an already + committed version, + + an exception will be raised. + display-name: Upsert Prompt + request: + name: PromptRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Prompt, including the name, which is used as a + unique identifier. + id: + type: optional + docs: ID for an existing Prompt to update. + model: + type: string + docs: >- + The model instance used, e.g. `gpt-4`. See [supported + models](https://humanloop.com/docs/supported-models) + endpoint: + type: optional + docs: The provider model endpoint used. + template: + type: optional + docs: >- + For chat endpoint, provide a Chat template. For completion + endpoint, provide a Prompt template. Input variables within the + template should be specified with double curly bracket syntax: + {{INPUT_NAME}}. + provider: + type: optional + docs: The company providing the underlying model service. + max_tokens: + type: optional + docs: >- + The maximum number of tokens to generate. Provide max_tokens=-1 + to dynamically calculate the maximum number of tokens to + generate given the length of the prompt + default: -1 + temperature: + type: optional + docs: >- + What sampling temperature to use when making a generation. + Higher values means the model will be more creative. + default: 1 + top_p: + type: optional + docs: >- + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens + with top_p probability mass. + default: 1 + stop: + type: optional + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop + sequence. + presence_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens + based on whether they appear in the generation so far. + default: 0 + frequency_penalty: + type: optional + docs: >- + Number between -2.0 and 2.0. Positive values penalize new tokens + based on how frequently they appear in the generation so far. + default: 0 + other: + type: optional> + docs: Other parameter values to be passed to the provider call. + seed: + type: optional + docs: >- + If specified, model will make a best effort to sample + deterministically, but it is not guaranteed. + response_format: + type: optional + docs: >- + The format of the response. Only `{"type": "json_object"}` is + currently supported for chat. + tools: + type: optional> + docs: >- + The tool specification that the model can choose to call if Tool + calling is supported. + linked_tools: + type: optional> + docs: >- + The IDs of the Tools in your organization that the model can + choose to call if Tool calling is supported. The default + deployed version of that tool is called. + commit_message: + type: optional + docs: Message describing the changes made. + response: + docs: Successful Response + type: root.PromptResponse + errors: + - root.UnprocessableEntityError + examples: + - request: + model: model + response: + body: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + get: + path: /prompts/{id} + method: GET + auth: true + docs: >- + Retrieve the Prompt with the given ID. + + + By default, the deployed version of the Prompt is returned. Use the + query parameters + + `version_id` or `environment` to target a specific version of the + Prompt. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + display-name: Get Prompt + request: + name: PromptsGetRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Prompt to retrieve. + environment: + type: optional + docs: Name of the Environment to retrieve a deployed Version from. + response: + docs: Successful Response + type: root.PromptResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + delete: + path: /prompts/{id} + method: DELETE + auth: true + docs: Delete the Prompt with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + display-name: Delete Prompt + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + move: + path: /prompts/{id} + method: PATCH + auth: true + docs: Move the Prompt to a different path or change the name. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + display-name: Move Prompt + request: + name: UpdatePromptRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Prompt including the Prompt name, which is used as a + unique identifier. + name: + type: optional + docs: Name of the Prompt. + response: + docs: Successful Response + type: root.PromptResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + listversions: + path: /prompts/{id}/versions + method: GET + auth: true + docs: Get a list of all the versions of a Prompt. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + display-name: List Versions + request: + name: PromptsListVersionsRequest + query-parameters: + status: + type: optional + docs: >- + Filter versions by status: 'uncommitted', 'committed'. If no + status is provided, all versions are returned. + environment: + type: optional + docs: >- + Name of the environment to filter versions by. If no environment + is provided, all versions are returned. + evaluator_aggregates: optional + response: + docs: Successful Response + type: root.ListPrompts + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + commit: + path: /prompts/{id}/versions/{version_id}/commit + method: POST + auth: true + docs: Commit the Prompt Version with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + version_id: + type: string + docs: Unique identifier for the specific version of the Prompt. + display-name: Commit + request: + body: root.CommitRequest + response: + docs: Successful Response + type: root.PromptResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + version_id: version_id + request: + commit_message: commit_message + response: + body: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + log: + path: /prompts/log + method: POST + auth: true + docs: >- + Log to a Prompt. + + + You can use query parameters version_id, or environment, to target + + an existing version of the Prompt. Otherwise the default deployed + version will be chosen. + + + Instead of targeting an existing version explicitly, you can instead + pass in + + Prompt details in the request body. In this case, we will check if the + details correspond + + to an existing version of the Prompt, if not we will create a new + version. This is helpful + + in the case where you are storing or deriving your Prompt details in + code. + display-name: Log + request: + name: PromptLogRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Prompt to log to. + environment: + type: optional + docs: Name of the Environment identifying a deployed version to log to. + body: + properties: + path: + type: optional + docs: >- + Path of the Prompt, including the name, which is used as a + unique identifier. + id: + type: optional + docs: ID for an existing Prompt to update. + output_message: + type: optional + docs: The message returned by the provider. + prompt_tokens: + type: optional + docs: Number of tokens in the prompt used to generate the output. + output_tokens: + type: optional + docs: Number of tokens in the output generated by the model. + prompt_cost: + type: optional + docs: Cost in dollars associated to the tokens in the prompt. + output_cost: + type: optional + docs: Cost in dollars associated to the tokens in the output. + finish_reason: + type: optional + docs: Reason the generation finished. + prompt: + type: optional + docs: >- + Details of your Prompt. A new Prompt version will be created if + the provided details are new. + messages: + type: optional> + docs: The messages passed to the to provider chat endpoint. + tool_choice: + type: optional + docs: >- + Controls how the model uses tools. The following options are + supported: + + - `'none'` means the model will not call any tool and instead + generates a message; this is the default when no tools are + provided as part of the Prompt. + + - `'auto'` means the model can decide to call one or more of the + provided tools; this is the default when tools are provided as + part of the Prompt. + + - `'required'` means the model can decide to call one or more of + the provided tools. + + - `{'type': 'function', 'function': {name': }}` + forces the model to use the named function. + output: + type: optional + docs: >- + Generated output from your model for the provided inputs. Can be + `None` if logging an error, or if creating a parent Log with the + intention to populate it later. + raw_output: + type: optional + docs: Raw output from the provider. + created_at: + type: optional + docs: 'User defined timestamp for when the log was created. ' + error: + type: optional + docs: Error message if the log is an error. + provider_latency: + type: optional + docs: Duration of the logged event in seconds. + provider_request: + type: optional> + docs: Raw request sent to provider. + provider_response: + type: optional> + docs: Raw response received the provider. + session_id: + type: optional + docs: >- + Unique identifier for the Session to associate the Log to. + Allows you to record multiple Logs to a Session (using an ID + kept by your internal systems) by passing the same `session_id` + in subsequent log requests. + parent_id: + type: optional + docs: >- + Unique identifier for the parent Log in a Session. Should only + be provided if `session_id` is provided. If provided, the Log + will be nested under the parent Log within the Session. + inputs: + type: optional> + docs: The inputs passed to the prompt template. + source: + type: optional + docs: Identifies where the model was called from. + metadata: + type: optional> + docs: Any additional metadata to record. + save: + type: optional + docs: >- + Whether the request/response payloads will be stored on + Humanloop. + source_datapoint_id: + type: optional + docs: >- + Unique identifier for the Datapoint that this Log is derived + from. This can be used by Humanloop to associate Logs to + Evaluations. If provided, Humanloop will automatically associate + this Log to Evaluations that require a Log for this + Datapoint-Version pair. + batches: + type: optional> + docs: >- + Array of Batch Ids that this log is part of. Batches are used to + group Logs together for offline Evaluations + user: + type: optional + docs: End-user ID related to the Log. + environment: + type: optional + docs: The name of the Environment the Log is associated to. + name: promptLogRequestEnvironment + response: + docs: Successful Response + type: root.CreatePromptLogResponse + errors: + - root.UnprocessableEntityError + examples: + - request: {} + response: + body: + id: id + prompt_id: prompt_id + version_id: version_id + session_id: session_id + call: + path: /prompts/call + method: POST + auth: true + docs: >- + Call a Prompt. + + + Calling a Prompt subsequently calls the model provider before logging + + the data to Humanloop. + + + You can use query parameters version_id, or environment, to target + + an existing version of the Prompt. Otherwise the default deployed + version will be chosen. + + + Instead of targeting an existing version explicitly, you can instead + pass in + + Prompt details in the request body. In this case, we will check if the + details correspond + + to an existing version of the Prompt, if not we will create a new + version. This is helpful + + in the case where you are storing or deriving your Prompt details in + code. + display-name: Call + request: + name: PromptCallRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Prompt to log to. + environment: + type: optional + docs: Name of the Environment identifying a deployed version to log to. + body: + properties: + path: + type: optional + docs: >- + Path of the Prompt, including the name, which is used as a + unique identifier. + id: + type: optional + docs: ID for an existing Prompt to update. + prompt: + type: optional + docs: >- + Details of your Prompt. A new Prompt version will be created if + the provided details are new. + messages: + type: optional> + docs: The messages passed to the to provider chat endpoint. + tool_choice: + type: optional + docs: >- + Controls how the model uses tools. The following options are + supported: + + - `'none'` means the model will not call any tool and instead + generates a message; this is the default when no tools are + provided as part of the Prompt. + + - `'auto'` means the model can decide to call one or more of the + provided tools; this is the default when tools are provided as + part of the Prompt. + + - `'required'` means the model can decide to call one or more of + the provided tools. + + - `{'type': 'function', 'function': {name': }}` + forces the model to use the named function. + session_id: + type: optional + docs: >- + Unique identifier for the Session to associate the Log to. + Allows you to record multiple Logs to a Session (using an ID + kept by your internal systems) by passing the same `session_id` + in subsequent log requests. + parent_id: + type: optional + docs: >- + Unique identifier for the parent Log in a Session. Should only + be provided if `session_id` is provided. If provided, the Log + will be nested under the parent Log within the Session. + inputs: + type: optional> + docs: The inputs passed to the prompt template. + source: + type: optional + docs: Identifies where the model was called from. + metadata: + type: optional> + docs: Any additional metadata to record. + save: + type: optional + docs: >- + Whether the request/response payloads will be stored on + Humanloop. + source_datapoint_id: + type: optional + docs: >- + Unique identifier for the Datapoint that this Log is derived + from. This can be used by Humanloop to associate Logs to + Evaluations. If provided, Humanloop will automatically associate + this Log to Evaluations that require a Log for this + Datapoint-Version pair. + batches: + type: optional> + docs: >- + Array of Batch Ids that this log is part of. Batches are used to + group Logs together for offline Evaluations + user: + type: optional + docs: End-user ID related to the Log. + environment: + type: optional + docs: The name of the Environment the Log is associated to. + name: promptCallRequestEnvironment + provider_api_keys: + type: optional + docs: >- + API keys required by each provider to make API calls. The API + keys provided here are not stored by Humanloop. If not specified + here, Humanloop will fall back to the key saved to your + organization. + num_samples: + type: optional + docs: The number of generations. + default: 1 + stream: + type: optional + docs: >- + If true, tokens will be sent as data-only server-sent events. If + num_samples > 1, samples are streamed back independently. + return_inputs: + type: optional + docs: >- + Whether to return the inputs in the response. If false, the + response will contain an empty dictionary under inputs. This is + useful for reducing the size of the response. Defaults to true. + logprobs: + type: optional + docs: >- + Include the log probabilities of the top n tokens in the + provider_response + suffix: + type: optional + docs: >- + The suffix that comes after a completion of inserted text. + Useful for completions that act like inserts. + response: + docs: Successful Response + type: PromptsCallResponse + errors: + - root.UnprocessableEntityError + examples: + - request: {} + response: + body: + prompt: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + messages: + - content: content + name: name + tool_call_id: tool_call_id + role: user + tool_calls: + - id: id + type: function + function: + name: name + tool_choice: none + session_id: session_id + parent_id: parent_id + inputs: + inputs: + key: value + source: source + metadata: + metadata: + key: value + save: true + source_datapoint_id: source_datapoint_id + batches: + - batches + user: user + environment: environment + id: id + logs: + - output: output + raw_output: raw_output + created_at: '2024-01-15T09:30:00Z' + error: error + provider_latency: 1.1 + output_message: + role: user + prompt_tokens: 1 + output_tokens: 1 + prompt_cost: 1.1 + output_cost: 1.1 + finish_reason: finish_reason + index: 1 + updateEvaluators: + path: /prompts/{id}/evaluators + method: POST + auth: true + docs: |- + Activate and deactivate Evaluators for the Prompt. + + An activated Evaluator will automatically be run on all new Logs + within the Prompt for monitoring purposes. + path-parameters: + id: string + display-name: Update Evaluators + request: + body: root.EvaluatorActivationDeactivationRequest + response: + docs: Successful Response + type: root.PromptResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + deploy: + path: /prompts/{id}/environments/{environment_id} + method: POST + auth: true + docs: >- + Deploy Prompt to Environment. + + + Set the deployed Version for the specified Environment. This Prompt + Version + + will be used for calls made to the Prompt in this Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + environment_id: + type: string + docs: Unique identifier for the Environment to deploy the Version to. + display-name: Deploy + request: + name: DeployPromptsIdEnvironmentsEnvironmentIdPostRequest + query-parameters: + version_id: + type: string + docs: Unique identifier for the specific version of the Prompt. + response: + docs: Successful Response + type: root.PromptResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + query-parameters: + version_id: version_id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + other: + other: + key: value + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + removeDeployment: + path: /prompts/{id}/environments/{environment_id} + method: DELETE + auth: true + docs: >- + Remove deployment of Prompt from Environment. + + + Remove the deployed Version for the specified Environment. This Prompt + Version + + will no longer be used for calls made to the Prompt in this Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + environment_id: + type: string + docs: Unique identifier for the Environment to remove the deployment from. + display-name: Remove Deployment + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + listEnvironments: + path: /prompts/{id}/environments + method: GET + auth: true + docs: List all Environments and their deployed versions for the Prompt. + path-parameters: + id: + type: string + docs: Unique identifier for Prompt. + display-name: List Environments + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + file: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + display-name: Prompts +docs: >+ + Prompts define how a large language model behaves. + + + #### What is a Prompt? + + + A Prompt on Humanloop encapsulates the base instructions and other + configuration for how a large language model should + + perform a specific task. + + + Prompts have immutable versions that you can **Commit** and **Deploy**. + + To use a Prompt, you can **Call** it to create a generation and you can + **Log** generations manually. + + + #### Referencing Prompts + + + Prompts are referenced by their unique ID or path. + + + You can perform actions on a specific Prompt version by specifying either the + `version_id` + + or `environment` query parameter in the request. If you provide a + `version_id`, Humanloop will + + use the specified version of the Prompt. If you provide an `environment`, + Humanloop will use the + + version of the Prompt that is currently deployed to that Environment. + + If you do not provide either a `version_id` or `environment`, Humanloop will + use the Prompt version + + that is deployed to the default Environment. + +types: + PromptRequestTemplate: + discriminated: false + docs: >- + For chat endpoint, provide a Chat template. For completion endpoint, + provide a Prompt template. Input variables within the template should be + specified with double curly bracket syntax: {{INPUT_NAME}}. + union: + - string + - list + PromptRequestStop: + discriminated: false + docs: >- + The string (or list of strings) after which the model will stop + generating. The returned text will not contain the stop sequence. + union: + - string + - list + PromptLogRequestToolChoice: + discriminated: false + docs: >- + Controls how the model uses tools. The following options are supported: + + - `'none'` means the model will not call any tool and instead generates a + message; this is the default when no tools are provided as part of the + Prompt. + + - `'auto'` means the model can decide to call one or more of the provided + tools; this is the default when tools are provided as part of the Prompt. + + - `'required'` means the model can decide to call one or more of the + provided tools. + + - `{'type': 'function', 'function': {name': }}` forces the + model to use the named function. + union: + - literal<"none"> + - literal<"auto"> + - literal<"required"> + - root.ToolChoice + PromptCallRequestToolChoice: + discriminated: false + docs: >- + Controls how the model uses tools. The following options are supported: + + - `'none'` means the model will not call any tool and instead generates a + message; this is the default when no tools are provided as part of the + Prompt. + + - `'auto'` means the model can decide to call one or more of the provided + tools; this is the default when tools are provided as part of the Prompt. + + - `'required'` means the model can decide to call one or more of the + provided tools. + + - `{'type': 'function', 'function': {name': }}` forces the + model to use the named function. + union: + - literal<"none"> + - literal<"auto"> + - literal<"required"> + - root.ToolChoice + PromptsCallResponse: + discriminated: false + union: + - root.PromptCallResponse + - root.PromptCallStreamResponse diff --git a/.mock/definition/sessions.yml b/.mock/definition/sessions.yml new file mode 100644 index 0000000..87f6210 --- /dev/null +++ b/.mock/definition/sessions.yml @@ -0,0 +1,165 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + get: + path: /sessions/{id} + method: GET + auth: true + docs: Retrieve the Session with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Session. + display-name: Get + response: + docs: Successful Response + type: root.SessionResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + logs: + - id: id + output_message: + role: user + prompt_tokens: 1 + output_tokens: 1 + prompt_cost: 1.1 + output_cost: 1.1 + finish_reason: finish_reason + prompt: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + messages: + - role: user + tool_choice: none + output: output + raw_output: raw_output + created_at: '2024-01-15T09:30:00Z' + error: error + provider_latency: 1.1 + session_id: session_id + parent_id: parent_id + source: source + save: true + source_datapoint_id: source_datapoint_id + batches: + - batches + user: user + environment: environment + delete: + path: /sessions/{id} + method: DELETE + auth: true + docs: Delete the Session with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Session. + display-name: Delete + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + list: + path: /sessions + method: GET + auth: true + docs: Get a list of Sessions. + pagination: + offset: $request.page + results: $response.records + display-name: 'List ' + request: + name: SessionsListRequest + query-parameters: + file_id: + type: optional + docs: >- + Unique identifier for File to return Sessions for. Sessions that + contain any Logs associated to this File will be returned. + version_id: + type: optional + docs: >- + Unique identifier for Version to return Sessions for. Sessions + that contain any Logs associated to this Version will be returned. + page: + type: optional + docs: Page number for pagination. + size: + type: optional + docs: Page size for pagination. Number of Sessions to fetch. + response: + docs: Successful Response + type: root.PaginatedSessionResponse + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + records: + - id: id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + logs: + - id: id + prompt: + path: path + id: id + name: name + version_id: version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + page: 1 + size: 1 + total: 1 + display-name: Sessions +docs: >+ + Sessions are groups of Logs that track sequences of LLM actions. + + + Sessions enable you to trace through related Logs across different Files. For + + example, a Session can contain a Prompt Log recording an LLM generation, a + Tool + + Log recording a retrieval step, and Evaluator Logs measuring the quality of + the + + generated text. + + + Logs within a Session may be nested within each other. When Evaluators are run + + for monitoring, the Evaluator Logs are added to the Session that the evaluated + + Log is in, nested within the evaluated Log. + diff --git a/.mock/definition/tools.yml b/.mock/definition/tools.yml new file mode 100644 index 0000000..d581585 --- /dev/null +++ b/.mock/definition/tools.yml @@ -0,0 +1,864 @@ +imports: + root: __package__.yml +service: + auth: false + base-path: '' + endpoints: + list: + path: /tools + method: GET + auth: true + docs: Get a list of Tools. + pagination: + offset: $request.page + results: $response.records + display-name: 'List ' + request: + name: ToolsListRequest + query-parameters: + page: + type: optional + docs: Page offset for pagination. + size: + type: optional + docs: Page size for pagination. Number of Tools to fetch. + name: + type: optional + docs: Case-insensitive filter for Tool name. + user_filter: + type: optional + docs: >- + Case-insensitive filter for users in the Tool. This filter matches + against both email address and name of users. + sort_by: + type: optional + docs: Field to sort Tools by + order: + type: optional + docs: Direction to sort by. + response: + docs: Successful Response + type: root.ListTools + errors: + - root.UnprocessableEntityError + examples: + - response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + source_code: source_code + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + upsert: + path: /tools + method: POST + auth: true + docs: >- + Create a Tool or update it with a new version if it already exists. + + + Tools are identified by the `ID` or their `path`. The name, description + and parameters determine the versions of the Tool. + + + If you provide a commit message, then the new version will be committed; + + otherwise it will be uncommitted. If you try to commit an already + committed version, + + an exception will be raised. + display-name: Upsert Tool + request: + name: ToolRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Tool, including the name, which is used as a unique + identifier. + id: + type: optional + docs: ID for an existing Tool to update. + function: + type: optional + docs: >- + Callable function specification of the Tool shown to the model + for tool calling. + source_code: + type: optional + docs: Code source of the Tool. + setup_values: + type: optional> + docs: >- + Values needed to setup the Tool, defined in JSON Schema format: + https://json-schema.org/ + tool_type: + type: optional + docs: Type of Tool. + commit_message: + type: optional + docs: Message describing the changes made. + response: + docs: Successful Response + type: root.ToolResponse + errors: + - root.UnprocessableEntityError + examples: + - request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + parameters: + parameters: + key: value + source_code: source_code + setup_values: + setup_values: + key: value + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + get: + path: /tools/{id} + method: GET + auth: true + docs: >- + Retrieve the Tool with the given ID. + + + By default, the deployed version of the Tool is returned. Use the query + parameters + + `version_id` or `environment` to target a specific version of the Tool. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + display-name: Get Tool + request: + name: ToolsGetRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Tool to retrieve. + environment: + type: optional + docs: Name of the Environment to retrieve a deployed Version from. + response: + docs: Successful Response + type: root.ToolResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + parameters: + parameters: + key: value + source_code: source_code + setup_values: + setup_values: + key: value + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + delete: + path: /tools/{id} + method: DELETE + auth: true + docs: Delete the Tool with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + display-name: Delete Tool + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + move: + path: /tools/{id} + method: PATCH + auth: true + docs: Move the Tool to a different path or change the name. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + display-name: Move Tool + request: + name: UpdateToolRequest + body: + properties: + path: + type: optional + docs: >- + Path of the Tool including the Tool name, which is used as a + unique identifier. + name: + type: optional + docs: Name of the Tool, which is used as a unique identifier. + response: + docs: Successful Response + type: root.ToolResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + parameters: + parameters: + key: value + source_code: source_code + setup_values: + setup_values: + key: value + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + listversions: + path: /tools/{id}/versions + method: GET + auth: true + docs: Get a list of all the versions of a Tool. + path-parameters: + id: + type: string + docs: Unique identifier for the Tool. + display-name: List Versions + request: + name: ToolsListVersionsRequest + query-parameters: + status: + type: optional + docs: >- + Filter versions by status: 'uncommitted', 'committed'. If no + status is provided, all versions are returned. + environment: + type: optional + docs: >- + Name of the environment to filter versions by. If no environment + is provided, all versions are returned. + evaluator_aggregates: optional + response: + docs: Successful Response + type: root.ListTools + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + records: + - path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + source_code: source_code + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + commit: + path: /tools/{id}/versions/{version_id}/commit + method: POST + auth: true + docs: Commit the Tool Version with the given ID. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + version_id: + type: string + docs: Unique identifier for the specific version of the Tool. + display-name: Commit + request: + body: root.CommitRequest + response: + docs: Successful Response + type: root.ToolResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + version_id: version_id + request: + commit_message: commit_message + response: + body: + path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + parameters: + parameters: + key: value + source_code: source_code + setup_values: + setup_values: + key: value + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + log: + path: /tools/log + method: POST + auth: true + docs: >- + Log to a Tool. + + + You can use query parameters version_id, or environment, to target + + an existing version of the Tool. Otherwise the default deployed version + will be chosen. + + + Instead of targeting an existing version explicitly, you can instead + pass in + + Tool details in the request body. In this case, we will check if the + details correspond + + to an existing version of the Tool, if not we will create a new version. + This is helpful + + in the case where you are storing or deriving your Tool details in code. + display-name: Log + request: + name: ToolLogRequest + query-parameters: + version_id: + type: optional + docs: A specific Version ID of the Tool to log to. + environment: + type: optional + docs: Name of the Environment identifying a deployed version to log to. + body: + properties: + path: + type: optional + docs: >- + Path of the Tool, including the name, which is used as a unique + identifier. + id: + type: optional + docs: ID for an existing Tool to update. + output: + type: optional + docs: >- + Generated output from your model for the provided inputs. Can be + `None` if logging an error, or if creating a parent Log with the + intention to populate it later. + raw_output: + type: optional + docs: Raw output from the provider. + created_at: + type: optional + docs: 'User defined timestamp for when the log was created. ' + error: + type: optional + docs: Error message if the log is an error. + provider_latency: + type: optional + docs: Duration of the logged event in seconds. + provider_request: + type: optional> + docs: Raw request sent to provider. + provider_response: + type: optional> + docs: Raw response received the provider. + session_id: + type: optional + docs: >- + Unique identifier for the Session to associate the Log to. + Allows you to record multiple Logs to a Session (using an ID + kept by your internal systems) by passing the same `session_id` + in subsequent log requests. + parent_id: + type: optional + docs: >- + Unique identifier for the parent Log in a Session. Should only + be provided if `session_id` is provided. If provided, the Log + will be nested under the parent Log within the Session. + inputs: + type: optional> + docs: The inputs passed to the prompt template. + source: + type: optional + docs: Identifies where the model was called from. + metadata: + type: optional> + docs: Any additional metadata to record. + save: + type: optional + docs: >- + Whether the request/response payloads will be stored on + Humanloop. + source_datapoint_id: + type: optional + docs: >- + Unique identifier for the Datapoint that this Log is derived + from. This can be used by Humanloop to associate Logs to + Evaluations. If provided, Humanloop will automatically associate + this Log to Evaluations that require a Log for this + Datapoint-Version pair. + batches: + type: optional> + docs: >- + Array of Batch Ids that this log is part of. Batches are used to + group Logs together for offline Evaluations + user: + type: optional + docs: End-user ID related to the Log. + environment: + type: optional + docs: The name of the Environment the Log is associated to. + name: toolLogRequestEnvironment + tool: + type: optional + docs: >- + Details of your Tool. A new Tool version will be created if the + provided details are new. + response: + docs: Successful Response + type: root.CreateToolLogResponse + errors: + - root.UnprocessableEntityError + examples: + - request: {} + response: + body: + id: id + tool_id: tool_id + version_id: version_id + session_id: session_id + updateEvaluators: + path: /tools/{id}/evaluators + method: POST + auth: true + docs: |- + Activate and deactivate Evaluators for the Tool. + + An activated Evaluator will automatically be run on all new Logs + within the Tool for monitoring purposes. + path-parameters: + id: string + display-name: Update Evaluators + request: + body: root.EvaluatorActivationDeactivationRequest + response: + docs: Successful Response + type: root.ToolResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + request: {} + response: + body: + path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + parameters: + parameters: + key: value + source_code: source_code + setup_values: + setup_values: + key: value + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + deploy: + path: /tools/{id}/environments/{environment_id} + method: POST + auth: true + docs: >- + Deploy Tool to Environment. + + + Set the deployed Version for the specified Environment. This Tool + Version + + will be used for calls made to the Tool in this Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + environment_id: + type: string + docs: Unique identifier for the Environment to deploy the Version to. + display-name: Deploy + request: + name: DeployToolsIdEnvironmentsEnvironmentIdPostRequest + query-parameters: + version_id: + type: string + docs: Unique identifier for the specific version of the Tool. + response: + docs: Successful Response + type: root.ToolResponse + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + query-parameters: + version_id: version_id + response: + body: + path: path + id: id + name: name + version_id: version_id + type: tool + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + full_name: full_name + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + function: + name: name + description: description + parameters: + parameters: + key: value + source_code: source_code + setup_values: + setup_values: + key: value + tool_type: pinecone_search + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + signature: signature + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + removeDeployment: + path: /tools/{id}/environments/{environment_id} + method: DELETE + auth: true + docs: >- + Remove deployment of Tool from Environment. + + + Remove the deployed Version for the specified Environment. This Tool + Version + + will no longer be used for calls made to the Tool in this Environment. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + environment_id: + type: string + docs: Unique identifier for the Environment to remove the deployment from. + display-name: Remove Deployment + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + environment_id: environment_id + listEnvironments: + path: /tools/{id}/environments + method: GET + auth: true + docs: List all Environments and their deployed versions for the Tool. + path-parameters: + id: + type: string + docs: Unique identifier for Tool. + display-name: List Environments + response: + docs: Successful Response + type: list + errors: + - root.UnprocessableEntityError + examples: + - path-parameters: + id: id + response: + body: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + file: + path: path + id: id + name: name + version_id: version_id + type: prompt + environments: + - id: id + created_at: '2024-01-15T09:30:00Z' + name: name + tag: default + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' + created_by: + id: id + email_address: email_address + status: uncommitted + last_used_at: '2024-01-15T09:30:00Z' + model: model + endpoint: complete + template: template + provider: openai + max_tokens: 1 + temperature: 1.1 + top_p: 1.1 + stop: stop + presence_penalty: 1.1 + frequency_penalty: 1.1 + seed: 1 + response_format: + type: json_object + tools: + - name: name + description: description + linked_tools: + - name: name + description: description + id: id + version_id: version_id + commit_message: commit_message + version_logs_count: 1 + total_logs_count: 1 + inputs: + - name: name + evaluator_aggregates: + - value: 1.1 + evaluator_id: evaluator_id + evaluator_version_id: evaluator_version_id + created_at: '2024-01-15T09:30:00Z' + updated_at: '2024-01-15T09:30:00Z' diff --git a/.mock/fern.config.json b/.mock/fern.config.json new file mode 100644 index 0000000..757fe74 --- /dev/null +++ b/.mock/fern.config.json @@ -0,0 +1,4 @@ +{ + "organization" : "humanloop", + "version" : "0.31.9" +} \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..6db0876 --- /dev/null +++ b/.npmignore @@ -0,0 +1,9 @@ +node_modules +src +tests +.gitignore +.github +.fernignore +.prettierrc.yml +tsconfig.json +yarn.lock \ No newline at end of file diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000..0c06786 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,2 @@ +tabWidth: 4 +printWidth: 120 diff --git a/README.md b/README.md new file mode 100644 index 0000000..c8adb54 --- /dev/null +++ b/README.md @@ -0,0 +1,161 @@ +# Humanloop TypeScript Library + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) +[![npm shield](https://img.shields.io/npm/v/humanloop)](https://www.npmjs.com/package/humanloop) + +The Humanloop TypeScript library provides convenient access to the Humanloop API from TypeScript. + +## Installation + +```sh +npm i -s humanloop +``` + +## Usage + +Instantiate and use the client with the following: + +```typescript +import * as environments from "../src/environments"; +import { HumanloopClient } from "humanloop"; + +const client = new HumanloopClient({ apiKey: "YOUR_API_KEY" }); +await client.prompts.upsert({ + model: "model", +}); +``` + +## Request And Response Types + +The SDK exports all request and response types as TypeScript interfaces. Simply import them with the +following namespace: + +```typescript +import { Humanloop } from "humanloop"; + +const request: Humanloop.PromptsListPromptsRequest = { + ... +}; +const response = await client.listPrompts(request); +``` + +## Exception Handling + +When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error +will be thrown. + +```typescript +import { HumanloopError } from "humanloop"; + +try { + await client.upsert(...); +} catch (err) { + if (err instanceof HumanloopError) { + console.log(err.statusCode); + console.log(err.message); + console.log(err.body); + } +} +``` + +## Aborting Requests + +The SDK allows users to abort requests at any point by passing in an abort signal. + +```typescript +const controller = new AbortController(); +const response = await client.upsert(..., { + abortSignal: controller.signal +}); +controller.abort(); // aborts the request +``` + +## Runtime Compatibility + +The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following +runtimes: + +- Node.js 18+ +- Vercel +- Cloudflare Workers +- Deno v1.25+ +- Bun 1.0+ +- React Native + +### Customizing Fetch Client + +The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an +unsupported environment, this provides a way for you to break glass and ensure the SDK works. + +```typescript +import { HumanloopClient } from "humanloop"; + +const client = new HumanloopClient({ + ... + fetcher: // provide your implementation here +}); +``` + +## Advanced + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retriable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). + +A request is deemed retriable when any of the following HTTP status codes is returned: + +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + +Use the `maxRetries` request option to configure this behavior. + +```typescript +const response = await client.upsert(..., { + maxRetries: 0 // override maxRetries at the request level +}); +``` + +## Advanced + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retriable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). + +A request is deemed retriable when any of the following HTTP status codes is returned: + +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + +Use the `maxRetries` request option to configure this behavior. + +```typescript +const response = await client.upsert(..., { + maxRetries: 0 // override maxRetries at the request level +}); +``` + +### Timeouts + +The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior. + +```typescript +const response = await client.upsert(..., { + timeoutInSeconds: 30 // override timeout to 30s +}); +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..35d6e65 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,5 @@ +/** @type {import('jest').Config} */ +module.exports = { + preset: "ts-jest", + testEnvironment: "node", +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..8c86b7b --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "humanloop", + "version": "0.0.1", + "private": false, + "repository": "https://github.com/humanloop/humanloop-node-beta", + "main": "./index.js", + "types": "./index.d.ts", + "scripts": { + "format": "prettier . --write --ignore-unknown", + "build": "tsc", + "prepack": "cp -rv dist/. .", + "test": "jest" + }, + "dependencies": { + "url-join": "4.0.1", + "form-data": "4.0.0", + "formdata-node": "^6.0.3", + "node-fetch": "2.7.0", + "qs": "6.11.2" + }, + "devDependencies": { + "@types/url-join": "4.0.1", + "@types/qs": "6.9.8", + "@types/node-fetch": "2.6.9", + "jest": "29.7.0", + "@types/jest": "29.5.5", + "ts-jest": "29.1.1", + "jest-environment-jsdom": "29.7.0", + "@types/node": "17.0.33", + "prettier": "2.7.1", + "typescript": "4.6.4" + } +} diff --git a/reference.md b/reference.md new file mode 100644 index 0000000..e19022e --- /dev/null +++ b/reference.md @@ -0,0 +1,6156 @@ +## Prompts + +
client.prompts.listPrompts({ ...params }) -> Humanloop.ListPrompts + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of Prompts. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.listPrompts(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.PromptsListPromptsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.upsert({ ...params }) -> Humanloop.PromptResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Create a Prompt or update it with a new version if it already exists. + +Prompts are identified by the `ID` or their `path`. The parameters (i.e. the prompt template, temperature, model etc.) determine the versions of the Prompt. + +If you provide a commit message, then the new version will be committed; +otherwise it will be uncommitted. If you try to commit an already committed version, +an exception will be raised. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.upsert({ + model: "model", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.PromptRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.get(id, { ...params }) -> Humanloop.PromptResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve the Prompt with the given ID. + +By default, the deployed version of the Prompt is returned. Use the query parameters +`version_id` or `environment` to target a specific version of the Prompt. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**request: `Humanloop.PromptsGetRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete the Prompt with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.move(id, { ...params }) -> Humanloop.PromptResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Move the Prompt to a different path or change the name. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.move("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**request: `Humanloop.UpdatePromptRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.listversions(id, { ...params }) -> Humanloop.ListPrompts + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of all the versions of a Prompt. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.listversions("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**request: `Humanloop.PromptsListVersionsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.commit(id, versionId, { ...params }) -> Humanloop.PromptResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Commit the Prompt Version with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.commit("id", "version_id", { + commitMessage: "commit_message", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**versionId: `string`** — Unique identifier for the specific version of the Prompt. + +
+ +
+ +
+ +
+ +**request: `Humanloop.CommitRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.log({ ...params }) -> Humanloop.CreatePromptLogResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Log to a Prompt. + +You can use query parameters version_id, or environment, to target +an existing version of the Prompt. Otherwise the default deployed version will be chosen. + +Instead of targeting an existing version explicitly, you can instead pass in +Prompt details in the request body. In this case, we will check if the details correspond +to an existing version of the Prompt, if not we will create a new version. This is helpful +in the case where you are storing or deriving your Prompt details in code. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.log(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.PromptLogRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.call({ ...params }) -> Humanloop.PromptsCallResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Call a Prompt. + +Calling a Prompt subsequently calls the model provider before logging +the data to Humanloop. + +You can use query parameters version_id, or environment, to target +an existing version of the Prompt. Otherwise the default deployed version will be chosen. + +Instead of targeting an existing version explicitly, you can instead pass in +Prompt details in the request body. In this case, we will check if the details correspond +to an existing version of the Prompt, if not we will create a new version. This is helpful +in the case where you are storing or deriving your Prompt details in code. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.call(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.PromptCallRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.updateEvaluators(id, { ...params }) -> Humanloop.PromptResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Activate and deactivate Evaluators for the Prompt. + +An activated Evaluator will automatically be run on all new Logs +within the Prompt for monitoring purposes. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.updateEvaluators("id", {}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluatorActivationDeactivationRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.deploy(id, environmentId, { ...params }) -> Humanloop.PromptResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Deploy Prompt to Environment. + +Set the deployed Version for the specified Environment. This Prompt Version +will be used for calls made to the Prompt in this Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.deploy("id", "environment_id", { + versionId: "version_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to deploy the Version to. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DeployPromptsIdEnvironmentsEnvironmentIdPostRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.removeDeployment(id, environmentId) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Remove deployment of Prompt from Environment. + +Remove the deployed Version for the specified Environment. This Prompt Version +will no longer be used for calls made to the Prompt in this Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.removeDeployment("id", "environment_id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to remove the deployment from. + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.prompts.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List all Environments and their deployed versions for the Prompt. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.prompts.listEnvironments("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**requestOptions: `Prompts.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Tools + +
client.tools.list({ ...params }) -> Humanloop.ListTools + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of Tools. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.list(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.ToolsListRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.upsert({ ...params }) -> Humanloop.ToolResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Create a Tool or update it with a new version if it already exists. + +Tools are identified by the `ID` or their `path`. The name, description and parameters determine the versions of the Tool. + +If you provide a commit message, then the new version will be committed; +otherwise it will be uncommitted. If you try to commit an already committed version, +an exception will be raised. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.upsert(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.ToolRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.get(id, { ...params }) -> Humanloop.ToolResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve the Tool with the given ID. + +By default, the deployed version of the Tool is returned. Use the query parameters +`version_id` or `environment` to target a specific version of the Tool. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**request: `Humanloop.ToolsGetRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete the Tool with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.move(id, { ...params }) -> Humanloop.ToolResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Move the Tool to a different path or change the name. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.move("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**request: `Humanloop.UpdateToolRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.listversions(id, { ...params }) -> Humanloop.ListTools + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of all the versions of a Tool. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.listversions("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for the Tool. + +
+ +
+ +
+ +
+ +**request: `Humanloop.ToolsListVersionsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.commit(id, versionId, { ...params }) -> Humanloop.ToolResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Commit the Tool Version with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.commit("id", "version_id", { + commitMessage: "commit_message", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**versionId: `string`** — Unique identifier for the specific version of the Tool. + +
+ +
+ +
+ +
+ +**request: `Humanloop.CommitRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.log({ ...params }) -> Humanloop.CreateToolLogResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Log to a Tool. + +You can use query parameters version_id, or environment, to target +an existing version of the Tool. Otherwise the default deployed version will be chosen. + +Instead of targeting an existing version explicitly, you can instead pass in +Tool details in the request body. In this case, we will check if the details correspond +to an existing version of the Tool, if not we will create a new version. This is helpful +in the case where you are storing or deriving your Tool details in code. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.log(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.ToolLogRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.updateEvaluators(id, { ...params }) -> Humanloop.ToolResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Activate and deactivate Evaluators for the Tool. + +An activated Evaluator will automatically be run on all new Logs +within the Tool for monitoring purposes. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.updateEvaluators("id", {}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluatorActivationDeactivationRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.deploy(id, environmentId, { ...params }) -> Humanloop.ToolResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Deploy Tool to Environment. + +Set the deployed Version for the specified Environment. This Tool Version +will be used for calls made to the Tool in this Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.deploy("id", "environment_id", { + versionId: "version_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to deploy the Version to. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DeployToolsIdEnvironmentsEnvironmentIdPostRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.removeDeployment(id, environmentId) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Remove deployment of Tool from Environment. + +Remove the deployed Version for the specified Environment. This Tool Version +will no longer be used for calls made to the Tool in this Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.removeDeployment("id", "environment_id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to remove the deployment from. + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.tools.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List all Environments and their deployed versions for the Tool. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.tools.listEnvironments("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Tool. + +
+ +
+ +
+ +
+ +**requestOptions: `Tools.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Datasets + +
client.datasets.list({ ...params }) -> Humanloop.PaginatedDatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of Datasets. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.list(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.DatasetsListRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.upsert({ ...params }) -> Humanloop.DatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Create a Dataset or update it with a new version if it already exists. + +Datasets are identified by the `ID` or their `path`. The datapoints determine the versions of the Dataset. + +By default, the new Dataset version will be set to the list of Datapoints provided in +the request. You can also create a new version by adding or removing Datapoints from an existing version +by specifying `action` as `add` or `remove` respectively. In this case, you may specify +the `version_id` or `environment` query parameters to identify the existing version to base +the new version on. If neither is provided, the default deployed version will be used. + +If you provide a commit message, then the new version will be committed; +otherwise it will be uncommitted. If you try to commit an already committed version, +an exception will be raised. + +Humanloop also deduplicates Datapoints. If you try to add a Datapoint that already +exists, it will be ignored. If you intentionally want to add a duplicate Datapoint, +you can add a unique identifier to the Datapoint's inputs such as `{_dedupe_id: }`. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.upsert({ + datapoints: [{}], +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.DatasetsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.get(id, { ...params }) -> Humanloop.DatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve the Dataset with the given ID. + +Unless `include_datapoints` is set to `true`, the response will not include +the Datapoints. +Use the List Datapoints endpoint (`GET /{id}/datapoints`) to efficiently +retrieve Datapoints for a large Dataset. + +By default, the deployed version of the Dataset is returned. Use the query parameters +`version_id` or `environment` to target a specific version of the Dataset. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DatasetsGetRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete the Dataset with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.move(id, { ...params }) -> Humanloop.DatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Update the Dataset with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.move("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**request: `Humanloop.UpdateDatasetRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.listdatapoints(id, { ...params }) -> Humanloop.PaginatedDatapointResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List all Datapoints for the Dataset with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.listdatapoints("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DatasetsListDatapointsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.listversions(id, { ...params }) -> Humanloop.ListDatasets + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of the versions for a Dataset. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.listversions("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DatasetsListVersionsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.commit(id, versionId, { ...params }) -> Humanloop.DatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Commit the Dataset Version with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.commit("id", "version_id", { + commitMessage: "commit_message", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**versionId: `string`** — Unique identifier for the specific version of the Dataset. + +
+ +
+ +
+ +
+ +**request: `Humanloop.CommitRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.createdatapointsfromlogs(id, { ...params }) -> Humanloop.DatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Add Datapoints from Logs to a Dataset. + +This will create a new committed version of the Dataset with the Datapoints from the Logs. + +If either `version_id` or `environment` is provided, the new version will be based on the specified version, +with the Datapoints from the Logs added to the existing Datapoints in the version. +If neither `version_id` nor `environment` is provided, the new version will be based on the version +of the Dataset that is deployed to the default Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.createdatapointsfromlogs("id", { + logIds: ["log_ids"], + commitMessage: "commit_message", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for the Dataset + +
+ +
+ +
+ +
+ +**request: `Humanloop.BodyDatasetsCreateDatapointsFromLogs`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.deploy(id, environmentId, { ...params }) -> Humanloop.DatasetResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Deploy Dataset to Environment. + +Set the deployed Version for the specified Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.deploy("id", "environment_id", { + versionId: "version_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to deploy the Version to. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.removeDeployment(id, environmentId) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Remove deployment of Dataset from Environment. + +Remove the deployed Version for the specified Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.removeDeployment("id", "environment_id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to remove the deployment from. + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.datasets.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List all Environments and their deployed versions for the Dataset. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.datasets.listEnvironments("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Dataset. + +
+ +
+ +
+ +
+ +**requestOptions: `Datasets.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Directories + +
client.directories.list() -> Humanloop.DirectoryResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve a list of all Directories. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.directories.list(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**requestOptions: `Directories.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.directories.create({ ...params }) -> Humanloop.DirectoryResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Creates a Directory. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.directories.create({ + name: "name", + parentId: "parent_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.CreateDirectoryRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Directories.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.directories.get(id) -> Humanloop.DirectoryWithParentsAndChildrenResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Fetches a directory by ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.directories.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — String ID of directory. Starts with `dir_`. + +
+ +
+ +
+ +
+ +**requestOptions: `Directories.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.directories.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete the Directory with the given ID. + +The Directory must be empty (i.e. contain no Directories or Files). + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.directories.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Directory. Starts with `dir_`. + +
+ +
+ +
+ +
+ +**requestOptions: `Directories.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.directories.update(id, { ...params }) -> Humanloop.DirectoryResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Update the Directory with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.directories.update("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Directory. Starts with `dir_`. + +
+ +
+ +
+ +
+ +**request: `Humanloop.UpdateDirectoryRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Directories.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Evaluations + +
client.evaluations.list({ ...params }) -> Humanloop.PaginatedEvaluationResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List Evaluations for the given File. + +Retrieve a list of Evaluations that evaluate versions of the specified File. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.list({ + fileId: "file_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluationsListRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluations.create({ ...params }) -> Humanloop.EvaluationResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Create an Evaluation. + +Create a new Evaluation by specifying the Dataset, Evaluatees, and Evaluators. +Humanloop will automatically start generating Logs and running Evaluators. + +To keep updated on the progress of the Evaluation, you can poll the Evaluation +and check its status. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.create({ + dataset: { + versionId: "version_id", + }, + evaluatees: [ + { + versionId: "version_id", + }, + ], + evaluators: [ + { + versionId: "version_id", + }, + ], +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.CreateEvaluationRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluations.get(id) -> Humanloop.EvaluationResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get an Evaluation. + +Retrieve the Evaluation with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluation. + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluations.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete an Evaluation. + +Remove an Evaluation from Humanloop. The Logs and Versions used in the Evaluation +will not be deleted. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluation. + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluations.update(id, { ...params }) -> Humanloop.EvaluationResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Update an Evaluation. + +Update the setup of an Evaluation by specifying the Dataset, Evaluatees, and Evaluators. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.update("id", { + dataset: { + versionId: "version_id", + }, + evaluatees: [ + { + versionId: "version_id", + }, + ], + evaluators: [ + { + versionId: "version_id", + }, + ], +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluation. + +
+ +
+ +
+ +
+ +**request: `Humanloop.CreateEvaluationRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluations.updatestatus(id, { ...params }) -> Humanloop.EvaluationResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Update the status of an Evaluation. + +Can be used to cancel a running Evaluation, or mark an Evaluation that uses external or human evaluators +as completed. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.updatestatus("id", { + status: Humanloop.EvaluationStatus.Pending, +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluation. + +
+ +
+ +
+ +
+ +**request: `Humanloop.UpdateEvaluationStatusRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluations.getstats(id) -> Humanloop.EvaluationStats + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get Evaluation Stats. + +Retrieve aggregate stats for the specified Evaluation. +This includes the number of generated Logs for every evaluatee and Evaluator metrics +(such as the mean and percentiles for numeric Evaluators for every evaluatee). + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluations.getstats("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluation. + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluations.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Evaluators + +
client.evaluators.list({ ...params }) -> Humanloop.ListEvaluators + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of Evaluators. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.list(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluatorsListRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.upsert({ ...params }) -> Humanloop.EvaluatorResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Create an Evaluator or update it with a new version if it already exists. + +Evaluators are identified by the `ID` or their `path`. The spec provided determines the version of the Evaluator. + +If you provide a commit message, then the new version will be committed; +otherwise it will be uncommitted. If you try to commit an already committed version, +an exception will be raised. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.upsert({ + spec: { + argumentsType: Humanloop.EvaluatorArgumentsType.TargetFree, + returnType: Humanloop.EvaluatorReturnTypeEnum.Boolean, + }, +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluatorsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.get(id, { ...params }) -> Humanloop.EvaluatorResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve the Evaluator with the given ID. + +By default, the deployed version of the Evaluator is returned. Use the query parameters +`version_id` or `environment` to target a specific version of the Evaluator. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluator. + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluatorsGetRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete the Evaluator with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluator. + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.move(id, { ...params }) -> Humanloop.EvaluatorResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Move the Evaluator to a different path or change the name. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.move("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluator. + +
+ +
+ +
+ +
+ +**request: `Humanloop.UpdateEvaluatorRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.listversions(id, { ...params }) -> Humanloop.ListEvaluators + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of all the versions of an Evaluator. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.listversions("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for the Evaluator. + +
+ +
+ +
+ +
+ +**request: `Humanloop.EvaluatorsListVersionsRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.commit(id, versionId, { ...params }) -> Humanloop.EvaluatorResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Commit the Evaluator Version with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.commit("id", "version_id", { + commitMessage: "commit_message", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Prompt. + +
+ +
+ +
+ +
+ +**versionId: `string`** — Unique identifier for the specific version of the Evaluator. + +
+ +
+ +
+ +
+ +**request: `Humanloop.CommitRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.listdefault() -> Humanloop.EvaluatorResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of default evaluators for the organization. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.listdefault(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.debug({ ...params }) -> Humanloop.EvaluationDebugResultResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Run a synchronous evaluator execution on a collection of datapoints. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.debug({ + fileId: "file_id", + evaluator: { + argumentsType: Humanloop.EvaluatorArgumentsType.TargetFree, + returnType: Humanloop.EvaluatorReturnTypeEnum.Boolean, + }, +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.RunSyncEvaluationRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.deploy(id, environmentId, { ...params }) -> Humanloop.EvaluatorResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Deploy Evaluator to Environment. + +Set the deployed Version for the specified Environment. This Evaluator Version +will be used for calls made to the Evaluator in this Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.deploy("id", "environment_id", { + versionId: "version_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluator. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to deploy the Version to. + +
+ +
+ +
+ +
+ +**request: `Humanloop.DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.removeDeployment(id, environmentId) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Remove deployment of Evaluator from Environment. + +Remove the deployed Version for the specified Environment. This Evaluator Version +will no longer be used for calls made to the Evaluator in this Environment. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.removeDeployment("id", "environment_id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluator. + +
+ +
+ +
+ +
+ +**environmentId: `string`** — Unique identifier for the Environment to remove the deployment from. + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.evaluators.listEnvironments(id) -> Humanloop.FileEnvironmentResponse[] + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List all Environments and their deployed versions for the Evaluator. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.evaluators.listEnvironments("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Evaluator. + +
+ +
+ +
+ +
+ +**requestOptions: `Evaluators.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Logs + +
client.logs.listLogsForFile({ ...params }) -> Humanloop.PaginatedPromptLogResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +List Logs. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.logs.listLogsForFile({ + fileId: "file_id", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.ListLogsForFileLogsGetRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Logs.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.logs.delete({ ...params }) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete Logs with the given IDs. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.logs.delete({ + id: "string", +}); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.LogsDeleteRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Logs.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.logs.get(id) -> Humanloop.PromptLogResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve the Log with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.logs.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Log. + +
+ +
+ +
+ +
+ +**requestOptions: `Logs.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +## Sessions + +
client.sessions.get(id) -> Humanloop.SessionResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Retrieve the Session with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.sessions.get("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Session. + +
+ +
+ +
+ +
+ +**requestOptions: `Sessions.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.sessions.delete(id) -> void + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Delete the Session with the given ID. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.sessions.delete("id"); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**id: `string`** — Unique identifier for Session. + +
+ +
+ +
+ +
+ +**requestOptions: `Sessions.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
+ +
client.sessions.list({ ...params }) -> Humanloop.PaginatedSessionResponse + +
+ +
+ +#### 📝 Description + +
+ +
+ +
+ +
+ +Get a list of Sessions. + +
+ +
+ +
+ +
+ +#### 🔌 Usage + +
+ +
+ +
+ +
+ +```ts +await client.sessions.list(); +``` + +
+ +
+ +
+ +
+ +#### ⚙️ Parameters + +
+ +
+ +
+ +
+ +**request: `Humanloop.SessionsListRequest`** + +
+ +
+ +
+ +
+ +**requestOptions: `Sessions.RequestOptions`** + +
+ +
+ +
+ +
+ +
+ +
+
diff --git a/src/Client.ts b/src/Client.ts new file mode 100644 index 0000000..0d52aa3 --- /dev/null +++ b/src/Client.ts @@ -0,0 +1,80 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "./environments"; +import * as core from "./core"; +import { Prompts } from "./api/resources/prompts/client/Client"; +import { Tools } from "./api/resources/tools/client/Client"; +import { Datasets } from "./api/resources/datasets/client/Client"; +import { Directories } from "./api/resources/directories/client/Client"; +import { Evaluations } from "./api/resources/evaluations/client/Client"; +import { Evaluators } from "./api/resources/evaluators/client/Client"; +import { Logs } from "./api/resources/logs/client/Client"; +import { Sessions } from "./api/resources/sessions/client/Client"; + +export declare namespace HumanloopClient { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class HumanloopClient { + constructor(protected readonly _options: HumanloopClient.Options) {} + + protected _prompts: Prompts | undefined; + + public get prompts(): Prompts { + return (this._prompts ??= new Prompts(this._options)); + } + + protected _tools: Tools | undefined; + + public get tools(): Tools { + return (this._tools ??= new Tools(this._options)); + } + + protected _datasets: Datasets | undefined; + + public get datasets(): Datasets { + return (this._datasets ??= new Datasets(this._options)); + } + + protected _directories: Directories | undefined; + + public get directories(): Directories { + return (this._directories ??= new Directories(this._options)); + } + + protected _evaluations: Evaluations | undefined; + + public get evaluations(): Evaluations { + return (this._evaluations ??= new Evaluations(this._options)); + } + + protected _evaluators: Evaluators | undefined; + + public get evaluators(): Evaluators { + return (this._evaluators ??= new Evaluators(this._options)); + } + + protected _logs: Logs | undefined; + + public get logs(): Logs { + return (this._logs ??= new Logs(this._options)); + } + + protected _sessions: Sessions | undefined; + + public get sessions(): Sessions { + return (this._sessions ??= new Sessions(this._options)); + } +} diff --git a/src/api/errors/UnprocessableEntityError.ts b/src/api/errors/UnprocessableEntityError.ts new file mode 100644 index 0000000..9430e2a --- /dev/null +++ b/src/api/errors/UnprocessableEntityError.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors/index"; +import * as Humanloop from "../index"; + +export class UnprocessableEntityError extends errors.HumanloopError { + constructor(body: Humanloop.HttpValidationError) { + super({ + message: "UnprocessableEntityError", + statusCode: 422, + body: body, + }); + Object.setPrototypeOf(this, UnprocessableEntityError.prototype); + } +} diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts new file mode 100644 index 0000000..58719cc --- /dev/null +++ b/src/api/errors/index.ts @@ -0,0 +1 @@ +export * from "./UnprocessableEntityError"; diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..3006072 --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,3 @@ +export * from "./resources"; +export * from "./types"; +export * from "./errors"; diff --git a/src/api/resources/datasets/client/Client.ts b/src/api/resources/datasets/client/Client.ts new file mode 100644 index 0000000..f48525a --- /dev/null +++ b/src/api/resources/datasets/client/Client.ts @@ -0,0 +1,1160 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Datasets { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +/** + * Datasets are collections of input-output pairs that you can use within Humanloop for Evaluations. + * + * #### What is a Dataset? + * + * A Dataset is a collection of unique Datapoints. These Datapoints contain `inputs` and `target` fields. The `inputs` + * are used to populate a Prompt's template and the `target` can be referenced by Evaluators to evaluate the quality of + * the generated output. + * + * Note that Humanloop automatically deduplicates Datapoints. If you try to add a Datapoint that already exists, it will + * be ignored. If you intentionally want to add a duplicate Datapoint, you can add a unique identifier to the Datapoint's + * inputs such as `{_dedupe_id: }`. + * + * #### Creating Dataset versions + * + * Datasets have immutable versions. To add/remove Datapoint to/from an existing version, use the **Create** endpoint + * and specify `action` as `"add"` or `"remove"` respectively. You may also specify the `version_id` or `environment` + * query parameters to identify the existing version to base the new version on. If neither is provided, the version + * deployed to the default Environment will be used. + * + * + */ +export class Datasets { + constructor(protected readonly _options: Datasets.Options) {} + + /** + * Get a list of Datasets. + * + * @param {Humanloop.DatasetsListRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.list() + */ + public async list( + request: Humanloop.DatasetsListRequest = {}, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { page, size, name, userFilter, sortBy, order } = request; + const _queryParams: Record = {}; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + if (name != null) { + _queryParams["name"] = name; + } + + if (userFilter != null) { + _queryParams["user_filter"] = userFilter; + } + + if (sortBy != null) { + _queryParams["sort_by"] = sortBy; + } + + if (order != null) { + _queryParams["order"] = order; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "datasets" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PaginatedDatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a Dataset or update it with a new version if it already exists. + * + * Datasets are identified by the `ID` or their `path`. The datapoints determine the versions of the Dataset. + * + * By default, the new Dataset version will be set to the list of Datapoints provided in + * the request. You can also create a new version by adding or removing Datapoints from an existing version + * by specifying `action` as `add` or `remove` respectively. In this case, you may specify + * the `version_id` or `environment` query parameters to identify the existing version to base + * the new version on. If neither is provided, the default deployed version will be used. + * + * If you provide a commit message, then the new version will be committed; + * otherwise it will be uncommitted. If you try to commit an already committed version, + * an exception will be raised. + * + * Humanloop also deduplicates Datapoints. If you try to add a Datapoint that already + * exists, it will be ignored. If you intentionally want to add a duplicate Datapoint, + * you can add a unique identifier to the Datapoint's inputs such as `{_dedupe_id: }`. + * + * @param {Humanloop.DatasetsRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.upsert({ + * datapoints: [{}] + * }) + */ + public async upsert( + request: Humanloop.DatasetsRequest, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { versionId, environment, ..._body } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "datasets" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + body: await serializers.DatasetsRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve the Dataset with the given ID. + * + * Unless `include_datapoints` is set to `true`, the response will not include + * the Datapoints. + * Use the List Datapoints endpoint (`GET /{id}/datapoints`) to efficiently + * retrieve Datapoints for a large Dataset. + * + * By default, the deployed version of the Dataset is returned. Use the query parameters + * `version_id` or `environment` to target a specific version of the Dataset. + * + * @param {string} id - Unique identifier for Dataset. + * @param {Humanloop.DatasetsGetRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.get("id") + */ + public async get( + id: string, + request: Humanloop.DatasetsGetRequest = {}, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { versionId, environment, includeDatapoints } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + if (includeDatapoints != null) { + _queryParams["include_datapoints"] = includeDatapoints.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the Dataset with the given ID. + * + * @param {string} id - Unique identifier for Dataset. + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.delete("id") + */ + public async delete(id: string, requestOptions?: Datasets.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update the Dataset with the given ID. + * + * @param {string} id - Unique identifier for Dataset. + * @param {Humanloop.UpdateDatasetRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.move("id") + */ + public async move( + id: string, + request: Humanloop.UpdateDatasetRequest = {}, + requestOptions?: Datasets.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.UpdateDatasetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List all Datapoints for the Dataset with the given ID. + * + * @param {string} id - Unique identifier for Dataset. + * @param {Humanloop.DatasetsListDatapointsRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.listdatapoints("id") + */ + public async listdatapoints( + id: string, + request: Humanloop.DatasetsListDatapointsRequest = {}, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { versionId, environment, page, size } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/datapoints` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PaginatedDatapointResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of the versions for a Dataset. + * + * @param {string} id - Unique identifier for Dataset. + * @param {Humanloop.DatasetsListVersionsRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.listversions("id") + */ + public async listversions( + id: string, + request: Humanloop.DatasetsListVersionsRequest = {}, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { status, environment, evaluationAggregates } = request; + const _queryParams: Record = {}; + if (status != null) { + _queryParams["status"] = status; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + if (evaluationAggregates != null) { + _queryParams["evaluation_aggregates"] = evaluationAggregates.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/versions` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListDatasets.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Commit the Dataset Version with the given ID. + * + * @param {string} id - Unique identifier for Dataset. + * @param {string} versionId - Unique identifier for the specific version of the Dataset. + * @param {Humanloop.CommitRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.commit("id", "version_id", { + * commitMessage: "commit_message" + * }) + */ + public async commit( + id: string, + versionId: string, + request: Humanloop.CommitRequest, + requestOptions?: Datasets.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/commit` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CommitRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Add Datapoints from Logs to a Dataset. + * + * This will create a new committed version of the Dataset with the Datapoints from the Logs. + * + * If either `version_id` or `environment` is provided, the new version will be based on the specified version, + * with the Datapoints from the Logs added to the existing Datapoints in the version. + * If neither `version_id` nor `environment` is provided, the new version will be based on the version + * of the Dataset that is deployed to the default Environment. + * + * @param {string} id - Unique identifier for the Dataset + * @param {Humanloop.BodyDatasetsCreateDatapointsFromLogs} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.createdatapointsfromlogs("id", { + * logIds: ["log_ids"], + * commitMessage: "commit_message" + * }) + */ + public async createdatapointsfromlogs( + id: string, + request: Humanloop.BodyDatasetsCreateDatapointsFromLogs, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { versionId, environment, ..._body } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/datapoints/logs` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + body: await serializers.BodyDatasetsCreateDatapointsFromLogs.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deploy Dataset to Environment. + * + * Set the deployed Version for the specified Environment. + * + * @param {string} id - Unique identifier for Dataset. + * @param {string} environmentId - Unique identifier for the Environment to deploy the Version to. + * @param {Humanloop.DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest} request + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.deploy("id", "environment_id", { + * versionId: "version_id" + * }) + */ + public async deploy( + id: string, + environmentId: string, + request: Humanloop.DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest, + requestOptions?: Datasets.RequestOptions + ): Promise { + const { versionId } = request; + const _queryParams: Record = {}; + _queryParams["version_id"] = versionId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DatasetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Remove deployment of Dataset from Environment. + * + * Remove the deployed Version for the specified Environment. + * + * @param {string} id - Unique identifier for Dataset. + * @param {string} environmentId - Unique identifier for the Environment to remove the deployment from. + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.removeDeployment("id", "environment_id") + */ + public async removeDeployment( + id: string, + environmentId: string, + requestOptions?: Datasets.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List all Environments and their deployed versions for the Dataset. + * + * @param {string} id - Unique identifier for Dataset. + * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.datasets.listEnvironments("id") + */ + public async listEnvironments( + id: string, + requestOptions?: Datasets.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `datasets/${encodeURIComponent(id)}/environments` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.datasets.listEnvironments.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/datasets/client/index.ts b/src/api/resources/datasets/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/datasets/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts b/src/api/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts new file mode 100644 index 0000000..5d9d697 --- /dev/null +++ b/src/api/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * logIds: ["log_ids"], + * commitMessage: "commit_message" + * } + */ +export interface BodyDatasetsCreateDatapointsFromLogs { + /** + * ID of the specific Dataset version to base the created Version on. + */ + versionId?: string; + /** + * Name of the Environment identifying a deployed Version to base the created Version on. + */ + environment?: string; + /** List of Log IDs to create Datapoints from. */ + logIds: string[]; + /** Commit message for the new Dataset version. */ + commitMessage: string; +} diff --git a/src/api/resources/datasets/client/requests/DatasetsGetRequest.ts b/src/api/resources/datasets/client/requests/DatasetsGetRequest.ts new file mode 100644 index 0000000..5d58e4c --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsGetRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface DatasetsGetRequest { + /** + * A specific Version ID of the Dataset to retrieve. + */ + versionId?: string; + /** + * Name of the Environment to retrieve a deployed Version from. + */ + environment?: string; + /** + * If set to `true`, include all Datapoints in the response. Defaults to `false`. Consider using the paginated List Datapoints endpoint instead. + */ + includeDatapoints?: boolean; +} diff --git a/src/api/resources/datasets/client/requests/DatasetsListDatapointsRequest.ts b/src/api/resources/datasets/client/requests/DatasetsListDatapointsRequest.ts new file mode 100644 index 0000000..2b4b1e6 --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsListDatapointsRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface DatasetsListDatapointsRequest { + /** + * A specific Version ID of the Dataset to retrieve. + */ + versionId?: string; + /** + * Name of the Environment to retrieve a deployed Version from. + */ + environment?: string; + /** + * Page number for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Datapoints to fetch. + */ + size?: number; +} diff --git a/src/api/resources/datasets/client/requests/DatasetsListRequest.ts b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts new file mode 100644 index 0000000..3ae5fe5 --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsListRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface DatasetsListRequest { + /** + * Page offset for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Datasets to fetch. + */ + size?: number; + /** + * Case-insensitive filter for Dataset name. + */ + name?: string; + /** + * Case-insensitive filter for users in the Dataset. This filter matches against both email address and name of users. + */ + userFilter?: string; + /** + * Field to sort Datasets by + */ + sortBy?: Humanloop.ProjectSortBy; + /** + * Direction to sort by. + */ + order?: Humanloop.SortOrder; +} diff --git a/src/api/resources/datasets/client/requests/DatasetsListVersionsRequest.ts b/src/api/resources/datasets/client/requests/DatasetsListVersionsRequest.ts new file mode 100644 index 0000000..a9d30e1 --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsListVersionsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface DatasetsListVersionsRequest { + /** + * Filter versions by status: 'uncommitted', 'committed'. If no status is provided, all versions are returned. + */ + status?: Humanloop.VersionStatus; + /** + * Name of the environment to filter versions by. If no environment is provided, all versions are returned. + */ + environment?: string; + evaluationAggregates?: boolean; +} diff --git a/src/api/resources/datasets/client/requests/DatasetsRequest.ts b/src/api/resources/datasets/client/requests/DatasetsRequest.ts new file mode 100644 index 0000000..34bb7de --- /dev/null +++ b/src/api/resources/datasets/client/requests/DatasetsRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * { + * datapoints: [{}] + * } + */ +export interface DatasetsRequest { + /** + * ID of the specific Dataset version to base the created Version on. Only used when `action` is `"add"` or `"remove"`. + */ + versionId?: string; + /** + * Name of the Environment identifying a deployed Version to base the created Version on. Only used when `action` is `"add"` or `"remove"`. + */ + environment?: string; + /** Path of the Dataset, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Dataset to update. */ + id?: string; + /** The Datapoints to create this Dataset version with. Modify the `action` field to determine how these Datapoints are used. */ + datapoints: Humanloop.CreateDatapointRequest[]; + /** + * The action to take with the provided Datapoints. + * + * - If `"set"`, the created version will only contain the Datapoints provided in this request. + * - If `"add"`, the created version will contain the Datapoints provided in this request in addition to the Datapoints in the target version. + * - If `"remove"`, the created version will contain the Datapoints in the target version except for the Datapoints provided in this request. + * + * If `"add"` or `"remove"`, one of the `version_id` or `environment` query parameters may be provided. + */ + action?: Humanloop.UpdateDatesetAction; + /** Message describing the changes made. If provided, a committed version of the Dataset is created. Otherwise, an uncommitted version is created. */ + commitMessage?: string; +} diff --git a/src/api/resources/datasets/client/requests/DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest.ts b/src/api/resources/datasets/client/requests/DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest.ts new file mode 100644 index 0000000..3d297e1 --- /dev/null +++ b/src/api/resources/datasets/client/requests/DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * versionId: "version_id" + * } + */ +export interface DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest { + /** + * Unique identifier for the specific version of the Dataset. + */ + versionId: string; +} diff --git a/src/api/resources/datasets/client/requests/UpdateDatasetRequest.ts b/src/api/resources/datasets/client/requests/UpdateDatasetRequest.ts new file mode 100644 index 0000000..af8bbdc --- /dev/null +++ b/src/api/resources/datasets/client/requests/UpdateDatasetRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface UpdateDatasetRequest { + /** Path of the Dataset including the Dataset name, which is used as a unique identifier. */ + path?: string; + /** Name of the Dataset, which is used as a unique identifier. */ + name?: string; +} diff --git a/src/api/resources/datasets/client/requests/index.ts b/src/api/resources/datasets/client/requests/index.ts new file mode 100644 index 0000000..1fdd55d --- /dev/null +++ b/src/api/resources/datasets/client/requests/index.ts @@ -0,0 +1,8 @@ +export { type DatasetsListRequest } from "./DatasetsListRequest"; +export { type DatasetsRequest } from "./DatasetsRequest"; +export { type DatasetsGetRequest } from "./DatasetsGetRequest"; +export { type UpdateDatasetRequest } from "./UpdateDatasetRequest"; +export { type DatasetsListDatapointsRequest } from "./DatasetsListDatapointsRequest"; +export { type DatasetsListVersionsRequest } from "./DatasetsListVersionsRequest"; +export { type BodyDatasetsCreateDatapointsFromLogs } from "./BodyDatasetsCreateDatapointsFromLogs"; +export { type DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest } from "./DeployDatasetsIdEnvironmentsEnvironmentIdPostRequest"; diff --git a/src/api/resources/datasets/index.ts b/src/api/resources/datasets/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/datasets/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/directories/client/Client.ts b/src/api/resources/directories/client/Client.ts new file mode 100644 index 0000000..accb673 --- /dev/null +++ b/src/api/resources/directories/client/Client.ts @@ -0,0 +1,424 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Directories { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Directories { + constructor(protected readonly _options: Directories.Options) {} + + /** + * Retrieve a list of all Directories. + * + * @param {Directories.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.directories.list() + */ + public async list(requestOptions?: Directories.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "directories" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.directories.list.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates a Directory. + * + * @param {Humanloop.CreateDirectoryRequest} request + * @param {Directories.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.directories.create({ + * name: "name", + * parentId: "parent_id" + * }) + */ + public async create( + request: Humanloop.CreateDirectoryRequest, + requestOptions?: Directories.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "directories" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CreateDirectoryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DirectoryResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Fetches a directory by ID. + * + * @param {string} id - String ID of directory. Starts with `dir_`. + * @param {Directories.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.directories.get("id") + */ + public async get( + id: string, + requestOptions?: Directories.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `directories/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DirectoryWithParentsAndChildrenResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the Directory with the given ID. + * + * The Directory must be empty (i.e. contain no Directories or Files). + * + * @param {string} id - Unique identifier for Directory. Starts with `dir_`. + * @param {Directories.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.directories.delete("id") + */ + public async delete(id: string, requestOptions?: Directories.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `directories/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update the Directory with the given ID. + * + * @param {string} id - Unique identifier for Directory. Starts with `dir_`. + * @param {Humanloop.UpdateDirectoryRequest} request + * @param {Directories.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.directories.update("id") + */ + public async update( + id: string, + request: Humanloop.UpdateDirectoryRequest = {}, + requestOptions?: Directories.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `directories/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.UpdateDirectoryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.DirectoryResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/directories/client/index.ts b/src/api/resources/directories/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/directories/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/directories/client/requests/CreateDirectoryRequest.ts b/src/api/resources/directories/client/requests/CreateDirectoryRequest.ts new file mode 100644 index 0000000..d8bd4a4 --- /dev/null +++ b/src/api/resources/directories/client/requests/CreateDirectoryRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * name: "name", + * parentId: "parent_id" + * } + */ +export interface CreateDirectoryRequest { + /** Name of the directory to create. */ + name: string; + /** ID of the parent directory. Starts with `dir_`. */ + parentId: string; +} diff --git a/src/api/resources/directories/client/requests/UpdateDirectoryRequest.ts b/src/api/resources/directories/client/requests/UpdateDirectoryRequest.ts new file mode 100644 index 0000000..d5a5ec1 --- /dev/null +++ b/src/api/resources/directories/client/requests/UpdateDirectoryRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface UpdateDirectoryRequest { + /** Name to set for the directory. */ + name?: string; + /** ID of the parent directory. Specify this to move directories. Starts with `dir_`. */ + parentId?: string; +} diff --git a/src/api/resources/directories/client/requests/index.ts b/src/api/resources/directories/client/requests/index.ts new file mode 100644 index 0000000..6d5541c --- /dev/null +++ b/src/api/resources/directories/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type CreateDirectoryRequest } from "./CreateDirectoryRequest"; +export { type UpdateDirectoryRequest } from "./UpdateDirectoryRequest"; diff --git a/src/api/resources/directories/index.ts b/src/api/resources/directories/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/directories/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/evaluations/client/Client.ts b/src/api/resources/evaluations/client/Client.ts new file mode 100644 index 0000000..e519ef3 --- /dev/null +++ b/src/api/resources/evaluations/client/Client.ts @@ -0,0 +1,652 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Evaluations { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +/** + * Evaluations help you measure the performance of your Prompts, Tools and LLM Evaluators. + * + * An Evaluation consists of a Dataset, Evaluatees (i.e. Versions to evaluate), and Evaluators. + * When an Evaluation is created, Humanloop will start generating Logs, iterating through Datapoints in the Dataset, + * for each Evaluatee. The Evaluators will then be run on these Logs. + * + * Aggregate stats can be viewed in the Humanloop app or retrieved with the **Get Evaluation Stats** endpoint. + * + * Note that when an Evaluation is created, Humanloop will attempt to reuse any existing Logs for each Datapoint-Evaluatee + * pair. This means that you can create multiple Evaluations without generating new Logs unnecessarily. + * + * + */ +export class Evaluations { + constructor(protected readonly _options: Evaluations.Options) {} + + /** + * List Evaluations for the given File. + * + * Retrieve a list of Evaluations that evaluate versions of the specified File. + * + * @param {Humanloop.EvaluationsListRequest} request + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.list({ + * fileId: "file_id" + * }) + */ + public async list( + request: Humanloop.EvaluationsListRequest, + requestOptions?: Evaluations.RequestOptions + ): Promise { + const { fileId, page, size } = request; + const _queryParams: Record = {}; + _queryParams["file_id"] = fileId; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "evaluations" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PaginatedEvaluationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create an Evaluation. + * + * Create a new Evaluation by specifying the Dataset, Evaluatees, and Evaluators. + * Humanloop will automatically start generating Logs and running Evaluators. + * + * To keep updated on the progress of the Evaluation, you can poll the Evaluation + * and check its status. + * + * @param {Humanloop.CreateEvaluationRequest} request + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.create({ + * dataset: { + * versionId: "version_id" + * }, + * evaluatees: [{ + * versionId: "version_id" + * }], + * evaluators: [{ + * versionId: "version_id" + * }] + * }) + */ + public async create( + request: Humanloop.CreateEvaluationRequest, + requestOptions?: Evaluations.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "evaluations" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CreateEvaluationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get an Evaluation. + * + * Retrieve the Evaluation with the given ID. + * + * @param {string} id - Unique identifier for Evaluation. + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.get("id") + */ + public async get(id: string, requestOptions?: Evaluations.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluations/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete an Evaluation. + * + * Remove an Evaluation from Humanloop. The Logs and Versions used in the Evaluation + * will not be deleted. + * + * @param {string} id - Unique identifier for Evaluation. + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.delete("id") + */ + public async delete(id: string, requestOptions?: Evaluations.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluations/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update an Evaluation. + * + * Update the setup of an Evaluation by specifying the Dataset, Evaluatees, and Evaluators. + * + * @param {string} id - Unique identifier for Evaluation. + * @param {Humanloop.CreateEvaluationRequest} request + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.update("id", { + * dataset: { + * versionId: "version_id" + * }, + * evaluatees: [{ + * versionId: "version_id" + * }], + * evaluators: [{ + * versionId: "version_id" + * }] + * }) + */ + public async update( + id: string, + request: Humanloop.CreateEvaluationRequest, + requestOptions?: Evaluations.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluations/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CreateEvaluationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Update the status of an Evaluation. + * + * Can be used to cancel a running Evaluation, or mark an Evaluation that uses external or human evaluators + * as completed. + * + * @param {string} id - Unique identifier for Evaluation. + * @param {Humanloop.UpdateEvaluationStatusRequest} request + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.updatestatus("id", { + * status: Humanloop.EvaluationStatus.Pending + * }) + */ + public async updatestatus( + id: string, + request: Humanloop.UpdateEvaluationStatusRequest, + requestOptions?: Evaluations.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluations/${encodeURIComponent(id)}/status` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.UpdateEvaluationStatusRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get Evaluation Stats. + * + * Retrieve aggregate stats for the specified Evaluation. + * This includes the number of generated Logs for every evaluatee and Evaluator metrics + * (such as the mean and percentiles for numeric Evaluators for every evaluatee). + * + * @param {string} id - Unique identifier for Evaluation. + * @param {Evaluations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluations.getstats("id") + */ + public async getstats(id: string, requestOptions?: Evaluations.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluations/${encodeURIComponent(id)}/stats` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluationStats.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/evaluations/client/index.ts b/src/api/resources/evaluations/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/evaluations/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/evaluations/client/requests/EvaluationsListRequest.ts b/src/api/resources/evaluations/client/requests/EvaluationsListRequest.ts new file mode 100644 index 0000000..8a89d23 --- /dev/null +++ b/src/api/resources/evaluations/client/requests/EvaluationsListRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * fileId: "file_id" + * } + */ +export interface EvaluationsListRequest { + /** + * Filter by File ID. If provided, only Evaluation for the specified File will be returned. + */ + fileId: string; + /** + * Page number for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Evaluations to fetch. + */ + size?: number; +} diff --git a/src/api/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts b/src/api/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts new file mode 100644 index 0000000..c38ab05 --- /dev/null +++ b/src/api/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * { + * status: Humanloop.EvaluationStatus.Pending + * } + */ +export interface UpdateEvaluationStatusRequest { + status: Humanloop.EvaluationStatus; +} diff --git a/src/api/resources/evaluations/client/requests/index.ts b/src/api/resources/evaluations/client/requests/index.ts new file mode 100644 index 0000000..b727fcb --- /dev/null +++ b/src/api/resources/evaluations/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type EvaluationsListRequest } from "./EvaluationsListRequest"; +export { type UpdateEvaluationStatusRequest } from "./UpdateEvaluationStatusRequest"; diff --git a/src/api/resources/evaluations/index.ts b/src/api/resources/evaluations/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/evaluations/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/evaluators/client/Client.ts b/src/api/resources/evaluators/client/Client.ts new file mode 100644 index 0000000..3243c9c --- /dev/null +++ b/src/api/resources/evaluators/client/Client.ts @@ -0,0 +1,1069 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Evaluators { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Evaluators { + constructor(protected readonly _options: Evaluators.Options) {} + + /** + * Get a list of Evaluators. + * + * @param {Humanloop.EvaluatorsListRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.list() + */ + public async list( + request: Humanloop.EvaluatorsListRequest = {}, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const { page, size, name, userFilter, sortBy, order } = request; + const _queryParams: Record = {}; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + if (name != null) { + _queryParams["name"] = name; + } + + if (userFilter != null) { + _queryParams["user_filter"] = userFilter; + } + + if (sortBy != null) { + _queryParams["sort_by"] = sortBy; + } + + if (order != null) { + _queryParams["order"] = order; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "evaluators" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListEvaluators.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create an Evaluator or update it with a new version if it already exists. + * + * Evaluators are identified by the `ID` or their `path`. The spec provided determines the version of the Evaluator. + * + * If you provide a commit message, then the new version will be committed; + * otherwise it will be uncommitted. If you try to commit an already committed version, + * an exception will be raised. + * + * @param {Humanloop.EvaluatorsRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.upsert({ + * spec: { + * argumentsType: Humanloop.EvaluatorArgumentsType.TargetFree, + * returnType: Humanloop.EvaluatorReturnTypeEnum.Boolean + * } + * }) + */ + public async upsert( + request: Humanloop.EvaluatorsRequest, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "evaluators" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.EvaluatorsRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluatorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve the Evaluator with the given ID. + * + * By default, the deployed version of the Evaluator is returned. Use the query parameters + * `version_id` or `environment` to target a specific version of the Evaluator. + * + * @param {string} id - Unique identifier for Evaluator. + * @param {Humanloop.EvaluatorsGetRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.get("id") + */ + public async get( + id: string, + request: Humanloop.EvaluatorsGetRequest = {}, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const { versionId, environment } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluatorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the Evaluator with the given ID. + * + * @param {string} id - Unique identifier for Evaluator. + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.delete("id") + */ + public async delete(id: string, requestOptions?: Evaluators.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Move the Evaluator to a different path or change the name. + * + * @param {string} id - Unique identifier for Evaluator. + * @param {Humanloop.UpdateEvaluatorRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.move("id") + */ + public async move( + id: string, + request: Humanloop.UpdateEvaluatorRequest = {}, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.UpdateEvaluatorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluatorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of all the versions of an Evaluator. + * + * @param {string} id - Unique identifier for the Evaluator. + * @param {Humanloop.EvaluatorsListVersionsRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.listversions("id") + */ + public async listversions( + id: string, + request: Humanloop.EvaluatorsListVersionsRequest = {}, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const { status, environment, evaluatorAggregates } = request; + const _queryParams: Record = {}; + if (status != null) { + _queryParams["status"] = status; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + if (evaluatorAggregates != null) { + _queryParams["evaluator_aggregates"] = evaluatorAggregates.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}/versions` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListEvaluators.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Commit the Evaluator Version with the given ID. + * + * @param {string} id - Unique identifier for Prompt. + * @param {string} versionId - Unique identifier for the specific version of the Evaluator. + * @param {Humanloop.CommitRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.commit("id", "version_id", { + * commitMessage: "commit_message" + * }) + */ + public async commit( + id: string, + versionId: string, + request: Humanloop.CommitRequest, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/commit` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CommitRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluatorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of default evaluators for the organization. + * + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.listdefault() + */ + public async listdefault(requestOptions?: Evaluators.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "evaluators/default" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.evaluators.listdefault.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Run a synchronous evaluator execution on a collection of datapoints. + * + * @param {Humanloop.RunSyncEvaluationRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.debug({ + * fileId: "file_id", + * evaluator: { + * argumentsType: Humanloop.EvaluatorArgumentsType.TargetFree, + * returnType: Humanloop.EvaluatorReturnTypeEnum.Boolean + * } + * }) + */ + public async debug( + request: Humanloop.RunSyncEvaluationRequest, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "evaluators/debug" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.RunSyncEvaluationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.evaluators.debug.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deploy Evaluator to Environment. + * + * Set the deployed Version for the specified Environment. This Evaluator Version + * will be used for calls made to the Evaluator in this Environment. + * + * @param {string} id - Unique identifier for Evaluator. + * @param {string} environmentId - Unique identifier for the Environment to deploy the Version to. + * @param {Humanloop.DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest} request + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.deploy("id", "environment_id", { + * versionId: "version_id" + * }) + */ + public async deploy( + id: string, + environmentId: string, + request: Humanloop.DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const { versionId } = request; + const _queryParams: Record = {}; + _queryParams["version_id"] = versionId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.EvaluatorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Remove deployment of Evaluator from Environment. + * + * Remove the deployed Version for the specified Environment. This Evaluator Version + * will no longer be used for calls made to the Evaluator in this Environment. + * + * @param {string} id - Unique identifier for Evaluator. + * @param {string} environmentId - Unique identifier for the Environment to remove the deployment from. + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.removeDeployment("id", "environment_id") + */ + public async removeDeployment( + id: string, + environmentId: string, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List all Environments and their deployed versions for the Evaluator. + * + * @param {string} id - Unique identifier for Evaluator. + * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.evaluators.listEnvironments("id") + */ + public async listEnvironments( + id: string, + requestOptions?: Evaluators.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `evaluators/${encodeURIComponent(id)}/environments` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.evaluators.listEnvironments.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/evaluators/client/index.ts b/src/api/resources/evaluators/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/evaluators/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/evaluators/client/requests/DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest.ts b/src/api/resources/evaluators/client/requests/DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest.ts new file mode 100644 index 0000000..edecfb1 --- /dev/null +++ b/src/api/resources/evaluators/client/requests/DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * versionId: "version_id" + * } + */ +export interface DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest { + /** + * Unique identifier for the specific version of the Evaluator. + */ + versionId: string; +} diff --git a/src/api/resources/evaluators/client/requests/EvaluatorsGetRequest.ts b/src/api/resources/evaluators/client/requests/EvaluatorsGetRequest.ts new file mode 100644 index 0000000..b61d8c0 --- /dev/null +++ b/src/api/resources/evaluators/client/requests/EvaluatorsGetRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface EvaluatorsGetRequest { + /** + * A specific Version ID of the Evaluator to retrieve. + */ + versionId?: string; + /** + * Name of the Environment to retrieve a deployed Version from. + */ + environment?: string; +} diff --git a/src/api/resources/evaluators/client/requests/EvaluatorsListRequest.ts b/src/api/resources/evaluators/client/requests/EvaluatorsListRequest.ts new file mode 100644 index 0000000..49d3ffb --- /dev/null +++ b/src/api/resources/evaluators/client/requests/EvaluatorsListRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface EvaluatorsListRequest { + /** + * Page offset for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Evaluators to fetch. + */ + size?: number; + /** + * Case-insensitive filter for Evaluator name. + */ + name?: string; + /** + * Case-insensitive filter for users in the Evaluator. This filter matches against both email address and name of users. + */ + userFilter?: string; + /** + * Field to sort Evaluators by + */ + sortBy?: Humanloop.ProjectSortBy; + /** + * Direction to sort by. + */ + order?: Humanloop.SortOrder; +} diff --git a/src/api/resources/evaluators/client/requests/EvaluatorsListVersionsRequest.ts b/src/api/resources/evaluators/client/requests/EvaluatorsListVersionsRequest.ts new file mode 100644 index 0000000..9a4fe42 --- /dev/null +++ b/src/api/resources/evaluators/client/requests/EvaluatorsListVersionsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface EvaluatorsListVersionsRequest { + /** + * Filter versions by status: 'uncommitted', 'committed'. If no status is provided, all versions are returned. + */ + status?: Humanloop.VersionStatus; + /** + * Name of the environment to filter versions by. If no environment is provided, all versions are returned. + */ + environment?: string; + evaluatorAggregates?: boolean; +} diff --git a/src/api/resources/evaluators/client/requests/EvaluatorsRequest.ts b/src/api/resources/evaluators/client/requests/EvaluatorsRequest.ts new file mode 100644 index 0000000..402672d --- /dev/null +++ b/src/api/resources/evaluators/client/requests/EvaluatorsRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * { + * spec: { + * argumentsType: Humanloop.EvaluatorArgumentsType.TargetFree, + * returnType: Humanloop.EvaluatorReturnTypeEnum.Boolean + * } + * } + */ +export interface EvaluatorsRequest { + /** Path of the Evaluator, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Evaluator to update. */ + id?: string; + /** Message describing the changes made. */ + commitMessage?: string; + spec: Humanloop.SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec; +} diff --git a/src/api/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts b/src/api/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts new file mode 100644 index 0000000..15d5859 --- /dev/null +++ b/src/api/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * { + * fileId: "file_id", + * evaluator: { + * argumentsType: Humanloop.EvaluatorArgumentsType.TargetFree, + * returnType: Humanloop.EvaluatorReturnTypeEnum.Boolean + * } + * } + */ +export interface RunSyncEvaluationRequest { + /** The ID of the Dataset that the datapoints belong to. */ + fileId: string; + evaluator: Humanloop.RunSyncEvaluationRequestEvaluator; + /** The ID of the Evaluator Version being debugged if it already exists and is being edited. */ + evaluatorVersionId?: string; + /** The IDs of the logs on which to run the draft evaluator.Provide one of `log_ids` or `datapoint_ids`. */ + logIds?: string[]; + /** The IDs of the evaluation datapoints on which to run the draft evaluator. */ + datapointIds?: string[]; + /** The ID of the Prompt Version to use generate datapoints for the evaluation datapoints. Only required if `datapoint_ids` is provided; has no effect otherwise. */ + promptVersionId?: string; +} diff --git a/src/api/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts b/src/api/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts new file mode 100644 index 0000000..fe9c8fa --- /dev/null +++ b/src/api/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface UpdateEvaluatorRequest { + /** Path of the Evaluator including the Evaluator name, which is used as a unique identifier. */ + path?: string; + /** Name of the Evaluator, which is used as a unique identifier. */ + name?: string; +} diff --git a/src/api/resources/evaluators/client/requests/index.ts b/src/api/resources/evaluators/client/requests/index.ts new file mode 100644 index 0000000..605cff1 --- /dev/null +++ b/src/api/resources/evaluators/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type EvaluatorsListRequest } from "./EvaluatorsListRequest"; +export { type EvaluatorsRequest } from "./EvaluatorsRequest"; +export { type EvaluatorsGetRequest } from "./EvaluatorsGetRequest"; +export { type UpdateEvaluatorRequest } from "./UpdateEvaluatorRequest"; +export { type EvaluatorsListVersionsRequest } from "./EvaluatorsListVersionsRequest"; +export { type RunSyncEvaluationRequest } from "./RunSyncEvaluationRequest"; +export { type DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest } from "./DeployEvaluatorsIdEnvironmentsEnvironmentIdPostRequest"; diff --git a/src/api/resources/evaluators/index.ts b/src/api/resources/evaluators/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/evaluators/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts b/src/api/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts new file mode 100644 index 0000000..6fd808f --- /dev/null +++ b/src/api/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../index"; + +export type RunSyncEvaluationRequestEvaluator = + | Humanloop.LlmEvaluatorRequest + | Humanloop.CodeEvaluatorRequest + | Humanloop.HumanEvaluatorRequest; diff --git a/src/api/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts b/src/api/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts new file mode 100644 index 0000000..e8e8396 --- /dev/null +++ b/src/api/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../index"; + +export type SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec = + | Humanloop.LlmEvaluatorRequest + | Humanloop.CodeEvaluatorRequest + | Humanloop.HumanEvaluatorRequest; diff --git a/src/api/resources/evaluators/types/index.ts b/src/api/resources/evaluators/types/index.ts new file mode 100644 index 0000000..6ec5c06 --- /dev/null +++ b/src/api/resources/evaluators/types/index.ts @@ -0,0 +1,2 @@ +export * from "./SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec"; +export * from "./RunSyncEvaluationRequestEvaluator"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts new file mode 100644 index 0000000..56936dd --- /dev/null +++ b/src/api/resources/index.ts @@ -0,0 +1,18 @@ +export * as prompts from "./prompts"; +export * from "./prompts/types"; +export * as evaluators from "./evaluators"; +export * from "./evaluators/types"; +export * as tools from "./tools"; +export * as datasets from "./datasets"; +export * as directories from "./directories"; +export * as evaluations from "./evaluations"; +export * as logs from "./logs"; +export * as sessions from "./sessions"; +export * from "./prompts/client/requests"; +export * from "./tools/client/requests"; +export * from "./datasets/client/requests"; +export * from "./directories/client/requests"; +export * from "./evaluations/client/requests"; +export * from "./evaluators/client/requests"; +export * from "./logs/client/requests"; +export * from "./sessions/client/requests"; diff --git a/src/api/resources/logs/client/Client.ts b/src/api/resources/logs/client/Client.ts new file mode 100644 index 0000000..1f69747 --- /dev/null +++ b/src/api/resources/logs/client/Client.ts @@ -0,0 +1,325 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Logs { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +/** + * Logs contain the inputs and outputs of each time a Prompt, Tool or Evaluator is called. + * + * Humanloop automatically records the inputs and outputs when you Call a Prompt or Tool and saves a Log. + * Evaluator Logs are also created when an Evaluator is run on a Log. + * + * You can manually create Logs through the API. + * + * ... + * + * + * + */ +export class Logs { + constructor(protected readonly _options: Logs.Options) {} + + /** + * List Logs. + * + * @param {Humanloop.ListLogsForFileLogsGetRequest} request + * @param {Logs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.logs.listLogsForFile({ + * fileId: "file_id" + * }) + */ + public async listLogsForFile( + request: Humanloop.ListLogsForFileLogsGetRequest, + requestOptions?: Logs.RequestOptions + ): Promise { + const { fileId, page, size, versionId, versionStatus, search, metadataSearch, startDate, endDate } = request; + const _queryParams: Record = {}; + _queryParams["file_id"] = fileId; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (versionStatus != null) { + _queryParams["version_status"] = versionStatus; + } + + if (search != null) { + _queryParams["search"] = search; + } + + if (metadataSearch != null) { + _queryParams["metadata_search"] = metadataSearch; + } + + if (startDate != null) { + _queryParams["start_date"] = startDate.toISOString(); + } + + if (endDate != null) { + _queryParams["end_date"] = endDate.toISOString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "logs" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PaginatedPromptLogResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete Logs with the given IDs. + * + * @param {Humanloop.LogsDeleteRequest} request + * @param {Logs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.logs.delete({ + * id: "string" + * }) + */ + public async delete( + request: Humanloop.LogsDeleteRequest = {}, + requestOptions?: Logs.RequestOptions + ): Promise { + const { id } = request; + const _queryParams: Record = {}; + if (id != null) { + if (Array.isArray(id)) { + _queryParams["id"] = id.map((item) => item); + } else { + _queryParams["id"] = id; + } + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "logs" + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve the Log with the given ID. + * + * @param {string} id - Unique identifier for Log. + * @param {Logs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.logs.get("id") + */ + public async get(id: string, requestOptions?: Logs.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `logs/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptLogResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/logs/client/index.ts b/src/api/resources/logs/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/logs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/logs/client/requests/ListLogsForFileLogsGetRequest.ts b/src/api/resources/logs/client/requests/ListLogsForFileLogsGetRequest.ts new file mode 100644 index 0000000..a4cbcf7 --- /dev/null +++ b/src/api/resources/logs/client/requests/ListLogsForFileLogsGetRequest.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * { + * fileId: "file_id" + * } + */ +export interface ListLogsForFileLogsGetRequest { + /** + * Unique identifier for the File to list Logs for. + */ + fileId: string; + /** + * Page number for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Logs to fetch. + */ + size?: number; + /** + * If provided, only Logs belonging to the specified Version will be returned. + */ + versionId?: string; + /** + * If provided, only Logs belonging to Versions with the specified status will be returned. + */ + versionStatus?: Humanloop.VersionStatus; + /** + * If provided, only Logs that contain the provided string in its inputs and output will be returned. + */ + search?: string; + /** + * If provided, only Logs that contain the provided string in its metadata will be returned. + */ + metadataSearch?: string; + /** + * If provided, only Logs created after the specified date will be returned. + */ + startDate?: Date; + /** + * If provided, only Logs created before the specified date will be returned. + */ + endDate?: Date; +} diff --git a/src/api/resources/logs/client/requests/LogsDeleteRequest.ts b/src/api/resources/logs/client/requests/LogsDeleteRequest.ts new file mode 100644 index 0000000..ccae68d --- /dev/null +++ b/src/api/resources/logs/client/requests/LogsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "string" + * } + */ +export interface LogsDeleteRequest { + /** + * Unique identifiers for the Logs to delete. + */ + id?: string | string[]; +} diff --git a/src/api/resources/logs/client/requests/index.ts b/src/api/resources/logs/client/requests/index.ts new file mode 100644 index 0000000..8639477 --- /dev/null +++ b/src/api/resources/logs/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type ListLogsForFileLogsGetRequest } from "./ListLogsForFileLogsGetRequest"; +export { type LogsDeleteRequest } from "./LogsDeleteRequest"; diff --git a/src/api/resources/logs/index.ts b/src/api/resources/logs/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/logs/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/prompts/client/Client.ts b/src/api/resources/prompts/client/Client.ts new file mode 100644 index 0000000..7c1a467 --- /dev/null +++ b/src/api/resources/prompts/client/Client.ts @@ -0,0 +1,1217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Prompts { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +/** + * Prompts define how a large language model behaves. + * + * #### What is a Prompt? + * + * A Prompt on Humanloop encapsulates the base instructions and other configuration for how a large language model should + * perform a specific task. + * + * Prompts have immutable versions that you can **Commit** and **Deploy**. + * To use a Prompt, you can **Call** it to create a generation and you can **Log** generations manually. + * + * #### Referencing Prompts + * + * Prompts are referenced by their unique ID or path. + * + * You can perform actions on a specific Prompt version by specifying either the `version_id` + * or `environment` query parameter in the request. If you provide a `version_id`, Humanloop will + * use the specified version of the Prompt. If you provide an `environment`, Humanloop will use the + * version of the Prompt that is currently deployed to that Environment. + * If you do not provide either a `version_id` or `environment`, Humanloop will use the Prompt version + * that is deployed to the default Environment. + * + * + */ +export class Prompts { + constructor(protected readonly _options: Prompts.Options) {} + + /** + * Get a list of Prompts. + * + * @param {Humanloop.PromptsListPromptsRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.listPrompts() + */ + public async listPrompts( + request: Humanloop.PromptsListPromptsRequest = {}, + requestOptions?: Prompts.RequestOptions + ): Promise { + const { page, size, name, userFilter, sortBy, order } = request; + const _queryParams: Record = {}; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + if (name != null) { + _queryParams["name"] = name; + } + + if (userFilter != null) { + _queryParams["user_filter"] = userFilter; + } + + if (sortBy != null) { + _queryParams["sort_by"] = sortBy; + } + + if (order != null) { + _queryParams["order"] = order; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "prompts" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListPrompts.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a Prompt or update it with a new version if it already exists. + * + * Prompts are identified by the `ID` or their `path`. The parameters (i.e. the prompt template, temperature, model etc.) determine the versions of the Prompt. + * + * If you provide a commit message, then the new version will be committed; + * otherwise it will be uncommitted. If you try to commit an already committed version, + * an exception will be raised. + * + * @param {Humanloop.PromptRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.upsert({ + * model: "model" + * }) + */ + public async upsert( + request: Humanloop.PromptRequest, + requestOptions?: Prompts.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "prompts" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.PromptRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve the Prompt with the given ID. + * + * By default, the deployed version of the Prompt is returned. Use the query parameters + * `version_id` or `environment` to target a specific version of the Prompt. + * + * @param {string} id - Unique identifier for Prompt. + * @param {Humanloop.PromptsGetRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.get("id") + */ + public async get( + id: string, + request: Humanloop.PromptsGetRequest = {}, + requestOptions?: Prompts.RequestOptions + ): Promise { + const { versionId, environment } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the Prompt with the given ID. + * + * @param {string} id - Unique identifier for Prompt. + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.delete("id") + */ + public async delete(id: string, requestOptions?: Prompts.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Move the Prompt to a different path or change the name. + * + * @param {string} id - Unique identifier for Prompt. + * @param {Humanloop.UpdatePromptRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.move("id") + */ + public async move( + id: string, + request: Humanloop.UpdatePromptRequest = {}, + requestOptions?: Prompts.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.UpdatePromptRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of all the versions of a Prompt. + * + * @param {string} id - Unique identifier for Prompt. + * @param {Humanloop.PromptsListVersionsRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.listversions("id") + */ + public async listversions( + id: string, + request: Humanloop.PromptsListVersionsRequest = {}, + requestOptions?: Prompts.RequestOptions + ): Promise { + const { status, environment, evaluatorAggregates } = request; + const _queryParams: Record = {}; + if (status != null) { + _queryParams["status"] = status; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + if (evaluatorAggregates != null) { + _queryParams["evaluator_aggregates"] = evaluatorAggregates.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}/versions` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListPrompts.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Commit the Prompt Version with the given ID. + * + * @param {string} id - Unique identifier for Prompt. + * @param {string} versionId - Unique identifier for the specific version of the Prompt. + * @param {Humanloop.CommitRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.commit("id", "version_id", { + * commitMessage: "commit_message" + * }) + */ + public async commit( + id: string, + versionId: string, + request: Humanloop.CommitRequest, + requestOptions?: Prompts.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/commit` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CommitRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Log to a Prompt. + * + * You can use query parameters version_id, or environment, to target + * an existing version of the Prompt. Otherwise the default deployed version will be chosen. + * + * Instead of targeting an existing version explicitly, you can instead pass in + * Prompt details in the request body. In this case, we will check if the details correspond + * to an existing version of the Prompt, if not we will create a new version. This is helpful + * in the case where you are storing or deriving your Prompt details in code. + * + * @param {Humanloop.PromptLogRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.log() + */ + public async log( + request: Humanloop.PromptLogRequest = {}, + requestOptions?: Prompts.RequestOptions + ): Promise { + const { versionId, environment, ..._body } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "prompts/log" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + body: await serializers.PromptLogRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.CreatePromptLogResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Call a Prompt. + * + * Calling a Prompt subsequently calls the model provider before logging + * the data to Humanloop. + * + * You can use query parameters version_id, or environment, to target + * an existing version of the Prompt. Otherwise the default deployed version will be chosen. + * + * Instead of targeting an existing version explicitly, you can instead pass in + * Prompt details in the request body. In this case, we will check if the details correspond + * to an existing version of the Prompt, if not we will create a new version. This is helpful + * in the case where you are storing or deriving your Prompt details in code. + * + * @param {Humanloop.PromptCallRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.call() + */ + public async call( + request: Humanloop.PromptCallRequest = {}, + requestOptions?: Prompts.RequestOptions + ): Promise { + const { versionId, environment, ..._body } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "prompts/call" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + body: await serializers.PromptCallRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptsCallResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Activate and deactivate Evaluators for the Prompt. + * + * An activated Evaluator will automatically be run on all new Logs + * within the Prompt for monitoring purposes. + * + * @param {string} id + * @param {Humanloop.EvaluatorActivationDeactivationRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.updateEvaluators("id", {}) + */ + public async updateEvaluators( + id: string, + request: Humanloop.EvaluatorActivationDeactivationRequest, + requestOptions?: Prompts.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}/evaluators` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.EvaluatorActivationDeactivationRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deploy Prompt to Environment. + * + * Set the deployed Version for the specified Environment. This Prompt Version + * will be used for calls made to the Prompt in this Environment. + * + * @param {string} id - Unique identifier for Prompt. + * @param {string} environmentId - Unique identifier for the Environment to deploy the Version to. + * @param {Humanloop.DeployPromptsIdEnvironmentsEnvironmentIdPostRequest} request + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.deploy("id", "environment_id", { + * versionId: "version_id" + * }) + */ + public async deploy( + id: string, + environmentId: string, + request: Humanloop.DeployPromptsIdEnvironmentsEnvironmentIdPostRequest, + requestOptions?: Prompts.RequestOptions + ): Promise { + const { versionId } = request; + const _queryParams: Record = {}; + _queryParams["version_id"] = versionId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PromptResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Remove deployment of Prompt from Environment. + * + * Remove the deployed Version for the specified Environment. This Prompt Version + * will no longer be used for calls made to the Prompt in this Environment. + * + * @param {string} id - Unique identifier for Prompt. + * @param {string} environmentId - Unique identifier for the Environment to remove the deployment from. + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.removeDeployment("id", "environment_id") + */ + public async removeDeployment( + id: string, + environmentId: string, + requestOptions?: Prompts.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List all Environments and their deployed versions for the Prompt. + * + * @param {string} id - Unique identifier for Prompt. + * @param {Prompts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.prompts.listEnvironments("id") + */ + public async listEnvironments( + id: string, + requestOptions?: Prompts.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `prompts/${encodeURIComponent(id)}/environments` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.prompts.listEnvironments.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/prompts/client/index.ts b/src/api/resources/prompts/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/prompts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/prompts/client/requests/DeployPromptsIdEnvironmentsEnvironmentIdPostRequest.ts b/src/api/resources/prompts/client/requests/DeployPromptsIdEnvironmentsEnvironmentIdPostRequest.ts new file mode 100644 index 0000000..9ec8e34 --- /dev/null +++ b/src/api/resources/prompts/client/requests/DeployPromptsIdEnvironmentsEnvironmentIdPostRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * versionId: "version_id" + * } + */ +export interface DeployPromptsIdEnvironmentsEnvironmentIdPostRequest { + /** + * Unique identifier for the specific version of the Prompt. + */ + versionId: string; +} diff --git a/src/api/resources/prompts/client/requests/PromptCallRequest.ts b/src/api/resources/prompts/client/requests/PromptCallRequest.ts new file mode 100644 index 0000000..b55e2f5 --- /dev/null +++ b/src/api/resources/prompts/client/requests/PromptCallRequest.ts @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface PromptCallRequest { + /** + * A specific Version ID of the Prompt to log to. + */ + versionId?: string; + /** + * Name of the Environment identifying a deployed version to log to. + */ + environment?: string; + /** Path of the Prompt, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Prompt to update. */ + id?: string; + /** Details of your Prompt. A new Prompt version will be created if the provided details are new. */ + prompt?: Humanloop.PromptKernelRequest; + /** The messages passed to the to provider chat endpoint. */ + messages?: Humanloop.ChatMessage[]; + /** + * Controls how the model uses tools. The following options are supported: + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ + toolChoice?: Humanloop.PromptCallRequestToolChoice; + /** Unique identifier for the Session to associate the Log to. Allows you to record multiple Logs to a Session (using an ID kept by your internal systems) by passing the same `session_id` in subsequent log requests. */ + sessionId?: string; + /** Unique identifier for the parent Log in a Session. Should only be provided if `session_id` is provided. If provided, the Log will be nested under the parent Log within the Session. */ + parentId?: string; + /** The inputs passed to the prompt template. */ + inputs?: Record; + /** Identifies where the model was called from. */ + source?: string; + /** Any additional metadata to record. */ + metadata?: Record; + /** Whether the request/response payloads will be stored on Humanloop. */ + save?: boolean; + /** Unique identifier for the Datapoint that this Log is derived from. This can be used by Humanloop to associate Logs to Evaluations. If provided, Humanloop will automatically associate this Log to Evaluations that require a Log for this Datapoint-Version pair. */ + sourceDatapointId?: string; + /** Array of Batch Ids that this log is part of. Batches are used to group Logs together for offline Evaluations */ + batches?: string[]; + /** End-user ID related to the Log. */ + user?: string; + /** The name of the Environment the Log is associated to. */ + promptCallRequestEnvironment?: string; + /** API keys required by each provider to make API calls. The API keys provided here are not stored by Humanloop. If not specified here, Humanloop will fall back to the key saved to your organization. */ + providerApiKeys?: Humanloop.ProviderApiKeys; + /** The number of generations. */ + numSamples?: number; + /** If true, tokens will be sent as data-only server-sent events. If num_samples > 1, samples are streamed back independently. */ + stream?: boolean; + /** Whether to return the inputs in the response. If false, the response will contain an empty dictionary under inputs. This is useful for reducing the size of the response. Defaults to true. */ + returnInputs?: boolean; + /** Include the log probabilities of the top n tokens in the provider_response */ + logprobs?: number; + /** The suffix that comes after a completion of inserted text. Useful for completions that act like inserts. */ + suffix?: string; +} diff --git a/src/api/resources/prompts/client/requests/PromptLogRequest.ts b/src/api/resources/prompts/client/requests/PromptLogRequest.ts new file mode 100644 index 0000000..9721852 --- /dev/null +++ b/src/api/resources/prompts/client/requests/PromptLogRequest.ts @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface PromptLogRequest { + /** + * A specific Version ID of the Prompt to log to. + */ + versionId?: string; + /** + * Name of the Environment identifying a deployed version to log to. + */ + environment?: string; + /** Path of the Prompt, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Prompt to update. */ + id?: string; + /** The message returned by the provider. */ + outputMessage?: Humanloop.ChatMessage; + /** Number of tokens in the prompt used to generate the output. */ + promptTokens?: number; + /** Number of tokens in the output generated by the model. */ + outputTokens?: number; + /** Cost in dollars associated to the tokens in the prompt. */ + promptCost?: number; + /** Cost in dollars associated to the tokens in the output. */ + outputCost?: number; + /** Reason the generation finished. */ + finishReason?: string; + /** Details of your Prompt. A new Prompt version will be created if the provided details are new. */ + prompt?: Humanloop.PromptKernelRequest; + /** The messages passed to the to provider chat endpoint. */ + messages?: Humanloop.ChatMessage[]; + /** + * Controls how the model uses tools. The following options are supported: + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ + toolChoice?: Humanloop.PromptLogRequestToolChoice; + /** Generated output from your model for the provided inputs. Can be `None` if logging an error, or if creating a parent Log with the intention to populate it later. */ + output?: string; + /** Raw output from the provider. */ + rawOutput?: string; + /** User defined timestamp for when the log was created. */ + createdAt?: Date; + /** Error message if the log is an error. */ + error?: string; + /** Duration of the logged event in seconds. */ + providerLatency?: number; + /** Raw request sent to provider. */ + providerRequest?: Record; + /** Raw response received the provider. */ + providerResponse?: Record; + /** Unique identifier for the Session to associate the Log to. Allows you to record multiple Logs to a Session (using an ID kept by your internal systems) by passing the same `session_id` in subsequent log requests. */ + sessionId?: string; + /** Unique identifier for the parent Log in a Session. Should only be provided if `session_id` is provided. If provided, the Log will be nested under the parent Log within the Session. */ + parentId?: string; + /** The inputs passed to the prompt template. */ + inputs?: Record; + /** Identifies where the model was called from. */ + source?: string; + /** Any additional metadata to record. */ + metadata?: Record; + /** Whether the request/response payloads will be stored on Humanloop. */ + save?: boolean; + /** Unique identifier for the Datapoint that this Log is derived from. This can be used by Humanloop to associate Logs to Evaluations. If provided, Humanloop will automatically associate this Log to Evaluations that require a Log for this Datapoint-Version pair. */ + sourceDatapointId?: string; + /** Array of Batch Ids that this log is part of. Batches are used to group Logs together for offline Evaluations */ + batches?: string[]; + /** End-user ID related to the Log. */ + user?: string; + /** The name of the Environment the Log is associated to. */ + promptLogRequestEnvironment?: string; +} diff --git a/src/api/resources/prompts/client/requests/PromptRequest.ts b/src/api/resources/prompts/client/requests/PromptRequest.ts new file mode 100644 index 0000000..6f232d0 --- /dev/null +++ b/src/api/resources/prompts/client/requests/PromptRequest.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * { + * model: "model" + * } + */ +export interface PromptRequest { + /** Path of the Prompt, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Prompt to update. */ + id?: string; + /** The model instance used, e.g. `gpt-4`. See [supported models](https://humanloop.com/docs/supported-models) */ + model: string; + /** The provider model endpoint used. */ + endpoint?: Humanloop.ModelEndpoints; + /** For chat endpoint, provide a Chat template. For completion endpoint, provide a Prompt template. Input variables within the template should be specified with double curly bracket syntax: {{INPUT_NAME}}. */ + template?: Humanloop.PromptRequestTemplate; + /** The company providing the underlying model service. */ + provider?: Humanloop.ModelProviders; + /** The maximum number of tokens to generate. Provide max_tokens=-1 to dynamically calculate the maximum number of tokens to generate given the length of the prompt */ + maxTokens?: number; + /** What sampling temperature to use when making a generation. Higher values means the model will be more creative. */ + temperature?: number; + /** An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. */ + topP?: number; + /** The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. */ + stop?: Humanloop.PromptRequestStop; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the generation so far. */ + presencePenalty?: number; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on how frequently they appear in the generation so far. */ + frequencyPenalty?: number; + /** Other parameter values to be passed to the provider call. */ + other?: Record; + /** If specified, model will make a best effort to sample deterministically, but it is not guaranteed. */ + seed?: number; + /** The format of the response. Only `{"type": "json_object"}` is currently supported for chat. */ + responseFormat?: Humanloop.ResponseFormat; + /** The tool specification that the model can choose to call if Tool calling is supported. */ + tools?: Humanloop.ToolFunction[]; + /** The IDs of the Tools in your organization that the model can choose to call if Tool calling is supported. The default deployed version of that tool is called. */ + linkedTools?: string[]; + /** Message describing the changes made. */ + commitMessage?: string; +} diff --git a/src/api/resources/prompts/client/requests/PromptsGetRequest.ts b/src/api/resources/prompts/client/requests/PromptsGetRequest.ts new file mode 100644 index 0000000..3c4a51a --- /dev/null +++ b/src/api/resources/prompts/client/requests/PromptsGetRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface PromptsGetRequest { + /** + * A specific Version ID of the Prompt to retrieve. + */ + versionId?: string; + /** + * Name of the Environment to retrieve a deployed Version from. + */ + environment?: string; +} diff --git a/src/api/resources/prompts/client/requests/PromptsListPromptsRequest.ts b/src/api/resources/prompts/client/requests/PromptsListPromptsRequest.ts new file mode 100644 index 0000000..661745e --- /dev/null +++ b/src/api/resources/prompts/client/requests/PromptsListPromptsRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface PromptsListPromptsRequest { + /** + * Page number for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Prompts to fetch. + */ + size?: number; + /** + * Case-insensitive filter for Prompt name. + */ + name?: string; + /** + * Case-insensitive filter for users in the Prompt. This filter matches against both email address and name of users. + */ + userFilter?: string; + /** + * Field to sort Prompts by + */ + sortBy?: Humanloop.ProjectSortBy; + /** + * Direction to sort by. + */ + order?: Humanloop.SortOrder; +} diff --git a/src/api/resources/prompts/client/requests/PromptsListVersionsRequest.ts b/src/api/resources/prompts/client/requests/PromptsListVersionsRequest.ts new file mode 100644 index 0000000..2226c8c --- /dev/null +++ b/src/api/resources/prompts/client/requests/PromptsListVersionsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface PromptsListVersionsRequest { + /** + * Filter versions by status: 'uncommitted', 'committed'. If no status is provided, all versions are returned. + */ + status?: Humanloop.VersionStatus; + /** + * Name of the environment to filter versions by. If no environment is provided, all versions are returned. + */ + environment?: string; + evaluatorAggregates?: boolean; +} diff --git a/src/api/resources/prompts/client/requests/UpdatePromptRequest.ts b/src/api/resources/prompts/client/requests/UpdatePromptRequest.ts new file mode 100644 index 0000000..d90bfaf --- /dev/null +++ b/src/api/resources/prompts/client/requests/UpdatePromptRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface UpdatePromptRequest { + /** Path of the Prompt including the Prompt name, which is used as a unique identifier. */ + path?: string; + /** Name of the Prompt. */ + name?: string; +} diff --git a/src/api/resources/prompts/client/requests/index.ts b/src/api/resources/prompts/client/requests/index.ts new file mode 100644 index 0000000..2aa46b4 --- /dev/null +++ b/src/api/resources/prompts/client/requests/index.ts @@ -0,0 +1,8 @@ +export { type PromptsListPromptsRequest } from "./PromptsListPromptsRequest"; +export { type PromptRequest } from "./PromptRequest"; +export { type PromptsGetRequest } from "./PromptsGetRequest"; +export { type UpdatePromptRequest } from "./UpdatePromptRequest"; +export { type PromptsListVersionsRequest } from "./PromptsListVersionsRequest"; +export { type PromptLogRequest } from "./PromptLogRequest"; +export { type PromptCallRequest } from "./PromptCallRequest"; +export { type DeployPromptsIdEnvironmentsEnvironmentIdPostRequest } from "./DeployPromptsIdEnvironmentsEnvironmentIdPostRequest"; diff --git a/src/api/resources/prompts/index.ts b/src/api/resources/prompts/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/prompts/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/prompts/types/PromptCallRequestToolChoice.ts b/src/api/resources/prompts/types/PromptCallRequestToolChoice.ts new file mode 100644 index 0000000..f39232c --- /dev/null +++ b/src/api/resources/prompts/types/PromptCallRequestToolChoice.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../index"; + +/** + * Controls how the model uses tools. The following options are supported: + * + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ +export type PromptCallRequestToolChoice = "none" | "auto" | "required" | Humanloop.ToolChoice; diff --git a/src/api/resources/prompts/types/PromptLogRequestToolChoice.ts b/src/api/resources/prompts/types/PromptLogRequestToolChoice.ts new file mode 100644 index 0000000..9cab8f2 --- /dev/null +++ b/src/api/resources/prompts/types/PromptLogRequestToolChoice.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../index"; + +/** + * Controls how the model uses tools. The following options are supported: + * + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ +export type PromptLogRequestToolChoice = "none" | "auto" | "required" | Humanloop.ToolChoice; diff --git a/src/api/resources/prompts/types/PromptRequestStop.ts b/src/api/resources/prompts/types/PromptRequestStop.ts new file mode 100644 index 0000000..d53e11a --- /dev/null +++ b/src/api/resources/prompts/types/PromptRequestStop.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. + */ +export type PromptRequestStop = string | string[]; diff --git a/src/api/resources/prompts/types/PromptRequestTemplate.ts b/src/api/resources/prompts/types/PromptRequestTemplate.ts new file mode 100644 index 0000000..e7c6477 --- /dev/null +++ b/src/api/resources/prompts/types/PromptRequestTemplate.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../index"; + +/** + * For chat endpoint, provide a Chat template. For completion endpoint, provide a Prompt template. Input variables within the template should be specified with double curly bracket syntax: {{INPUT_NAME}}. + */ +export type PromptRequestTemplate = string | Humanloop.ChatMessage[]; diff --git a/src/api/resources/prompts/types/PromptsCallResponse.ts b/src/api/resources/prompts/types/PromptsCallResponse.ts new file mode 100644 index 0000000..7578e51 --- /dev/null +++ b/src/api/resources/prompts/types/PromptsCallResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../index"; + +export type PromptsCallResponse = Humanloop.PromptCallResponse | Humanloop.PromptCallStreamResponse; diff --git a/src/api/resources/prompts/types/index.ts b/src/api/resources/prompts/types/index.ts new file mode 100644 index 0000000..4b89c9b --- /dev/null +++ b/src/api/resources/prompts/types/index.ts @@ -0,0 +1,5 @@ +export * from "./PromptRequestTemplate"; +export * from "./PromptRequestStop"; +export * from "./PromptLogRequestToolChoice"; +export * from "./PromptCallRequestToolChoice"; +export * from "./PromptsCallResponse"; diff --git a/src/api/resources/sessions/client/Client.ts b/src/api/resources/sessions/client/Client.ts new file mode 100644 index 0000000..47a74a1 --- /dev/null +++ b/src/api/resources/sessions/client/Client.ts @@ -0,0 +1,291 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Sessions { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +/** + * Sessions are groups of Logs that track sequences of LLM actions. + * + * Sessions enable you to trace through related Logs across different Files. For + * example, a Session can contain a Prompt Log recording an LLM generation, a Tool + * Log recording a retrieval step, and Evaluator Logs measuring the quality of the + * generated text. + * + * Logs within a Session may be nested within each other. When Evaluators are run + * for monitoring, the Evaluator Logs are added to the Session that the evaluated + * Log is in, nested within the evaluated Log. + * + * + */ +export class Sessions { + constructor(protected readonly _options: Sessions.Options) {} + + /** + * Retrieve the Session with the given ID. + * + * @param {string} id - Unique identifier for Session. + * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.sessions.get("id") + */ + public async get(id: string, requestOptions?: Sessions.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `sessions/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.SessionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the Session with the given ID. + * + * @param {string} id - Unique identifier for Session. + * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.sessions.delete("id") + */ + public async delete(id: string, requestOptions?: Sessions.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `sessions/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of Sessions. + * + * @param {Humanloop.SessionsListRequest} request + * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.sessions.list() + */ + public async list( + request: Humanloop.SessionsListRequest = {}, + requestOptions?: Sessions.RequestOptions + ): Promise { + const { fileId, versionId, page, size } = request; + const _queryParams: Record = {}; + if (fileId != null) { + _queryParams["file_id"] = fileId; + } + + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "sessions" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.PaginatedSessionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/sessions/client/index.ts b/src/api/resources/sessions/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/sessions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/sessions/client/requests/SessionsListRequest.ts b/src/api/resources/sessions/client/requests/SessionsListRequest.ts new file mode 100644 index 0000000..1c6f7b0 --- /dev/null +++ b/src/api/resources/sessions/client/requests/SessionsListRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface SessionsListRequest { + /** + * Unique identifier for File to return Sessions for. Sessions that contain any Logs associated to this File will be returned. + */ + fileId?: string; + /** + * Unique identifier for Version to return Sessions for. Sessions that contain any Logs associated to this Version will be returned. + */ + versionId?: string; + /** + * Page number for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Sessions to fetch. + */ + size?: number; +} diff --git a/src/api/resources/sessions/client/requests/index.ts b/src/api/resources/sessions/client/requests/index.ts new file mode 100644 index 0000000..9c8e7d5 --- /dev/null +++ b/src/api/resources/sessions/client/requests/index.ts @@ -0,0 +1 @@ +export { type SessionsListRequest } from "./SessionsListRequest"; diff --git a/src/api/resources/sessions/index.ts b/src/api/resources/sessions/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/sessions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/tools/client/Client.ts b/src/api/resources/tools/client/Client.ts new file mode 100644 index 0000000..0b397f8 --- /dev/null +++ b/src/api/resources/tools/client/Client.ts @@ -0,0 +1,1089 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Humanloop from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Tools { + interface Options { + environment?: core.Supplier; + apiKey: core.Supplier; + fetcher?: core.FetchFunction; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + abortSignal?: AbortSignal; + } +} + +export class Tools { + constructor(protected readonly _options: Tools.Options) {} + + /** + * Get a list of Tools. + * + * @param {Humanloop.ToolsListRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.list() + */ + public async list( + request: Humanloop.ToolsListRequest = {}, + requestOptions?: Tools.RequestOptions + ): Promise { + const { page, size, name, userFilter, sortBy, order } = request; + const _queryParams: Record = {}; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (size != null) { + _queryParams["size"] = size.toString(); + } + + if (name != null) { + _queryParams["name"] = name; + } + + if (userFilter != null) { + _queryParams["user_filter"] = userFilter; + } + + if (sortBy != null) { + _queryParams["sort_by"] = sortBy; + } + + if (order != null) { + _queryParams["order"] = order; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "tools" + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListTools.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Create a Tool or update it with a new version if it already exists. + * + * Tools are identified by the `ID` or their `path`. The name, description and parameters determine the versions of the Tool. + * + * If you provide a commit message, then the new version will be committed; + * otherwise it will be uncommitted. If you try to commit an already committed version, + * an exception will be raised. + * + * @param {Humanloop.ToolRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.upsert() + */ + public async upsert( + request: Humanloop.ToolRequest = {}, + requestOptions?: Tools.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "tools" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.ToolRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ToolResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieve the Tool with the given ID. + * + * By default, the deployed version of the Tool is returned. Use the query parameters + * `version_id` or `environment` to target a specific version of the Tool. + * + * @param {string} id - Unique identifier for Tool. + * @param {Humanloop.ToolsGetRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.get("id") + */ + public async get( + id: string, + request: Humanloop.ToolsGetRequest = {}, + requestOptions?: Tools.RequestOptions + ): Promise { + const { versionId, environment } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ToolResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Delete the Tool with the given ID. + * + * @param {string} id - Unique identifier for Tool. + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.delete("id") + */ + public async delete(id: string, requestOptions?: Tools.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Move the Tool to a different path or change the name. + * + * @param {string} id - Unique identifier for Tool. + * @param {Humanloop.UpdateToolRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.move("id") + */ + public async move( + id: string, + request: Humanloop.UpdateToolRequest = {}, + requestOptions?: Tools.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}` + ), + method: "PATCH", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.UpdateToolRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ToolResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Get a list of all the versions of a Tool. + * + * @param {string} id - Unique identifier for the Tool. + * @param {Humanloop.ToolsListVersionsRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.listversions("id") + */ + public async listversions( + id: string, + request: Humanloop.ToolsListVersionsRequest = {}, + requestOptions?: Tools.RequestOptions + ): Promise { + const { status, environment, evaluatorAggregates } = request; + const _queryParams: Record = {}; + if (status != null) { + _queryParams["status"] = status; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + if (evaluatorAggregates != null) { + _queryParams["evaluator_aggregates"] = evaluatorAggregates.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}/versions` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ListTools.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Commit the Tool Version with the given ID. + * + * @param {string} id - Unique identifier for Tool. + * @param {string} versionId - Unique identifier for the specific version of the Tool. + * @param {Humanloop.CommitRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.commit("id", "version_id", { + * commitMessage: "commit_message" + * }) + */ + public async commit( + id: string, + versionId: string, + request: Humanloop.CommitRequest, + requestOptions?: Tools.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/commit` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.CommitRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ToolResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Log to a Tool. + * + * You can use query parameters version_id, or environment, to target + * an existing version of the Tool. Otherwise the default deployed version will be chosen. + * + * Instead of targeting an existing version explicitly, you can instead pass in + * Tool details in the request body. In this case, we will check if the details correspond + * to an existing version of the Tool, if not we will create a new version. This is helpful + * in the case where you are storing or deriving your Tool details in code. + * + * @param {Humanloop.ToolLogRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.log() + */ + public async log( + request: Humanloop.ToolLogRequest = {}, + requestOptions?: Tools.RequestOptions + ): Promise { + const { versionId, environment, ..._body } = request; + const _queryParams: Record = {}; + if (versionId != null) { + _queryParams["version_id"] = versionId; + } + + if (environment != null) { + _queryParams["environment"] = environment; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + "tools/log" + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + body: await serializers.ToolLogRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.CreateToolLogResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Activate and deactivate Evaluators for the Tool. + * + * An activated Evaluator will automatically be run on all new Logs + * within the Tool for monitoring purposes. + * + * @param {string} id + * @param {Humanloop.EvaluatorActivationDeactivationRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.updateEvaluators("id", {}) + */ + public async updateEvaluators( + id: string, + request: Humanloop.EvaluatorActivationDeactivationRequest, + requestOptions?: Tools.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}/evaluators` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + body: await serializers.EvaluatorActivationDeactivationRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ToolResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deploy Tool to Environment. + * + * Set the deployed Version for the specified Environment. This Tool Version + * will be used for calls made to the Tool in this Environment. + * + * @param {string} id - Unique identifier for Tool. + * @param {string} environmentId - Unique identifier for the Environment to deploy the Version to. + * @param {Humanloop.DeployToolsIdEnvironmentsEnvironmentIdPostRequest} request + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.deploy("id", "environment_id", { + * versionId: "version_id" + * }) + */ + public async deploy( + id: string, + environmentId: string, + request: Humanloop.DeployToolsIdEnvironmentsEnvironmentIdPostRequest, + requestOptions?: Tools.RequestOptions + ): Promise { + const { versionId } = request; + const _queryParams: Record = {}; + _queryParams["version_id"] = versionId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "POST", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.ToolResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Remove deployment of Tool from Environment. + * + * Remove the deployed Version for the specified Environment. This Tool Version + * will no longer be used for calls made to the Tool in this Environment. + * + * @param {string} id - Unique identifier for Tool. + * @param {string} environmentId - Unique identifier for the Environment to remove the deployment from. + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.removeDeployment("id", "environment_id") + */ + public async removeDeployment( + id: string, + environmentId: string, + requestOptions?: Tools.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}/environments/${encodeURIComponent(environmentId)}` + ), + method: "DELETE", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * List all Environments and their deployed versions for the Tool. + * + * @param {string} id - Unique identifier for Tool. + * @param {Tools.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Humanloop.UnprocessableEntityError} + * + * @example + * await client.tools.listEnvironments("id") + */ + public async listEnvironments( + id: string, + requestOptions?: Tools.RequestOptions + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.HumanloopEnvironment.Default, + `tools/${encodeURIComponent(id)}/environments` + ), + method: "GET", + headers: { + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "humanloop", + "X-Fern-SDK-Version": "0.0.1", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return await serializers.tools.listEnvironments.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 422: + throw new Humanloop.UnprocessableEntityError( + await serializers.HttpValidationError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }) + ); + default: + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.HumanloopError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.HumanloopTimeoutError(); + case "unknown": + throw new errors.HumanloopError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getCustomAuthorizationHeaders() { + const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["HUMANLOOP_API_KEY"]; + return { "X-API-KEY": apiKeyValue }; + } +} diff --git a/src/api/resources/tools/client/index.ts b/src/api/resources/tools/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/tools/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/tools/client/requests/DeployToolsIdEnvironmentsEnvironmentIdPostRequest.ts b/src/api/resources/tools/client/requests/DeployToolsIdEnvironmentsEnvironmentIdPostRequest.ts new file mode 100644 index 0000000..9e6f83d --- /dev/null +++ b/src/api/resources/tools/client/requests/DeployToolsIdEnvironmentsEnvironmentIdPostRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * versionId: "version_id" + * } + */ +export interface DeployToolsIdEnvironmentsEnvironmentIdPostRequest { + /** + * Unique identifier for the specific version of the Tool. + */ + versionId: string; +} diff --git a/src/api/resources/tools/client/requests/ToolLogRequest.ts b/src/api/resources/tools/client/requests/ToolLogRequest.ts new file mode 100644 index 0000000..f97f1eb --- /dev/null +++ b/src/api/resources/tools/client/requests/ToolLogRequest.ts @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface ToolLogRequest { + /** + * A specific Version ID of the Tool to log to. + */ + versionId?: string; + /** + * Name of the Environment identifying a deployed version to log to. + */ + environment?: string; + /** Path of the Tool, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Tool to update. */ + id?: string; + /** Generated output from your model for the provided inputs. Can be `None` if logging an error, or if creating a parent Log with the intention to populate it later. */ + output?: string; + /** Raw output from the provider. */ + rawOutput?: string; + /** User defined timestamp for when the log was created. */ + createdAt?: Date; + /** Error message if the log is an error. */ + error?: string; + /** Duration of the logged event in seconds. */ + providerLatency?: number; + /** Raw request sent to provider. */ + providerRequest?: Record; + /** Raw response received the provider. */ + providerResponse?: Record; + /** Unique identifier for the Session to associate the Log to. Allows you to record multiple Logs to a Session (using an ID kept by your internal systems) by passing the same `session_id` in subsequent log requests. */ + sessionId?: string; + /** Unique identifier for the parent Log in a Session. Should only be provided if `session_id` is provided. If provided, the Log will be nested under the parent Log within the Session. */ + parentId?: string; + /** The inputs passed to the prompt template. */ + inputs?: Record; + /** Identifies where the model was called from. */ + source?: string; + /** Any additional metadata to record. */ + metadata?: Record; + /** Whether the request/response payloads will be stored on Humanloop. */ + save?: boolean; + /** Unique identifier for the Datapoint that this Log is derived from. This can be used by Humanloop to associate Logs to Evaluations. If provided, Humanloop will automatically associate this Log to Evaluations that require a Log for this Datapoint-Version pair. */ + sourceDatapointId?: string; + /** Array of Batch Ids that this log is part of. Batches are used to group Logs together for offline Evaluations */ + batches?: string[]; + /** End-user ID related to the Log. */ + user?: string; + /** The name of the Environment the Log is associated to. */ + toolLogRequestEnvironment?: string; + /** Details of your Tool. A new Tool version will be created if the provided details are new. */ + tool?: Humanloop.ToolKernelRequest; +} diff --git a/src/api/resources/tools/client/requests/ToolRequest.ts b/src/api/resources/tools/client/requests/ToolRequest.ts new file mode 100644 index 0000000..62174fc --- /dev/null +++ b/src/api/resources/tools/client/requests/ToolRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface ToolRequest { + /** Path of the Tool, including the name, which is used as a unique identifier. */ + path?: string; + /** ID for an existing Tool to update. */ + id?: string; + /** Callable function specification of the Tool shown to the model for tool calling. */ + function?: Humanloop.ToolFunction; + /** Code source of the Tool. */ + sourceCode?: string; + /** Values needed to setup the Tool, defined in JSON Schema format: https://json-schema.org/ */ + setupValues?: Record; + /** Type of Tool. */ + toolType?: Humanloop.FilesToolType; + /** Message describing the changes made. */ + commitMessage?: string; +} diff --git a/src/api/resources/tools/client/requests/ToolsGetRequest.ts b/src/api/resources/tools/client/requests/ToolsGetRequest.ts new file mode 100644 index 0000000..a7fca6d --- /dev/null +++ b/src/api/resources/tools/client/requests/ToolsGetRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ToolsGetRequest { + /** + * A specific Version ID of the Tool to retrieve. + */ + versionId?: string; + /** + * Name of the Environment to retrieve a deployed Version from. + */ + environment?: string; +} diff --git a/src/api/resources/tools/client/requests/ToolsListRequest.ts b/src/api/resources/tools/client/requests/ToolsListRequest.ts new file mode 100644 index 0000000..184c293 --- /dev/null +++ b/src/api/resources/tools/client/requests/ToolsListRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface ToolsListRequest { + /** + * Page offset for pagination. + */ + page?: number; + /** + * Page size for pagination. Number of Tools to fetch. + */ + size?: number; + /** + * Case-insensitive filter for Tool name. + */ + name?: string; + /** + * Case-insensitive filter for users in the Tool. This filter matches against both email address and name of users. + */ + userFilter?: string; + /** + * Field to sort Tools by + */ + sortBy?: Humanloop.ProjectSortBy; + /** + * Direction to sort by. + */ + order?: Humanloop.SortOrder; +} diff --git a/src/api/resources/tools/client/requests/ToolsListVersionsRequest.ts b/src/api/resources/tools/client/requests/ToolsListVersionsRequest.ts new file mode 100644 index 0000000..d1a3934 --- /dev/null +++ b/src/api/resources/tools/client/requests/ToolsListVersionsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../../../../index"; + +/** + * @example + * {} + */ +export interface ToolsListVersionsRequest { + /** + * Filter versions by status: 'uncommitted', 'committed'. If no status is provided, all versions are returned. + */ + status?: Humanloop.VersionStatus; + /** + * Name of the environment to filter versions by. If no environment is provided, all versions are returned. + */ + environment?: string; + evaluatorAggregates?: boolean; +} diff --git a/src/api/resources/tools/client/requests/UpdateToolRequest.ts b/src/api/resources/tools/client/requests/UpdateToolRequest.ts new file mode 100644 index 0000000..6f39d84 --- /dev/null +++ b/src/api/resources/tools/client/requests/UpdateToolRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface UpdateToolRequest { + /** Path of the Tool including the Tool name, which is used as a unique identifier. */ + path?: string; + /** Name of the Tool, which is used as a unique identifier. */ + name?: string; +} diff --git a/src/api/resources/tools/client/requests/index.ts b/src/api/resources/tools/client/requests/index.ts new file mode 100644 index 0000000..29a8431 --- /dev/null +++ b/src/api/resources/tools/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type ToolsListRequest } from "./ToolsListRequest"; +export { type ToolRequest } from "./ToolRequest"; +export { type ToolsGetRequest } from "./ToolsGetRequest"; +export { type UpdateToolRequest } from "./UpdateToolRequest"; +export { type ToolsListVersionsRequest } from "./ToolsListVersionsRequest"; +export { type ToolLogRequest } from "./ToolLogRequest"; +export { type DeployToolsIdEnvironmentsEnvironmentIdPostRequest } from "./DeployToolsIdEnvironmentsEnvironmentIdPostRequest"; diff --git a/src/api/resources/tools/index.ts b/src/api/resources/tools/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/api/resources/tools/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/types/AgentConfigResponse.ts b/src/api/types/AgentConfigResponse.ts new file mode 100644 index 0000000..8d8cc74 --- /dev/null +++ b/src/api/types/AgentConfigResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface AgentConfigResponse { + /** String ID of config. Starts with `config_`. */ + id: string; + /** Other parameters that define the config. */ + other?: Record; + type: "agent"; + /** The user who created the config. */ + createdBy?: Humanloop.BaseModelsUserResponse; + /** Whether the config is committed or not. */ + status: string; + /** Name of config. */ + name: string; + /** Description of config. */ + description?: string; + /** Class of the agent. */ + agentClass: string; + /** Tools associated with the agent. */ + tools?: Humanloop.ToolConfigRequest[]; + /** Model config associated with the agent. */ + modelConfig: Humanloop.ModelConfigRequest; +} diff --git a/src/api/types/BaseMetricResponse.ts b/src/api/types/BaseMetricResponse.ts new file mode 100644 index 0000000..7aaa79b --- /dev/null +++ b/src/api/types/BaseMetricResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface BaseMetricResponse { + /** ID of the metric. Starts with 'metric\_'. */ + id: string; + /** The name of the metric. */ + name: string; + /** A description of what the metric measures. */ + description: string; + /** Python code used to calculate a metric value on each logged datapoint. */ + code: string; + /** Whether the metric is a global default metric. Metrics with this flag enabled cannot be deleted or modified. */ + default: boolean; + /** If enabled, the metric is calculated for every logged datapoint. */ + active: boolean; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/BaseModelsUserResponse.ts b/src/api/types/BaseModelsUserResponse.ts new file mode 100644 index 0000000..6eac3b3 --- /dev/null +++ b/src/api/types/BaseModelsUserResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface BaseModelsUserResponse { + /** String ID of user. Starts with `usr_`. */ + id: string; + /** The user's email address. */ + emailAddress: string; + /** The user's full name. */ + fullName?: string; + /** Whether the user has verified their email address. */ + verified: boolean; +} diff --git a/src/api/types/BooleanEvaluatorVersionStats.ts b/src/api/types/BooleanEvaluatorVersionStats.ts new file mode 100644 index 0000000..81684e8 --- /dev/null +++ b/src/api/types/BooleanEvaluatorVersionStats.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Base attributes for stats for an Evaluator Version-Evaluated Version pair + * in the Evaluation Report. + */ +export interface BooleanEvaluatorVersionStats { + /** Unique identifier for the Evaluator Version. */ + evaluatorVersionId: string; + /** The total number of Logs generated by this Evaluator Version on the Evaluated Version's Logs. This includes Nulls and Errors. */ + totalLogs: number; + /** The total number of Evaluator judgments for this Evaluator Version. This excludes Nulls and Errors. */ + numJudgments: number; + /** The total number of null judgments (i.e. abstentions) for this Evaluator Version. */ + numNulls: number; + /** The total number of errored Evaluators for this Evaluator Version. */ + numErrors: number; + /** The total number of `True` judgments for this Evaluator Version. */ + numTrue: number; + /** The total number of `False` judgments for this Evaluator Version. */ + numFalse: number; +} diff --git a/src/api/types/CategoricalFeedbackLabel.ts b/src/api/types/CategoricalFeedbackLabel.ts new file mode 100644 index 0000000..46251b2 --- /dev/null +++ b/src/api/types/CategoricalFeedbackLabel.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface CategoricalFeedbackLabel { + value: string; + /** Whether the feedback sentiment is positive or negative. */ + sentiment: Humanloop.LabelSentiment; + /** Whether the feedback label is active or inactive. */ + status: Humanloop.FeedbackLabelStatus; +} diff --git a/src/api/types/ChatMessage.ts b/src/api/types/ChatMessage.ts new file mode 100644 index 0000000..a410aa3 --- /dev/null +++ b/src/api/types/ChatMessage.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ChatMessage { + /** The content of the message. */ + content?: Humanloop.ChatMessageContent; + /** Optional name of the message author. */ + name?: string; + /** Tool call that this message is responding to. */ + toolCallId?: string; + /** Role of the message author. */ + role: Humanloop.ChatRole; + /** A list of tool calls requested by the assistant. */ + toolCalls?: Humanloop.ToolCall[]; +} diff --git a/src/api/types/ChatMessageContent.ts b/src/api/types/ChatMessageContent.ts new file mode 100644 index 0000000..50640fa --- /dev/null +++ b/src/api/types/ChatMessageContent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The content of the message. + */ +export type ChatMessageContent = string | Humanloop.ChatMessageContentItem[]; diff --git a/src/api/types/ChatMessageContentItem.ts b/src/api/types/ChatMessageContentItem.ts new file mode 100644 index 0000000..343a957 --- /dev/null +++ b/src/api/types/ChatMessageContentItem.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type ChatMessageContentItem = Humanloop.TextChatContent | Humanloop.ImageChatContent; diff --git a/src/api/types/ChatMessageWithToolCall.ts b/src/api/types/ChatMessageWithToolCall.ts new file mode 100644 index 0000000..50d0b03 --- /dev/null +++ b/src/api/types/ChatMessageWithToolCall.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ChatMessageWithToolCall { + /** The content of the message. */ + content?: Humanloop.ChatMessageWithToolCallContent; + /** Optional name of the message author. */ + name?: string; + /** Tool call that this message is responding to. */ + toolCallId?: string; + /** Role of the message author. */ + role: Humanloop.ChatRole; + /** A list of tool calls requested by the assistant. */ + toolCalls?: Humanloop.ToolCall[]; + /** NB: Deprecated in favour of tool_calls. A tool call requested by the assistant. */ + toolCall?: Humanloop.FunctionTool; +} diff --git a/src/api/types/ChatMessageWithToolCallContent.ts b/src/api/types/ChatMessageWithToolCallContent.ts new file mode 100644 index 0000000..25872ca --- /dev/null +++ b/src/api/types/ChatMessageWithToolCallContent.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The content of the message. + */ +export type ChatMessageWithToolCallContent = string | Humanloop.ChatMessageWithToolCallContentItem[]; diff --git a/src/api/types/ChatMessageWithToolCallContentItem.ts b/src/api/types/ChatMessageWithToolCallContentItem.ts new file mode 100644 index 0000000..e3d4755 --- /dev/null +++ b/src/api/types/ChatMessageWithToolCallContentItem.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type ChatMessageWithToolCallContentItem = Humanloop.TextChatContent | Humanloop.ImageChatContent; diff --git a/src/api/types/ChatRole.ts b/src/api/types/ChatRole.ts new file mode 100644 index 0000000..e7d8d36 --- /dev/null +++ b/src/api/types/ChatRole.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type ChatRole = "user" | "assistant" | "system" | "tool"; + +export const ChatRole = { + User: "user", + Assistant: "assistant", + System: "system", + Tool: "tool", +} as const; diff --git a/src/api/types/ChatToolType.ts b/src/api/types/ChatToolType.ts new file mode 100644 index 0000000..b2e6fef --- /dev/null +++ b/src/api/types/ChatToolType.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of tool to call. + */ +export type ChatToolType = "function"; diff --git a/src/api/types/CodeEvaluatorRequest.ts b/src/api/types/CodeEvaluatorRequest.ts new file mode 100644 index 0000000..fc287b9 --- /dev/null +++ b/src/api/types/CodeEvaluatorRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface CodeEvaluatorRequest { + /** Whether this evaluator is target-free or target-required. */ + argumentsType: Humanloop.EvaluatorArgumentsType; + /** The type of the return value of the evaluator. */ + returnType: Humanloop.EvaluatorReturnTypeEnum; + evaluatorType: "python"; + /** The code for the evaluator. This code will be executed in a sandboxed environment. */ + code?: string; +} diff --git a/src/api/types/CommitRequest.ts b/src/api/types/CommitRequest.ts new file mode 100644 index 0000000..93296b5 --- /dev/null +++ b/src/api/types/CommitRequest.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CommitRequest { + /** Message describing the changes made. */ + commitMessage: string; +} diff --git a/src/api/types/ConfigResponse.ts b/src/api/types/ConfigResponse.ts new file mode 100644 index 0000000..2db2f55 --- /dev/null +++ b/src/api/types/ConfigResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type ConfigResponse = + | Humanloop.ModelConfigResponse + | Humanloop.ToolConfigResponse + | Humanloop.EvaluatorConfigResponse + | Humanloop.AgentConfigResponse + | Humanloop.GenericConfigResponse; diff --git a/src/api/types/ConfigToolResponse.ts b/src/api/types/ConfigToolResponse.ts new file mode 100644 index 0000000..a972810 --- /dev/null +++ b/src/api/types/ConfigToolResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ConfigToolResponse { + /** The ID of the tool. Starts with either `config_` or `oc_`. */ + id: string; + /** Name for the tool referenced by the model. */ + name: string; + /** Description of the tool referenced by the model */ + description?: string; + /** Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ */ + parameters?: Record; + /** The origin of the tool */ + source?: string; +} diff --git a/src/api/types/CreateDatapointRequest.ts b/src/api/types/CreateDatapointRequest.ts new file mode 100644 index 0000000..04b844e --- /dev/null +++ b/src/api/types/CreateDatapointRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface CreateDatapointRequest { + /** The inputs to the prompt template. */ + inputs?: Record; + /** List of chat messages to provide to the model. */ + messages?: Humanloop.ChatMessage[]; + /** Object with criteria necessary to evaluate generations with this Datapoint. This is passed in as an argument to Evaluators when used in an Evaluation. */ + target?: Record; +} diff --git a/src/api/types/CreateDatapointRequestTargetValue.ts b/src/api/types/CreateDatapointRequestTargetValue.ts new file mode 100644 index 0000000..cb623d2 --- /dev/null +++ b/src/api/types/CreateDatapointRequestTargetValue.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type CreateDatapointRequestTargetValue = + | string + | number + | number + | boolean + | Record + | unknown[]; diff --git a/src/api/types/CreateEvaluationRequest.ts b/src/api/types/CreateEvaluationRequest.ts new file mode 100644 index 0000000..af2f3c7 --- /dev/null +++ b/src/api/types/CreateEvaluationRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Request model for creating an Evaluation. + * + * Evaluation benchmark your Prompt/Tool Versions. With the Datapoints in a Dataset Version, + * Logs corresponding to the Datapoint and each Evaluated Version are evaluated by the specified Evaluator Versions. + * Aggregated statistics are then calculated and presented in the Evaluation. + */ +export interface CreateEvaluationRequest { + /** The Dataset Version to use in this Evaluation. */ + dataset: Humanloop.EvaluationsDatasetRequest; + /** Unique identifiers for the Prompt/Tool Versions to include in the Evaluation Report. */ + evaluatees: Humanloop.EvaluateeRequest[]; + /** The Evaluators used to evaluate. */ + evaluators: Humanloop.EvaluationsRequest[]; +} diff --git a/src/api/types/CreatePromptLogResponse.ts b/src/api/types/CreatePromptLogResponse.ts new file mode 100644 index 0000000..f5a3720 --- /dev/null +++ b/src/api/types/CreatePromptLogResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreatePromptLogResponse { + /** String ID of log. */ + id: string; + /** ID of the Prompt the log belongs to. */ + promptId: string; + /** ID of the specific version of the Prompt. */ + versionId: string; + /** String ID of session the log belongs to. */ + sessionId?: string; +} diff --git a/src/api/types/CreateToolLogResponse.ts b/src/api/types/CreateToolLogResponse.ts new file mode 100644 index 0000000..37c20ef --- /dev/null +++ b/src/api/types/CreateToolLogResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CreateToolLogResponse { + /** String ID of log. */ + id: string; + /** ID of the Tool the log belongs to. */ + toolId: string; + /** ID of the specific version of the Tool. */ + versionId: string; + /** String ID of session the log belongs to. */ + sessionId?: string; +} diff --git a/src/api/types/DashboardConfiguration.ts b/src/api/types/DashboardConfiguration.ts new file mode 100644 index 0000000..a0ffa43 --- /dev/null +++ b/src/api/types/DashboardConfiguration.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface DashboardConfiguration { + timeUnit: Humanloop.TimeUnit; + timeRangeDays: number; + modelConfigIds: string[]; +} diff --git a/src/api/types/DatapointResponse.ts b/src/api/types/DatapointResponse.ts new file mode 100644 index 0000000..237c087 --- /dev/null +++ b/src/api/types/DatapointResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface DatapointResponse { + /** The inputs to the prompt template. */ + inputs?: Record; + /** List of chat messages to provide to the model. */ + messages?: Humanloop.ChatMessage[]; + /** Object with criteria necessary to evaluate generations with this Datapoint. This is passed in as an argument to Evaluators when used in an Evaluation. */ + target?: Record; + /** Unique identifier for the Datapoint. Starts with `dp_`. */ + id: string; +} diff --git a/src/api/types/DatapointResponseTargetValue.ts b/src/api/types/DatapointResponseTargetValue.ts new file mode 100644 index 0000000..3d4a39c --- /dev/null +++ b/src/api/types/DatapointResponseTargetValue.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type DatapointResponseTargetValue = string | number | number | boolean | Record | unknown[]; diff --git a/src/api/types/DatasetResponse.ts b/src/api/types/DatasetResponse.ts new file mode 100644 index 0000000..9d59a39 --- /dev/null +++ b/src/api/types/DatasetResponse.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Base type that all File Responses should inherit from. + * + * Attributes defined here are common to all File Responses and should be overridden + * in the inheriting classes with documentation and appropriate Field definitions. + */ +export interface DatasetResponse { + /** Path of the Dataset, including the name, which is used as a unique identifier. */ + path: string; + /** Unique identifier for the Dataset. Starts with `ds_`. */ + id: string; + /** Name of the Dataset, which is used as a unique identifier. */ + name: string; + /** Unique identifier for the specific Dataset Version. If no query params provided, the default deployed Dataset Version is returned. Starts with `dsv_`. */ + versionId: string; + type?: "dataset"; + /** The list of environments the Dataset Version is deployed to. */ + environments?: Humanloop.EnvironmentResponse[]; + createdAt: Date; + updatedAt: Date; + /** The user who created the Dataset. */ + createdBy?: Humanloop.UserResponse; + /** The status of the Dataset Version. */ + status: Humanloop.VersionStatus; + lastUsedAt: Date; + /** Message describing the changes made. If provided, a committed version of the Dataset is created. Otherwise, an uncommitted version is created. */ + commitMessage?: string; + /** The number of Datapoints in this Dataset version. */ + datapointsCount: number; + /** The list of Datapoints in this Dataset version. Only provided if explicitly requested. */ + datapoints?: Humanloop.DatapointResponse[]; +} diff --git a/src/api/types/DirectoryResponse.ts b/src/api/types/DirectoryResponse.ts new file mode 100644 index 0000000..ea581b5 --- /dev/null +++ b/src/api/types/DirectoryResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DirectoryResponse { + /** Name of the directory to create. */ + name: string; + /** ID of the parent directory. Will be `None` if the directory is the root directory. Starts with `dir_`. */ + parentId?: string; + /** String ID of directory. Starts with `dir_`. */ + id: string; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/DirectoryWithParentsAndChildrenResponse.ts b/src/api/types/DirectoryWithParentsAndChildrenResponse.ts new file mode 100644 index 0000000..373e666 --- /dev/null +++ b/src/api/types/DirectoryWithParentsAndChildrenResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface DirectoryWithParentsAndChildrenResponse { + /** Name of the directory to create. */ + name: string; + /** ID of the parent directory. Will be `None` if the directory is the root directory. Starts with `dir_`. */ + parentId?: string; + /** String ID of directory. Starts with `dir_`. */ + id: string; + createdAt: Date; + updatedAt: Date; + /** List of subdirectories in the directory. */ + subdirectories: Humanloop.DirectoryResponse[]; + /** List of files in the directory. */ + files: Humanloop.DirectoryWithParentsAndChildrenResponseFilesItem[]; + /** List of parent directories of the directory. */ + parents: Humanloop.DirectoryResponse[]; +} diff --git a/src/api/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts b/src/api/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts new file mode 100644 index 0000000..89f5a79 --- /dev/null +++ b/src/api/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type DirectoryWithParentsAndChildrenResponseFilesItem = + | Humanloop.PromptResponse + | Humanloop.ToolResponse + | Humanloop.EvaluatorResponse + | Humanloop.DatasetResponse; diff --git a/src/api/types/EnvironmentResponse.ts b/src/api/types/EnvironmentResponse.ts new file mode 100644 index 0000000..d098ab0 --- /dev/null +++ b/src/api/types/EnvironmentResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EnvironmentResponse { + id: string; + createdAt: Date; + name: string; + tag: Humanloop.EnvironmentTag; +} diff --git a/src/api/types/EnvironmentTag.ts b/src/api/types/EnvironmentTag.ts new file mode 100644 index 0000000..c192e37 --- /dev/null +++ b/src/api/types/EnvironmentTag.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type EnvironmentTag = "default" | "other"; + +export const EnvironmentTag = { + Default: "default", + Other: "other", +} as const; diff --git a/src/api/types/EvaluatedVersionResponse.ts b/src/api/types/EvaluatedVersionResponse.ts new file mode 100644 index 0000000..3253fc6 --- /dev/null +++ b/src/api/types/EvaluatedVersionResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type EvaluatedVersionResponse = Humanloop.PromptResponse | Humanloop.ToolResponse; diff --git a/src/api/types/EvaluateeRequest.ts b/src/api/types/EvaluateeRequest.ts new file mode 100644 index 0000000..fd36869 --- /dev/null +++ b/src/api/types/EvaluateeRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EvaluateeRequest { + /** Unique identifier for the Prompt/Tool Version to include in the Evaluation Report. Starts with `pv_` for Prompts and `tv_` for Tools. */ + versionId: string; + /** Unique identifier for the batch of Logs to include in the Evaluation Report. */ + batchId?: string; + /** Whether the Prompt/Tool is orchestrated by Humanloop. Default is `True`. If `False`, a log for the Prompt/Tool should be submitted by the user via the API. */ + orchestrated?: boolean; +} diff --git a/src/api/types/EvaluateeResponse.ts b/src/api/types/EvaluateeResponse.ts new file mode 100644 index 0000000..89ca901 --- /dev/null +++ b/src/api/types/EvaluateeResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluateeResponse { + version: Humanloop.EvaluatedVersionResponse; + /** Unique identifier for the batch of Logs to include in the Evaluation Report. */ + batchId?: string; + /** Whether the Prompt/Tool is orchestrated by Humanloop. Default is `True`. If `False`, a log for the Prompt/Tool should be submitted by the user via the API. */ + orchestrated: boolean; +} diff --git a/src/api/types/EvaluationDebugResultResponse.ts b/src/api/types/EvaluationDebugResultResponse.ts new file mode 100644 index 0000000..bd33925 --- /dev/null +++ b/src/api/types/EvaluationDebugResultResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * This is similar to an `EvaluationResult` but is ephemeral as it is only for synchronous + * debug runs. It does not have an ID, or a reference to an evaluation run or even an evaluation + * function. + */ +export interface EvaluationDebugResultResponse { + logId: string; + log: Humanloop.LogResponse; + datapointId?: string; + llmEvaluationLog?: Humanloop.LogResponse; + value?: Humanloop.EvaluationDebugResultResponseValue; + error?: string; +} diff --git a/src/api/types/EvaluationDebugResultResponseValue.ts b/src/api/types/EvaluationDebugResultResponseValue.ts new file mode 100644 index 0000000..6451d38 --- /dev/null +++ b/src/api/types/EvaluationDebugResultResponseValue.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type EvaluationDebugResultResponseValue = boolean | number; diff --git a/src/api/types/EvaluationEvaluatorResponse.ts b/src/api/types/EvaluationEvaluatorResponse.ts new file mode 100644 index 0000000..ab78b94 --- /dev/null +++ b/src/api/types/EvaluationEvaluatorResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluationEvaluatorResponse { + version: Humanloop.EvaluatorResponse; + /** Whether the Evaluator is orchestrated by Humanloop. Default is `True`. If `False`, a log for the Evaluator should be submitted by the user via the API. */ + orchestrated: boolean; +} diff --git a/src/api/types/EvaluationResponse.ts b/src/api/types/EvaluationResponse.ts new file mode 100644 index 0000000..b057bf3 --- /dev/null +++ b/src/api/types/EvaluationResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluationResponse { + /** Unique identifier for the Evaluation. Starts with `evr`. */ + id: string; + /** The Dataset Version used in the Evaluation. */ + dataset: Humanloop.DatasetResponse; + /** The Prompt/Tool Versions included in the Evaluation. */ + evaluatees: Humanloop.EvaluateeResponse[]; + /** The Evaluator Versions used to evaluate. */ + evaluators: Humanloop.EvaluationEvaluatorResponse[]; + /** + * The current status of the Evaluation. + * + * - `"pending"`: The Evaluation has been created but is not actively being worked on by Humanloop. + * - `"running"`: Humanloop is checking for any missing Logs and Evaluator Logs, and will generate them where appropriate. + * - `"completed"`: All Logs an Evaluator Logs have been generated. + * - `"cancelled"`: The Evaluation has been cancelled by the user. Humanloop will stop generating Logs and Evaluator Logs. + */ + status: Humanloop.EvaluationStatus; + createdAt: Date; + createdBy?: Humanloop.UserResponse; + updatedAt: Date; +} diff --git a/src/api/types/EvaluationResultResponse.ts b/src/api/types/EvaluationResultResponse.ts new file mode 100644 index 0000000..70b81c2 --- /dev/null +++ b/src/api/types/EvaluationResultResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluationResultResponse { + id: string; + evaluatorId: string; + evaluatorVersionId: string; + evaluationId?: string; + logId: string; + log?: Humanloop.LogResponse; + versionId?: string; + version?: unknown; + value?: Humanloop.EvaluationResultResponseValue; + error?: string; + updatedAt: Date; + createdAt: Date; + llmEvaluatorLog?: Humanloop.LogResponse; +} diff --git a/src/api/types/EvaluationResultResponseValue.ts b/src/api/types/EvaluationResultResponseValue.ts new file mode 100644 index 0000000..197812f --- /dev/null +++ b/src/api/types/EvaluationResultResponseValue.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type EvaluationResultResponseValue = boolean | number; diff --git a/src/api/types/EvaluationStats.ts b/src/api/types/EvaluationStats.ts new file mode 100644 index 0000000..ace2e20 --- /dev/null +++ b/src/api/types/EvaluationStats.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluationStats { + /** Stats for the Evaluation Report as a whole. */ + overallStats: Humanloop.OverallStats; + /** Stats for each Evaluated Version in the Evaluation Report. */ + versionStats: Humanloop.VersionStats[]; +} diff --git a/src/api/types/EvaluationStatus.ts b/src/api/types/EvaluationStatus.ts new file mode 100644 index 0000000..3d85619 --- /dev/null +++ b/src/api/types/EvaluationStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Status of an evaluation. + */ +export type EvaluationStatus = "pending" | "running" | "completed" | "cancelled" | "failed"; + +export const EvaluationStatus = { + Pending: "pending", + Running: "running", + Completed: "completed", + Cancelled: "cancelled", + Failed: "failed", +} as const; diff --git a/src/api/types/EvaluationsDatasetRequest.ts b/src/api/types/EvaluationsDatasetRequest.ts new file mode 100644 index 0000000..92ae58f --- /dev/null +++ b/src/api/types/EvaluationsDatasetRequest.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EvaluationsDatasetRequest { + /** Unique identifier for the Dataset Version to use in this evaluation. Starts with `dsv_`. */ + versionId: string; +} diff --git a/src/api/types/EvaluationsRequest.ts b/src/api/types/EvaluationsRequest.ts new file mode 100644 index 0000000..06356da --- /dev/null +++ b/src/api/types/EvaluationsRequest.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EvaluationsRequest { + /** Unique identifier for the Evaluator Version to use in this evaluation. Starts with `evv_`. */ + versionId: string; + /** Whether the Evaluator is orchestrated by Humanloop. Default is `True`. If `False`, a log for the Evaluator should be submitted by the user via the API. */ + orchestrated?: boolean; +} diff --git a/src/api/types/EvaluatorActivationDeactivationRequest.ts b/src/api/types/EvaluatorActivationDeactivationRequest.ts new file mode 100644 index 0000000..a8f7968 --- /dev/null +++ b/src/api/types/EvaluatorActivationDeactivationRequest.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluatorActivationDeactivationRequest { + /** Monitoring Evaluators to activate. These will be automatically run on new Logs. */ + evaluatorsToActivate?: Humanloop.EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem[]; + /** Evaluators to deactivate. These will not be run on new Logs. */ + evaluatorsToDeactivate?: Humanloop.EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem[]; +} diff --git a/src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts b/src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts new file mode 100644 index 0000000..1f245f1 --- /dev/null +++ b/src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem = + | Humanloop.MonitoringEvaluatorVersionRequest + | Humanloop.MonitoringEvaluatorEnvironmentRequest; diff --git a/src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts b/src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts new file mode 100644 index 0000000..010ab23 --- /dev/null +++ b/src/api/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem = + | Humanloop.MonitoringEvaluatorVersionRequest + | Humanloop.MonitoringEvaluatorEnvironmentRequest; diff --git a/src/api/types/EvaluatorAggregate.ts b/src/api/types/EvaluatorAggregate.ts new file mode 100644 index 0000000..7b294ad --- /dev/null +++ b/src/api/types/EvaluatorAggregate.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EvaluatorAggregate { + /** The aggregated value of the evaluator. */ + value: number; + /** ID of the evaluator. */ + evaluatorId: string; + /** ID of the evaluator version. */ + evaluatorVersionId: string; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/EvaluatorArgumentsType.ts b/src/api/types/EvaluatorArgumentsType.ts new file mode 100644 index 0000000..57a4a43 --- /dev/null +++ b/src/api/types/EvaluatorArgumentsType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enum representing the possible argument types of an evaluator. + */ +export type EvaluatorArgumentsType = "target_free" | "target_required"; + +export const EvaluatorArgumentsType = { + TargetFree: "target_free", + TargetRequired: "target_required", +} as const; diff --git a/src/api/types/EvaluatorConfigResponse.ts b/src/api/types/EvaluatorConfigResponse.ts new file mode 100644 index 0000000..f953471 --- /dev/null +++ b/src/api/types/EvaluatorConfigResponse.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface EvaluatorConfigResponse { + /** String ID of config. Starts with `config_`. */ + id: string; + /** Other parameters that define the config. */ + other?: Record; + type: "evaluator"; + /** The user who created the config. */ + createdBy?: Humanloop.BaseModelsUserResponse; + /** Whether the config is committed or not. */ + status: string; + /** Name of config. */ + name: string; + /** Description of config. */ + description?: string; + /** Type of evaluator. */ + evaluatorType: string; + /** The model config defining the LLM evaluator. */ + modelConfig?: Humanloop.ModelConfigResponse; + /** The code for the evaluator. This code will be executed in a sandboxed environment. */ + code?: string; + /** Whether this evaluator is target-free or target-required. */ + argumentsType?: Humanloop.EvaluatorArgumentsType; + /** The type of the return value of the evaluator. */ + returnType?: Humanloop.EvaluatorReturnTypeEnum; +} diff --git a/src/api/types/EvaluatorResponse.ts b/src/api/types/EvaluatorResponse.ts new file mode 100644 index 0000000..642ec86 --- /dev/null +++ b/src/api/types/EvaluatorResponse.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Request model for creating a new Evaluator + */ +export interface EvaluatorResponse { + /** Path of the Dataset including the Dataset name, which is used as a unique identifier. */ + path: string; + /** Unique identifier for the Evaluator. */ + id: string; + /** Name of the Evaluator, which is used as a unique identifier. */ + name: string; + /** Unique identifier for the specific Evaluator Version. If no query params provided, the default deployed Evaluator Version is returned. */ + versionId: string; + type?: "evaluator"; + /** The list of environments the Prompt Version is deployed to. */ + environments?: Humanloop.EnvironmentResponse[]; + createdAt: Date; + updatedAt: Date; + /** The user who created the Prompt. */ + createdBy?: Humanloop.UserResponse; + status: Humanloop.VersionStatus; + lastUsedAt: Date; + /** Message describing the changes made. */ + commitMessage?: string; + spec: Humanloop.EvaluatorResponseSpec; + /** The number of logs that have been generated for this Prompt Version */ + versionLogsCount: number; + /** The number of logs that have been generated across all Prompt Versions */ + totalLogsCount: number; + /** Inputs associated to the Prompt. Inputs correspond to any of the variables used within the Prompt template. */ + inputs: Humanloop.InputResponse[]; + /** Aggregation of Evaluator results for the Evaluator Version. */ + evaluatorAggregates?: Humanloop.EvaluatorAggregate[]; +} diff --git a/src/api/types/EvaluatorResponseSpec.ts b/src/api/types/EvaluatorResponseSpec.ts new file mode 100644 index 0000000..6b976ed --- /dev/null +++ b/src/api/types/EvaluatorResponseSpec.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type EvaluatorResponseSpec = + | Humanloop.LlmEvaluatorRequest + | Humanloop.CodeEvaluatorRequest + | Humanloop.HumanEvaluatorRequest; diff --git a/src/api/types/EvaluatorReturnTypeEnum.ts b/src/api/types/EvaluatorReturnTypeEnum.ts new file mode 100644 index 0000000..c005785 --- /dev/null +++ b/src/api/types/EvaluatorReturnTypeEnum.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enum representing the possible return types of an evaluator. + */ +export type EvaluatorReturnTypeEnum = "boolean" | "number"; + +export const EvaluatorReturnTypeEnum = { + Boolean: "boolean", + Number: "number", +} as const; diff --git a/src/api/types/ExperimentResponse.ts b/src/api/types/ExperimentResponse.ts new file mode 100644 index 0000000..ebb6cf8 --- /dev/null +++ b/src/api/types/ExperimentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ExperimentResponse { + /** String ID of experiment. Starts with `exp_`. */ + id: string; + /** String ID of file the experiment belongs to. */ + fileId: string; + /** Name of experiment. */ + name: string; + /** Status of experiment. */ + status: Humanloop.ExperimentStatus; + /** List of Versions associated to the experiment. */ + versions?: Humanloop.ExperimentVersionResponse[]; + /** Metric used as the experiment's objective. */ + metric: Humanloop.BaseMetricResponse; + /** Feedback labels to treat as positive user feedback. Used to monitor the performance of model configs in the experiment. */ + positiveLabels: Humanloop.PositiveLabel[]; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/ExperimentStatus.ts b/src/api/types/ExperimentStatus.ts new file mode 100644 index 0000000..ae6175e --- /dev/null +++ b/src/api/types/ExperimentStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type ExperimentStatus = "Initialized" | "In progress"; + +export const ExperimentStatus = { + Initialized: "Initialized", + InProgress: "In progress", +} as const; diff --git a/src/api/types/ExperimentVersionResponse.ts b/src/api/types/ExperimentVersionResponse.ts new file mode 100644 index 0000000..26205cb --- /dev/null +++ b/src/api/types/ExperimentVersionResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ExperimentVersionResponse { + /** The mean performance of the Version. */ + mean?: number; + /** The spread of performance of the Version. */ + spread?: number; + /** Number of datapoints with feedback associated to the experiment. */ + trialsCount: number; + /** Whether the Version is active in the experiment. Only active model configs can be sampled from the experiment. */ + active: boolean; + /** String ID of Version. */ + id: string; + /** Commit message of Version. */ + commitMessage?: string; + /** Version of the Prompt or Tool. */ + versionId: string; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/FeedbackClass.ts b/src/api/types/FeedbackClass.ts new file mode 100644 index 0000000..6eaf4bd --- /dev/null +++ b/src/api/types/FeedbackClass.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type FeedbackClass = "select" | "multi_select" | "text" | "number"; + +export const FeedbackClass = { + Select: "select", + MultiSelect: "multi_select", + Text: "text", + Number: "number", +} as const; diff --git a/src/api/types/FeedbackLabelStatus.ts b/src/api/types/FeedbackLabelStatus.ts new file mode 100644 index 0000000..43b8952 --- /dev/null +++ b/src/api/types/FeedbackLabelStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Controls whether the label is displayed in the UI. + */ +export type FeedbackLabelStatus = "unset" | "active" | "inactive"; + +export const FeedbackLabelStatus = { + Unset: "unset", + Active: "active", + Inactive: "inactive", +} as const; diff --git a/src/api/types/FeedbackResponse.ts b/src/api/types/FeedbackResponse.ts new file mode 100644 index 0000000..8ecf5f1 --- /dev/null +++ b/src/api/types/FeedbackResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface FeedbackResponse { + /** The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'. */ + type: Humanloop.FeedbackResponseType; + /** The feedback value to set. This would be the appropriate text for 'correction' or 'comment', or a label to apply for 'rating', 'action', or 'issue'. */ + value: Humanloop.FeedbackResponseValue; + /** ID to associate the feedback to a previously logged datapoint. */ + dataId?: string; + /** A unique identifier to who provided the feedback. */ + user?: string; + /** User defined timestamp for when the feedback was created. */ + createdAt?: Date; + /** String ID of user feedback. Starts with `ann_`, short for annotation. */ + id: string; +} diff --git a/src/api/types/FeedbackResponseType.ts b/src/api/types/FeedbackResponseType.ts new file mode 100644 index 0000000..cc45df2 --- /dev/null +++ b/src/api/types/FeedbackResponseType.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'. + */ +export type FeedbackResponseType = Humanloop.FeedbackType | string; diff --git a/src/api/types/FeedbackResponseValue.ts b/src/api/types/FeedbackResponseValue.ts new file mode 100644 index 0000000..e56e84a --- /dev/null +++ b/src/api/types/FeedbackResponseValue.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The feedback value to set. This would be the appropriate text for 'correction' or 'comment', or a label to apply for 'rating', 'action', or 'issue'. + */ +export type FeedbackResponseValue = number | string; diff --git a/src/api/types/FeedbackType.ts b/src/api/types/FeedbackType.ts new file mode 100644 index 0000000..f1fd581 --- /dev/null +++ b/src/api/types/FeedbackType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type FeedbackType = "rating" | "action" | "issue" | "correction" | "comment"; + +export const FeedbackType = { + Rating: "rating", + Action: "action", + Issue: "issue", + Correction: "correction", + Comment: "comment", +} as const; diff --git a/src/api/types/FeedbackTypeModel.ts b/src/api/types/FeedbackTypeModel.ts new file mode 100644 index 0000000..a3db834 --- /dev/null +++ b/src/api/types/FeedbackTypeModel.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface FeedbackTypeModel { + /** The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'. */ + type: Humanloop.FeedbackTypeModelType; + /** The allowed values for categorical feedback types. Not populated for `correction` and `comment`. */ + values?: Humanloop.CategoricalFeedbackLabel[]; +} diff --git a/src/api/types/FeedbackTypeModelType.ts b/src/api/types/FeedbackTypeModelType.ts new file mode 100644 index 0000000..2438e64 --- /dev/null +++ b/src/api/types/FeedbackTypeModelType.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The type of feedback. The default feedback types available are 'rating', 'action', 'issue', 'correction', and 'comment'. + */ +export type FeedbackTypeModelType = Humanloop.FeedbackType | string; diff --git a/src/api/types/FeedbackTypes.ts b/src/api/types/FeedbackTypes.ts new file mode 100644 index 0000000..e8ef479 --- /dev/null +++ b/src/api/types/FeedbackTypes.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type FeedbackTypes = Humanloop.FeedbackTypeModel[]; diff --git a/src/api/types/FileEnvironmentResponse.ts b/src/api/types/FileEnvironmentResponse.ts new file mode 100644 index 0000000..9550e07 --- /dev/null +++ b/src/api/types/FileEnvironmentResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Response model for the List Environments endpoint under Files. + * + * Contains the deployed version of the File, if one is deployed to the Environment. + */ +export interface FileEnvironmentResponse { + id: string; + createdAt: Date; + name: string; + tag: Humanloop.EnvironmentTag; + /** The version of the File that is deployed to the Environment, if one is deployed. */ + file?: Humanloop.FileEnvironmentResponseFile; +} diff --git a/src/api/types/FileEnvironmentResponseFile.ts b/src/api/types/FileEnvironmentResponseFile.ts new file mode 100644 index 0000000..37f0e38 --- /dev/null +++ b/src/api/types/FileEnvironmentResponseFile.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The version of the File that is deployed to the Environment, if one is deployed. + */ +export type FileEnvironmentResponseFile = + | Humanloop.PromptResponse + | Humanloop.ToolResponse + | Humanloop.DatasetResponse + | Humanloop.EvaluatorResponse; diff --git a/src/api/types/FilesToolType.ts b/src/api/types/FilesToolType.ts new file mode 100644 index 0000000..0d213a0 --- /dev/null +++ b/src/api/types/FilesToolType.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Type of tool. + */ +export type FilesToolType = "pinecone_search" | "google" | "mock" | "snippet" | "json_schema" | "get_api_call"; + +export const FilesToolType = { + PineconeSearch: "pinecone_search", + Google: "google", + Mock: "mock", + Snippet: "snippet", + JsonSchema: "json_schema", + GetApiCall: "get_api_call", +} as const; diff --git a/src/api/types/FunctionTool.ts b/src/api/types/FunctionTool.ts new file mode 100644 index 0000000..7f01101 --- /dev/null +++ b/src/api/types/FunctionTool.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A function tool to be called by the model where user owns runtime. + */ +export interface FunctionTool { + name: string; + arguments?: string; +} diff --git a/src/api/types/FunctionToolChoice.ts b/src/api/types/FunctionToolChoice.ts new file mode 100644 index 0000000..16131ff --- /dev/null +++ b/src/api/types/FunctionToolChoice.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A function tool to be called by the model where user owns runtime. + */ +export interface FunctionToolChoice { + name: string; +} diff --git a/src/api/types/GenericConfigResponse.ts b/src/api/types/GenericConfigResponse.ts new file mode 100644 index 0000000..b961bed --- /dev/null +++ b/src/api/types/GenericConfigResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface GenericConfigResponse { + /** String ID of config. Starts with `config_`. */ + id: string; + /** Other parameters that define the config. */ + other?: Record; + type: "generic"; + /** The user who created the config. */ + createdBy?: Humanloop.BaseModelsUserResponse; + /** Whether the config is committed or not. */ + status: string; + /** Name of config. */ + name: string; + /** Description of config. */ + description?: string; +} diff --git a/src/api/types/HttpValidationError.ts b/src/api/types/HttpValidationError.ts new file mode 100644 index 0000000..bb98ead --- /dev/null +++ b/src/api/types/HttpValidationError.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface HttpValidationError { + detail?: Humanloop.ValidationError[]; +} diff --git a/src/api/types/HumanEvaluatorRequest.ts b/src/api/types/HumanEvaluatorRequest.ts new file mode 100644 index 0000000..91ba78d --- /dev/null +++ b/src/api/types/HumanEvaluatorRequest.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface HumanEvaluatorRequest { + /** Whether this evaluator is target-free or target-required. */ + argumentsType: Humanloop.EvaluatorArgumentsType; + /** The type of the return value of the evaluator. */ + returnType: Humanloop.EvaluatorReturnTypeEnum; + evaluatorType: "human"; +} diff --git a/src/api/types/ImageChatContent.ts b/src/api/types/ImageChatContent.ts new file mode 100644 index 0000000..d463a88 --- /dev/null +++ b/src/api/types/ImageChatContent.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ImageChatContent { + type: "image_url"; + /** The message's image content. */ + imageUrl: Humanloop.ImageUrl; +} diff --git a/src/api/types/ImageUrl.ts b/src/api/types/ImageUrl.ts new file mode 100644 index 0000000..4386bcc --- /dev/null +++ b/src/api/types/ImageUrl.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ImageUrl { + /** Either a URL of the image or the base64 encoded image data. */ + url: string; + /** Specify the detail level of the image provided to the model. For more details see: https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding */ + detail?: Humanloop.ImageUrlDetail; +} diff --git a/src/api/types/ImageUrlDetail.ts b/src/api/types/ImageUrlDetail.ts new file mode 100644 index 0000000..1e16ef9 --- /dev/null +++ b/src/api/types/ImageUrlDetail.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specify the detail level of the image provided to the model. For more details see: https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding + */ +export type ImageUrlDetail = "high" | "low" | "auto"; + +export const ImageUrlDetail = { + High: "high", + Low: "low", + Auto: "auto", +} as const; diff --git a/src/api/types/InputResponse.ts b/src/api/types/InputResponse.ts new file mode 100644 index 0000000..5c5b623 --- /dev/null +++ b/src/api/types/InputResponse.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface InputResponse { + /** Type of input. */ + name: string; +} diff --git a/src/api/types/LabelSentiment.ts b/src/api/types/LabelSentiment.ts new file mode 100644 index 0000000..44a4ef1 --- /dev/null +++ b/src/api/types/LabelSentiment.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * How a label should be treated in calculating Version performance. + * + * Used by a File's PAPV (Positive Action Per View) metric. + */ +export type LabelSentiment = "positive" | "negative" | "neutral" | "unset"; + +export const LabelSentiment = { + Positive: "positive", + Negative: "negative", + Neutral: "neutral", + Unset: "unset", +} as const; diff --git a/src/api/types/LinkedToolRequest.ts b/src/api/types/LinkedToolRequest.ts new file mode 100644 index 0000000..47447d7 --- /dev/null +++ b/src/api/types/LinkedToolRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface LinkedToolRequest { + /** The ID of the linked tool. Starts with "oc\_" */ + id: string; + /** The source of the linked tool. For a linked tool it should be `organization` */ + source: "organization"; + /** The name of the linked tool. */ + name?: string; + /** The description of the linked tool. */ + description?: string; + /** The parameters of the linked tool. */ + parameters?: Record; +} diff --git a/src/api/types/LinkedToolResponse.ts b/src/api/types/LinkedToolResponse.ts new file mode 100644 index 0000000..da0cf97 --- /dev/null +++ b/src/api/types/LinkedToolResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface LinkedToolResponse { + /** Name for the tool referenced by the model. */ + name: string; + /** Description of the tool referenced by the model */ + description: string; + /** Parameters needed to run the Tool, defined in JSON Schema format: https://json-schema.org/ */ + parameters?: Record; + /** Unique identifier for the Tool linked. */ + id: string; + /** Unique identifier for the Tool Version linked. */ + versionId: string; +} diff --git a/src/api/types/ListDatasets.ts b/src/api/types/ListDatasets.ts new file mode 100644 index 0000000..c6ed372 --- /dev/null +++ b/src/api/types/ListDatasets.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ListDatasets { + /** The list of Datasets. */ + records: Humanloop.DatasetResponse[]; +} diff --git a/src/api/types/ListEvaluators.ts b/src/api/types/ListEvaluators.ts new file mode 100644 index 0000000..ce0aa59 --- /dev/null +++ b/src/api/types/ListEvaluators.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ListEvaluators { + /** The list of Evaluators. */ + records: Humanloop.EvaluatorResponse[]; +} diff --git a/src/api/types/ListPrompts.ts b/src/api/types/ListPrompts.ts new file mode 100644 index 0000000..a5bee4d --- /dev/null +++ b/src/api/types/ListPrompts.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ListPrompts { + /** The list of Prompts. */ + records: Humanloop.PromptResponse[]; +} diff --git a/src/api/types/ListTools.ts b/src/api/types/ListTools.ts new file mode 100644 index 0000000..33380bf --- /dev/null +++ b/src/api/types/ListTools.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ListTools { + /** The list of Tools. */ + records: Humanloop.ToolResponse[]; +} diff --git a/src/api/types/LlmEvaluatorRequest.ts b/src/api/types/LlmEvaluatorRequest.ts new file mode 100644 index 0000000..0b7af84 --- /dev/null +++ b/src/api/types/LlmEvaluatorRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface LlmEvaluatorRequest { + /** Whether this evaluator is target-free or target-required. */ + argumentsType: Humanloop.EvaluatorArgumentsType; + /** The type of the return value of the evaluator. */ + returnType: Humanloop.EvaluatorReturnTypeEnum; + evaluatorType: "llm"; + /** The prompt parameters used to generate. */ + prompt?: Humanloop.PromptKernelRequest; +} diff --git a/src/api/types/LogResponse.ts b/src/api/types/LogResponse.ts new file mode 100644 index 0000000..f8cd9a7 --- /dev/null +++ b/src/api/types/LogResponse.ts @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Request model for logging a datapoint. + */ +export interface LogResponse { + /** The name of the project associated with this log */ + project?: string; + /** The unique ID of the project associated with this log. */ + projectId?: string; + /** ID of the session to associate the datapoint. */ + sessionId?: string; + /** A unique string identifying the session to associate the datapoint to. Allows you to log multiple datapoints to a session (using an ID kept by your internal systems) by passing the same `session_reference_id` in subsequent log requests. Specify at most one of this or `session_id`. */ + sessionReferenceId?: string; + /** ID associated to the parent datapoint in a session. */ + parentId?: string; + /** A unique string identifying the previously-logged parent datapoint in a session. Allows you to log nested datapoints with your internal system IDs by passing the same reference ID as `parent_id` in a prior log request. Specify at most one of this or `parent_id`. Note that this cannot refer to a datapoint being logged in the same request. */ + parentReferenceId?: string; + /** The inputs passed to the prompt template. */ + inputs?: Record; + /** Identifies where the model was called from. */ + source?: string; + /** Any additional metadata to record. */ + metadata?: Record; + /** Whether the request/response payloads will be stored on Humanloop. */ + save?: boolean; + /** ID of the source datapoint if this is a log derived from a datapoint in a dataset. */ + sourceDatapointId?: string; + /** String ID of logged datapoint. Starts with `data_`. */ + id: string; + /** Unique user-provided string identifying the datapoint. */ + referenceId?: string; + /** Unique ID of an experiment trial to associate to the log. */ + trialId?: string; + /** The messages passed to the to provider chat endpoint. */ + messages?: Humanloop.ChatMessageWithToolCall[]; + /** Generated output from your model for the provided inputs. Can be `None` if logging an error, or if logging a parent datapoint with the intention to populate it later */ + output?: string; + judgment?: Humanloop.LogResponseJudgment; + /** Unique ID of a config to associate to the log. */ + configId?: string; + config: Humanloop.ConfigResponse; + /** The environment name used to create the log. */ + environment?: string; + feedback?: Humanloop.FeedbackResponse[]; + /** User defined timestamp for when the log was created. */ + createdAt?: Date; + /** Error message if the log is an error. */ + error?: string; + /** Duration of the logged event in seconds. */ + duration?: number; + /** The message returned by the provider. */ + outputMessage?: Humanloop.ChatMessageWithToolCall; + /** Number of tokens in the prompt used to generate the output. */ + promptTokens?: number; + /** Number of tokens in the output generated by the model. */ + outputTokens?: number; + /** Cost in dollars associated to the tokens in the prompt. */ + promptCost?: number; + /** Cost in dollars associated to the tokens in the output. */ + outputCost?: number; + /** Raw request sent to provider. */ + providerRequest?: Record; + /** Raw response received the provider. */ + providerResponse?: Record; + /** User email address provided when creating the datapoint. */ + user?: string; + /** Latency of provider response. */ + providerLatency?: number; + /** Total number of tokens in the prompt and output. */ + tokens?: number; + /** Raw output from the provider. */ + rawOutput?: string; + /** Reason the generation finished. */ + finishReason?: string; + metricValues?: Humanloop.MetricValueResponse[]; + tools?: Humanloop.ToolResultResponse[]; + /** Controls how the model uses tools. The following options are supported: 'none' forces the model to not call a tool; the default when no tools are provided as part of the model config. 'auto' the model can decide to call one of the provided tools; the default when tools are provided as part of the model config. Providing {'type': 'function', 'function': {name': }} forces the model to use the named function. */ + toolChoice?: Humanloop.LogResponseToolChoice; + evaluationResults: Humanloop.EvaluationResultResponse[]; + observabilityStatus: Humanloop.ObservabilityStatus; + updatedAt: Date; + /** List of batch IDs the log belongs to. */ + batchIds?: string[]; +} diff --git a/src/api/types/LogResponseJudgment.ts b/src/api/types/LogResponseJudgment.ts new file mode 100644 index 0000000..9ae83d8 --- /dev/null +++ b/src/api/types/LogResponseJudgment.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type LogResponseJudgment = boolean | number; diff --git a/src/api/types/LogResponseToolChoice.ts b/src/api/types/LogResponseToolChoice.ts new file mode 100644 index 0000000..3cfaf88 --- /dev/null +++ b/src/api/types/LogResponseToolChoice.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Controls how the model uses tools. The following options are supported: 'none' forces the model to not call a tool; the default when no tools are provided as part of the model config. 'auto' the model can decide to call one of the provided tools; the default when tools are provided as part of the model config. Providing {'type': 'function', 'function': {name': }} forces the model to use the named function. + */ +export type LogResponseToolChoice = "none" | "auto" | "required" | Humanloop.ToolChoice; diff --git a/src/api/types/MetricValueResponse.ts b/src/api/types/MetricValueResponse.ts new file mode 100644 index 0000000..8d30893 --- /dev/null +++ b/src/api/types/MetricValueResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MetricValueResponse { + metricId: string; + metricName: string; + metricValue: number; +} diff --git a/src/api/types/ModelConfigRequest.ts b/src/api/types/ModelConfigRequest.ts new file mode 100644 index 0000000..564e918 --- /dev/null +++ b/src/api/types/ModelConfigRequest.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Model config used for logging both chat and completion. + */ +export interface ModelConfigRequest { + /** A friendly display name for the model config. If not provided, a name will be generated. */ + name?: string; + /** A description of the model config. */ + description?: string; + /** The company providing the underlying model service. */ + provider?: Humanloop.ModelProviders; + /** The model instance used. E.g. text-davinci-002. */ + model: string; + /** The maximum number of tokens to generate. Provide max_tokens=-1 to dynamically calculate the maximum number of tokens to generate given the length of the prompt */ + maxTokens?: number; + /** What sampling temperature to use when making a generation. Higher values means the model will be more creative. */ + temperature?: number; + /** An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. */ + topP?: number; + /** The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. */ + stop?: Humanloop.ModelConfigRequestStop; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the generation so far. */ + presencePenalty?: number; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on how frequently they appear in the generation so far. */ + frequencyPenalty?: number; + /** Other parameter values to be passed to the provider call. */ + other?: Record; + /** If specified, model will make a best effort to sample deterministically, but it is not guaranteed. */ + seed?: number; + /** The format of the response. Only type json_object is currently supported for chat. */ + responseFormat?: Humanloop.ResponseFormat; + /** The provider model endpoint used. */ + endpoint?: Humanloop.ModelEndpoints; + /** Prompt template that will take your specified inputs to form your final request to the model. Input variables within the prompt template should be specified with syntax: {{INPUT_NAME}}. */ + promptTemplate?: string; + /** Messages prepended to the list of messages sent to the provider. These messages that will take your specified inputs to form your final request to the provider model. Input variables within the template should be specified with syntax: {{INPUT_NAME}}. */ + chatTemplate?: Humanloop.ChatMessageWithToolCall[]; + /** Make tools available to OpenAIs chat model as functions. */ + tools?: Humanloop.ModelConfigRequestToolsItem[]; + type?: "model"; +} diff --git a/src/api/types/ModelConfigRequestStop.ts b/src/api/types/ModelConfigRequestStop.ts new file mode 100644 index 0000000..6c6514e --- /dev/null +++ b/src/api/types/ModelConfigRequestStop.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. + */ +export type ModelConfigRequestStop = string | string[]; diff --git a/src/api/types/ModelConfigRequestToolsItem.ts b/src/api/types/ModelConfigRequestToolsItem.ts new file mode 100644 index 0000000..ca06b3a --- /dev/null +++ b/src/api/types/ModelConfigRequestToolsItem.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type ModelConfigRequestToolsItem = Humanloop.LinkedToolRequest | Humanloop.ModelConfigToolRequest; diff --git a/src/api/types/ModelConfigResponse.ts b/src/api/types/ModelConfigResponse.ts new file mode 100644 index 0000000..ead9434 --- /dev/null +++ b/src/api/types/ModelConfigResponse.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Model config request. + * + * Contains fields that are common to all (i.e. both chat and complete) endpoints. + */ +export interface ModelConfigResponse { + /** String ID of config. Starts with `config_`. */ + id: string; + /** Other parameter values to be passed to the provider call. */ + other?: Record; + type: "model"; + /** A friendly display name for the model config. If not provided, a name will be generated. */ + name?: string; + /** A description of the model config. */ + description?: string; + /** The company providing the underlying model service. */ + provider?: Humanloop.ModelProviders; + /** The model instance used. E.g. text-davinci-002. */ + model: string; + /** The maximum number of tokens to generate. Provide max_tokens=-1 to dynamically calculate the maximum number of tokens to generate given the length of the prompt */ + maxTokens?: number; + /** What sampling temperature to use when making a generation. Higher values means the model will be more creative. */ + temperature?: number; + /** An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. */ + topP?: number; + /** The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. */ + stop?: Humanloop.ModelConfigResponseStop; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the generation so far. */ + presencePenalty?: number; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on how frequently they appear in the generation so far. */ + frequencyPenalty?: number; + /** If specified, model will make a best effort to sample deterministically, but it is not guaranteed. */ + seed?: number; + /** The format of the response. Only type json_object is currently supported for chat. */ + responseFormat?: Humanloop.ResponseFormat; + /** Prompt template that will take your specified inputs to form your final request to the model. NB: Input variables within the prompt template should be specified with syntax: {{INPUT_NAME}}. */ + promptTemplate?: string; + /** Messages prepended to the list of messages sent to the provider. These messages that will take your specified inputs to form your final request to the provider model. NB: Input variables within the template should be specified with syntax: {{INPUT_NAME}}. */ + chatTemplate?: Humanloop.ChatMessageWithToolCall[]; + /** NB: Deprecated with tools field. Definition of tools shown to the model. */ + toolConfigs?: Humanloop.ToolConfigResponse[]; + /** Tools shown to the model. */ + tools?: Humanloop.ConfigToolResponse[]; + /** The provider model endpoint used. */ + endpoint?: Humanloop.ModelEndpoints; +} diff --git a/src/api/types/ModelConfigResponseStop.ts b/src/api/types/ModelConfigResponseStop.ts new file mode 100644 index 0000000..00fbb88 --- /dev/null +++ b/src/api/types/ModelConfigResponseStop.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. + */ +export type ModelConfigResponseStop = string | string[]; diff --git a/src/api/types/ModelConfigToolRequest.ts b/src/api/types/ModelConfigToolRequest.ts new file mode 100644 index 0000000..2967662 --- /dev/null +++ b/src/api/types/ModelConfigToolRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Definition of tool within a model config. + * + * The subset of ToolConfig parameters received by the chat endpoint. + * Does not have things like the signature or setup schema. + */ +export interface ModelConfigToolRequest { + /** The name of the tool shown to the model. */ + name: string; + /** The description of the tool shown to the model. */ + description?: string; + /** Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ */ + parameters?: Record; + /** Source of the tool. If defined at an organization level will be 'organization' else 'inline'. */ + source?: Humanloop.ToolSource; + /** Code source of the tool. */ + sourceCode?: string; + /** Other parameters that define the config. */ + other?: Record; + /** If is_preset = true, this is the name of the preset tool on Humanloop. This is used as the key to look up the Humanloop runtime of the tool */ + presetName?: string; +} diff --git a/src/api/types/ModelEndpoints.ts b/src/api/types/ModelEndpoints.ts new file mode 100644 index 0000000..a06670d --- /dev/null +++ b/src/api/types/ModelEndpoints.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported model provider endpoints. + */ +export type ModelEndpoints = "complete" | "chat" | "edit"; + +export const ModelEndpoints = { + Complete: "complete", + Chat: "chat", + Edit: "edit", +} as const; diff --git a/src/api/types/ModelProviders.ts b/src/api/types/ModelProviders.ts new file mode 100644 index 0000000..926a38b --- /dev/null +++ b/src/api/types/ModelProviders.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported model providers. + */ +export type ModelProviders = + | "openai" + | "openai_azure" + | "ai21" + | "mock" + | "anthropic" + | "langchain" + | "cohere" + | "replicate" + | "google" + | "groq"; + +export const ModelProviders = { + Openai: "openai", + OpenaiAzure: "openai_azure", + Ai21: "ai21", + Mock: "mock", + Anthropic: "anthropic", + Langchain: "langchain", + Cohere: "cohere", + Replicate: "replicate", + Google: "google", + Groq: "groq", +} as const; diff --git a/src/api/types/MonitoringEvaluatorEnvironmentRequest.ts b/src/api/types/MonitoringEvaluatorEnvironmentRequest.ts new file mode 100644 index 0000000..1f43708 --- /dev/null +++ b/src/api/types/MonitoringEvaluatorEnvironmentRequest.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MonitoringEvaluatorEnvironmentRequest { + /** Unique identifier for the Evaluator to be used for monitoring. */ + evaluatorId: string; + /** Unique identifier for the Environment. The Evaluator Version deployed to this Environment will be used for monitoring. */ + environmentId: string; +} diff --git a/src/api/types/MonitoringEvaluatorResponse.ts b/src/api/types/MonitoringEvaluatorResponse.ts new file mode 100644 index 0000000..92ff9f8 --- /dev/null +++ b/src/api/types/MonitoringEvaluatorResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface MonitoringEvaluatorResponse { + /** The Evaluator Version used for monitoring. This can be a specific Version by ID, or a Version deployed to an Environment. */ + versionReference: Humanloop.VersionReferenceResponse; + /** The deployed Version. */ + version?: Humanloop.EvaluatorResponse; + /** The state of the Monitoring Evaluator. Either `active` or `inactive` */ + state: Humanloop.MonitoringEvaluatorState; + createdAt: Date; + updatedAt: Date; +} diff --git a/src/api/types/MonitoringEvaluatorState.ts b/src/api/types/MonitoringEvaluatorState.ts new file mode 100644 index 0000000..931f795 --- /dev/null +++ b/src/api/types/MonitoringEvaluatorState.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * State of an evaluator connected to a file + */ +export type MonitoringEvaluatorState = "active" | "inactive"; + +export const MonitoringEvaluatorState = { + Active: "active", + Inactive: "inactive", +} as const; diff --git a/src/api/types/MonitoringEvaluatorVersionRequest.ts b/src/api/types/MonitoringEvaluatorVersionRequest.ts new file mode 100644 index 0000000..a9bbab3 --- /dev/null +++ b/src/api/types/MonitoringEvaluatorVersionRequest.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface MonitoringEvaluatorVersionRequest { + /** Unique identifier for the Evaluator Version to be used for monitoring. */ + evaluatorVersionId: string; +} diff --git a/src/api/types/NumericEvaluatorVersionStats.ts b/src/api/types/NumericEvaluatorVersionStats.ts new file mode 100644 index 0000000..d4dba86 --- /dev/null +++ b/src/api/types/NumericEvaluatorVersionStats.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Base attributes for stats for an Evaluator Version-Evaluated Version pair + * in the Evaluation Report. + */ +export interface NumericEvaluatorVersionStats { + /** Unique identifier for the Evaluator Version. */ + evaluatorVersionId: string; + /** The total number of Logs generated by this Evaluator Version on the Evaluated Version's Logs. This includes Nulls and Errors. */ + totalLogs: number; + /** The total number of Evaluator judgments for this Evaluator Version. This excludes Nulls and Errors. */ + numJudgments: number; + /** The total number of null judgments (i.e. abstentions) for this Evaluator Version. */ + numNulls: number; + /** The total number of errored Evaluators for this Evaluator Version. */ + numErrors: number; + mean?: number; + std?: number; + percentiles: Record; +} diff --git a/src/api/types/ObservabilityStatus.ts b/src/api/types/ObservabilityStatus.ts new file mode 100644 index 0000000..ccfb7ec --- /dev/null +++ b/src/api/types/ObservabilityStatus.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Status of a Log for observability. + * + * Observability is implemented by running monitoring Evaluators on Logs. + */ +export type ObservabilityStatus = "pending" | "running" | "completed" | "failed"; + +export const ObservabilityStatus = { + Pending: "pending", + Running: "running", + Completed: "completed", + Failed: "failed", +} as const; diff --git a/src/api/types/OverallStats.ts b/src/api/types/OverallStats.ts new file mode 100644 index 0000000..92a3b4a --- /dev/null +++ b/src/api/types/OverallStats.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface OverallStats { + /** The total number of Datapoints in the Evaluation Report's Dataset Version. */ + numDatapoints: number; + /** The total number of Logs in the Evaluation Report. */ + totalLogs: number; + /** The total number of Evaluator Logs in the Evaluation Report. */ + totalEvaluatorLogs: number; +} diff --git a/src/api/types/PaginatedDatapointResponse.ts b/src/api/types/PaginatedDatapointResponse.ts new file mode 100644 index 0000000..a605c2e --- /dev/null +++ b/src/api/types/PaginatedDatapointResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface PaginatedDatapointResponse { + records: Humanloop.DatapointResponse[]; + page: number; + size: number; + total: number; +} diff --git a/src/api/types/PaginatedDatasetResponse.ts b/src/api/types/PaginatedDatasetResponse.ts new file mode 100644 index 0000000..a97b719 --- /dev/null +++ b/src/api/types/PaginatedDatasetResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface PaginatedDatasetResponse { + records: Humanloop.DatasetResponse[]; + page: number; + size: number; + total: number; +} diff --git a/src/api/types/PaginatedEvaluationResponse.ts b/src/api/types/PaginatedEvaluationResponse.ts new file mode 100644 index 0000000..dc596f3 --- /dev/null +++ b/src/api/types/PaginatedEvaluationResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface PaginatedEvaluationResponse { + records: Humanloop.EvaluationResponse[]; + page: number; + size: number; + total: number; +} diff --git a/src/api/types/PaginatedPromptLogResponse.ts b/src/api/types/PaginatedPromptLogResponse.ts new file mode 100644 index 0000000..7196ff7 --- /dev/null +++ b/src/api/types/PaginatedPromptLogResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface PaginatedPromptLogResponse { + records: Humanloop.PromptLogResponse[]; + page: number; + size: number; + total: number; +} diff --git a/src/api/types/PaginatedSessionResponse.ts b/src/api/types/PaginatedSessionResponse.ts new file mode 100644 index 0000000..ca683de --- /dev/null +++ b/src/api/types/PaginatedSessionResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface PaginatedSessionResponse { + records: Humanloop.SessionResponse[]; + page: number; + size: number; + total: number; +} diff --git a/src/api/types/PlatformAccessEnum.ts b/src/api/types/PlatformAccessEnum.ts new file mode 100644 index 0000000..dab320b --- /dev/null +++ b/src/api/types/PlatformAccessEnum.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type PlatformAccessEnum = "superadmin" | "supportadmin" | "user"; + +export const PlatformAccessEnum = { + Superadmin: "superadmin", + Supportadmin: "supportadmin", + User: "user", +} as const; diff --git a/src/api/types/PositiveLabel.ts b/src/api/types/PositiveLabel.ts new file mode 100644 index 0000000..a7a9479 --- /dev/null +++ b/src/api/types/PositiveLabel.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PositiveLabel { + type: string; + value: string; +} diff --git a/src/api/types/ProjectSortBy.ts b/src/api/types/ProjectSortBy.ts new file mode 100644 index 0000000..1316d7e --- /dev/null +++ b/src/api/types/ProjectSortBy.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type ProjectSortBy = "created_at" | "updated_at" | "name"; + +export const ProjectSortBy = { + CreatedAt: "created_at", + UpdatedAt: "updated_at", + Name: "name", +} as const; diff --git a/src/api/types/PromptCallLogResponse.ts b/src/api/types/PromptCallLogResponse.ts new file mode 100644 index 0000000..682dc66 --- /dev/null +++ b/src/api/types/PromptCallLogResponse.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Sample specific response details for a Prompt call + */ +export interface PromptCallLogResponse { + /** Generated output from your model for the provided inputs. Can be `None` if logging an error, or if creating a parent Log with the intention to populate it later. */ + output?: string; + /** Raw output from the provider. */ + rawOutput?: string; + /** User defined timestamp for when the log was created. */ + createdAt?: Date; + /** Error message if the log is an error. */ + error?: string; + /** Duration of the logged event in seconds. */ + providerLatency?: number; + /** The message returned by the provider. */ + outputMessage?: Humanloop.ChatMessage; + /** Number of tokens in the prompt used to generate the output. */ + promptTokens?: number; + /** Number of tokens in the output generated by the model. */ + outputTokens?: number; + /** Cost in dollars associated to the tokens in the prompt. */ + promptCost?: number; + /** Cost in dollars associated to the tokens in the output. */ + outputCost?: number; + /** Reason the generation finished. */ + finishReason?: string; + /** The index of the sample in the batch. */ + index: number; +} diff --git a/src/api/types/PromptCallResponse.ts b/src/api/types/PromptCallResponse.ts new file mode 100644 index 0000000..50c7020 --- /dev/null +++ b/src/api/types/PromptCallResponse.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Response model for a Prompt call with potentially multiple log samples. + */ +export interface PromptCallResponse { + /** Prompt details used to generate the log. */ + prompt: Humanloop.PromptResponse; + /** The messages passed to the to provider chat endpoint. */ + messages?: Humanloop.ChatMessage[]; + /** + * Controls how the model uses tools. The following options are supported: + * + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ + toolChoice?: Humanloop.PromptCallResponseToolChoice; + /** Unique identifier for the Session to associate the Log to. Allows you to record multiple Logs to a Session (using an ID kept by your internal systems) by passing the same `session_id` in subsequent log requests. */ + sessionId?: string; + /** Unique identifier for the parent Log in a Session. Should only be provided if `session_id` is provided. If provided, the Log will be nested under the parent Log within the Session. */ + parentId?: string; + /** The inputs passed to the prompt template. */ + inputs?: Record; + /** Identifies where the model was called from. */ + source?: string; + /** Any additional metadata to record. */ + metadata?: Record; + /** Whether the request/response payloads will be stored on Humanloop. */ + save?: boolean; + /** Unique identifier for the Datapoint that this Log is derived from. This can be used by Humanloop to associate Logs to Evaluations. If provided, Humanloop will automatically associate this Log to Evaluations that require a Log for this Datapoint-Version pair. */ + sourceDatapointId?: string; + /** Array of Batch Ids that this log is part of. Batches are used to group Logs together for offline Evaluations */ + batches?: string[]; + /** End-user ID related to the Log. */ + user?: string; + /** The name of the Environment the Log is associated to. */ + environment?: string; + /** ID of the log. */ + id: string; + /** The logs generated by the Prompt call. */ + logs: Humanloop.PromptCallLogResponse[]; +} diff --git a/src/api/types/PromptCallResponseToolChoice.ts b/src/api/types/PromptCallResponseToolChoice.ts new file mode 100644 index 0000000..b913ce8 --- /dev/null +++ b/src/api/types/PromptCallResponseToolChoice.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Controls how the model uses tools. The following options are supported: + * + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ +export type PromptCallResponseToolChoice = "none" | "auto" | "required" | Humanloop.ToolChoice; diff --git a/src/api/types/PromptCallStreamResponse.ts b/src/api/types/PromptCallStreamResponse.ts new file mode 100644 index 0000000..27f9a1c --- /dev/null +++ b/src/api/types/PromptCallStreamResponse.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Response model for calling Prompt in streaming mode. + */ +export interface PromptCallStreamResponse { + /** Generated output from your model for the provided inputs. Can be `None` if logging an error, or if creating a parent Log with the intention to populate it later. */ + output?: string; + /** Raw output from the provider. */ + rawOutput?: string; + /** User defined timestamp for when the log was created. */ + createdAt?: Date; + /** Error message if the log is an error. */ + error?: string; + /** Duration of the logged event in seconds. */ + providerLatency?: number; + /** The message returned by the provider. */ + outputMessage?: Humanloop.ChatMessage; + /** Number of tokens in the prompt used to generate the output. */ + promptTokens?: number; + /** Number of tokens in the output generated by the model. */ + outputTokens?: number; + /** Cost in dollars associated to the tokens in the prompt. */ + promptCost?: number; + /** Cost in dollars associated to the tokens in the output. */ + outputCost?: number; + /** Reason the generation finished. */ + finishReason?: string; + /** The index of the sample in the batch. */ + index: number; + /** ID of the log. */ + id: string; + /** ID of the Prompt the log belongs to. */ + promptId: string; + /** ID of the specific version of the Prompt. */ + versionId: string; +} diff --git a/src/api/types/PromptKernelRequest.ts b/src/api/types/PromptKernelRequest.ts new file mode 100644 index 0000000..2ce0501 --- /dev/null +++ b/src/api/types/PromptKernelRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface PromptKernelRequest { + /** The model instance used, e.g. `gpt-4`. See [supported models](https://humanloop.com/docs/supported-models) */ + model: string; + /** The provider model endpoint used. */ + endpoint?: Humanloop.ModelEndpoints; + /** For chat endpoint, provide a Chat template. For completion endpoint, provide a Prompt template. Input variables within the template should be specified with double curly bracket syntax: {{INPUT_NAME}}. */ + template?: Humanloop.PromptKernelRequestTemplate; + /** The company providing the underlying model service. */ + provider?: Humanloop.ModelProviders; + /** The maximum number of tokens to generate. Provide max_tokens=-1 to dynamically calculate the maximum number of tokens to generate given the length of the prompt */ + maxTokens?: number; + /** What sampling temperature to use when making a generation. Higher values means the model will be more creative. */ + temperature?: number; + /** An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. */ + topP?: number; + /** The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. */ + stop?: Humanloop.PromptKernelRequestStop; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the generation so far. */ + presencePenalty?: number; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on how frequently they appear in the generation so far. */ + frequencyPenalty?: number; + /** Other parameter values to be passed to the provider call. */ + other?: Record; + /** If specified, model will make a best effort to sample deterministically, but it is not guaranteed. */ + seed?: number; + /** The format of the response. Only `{"type": "json_object"}` is currently supported for chat. */ + responseFormat?: Humanloop.ResponseFormat; + /** The tool specification that the model can choose to call if Tool calling is supported. */ + tools?: Humanloop.ToolFunction[]; + /** The IDs of the Tools in your organization that the model can choose to call if Tool calling is supported. The default deployed version of that tool is called. */ + linkedTools?: string[]; +} diff --git a/src/api/types/PromptKernelRequestStop.ts b/src/api/types/PromptKernelRequestStop.ts new file mode 100644 index 0000000..9fefa98 --- /dev/null +++ b/src/api/types/PromptKernelRequestStop.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. + */ +export type PromptKernelRequestStop = string | string[]; diff --git a/src/api/types/PromptKernelRequestTemplate.ts b/src/api/types/PromptKernelRequestTemplate.ts new file mode 100644 index 0000000..46ca247 --- /dev/null +++ b/src/api/types/PromptKernelRequestTemplate.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * For chat endpoint, provide a Chat template. For completion endpoint, provide a Prompt template. Input variables within the template should be specified with double curly bracket syntax: {{INPUT_NAME}}. + */ +export type PromptKernelRequestTemplate = string | Humanloop.ChatMessage[]; diff --git a/src/api/types/PromptLogResponse.ts b/src/api/types/PromptLogResponse.ts new file mode 100644 index 0000000..e0212c6 --- /dev/null +++ b/src/api/types/PromptLogResponse.ts @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Request for creating a Prompt log. + */ +export interface PromptLogResponse { + /** Unique identifier for the Log. */ + id: string; + /** The message returned by the provider. */ + outputMessage?: Humanloop.ChatMessage; + /** Number of tokens in the prompt used to generate the output. */ + promptTokens?: number; + /** Number of tokens in the output generated by the model. */ + outputTokens?: number; + /** Cost in dollars associated to the tokens in the prompt. */ + promptCost?: number; + /** Cost in dollars associated to the tokens in the output. */ + outputCost?: number; + /** Reason the generation finished. */ + finishReason?: string; + /** Prompt details used to generate the log. */ + prompt: Humanloop.PromptResponse; + /** The messages passed to the to provider chat endpoint. */ + messages?: Humanloop.ChatMessage[]; + /** + * Controls how the model uses tools. The following options are supported: + * + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ + toolChoice?: Humanloop.PromptLogResponseToolChoice; + /** Generated output from your model for the provided inputs. Can be `None` if logging an error, or if creating a parent Log with the intention to populate it later. */ + output?: string; + /** Raw output from the provider. */ + rawOutput?: string; + /** User defined timestamp for when the log was created. */ + createdAt?: Date; + /** Error message if the log is an error. */ + error?: string; + /** Duration of the logged event in seconds. */ + providerLatency?: number; + /** Raw request sent to provider. */ + providerRequest?: Record; + /** Raw response received the provider. */ + providerResponse?: Record; + /** Unique identifier for the Session to associate the Log to. Allows you to record multiple Logs to a Session (using an ID kept by your internal systems) by passing the same `session_id` in subsequent log requests. */ + sessionId?: string; + /** Unique identifier for the parent Log in a Session. Should only be provided if `session_id` is provided. If provided, the Log will be nested under the parent Log within the Session. */ + parentId?: string; + /** The inputs passed to the prompt template. */ + inputs?: Record; + /** Identifies where the model was called from. */ + source?: string; + /** Any additional metadata to record. */ + metadata?: Record; + /** Whether the request/response payloads will be stored on Humanloop. */ + save?: boolean; + /** Unique identifier for the Datapoint that this Log is derived from. This can be used by Humanloop to associate Logs to Evaluations. If provided, Humanloop will automatically associate this Log to Evaluations that require a Log for this Datapoint-Version pair. */ + sourceDatapointId?: string; + /** Array of Batch Ids that this log is part of. Batches are used to group Logs together for offline Evaluations */ + batches?: string[]; + /** End-user ID related to the Log. */ + user?: string; + /** The name of the Environment the Log is associated to. */ + environment?: string; +} diff --git a/src/api/types/PromptLogResponseToolChoice.ts b/src/api/types/PromptLogResponseToolChoice.ts new file mode 100644 index 0000000..3d60d22 --- /dev/null +++ b/src/api/types/PromptLogResponseToolChoice.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Controls how the model uses tools. The following options are supported: + * + * - `'none'` means the model will not call any tool and instead generates a message; this is the default when no tools are provided as part of the Prompt. + * - `'auto'` means the model can decide to call one or more of the provided tools; this is the default when tools are provided as part of the Prompt. + * - `'required'` means the model can decide to call one or more of the provided tools. + * - `{'type': 'function', 'function': {name': }}` forces the model to use the named function. + */ +export type PromptLogResponseToolChoice = "none" | "auto" | "required" | Humanloop.ToolChoice; diff --git a/src/api/types/PromptResponse.ts b/src/api/types/PromptResponse.ts new file mode 100644 index 0000000..2ed5ae7 --- /dev/null +++ b/src/api/types/PromptResponse.ts @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Request model for creating a new Prompt + */ +export interface PromptResponse { + /** Path of the Prompt, including the name, which is used as a unique identifier. */ + path: string; + /** Unique identifier for the Prompt. */ + id: string; + /** Name of the Prompt. */ + name: string; + /** Unique identifier for the specific Prompt Version. If no query params provided, the default deployed Prompt Version is returned. */ + versionId: string; + type?: "prompt"; + /** The list of environments the Prompt Version is deployed to. */ + environments?: Humanloop.EnvironmentResponse[]; + createdAt: Date; + updatedAt: Date; + /** The user who created the Prompt. */ + createdBy?: Humanloop.UserResponse; + /** The status of the Prompt Version. */ + status: Humanloop.VersionStatus; + lastUsedAt: Date; + /** The model instance used, e.g. `gpt-4`. See [supported models](https://humanloop.com/docs/supported-models) */ + model: string; + /** The provider model endpoint used. */ + endpoint?: Humanloop.ModelEndpoints; + /** For chat endpoint, provide a Chat template. For completion endpoint, provide a Prompt template. Input variables within the template should be specified with double curly bracket syntax: {{INPUT_NAME}}. */ + template?: Humanloop.PromptResponseTemplate; + /** The company providing the underlying model service. */ + provider?: Humanloop.ModelProviders; + /** The maximum number of tokens to generate. Provide max_tokens=-1 to dynamically calculate the maximum number of tokens to generate given the length of the prompt */ + maxTokens?: number; + /** What sampling temperature to use when making a generation. Higher values means the model will be more creative. */ + temperature?: number; + /** An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. */ + topP?: number; + /** The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. */ + stop?: Humanloop.PromptResponseStop; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the generation so far. */ + presencePenalty?: number; + /** Number between -2.0 and 2.0. Positive values penalize new tokens based on how frequently they appear in the generation so far. */ + frequencyPenalty?: number; + /** Other parameter values to be passed to the provider call. */ + other?: Record; + /** If specified, model will make a best effort to sample deterministically, but it is not guaranteed. */ + seed?: number; + /** The format of the response. Only `{"type": "json_object"}` is currently supported for chat. */ + responseFormat?: Humanloop.ResponseFormat; + /** The tool specification that the model can choose to call if Tool calling is supported. */ + tools?: Humanloop.ToolFunction[]; + /** The tools linked to your prompt that the model can call. */ + linkedTools?: Humanloop.LinkedToolResponse[]; + /** Message describing the changes made. */ + commitMessage?: string; + /** The number of logs that have been generated for this Prompt Version */ + versionLogsCount: number; + /** The number of logs that have been generated across all Prompt Versions */ + totalLogsCount: number; + /** Inputs associated to the Prompt. Inputs correspond to any of the variables used within the Prompt template. */ + inputs: Humanloop.InputResponse[]; + /** Aggregation of Evaluator results for the Prompt Version. */ + evaluatorAggregates?: Humanloop.EvaluatorAggregate[]; +} diff --git a/src/api/types/PromptResponseStop.ts b/src/api/types/PromptResponseStop.ts new file mode 100644 index 0000000..d9d958d --- /dev/null +++ b/src/api/types/PromptResponseStop.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The string (or list of strings) after which the model will stop generating. The returned text will not contain the stop sequence. + */ +export type PromptResponseStop = string | string[]; diff --git a/src/api/types/PromptResponseTemplate.ts b/src/api/types/PromptResponseTemplate.ts new file mode 100644 index 0000000..4d04ef6 --- /dev/null +++ b/src/api/types/PromptResponseTemplate.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * For chat endpoint, provide a Chat template. For completion endpoint, provide a Prompt template. Input variables within the template should be specified with double curly bracket syntax: {{INPUT_NAME}}. + */ +export type PromptResponseTemplate = string | Humanloop.ChatMessage[]; diff --git a/src/api/types/ProviderApiKeys.ts b/src/api/types/ProviderApiKeys.ts new file mode 100644 index 0000000..ab27e0f --- /dev/null +++ b/src/api/types/ProviderApiKeys.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ProviderApiKeys { + openai?: string; + ai21?: string; + mock?: string; + anthropic?: string; + cohere?: string; + openaiAzure?: string; + openaiAzureEndpoint?: string; +} diff --git a/src/api/types/ResponseFormat.ts b/src/api/types/ResponseFormat.ts new file mode 100644 index 0000000..3add5e4 --- /dev/null +++ b/src/api/types/ResponseFormat.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Response format of the model. + */ +export interface ResponseFormat { + type: "json_object"; +} diff --git a/src/api/types/SessionResponse.ts b/src/api/types/SessionResponse.ts new file mode 100644 index 0000000..abdc55f --- /dev/null +++ b/src/api/types/SessionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface SessionResponse { + /** Unique identifier for the Session. */ + id: string; + createdAt: Date; + updatedAt: Date; + /** List of Logs associated with this Session. */ + logs: Humanloop.PromptLogResponse[]; +} diff --git a/src/api/types/SortOrder.ts b/src/api/types/SortOrder.ts new file mode 100644 index 0000000..8687227 --- /dev/null +++ b/src/api/types/SortOrder.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type SortOrder = "asc" | "desc"; + +export const SortOrder = { + Asc: "asc", + Desc: "desc", +} as const; diff --git a/src/api/types/TextChatContent.ts b/src/api/types/TextChatContent.ts new file mode 100644 index 0000000..df46d43 --- /dev/null +++ b/src/api/types/TextChatContent.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TextChatContent { + type: "text"; + /** The message's text content. */ + text: string; +} diff --git a/src/api/types/TimeUnit.ts b/src/api/types/TimeUnit.ts new file mode 100644 index 0000000..d892ac0 --- /dev/null +++ b/src/api/types/TimeUnit.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type TimeUnit = "day" | "week" | "month"; + +export const TimeUnit = { + Day: "day", + Week: "week", + Month: "month", +} as const; diff --git a/src/api/types/ToolCall.ts b/src/api/types/ToolCall.ts new file mode 100644 index 0000000..c695808 --- /dev/null +++ b/src/api/types/ToolCall.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * A tool call to be made. + */ +export interface ToolCall { + id: string; + type: Humanloop.ChatToolType; + function: Humanloop.FunctionTool; +} diff --git a/src/api/types/ToolChoice.ts b/src/api/types/ToolChoice.ts new file mode 100644 index 0000000..35f3a41 --- /dev/null +++ b/src/api/types/ToolChoice.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Tool choice to force the model to use a tool. + */ +export interface ToolChoice { + type: Humanloop.ChatToolType; + function: Humanloop.FunctionToolChoice; +} diff --git a/src/api/types/ToolConfigRequest.ts b/src/api/types/ToolConfigRequest.ts new file mode 100644 index 0000000..def558c --- /dev/null +++ b/src/api/types/ToolConfigRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Definition of tool within a model config. + * + * The subset of ToolConfig parameters received by the chat endpoint. + * Does not have things like the signature or setup schema. + */ +export interface ToolConfigRequest { + /** The name of the tool shown to the model. */ + name: string; + /** The description of the tool shown to the model. */ + description?: string; + /** Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ */ + parameters?: Record; + /** Source of the tool. If defined at an organization level will be 'organization' else 'inline'. */ + source?: Humanloop.ToolSource; + /** Code source of the tool. */ + sourceCode?: string; + /** Other parameters that define the config. */ + other?: Record; + /** If is_preset = true, this is the name of the preset tool on Humanloop. This is used as the key to look up the Humanloop runtime of the tool */ + presetName?: string; + type: "tool"; +} diff --git a/src/api/types/ToolConfigResponse.ts b/src/api/types/ToolConfigResponse.ts new file mode 100644 index 0000000..286442d --- /dev/null +++ b/src/api/types/ToolConfigResponse.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ToolConfigResponse { + /** String ID of config. Starts with `config_`. */ + id: string; + /** Other parameters that define the config. */ + other?: Record; + type: "tool"; + /** The user who created the config. */ + createdBy?: Humanloop.BaseModelsUserResponse; + /** Whether the config is committed or not. */ + status: string; + /** Name for the tool referenced by the model. */ + name: string; + /** Description of the tool referenced by the model */ + description?: string; + /** Source of the tool. If defined at an organization level will be 'organization' else 'inline'. */ + source?: Humanloop.ToolSource; + /** Code source of the tool. */ + sourceCode?: string; + /** Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ */ + setupSchema?: Record; + /** Definition of parameters needed to run the tool. Provided in jsonschema format: https://json-schema.org/ */ + parameters?: Record; + /** The function signature of the tool when being called. */ + signature?: string; + /** Whether the tool is one where Humanloop defines runtime or not. */ + isPreset?: boolean; + /** If is_preset = true, this is the name of the preset tool on Humanloop. This is used as the key to lookup the Humanloop runtime of the tool */ + presetName?: string; +} diff --git a/src/api/types/ToolFunction.ts b/src/api/types/ToolFunction.ts new file mode 100644 index 0000000..859ace7 --- /dev/null +++ b/src/api/types/ToolFunction.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ToolFunction { + /** Name for the tool referenced by the model. */ + name: string; + /** Description of the tool referenced by the model */ + description: string; + /** Parameters needed to run the Tool, defined in JSON Schema format: https://json-schema.org/ */ + parameters?: Record; +} diff --git a/src/api/types/ToolKernelRequest.ts b/src/api/types/ToolKernelRequest.ts new file mode 100644 index 0000000..decf932 --- /dev/null +++ b/src/api/types/ToolKernelRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ToolKernelRequest { + /** Callable function specification of the Tool shown to the model for tool calling. */ + function?: Humanloop.ToolFunction; + /** Code source of the Tool. */ + sourceCode?: string; + /** Values needed to setup the Tool, defined in JSON Schema format: https://json-schema.org/ */ + setupValues?: Record; +} diff --git a/src/api/types/ToolResponse.ts b/src/api/types/ToolResponse.ts new file mode 100644 index 0000000..98fbe7c --- /dev/null +++ b/src/api/types/ToolResponse.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Request to create a new Tool. + */ +export interface ToolResponse { + /** Path of the Tool, including the name, which is used as a unique identifier. */ + path: string; + /** Unique identifier for the Tool. */ + id: string; + /** Name of the Tool, which is used as a unique identifier. */ + name: string; + /** Unique identifier for the specific Tool Version. If no query params provided, the default deployed Tool Version is returned. */ + versionId: string; + type?: "tool"; + /** The list of environments the Tool Version is deployed to. */ + environments?: Humanloop.EnvironmentResponse[]; + createdAt: Date; + updatedAt: Date; + /** The user who created the Tool. */ + createdBy?: Humanloop.UserResponse; + /** The status of the Tool Version. */ + status: Humanloop.VersionStatus; + lastUsedAt: Date; + /** Callable function specification of the Tool shown to the model for tool calling. */ + function?: Humanloop.ToolFunction; + /** Code source of the Tool. */ + sourceCode?: string; + /** Values needed to setup the Tool, defined in JSON Schema format: https://json-schema.org/ */ + setupValues?: Record; + /** Type of Tool. */ + toolType?: Humanloop.FilesToolType; + /** Message describing the changes made. */ + commitMessage?: string; + /** The number of logs that have been generated for this Tool Version */ + versionLogsCount: number; + /** The number of logs that have been generated across all Tool Versions */ + totalLogsCount: number; + /** Inputs associated to the Prompt. Inputs correspond to any of the variables used within the Tool template. */ + inputs: Humanloop.InputResponse[]; + /** Signature of the Tool. */ + signature?: string; + /** Aggregation of Evaluator results for the Tool Version. */ + evaluatorAggregates?: Humanloop.EvaluatorAggregate[]; +} diff --git a/src/api/types/ToolResultResponse.ts b/src/api/types/ToolResultResponse.ts new file mode 100644 index 0000000..2b5cef0 --- /dev/null +++ b/src/api/types/ToolResultResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A result from a tool used to populate the prompt template + */ +export interface ToolResultResponse { + id: string; + name: string; + signature: string; + result: string; +} diff --git a/src/api/types/ToolSource.ts b/src/api/types/ToolSource.ts new file mode 100644 index 0000000..3bbc5ba --- /dev/null +++ b/src/api/types/ToolSource.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Source of tool. Used to differentiate between tools and tool versions when they are combined in a list. + * + * V4 uses organization and inline. Those are deprecated and will be removed in favour of tool and tool_version. + */ +export type ToolSource = "organization" | "inline"; + +export const ToolSource = { + Organization: "organization", + Inline: "inline", +} as const; diff --git a/src/api/types/UpdateDatesetAction.ts b/src/api/types/UpdateDatesetAction.ts new file mode 100644 index 0000000..864afb9 --- /dev/null +++ b/src/api/types/UpdateDatesetAction.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type UpdateDatesetAction = "set" | "add" | "remove"; + +export const UpdateDatesetAction = { + Set: "set", + Add: "add", + Remove: "remove", +} as const; diff --git a/src/api/types/UserResponse.ts b/src/api/types/UserResponse.ts new file mode 100644 index 0000000..203e357 --- /dev/null +++ b/src/api/types/UserResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UserResponse { + /** Unique identifier for User. Starts with `usr`. */ + id: string; + /** The User's email address. */ + emailAddress: string; + /** The User's full name. */ + fullName?: string; +} diff --git a/src/api/types/ValidationError.ts b/src/api/types/ValidationError.ts new file mode 100644 index 0000000..83c7b70 --- /dev/null +++ b/src/api/types/ValidationError.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export interface ValidationError { + loc: Humanloop.ValidationErrorLocItem[]; + msg: string; + type: string; +} diff --git a/src/api/types/ValidationErrorLocItem.ts b/src/api/types/ValidationErrorLocItem.ts new file mode 100644 index 0000000..c97f7db --- /dev/null +++ b/src/api/types/ValidationErrorLocItem.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ValidationErrorLocItem = string | number; diff --git a/src/api/types/VersionDeploymentResponse.ts b/src/api/types/VersionDeploymentResponse.ts new file mode 100644 index 0000000..fb7332a --- /dev/null +++ b/src/api/types/VersionDeploymentResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * A variable reference to the Version deployed to an Environment + */ +export interface VersionDeploymentResponse { + /** The File that the deployed Version belongs to. */ + file: Humanloop.VersionDeploymentResponseFile; + /** The Environment that the Version is deployed to. */ + environment: Humanloop.EnvironmentResponse; + type: "environment"; +} diff --git a/src/api/types/VersionDeploymentResponseFile.ts b/src/api/types/VersionDeploymentResponseFile.ts new file mode 100644 index 0000000..0ef0ec1 --- /dev/null +++ b/src/api/types/VersionDeploymentResponseFile.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The File that the deployed Version belongs to. + */ +export type VersionDeploymentResponseFile = + | Humanloop.PromptResponse + | Humanloop.ToolResponse + | Humanloop.DatasetResponse + | Humanloop.EvaluatorResponse; diff --git a/src/api/types/VersionIdResponse.ts b/src/api/types/VersionIdResponse.ts new file mode 100644 index 0000000..8c04171 --- /dev/null +++ b/src/api/types/VersionIdResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * A reference to a specific Version by its ID + */ +export interface VersionIdResponse { + /** The specific Version being referenced. */ + version: Humanloop.VersionIdResponseVersion; + type: "version"; +} diff --git a/src/api/types/VersionIdResponseVersion.ts b/src/api/types/VersionIdResponseVersion.ts new file mode 100644 index 0000000..a48b83b --- /dev/null +++ b/src/api/types/VersionIdResponseVersion.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * The specific Version being referenced. + */ +export type VersionIdResponseVersion = + | Humanloop.PromptResponse + | Humanloop.ToolResponse + | Humanloop.DatasetResponse + | Humanloop.EvaluatorResponse; diff --git a/src/api/types/VersionReferenceResponse.ts b/src/api/types/VersionReferenceResponse.ts new file mode 100644 index 0000000..595769c --- /dev/null +++ b/src/api/types/VersionReferenceResponse.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type VersionReferenceResponse = Humanloop.VersionDeploymentResponse | Humanloop.VersionIdResponse; diff --git a/src/api/types/VersionStats.ts b/src/api/types/VersionStats.ts new file mode 100644 index 0000000..af0f979 --- /dev/null +++ b/src/api/types/VersionStats.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +/** + * Stats for an Evaluated Version in the Evaluation Report. + */ +export interface VersionStats { + /** Unique identifier for the Evaluated Version. */ + versionId: string; + /** The total number of existing Logs for this Evaluated Version within the Evaluation Report. These are Logs that have been generated by this Evaluated Version on a Datapoint belonging to the Evaluation Report's Dataset Version. */ + numLogs: number; + /** Stats for each Evaluator Version used to evaluate this Evaluated Version. */ + evaluatorVersionStats: Humanloop.VersionStatsEvaluatorVersionStatsItem[]; +} diff --git a/src/api/types/VersionStatsEvaluatorVersionStatsItem.ts b/src/api/types/VersionStatsEvaluatorVersionStatsItem.ts new file mode 100644 index 0000000..75b8b8c --- /dev/null +++ b/src/api/types/VersionStatsEvaluatorVersionStatsItem.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Humanloop from "../index"; + +export type VersionStatsEvaluatorVersionStatsItem = + | Humanloop.NumericEvaluatorVersionStats + | Humanloop.BooleanEvaluatorVersionStats; diff --git a/src/api/types/VersionStatus.ts b/src/api/types/VersionStatus.ts new file mode 100644 index 0000000..2358310 --- /dev/null +++ b/src/api/types/VersionStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumeration. + */ +export type VersionStatus = "uncommitted" | "committed" | "deleted"; + +export const VersionStatus = { + Uncommitted: "uncommitted", + Committed: "committed", + Deleted: "deleted", +} as const; diff --git a/src/api/types/index.ts b/src/api/types/index.ts new file mode 100644 index 0000000..0be8d33 --- /dev/null +++ b/src/api/types/index.ts @@ -0,0 +1,151 @@ +export * from "./AgentConfigResponse"; +export * from "./BaseMetricResponse"; +export * from "./BooleanEvaluatorVersionStats"; +export * from "./CategoricalFeedbackLabel"; +export * from "./ChatMessageContentItem"; +export * from "./ChatMessageContent"; +export * from "./ChatMessage"; +export * from "./ChatMessageWithToolCallContentItem"; +export * from "./ChatMessageWithToolCallContent"; +export * from "./ChatMessageWithToolCall"; +export * from "./ChatRole"; +export * from "./CodeEvaluatorRequest"; +export * from "./CommitRequest"; +export * from "./ConfigResponse"; +export * from "./CreateDatapointRequestTargetValue"; +export * from "./CreateDatapointRequest"; +export * from "./CreateEvaluationRequest"; +export * from "./CreatePromptLogResponse"; +export * from "./CreateToolLogResponse"; +export * from "./DashboardConfiguration"; +export * from "./DatapointResponseTargetValue"; +export * from "./DatapointResponse"; +export * from "./DatasetResponse"; +export * from "./DirectoryResponse"; +export * from "./DirectoryWithParentsAndChildrenResponseFilesItem"; +export * from "./DirectoryWithParentsAndChildrenResponse"; +export * from "./EnvironmentResponse"; +export * from "./EnvironmentTag"; +export * from "./EvaluatedVersionResponse"; +export * from "./EvaluateeRequest"; +export * from "./EvaluateeResponse"; +export * from "./EvaluationDebugResultResponseValue"; +export * from "./EvaluationDebugResultResponse"; +export * from "./EvaluationEvaluatorResponse"; +export * from "./EvaluationResponse"; +export * from "./EvaluationResultResponseValue"; +export * from "./EvaluationResultResponse"; +export * from "./EvaluationStats"; +export * from "./EvaluationStatus"; +export * from "./EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem"; +export * from "./EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem"; +export * from "./EvaluatorActivationDeactivationRequest"; +export * from "./EvaluatorAggregate"; +export * from "./EvaluatorArgumentsType"; +export * from "./EvaluatorConfigResponse"; +export * from "./EvaluatorResponseSpec"; +export * from "./EvaluatorResponse"; +export * from "./EvaluatorReturnTypeEnum"; +export * from "./ExperimentResponse"; +export * from "./ExperimentStatus"; +export * from "./ExperimentVersionResponse"; +export * from "./FeedbackClass"; +export * from "./FeedbackLabelStatus"; +export * from "./FeedbackResponseType"; +export * from "./FeedbackResponseValue"; +export * from "./FeedbackResponse"; +export * from "./FeedbackTypeModelType"; +export * from "./FeedbackTypeModel"; +export * from "./FeedbackTypes"; +export * from "./FileEnvironmentResponseFile"; +export * from "./FileEnvironmentResponse"; +export * from "./FunctionTool"; +export * from "./FunctionToolChoice"; +export * from "./GenericConfigResponse"; +export * from "./HttpValidationError"; +export * from "./HumanEvaluatorRequest"; +export * from "./ImageChatContent"; +export * from "./ImageUrlDetail"; +export * from "./ImageUrl"; +export * from "./InputResponse"; +export * from "./LlmEvaluatorRequest"; +export * from "./LabelSentiment"; +export * from "./LinkedToolRequest"; +export * from "./LinkedToolResponse"; +export * from "./ListDatasets"; +export * from "./ListEvaluators"; +export * from "./ListPrompts"; +export * from "./ListTools"; +export * from "./LogResponseJudgment"; +export * from "./LogResponseToolChoice"; +export * from "./LogResponse"; +export * from "./MetricValueResponse"; +export * from "./ModelConfigRequestStop"; +export * from "./ModelConfigRequestToolsItem"; +export * from "./ModelConfigRequest"; +export * from "./ModelConfigResponseStop"; +export * from "./ModelConfigResponse"; +export * from "./ModelConfigToolRequest"; +export * from "./ModelEndpoints"; +export * from "./ModelProviders"; +export * from "./MonitoringEvaluatorEnvironmentRequest"; +export * from "./MonitoringEvaluatorResponse"; +export * from "./MonitoringEvaluatorState"; +export * from "./MonitoringEvaluatorVersionRequest"; +export * from "./NumericEvaluatorVersionStats"; +export * from "./ObservabilityStatus"; +export * from "./OverallStats"; +export * from "./PaginatedDatapointResponse"; +export * from "./PaginatedDatasetResponse"; +export * from "./PaginatedEvaluationResponse"; +export * from "./PaginatedPromptLogResponse"; +export * from "./PaginatedSessionResponse"; +export * from "./PlatformAccessEnum"; +export * from "./PositiveLabel"; +export * from "./ProjectSortBy"; +export * from "./PromptCallLogResponse"; +export * from "./PromptCallResponseToolChoice"; +export * from "./PromptCallResponse"; +export * from "./PromptCallStreamResponse"; +export * from "./PromptKernelRequestTemplate"; +export * from "./PromptKernelRequestStop"; +export * from "./PromptKernelRequest"; +export * from "./PromptLogResponseToolChoice"; +export * from "./PromptLogResponse"; +export * from "./PromptResponseTemplate"; +export * from "./PromptResponseStop"; +export * from "./PromptResponse"; +export * from "./ProviderApiKeys"; +export * from "./ResponseFormat"; +export * from "./SessionResponse"; +export * from "./SortOrder"; +export * from "./TextChatContent"; +export * from "./TimeUnit"; +export * from "./ToolCall"; +export * from "./ToolChoice"; +export * from "./ToolConfigRequest"; +export * from "./ToolConfigResponse"; +export * from "./ToolFunction"; +export * from "./ToolKernelRequest"; +export * from "./ToolResultResponse"; +export * from "./ToolSource"; +export * from "./UpdateDatesetAction"; +export * from "./ValidationErrorLocItem"; +export * from "./ValidationError"; +export * from "./VersionDeploymentResponseFile"; +export * from "./VersionDeploymentResponse"; +export * from "./VersionIdResponseVersion"; +export * from "./VersionIdResponse"; +export * from "./VersionReferenceResponse"; +export * from "./VersionStatsEvaluatorVersionStatsItem"; +export * from "./VersionStats"; +export * from "./VersionStatus"; +export * from "./ChatToolType"; +export * from "./FilesToolType"; +export * from "./ConfigToolResponse"; +export * from "./FeedbackType"; +export * from "./BaseModelsUserResponse"; +export * from "./EvaluationsDatasetRequest"; +export * from "./EvaluationsRequest"; +export * from "./ToolResponse"; +export * from "./UserResponse"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts new file mode 100644 index 0000000..3664d09 --- /dev/null +++ b/src/core/fetcher/APIResponse.ts @@ -0,0 +1,12 @@ +export type APIResponse = SuccessfulResponse | FailedResponse; + +export interface SuccessfulResponse { + ok: true; + body: T; + headers?: Record; +} + +export interface FailedResponse { + ok: false; + error: T; +} diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts new file mode 100644 index 0000000..5106568 --- /dev/null +++ b/src/core/fetcher/Fetcher.ts @@ -0,0 +1,282 @@ +import qs from "qs"; +import { RUNTIME } from "../runtime"; +import { APIResponse } from "./APIResponse"; + +export type FetchFunction = (args: Fetcher.Args) => Promise>; + +export declare namespace Fetcher { + export interface Args { + url: string; + method: string; + contentType?: string; + headers?: Record; + queryParameters?: Record; + body?: unknown; + timeoutMs?: number; + maxRetries?: number; + withCredentials?: boolean; + abortSignal?: AbortSignal; + responseType?: "json" | "blob" | "streaming" | "text"; + } + + export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; + + export interface FailedStatusCodeError { + reason: "status-code"; + statusCode: number; + body: unknown; + } + + export interface NonJsonError { + reason: "non-json"; + statusCode: number; + rawBody: string; + } + + export interface TimeoutError { + reason: "timeout"; + } + + export interface UnknownError { + reason: "unknown"; + errorMessage: string; + } +} + +const INITIAL_RETRY_DELAY = 1; +const MAX_RETRY_DELAY = 60; +const DEFAULT_MAX_RETRIES = 2; + +async function fetcherImpl(args: Fetcher.Args): Promise> { + const headers: Record = {}; + if (args.body !== undefined && args.contentType != null) { + headers["Content-Type"] = args.contentType; + } + + if (args.headers != null) { + for (const [key, value] of Object.entries(args.headers)) { + if (value != null) { + headers[key] = value; + } + } + } + + const url = + Object.keys(args.queryParameters ?? {}).length > 0 + ? `${args.url}?${qs.stringify(args.queryParameters, { arrayFormat: "repeat" })}` + : args.url; + + let body: BodyInit | undefined = undefined; + const maybeStringifyBody = (body: any) => { + if (body instanceof Uint8Array) { + return body; + } else if (args.contentType === "application/x-www-form-urlencoded" && typeof args.body === "string") { + return args.body; + } else { + return JSON.stringify(body); + } + }; + + if (RUNTIME.type === "node") { + if (args.body instanceof (await import("formdata-node")).FormData) { + // @ts-expect-error + body = args.body; + } else { + body = maybeStringifyBody(args.body); + } + } else { + if (args.body instanceof (await import("form-data")).default) { + // @ts-expect-error + body = args.body; + } else { + body = maybeStringifyBody(args.body); + } + } + + const fetchFn = await getFetchFn(); + + const makeRequest = async (): Promise => { + const signals: AbortSignal[] = []; + + // Add timeout signal + let timeoutAbortId: NodeJS.Timeout | undefined = undefined; + if (args.timeoutMs != null) { + const { signal, abortId } = getTimeoutSignal(args.timeoutMs); + timeoutAbortId = abortId; + signals.push(signal); + } + + // Add arbitrary signal + if (args.abortSignal != null) { + signals.push(args.abortSignal); + } + + const response = await fetchFn(url, { + method: args.method, + headers, + body, + signal: anySignal(signals), + credentials: args.withCredentials ? "include" : undefined, + }); + + if (timeoutAbortId != null) { + clearTimeout(timeoutAbortId); + } + + return response; + }; + + try { + let response = await makeRequest(); + + for (let i = 0; i < (args.maxRetries ?? DEFAULT_MAX_RETRIES); ++i) { + if ( + response.status === 408 || + response.status === 409 || + response.status === 429 || + response.status >= 500 + ) { + const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY); + await new Promise((resolve) => setTimeout(resolve, delay)); + response = await makeRequest(); + } else { + break; + } + } + + let body: unknown; + if (response.body != null && args.responseType === "blob") { + body = await response.blob(); + } else if (response.body != null && args.responseType === "streaming") { + body = response.body; + } else if (response.body != null && args.responseType === "text") { + body = await response.text(); + } else { + const text = await response.text(); + if (text.length > 0) { + try { + body = JSON.parse(text); + } catch (err) { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: text, + }, + }; + } + } + } + + if (response.status >= 200 && response.status < 400) { + return { + ok: true, + body: body as R, + headers: response.headers, + }; + } else { + return { + ok: false, + error: { + reason: "status-code", + statusCode: response.status, + body, + }, + }; + } + } catch (error) { + if (args.abortSignal != null && args.abortSignal.aborted) { + return { + ok: false, + error: { + reason: "unknown", + errorMessage: "The user aborted a request", + }, + }; + } else if (error instanceof Error && error.name === "AbortError") { + return { + ok: false, + error: { + reason: "timeout", + }, + }; + } else if (error instanceof Error) { + return { + ok: false, + error: { + reason: "unknown", + errorMessage: error.message, + }, + }; + } + + return { + ok: false, + error: { + reason: "unknown", + errorMessage: JSON.stringify(error), + }, + }; + } +} + +const TIMEOUT = "timeout"; + +function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: NodeJS.Timeout } { + const controller = new AbortController(); + const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs); + return { signal: controller.signal, abortId }; +} + +/** + * Returns an abort signal that is getting aborted when + * at least one of the specified abort signals is aborted. + * + * Requires at least node.js 18. + */ +function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { + // Allowing signals to be passed either as array + // of signals or as multiple arguments. + const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args); + + const controller = new AbortController(); + + for (const signal of signals) { + if (signal.aborted) { + // Exiting early if one of the signals + // is already aborted. + controller.abort((signal as any)?.reason); + break; + } + + // Listening for signals and removing the listeners + // when at least one symbol is aborted. + signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { + signal: controller.signal, + }); + } + + return controller.signal; +} + +/** + * Returns a fetch function based on the runtime + */ +async function getFetchFn(): Promise { + // In Node.js environments, the SDK always uses`node-fetch`. + if (RUNTIME.type === "node") { + return (await import("node-fetch")).default as any; + } + + // Otherwise the SDK uses global fetch if available, + // and falls back to node-fetch. + if (typeof fetch == "function") { + return fetch; + } + + // Defaults to node `node-fetch` if global fetch isn't available + return (await import("node-fetch")).default as any; +} + +export const fetcher: FetchFunction = fetcherImpl; diff --git a/src/core/fetcher/Supplier.ts b/src/core/fetcher/Supplier.ts new file mode 100644 index 0000000..867c931 --- /dev/null +++ b/src/core/fetcher/Supplier.ts @@ -0,0 +1,11 @@ +export type Supplier = T | Promise | (() => T | Promise); + +export const Supplier = { + get: async (supplier: Supplier): Promise => { + if (typeof supplier === "function") { + return (supplier as () => T)(); + } else { + return supplier; + } + }, +}; diff --git a/src/core/fetcher/getHeader.ts b/src/core/fetcher/getHeader.ts new file mode 100644 index 0000000..50f922b --- /dev/null +++ b/src/core/fetcher/getHeader.ts @@ -0,0 +1,8 @@ +export function getHeader(headers: Record, header: string): string | undefined { + for (const [headerKey, headerValue] of Object.entries(headers)) { + if (headerKey.toLowerCase() === header.toLowerCase()) { + return headerValue; + } + } + return undefined; +} diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts new file mode 100644 index 0000000..2d658ca --- /dev/null +++ b/src/core/fetcher/index.ts @@ -0,0 +1,5 @@ +export type { APIResponse } from "./APIResponse"; +export { fetcher } from "./Fetcher"; +export type { Fetcher, FetchFunction } from "./Fetcher"; +export { getHeader } from "./getHeader"; +export { Supplier } from "./Supplier"; diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..e300686 --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,3 @@ +export * from "./fetcher"; +export * from "./runtime"; +export * as serialization from "./schemas"; diff --git a/src/core/runtime/index.ts b/src/core/runtime/index.ts new file mode 100644 index 0000000..5c76dbb --- /dev/null +++ b/src/core/runtime/index.ts @@ -0,0 +1 @@ +export { RUNTIME } from "./runtime"; diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts new file mode 100644 index 0000000..30fe077 --- /dev/null +++ b/src/core/runtime/runtime.ts @@ -0,0 +1,124 @@ +interface DenoGlobal { + version: { + deno: string; + }; +} + +interface BunGlobal { + version: string; +} + +declare const Deno: DenoGlobal; +declare const Bun: BunGlobal; + +/** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ +const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; + +/** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ +const isWebWorker = + typeof self === "object" && + // @ts-ignore + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); + +/** + * A constant that indicates whether the environment the code is running is Deno. + */ +const isDeno = + typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; + +/** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ +const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; + +/** + * A constant that indicates whether the environment the code is running is Node.JS. + */ +const isNode = + typeof process !== "undefined" && + Boolean(process.version) && + Boolean(process.versions?.node) && + // Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions + !isDeno && + !isBun; + +/** + * A constant that indicates whether the environment the code is running is in React-Native. + * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js + */ +const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; + +/** + * A constant that indicates whether the environment the code is running is Cloudflare. + * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent + */ +const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; + +/** + * A constant that indicates which environment and version the SDK is running in. + */ +export const RUNTIME: Runtime = evaluateRuntime(); + +export interface Runtime { + type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; + version?: string; +} + +function evaluateRuntime(): Runtime { + if (isBrowser) { + return { + type: "browser", + version: window.navigator.userAgent, + }; + } + + if (isCloudflare) { + return { + type: "workerd", + }; + } + + if (isWebWorker) { + return { + type: "web-worker", + }; + } + + if (isDeno) { + return { + type: "deno", + version: Deno.version.deno, + }; + } + + if (isBun) { + return { + type: "bun", + version: Bun.version, + }; + } + + if (isNode) { + return { + type: "node", + version: process.versions.node, + }; + } + + if (isReactNative) { + return { + type: "react-native", + }; + } + + return { + type: "unknown", + }; +} diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts new file mode 100644 index 0000000..870f373 --- /dev/null +++ b/src/core/schemas/Schema.ts @@ -0,0 +1,94 @@ +import { SchemaUtils } from "./builders"; +import { MaybePromise } from "./utils/MaybePromise"; + +export type Schema = BaseSchema & SchemaUtils; + +export type inferRaw = S extends Schema ? Raw : never; +export type inferParsed = S extends Schema ? Parsed : never; + +export interface BaseSchema { + parse: (raw: unknown, opts?: SchemaOptions) => MaybePromise>; + json: (parsed: unknown, opts?: SchemaOptions) => MaybePromise>; + getType: () => SchemaType | Promise; +} + +export const SchemaType = { + DATE: "date", + ENUM: "enum", + LIST: "list", + STRING_LITERAL: "stringLiteral", + BOOLEAN_LITERAL: "booleanLiteral", + OBJECT: "object", + ANY: "any", + BOOLEAN: "boolean", + NUMBER: "number", + STRING: "string", + UNKNOWN: "unknown", + RECORD: "record", + SET: "set", + UNION: "union", + UNDISCRIMINATED_UNION: "undiscriminatedUnion", + OPTIONAL: "optional", +} as const; +export type SchemaType = typeof SchemaType[keyof typeof SchemaType]; + +export type MaybeValid = Valid | Invalid; + +export interface Valid { + ok: true; + value: T; +} + +export interface Invalid { + ok: false; + errors: ValidationError[]; +} + +export interface ValidationError { + path: string[]; + message: string; +} + +export interface SchemaOptions { + /** + * how to handle unrecognized keys in objects + * + * @default "fail" + */ + unrecognizedObjectKeys?: "fail" | "passthrough" | "strip"; + + /** + * whether to fail when an unrecognized discriminant value is + * encountered in a union + * + * @default false + */ + allowUnrecognizedUnionMembers?: boolean; + + /** + * whether to fail when an unrecognized enum value is encountered + * + * @default false + */ + allowUnrecognizedEnumValues?: boolean; + + /** + * whether to allow data that doesn't conform to the schema. + * invalid data is passed through without transformation. + * + * when this is enabled, .parse() and .json() will always + * return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()` + * will never fail. + * + * @default false + */ + skipValidation?: boolean; + + /** + * each validation failure contains a "path" property, which is + * the breadcrumbs to the offending node in the JSON. you can supply + * a prefix that is prepended to all the errors' paths. this can be + * helpful for zurg's internal debug logging. + */ + breadcrumbsPrefix?: string[]; +} diff --git a/src/core/schemas/builders/date/date.ts b/src/core/schemas/builders/date/date.ts new file mode 100644 index 0000000..b70f24b --- /dev/null +++ b/src/core/schemas/builders/date/date.ts @@ -0,0 +1,65 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime +const ISO_8601_REGEX = + /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; + +export function date(): Schema { + const baseSchema: BaseSchema = { + parse: (raw, { breadcrumbsPrefix = [] } = {}) => { + if (typeof raw !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "string"), + }, + ], + }; + } + if (!ISO_8601_REGEX.test(raw)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"), + }, + ], + }; + } + return { + ok: true, + value: new Date(raw), + }; + }, + json: (date, { breadcrumbsPrefix = [] } = {}) => { + if (date instanceof Date) { + return { + ok: true, + value: date.toISOString(), + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(date, "Date object"), + }, + ], + }; + } + }, + getType: () => SchemaType.DATE, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/date/index.ts b/src/core/schemas/builders/date/index.ts new file mode 100644 index 0000000..187b290 --- /dev/null +++ b/src/core/schemas/builders/date/index.ts @@ -0,0 +1 @@ +export { date } from "./date"; diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts new file mode 100644 index 0000000..c1e24d6 --- /dev/null +++ b/src/core/schemas/builders/enum/enum.ts @@ -0,0 +1,43 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function enum_(values: E): Schema { + const validValues = new Set(values); + + const schemaCreator = createIdentitySchemaCreator( + SchemaType.ENUM, + (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => { + if (typeof value !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "string"), + }, + ], + }; + } + + if (!validValues.has(value) && !allowUnrecognizedEnumValues) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "enum"), + }, + ], + }; + } + + return { + ok: true, + value: value as U, + }; + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/enum/index.ts b/src/core/schemas/builders/enum/index.ts new file mode 100644 index 0000000..fe6faed --- /dev/null +++ b/src/core/schemas/builders/enum/index.ts @@ -0,0 +1 @@ +export { enum_ } from "./enum"; diff --git a/src/core/schemas/builders/index.ts b/src/core/schemas/builders/index.ts new file mode 100644 index 0000000..050cd2c --- /dev/null +++ b/src/core/schemas/builders/index.ts @@ -0,0 +1,13 @@ +export * from "./date"; +export * from "./enum"; +export * from "./lazy"; +export * from "./list"; +export * from "./literals"; +export * from "./object"; +export * from "./object-like"; +export * from "./primitives"; +export * from "./record"; +export * from "./schema-utils"; +export * from "./set"; +export * from "./undiscriminated-union"; +export * from "./union"; diff --git a/src/core/schemas/builders/lazy/index.ts b/src/core/schemas/builders/lazy/index.ts new file mode 100644 index 0000000..77420fb --- /dev/null +++ b/src/core/schemas/builders/lazy/index.ts @@ -0,0 +1,3 @@ +export { lazy } from "./lazy"; +export type { SchemaGetter } from "./lazy"; +export { lazyObject } from "./lazyObject"; diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts new file mode 100644 index 0000000..a665472 --- /dev/null +++ b/src/core/schemas/builders/lazy/lazy.ts @@ -0,0 +1,34 @@ +import { BaseSchema, Schema } from "../../Schema"; +import { getSchemaUtils } from "../schema-utils"; + +export type SchemaGetter> = () => SchemaType | Promise; + +export function lazy(getter: SchemaGetter>): Schema { + const baseSchema = constructLazyBaseSchema(getter); + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function constructLazyBaseSchema( + getter: SchemaGetter> +): BaseSchema { + return { + parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts), + json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts), + getType: async () => (await getMemoizedSchema(getter)).getType(), + }; +} + +type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; + +export async function getMemoizedSchema>( + getter: SchemaGetter +): Promise { + const castedGetter = getter as MemoizedGetter; + if (castedGetter.__zurg_memoized == null) { + castedGetter.__zurg_memoized = await getter(); + } + return castedGetter.__zurg_memoized; +} diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts new file mode 100644 index 0000000..e48c016 --- /dev/null +++ b/src/core/schemas/builders/lazy/lazyObject.ts @@ -0,0 +1,20 @@ +import { getObjectUtils } from "../object"; +import { getObjectLikeUtils } from "../object-like"; +import { BaseObjectSchema, ObjectSchema } from "../object/types"; +import { getSchemaUtils } from "../schema-utils"; +import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy"; + +export function lazyObject(getter: SchemaGetter>): ObjectSchema { + const baseSchema: BaseObjectSchema = { + ...constructLazyBaseSchema(getter), + _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(), + _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties(), + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/list/index.ts b/src/core/schemas/builders/list/index.ts new file mode 100644 index 0000000..25f4bcc --- /dev/null +++ b/src/core/schemas/builders/list/index.ts @@ -0,0 +1 @@ +export { list } from "./list"; diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts new file mode 100644 index 0000000..b333321 --- /dev/null +++ b/src/core/schemas/builders/list/list.ts @@ -0,0 +1,74 @@ +import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +export function list(schema: Schema): Schema { + const baseSchema: BaseSchema = { + parse: async (raw, opts) => + validateAndTransformArray(raw, (item, index) => + schema.parse(item, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], + }) + ), + json: (parsed, opts) => + validateAndTransformArray(parsed, (item, index) => + schema.json(item, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], + }) + ), + getType: () => SchemaType.LIST, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +async function validateAndTransformArray( + value: unknown, + transformItem: (item: Raw, index: number) => MaybePromise> +): Promise> { + if (!Array.isArray(value)) { + return { + ok: false, + errors: [ + { + message: getErrorMessageForIncorrectType(value, "list"), + path: [], + }, + ], + }; + } + + const maybeValidItems = await Promise.all(value.map((item, index) => transformItem(item, index))); + + return maybeValidItems.reduce>( + (acc, item) => { + if (acc.ok && item.ok) { + return { + ok: true, + value: [...acc.value, item.value], + }; + } + + const errors: ValidationError[] = []; + if (!acc.ok) { + errors.push(...acc.errors); + } + if (!item.ok) { + errors.push(...item.errors); + } + + return { + ok: false, + errors, + }; + }, + { ok: true, value: [] } + ); +} diff --git a/src/core/schemas/builders/literals/booleanLiteral.ts b/src/core/schemas/builders/literals/booleanLiteral.ts new file mode 100644 index 0000000..a83d22c --- /dev/null +++ b/src/core/schemas/builders/literals/booleanLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function booleanLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.BOOLEAN_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `${literal.toString()}`), + }, + ], + }; + } + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/literals/index.ts b/src/core/schemas/builders/literals/index.ts new file mode 100644 index 0000000..d2bf08f --- /dev/null +++ b/src/core/schemas/builders/literals/index.ts @@ -0,0 +1,2 @@ +export { stringLiteral } from "./stringLiteral"; +export { booleanLiteral } from "./booleanLiteral"; diff --git a/src/core/schemas/builders/literals/stringLiteral.ts b/src/core/schemas/builders/literals/stringLiteral.ts new file mode 100644 index 0000000..3939b76 --- /dev/null +++ b/src/core/schemas/builders/literals/stringLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function stringLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.STRING_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `"${literal}"`), + }, + ], + }; + } + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts new file mode 100644 index 0000000..270ea17 --- /dev/null +++ b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts @@ -0,0 +1,79 @@ +import { BaseSchema } from "../../Schema"; +import { filterObject } from "../../utils/filterObject"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { getSchemaUtils } from "../schema-utils"; +import { ObjectLikeSchema, ObjectLikeUtils } from "./types"; + +export function getObjectLikeUtils(schema: BaseSchema): ObjectLikeUtils { + return { + withParsedProperties: (properties) => withParsedProperties(schema, properties), + }; +} + +/** + * object-like utils are defined in one file to resolve issues with circular imports + */ + +export function withParsedProperties( + objectLike: BaseSchema, + properties: { [K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]) } +): ObjectLikeSchema { + const objectSchema: BaseSchema = { + parse: async (raw, opts) => { + const parsedObject = await objectLike.parse(raw, opts); + if (!parsedObject.ok) { + return parsedObject; + } + + const additionalProperties = Object.entries(properties).reduce>( + (processed, [key, value]) => { + return { + ...processed, + [key]: typeof value === "function" ? value(parsedObject.value) : value, + }; + }, + {} + ); + + return { + ok: true, + value: { + ...parsedObject.value, + ...(additionalProperties as Properties), + }, + }; + }, + + json: (parsed, opts) => { + if (!isPlainObject(parsed)) { + return { + ok: false, + errors: [ + { + path: opts?.breadcrumbsPrefix ?? [], + message: getErrorMessageForIncorrectType(parsed, "object"), + }, + ], + }; + } + + // strip out added properties + const addedPropertyKeys = new Set(Object.keys(properties)); + const parsedWithoutAddedProperties = filterObject( + parsed, + Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)) + ); + + return objectLike.json(parsedWithoutAddedProperties as ParsedObjectShape, opts); + }, + + getType: () => objectLike.getType(), + }; + + return { + ...objectSchema, + ...getSchemaUtils(objectSchema), + ...getObjectLikeUtils(objectSchema), + }; +} diff --git a/src/core/schemas/builders/object-like/index.ts b/src/core/schemas/builders/object-like/index.ts new file mode 100644 index 0000000..c342e72 --- /dev/null +++ b/src/core/schemas/builders/object-like/index.ts @@ -0,0 +1,2 @@ +export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils"; +export type { ObjectLikeSchema, ObjectLikeUtils } from "./types"; diff --git a/src/core/schemas/builders/object-like/types.ts b/src/core/schemas/builders/object-like/types.ts new file mode 100644 index 0000000..75b3698 --- /dev/null +++ b/src/core/schemas/builders/object-like/types.ts @@ -0,0 +1,11 @@ +import { BaseSchema, Schema } from "../../Schema"; + +export type ObjectLikeSchema = Schema & + BaseSchema & + ObjectLikeUtils; + +export interface ObjectLikeUtils { + withParsedProperties: >(properties: { + [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); + }) => ObjectLikeSchema; +} diff --git a/src/core/schemas/builders/object/index.ts b/src/core/schemas/builders/object/index.ts new file mode 100644 index 0000000..e3f4388 --- /dev/null +++ b/src/core/schemas/builders/object/index.ts @@ -0,0 +1,22 @@ +export { getObjectUtils, object } from "./object"; +export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties"; +export type { + inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, +} from "./objectWithoutOptionalProperties"; +export { isProperty, property } from "./property"; +export type { Property } from "./property"; +export type { + BaseObjectSchema, + inferObjectSchemaFromPropertySchemas, + inferParsedObject, + inferParsedObjectFromPropertySchemas, + inferParsedPropertySchema, + inferRawKey, + inferRawObject, + inferRawObjectFromPropertySchemas, + inferRawPropertySchema, + ObjectSchema, + ObjectUtils, + PropertySchemas, +} from "./types"; diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts new file mode 100644 index 0000000..6427678 --- /dev/null +++ b/src/core/schemas/builders/object/object.ts @@ -0,0 +1,333 @@ +import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { entries } from "../../utils/entries"; +import { filterObject } from "../../utils/filterObject"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { keys } from "../../utils/keys"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { partition } from "../../utils/partition"; +import { getObjectLikeUtils } from "../object-like"; +import { getSchemaUtils } from "../schema-utils"; +import { isProperty } from "./property"; +import { + BaseObjectSchema, + inferObjectSchemaFromPropertySchemas, + inferParsedObjectFromPropertySchemas, + inferRawObjectFromPropertySchemas, + ObjectSchema, + ObjectUtils, + PropertySchemas, +} from "./types"; + +interface ObjectPropertyWithRawKey { + rawKey: string; + parsedKey: string; + valueSchema: Schema; +} + +export function object>( + schemas: T +): inferObjectSchemaFromPropertySchemas { + const baseSchema: BaseObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas + > = { + _getRawProperties: () => + Promise.resolve( + Object.entries(schemas).map(([parsedKey, propertySchema]) => + isProperty(propertySchema) ? propertySchema.rawKey : parsedKey + ) as unknown as (keyof inferRawObjectFromPropertySchemas)[] + ), + _getParsedProperties: () => + Promise.resolve(keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[]), + + parse: async (raw, opts) => { + const rawKeyToProperty: Record = {}; + const requiredKeys: string[] = []; + + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey; + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; + + const property: ObjectPropertyWithRawKey = { + rawKey, + parsedKey: parsedKey as string, + valueSchema, + }; + + rawKeyToProperty[rawKey] = property; + + if (isSchemaRequired(valueSchema)) { + requiredKeys.push(rawKey); + } + } + + return validateAndTransformObject({ + value: raw, + requiredKeys, + getProperty: (rawKey) => { + const property = rawKeyToProperty[rawKey]; + if (property == null) { + return undefined; + } + return { + transformedKey: property.parsedKey, + transform: (propertyValue) => + property.valueSchema.parse(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawKey], + }), + }; + }, + unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, + skipValidation: opts?.skipValidation, + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + + json: async (parsed, opts) => { + const requiredKeys: string[] = []; + + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; + + if (isSchemaRequired(valueSchema)) { + requiredKeys.push(parsedKey as string); + } + } + + return validateAndTransformObject({ + value: parsed, + requiredKeys, + getProperty: ( + parsedKey + ): + | { transformedKey: string; transform: (propertyValue: unknown) => MaybePromise> } + | undefined => { + const property = schemas[parsedKey as keyof T]; + + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (property == null) { + return undefined; + } + + if (isProperty(property)) { + return { + transformedKey: property.rawKey, + transform: (propertyValue) => + property.valueSchema.json(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], + }), + }; + } else { + return { + transformedKey: parsedKey, + transform: (propertyValue) => + property.json(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], + }), + }; + } + }, + unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, + skipValidation: opts?.skipValidation, + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + + getType: () => SchemaType.OBJECT, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; +} + +async function validateAndTransformObject({ + value, + requiredKeys, + getProperty, + unrecognizedObjectKeys = "fail", + skipValidation = false, + breadcrumbsPrefix = [], +}: { + value: unknown; + requiredKeys: string[]; + getProperty: ( + preTransformedKey: string + ) => { transformedKey: string; transform: (propertyValue: unknown) => MaybePromise> } | undefined; + unrecognizedObjectKeys: "fail" | "passthrough" | "strip" | undefined; + skipValidation: boolean | undefined; + breadcrumbsPrefix: string[] | undefined; +}): Promise> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + const missingRequiredKeys = new Set(requiredKeys); + const errors: ValidationError[] = []; + const transformed: Record = {}; + + for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) { + const property = getProperty(preTransformedKey); + + if (property != null) { + missingRequiredKeys.delete(preTransformedKey); + + const value = await property.transform(preTransformedItemValue); + if (value.ok) { + transformed[property.transformedKey] = value.value; + } else { + transformed[preTransformedKey] = preTransformedItemValue; + errors.push(...value.errors); + } + } else { + switch (unrecognizedObjectKeys) { + case "fail": + errors.push({ + path: [...breadcrumbsPrefix, preTransformedKey], + message: `Unexpected key "${preTransformedKey}"`, + }); + break; + case "strip": + break; + case "passthrough": + transformed[preTransformedKey] = preTransformedItemValue; + break; + } + } + } + + errors.push( + ...requiredKeys + .filter((key) => missingRequiredKeys.has(key)) + .map((key) => ({ + path: breadcrumbsPrefix, + message: `Missing required key "${key}"`, + })) + ); + + if (errors.length === 0 || skipValidation) { + return { + ok: true, + value: transformed as Transformed, + }; + } else { + return { + ok: false, + errors, + }; + } +} + +export function getObjectUtils(schema: BaseObjectSchema): ObjectUtils { + return { + extend: (extension: ObjectSchema) => { + const baseSchema: BaseObjectSchema = { + _getParsedProperties: async () => [ + ...(await schema._getParsedProperties()), + ...(await extension._getParsedProperties()), + ], + _getRawProperties: async () => [ + ...(await schema._getRawProperties()), + ...(await extension._getRawProperties()), + ], + parse: async (raw, opts) => { + return validateAndTransformExtendedObject({ + extensionKeys: await extension._getRawProperties(), + value: raw, + transformBase: (rawBase) => schema.parse(rawBase, opts), + transformExtension: (rawExtension) => extension.parse(rawExtension, opts), + }); + }, + json: async (parsed, opts) => { + return validateAndTransformExtendedObject({ + extensionKeys: await extension._getParsedProperties(), + value: parsed, + transformBase: (parsedBase) => schema.json(parsedBase, opts), + transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), + }); + }, + getType: () => SchemaType.OBJECT, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; + }, + }; +} + +async function validateAndTransformExtendedObject({ + extensionKeys, + value, + transformBase, + transformExtension, +}: { + extensionKeys: (keyof PreTransformedExtension)[]; + value: unknown; + transformBase: (value: unknown) => MaybePromise>; + transformExtension: (value: unknown) => MaybePromise>; +}): Promise> { + const extensionPropertiesSet = new Set(extensionKeys); + const [extensionProperties, baseProperties] = partition(keys(value), (key) => + extensionPropertiesSet.has(key as keyof PreTransformedExtension) + ); + + const transformedBase = await transformBase(filterObject(value, baseProperties)); + const transformedExtension = await transformExtension(filterObject(value, extensionProperties)); + + if (transformedBase.ok && transformedExtension.ok) { + return { + ok: true, + value: { + ...transformedBase.value, + ...transformedExtension.value, + }, + }; + } else { + return { + ok: false, + errors: [ + ...(transformedBase.ok ? [] : transformedBase.errors), + ...(transformedExtension.ok ? [] : transformedExtension.errors), + ], + }; + } +} + +function isSchemaRequired(schema: Schema): boolean { + return !isSchemaOptional(schema); +} + +function isSchemaOptional(schema: Schema): boolean { + switch (schema.getType()) { + case SchemaType.ANY: + case SchemaType.UNKNOWN: + case SchemaType.OPTIONAL: + return true; + default: + return false; + } +} diff --git a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts new file mode 100644 index 0000000..a0951f4 --- /dev/null +++ b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts @@ -0,0 +1,18 @@ +import { object } from "./object"; +import { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, ObjectSchema, PropertySchemas } from "./types"; + +export function objectWithoutOptionalProperties>( + schemas: T +): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas { + return object(schemas) as unknown as inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas; +} + +export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas> = + ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas + >; + +export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas> = { + [K in keyof T]: inferParsedPropertySchema; +}; diff --git a/src/core/schemas/builders/object/property.ts b/src/core/schemas/builders/object/property.ts new file mode 100644 index 0000000..d245c4b --- /dev/null +++ b/src/core/schemas/builders/object/property.ts @@ -0,0 +1,23 @@ +import { Schema } from "../../Schema"; + +export function property( + rawKey: RawKey, + valueSchema: Schema +): Property { + return { + rawKey, + valueSchema, + isProperty: true, + }; +} + +export interface Property { + rawKey: RawKey; + valueSchema: Schema; + isProperty: true; +} + +export function isProperty>(maybeProperty: unknown): maybeProperty is O { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + return (maybeProperty as O).isProperty; +} diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts new file mode 100644 index 0000000..17cff4f --- /dev/null +++ b/src/core/schemas/builders/object/types.ts @@ -0,0 +1,72 @@ +import { BaseSchema, inferParsed, inferRaw, Schema } from "../../Schema"; +import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties"; +import { ObjectLikeUtils } from "../object-like"; +import { SchemaUtils } from "../schema-utils"; +import { Property } from "./property"; + +export type ObjectSchema = BaseObjectSchema & + ObjectLikeUtils & + ObjectUtils & + SchemaUtils; + +export interface BaseObjectSchema extends BaseSchema { + _getRawProperties: () => Promise<(keyof Raw)[]>; + _getParsedProperties: () => Promise<(keyof Parsed)[]>; +} + +export interface ObjectUtils { + extend: ( + schemas: ObjectSchema + ) => ObjectSchema; +} + +export type inferRawObject> = O extends ObjectSchema ? Raw : never; + +export type inferParsedObject> = O extends ObjectSchema + ? Parsed + : never; + +export type inferObjectSchemaFromPropertySchemas> = ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas +>; + +export type inferRawObjectFromPropertySchemas> = + addQuestionMarksToNullableProperties<{ + [ParsedKey in keyof T as inferRawKey]: inferRawPropertySchema; + }>; + +export type inferParsedObjectFromPropertySchemas> = + addQuestionMarksToNullableProperties<{ + [K in keyof T]: inferParsedPropertySchema; + }>; + +export type PropertySchemas = Record< + ParsedKeys, + Property | Schema +>; + +export type inferRawPropertySchema

| Schema> = P extends Property< + any, + infer Raw, + any +> + ? Raw + : P extends Schema + ? inferRaw

+ : never; + +export type inferParsedPropertySchema

| Schema> = P extends Property< + any, + any, + infer Parsed +> + ? Parsed + : P extends Schema + ? inferParsed

+ : never; + +export type inferRawKey< + ParsedKey extends string | number | symbol, + P extends Property | Schema +> = P extends Property ? Raw : ParsedKey; diff --git a/src/core/schemas/builders/primitives/any.ts b/src/core/schemas/builders/primitives/any.ts new file mode 100644 index 0000000..fcaeb04 --- /dev/null +++ b/src/core/schemas/builders/primitives/any.ts @@ -0,0 +1,4 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; + +export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/primitives/boolean.ts b/src/core/schemas/builders/primitives/boolean.ts new file mode 100644 index 0000000..fad6056 --- /dev/null +++ b/src/core/schemas/builders/primitives/boolean.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const boolean = createIdentitySchemaCreator( + SchemaType.BOOLEAN, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "boolean") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "boolean"), + }, + ], + }; + } + } +); diff --git a/src/core/schemas/builders/primitives/index.ts b/src/core/schemas/builders/primitives/index.ts new file mode 100644 index 0000000..788f941 --- /dev/null +++ b/src/core/schemas/builders/primitives/index.ts @@ -0,0 +1,5 @@ +export { any } from "./any"; +export { boolean } from "./boolean"; +export { number } from "./number"; +export { string } from "./string"; +export { unknown } from "./unknown"; diff --git a/src/core/schemas/builders/primitives/number.ts b/src/core/schemas/builders/primitives/number.ts new file mode 100644 index 0000000..c268945 --- /dev/null +++ b/src/core/schemas/builders/primitives/number.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const number = createIdentitySchemaCreator( + SchemaType.NUMBER, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "number") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "number"), + }, + ], + }; + } + } +); diff --git a/src/core/schemas/builders/primitives/string.ts b/src/core/schemas/builders/primitives/string.ts new file mode 100644 index 0000000..949f1f2 --- /dev/null +++ b/src/core/schemas/builders/primitives/string.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const string = createIdentitySchemaCreator( + SchemaType.STRING, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "string") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "string"), + }, + ], + }; + } + } +); diff --git a/src/core/schemas/builders/primitives/unknown.ts b/src/core/schemas/builders/primitives/unknown.ts new file mode 100644 index 0000000..4d52495 --- /dev/null +++ b/src/core/schemas/builders/primitives/unknown.ts @@ -0,0 +1,4 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; + +export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/record/index.ts b/src/core/schemas/builders/record/index.ts new file mode 100644 index 0000000..82e25c5 --- /dev/null +++ b/src/core/schemas/builders/record/index.ts @@ -0,0 +1,2 @@ +export { record } from "./record"; +export type { BaseRecordSchema, RecordSchema } from "./types"; diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts new file mode 100644 index 0000000..ac1cd22 --- /dev/null +++ b/src/core/schemas/builders/record/record.ts @@ -0,0 +1,131 @@ +import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { entries } from "../../utils/entries"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; +import { BaseRecordSchema, RecordSchema } from "./types"; + +export function record( + keySchema: Schema, + valueSchema: Schema +): RecordSchema { + const baseSchema: BaseRecordSchema = { + parse: async (raw, opts) => { + return validateAndTransformRecord({ + value: raw, + isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + transformKey: (key) => + keySchema.parse(key, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], + }), + transformValue: (value, key) => + valueSchema.parse(value, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], + }), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + json: async (parsed, opts) => { + return validateAndTransformRecord({ + value: parsed, + isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, + transformKey: (key) => + keySchema.json(key, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], + }), + transformValue: (value, key) => + valueSchema.json(value, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], + }), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + getType: () => SchemaType.RECORD, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +async function validateAndTransformRecord({ + value, + isKeyNumeric, + transformKey, + transformValue, + breadcrumbsPrefix = [], +}: { + value: unknown; + isKeyNumeric: boolean; + transformKey: (key: string | number) => MaybePromise>; + transformValue: (value: unknown, key: string | number) => MaybePromise>; + breadcrumbsPrefix: string[] | undefined; +}): Promise>> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + return entries(value).reduce>>>( + async (accPromise, [stringKey, value]) => { + // skip nullish keys + if (value == null) { + return accPromise; + } + + const acc = await accPromise; + + let key: string | number = stringKey; + if (isKeyNumeric) { + const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; + if (!isNaN(numberKey)) { + key = numberKey; + } + } + const transformedKey = await transformKey(key); + + const transformedValue = await transformValue(value, key); + + if (acc.ok && transformedKey.ok && transformedValue.ok) { + return { + ok: true, + value: { + ...acc.value, + [transformedKey.value]: transformedValue.value, + }, + }; + } + + const errors: ValidationError[] = []; + if (!acc.ok) { + errors.push(...acc.errors); + } + if (!transformedKey.ok) { + errors.push(...transformedKey.errors); + } + if (!transformedValue.ok) { + errors.push(...transformedValue.errors); + } + + return { + ok: false, + errors, + }; + }, + Promise.resolve({ ok: true, value: {} as Record }) + ); +} diff --git a/src/core/schemas/builders/record/types.ts b/src/core/schemas/builders/record/types.ts new file mode 100644 index 0000000..eb82cc7 --- /dev/null +++ b/src/core/schemas/builders/record/types.ts @@ -0,0 +1,17 @@ +import { BaseSchema } from "../../Schema"; +import { SchemaUtils } from "../schema-utils"; + +export type RecordSchema< + RawKey extends string | number, + RawValue, + ParsedKey extends string | number, + ParsedValue +> = BaseRecordSchema & + SchemaUtils, Record>; + +export type BaseRecordSchema< + RawKey extends string | number, + RawValue, + ParsedKey extends string | number, + ParsedValue +> = BaseSchema, Record>; diff --git a/src/core/schemas/builders/schema-utils/JsonError.ts b/src/core/schemas/builders/schema-utils/JsonError.ts new file mode 100644 index 0000000..2b89ca0 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/JsonError.ts @@ -0,0 +1,9 @@ +import { ValidationError } from "../../Schema"; +import { stringifyValidationError } from "./stringifyValidationErrors"; + +export class JsonError extends Error { + constructor(public readonly errors: ValidationError[]) { + super(errors.map(stringifyValidationError).join("; ")); + Object.setPrototypeOf(this, JsonError.prototype); + } +} diff --git a/src/core/schemas/builders/schema-utils/ParseError.ts b/src/core/schemas/builders/schema-utils/ParseError.ts new file mode 100644 index 0000000..d056eb4 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/ParseError.ts @@ -0,0 +1,9 @@ +import { ValidationError } from "../../Schema"; +import { stringifyValidationError } from "./stringifyValidationErrors"; + +export class ParseError extends Error { + constructor(public readonly errors: ValidationError[]) { + super(errors.map(stringifyValidationError).join("; ")); + Object.setPrototypeOf(this, ParseError.prototype); + } +} diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts new file mode 100644 index 0000000..0c0d379 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts @@ -0,0 +1,99 @@ +import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema"; +import { JsonError } from "./JsonError"; +import { ParseError } from "./ParseError"; + +export interface SchemaUtils { + optional: () => Schema; + transform: (transformer: SchemaTransformer) => Schema; + parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; + jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; +} + +export interface SchemaTransformer { + transform: (parsed: Parsed) => Transformed; + untransform: (transformed: any) => Parsed; +} + +export function getSchemaUtils(schema: BaseSchema): SchemaUtils { + return { + optional: () => optional(schema), + transform: (transformer) => transform(schema, transformer), + parseOrThrow: async (raw, opts) => { + const parsed = await schema.parse(raw, opts); + if (parsed.ok) { + return parsed.value; + } + throw new ParseError(parsed.errors); + }, + jsonOrThrow: async (parsed, opts) => { + const raw = await schema.json(parsed, opts); + if (raw.ok) { + return raw.value; + } + throw new JsonError(raw.errors); + }, + }; +} + +/** + * schema utils are defined in one file to resolve issues with circular imports + */ + +export function optional( + schema: BaseSchema +): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => { + if (raw == null) { + return { + ok: true, + value: undefined, + }; + } + return schema.parse(raw, opts); + }, + json: (parsed, opts) => { + if (parsed == null) { + return { + ok: true, + value: null, + }; + } + return schema.json(parsed, opts); + }, + getType: () => SchemaType.OPTIONAL, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function transform( + schema: BaseSchema, + transformer: SchemaTransformer +): Schema { + const baseSchema: BaseSchema = { + parse: async (raw, opts) => { + const parsed = await schema.parse(raw, opts); + if (!parsed.ok) { + return parsed; + } + return { + ok: true, + value: transformer.transform(parsed.value), + }; + }, + json: async (transformed, opts) => { + const parsed = await transformer.untransform(transformed); + return schema.json(parsed, opts); + }, + getType: () => schema.getType(), + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/schema-utils/index.ts b/src/core/schemas/builders/schema-utils/index.ts new file mode 100644 index 0000000..aa04e05 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/index.ts @@ -0,0 +1,4 @@ +export { getSchemaUtils, optional, transform } from "./getSchemaUtils"; +export type { SchemaUtils } from "./getSchemaUtils"; +export { JsonError } from "./JsonError"; +export { ParseError } from "./ParseError"; diff --git a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts new file mode 100644 index 0000000..4160f0a --- /dev/null +++ b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts @@ -0,0 +1,8 @@ +import { ValidationError } from "../../Schema"; + +export function stringifyValidationError(error: ValidationError): string { + if (error.path.length === 0) { + return error.message; + } + return `${error.path.join(" -> ")}: ${error.message}`; +} diff --git a/src/core/schemas/builders/set/index.ts b/src/core/schemas/builders/set/index.ts new file mode 100644 index 0000000..f3310e8 --- /dev/null +++ b/src/core/schemas/builders/set/index.ts @@ -0,0 +1 @@ +export { set } from "./set"; diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts new file mode 100644 index 0000000..3113bcb --- /dev/null +++ b/src/core/schemas/builders/set/set.ts @@ -0,0 +1,43 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { list } from "../list"; +import { getSchemaUtils } from "../schema-utils"; + +export function set(schema: Schema): Schema> { + const listSchema = list(schema); + const baseSchema: BaseSchema> = { + parse: async (raw, opts) => { + const parsedList = await listSchema.parse(raw, opts); + if (parsedList.ok) { + return { + ok: true, + value: new Set(parsedList.value), + }; + } else { + return parsedList; + } + }, + json: async (parsed, opts) => { + if (!(parsed instanceof Set)) { + return { + ok: false, + errors: [ + { + path: opts?.breadcrumbsPrefix ?? [], + message: getErrorMessageForIncorrectType(parsed, "Set"), + }, + ], + }; + } + const jsonList = await listSchema.json([...parsed], opts); + return jsonList; + }, + getType: () => SchemaType.SET, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/undiscriminated-union/index.ts b/src/core/schemas/builders/undiscriminated-union/index.ts new file mode 100644 index 0000000..75b71cb --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/index.ts @@ -0,0 +1,6 @@ +export type { + inferParsedUnidiscriminatedUnionSchema, + inferRawUnidiscriminatedUnionSchema, + UndiscriminatedUnionSchema, +} from "./types"; +export { undiscriminatedUnion } from "./undiscriminatedUnion"; diff --git a/src/core/schemas/builders/undiscriminated-union/types.ts b/src/core/schemas/builders/undiscriminated-union/types.ts new file mode 100644 index 0000000..43e7108 --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/types.ts @@ -0,0 +1,10 @@ +import { inferParsed, inferRaw, Schema } from "../../Schema"; + +export type UndiscriminatedUnionSchema = Schema< + inferRawUnidiscriminatedUnionSchema, + inferParsedUnidiscriminatedUnionSchema +>; + +export type inferRawUnidiscriminatedUnionSchema = inferRaw; + +export type inferParsedUnidiscriminatedUnionSchema = inferParsed; diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts new file mode 100644 index 0000000..771dc6a --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts @@ -0,0 +1,61 @@ +import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; +import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; + +export function undiscriminatedUnion, ...Schema[]]>( + schemas: Schemas +): Schema, inferParsedUnidiscriminatedUnionSchema> { + const baseSchema: BaseSchema< + inferRawUnidiscriminatedUnionSchema, + inferParsedUnidiscriminatedUnionSchema + > = { + parse: async (raw, opts) => { + return validateAndTransformUndiscriminatedUnion>( + (schema, opts) => schema.parse(raw, opts), + schemas, + opts + ); + }, + json: async (parsed, opts) => { + return validateAndTransformUndiscriminatedUnion>( + (schema, opts) => schema.json(parsed, opts), + schemas, + opts + ); + }, + getType: () => SchemaType.UNDISCRIMINATED_UNION, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +async function validateAndTransformUndiscriminatedUnion( + transform: (schema: Schema, opts: SchemaOptions) => MaybePromise>, + schemas: Schema[], + opts: SchemaOptions | undefined +): Promise> { + const errors: ValidationError[] = []; + for (const [index, schema] of schemas.entries()) { + const transformed = await transform(schema, { ...opts, skipValidation: false }); + if (transformed.ok) { + return transformed; + } else { + for (const error of transformed.errors) { + errors.push({ + path: error.path, + message: `[Variant ${index}] ${error.message}`, + }); + } + } + } + + return { + ok: false, + errors, + }; +} diff --git a/src/core/schemas/builders/union/discriminant.ts b/src/core/schemas/builders/union/discriminant.ts new file mode 100644 index 0000000..55065bc --- /dev/null +++ b/src/core/schemas/builders/union/discriminant.ts @@ -0,0 +1,14 @@ +export function discriminant( + parsedDiscriminant: ParsedDiscriminant, + rawDiscriminant: RawDiscriminant +): Discriminant { + return { + parsedDiscriminant, + rawDiscriminant, + }; +} + +export interface Discriminant { + parsedDiscriminant: ParsedDiscriminant; + rawDiscriminant: RawDiscriminant; +} diff --git a/src/core/schemas/builders/union/index.ts b/src/core/schemas/builders/union/index.ts new file mode 100644 index 0000000..85fc008 --- /dev/null +++ b/src/core/schemas/builders/union/index.ts @@ -0,0 +1,10 @@ +export { discriminant } from "./discriminant"; +export type { Discriminant } from "./discriminant"; +export type { + inferParsedDiscriminant, + inferParsedUnion, + inferRawDiscriminant, + inferRawUnion, + UnionSubtypes, +} from "./types"; +export { union } from "./union"; diff --git a/src/core/schemas/builders/union/types.ts b/src/core/schemas/builders/union/types.ts new file mode 100644 index 0000000..6f82c86 --- /dev/null +++ b/src/core/schemas/builders/union/types.ts @@ -0,0 +1,26 @@ +import { inferParsedObject, inferRawObject, ObjectSchema } from "../object"; +import { Discriminant } from "./discriminant"; + +export type UnionSubtypes = { + [K in DiscriminantValues]: ObjectSchema; +}; + +export type inferRawUnion, U extends UnionSubtypes> = { + [K in keyof U]: Record, K> & inferRawObject; +}[keyof U]; + +export type inferParsedUnion, U extends UnionSubtypes> = { + [K in keyof U]: Record, K> & inferParsedObject; +}[keyof U]; + +export type inferRawDiscriminant> = D extends string + ? D + : D extends Discriminant + ? Raw + : never; + +export type inferParsedDiscriminant> = D extends string + ? D + : D extends Discriminant + ? Parsed + : never; diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts new file mode 100644 index 0000000..ed659be --- /dev/null +++ b/src/core/schemas/builders/union/union.ts @@ -0,0 +1,173 @@ +import { BaseSchema, MaybeValid, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { keys } from "../../utils/keys"; +import { MaybePromise } from "../../utils/MaybePromise"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { enum_ } from "../enum"; +import { ObjectSchema } from "../object"; +import { getObjectLikeUtils, ObjectLikeSchema } from "../object-like"; +import { getSchemaUtils } from "../schema-utils"; +import { Discriminant } from "./discriminant"; +import { inferParsedDiscriminant, inferParsedUnion, inferRawDiscriminant, inferRawUnion, UnionSubtypes } from "./types"; + +export function union, U extends UnionSubtypes>( + discriminant: D, + union: U +): ObjectLikeSchema, inferParsedUnion> { + const rawDiscriminant = + typeof discriminant === "string" ? discriminant : (discriminant.rawDiscriminant as inferRawDiscriminant); + const parsedDiscriminant = + typeof discriminant === "string" + ? discriminant + : (discriminant.parsedDiscriminant as inferParsedDiscriminant); + + const discriminantValueSchema = enum_(keys(union) as string[]); + + const baseSchema: BaseSchema, inferParsedUnion> = { + parse: async (raw, opts) => { + return transformAndValidateUnion({ + value: raw, + discriminant: rawDiscriminant, + transformedDiscriminant: parsedDiscriminant, + transformDiscriminantValue: (discriminantValue) => + discriminantValueSchema.parse(discriminantValue, { + allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawDiscriminant], + }), + getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], + allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, + transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => + additionalPropertiesSchema.parse(additionalProperties, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + json: async (parsed, opts) => { + return transformAndValidateUnion({ + value: parsed, + discriminant: parsedDiscriminant, + transformedDiscriminant: rawDiscriminant, + transformDiscriminantValue: (discriminantValue) => + discriminantValueSchema.json(discriminantValue, { + allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedDiscriminant], + }), + getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], + allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, + transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => + additionalPropertiesSchema.json(additionalProperties, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + getType: () => SchemaType.UNION, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + }; +} + +async function transformAndValidateUnion< + TransformedDiscriminant extends string, + TransformedDiscriminantValue extends string, + TransformedAdditionalProperties +>({ + value, + discriminant, + transformedDiscriminant, + transformDiscriminantValue, + getAdditionalPropertiesSchema, + allowUnrecognizedUnionMembers = false, + transformAdditionalProperties, + breadcrumbsPrefix = [], +}: { + value: unknown; + discriminant: string; + transformedDiscriminant: TransformedDiscriminant; + transformDiscriminantValue: (discriminantValue: unknown) => MaybePromise>; + getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema | undefined; + allowUnrecognizedUnionMembers: boolean | undefined; + transformAdditionalProperties: ( + additionalProperties: unknown, + additionalPropertiesSchema: ObjectSchema + ) => MaybePromise>; + breadcrumbsPrefix: string[] | undefined; +}): Promise< + MaybeValid & TransformedAdditionalProperties> +> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + const { [discriminant]: discriminantValue, ...additionalProperties } = value; + + if (discriminantValue == null) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: `Missing discriminant ("${discriminant}")`, + }, + ], + }; + } + + const transformedDiscriminantValue = await transformDiscriminantValue(discriminantValue); + if (!transformedDiscriminantValue.ok) { + return { + ok: false, + errors: transformedDiscriminantValue.errors, + }; + } + + const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value); + + if (additionalPropertiesSchema == null) { + if (allowUnrecognizedUnionMembers) { + return { + ok: true, + value: { + [transformedDiscriminant]: transformedDiscriminantValue.value, + ...additionalProperties, + } as Record & TransformedAdditionalProperties, + }; + } else { + return { + ok: false, + errors: [ + { + path: [...breadcrumbsPrefix, discriminant], + message: "Unexpected discriminant value", + }, + ], + }; + } + } + + const transformedAdditionalProperties = await transformAdditionalProperties( + additionalProperties, + additionalPropertiesSchema + ); + if (!transformedAdditionalProperties.ok) { + return transformedAdditionalProperties; + } + + return { + ok: true, + value: { + [transformedDiscriminant]: discriminantValue, + ...transformedAdditionalProperties.value, + } as Record & TransformedAdditionalProperties, + }; +} diff --git a/src/core/schemas/index.ts b/src/core/schemas/index.ts new file mode 100644 index 0000000..5429d8b --- /dev/null +++ b/src/core/schemas/index.ts @@ -0,0 +1,2 @@ +export * from "./builders"; +export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema"; diff --git a/src/core/schemas/utils/MaybePromise.ts b/src/core/schemas/utils/MaybePromise.ts new file mode 100644 index 0000000..9cd354b --- /dev/null +++ b/src/core/schemas/utils/MaybePromise.ts @@ -0,0 +1 @@ +export type MaybePromise = T | Promise; diff --git a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts new file mode 100644 index 0000000..4111d70 --- /dev/null +++ b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts @@ -0,0 +1,15 @@ +export type addQuestionMarksToNullableProperties = { + [K in OptionalKeys]?: T[K]; +} & Pick>; + +export type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] + ? K + : null extends T[K] + ? K + : 1 extends (any extends T[K] ? 0 : 1) + ? never + : K; +}[keyof T]; + +export type RequiredKeys = Exclude>; diff --git a/src/core/schemas/utils/createIdentitySchemaCreator.ts b/src/core/schemas/utils/createIdentitySchemaCreator.ts new file mode 100644 index 0000000..de107cf --- /dev/null +++ b/src/core/schemas/utils/createIdentitySchemaCreator.ts @@ -0,0 +1,21 @@ +import { getSchemaUtils } from "../builders/schema-utils"; +import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema"; +import { maybeSkipValidation } from "./maybeSkipValidation"; + +export function createIdentitySchemaCreator( + schemaType: SchemaType, + validate: (value: unknown, opts?: SchemaOptions) => MaybeValid +): () => Schema { + return () => { + const baseSchema: BaseSchema = { + parse: validate, + json: validate, + getType: () => schemaType, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; + }; +} diff --git a/src/core/schemas/utils/entries.ts b/src/core/schemas/utils/entries.ts new file mode 100644 index 0000000..e122952 --- /dev/null +++ b/src/core/schemas/utils/entries.ts @@ -0,0 +1,3 @@ +export function entries(object: T): [keyof T, T[keyof T]][] { + return Object.entries(object) as [keyof T, T[keyof T]][]; +} diff --git a/src/core/schemas/utils/filterObject.ts b/src/core/schemas/utils/filterObject.ts new file mode 100644 index 0000000..2c25a34 --- /dev/null +++ b/src/core/schemas/utils/filterObject.ts @@ -0,0 +1,10 @@ +export function filterObject(obj: T, keysToInclude: K[]): Pick { + const keysToIncludeSet = new Set(keysToInclude); + return Object.entries(obj).reduce((acc, [key, value]) => { + if (keysToIncludeSet.has(key as K)) { + acc[key as K] = value; + } + return acc; + // eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter + }, {} as Pick); +} diff --git a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts new file mode 100644 index 0000000..438012d --- /dev/null +++ b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts @@ -0,0 +1,21 @@ +export function getErrorMessageForIncorrectType(value: unknown, expectedType: string): string { + return `Expected ${expectedType}. Received ${getTypeAsString(value)}.`; +} + +function getTypeAsString(value: unknown): string { + if (Array.isArray(value)) { + return "list"; + } + if (value === null) { + return "null"; + } + switch (typeof value) { + case "string": + return `"${value}"`; + case "number": + case "boolean": + case "undefined": + return `${value}`; + } + return typeof value; +} diff --git a/src/core/schemas/utils/isPlainObject.ts b/src/core/schemas/utils/isPlainObject.ts new file mode 100644 index 0000000..db82a72 --- /dev/null +++ b/src/core/schemas/utils/isPlainObject.ts @@ -0,0 +1,17 @@ +// borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js +export function isPlainObject(value: unknown): value is Record { + if (typeof value !== "object" || value === null) { + return false; + } + + if (Object.getPrototypeOf(value) === null) { + return true; + } + + let proto = value; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + + return Object.getPrototypeOf(value) === proto; +} diff --git a/src/core/schemas/utils/keys.ts b/src/core/schemas/utils/keys.ts new file mode 100644 index 0000000..0186709 --- /dev/null +++ b/src/core/schemas/utils/keys.ts @@ -0,0 +1,3 @@ +export function keys(object: T): (keyof T)[] { + return Object.keys(object) as (keyof T)[]; +} diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts new file mode 100644 index 0000000..99c02c3 --- /dev/null +++ b/src/core/schemas/utils/maybeSkipValidation.ts @@ -0,0 +1,39 @@ +import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; +import { MaybePromise } from "./MaybePromise"; + +export function maybeSkipValidation, Raw, Parsed>(schema: S): S { + return { + ...schema, + json: transformAndMaybeSkipValidation(schema.json), + parse: transformAndMaybeSkipValidation(schema.parse), + }; +} + +function transformAndMaybeSkipValidation( + transform: (value: unknown, opts?: SchemaOptions) => MaybePromise> +): (value: unknown, opts?: SchemaOptions) => MaybePromise> { + return async (value, opts): Promise> => { + const transformed = await transform(value, opts); + const { skipValidation = false } = opts ?? {}; + if (!transformed.ok && skipValidation) { + // eslint-disable-next-line no-console + console.warn( + [ + "Failed to validate.", + ...transformed.errors.map( + (error) => + " - " + + (error.path.length > 0 ? `${error.path.join(".")}: ${error.message}` : error.message) + ), + ].join("\n") + ); + + return { + ok: true, + value: value as T, + }; + } else { + return transformed; + } + }; +} diff --git a/src/core/schemas/utils/partition.ts b/src/core/schemas/utils/partition.ts new file mode 100644 index 0000000..f58d6f3 --- /dev/null +++ b/src/core/schemas/utils/partition.ts @@ -0,0 +1,12 @@ +export function partition(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]] { + const trueItems: T[] = [], + falseItems: T[] = []; + for (const item of items) { + if (predicate(item)) { + trueItems.push(item); + } else { + falseItems.push(item); + } + } + return [trueItems, falseItems]; +} diff --git a/src/environments.ts b/src/environments.ts new file mode 100644 index 0000000..d68841b --- /dev/null +++ b/src/environments.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export const HumanloopEnvironment = { + Default: "https://api.humanloop.com/v5", +} as const; + +export type HumanloopEnvironment = typeof HumanloopEnvironment.Default; diff --git a/src/errors/HumanloopError.ts b/src/errors/HumanloopError.ts new file mode 100644 index 0000000..79f1a56 --- /dev/null +++ b/src/errors/HumanloopError.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class HumanloopError extends Error { + readonly statusCode?: number; + readonly body?: unknown; + + constructor({ message, statusCode, body }: { message?: string; statusCode?: number; body?: unknown }) { + super(buildMessage({ message, statusCode, body })); + Object.setPrototypeOf(this, HumanloopError.prototype); + if (statusCode != null) { + this.statusCode = statusCode; + } + + if (body !== undefined) { + this.body = body; + } + } +} + +function buildMessage({ + message, + statusCode, + body, +}: { + message: string | undefined; + statusCode: number | undefined; + body: unknown | undefined; +}): string { + let lines: string[] = []; + if (message != null) { + lines.push(message); + } + + if (statusCode != null) { + lines.push(`Status code: ${statusCode.toString()}`); + } + + if (body != null) { + lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`); + } + + return lines.join("\n"); +} diff --git a/src/errors/HumanloopTimeoutError.ts b/src/errors/HumanloopTimeoutError.ts new file mode 100644 index 0000000..b213832 --- /dev/null +++ b/src/errors/HumanloopTimeoutError.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class HumanloopTimeoutError extends Error { + constructor() { + super("Timeout"); + Object.setPrototypeOf(this, HumanloopTimeoutError.prototype); + } +} diff --git a/src/errors/index.ts b/src/errors/index.ts new file mode 100644 index 0000000..e5e9c86 --- /dev/null +++ b/src/errors/index.ts @@ -0,0 +1,2 @@ +export { HumanloopError } from "./HumanloopError"; +export { HumanloopTimeoutError } from "./HumanloopTimeoutError"; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..a2ccd93 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,4 @@ +export * as Humanloop from "./api"; +export { HumanloopClient } from "./Client"; +export { HumanloopEnvironment } from "./environments"; +export { HumanloopError, HumanloopTimeoutError } from "./errors"; diff --git a/src/serialization/index.ts b/src/serialization/index.ts new file mode 100644 index 0000000..3e15e29 --- /dev/null +++ b/src/serialization/index.ts @@ -0,0 +1,2 @@ +export * from "./resources"; +export * from "./types"; diff --git a/src/serialization/resources/datasets/client/index.ts b/src/serialization/resources/datasets/client/index.ts new file mode 100644 index 0000000..0ab8d67 --- /dev/null +++ b/src/serialization/resources/datasets/client/index.ts @@ -0,0 +1,2 @@ +export * as listEnvironments from "./listEnvironments"; +export * from "./requests"; diff --git a/src/serialization/resources/datasets/client/listEnvironments.ts b/src/serialization/resources/datasets/client/listEnvironments.ts new file mode 100644 index 0000000..1962abe --- /dev/null +++ b/src/serialization/resources/datasets/client/listEnvironments.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { FileEnvironmentResponse } from "../../../types/FileEnvironmentResponse"; + +export const Response: core.serialization.Schema< + serializers.datasets.listEnvironments.Response.Raw, + Humanloop.FileEnvironmentResponse[] +> = core.serialization.list(FileEnvironmentResponse); + +export declare namespace Response { + type Raw = FileEnvironmentResponse.Raw[]; +} diff --git a/src/serialization/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts b/src/serialization/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts new file mode 100644 index 0000000..03d0987 --- /dev/null +++ b/src/serialization/resources/datasets/client/requests/BodyDatasetsCreateDatapointsFromLogs.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BodyDatasetsCreateDatapointsFromLogs: core.serialization.Schema< + serializers.BodyDatasetsCreateDatapointsFromLogs.Raw, + Omit +> = core.serialization.object({ + logIds: core.serialization.property("log_ids", core.serialization.list(core.serialization.string())), + commitMessage: core.serialization.property("commit_message", core.serialization.string()), +}); + +export declare namespace BodyDatasetsCreateDatapointsFromLogs { + interface Raw { + log_ids: string[]; + commit_message: string; + } +} diff --git a/src/serialization/resources/datasets/client/requests/DatasetsRequest.ts b/src/serialization/resources/datasets/client/requests/DatasetsRequest.ts new file mode 100644 index 0000000..c3c52ff --- /dev/null +++ b/src/serialization/resources/datasets/client/requests/DatasetsRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CreateDatapointRequest } from "../../../../types/CreateDatapointRequest"; +import { UpdateDatesetAction } from "../../../../types/UpdateDatesetAction"; + +export const DatasetsRequest: core.serialization.Schema< + serializers.DatasetsRequest.Raw, + Omit +> = core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + datapoints: core.serialization.list(CreateDatapointRequest), + action: UpdateDatesetAction.optional(), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), +}); + +export declare namespace DatasetsRequest { + interface Raw { + path?: string | null; + id?: string | null; + datapoints: CreateDatapointRequest.Raw[]; + action?: UpdateDatesetAction.Raw | null; + commit_message?: string | null; + } +} diff --git a/src/serialization/resources/datasets/client/requests/UpdateDatasetRequest.ts b/src/serialization/resources/datasets/client/requests/UpdateDatasetRequest.ts new file mode 100644 index 0000000..09339be --- /dev/null +++ b/src/serialization/resources/datasets/client/requests/UpdateDatasetRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdateDatasetRequest: core.serialization.Schema< + serializers.UpdateDatasetRequest.Raw, + Humanloop.UpdateDatasetRequest +> = core.serialization.object({ + path: core.serialization.string().optional(), + name: core.serialization.string().optional(), +}); + +export declare namespace UpdateDatasetRequest { + interface Raw { + path?: string | null; + name?: string | null; + } +} diff --git a/src/serialization/resources/datasets/client/requests/index.ts b/src/serialization/resources/datasets/client/requests/index.ts new file mode 100644 index 0000000..2325b91 --- /dev/null +++ b/src/serialization/resources/datasets/client/requests/index.ts @@ -0,0 +1,3 @@ +export { DatasetsRequest } from "./DatasetsRequest"; +export { UpdateDatasetRequest } from "./UpdateDatasetRequest"; +export { BodyDatasetsCreateDatapointsFromLogs } from "./BodyDatasetsCreateDatapointsFromLogs"; diff --git a/src/serialization/resources/datasets/index.ts b/src/serialization/resources/datasets/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/datasets/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/directories/client/index.ts b/src/serialization/resources/directories/client/index.ts new file mode 100644 index 0000000..257d03e --- /dev/null +++ b/src/serialization/resources/directories/client/index.ts @@ -0,0 +1,2 @@ +export * as list from "./list"; +export * from "./requests"; diff --git a/src/serialization/resources/directories/client/list.ts b/src/serialization/resources/directories/client/list.ts new file mode 100644 index 0000000..d2459a4 --- /dev/null +++ b/src/serialization/resources/directories/client/list.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { DirectoryResponse } from "../../../types/DirectoryResponse"; + +export const Response: core.serialization.Schema< + serializers.directories.list.Response.Raw, + Humanloop.DirectoryResponse[] +> = core.serialization.list(DirectoryResponse); + +export declare namespace Response { + type Raw = DirectoryResponse.Raw[]; +} diff --git a/src/serialization/resources/directories/client/requests/CreateDirectoryRequest.ts b/src/serialization/resources/directories/client/requests/CreateDirectoryRequest.ts new file mode 100644 index 0000000..9f58c16 --- /dev/null +++ b/src/serialization/resources/directories/client/requests/CreateDirectoryRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CreateDirectoryRequest: core.serialization.Schema< + serializers.CreateDirectoryRequest.Raw, + Humanloop.CreateDirectoryRequest +> = core.serialization.object({ + name: core.serialization.string(), + parentId: core.serialization.property("parent_id", core.serialization.string()), +}); + +export declare namespace CreateDirectoryRequest { + interface Raw { + name: string; + parent_id: string; + } +} diff --git a/src/serialization/resources/directories/client/requests/UpdateDirectoryRequest.ts b/src/serialization/resources/directories/client/requests/UpdateDirectoryRequest.ts new file mode 100644 index 0000000..5f9a8e5 --- /dev/null +++ b/src/serialization/resources/directories/client/requests/UpdateDirectoryRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdateDirectoryRequest: core.serialization.Schema< + serializers.UpdateDirectoryRequest.Raw, + Humanloop.UpdateDirectoryRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), +}); + +export declare namespace UpdateDirectoryRequest { + interface Raw { + name?: string | null; + parent_id?: string | null; + } +} diff --git a/src/serialization/resources/directories/client/requests/index.ts b/src/serialization/resources/directories/client/requests/index.ts new file mode 100644 index 0000000..5aaa7eb --- /dev/null +++ b/src/serialization/resources/directories/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateDirectoryRequest } from "./CreateDirectoryRequest"; +export { UpdateDirectoryRequest } from "./UpdateDirectoryRequest"; diff --git a/src/serialization/resources/directories/index.ts b/src/serialization/resources/directories/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/directories/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/evaluations/client/index.ts b/src/serialization/resources/evaluations/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/serialization/resources/evaluations/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts b/src/serialization/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts new file mode 100644 index 0000000..3eb209c --- /dev/null +++ b/src/serialization/resources/evaluations/client/requests/UpdateEvaluationStatusRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { EvaluationStatus } from "../../../../types/EvaluationStatus"; + +export const UpdateEvaluationStatusRequest: core.serialization.Schema< + serializers.UpdateEvaluationStatusRequest.Raw, + Humanloop.UpdateEvaluationStatusRequest +> = core.serialization.object({ + status: EvaluationStatus, +}); + +export declare namespace UpdateEvaluationStatusRequest { + interface Raw { + status: EvaluationStatus.Raw; + } +} diff --git a/src/serialization/resources/evaluations/client/requests/index.ts b/src/serialization/resources/evaluations/client/requests/index.ts new file mode 100644 index 0000000..9d1b3fa --- /dev/null +++ b/src/serialization/resources/evaluations/client/requests/index.ts @@ -0,0 +1 @@ +export { UpdateEvaluationStatusRequest } from "./UpdateEvaluationStatusRequest"; diff --git a/src/serialization/resources/evaluations/index.ts b/src/serialization/resources/evaluations/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/evaluations/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/evaluators/client/debug.ts b/src/serialization/resources/evaluators/client/debug.ts new file mode 100644 index 0000000..2bdd284 --- /dev/null +++ b/src/serialization/resources/evaluators/client/debug.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { EvaluationDebugResultResponse } from "../../../types/EvaluationDebugResultResponse"; + +export const Response: core.serialization.Schema< + serializers.evaluators.debug.Response.Raw, + Humanloop.EvaluationDebugResultResponse[] +> = core.serialization.list(EvaluationDebugResultResponse); + +export declare namespace Response { + type Raw = EvaluationDebugResultResponse.Raw[]; +} diff --git a/src/serialization/resources/evaluators/client/index.ts b/src/serialization/resources/evaluators/client/index.ts new file mode 100644 index 0000000..e71189f --- /dev/null +++ b/src/serialization/resources/evaluators/client/index.ts @@ -0,0 +1,4 @@ +export * as listdefault from "./listdefault"; +export * as debug from "./debug"; +export * as listEnvironments from "./listEnvironments"; +export * from "./requests"; diff --git a/src/serialization/resources/evaluators/client/listEnvironments.ts b/src/serialization/resources/evaluators/client/listEnvironments.ts new file mode 100644 index 0000000..efe0230 --- /dev/null +++ b/src/serialization/resources/evaluators/client/listEnvironments.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { FileEnvironmentResponse } from "../../../types/FileEnvironmentResponse"; + +export const Response: core.serialization.Schema< + serializers.evaluators.listEnvironments.Response.Raw, + Humanloop.FileEnvironmentResponse[] +> = core.serialization.list(FileEnvironmentResponse); + +export declare namespace Response { + type Raw = FileEnvironmentResponse.Raw[]; +} diff --git a/src/serialization/resources/evaluators/client/listdefault.ts b/src/serialization/resources/evaluators/client/listdefault.ts new file mode 100644 index 0000000..35451f2 --- /dev/null +++ b/src/serialization/resources/evaluators/client/listdefault.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { EvaluatorResponse } from "../../../types/EvaluatorResponse"; + +export const Response: core.serialization.Schema< + serializers.evaluators.listdefault.Response.Raw, + Humanloop.EvaluatorResponse[] +> = core.serialization.list(EvaluatorResponse); + +export declare namespace Response { + type Raw = EvaluatorResponse.Raw[]; +} diff --git a/src/serialization/resources/evaluators/client/requests/EvaluatorsRequest.ts b/src/serialization/resources/evaluators/client/requests/EvaluatorsRequest.ts new file mode 100644 index 0000000..660c510 --- /dev/null +++ b/src/serialization/resources/evaluators/client/requests/EvaluatorsRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec } from "../../types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec"; + +export const EvaluatorsRequest: core.serialization.Schema< + serializers.EvaluatorsRequest.Raw, + Humanloop.EvaluatorsRequest +> = core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + spec: SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec, +}); + +export declare namespace EvaluatorsRequest { + interface Raw { + path?: string | null; + id?: string | null; + commit_message?: string | null; + spec: SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.Raw; + } +} diff --git a/src/serialization/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts b/src/serialization/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts new file mode 100644 index 0000000..031d824 --- /dev/null +++ b/src/serialization/resources/evaluators/client/requests/RunSyncEvaluationRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { RunSyncEvaluationRequestEvaluator } from "../../types/RunSyncEvaluationRequestEvaluator"; + +export const RunSyncEvaluationRequest: core.serialization.Schema< + serializers.RunSyncEvaluationRequest.Raw, + Humanloop.RunSyncEvaluationRequest +> = core.serialization.object({ + fileId: core.serialization.property("file_id", core.serialization.string()), + evaluator: RunSyncEvaluationRequestEvaluator, + evaluatorVersionId: core.serialization.property("evaluator_version_id", core.serialization.string().optional()), + logIds: core.serialization.property("log_ids", core.serialization.list(core.serialization.string()).optional()), + datapointIds: core.serialization.property( + "datapoint_ids", + core.serialization.list(core.serialization.string()).optional() + ), + promptVersionId: core.serialization.property("prompt_version_id", core.serialization.string().optional()), +}); + +export declare namespace RunSyncEvaluationRequest { + interface Raw { + file_id: string; + evaluator: RunSyncEvaluationRequestEvaluator.Raw; + evaluator_version_id?: string | null; + log_ids?: string[] | null; + datapoint_ids?: string[] | null; + prompt_version_id?: string | null; + } +} diff --git a/src/serialization/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts b/src/serialization/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts new file mode 100644 index 0000000..c5fff6f --- /dev/null +++ b/src/serialization/resources/evaluators/client/requests/UpdateEvaluatorRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdateEvaluatorRequest: core.serialization.Schema< + serializers.UpdateEvaluatorRequest.Raw, + Humanloop.UpdateEvaluatorRequest +> = core.serialization.object({ + path: core.serialization.string().optional(), + name: core.serialization.string().optional(), +}); + +export declare namespace UpdateEvaluatorRequest { + interface Raw { + path?: string | null; + name?: string | null; + } +} diff --git a/src/serialization/resources/evaluators/client/requests/index.ts b/src/serialization/resources/evaluators/client/requests/index.ts new file mode 100644 index 0000000..63186d7 --- /dev/null +++ b/src/serialization/resources/evaluators/client/requests/index.ts @@ -0,0 +1,3 @@ +export { EvaluatorsRequest } from "./EvaluatorsRequest"; +export { UpdateEvaluatorRequest } from "./UpdateEvaluatorRequest"; +export { RunSyncEvaluationRequest } from "./RunSyncEvaluationRequest"; diff --git a/src/serialization/resources/evaluators/index.ts b/src/serialization/resources/evaluators/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/evaluators/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts b/src/serialization/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts new file mode 100644 index 0000000..910c750 --- /dev/null +++ b/src/serialization/resources/evaluators/types/RunSyncEvaluationRequestEvaluator.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { LlmEvaluatorRequest } from "../../../types/LlmEvaluatorRequest"; +import { CodeEvaluatorRequest } from "../../../types/CodeEvaluatorRequest"; +import { HumanEvaluatorRequest } from "../../../types/HumanEvaluatorRequest"; + +export const RunSyncEvaluationRequestEvaluator: core.serialization.Schema< + serializers.RunSyncEvaluationRequestEvaluator.Raw, + Humanloop.RunSyncEvaluationRequestEvaluator +> = core.serialization.undiscriminatedUnion([LlmEvaluatorRequest, CodeEvaluatorRequest, HumanEvaluatorRequest]); + +export declare namespace RunSyncEvaluationRequestEvaluator { + type Raw = LlmEvaluatorRequest.Raw | CodeEvaluatorRequest.Raw | HumanEvaluatorRequest.Raw; +} diff --git a/src/serialization/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts b/src/serialization/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts new file mode 100644 index 0000000..b8c8ad9 --- /dev/null +++ b/src/serialization/resources/evaluators/types/SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { LlmEvaluatorRequest } from "../../../types/LlmEvaluatorRequest"; +import { CodeEvaluatorRequest } from "../../../types/CodeEvaluatorRequest"; +import { HumanEvaluatorRequest } from "../../../types/HumanEvaluatorRequest"; + +export const SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec: core.serialization.Schema< + serializers.SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec.Raw, + Humanloop.SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec +> = core.serialization.undiscriminatedUnion([LlmEvaluatorRequest, CodeEvaluatorRequest, HumanEvaluatorRequest]); + +export declare namespace SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec { + type Raw = LlmEvaluatorRequest.Raw | CodeEvaluatorRequest.Raw | HumanEvaluatorRequest.Raw; +} diff --git a/src/serialization/resources/evaluators/types/index.ts b/src/serialization/resources/evaluators/types/index.ts new file mode 100644 index 0000000..6ec5c06 --- /dev/null +++ b/src/serialization/resources/evaluators/types/index.ts @@ -0,0 +1,2 @@ +export * from "./SrcExternalAppModelsV5EvaluatorsEvaluatorRequestSpec"; +export * from "./RunSyncEvaluationRequestEvaluator"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts new file mode 100644 index 0000000..09b9c0d --- /dev/null +++ b/src/serialization/resources/index.ts @@ -0,0 +1,14 @@ +export * as prompts from "./prompts"; +export * from "./prompts/types"; +export * as evaluators from "./evaluators"; +export * from "./evaluators/types"; +export * as tools from "./tools"; +export * as datasets from "./datasets"; +export * as directories from "./directories"; +export * from "./prompts/client/requests"; +export * from "./tools/client/requests"; +export * from "./datasets/client/requests"; +export * from "./directories/client/requests"; +export * as evaluations from "./evaluations"; +export * from "./evaluations/client/requests"; +export * from "./evaluators/client/requests"; diff --git a/src/serialization/resources/prompts/client/index.ts b/src/serialization/resources/prompts/client/index.ts new file mode 100644 index 0000000..0ab8d67 --- /dev/null +++ b/src/serialization/resources/prompts/client/index.ts @@ -0,0 +1,2 @@ +export * as listEnvironments from "./listEnvironments"; +export * from "./requests"; diff --git a/src/serialization/resources/prompts/client/listEnvironments.ts b/src/serialization/resources/prompts/client/listEnvironments.ts new file mode 100644 index 0000000..9a1974e --- /dev/null +++ b/src/serialization/resources/prompts/client/listEnvironments.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { FileEnvironmentResponse } from "../../../types/FileEnvironmentResponse"; + +export const Response: core.serialization.Schema< + serializers.prompts.listEnvironments.Response.Raw, + Humanloop.FileEnvironmentResponse[] +> = core.serialization.list(FileEnvironmentResponse); + +export declare namespace Response { + type Raw = FileEnvironmentResponse.Raw[]; +} diff --git a/src/serialization/resources/prompts/client/requests/PromptCallRequest.ts b/src/serialization/resources/prompts/client/requests/PromptCallRequest.ts new file mode 100644 index 0000000..3bc9947 --- /dev/null +++ b/src/serialization/resources/prompts/client/requests/PromptCallRequest.ts @@ -0,0 +1,64 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PromptKernelRequest } from "../../../../types/PromptKernelRequest"; +import { ChatMessage } from "../../../../types/ChatMessage"; +import { PromptCallRequestToolChoice } from "../../types/PromptCallRequestToolChoice"; +import { ProviderApiKeys } from "../../../../types/ProviderApiKeys"; + +export const PromptCallRequest: core.serialization.Schema< + serializers.PromptCallRequest.Raw, + Omit +> = core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + prompt: PromptKernelRequest.optional(), + messages: core.serialization.list(ChatMessage).optional(), + toolChoice: core.serialization.property("tool_choice", PromptCallRequestToolChoice.optional()), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + inputs: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), + metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + save: core.serialization.boolean().optional(), + sourceDatapointId: core.serialization.property("source_datapoint_id", core.serialization.string().optional()), + batches: core.serialization.list(core.serialization.string()).optional(), + user: core.serialization.string().optional(), + promptCallRequestEnvironment: core.serialization.property("environment", core.serialization.string().optional()), + providerApiKeys: core.serialization.property("provider_api_keys", ProviderApiKeys.optional()), + numSamples: core.serialization.property("num_samples", core.serialization.number().optional()), + stream: core.serialization.boolean().optional(), + returnInputs: core.serialization.property("return_inputs", core.serialization.boolean().optional()), + logprobs: core.serialization.number().optional(), + suffix: core.serialization.string().optional(), +}); + +export declare namespace PromptCallRequest { + interface Raw { + path?: string | null; + id?: string | null; + prompt?: PromptKernelRequest.Raw | null; + messages?: ChatMessage.Raw[] | null; + tool_choice?: PromptCallRequestToolChoice.Raw | null; + session_id?: string | null; + parent_id?: string | null; + inputs?: Record | null; + source?: string | null; + metadata?: Record | null; + save?: boolean | null; + source_datapoint_id?: string | null; + batches?: string[] | null; + user?: string | null; + environment?: string | null; + provider_api_keys?: ProviderApiKeys.Raw | null; + num_samples?: number | null; + stream?: boolean | null; + return_inputs?: boolean | null; + logprobs?: number | null; + suffix?: string | null; + } +} diff --git a/src/serialization/resources/prompts/client/requests/PromptLogRequest.ts b/src/serialization/resources/prompts/client/requests/PromptLogRequest.ts new file mode 100644 index 0000000..af7028d --- /dev/null +++ b/src/serialization/resources/prompts/client/requests/PromptLogRequest.ts @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ChatMessage } from "../../../../types/ChatMessage"; +import { PromptKernelRequest } from "../../../../types/PromptKernelRequest"; +import { PromptLogRequestToolChoice } from "../../types/PromptLogRequestToolChoice"; + +export const PromptLogRequest: core.serialization.Schema< + serializers.PromptLogRequest.Raw, + Omit +> = core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + outputMessage: core.serialization.property("output_message", ChatMessage.optional()), + promptTokens: core.serialization.property("prompt_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + promptCost: core.serialization.property("prompt_cost", core.serialization.number().optional()), + outputCost: core.serialization.property("output_cost", core.serialization.number().optional()), + finishReason: core.serialization.property("finish_reason", core.serialization.string().optional()), + prompt: PromptKernelRequest.optional(), + messages: core.serialization.list(ChatMessage).optional(), + toolChoice: core.serialization.property("tool_choice", PromptLogRequestToolChoice.optional()), + output: core.serialization.string().optional(), + rawOutput: core.serialization.property("raw_output", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + error: core.serialization.string().optional(), + providerLatency: core.serialization.property("provider_latency", core.serialization.number().optional()), + providerRequest: core.serialization.property( + "provider_request", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + providerResponse: core.serialization.property( + "provider_response", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + inputs: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), + metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + save: core.serialization.boolean().optional(), + sourceDatapointId: core.serialization.property("source_datapoint_id", core.serialization.string().optional()), + batches: core.serialization.list(core.serialization.string()).optional(), + user: core.serialization.string().optional(), + promptLogRequestEnvironment: core.serialization.property("environment", core.serialization.string().optional()), +}); + +export declare namespace PromptLogRequest { + interface Raw { + path?: string | null; + id?: string | null; + output_message?: ChatMessage.Raw | null; + prompt_tokens?: number | null; + output_tokens?: number | null; + prompt_cost?: number | null; + output_cost?: number | null; + finish_reason?: string | null; + prompt?: PromptKernelRequest.Raw | null; + messages?: ChatMessage.Raw[] | null; + tool_choice?: PromptLogRequestToolChoice.Raw | null; + output?: string | null; + raw_output?: string | null; + created_at?: string | null; + error?: string | null; + provider_latency?: number | null; + provider_request?: Record | null; + provider_response?: Record | null; + session_id?: string | null; + parent_id?: string | null; + inputs?: Record | null; + source?: string | null; + metadata?: Record | null; + save?: boolean | null; + source_datapoint_id?: string | null; + batches?: string[] | null; + user?: string | null; + environment?: string | null; + } +} diff --git a/src/serialization/resources/prompts/client/requests/PromptRequest.ts b/src/serialization/resources/prompts/client/requests/PromptRequest.ts new file mode 100644 index 0000000..fc03af5 --- /dev/null +++ b/src/serialization/resources/prompts/client/requests/PromptRequest.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ModelEndpoints } from "../../../../types/ModelEndpoints"; +import { PromptRequestTemplate } from "../../types/PromptRequestTemplate"; +import { ModelProviders } from "../../../../types/ModelProviders"; +import { PromptRequestStop } from "../../types/PromptRequestStop"; +import { ResponseFormat } from "../../../../types/ResponseFormat"; +import { ToolFunction } from "../../../../types/ToolFunction"; + +export const PromptRequest: core.serialization.Schema = + core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + model: core.serialization.string(), + endpoint: ModelEndpoints.optional(), + template: PromptRequestTemplate.optional(), + provider: ModelProviders.optional(), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + topP: core.serialization.property("top_p", core.serialization.number().optional()), + stop: PromptRequestStop.optional(), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + seed: core.serialization.number().optional(), + responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), + tools: core.serialization.list(ToolFunction).optional(), + linkedTools: core.serialization.property( + "linked_tools", + core.serialization.list(core.serialization.string()).optional() + ), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + }); + +export declare namespace PromptRequest { + interface Raw { + path?: string | null; + id?: string | null; + model: string; + endpoint?: ModelEndpoints.Raw | null; + template?: PromptRequestTemplate.Raw | null; + provider?: ModelProviders.Raw | null; + max_tokens?: number | null; + temperature?: number | null; + top_p?: number | null; + stop?: PromptRequestStop.Raw | null; + presence_penalty?: number | null; + frequency_penalty?: number | null; + other?: Record | null; + seed?: number | null; + response_format?: ResponseFormat.Raw | null; + tools?: ToolFunction.Raw[] | null; + linked_tools?: string[] | null; + commit_message?: string | null; + } +} diff --git a/src/serialization/resources/prompts/client/requests/UpdatePromptRequest.ts b/src/serialization/resources/prompts/client/requests/UpdatePromptRequest.ts new file mode 100644 index 0000000..364a710 --- /dev/null +++ b/src/serialization/resources/prompts/client/requests/UpdatePromptRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdatePromptRequest: core.serialization.Schema< + serializers.UpdatePromptRequest.Raw, + Humanloop.UpdatePromptRequest +> = core.serialization.object({ + path: core.serialization.string().optional(), + name: core.serialization.string().optional(), +}); + +export declare namespace UpdatePromptRequest { + interface Raw { + path?: string | null; + name?: string | null; + } +} diff --git a/src/serialization/resources/prompts/client/requests/index.ts b/src/serialization/resources/prompts/client/requests/index.ts new file mode 100644 index 0000000..4afe045 --- /dev/null +++ b/src/serialization/resources/prompts/client/requests/index.ts @@ -0,0 +1,4 @@ +export { PromptRequest } from "./PromptRequest"; +export { UpdatePromptRequest } from "./UpdatePromptRequest"; +export { PromptLogRequest } from "./PromptLogRequest"; +export { PromptCallRequest } from "./PromptCallRequest"; diff --git a/src/serialization/resources/prompts/index.ts b/src/serialization/resources/prompts/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/serialization/resources/prompts/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/serialization/resources/prompts/types/PromptCallRequestToolChoice.ts b/src/serialization/resources/prompts/types/PromptCallRequestToolChoice.ts new file mode 100644 index 0000000..47f2025 --- /dev/null +++ b/src/serialization/resources/prompts/types/PromptCallRequestToolChoice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolChoice } from "../../../types/ToolChoice"; + +export const PromptCallRequestToolChoice: core.serialization.Schema< + serializers.PromptCallRequestToolChoice.Raw, + Humanloop.PromptCallRequestToolChoice +> = core.serialization.undiscriminatedUnion([ + core.serialization.stringLiteral("none"), + core.serialization.stringLiteral("auto"), + core.serialization.stringLiteral("required"), + ToolChoice, +]); + +export declare namespace PromptCallRequestToolChoice { + type Raw = "none" | "auto" | "required" | ToolChoice.Raw; +} diff --git a/src/serialization/resources/prompts/types/PromptLogRequestToolChoice.ts b/src/serialization/resources/prompts/types/PromptLogRequestToolChoice.ts new file mode 100644 index 0000000..0079330 --- /dev/null +++ b/src/serialization/resources/prompts/types/PromptLogRequestToolChoice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { ToolChoice } from "../../../types/ToolChoice"; + +export const PromptLogRequestToolChoice: core.serialization.Schema< + serializers.PromptLogRequestToolChoice.Raw, + Humanloop.PromptLogRequestToolChoice +> = core.serialization.undiscriminatedUnion([ + core.serialization.stringLiteral("none"), + core.serialization.stringLiteral("auto"), + core.serialization.stringLiteral("required"), + ToolChoice, +]); + +export declare namespace PromptLogRequestToolChoice { + type Raw = "none" | "auto" | "required" | ToolChoice.Raw; +} diff --git a/src/serialization/resources/prompts/types/PromptRequestStop.ts b/src/serialization/resources/prompts/types/PromptRequestStop.ts new file mode 100644 index 0000000..154cf1e --- /dev/null +++ b/src/serialization/resources/prompts/types/PromptRequestStop.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; + +export const PromptRequestStop: core.serialization.Schema< + serializers.PromptRequestStop.Raw, + Humanloop.PromptRequestStop +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(core.serialization.string()), +]); + +export declare namespace PromptRequestStop { + type Raw = string | string[]; +} diff --git a/src/serialization/resources/prompts/types/PromptRequestTemplate.ts b/src/serialization/resources/prompts/types/PromptRequestTemplate.ts new file mode 100644 index 0000000..6bdd43c --- /dev/null +++ b/src/serialization/resources/prompts/types/PromptRequestTemplate.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { ChatMessage } from "../../../types/ChatMessage"; + +export const PromptRequestTemplate: core.serialization.Schema< + serializers.PromptRequestTemplate.Raw, + Humanloop.PromptRequestTemplate +> = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(ChatMessage)]); + +export declare namespace PromptRequestTemplate { + type Raw = string | ChatMessage.Raw[]; +} diff --git a/src/serialization/resources/prompts/types/PromptsCallResponse.ts b/src/serialization/resources/prompts/types/PromptsCallResponse.ts new file mode 100644 index 0000000..12a87f1 --- /dev/null +++ b/src/serialization/resources/prompts/types/PromptsCallResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { PromptCallResponse } from "../../../types/PromptCallResponse"; +import { PromptCallStreamResponse } from "../../../types/PromptCallStreamResponse"; + +export const PromptsCallResponse: core.serialization.Schema< + serializers.PromptsCallResponse.Raw, + Humanloop.PromptsCallResponse +> = core.serialization.undiscriminatedUnion([PromptCallResponse, PromptCallStreamResponse]); + +export declare namespace PromptsCallResponse { + type Raw = PromptCallResponse.Raw | PromptCallStreamResponse.Raw; +} diff --git a/src/serialization/resources/prompts/types/index.ts b/src/serialization/resources/prompts/types/index.ts new file mode 100644 index 0000000..4b89c9b --- /dev/null +++ b/src/serialization/resources/prompts/types/index.ts @@ -0,0 +1,5 @@ +export * from "./PromptRequestTemplate"; +export * from "./PromptRequestStop"; +export * from "./PromptLogRequestToolChoice"; +export * from "./PromptCallRequestToolChoice"; +export * from "./PromptsCallResponse"; diff --git a/src/serialization/resources/tools/client/index.ts b/src/serialization/resources/tools/client/index.ts new file mode 100644 index 0000000..0ab8d67 --- /dev/null +++ b/src/serialization/resources/tools/client/index.ts @@ -0,0 +1,2 @@ +export * as listEnvironments from "./listEnvironments"; +export * from "./requests"; diff --git a/src/serialization/resources/tools/client/listEnvironments.ts b/src/serialization/resources/tools/client/listEnvironments.ts new file mode 100644 index 0000000..6460e88 --- /dev/null +++ b/src/serialization/resources/tools/client/listEnvironments.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Humanloop from "../../../../api/index"; +import * as core from "../../../../core"; +import { FileEnvironmentResponse } from "../../../types/FileEnvironmentResponse"; + +export const Response: core.serialization.Schema< + serializers.tools.listEnvironments.Response.Raw, + Humanloop.FileEnvironmentResponse[] +> = core.serialization.list(FileEnvironmentResponse); + +export declare namespace Response { + type Raw = FileEnvironmentResponse.Raw[]; +} diff --git a/src/serialization/resources/tools/client/requests/ToolLogRequest.ts b/src/serialization/resources/tools/client/requests/ToolLogRequest.ts new file mode 100644 index 0000000..847a9bf --- /dev/null +++ b/src/serialization/resources/tools/client/requests/ToolLogRequest.ts @@ -0,0 +1,65 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ToolKernelRequest } from "../../../../types/ToolKernelRequest"; + +export const ToolLogRequest: core.serialization.Schema< + serializers.ToolLogRequest.Raw, + Omit +> = core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + output: core.serialization.string().optional(), + rawOutput: core.serialization.property("raw_output", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + error: core.serialization.string().optional(), + providerLatency: core.serialization.property("provider_latency", core.serialization.number().optional()), + providerRequest: core.serialization.property( + "provider_request", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + providerResponse: core.serialization.property( + "provider_response", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + inputs: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), + metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + save: core.serialization.boolean().optional(), + sourceDatapointId: core.serialization.property("source_datapoint_id", core.serialization.string().optional()), + batches: core.serialization.list(core.serialization.string()).optional(), + user: core.serialization.string().optional(), + toolLogRequestEnvironment: core.serialization.property("environment", core.serialization.string().optional()), + tool: ToolKernelRequest.optional(), +}); + +export declare namespace ToolLogRequest { + interface Raw { + path?: string | null; + id?: string | null; + output?: string | null; + raw_output?: string | null; + created_at?: string | null; + error?: string | null; + provider_latency?: number | null; + provider_request?: Record | null; + provider_response?: Record | null; + session_id?: string | null; + parent_id?: string | null; + inputs?: Record | null; + source?: string | null; + metadata?: Record | null; + save?: boolean | null; + source_datapoint_id?: string | null; + batches?: string[] | null; + user?: string | null; + environment?: string | null; + tool?: ToolKernelRequest.Raw | null; + } +} diff --git a/src/serialization/resources/tools/client/requests/ToolRequest.ts b/src/serialization/resources/tools/client/requests/ToolRequest.ts new file mode 100644 index 0000000..9b6371d --- /dev/null +++ b/src/serialization/resources/tools/client/requests/ToolRequest.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ToolFunction } from "../../../../types/ToolFunction"; +import { FilesToolType } from "../../../../types/FilesToolType"; + +export const ToolRequest: core.serialization.Schema = + core.serialization.object({ + path: core.serialization.string().optional(), + id: core.serialization.string().optional(), + function: ToolFunction.optional(), + sourceCode: core.serialization.property("source_code", core.serialization.string().optional()), + setupValues: core.serialization.property( + "setup_values", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + toolType: core.serialization.property("tool_type", FilesToolType.optional()), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + }); + +export declare namespace ToolRequest { + interface Raw { + path?: string | null; + id?: string | null; + function?: ToolFunction.Raw | null; + source_code?: string | null; + setup_values?: Record | null; + tool_type?: FilesToolType.Raw | null; + commit_message?: string | null; + } +} diff --git a/src/serialization/resources/tools/client/requests/UpdateToolRequest.ts b/src/serialization/resources/tools/client/requests/UpdateToolRequest.ts new file mode 100644 index 0000000..3d41b63 --- /dev/null +++ b/src/serialization/resources/tools/client/requests/UpdateToolRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Humanloop from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdateToolRequest: core.serialization.Schema< + serializers.UpdateToolRequest.Raw, + Humanloop.UpdateToolRequest +> = core.serialization.object({ + path: core.serialization.string().optional(), + name: core.serialization.string().optional(), +}); + +export declare namespace UpdateToolRequest { + interface Raw { + path?: string | null; + name?: string | null; + } +} diff --git a/src/serialization/resources/tools/client/requests/index.ts b/src/serialization/resources/tools/client/requests/index.ts new file mode 100644 index 0000000..2a2fd2f --- /dev/null +++ b/src/serialization/resources/tools/client/requests/index.ts @@ -0,0 +1,3 @@ +export { ToolRequest } from "./ToolRequest"; +export { UpdateToolRequest } from "./UpdateToolRequest"; +export { ToolLogRequest } from "./ToolLogRequest"; diff --git a/src/serialization/resources/tools/index.ts b/src/serialization/resources/tools/index.ts new file mode 100644 index 0000000..5ec7692 --- /dev/null +++ b/src/serialization/resources/tools/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/types/AgentConfigResponse.ts b/src/serialization/types/AgentConfigResponse.ts new file mode 100644 index 0000000..f1b8250 --- /dev/null +++ b/src/serialization/types/AgentConfigResponse.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { BaseModelsUserResponse } from "./BaseModelsUserResponse"; +import { ToolConfigRequest } from "./ToolConfigRequest"; +import { ModelConfigRequest } from "./ModelConfigRequest"; + +export const AgentConfigResponse: core.serialization.ObjectSchema< + serializers.AgentConfigResponse.Raw, + Humanloop.AgentConfigResponse +> = core.serialization.object({ + id: core.serialization.string(), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + type: core.serialization.stringLiteral("agent"), + createdBy: core.serialization.property("created_by", BaseModelsUserResponse.optional()), + status: core.serialization.string(), + name: core.serialization.string(), + description: core.serialization.string().optional(), + agentClass: core.serialization.property("agent_class", core.serialization.string()), + tools: core.serialization.list(ToolConfigRequest).optional(), + modelConfig: core.serialization.property("model_config", ModelConfigRequest), +}); + +export declare namespace AgentConfigResponse { + interface Raw { + id: string; + other?: Record | null; + type: "agent"; + created_by?: BaseModelsUserResponse.Raw | null; + status: string; + name: string; + description?: string | null; + agent_class: string; + tools?: ToolConfigRequest.Raw[] | null; + model_config: ModelConfigRequest.Raw; + } +} diff --git a/src/serialization/types/BaseMetricResponse.ts b/src/serialization/types/BaseMetricResponse.ts new file mode 100644 index 0000000..d71f00d --- /dev/null +++ b/src/serialization/types/BaseMetricResponse.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const BaseMetricResponse: core.serialization.ObjectSchema< + serializers.BaseMetricResponse.Raw, + Humanloop.BaseMetricResponse +> = core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + description: core.serialization.string(), + code: core.serialization.string(), + default: core.serialization.boolean(), + active: core.serialization.boolean(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace BaseMetricResponse { + interface Raw { + id: string; + name: string; + description: string; + code: string; + default: boolean; + active: boolean; + created_at: string; + updated_at: string; + } +} diff --git a/src/serialization/types/BaseModelsUserResponse.ts b/src/serialization/types/BaseModelsUserResponse.ts new file mode 100644 index 0000000..ef67546 --- /dev/null +++ b/src/serialization/types/BaseModelsUserResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const BaseModelsUserResponse: core.serialization.ObjectSchema< + serializers.BaseModelsUserResponse.Raw, + Humanloop.BaseModelsUserResponse +> = core.serialization.object({ + id: core.serialization.string(), + emailAddress: core.serialization.property("email_address", core.serialization.string()), + fullName: core.serialization.property("full_name", core.serialization.string().optional()), + verified: core.serialization.boolean(), +}); + +export declare namespace BaseModelsUserResponse { + interface Raw { + id: string; + email_address: string; + full_name?: string | null; + verified: boolean; + } +} diff --git a/src/serialization/types/BooleanEvaluatorVersionStats.ts b/src/serialization/types/BooleanEvaluatorVersionStats.ts new file mode 100644 index 0000000..8992f1d --- /dev/null +++ b/src/serialization/types/BooleanEvaluatorVersionStats.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const BooleanEvaluatorVersionStats: core.serialization.ObjectSchema< + serializers.BooleanEvaluatorVersionStats.Raw, + Humanloop.BooleanEvaluatorVersionStats +> = core.serialization.object({ + evaluatorVersionId: core.serialization.property("evaluator_version_id", core.serialization.string()), + totalLogs: core.serialization.property("total_logs", core.serialization.number()), + numJudgments: core.serialization.property("num_judgments", core.serialization.number()), + numNulls: core.serialization.property("num_nulls", core.serialization.number()), + numErrors: core.serialization.property("num_errors", core.serialization.number()), + numTrue: core.serialization.property("num_true", core.serialization.number()), + numFalse: core.serialization.property("num_false", core.serialization.number()), +}); + +export declare namespace BooleanEvaluatorVersionStats { + interface Raw { + evaluator_version_id: string; + total_logs: number; + num_judgments: number; + num_nulls: number; + num_errors: number; + num_true: number; + num_false: number; + } +} diff --git a/src/serialization/types/CategoricalFeedbackLabel.ts b/src/serialization/types/CategoricalFeedbackLabel.ts new file mode 100644 index 0000000..cb43893 --- /dev/null +++ b/src/serialization/types/CategoricalFeedbackLabel.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { LabelSentiment } from "./LabelSentiment"; +import { FeedbackLabelStatus } from "./FeedbackLabelStatus"; + +export const CategoricalFeedbackLabel: core.serialization.ObjectSchema< + serializers.CategoricalFeedbackLabel.Raw, + Humanloop.CategoricalFeedbackLabel +> = core.serialization.object({ + value: core.serialization.string(), + sentiment: LabelSentiment, + status: FeedbackLabelStatus, +}); + +export declare namespace CategoricalFeedbackLabel { + interface Raw { + value: string; + sentiment: LabelSentiment.Raw; + status: FeedbackLabelStatus.Raw; + } +} diff --git a/src/serialization/types/ChatMessage.ts b/src/serialization/types/ChatMessage.ts new file mode 100644 index 0000000..6a9f143 --- /dev/null +++ b/src/serialization/types/ChatMessage.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessageContent } from "./ChatMessageContent"; +import { ChatRole } from "./ChatRole"; +import { ToolCall } from "./ToolCall"; + +export const ChatMessage: core.serialization.ObjectSchema = + core.serialization.object({ + content: ChatMessageContent.optional(), + name: core.serialization.string().optional(), + toolCallId: core.serialization.property("tool_call_id", core.serialization.string().optional()), + role: ChatRole, + toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall).optional()), + }); + +export declare namespace ChatMessage { + interface Raw { + content?: ChatMessageContent.Raw | null; + name?: string | null; + tool_call_id?: string | null; + role: ChatRole.Raw; + tool_calls?: ToolCall.Raw[] | null; + } +} diff --git a/src/serialization/types/ChatMessageContent.ts b/src/serialization/types/ChatMessageContent.ts new file mode 100644 index 0000000..e39a918 --- /dev/null +++ b/src/serialization/types/ChatMessageContent.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessageContentItem } from "./ChatMessageContentItem"; + +export const ChatMessageContent: core.serialization.Schema< + serializers.ChatMessageContent.Raw, + Humanloop.ChatMessageContent +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(ChatMessageContentItem), +]); + +export declare namespace ChatMessageContent { + type Raw = string | ChatMessageContentItem.Raw[]; +} diff --git a/src/serialization/types/ChatMessageContentItem.ts b/src/serialization/types/ChatMessageContentItem.ts new file mode 100644 index 0000000..0198b67 --- /dev/null +++ b/src/serialization/types/ChatMessageContentItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { TextChatContent } from "./TextChatContent"; +import { ImageChatContent } from "./ImageChatContent"; + +export const ChatMessageContentItem: core.serialization.Schema< + serializers.ChatMessageContentItem.Raw, + Humanloop.ChatMessageContentItem +> = core.serialization.undiscriminatedUnion([TextChatContent, ImageChatContent]); + +export declare namespace ChatMessageContentItem { + type Raw = TextChatContent.Raw | ImageChatContent.Raw; +} diff --git a/src/serialization/types/ChatMessageWithToolCall.ts b/src/serialization/types/ChatMessageWithToolCall.ts new file mode 100644 index 0000000..8f53f8a --- /dev/null +++ b/src/serialization/types/ChatMessageWithToolCall.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessageWithToolCallContent } from "./ChatMessageWithToolCallContent"; +import { ChatRole } from "./ChatRole"; +import { ToolCall } from "./ToolCall"; +import { FunctionTool } from "./FunctionTool"; + +export const ChatMessageWithToolCall: core.serialization.ObjectSchema< + serializers.ChatMessageWithToolCall.Raw, + Humanloop.ChatMessageWithToolCall +> = core.serialization.object({ + content: ChatMessageWithToolCallContent.optional(), + name: core.serialization.string().optional(), + toolCallId: core.serialization.property("tool_call_id", core.serialization.string().optional()), + role: ChatRole, + toolCalls: core.serialization.property("tool_calls", core.serialization.list(ToolCall).optional()), + toolCall: core.serialization.property("tool_call", FunctionTool.optional()), +}); + +export declare namespace ChatMessageWithToolCall { + interface Raw { + content?: ChatMessageWithToolCallContent.Raw | null; + name?: string | null; + tool_call_id?: string | null; + role: ChatRole.Raw; + tool_calls?: ToolCall.Raw[] | null; + tool_call?: FunctionTool.Raw | null; + } +} diff --git a/src/serialization/types/ChatMessageWithToolCallContent.ts b/src/serialization/types/ChatMessageWithToolCallContent.ts new file mode 100644 index 0000000..d226636 --- /dev/null +++ b/src/serialization/types/ChatMessageWithToolCallContent.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessageWithToolCallContentItem } from "./ChatMessageWithToolCallContentItem"; + +export const ChatMessageWithToolCallContent: core.serialization.Schema< + serializers.ChatMessageWithToolCallContent.Raw, + Humanloop.ChatMessageWithToolCallContent +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(ChatMessageWithToolCallContentItem), +]); + +export declare namespace ChatMessageWithToolCallContent { + type Raw = string | ChatMessageWithToolCallContentItem.Raw[]; +} diff --git a/src/serialization/types/ChatMessageWithToolCallContentItem.ts b/src/serialization/types/ChatMessageWithToolCallContentItem.ts new file mode 100644 index 0000000..793888e --- /dev/null +++ b/src/serialization/types/ChatMessageWithToolCallContentItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { TextChatContent } from "./TextChatContent"; +import { ImageChatContent } from "./ImageChatContent"; + +export const ChatMessageWithToolCallContentItem: core.serialization.Schema< + serializers.ChatMessageWithToolCallContentItem.Raw, + Humanloop.ChatMessageWithToolCallContentItem +> = core.serialization.undiscriminatedUnion([TextChatContent, ImageChatContent]); + +export declare namespace ChatMessageWithToolCallContentItem { + type Raw = TextChatContent.Raw | ImageChatContent.Raw; +} diff --git a/src/serialization/types/ChatRole.ts b/src/serialization/types/ChatRole.ts new file mode 100644 index 0000000..b15be1d --- /dev/null +++ b/src/serialization/types/ChatRole.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ChatRole: core.serialization.Schema = + core.serialization.enum_(["user", "assistant", "system", "tool"]); + +export declare namespace ChatRole { + type Raw = "user" | "assistant" | "system" | "tool"; +} diff --git a/src/serialization/types/ChatToolType.ts b/src/serialization/types/ChatToolType.ts new file mode 100644 index 0000000..571bc6c --- /dev/null +++ b/src/serialization/types/ChatToolType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ChatToolType: core.serialization.Schema = + core.serialization.stringLiteral("function"); + +export declare namespace ChatToolType { + type Raw = "function"; +} diff --git a/src/serialization/types/CodeEvaluatorRequest.ts b/src/serialization/types/CodeEvaluatorRequest.ts new file mode 100644 index 0000000..3bfdd47 --- /dev/null +++ b/src/serialization/types/CodeEvaluatorRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatorArgumentsType } from "./EvaluatorArgumentsType"; +import { EvaluatorReturnTypeEnum } from "./EvaluatorReturnTypeEnum"; + +export const CodeEvaluatorRequest: core.serialization.ObjectSchema< + serializers.CodeEvaluatorRequest.Raw, + Humanloop.CodeEvaluatorRequest +> = core.serialization.object({ + argumentsType: core.serialization.property("arguments_type", EvaluatorArgumentsType), + returnType: core.serialization.property("return_type", EvaluatorReturnTypeEnum), + evaluatorType: core.serialization.property("evaluator_type", core.serialization.stringLiteral("python")), + code: core.serialization.string().optional(), +}); + +export declare namespace CodeEvaluatorRequest { + interface Raw { + arguments_type: EvaluatorArgumentsType.Raw; + return_type: EvaluatorReturnTypeEnum.Raw; + evaluator_type: "python"; + code?: string | null; + } +} diff --git a/src/serialization/types/CommitRequest.ts b/src/serialization/types/CommitRequest.ts new file mode 100644 index 0000000..b040183 --- /dev/null +++ b/src/serialization/types/CommitRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const CommitRequest: core.serialization.ObjectSchema = + core.serialization.object({ + commitMessage: core.serialization.property("commit_message", core.serialization.string()), + }); + +export declare namespace CommitRequest { + interface Raw { + commit_message: string; + } +} diff --git a/src/serialization/types/ConfigResponse.ts b/src/serialization/types/ConfigResponse.ts new file mode 100644 index 0000000..518a330 --- /dev/null +++ b/src/serialization/types/ConfigResponse.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ModelConfigResponse } from "./ModelConfigResponse"; +import { ToolConfigResponse } from "./ToolConfigResponse"; +import { EvaluatorConfigResponse } from "./EvaluatorConfigResponse"; +import { AgentConfigResponse } from "./AgentConfigResponse"; +import { GenericConfigResponse } from "./GenericConfigResponse"; + +export const ConfigResponse: core.serialization.Schema = + core.serialization.undiscriminatedUnion([ + ModelConfigResponse, + ToolConfigResponse, + EvaluatorConfigResponse, + AgentConfigResponse, + GenericConfigResponse, + ]); + +export declare namespace ConfigResponse { + type Raw = + | ModelConfigResponse.Raw + | ToolConfigResponse.Raw + | EvaluatorConfigResponse.Raw + | AgentConfigResponse.Raw + | GenericConfigResponse.Raw; +} diff --git a/src/serialization/types/ConfigToolResponse.ts b/src/serialization/types/ConfigToolResponse.ts new file mode 100644 index 0000000..a1c43c6 --- /dev/null +++ b/src/serialization/types/ConfigToolResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ConfigToolResponse: core.serialization.ObjectSchema< + serializers.ConfigToolResponse.Raw, + Humanloop.ConfigToolResponse +> = core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + description: core.serialization.string().optional(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), +}); + +export declare namespace ConfigToolResponse { + interface Raw { + id: string; + name: string; + description?: string | null; + parameters?: Record | null; + source?: string | null; + } +} diff --git a/src/serialization/types/CreateDatapointRequest.ts b/src/serialization/types/CreateDatapointRequest.ts new file mode 100644 index 0000000..5d8271a --- /dev/null +++ b/src/serialization/types/CreateDatapointRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; +import { CreateDatapointRequestTargetValue } from "./CreateDatapointRequestTargetValue"; + +export const CreateDatapointRequest: core.serialization.ObjectSchema< + serializers.CreateDatapointRequest.Raw, + Humanloop.CreateDatapointRequest +> = core.serialization.object({ + inputs: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(), + messages: core.serialization.list(ChatMessage).optional(), + target: core.serialization.record(core.serialization.string(), CreateDatapointRequestTargetValue).optional(), +}); + +export declare namespace CreateDatapointRequest { + interface Raw { + inputs?: Record | null; + messages?: ChatMessage.Raw[] | null; + target?: Record | null; + } +} diff --git a/src/serialization/types/CreateDatapointRequestTargetValue.ts b/src/serialization/types/CreateDatapointRequestTargetValue.ts new file mode 100644 index 0000000..9756bcb --- /dev/null +++ b/src/serialization/types/CreateDatapointRequestTargetValue.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const CreateDatapointRequestTargetValue: core.serialization.Schema< + serializers.CreateDatapointRequestTargetValue.Raw, + Humanloop.CreateDatapointRequestTargetValue +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.number(), + core.serialization.number(), + core.serialization.boolean(), + core.serialization.record(core.serialization.string(), core.serialization.unknown()), + core.serialization.list(core.serialization.unknown()), +]); + +export declare namespace CreateDatapointRequestTargetValue { + type Raw = string | number | number | boolean | Record | unknown[]; +} diff --git a/src/serialization/types/CreateEvaluationRequest.ts b/src/serialization/types/CreateEvaluationRequest.ts new file mode 100644 index 0000000..fd08d28 --- /dev/null +++ b/src/serialization/types/CreateEvaluationRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluationsDatasetRequest } from "./EvaluationsDatasetRequest"; +import { EvaluateeRequest } from "./EvaluateeRequest"; +import { EvaluationsRequest } from "./EvaluationsRequest"; + +export const CreateEvaluationRequest: core.serialization.ObjectSchema< + serializers.CreateEvaluationRequest.Raw, + Humanloop.CreateEvaluationRequest +> = core.serialization.object({ + dataset: EvaluationsDatasetRequest, + evaluatees: core.serialization.list(EvaluateeRequest), + evaluators: core.serialization.list(EvaluationsRequest), +}); + +export declare namespace CreateEvaluationRequest { + interface Raw { + dataset: EvaluationsDatasetRequest.Raw; + evaluatees: EvaluateeRequest.Raw[]; + evaluators: EvaluationsRequest.Raw[]; + } +} diff --git a/src/serialization/types/CreatePromptLogResponse.ts b/src/serialization/types/CreatePromptLogResponse.ts new file mode 100644 index 0000000..3551c71 --- /dev/null +++ b/src/serialization/types/CreatePromptLogResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const CreatePromptLogResponse: core.serialization.ObjectSchema< + serializers.CreatePromptLogResponse.Raw, + Humanloop.CreatePromptLogResponse +> = core.serialization.object({ + id: core.serialization.string(), + promptId: core.serialization.property("prompt_id", core.serialization.string()), + versionId: core.serialization.property("version_id", core.serialization.string()), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), +}); + +export declare namespace CreatePromptLogResponse { + interface Raw { + id: string; + prompt_id: string; + version_id: string; + session_id?: string | null; + } +} diff --git a/src/serialization/types/CreateToolLogResponse.ts b/src/serialization/types/CreateToolLogResponse.ts new file mode 100644 index 0000000..03db603 --- /dev/null +++ b/src/serialization/types/CreateToolLogResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const CreateToolLogResponse: core.serialization.ObjectSchema< + serializers.CreateToolLogResponse.Raw, + Humanloop.CreateToolLogResponse +> = core.serialization.object({ + id: core.serialization.string(), + toolId: core.serialization.property("tool_id", core.serialization.string()), + versionId: core.serialization.property("version_id", core.serialization.string()), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), +}); + +export declare namespace CreateToolLogResponse { + interface Raw { + id: string; + tool_id: string; + version_id: string; + session_id?: string | null; + } +} diff --git a/src/serialization/types/DashboardConfiguration.ts b/src/serialization/types/DashboardConfiguration.ts new file mode 100644 index 0000000..a8f1daa --- /dev/null +++ b/src/serialization/types/DashboardConfiguration.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { TimeUnit } from "./TimeUnit"; + +export const DashboardConfiguration: core.serialization.ObjectSchema< + serializers.DashboardConfiguration.Raw, + Humanloop.DashboardConfiguration +> = core.serialization.object({ + timeUnit: core.serialization.property("time_unit", TimeUnit), + timeRangeDays: core.serialization.property("time_range_days", core.serialization.number()), + modelConfigIds: core.serialization.property( + "model_config_ids", + core.serialization.list(core.serialization.string()) + ), +}); + +export declare namespace DashboardConfiguration { + interface Raw { + time_unit: TimeUnit.Raw; + time_range_days: number; + model_config_ids: string[]; + } +} diff --git a/src/serialization/types/DatapointResponse.ts b/src/serialization/types/DatapointResponse.ts new file mode 100644 index 0000000..12886d2 --- /dev/null +++ b/src/serialization/types/DatapointResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; +import { DatapointResponseTargetValue } from "./DatapointResponseTargetValue"; + +export const DatapointResponse: core.serialization.ObjectSchema< + serializers.DatapointResponse.Raw, + Humanloop.DatapointResponse +> = core.serialization.object({ + inputs: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(), + messages: core.serialization.list(ChatMessage).optional(), + target: core.serialization.record(core.serialization.string(), DatapointResponseTargetValue).optional(), + id: core.serialization.string(), +}); + +export declare namespace DatapointResponse { + interface Raw { + inputs?: Record | null; + messages?: ChatMessage.Raw[] | null; + target?: Record | null; + id: string; + } +} diff --git a/src/serialization/types/DatapointResponseTargetValue.ts b/src/serialization/types/DatapointResponseTargetValue.ts new file mode 100644 index 0000000..5806a56 --- /dev/null +++ b/src/serialization/types/DatapointResponseTargetValue.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const DatapointResponseTargetValue: core.serialization.Schema< + serializers.DatapointResponseTargetValue.Raw, + Humanloop.DatapointResponseTargetValue +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.number(), + core.serialization.number(), + core.serialization.boolean(), + core.serialization.record(core.serialization.string(), core.serialization.unknown()), + core.serialization.list(core.serialization.unknown()), +]); + +export declare namespace DatapointResponseTargetValue { + type Raw = string | number | number | boolean | Record | unknown[]; +} diff --git a/src/serialization/types/DatasetResponse.ts b/src/serialization/types/DatasetResponse.ts new file mode 100644 index 0000000..1e78309 --- /dev/null +++ b/src/serialization/types/DatasetResponse.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EnvironmentResponse } from "./EnvironmentResponse"; +import { UserResponse } from "./UserResponse"; +import { VersionStatus } from "./VersionStatus"; +import { DatapointResponse } from "./DatapointResponse"; + +export const DatasetResponse: core.serialization.ObjectSchema< + serializers.DatasetResponse.Raw, + Humanloop.DatasetResponse +> = core.serialization.object({ + path: core.serialization.string(), + id: core.serialization.string(), + name: core.serialization.string(), + versionId: core.serialization.property("version_id", core.serialization.string()), + type: core.serialization.stringLiteral("dataset").optional(), + environments: core.serialization.list(EnvironmentResponse).optional(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + createdBy: core.serialization.property("created_by", UserResponse.optional()), + status: VersionStatus, + lastUsedAt: core.serialization.property("last_used_at", core.serialization.date()), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + datapointsCount: core.serialization.property("datapoints_count", core.serialization.number()), + datapoints: core.serialization.list(DatapointResponse).optional(), +}); + +export declare namespace DatasetResponse { + interface Raw { + path: string; + id: string; + name: string; + version_id: string; + type?: "dataset" | null; + environments?: EnvironmentResponse.Raw[] | null; + created_at: string; + updated_at: string; + created_by?: UserResponse.Raw | null; + status: VersionStatus.Raw; + last_used_at: string; + commit_message?: string | null; + datapoints_count: number; + datapoints?: DatapointResponse.Raw[] | null; + } +} diff --git a/src/serialization/types/DirectoryResponse.ts b/src/serialization/types/DirectoryResponse.ts new file mode 100644 index 0000000..369a888 --- /dev/null +++ b/src/serialization/types/DirectoryResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const DirectoryResponse: core.serialization.ObjectSchema< + serializers.DirectoryResponse.Raw, + Humanloop.DirectoryResponse +> = core.serialization.object({ + name: core.serialization.string(), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + id: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace DirectoryResponse { + interface Raw { + name: string; + parent_id?: string | null; + id: string; + created_at: string; + updated_at: string; + } +} diff --git a/src/serialization/types/DirectoryWithParentsAndChildrenResponse.ts b/src/serialization/types/DirectoryWithParentsAndChildrenResponse.ts new file mode 100644 index 0000000..cf23081 --- /dev/null +++ b/src/serialization/types/DirectoryWithParentsAndChildrenResponse.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { DirectoryResponse } from "./DirectoryResponse"; +import { DirectoryWithParentsAndChildrenResponseFilesItem } from "./DirectoryWithParentsAndChildrenResponseFilesItem"; + +export const DirectoryWithParentsAndChildrenResponse: core.serialization.ObjectSchema< + serializers.DirectoryWithParentsAndChildrenResponse.Raw, + Humanloop.DirectoryWithParentsAndChildrenResponse +> = core.serialization.object({ + name: core.serialization.string(), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + id: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + subdirectories: core.serialization.list(DirectoryResponse), + files: core.serialization.list(DirectoryWithParentsAndChildrenResponseFilesItem), + parents: core.serialization.list(DirectoryResponse), +}); + +export declare namespace DirectoryWithParentsAndChildrenResponse { + interface Raw { + name: string; + parent_id?: string | null; + id: string; + created_at: string; + updated_at: string; + subdirectories: DirectoryResponse.Raw[]; + files: DirectoryWithParentsAndChildrenResponseFilesItem.Raw[]; + parents: DirectoryResponse.Raw[]; + } +} diff --git a/src/serialization/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts b/src/serialization/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts new file mode 100644 index 0000000..e32f4b1 --- /dev/null +++ b/src/serialization/types/DirectoryWithParentsAndChildrenResponseFilesItem.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; +import { ToolResponse } from "./ToolResponse"; +import { EvaluatorResponse } from "./EvaluatorResponse"; +import { DatasetResponse } from "./DatasetResponse"; + +export const DirectoryWithParentsAndChildrenResponseFilesItem: core.serialization.Schema< + serializers.DirectoryWithParentsAndChildrenResponseFilesItem.Raw, + Humanloop.DirectoryWithParentsAndChildrenResponseFilesItem +> = core.serialization.undiscriminatedUnion([PromptResponse, ToolResponse, EvaluatorResponse, DatasetResponse]); + +export declare namespace DirectoryWithParentsAndChildrenResponseFilesItem { + type Raw = PromptResponse.Raw | ToolResponse.Raw | EvaluatorResponse.Raw | DatasetResponse.Raw; +} diff --git a/src/serialization/types/EnvironmentResponse.ts b/src/serialization/types/EnvironmentResponse.ts new file mode 100644 index 0000000..5ba9de0 --- /dev/null +++ b/src/serialization/types/EnvironmentResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EnvironmentTag } from "./EnvironmentTag"; + +export const EnvironmentResponse: core.serialization.ObjectSchema< + serializers.EnvironmentResponse.Raw, + Humanloop.EnvironmentResponse +> = core.serialization.object({ + id: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + name: core.serialization.string(), + tag: EnvironmentTag, +}); + +export declare namespace EnvironmentResponse { + interface Raw { + id: string; + created_at: string; + name: string; + tag: EnvironmentTag.Raw; + } +} diff --git a/src/serialization/types/EnvironmentTag.ts b/src/serialization/types/EnvironmentTag.ts new file mode 100644 index 0000000..01a1f4e --- /dev/null +++ b/src/serialization/types/EnvironmentTag.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EnvironmentTag: core.serialization.Schema = + core.serialization.enum_(["default", "other"]); + +export declare namespace EnvironmentTag { + type Raw = "default" | "other"; +} diff --git a/src/serialization/types/EvaluatedVersionResponse.ts b/src/serialization/types/EvaluatedVersionResponse.ts new file mode 100644 index 0000000..30d614c --- /dev/null +++ b/src/serialization/types/EvaluatedVersionResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; +import { ToolResponse } from "./ToolResponse"; + +export const EvaluatedVersionResponse: core.serialization.Schema< + serializers.EvaluatedVersionResponse.Raw, + Humanloop.EvaluatedVersionResponse +> = core.serialization.undiscriminatedUnion([PromptResponse, ToolResponse]); + +export declare namespace EvaluatedVersionResponse { + type Raw = PromptResponse.Raw | ToolResponse.Raw; +} diff --git a/src/serialization/types/EvaluateeRequest.ts b/src/serialization/types/EvaluateeRequest.ts new file mode 100644 index 0000000..f30edf9 --- /dev/null +++ b/src/serialization/types/EvaluateeRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluateeRequest: core.serialization.ObjectSchema< + serializers.EvaluateeRequest.Raw, + Humanloop.EvaluateeRequest +> = core.serialization.object({ + versionId: core.serialization.property("version_id", core.serialization.string()), + batchId: core.serialization.property("batch_id", core.serialization.string().optional()), + orchestrated: core.serialization.boolean().optional(), +}); + +export declare namespace EvaluateeRequest { + interface Raw { + version_id: string; + batch_id?: string | null; + orchestrated?: boolean | null; + } +} diff --git a/src/serialization/types/EvaluateeResponse.ts b/src/serialization/types/EvaluateeResponse.ts new file mode 100644 index 0000000..5f0b405 --- /dev/null +++ b/src/serialization/types/EvaluateeResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatedVersionResponse } from "./EvaluatedVersionResponse"; + +export const EvaluateeResponse: core.serialization.ObjectSchema< + serializers.EvaluateeResponse.Raw, + Humanloop.EvaluateeResponse +> = core.serialization.object({ + version: EvaluatedVersionResponse, + batchId: core.serialization.property("batch_id", core.serialization.string().optional()), + orchestrated: core.serialization.boolean(), +}); + +export declare namespace EvaluateeResponse { + interface Raw { + version: EvaluatedVersionResponse.Raw; + batch_id?: string | null; + orchestrated: boolean; + } +} diff --git a/src/serialization/types/EvaluationDebugResultResponse.ts b/src/serialization/types/EvaluationDebugResultResponse.ts new file mode 100644 index 0000000..9dfb290 --- /dev/null +++ b/src/serialization/types/EvaluationDebugResultResponse.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluationDebugResultResponseValue } from "./EvaluationDebugResultResponseValue"; + +export const EvaluationDebugResultResponse: core.serialization.ObjectSchema< + serializers.EvaluationDebugResultResponse.Raw, + Humanloop.EvaluationDebugResultResponse +> = core.serialization.object({ + logId: core.serialization.property("log_id", core.serialization.string()), + log: core.serialization.lazyObject(async () => (await import("..")).LogResponse), + datapointId: core.serialization.property("datapoint_id", core.serialization.string().optional()), + llmEvaluationLog: core.serialization.property( + "llm_evaluation_log", + core.serialization.lazyObject(async () => (await import("..")).LogResponse).optional() + ), + value: EvaluationDebugResultResponseValue.optional(), + error: core.serialization.string().optional(), +}); + +export declare namespace EvaluationDebugResultResponse { + interface Raw { + log_id: string; + log: serializers.LogResponse.Raw; + datapoint_id?: string | null; + llm_evaluation_log?: serializers.LogResponse.Raw | null; + value?: EvaluationDebugResultResponseValue.Raw | null; + error?: string | null; + } +} diff --git a/src/serialization/types/EvaluationDebugResultResponseValue.ts b/src/serialization/types/EvaluationDebugResultResponseValue.ts new file mode 100644 index 0000000..2756392 --- /dev/null +++ b/src/serialization/types/EvaluationDebugResultResponseValue.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluationDebugResultResponseValue: core.serialization.Schema< + serializers.EvaluationDebugResultResponseValue.Raw, + Humanloop.EvaluationDebugResultResponseValue +> = core.serialization.undiscriminatedUnion([core.serialization.boolean(), core.serialization.number()]); + +export declare namespace EvaluationDebugResultResponseValue { + type Raw = boolean | number; +} diff --git a/src/serialization/types/EvaluationEvaluatorResponse.ts b/src/serialization/types/EvaluationEvaluatorResponse.ts new file mode 100644 index 0000000..07dea26 --- /dev/null +++ b/src/serialization/types/EvaluationEvaluatorResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatorResponse } from "./EvaluatorResponse"; + +export const EvaluationEvaluatorResponse: core.serialization.ObjectSchema< + serializers.EvaluationEvaluatorResponse.Raw, + Humanloop.EvaluationEvaluatorResponse +> = core.serialization.object({ + version: EvaluatorResponse, + orchestrated: core.serialization.boolean(), +}); + +export declare namespace EvaluationEvaluatorResponse { + interface Raw { + version: EvaluatorResponse.Raw; + orchestrated: boolean; + } +} diff --git a/src/serialization/types/EvaluationResponse.ts b/src/serialization/types/EvaluationResponse.ts new file mode 100644 index 0000000..bbe5eec --- /dev/null +++ b/src/serialization/types/EvaluationResponse.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { DatasetResponse } from "./DatasetResponse"; +import { EvaluateeResponse } from "./EvaluateeResponse"; +import { EvaluationEvaluatorResponse } from "./EvaluationEvaluatorResponse"; +import { EvaluationStatus } from "./EvaluationStatus"; +import { UserResponse } from "./UserResponse"; + +export const EvaluationResponse: core.serialization.ObjectSchema< + serializers.EvaluationResponse.Raw, + Humanloop.EvaluationResponse +> = core.serialization.object({ + id: core.serialization.string(), + dataset: DatasetResponse, + evaluatees: core.serialization.list(EvaluateeResponse), + evaluators: core.serialization.list(EvaluationEvaluatorResponse), + status: EvaluationStatus, + createdAt: core.serialization.property("created_at", core.serialization.date()), + createdBy: core.serialization.property("created_by", UserResponse.optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace EvaluationResponse { + interface Raw { + id: string; + dataset: DatasetResponse.Raw; + evaluatees: EvaluateeResponse.Raw[]; + evaluators: EvaluationEvaluatorResponse.Raw[]; + status: EvaluationStatus.Raw; + created_at: string; + created_by?: UserResponse.Raw | null; + updated_at: string; + } +} diff --git a/src/serialization/types/EvaluationResultResponse.ts b/src/serialization/types/EvaluationResultResponse.ts new file mode 100644 index 0000000..37f7e82 --- /dev/null +++ b/src/serialization/types/EvaluationResultResponse.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluationResultResponseValue } from "./EvaluationResultResponseValue"; + +export const EvaluationResultResponse: core.serialization.ObjectSchema< + serializers.EvaluationResultResponse.Raw, + Humanloop.EvaluationResultResponse +> = core.serialization.object({ + id: core.serialization.string(), + evaluatorId: core.serialization.property("evaluator_id", core.serialization.string()), + evaluatorVersionId: core.serialization.property("evaluator_version_id", core.serialization.string()), + evaluationId: core.serialization.property("evaluation_id", core.serialization.string().optional()), + logId: core.serialization.property("log_id", core.serialization.string()), + log: core.serialization.lazyObject(async () => (await import("..")).LogResponse).optional(), + versionId: core.serialization.property("version_id", core.serialization.string().optional()), + version: core.serialization.unknown().optional(), + value: EvaluationResultResponseValue.optional(), + error: core.serialization.string().optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + llmEvaluatorLog: core.serialization.property( + "llm_evaluator_log", + core.serialization.lazyObject(async () => (await import("..")).LogResponse).optional() + ), +}); + +export declare namespace EvaluationResultResponse { + interface Raw { + id: string; + evaluator_id: string; + evaluator_version_id: string; + evaluation_id?: string | null; + log_id: string; + log?: serializers.LogResponse.Raw | null; + version_id?: string | null; + version?: unknown | null; + value?: EvaluationResultResponseValue.Raw | null; + error?: string | null; + updated_at: string; + created_at: string; + llm_evaluator_log?: serializers.LogResponse.Raw | null; + } +} diff --git a/src/serialization/types/EvaluationResultResponseValue.ts b/src/serialization/types/EvaluationResultResponseValue.ts new file mode 100644 index 0000000..b90fa52 --- /dev/null +++ b/src/serialization/types/EvaluationResultResponseValue.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluationResultResponseValue: core.serialization.Schema< + serializers.EvaluationResultResponseValue.Raw, + Humanloop.EvaluationResultResponseValue +> = core.serialization.undiscriminatedUnion([core.serialization.boolean(), core.serialization.number()]); + +export declare namespace EvaluationResultResponseValue { + type Raw = boolean | number; +} diff --git a/src/serialization/types/EvaluationStats.ts b/src/serialization/types/EvaluationStats.ts new file mode 100644 index 0000000..14255c2 --- /dev/null +++ b/src/serialization/types/EvaluationStats.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { OverallStats } from "./OverallStats"; +import { VersionStats } from "./VersionStats"; + +export const EvaluationStats: core.serialization.ObjectSchema< + serializers.EvaluationStats.Raw, + Humanloop.EvaluationStats +> = core.serialization.object({ + overallStats: core.serialization.property("overall_stats", OverallStats), + versionStats: core.serialization.property("version_stats", core.serialization.list(VersionStats)), +}); + +export declare namespace EvaluationStats { + interface Raw { + overall_stats: OverallStats.Raw; + version_stats: VersionStats.Raw[]; + } +} diff --git a/src/serialization/types/EvaluationStatus.ts b/src/serialization/types/EvaluationStatus.ts new file mode 100644 index 0000000..cec1d87 --- /dev/null +++ b/src/serialization/types/EvaluationStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluationStatus: core.serialization.Schema = + core.serialization.enum_(["pending", "running", "completed", "cancelled", "failed"]); + +export declare namespace EvaluationStatus { + type Raw = "pending" | "running" | "completed" | "cancelled" | "failed"; +} diff --git a/src/serialization/types/EvaluationsDatasetRequest.ts b/src/serialization/types/EvaluationsDatasetRequest.ts new file mode 100644 index 0000000..ff04a0a --- /dev/null +++ b/src/serialization/types/EvaluationsDatasetRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluationsDatasetRequest: core.serialization.ObjectSchema< + serializers.EvaluationsDatasetRequest.Raw, + Humanloop.EvaluationsDatasetRequest +> = core.serialization.object({ + versionId: core.serialization.property("version_id", core.serialization.string()), +}); + +export declare namespace EvaluationsDatasetRequest { + interface Raw { + version_id: string; + } +} diff --git a/src/serialization/types/EvaluationsRequest.ts b/src/serialization/types/EvaluationsRequest.ts new file mode 100644 index 0000000..cacd1a2 --- /dev/null +++ b/src/serialization/types/EvaluationsRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluationsRequest: core.serialization.ObjectSchema< + serializers.EvaluationsRequest.Raw, + Humanloop.EvaluationsRequest +> = core.serialization.object({ + versionId: core.serialization.property("version_id", core.serialization.string()), + orchestrated: core.serialization.boolean().optional(), +}); + +export declare namespace EvaluationsRequest { + interface Raw { + version_id: string; + orchestrated?: boolean | null; + } +} diff --git a/src/serialization/types/EvaluatorActivationDeactivationRequest.ts b/src/serialization/types/EvaluatorActivationDeactivationRequest.ts new file mode 100644 index 0000000..c7e68d9 --- /dev/null +++ b/src/serialization/types/EvaluatorActivationDeactivationRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem } from "./EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem"; +import { EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem } from "./EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem"; + +export const EvaluatorActivationDeactivationRequest: core.serialization.ObjectSchema< + serializers.EvaluatorActivationDeactivationRequest.Raw, + Humanloop.EvaluatorActivationDeactivationRequest +> = core.serialization.object({ + evaluatorsToActivate: core.serialization.property( + "evaluators_to_activate", + core.serialization.list(EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem).optional() + ), + evaluatorsToDeactivate: core.serialization.property( + "evaluators_to_deactivate", + core.serialization.list(EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem).optional() + ), +}); + +export declare namespace EvaluatorActivationDeactivationRequest { + interface Raw { + evaluators_to_activate?: EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.Raw[] | null; + evaluators_to_deactivate?: EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.Raw[] | null; + } +} diff --git a/src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts b/src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts new file mode 100644 index 0000000..bca13af --- /dev/null +++ b/src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { MonitoringEvaluatorVersionRequest } from "./MonitoringEvaluatorVersionRequest"; +import { MonitoringEvaluatorEnvironmentRequest } from "./MonitoringEvaluatorEnvironmentRequest"; + +export const EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem: core.serialization.Schema< + serializers.EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem.Raw, + Humanloop.EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem +> = core.serialization.undiscriminatedUnion([MonitoringEvaluatorVersionRequest, MonitoringEvaluatorEnvironmentRequest]); + +export declare namespace EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem { + type Raw = MonitoringEvaluatorVersionRequest.Raw | MonitoringEvaluatorEnvironmentRequest.Raw; +} diff --git a/src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts b/src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts new file mode 100644 index 0000000..3d4940b --- /dev/null +++ b/src/serialization/types/EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { MonitoringEvaluatorVersionRequest } from "./MonitoringEvaluatorVersionRequest"; +import { MonitoringEvaluatorEnvironmentRequest } from "./MonitoringEvaluatorEnvironmentRequest"; + +export const EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem: core.serialization.Schema< + serializers.EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem.Raw, + Humanloop.EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem +> = core.serialization.undiscriminatedUnion([MonitoringEvaluatorVersionRequest, MonitoringEvaluatorEnvironmentRequest]); + +export declare namespace EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem { + type Raw = MonitoringEvaluatorVersionRequest.Raw | MonitoringEvaluatorEnvironmentRequest.Raw; +} diff --git a/src/serialization/types/EvaluatorAggregate.ts b/src/serialization/types/EvaluatorAggregate.ts new file mode 100644 index 0000000..30a25bd --- /dev/null +++ b/src/serialization/types/EvaluatorAggregate.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluatorAggregate: core.serialization.ObjectSchema< + serializers.EvaluatorAggregate.Raw, + Humanloop.EvaluatorAggregate +> = core.serialization.object({ + value: core.serialization.number(), + evaluatorId: core.serialization.property("evaluator_id", core.serialization.string()), + evaluatorVersionId: core.serialization.property("evaluator_version_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace EvaluatorAggregate { + interface Raw { + value: number; + evaluator_id: string; + evaluator_version_id: string; + created_at: string; + updated_at: string; + } +} diff --git a/src/serialization/types/EvaluatorArgumentsType.ts b/src/serialization/types/EvaluatorArgumentsType.ts new file mode 100644 index 0000000..a928f32 --- /dev/null +++ b/src/serialization/types/EvaluatorArgumentsType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluatorArgumentsType: core.serialization.Schema< + serializers.EvaluatorArgumentsType.Raw, + Humanloop.EvaluatorArgumentsType +> = core.serialization.enum_(["target_free", "target_required"]); + +export declare namespace EvaluatorArgumentsType { + type Raw = "target_free" | "target_required"; +} diff --git a/src/serialization/types/EvaluatorConfigResponse.ts b/src/serialization/types/EvaluatorConfigResponse.ts new file mode 100644 index 0000000..0927781 --- /dev/null +++ b/src/serialization/types/EvaluatorConfigResponse.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { BaseModelsUserResponse } from "./BaseModelsUserResponse"; +import { ModelConfigResponse } from "./ModelConfigResponse"; +import { EvaluatorArgumentsType } from "./EvaluatorArgumentsType"; +import { EvaluatorReturnTypeEnum } from "./EvaluatorReturnTypeEnum"; + +export const EvaluatorConfigResponse: core.serialization.ObjectSchema< + serializers.EvaluatorConfigResponse.Raw, + Humanloop.EvaluatorConfigResponse +> = core.serialization.object({ + id: core.serialization.string(), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + type: core.serialization.stringLiteral("evaluator"), + createdBy: core.serialization.property("created_by", BaseModelsUserResponse.optional()), + status: core.serialization.string(), + name: core.serialization.string(), + description: core.serialization.string().optional(), + evaluatorType: core.serialization.property("evaluator_type", core.serialization.string()), + modelConfig: core.serialization.property("model_config", ModelConfigResponse.optional()), + code: core.serialization.string().optional(), + argumentsType: core.serialization.property("arguments_type", EvaluatorArgumentsType.optional()), + returnType: core.serialization.property("return_type", EvaluatorReturnTypeEnum.optional()), +}); + +export declare namespace EvaluatorConfigResponse { + interface Raw { + id: string; + other?: Record | null; + type: "evaluator"; + created_by?: BaseModelsUserResponse.Raw | null; + status: string; + name: string; + description?: string | null; + evaluator_type: string; + model_config?: ModelConfigResponse.Raw | null; + code?: string | null; + arguments_type?: EvaluatorArgumentsType.Raw | null; + return_type?: EvaluatorReturnTypeEnum.Raw | null; + } +} diff --git a/src/serialization/types/EvaluatorResponse.ts b/src/serialization/types/EvaluatorResponse.ts new file mode 100644 index 0000000..f8c3693 --- /dev/null +++ b/src/serialization/types/EvaluatorResponse.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EnvironmentResponse } from "./EnvironmentResponse"; +import { UserResponse } from "./UserResponse"; +import { VersionStatus } from "./VersionStatus"; +import { EvaluatorResponseSpec } from "./EvaluatorResponseSpec"; +import { InputResponse } from "./InputResponse"; +import { EvaluatorAggregate } from "./EvaluatorAggregate"; + +export const EvaluatorResponse: core.serialization.ObjectSchema< + serializers.EvaluatorResponse.Raw, + Humanloop.EvaluatorResponse +> = core.serialization.object({ + path: core.serialization.string(), + id: core.serialization.string(), + name: core.serialization.string(), + versionId: core.serialization.property("version_id", core.serialization.string()), + type: core.serialization.stringLiteral("evaluator").optional(), + environments: core.serialization.list(EnvironmentResponse).optional(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + createdBy: core.serialization.property("created_by", UserResponse.optional()), + status: VersionStatus, + lastUsedAt: core.serialization.property("last_used_at", core.serialization.date()), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + spec: EvaluatorResponseSpec, + versionLogsCount: core.serialization.property("version_logs_count", core.serialization.number()), + totalLogsCount: core.serialization.property("total_logs_count", core.serialization.number()), + inputs: core.serialization.list(InputResponse), + evaluatorAggregates: core.serialization.property( + "evaluator_aggregates", + core.serialization.list(EvaluatorAggregate).optional() + ), +}); + +export declare namespace EvaluatorResponse { + interface Raw { + path: string; + id: string; + name: string; + version_id: string; + type?: "evaluator" | null; + environments?: EnvironmentResponse.Raw[] | null; + created_at: string; + updated_at: string; + created_by?: UserResponse.Raw | null; + status: VersionStatus.Raw; + last_used_at: string; + commit_message?: string | null; + spec: EvaluatorResponseSpec.Raw; + version_logs_count: number; + total_logs_count: number; + inputs: InputResponse.Raw[]; + evaluator_aggregates?: EvaluatorAggregate.Raw[] | null; + } +} diff --git a/src/serialization/types/EvaluatorResponseSpec.ts b/src/serialization/types/EvaluatorResponseSpec.ts new file mode 100644 index 0000000..9c286b5 --- /dev/null +++ b/src/serialization/types/EvaluatorResponseSpec.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { LlmEvaluatorRequest } from "./LlmEvaluatorRequest"; +import { CodeEvaluatorRequest } from "./CodeEvaluatorRequest"; +import { HumanEvaluatorRequest } from "./HumanEvaluatorRequest"; + +export const EvaluatorResponseSpec: core.serialization.Schema< + serializers.EvaluatorResponseSpec.Raw, + Humanloop.EvaluatorResponseSpec +> = core.serialization.undiscriminatedUnion([LlmEvaluatorRequest, CodeEvaluatorRequest, HumanEvaluatorRequest]); + +export declare namespace EvaluatorResponseSpec { + type Raw = LlmEvaluatorRequest.Raw | CodeEvaluatorRequest.Raw | HumanEvaluatorRequest.Raw; +} diff --git a/src/serialization/types/EvaluatorReturnTypeEnum.ts b/src/serialization/types/EvaluatorReturnTypeEnum.ts new file mode 100644 index 0000000..36bd36b --- /dev/null +++ b/src/serialization/types/EvaluatorReturnTypeEnum.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const EvaluatorReturnTypeEnum: core.serialization.Schema< + serializers.EvaluatorReturnTypeEnum.Raw, + Humanloop.EvaluatorReturnTypeEnum +> = core.serialization.enum_(["boolean", "number"]); + +export declare namespace EvaluatorReturnTypeEnum { + type Raw = "boolean" | "number"; +} diff --git a/src/serialization/types/ExperimentResponse.ts b/src/serialization/types/ExperimentResponse.ts new file mode 100644 index 0000000..e512865 --- /dev/null +++ b/src/serialization/types/ExperimentResponse.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ExperimentStatus } from "./ExperimentStatus"; +import { ExperimentVersionResponse } from "./ExperimentVersionResponse"; +import { BaseMetricResponse } from "./BaseMetricResponse"; +import { PositiveLabel } from "./PositiveLabel"; + +export const ExperimentResponse: core.serialization.ObjectSchema< + serializers.ExperimentResponse.Raw, + Humanloop.ExperimentResponse +> = core.serialization.object({ + id: core.serialization.string(), + fileId: core.serialization.property("file_id", core.serialization.string()), + name: core.serialization.string(), + status: ExperimentStatus, + versions: core.serialization.list(ExperimentVersionResponse).optional(), + metric: BaseMetricResponse, + positiveLabels: core.serialization.property("positive_labels", core.serialization.list(PositiveLabel)), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace ExperimentResponse { + interface Raw { + id: string; + file_id: string; + name: string; + status: ExperimentStatus.Raw; + versions?: ExperimentVersionResponse.Raw[] | null; + metric: BaseMetricResponse.Raw; + positive_labels: PositiveLabel.Raw[]; + created_at: string; + updated_at: string; + } +} diff --git a/src/serialization/types/ExperimentStatus.ts b/src/serialization/types/ExperimentStatus.ts new file mode 100644 index 0000000..19b4eda --- /dev/null +++ b/src/serialization/types/ExperimentStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ExperimentStatus: core.serialization.Schema = + core.serialization.enum_(["Initialized", "In progress"]); + +export declare namespace ExperimentStatus { + type Raw = "Initialized" | "In progress"; +} diff --git a/src/serialization/types/ExperimentVersionResponse.ts b/src/serialization/types/ExperimentVersionResponse.ts new file mode 100644 index 0000000..733a8a3 --- /dev/null +++ b/src/serialization/types/ExperimentVersionResponse.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ExperimentVersionResponse: core.serialization.ObjectSchema< + serializers.ExperimentVersionResponse.Raw, + Humanloop.ExperimentVersionResponse +> = core.serialization.object({ + mean: core.serialization.number().optional(), + spread: core.serialization.number().optional(), + trialsCount: core.serialization.property("trials_count", core.serialization.number()), + active: core.serialization.boolean(), + id: core.serialization.string(), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + versionId: core.serialization.property("version_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace ExperimentVersionResponse { + interface Raw { + mean?: number | null; + spread?: number | null; + trials_count: number; + active: boolean; + id: string; + commit_message?: string | null; + version_id: string; + created_at: string; + updated_at: string; + } +} diff --git a/src/serialization/types/FeedbackClass.ts b/src/serialization/types/FeedbackClass.ts new file mode 100644 index 0000000..20827d7 --- /dev/null +++ b/src/serialization/types/FeedbackClass.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FeedbackClass: core.serialization.Schema = + core.serialization.enum_(["select", "multi_select", "text", "number"]); + +export declare namespace FeedbackClass { + type Raw = "select" | "multi_select" | "text" | "number"; +} diff --git a/src/serialization/types/FeedbackLabelStatus.ts b/src/serialization/types/FeedbackLabelStatus.ts new file mode 100644 index 0000000..3e28fa6 --- /dev/null +++ b/src/serialization/types/FeedbackLabelStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FeedbackLabelStatus: core.serialization.Schema< + serializers.FeedbackLabelStatus.Raw, + Humanloop.FeedbackLabelStatus +> = core.serialization.enum_(["unset", "active", "inactive"]); + +export declare namespace FeedbackLabelStatus { + type Raw = "unset" | "active" | "inactive"; +} diff --git a/src/serialization/types/FeedbackResponse.ts b/src/serialization/types/FeedbackResponse.ts new file mode 100644 index 0000000..79a1fcb --- /dev/null +++ b/src/serialization/types/FeedbackResponse.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { FeedbackResponseType } from "./FeedbackResponseType"; +import { FeedbackResponseValue } from "./FeedbackResponseValue"; + +export const FeedbackResponse: core.serialization.ObjectSchema< + serializers.FeedbackResponse.Raw, + Humanloop.FeedbackResponse +> = core.serialization.object({ + type: FeedbackResponseType, + value: FeedbackResponseValue, + dataId: core.serialization.property("data_id", core.serialization.string().optional()), + user: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + id: core.serialization.string(), +}); + +export declare namespace FeedbackResponse { + interface Raw { + type: FeedbackResponseType.Raw; + value: FeedbackResponseValue.Raw; + data_id?: string | null; + user?: string | null; + created_at?: string | null; + id: string; + } +} diff --git a/src/serialization/types/FeedbackResponseType.ts b/src/serialization/types/FeedbackResponseType.ts new file mode 100644 index 0000000..a302f47 --- /dev/null +++ b/src/serialization/types/FeedbackResponseType.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { FeedbackType } from "./FeedbackType"; + +export const FeedbackResponseType: core.serialization.Schema< + serializers.FeedbackResponseType.Raw, + Humanloop.FeedbackResponseType +> = core.serialization.undiscriminatedUnion([FeedbackType, core.serialization.string()]); + +export declare namespace FeedbackResponseType { + type Raw = FeedbackType.Raw | string; +} diff --git a/src/serialization/types/FeedbackResponseValue.ts b/src/serialization/types/FeedbackResponseValue.ts new file mode 100644 index 0000000..20c342b --- /dev/null +++ b/src/serialization/types/FeedbackResponseValue.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FeedbackResponseValue: core.serialization.Schema< + serializers.FeedbackResponseValue.Raw, + Humanloop.FeedbackResponseValue +> = core.serialization.undiscriminatedUnion([core.serialization.number(), core.serialization.string()]); + +export declare namespace FeedbackResponseValue { + type Raw = number | string; +} diff --git a/src/serialization/types/FeedbackType.ts b/src/serialization/types/FeedbackType.ts new file mode 100644 index 0000000..69626e3 --- /dev/null +++ b/src/serialization/types/FeedbackType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FeedbackType: core.serialization.Schema = + core.serialization.enum_(["rating", "action", "issue", "correction", "comment"]); + +export declare namespace FeedbackType { + type Raw = "rating" | "action" | "issue" | "correction" | "comment"; +} diff --git a/src/serialization/types/FeedbackTypeModel.ts b/src/serialization/types/FeedbackTypeModel.ts new file mode 100644 index 0000000..c143de5 --- /dev/null +++ b/src/serialization/types/FeedbackTypeModel.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { FeedbackTypeModelType } from "./FeedbackTypeModelType"; +import { CategoricalFeedbackLabel } from "./CategoricalFeedbackLabel"; + +export const FeedbackTypeModel: core.serialization.ObjectSchema< + serializers.FeedbackTypeModel.Raw, + Humanloop.FeedbackTypeModel +> = core.serialization.object({ + type: FeedbackTypeModelType, + values: core.serialization.list(CategoricalFeedbackLabel).optional(), +}); + +export declare namespace FeedbackTypeModel { + interface Raw { + type: FeedbackTypeModelType.Raw; + values?: CategoricalFeedbackLabel.Raw[] | null; + } +} diff --git a/src/serialization/types/FeedbackTypeModelType.ts b/src/serialization/types/FeedbackTypeModelType.ts new file mode 100644 index 0000000..e0bc01a --- /dev/null +++ b/src/serialization/types/FeedbackTypeModelType.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { FeedbackType } from "./FeedbackType"; + +export const FeedbackTypeModelType: core.serialization.Schema< + serializers.FeedbackTypeModelType.Raw, + Humanloop.FeedbackTypeModelType +> = core.serialization.undiscriminatedUnion([FeedbackType, core.serialization.string()]); + +export declare namespace FeedbackTypeModelType { + type Raw = FeedbackType.Raw | string; +} diff --git a/src/serialization/types/FeedbackTypes.ts b/src/serialization/types/FeedbackTypes.ts new file mode 100644 index 0000000..0eb8ce9 --- /dev/null +++ b/src/serialization/types/FeedbackTypes.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { FeedbackTypeModel } from "./FeedbackTypeModel"; + +export const FeedbackTypes: core.serialization.Schema = + core.serialization.list(FeedbackTypeModel); + +export declare namespace FeedbackTypes { + type Raw = FeedbackTypeModel.Raw[]; +} diff --git a/src/serialization/types/FileEnvironmentResponse.ts b/src/serialization/types/FileEnvironmentResponse.ts new file mode 100644 index 0000000..e0d1d02 --- /dev/null +++ b/src/serialization/types/FileEnvironmentResponse.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EnvironmentTag } from "./EnvironmentTag"; +import { FileEnvironmentResponseFile } from "./FileEnvironmentResponseFile"; + +export const FileEnvironmentResponse: core.serialization.ObjectSchema< + serializers.FileEnvironmentResponse.Raw, + Humanloop.FileEnvironmentResponse +> = core.serialization.object({ + id: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + name: core.serialization.string(), + tag: EnvironmentTag, + file: FileEnvironmentResponseFile.optional(), +}); + +export declare namespace FileEnvironmentResponse { + interface Raw { + id: string; + created_at: string; + name: string; + tag: EnvironmentTag.Raw; + file?: FileEnvironmentResponseFile.Raw | null; + } +} diff --git a/src/serialization/types/FileEnvironmentResponseFile.ts b/src/serialization/types/FileEnvironmentResponseFile.ts new file mode 100644 index 0000000..2801c75 --- /dev/null +++ b/src/serialization/types/FileEnvironmentResponseFile.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; +import { ToolResponse } from "./ToolResponse"; +import { DatasetResponse } from "./DatasetResponse"; +import { EvaluatorResponse } from "./EvaluatorResponse"; + +export const FileEnvironmentResponseFile: core.serialization.Schema< + serializers.FileEnvironmentResponseFile.Raw, + Humanloop.FileEnvironmentResponseFile +> = core.serialization.undiscriminatedUnion([PromptResponse, ToolResponse, DatasetResponse, EvaluatorResponse]); + +export declare namespace FileEnvironmentResponseFile { + type Raw = PromptResponse.Raw | ToolResponse.Raw | DatasetResponse.Raw | EvaluatorResponse.Raw; +} diff --git a/src/serialization/types/FilesToolType.ts b/src/serialization/types/FilesToolType.ts new file mode 100644 index 0000000..c73df43 --- /dev/null +++ b/src/serialization/types/FilesToolType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FilesToolType: core.serialization.Schema = + core.serialization.enum_(["pinecone_search", "google", "mock", "snippet", "json_schema", "get_api_call"]); + +export declare namespace FilesToolType { + type Raw = "pinecone_search" | "google" | "mock" | "snippet" | "json_schema" | "get_api_call"; +} diff --git a/src/serialization/types/FunctionTool.ts b/src/serialization/types/FunctionTool.ts new file mode 100644 index 0000000..0648e26 --- /dev/null +++ b/src/serialization/types/FunctionTool.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FunctionTool: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string(), + arguments: core.serialization.string().optional(), + }); + +export declare namespace FunctionTool { + interface Raw { + name: string; + arguments?: string | null; + } +} diff --git a/src/serialization/types/FunctionToolChoice.ts b/src/serialization/types/FunctionToolChoice.ts new file mode 100644 index 0000000..69c5de6 --- /dev/null +++ b/src/serialization/types/FunctionToolChoice.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const FunctionToolChoice: core.serialization.ObjectSchema< + serializers.FunctionToolChoice.Raw, + Humanloop.FunctionToolChoice +> = core.serialization.object({ + name: core.serialization.string(), +}); + +export declare namespace FunctionToolChoice { + interface Raw { + name: string; + } +} diff --git a/src/serialization/types/GenericConfigResponse.ts b/src/serialization/types/GenericConfigResponse.ts new file mode 100644 index 0000000..179856a --- /dev/null +++ b/src/serialization/types/GenericConfigResponse.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { BaseModelsUserResponse } from "./BaseModelsUserResponse"; + +export const GenericConfigResponse: core.serialization.ObjectSchema< + serializers.GenericConfigResponse.Raw, + Humanloop.GenericConfigResponse +> = core.serialization.object({ + id: core.serialization.string(), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + type: core.serialization.stringLiteral("generic"), + createdBy: core.serialization.property("created_by", BaseModelsUserResponse.optional()), + status: core.serialization.string(), + name: core.serialization.string(), + description: core.serialization.string().optional(), +}); + +export declare namespace GenericConfigResponse { + interface Raw { + id: string; + other?: Record | null; + type: "generic"; + created_by?: BaseModelsUserResponse.Raw | null; + status: string; + name: string; + description?: string | null; + } +} diff --git a/src/serialization/types/HttpValidationError.ts b/src/serialization/types/HttpValidationError.ts new file mode 100644 index 0000000..bcb99df --- /dev/null +++ b/src/serialization/types/HttpValidationError.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ValidationError } from "./ValidationError"; + +export const HttpValidationError: core.serialization.ObjectSchema< + serializers.HttpValidationError.Raw, + Humanloop.HttpValidationError +> = core.serialization.object({ + detail: core.serialization.list(ValidationError).optional(), +}); + +export declare namespace HttpValidationError { + interface Raw { + detail?: ValidationError.Raw[] | null; + } +} diff --git a/src/serialization/types/HumanEvaluatorRequest.ts b/src/serialization/types/HumanEvaluatorRequest.ts new file mode 100644 index 0000000..496b71a --- /dev/null +++ b/src/serialization/types/HumanEvaluatorRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatorArgumentsType } from "./EvaluatorArgumentsType"; +import { EvaluatorReturnTypeEnum } from "./EvaluatorReturnTypeEnum"; + +export const HumanEvaluatorRequest: core.serialization.ObjectSchema< + serializers.HumanEvaluatorRequest.Raw, + Humanloop.HumanEvaluatorRequest +> = core.serialization.object({ + argumentsType: core.serialization.property("arguments_type", EvaluatorArgumentsType), + returnType: core.serialization.property("return_type", EvaluatorReturnTypeEnum), + evaluatorType: core.serialization.property("evaluator_type", core.serialization.stringLiteral("human")), +}); + +export declare namespace HumanEvaluatorRequest { + interface Raw { + arguments_type: EvaluatorArgumentsType.Raw; + return_type: EvaluatorReturnTypeEnum.Raw; + evaluator_type: "human"; + } +} diff --git a/src/serialization/types/ImageChatContent.ts b/src/serialization/types/ImageChatContent.ts new file mode 100644 index 0000000..7ab1743 --- /dev/null +++ b/src/serialization/types/ImageChatContent.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ImageUrl } from "./ImageUrl"; + +export const ImageChatContent: core.serialization.ObjectSchema< + serializers.ImageChatContent.Raw, + Humanloop.ImageChatContent +> = core.serialization.object({ + type: core.serialization.stringLiteral("image_url"), + imageUrl: core.serialization.property("image_url", ImageUrl), +}); + +export declare namespace ImageChatContent { + interface Raw { + type: "image_url"; + image_url: ImageUrl.Raw; + } +} diff --git a/src/serialization/types/ImageUrl.ts b/src/serialization/types/ImageUrl.ts new file mode 100644 index 0000000..31366e0 --- /dev/null +++ b/src/serialization/types/ImageUrl.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ImageUrlDetail } from "./ImageUrlDetail"; + +export const ImageUrl: core.serialization.ObjectSchema = + core.serialization.object({ + url: core.serialization.string(), + detail: ImageUrlDetail.optional(), + }); + +export declare namespace ImageUrl { + interface Raw { + url: string; + detail?: ImageUrlDetail.Raw | null; + } +} diff --git a/src/serialization/types/ImageUrlDetail.ts b/src/serialization/types/ImageUrlDetail.ts new file mode 100644 index 0000000..4c7a4f3 --- /dev/null +++ b/src/serialization/types/ImageUrlDetail.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ImageUrlDetail: core.serialization.Schema = + core.serialization.enum_(["high", "low", "auto"]); + +export declare namespace ImageUrlDetail { + type Raw = "high" | "low" | "auto"; +} diff --git a/src/serialization/types/InputResponse.ts b/src/serialization/types/InputResponse.ts new file mode 100644 index 0000000..b5ec759 --- /dev/null +++ b/src/serialization/types/InputResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const InputResponse: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string(), + }); + +export declare namespace InputResponse { + interface Raw { + name: string; + } +} diff --git a/src/serialization/types/LabelSentiment.ts b/src/serialization/types/LabelSentiment.ts new file mode 100644 index 0000000..56b19b1 --- /dev/null +++ b/src/serialization/types/LabelSentiment.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const LabelSentiment: core.serialization.Schema = + core.serialization.enum_(["positive", "negative", "neutral", "unset"]); + +export declare namespace LabelSentiment { + type Raw = "positive" | "negative" | "neutral" | "unset"; +} diff --git a/src/serialization/types/LinkedToolRequest.ts b/src/serialization/types/LinkedToolRequest.ts new file mode 100644 index 0000000..e9302f6 --- /dev/null +++ b/src/serialization/types/LinkedToolRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const LinkedToolRequest: core.serialization.ObjectSchema< + serializers.LinkedToolRequest.Raw, + Humanloop.LinkedToolRequest +> = core.serialization.object({ + id: core.serialization.string(), + source: core.serialization.stringLiteral("organization"), + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), +}); + +export declare namespace LinkedToolRequest { + interface Raw { + id: string; + source: "organization"; + name?: string | null; + description?: string | null; + parameters?: Record | null; + } +} diff --git a/src/serialization/types/LinkedToolResponse.ts b/src/serialization/types/LinkedToolResponse.ts new file mode 100644 index 0000000..a5d2d75 --- /dev/null +++ b/src/serialization/types/LinkedToolResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const LinkedToolResponse: core.serialization.ObjectSchema< + serializers.LinkedToolResponse.Raw, + Humanloop.LinkedToolResponse +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + id: core.serialization.string(), + versionId: core.serialization.property("version_id", core.serialization.string()), +}); + +export declare namespace LinkedToolResponse { + interface Raw { + name: string; + description: string; + parameters?: Record | null; + id: string; + version_id: string; + } +} diff --git a/src/serialization/types/ListDatasets.ts b/src/serialization/types/ListDatasets.ts new file mode 100644 index 0000000..cc5a482 --- /dev/null +++ b/src/serialization/types/ListDatasets.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { DatasetResponse } from "./DatasetResponse"; + +export const ListDatasets: core.serialization.ObjectSchema = + core.serialization.object({ + records: core.serialization.list(DatasetResponse), + }); + +export declare namespace ListDatasets { + interface Raw { + records: DatasetResponse.Raw[]; + } +} diff --git a/src/serialization/types/ListEvaluators.ts b/src/serialization/types/ListEvaluators.ts new file mode 100644 index 0000000..e63aa41 --- /dev/null +++ b/src/serialization/types/ListEvaluators.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatorResponse } from "./EvaluatorResponse"; + +export const ListEvaluators: core.serialization.ObjectSchema = + core.serialization.object({ + records: core.serialization.list(EvaluatorResponse), + }); + +export declare namespace ListEvaluators { + interface Raw { + records: EvaluatorResponse.Raw[]; + } +} diff --git a/src/serialization/types/ListPrompts.ts b/src/serialization/types/ListPrompts.ts new file mode 100644 index 0000000..36eb926 --- /dev/null +++ b/src/serialization/types/ListPrompts.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; + +export const ListPrompts: core.serialization.ObjectSchema = + core.serialization.object({ + records: core.serialization.list(PromptResponse), + }); + +export declare namespace ListPrompts { + interface Raw { + records: PromptResponse.Raw[]; + } +} diff --git a/src/serialization/types/ListTools.ts b/src/serialization/types/ListTools.ts new file mode 100644 index 0000000..1c5e781 --- /dev/null +++ b/src/serialization/types/ListTools.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolResponse } from "./ToolResponse"; + +export const ListTools: core.serialization.ObjectSchema = + core.serialization.object({ + records: core.serialization.list(ToolResponse), + }); + +export declare namespace ListTools { + interface Raw { + records: ToolResponse.Raw[]; + } +} diff --git a/src/serialization/types/LlmEvaluatorRequest.ts b/src/serialization/types/LlmEvaluatorRequest.ts new file mode 100644 index 0000000..a1467d4 --- /dev/null +++ b/src/serialization/types/LlmEvaluatorRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluatorArgumentsType } from "./EvaluatorArgumentsType"; +import { EvaluatorReturnTypeEnum } from "./EvaluatorReturnTypeEnum"; +import { PromptKernelRequest } from "./PromptKernelRequest"; + +export const LlmEvaluatorRequest: core.serialization.ObjectSchema< + serializers.LlmEvaluatorRequest.Raw, + Humanloop.LlmEvaluatorRequest +> = core.serialization.object({ + argumentsType: core.serialization.property("arguments_type", EvaluatorArgumentsType), + returnType: core.serialization.property("return_type", EvaluatorReturnTypeEnum), + evaluatorType: core.serialization.property("evaluator_type", core.serialization.stringLiteral("llm")), + prompt: PromptKernelRequest.optional(), +}); + +export declare namespace LlmEvaluatorRequest { + interface Raw { + arguments_type: EvaluatorArgumentsType.Raw; + return_type: EvaluatorReturnTypeEnum.Raw; + evaluator_type: "llm"; + prompt?: PromptKernelRequest.Raw | null; + } +} diff --git a/src/serialization/types/LogResponse.ts b/src/serialization/types/LogResponse.ts new file mode 100644 index 0000000..019c29b --- /dev/null +++ b/src/serialization/types/LogResponse.ts @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessageWithToolCall } from "./ChatMessageWithToolCall"; +import { LogResponseJudgment } from "./LogResponseJudgment"; +import { ConfigResponse } from "./ConfigResponse"; +import { FeedbackResponse } from "./FeedbackResponse"; +import { MetricValueResponse } from "./MetricValueResponse"; +import { ToolResultResponse } from "./ToolResultResponse"; +import { LogResponseToolChoice } from "./LogResponseToolChoice"; +import { ObservabilityStatus } from "./ObservabilityStatus"; + +export const LogResponse: core.serialization.ObjectSchema = + core.serialization.object({ + project: core.serialization.string().optional(), + projectId: core.serialization.property("project_id", core.serialization.string().optional()), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), + sessionReferenceId: core.serialization.property("session_reference_id", core.serialization.string().optional()), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + parentReferenceId: core.serialization.property("parent_reference_id", core.serialization.string().optional()), + inputs: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), + metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + save: core.serialization.boolean().optional(), + sourceDatapointId: core.serialization.property("source_datapoint_id", core.serialization.string().optional()), + id: core.serialization.string(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optional()), + trialId: core.serialization.property("trial_id", core.serialization.string().optional()), + messages: core.serialization.list(ChatMessageWithToolCall).optional(), + output: core.serialization.string().optional(), + judgment: LogResponseJudgment.optional(), + configId: core.serialization.property("config_id", core.serialization.string().optional()), + config: ConfigResponse, + environment: core.serialization.string().optional(), + feedback: core.serialization.list(FeedbackResponse).optional(), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + error: core.serialization.string().optional(), + duration: core.serialization.number().optional(), + outputMessage: core.serialization.property("output_message", ChatMessageWithToolCall.optional()), + promptTokens: core.serialization.property("prompt_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + promptCost: core.serialization.property("prompt_cost", core.serialization.number().optional()), + outputCost: core.serialization.property("output_cost", core.serialization.number().optional()), + providerRequest: core.serialization.property( + "provider_request", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + providerResponse: core.serialization.property( + "provider_response", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + user: core.serialization.string().optional(), + providerLatency: core.serialization.property("provider_latency", core.serialization.number().optional()), + tokens: core.serialization.number().optional(), + rawOutput: core.serialization.property("raw_output", core.serialization.string().optional()), + finishReason: core.serialization.property("finish_reason", core.serialization.string().optional()), + metricValues: core.serialization.property( + "metric_values", + core.serialization.list(MetricValueResponse).optional() + ), + tools: core.serialization.list(ToolResultResponse).optional(), + toolChoice: core.serialization.property("tool_choice", LogResponseToolChoice.optional()), + evaluationResults: core.serialization.property( + "evaluation_results", + core.serialization.list( + core.serialization.lazyObject(async () => (await import("..")).EvaluationResultResponse) + ) + ), + observabilityStatus: core.serialization.property("observability_status", ObservabilityStatus), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + batchIds: core.serialization.property( + "batch_ids", + core.serialization.list(core.serialization.string()).optional() + ), + }); + +export declare namespace LogResponse { + interface Raw { + project?: string | null; + project_id?: string | null; + session_id?: string | null; + session_reference_id?: string | null; + parent_id?: string | null; + parent_reference_id?: string | null; + inputs?: Record | null; + source?: string | null; + metadata?: Record | null; + save?: boolean | null; + source_datapoint_id?: string | null; + id: string; + reference_id?: string | null; + trial_id?: string | null; + messages?: ChatMessageWithToolCall.Raw[] | null; + output?: string | null; + judgment?: LogResponseJudgment.Raw | null; + config_id?: string | null; + config: ConfigResponse.Raw; + environment?: string | null; + feedback?: FeedbackResponse.Raw[] | null; + created_at?: string | null; + error?: string | null; + duration?: number | null; + output_message?: ChatMessageWithToolCall.Raw | null; + prompt_tokens?: number | null; + output_tokens?: number | null; + prompt_cost?: number | null; + output_cost?: number | null; + provider_request?: Record | null; + provider_response?: Record | null; + user?: string | null; + provider_latency?: number | null; + tokens?: number | null; + raw_output?: string | null; + finish_reason?: string | null; + metric_values?: MetricValueResponse.Raw[] | null; + tools?: ToolResultResponse.Raw[] | null; + tool_choice?: LogResponseToolChoice.Raw | null; + evaluation_results: serializers.EvaluationResultResponse.Raw[]; + observability_status: ObservabilityStatus.Raw; + updated_at: string; + batch_ids?: string[] | null; + } +} diff --git a/src/serialization/types/LogResponseJudgment.ts b/src/serialization/types/LogResponseJudgment.ts new file mode 100644 index 0000000..e1b9a7d --- /dev/null +++ b/src/serialization/types/LogResponseJudgment.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const LogResponseJudgment: core.serialization.Schema< + serializers.LogResponseJudgment.Raw, + Humanloop.LogResponseJudgment +> = core.serialization.undiscriminatedUnion([core.serialization.boolean(), core.serialization.number()]); + +export declare namespace LogResponseJudgment { + type Raw = boolean | number; +} diff --git a/src/serialization/types/LogResponseToolChoice.ts b/src/serialization/types/LogResponseToolChoice.ts new file mode 100644 index 0000000..860aea2 --- /dev/null +++ b/src/serialization/types/LogResponseToolChoice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolChoice } from "./ToolChoice"; + +export const LogResponseToolChoice: core.serialization.Schema< + serializers.LogResponseToolChoice.Raw, + Humanloop.LogResponseToolChoice +> = core.serialization.undiscriminatedUnion([ + core.serialization.stringLiteral("none"), + core.serialization.stringLiteral("auto"), + core.serialization.stringLiteral("required"), + ToolChoice, +]); + +export declare namespace LogResponseToolChoice { + type Raw = "none" | "auto" | "required" | ToolChoice.Raw; +} diff --git a/src/serialization/types/MetricValueResponse.ts b/src/serialization/types/MetricValueResponse.ts new file mode 100644 index 0000000..e5b7acc --- /dev/null +++ b/src/serialization/types/MetricValueResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const MetricValueResponse: core.serialization.ObjectSchema< + serializers.MetricValueResponse.Raw, + Humanloop.MetricValueResponse +> = core.serialization.object({ + metricId: core.serialization.property("metric_id", core.serialization.string()), + metricName: core.serialization.property("metric_name", core.serialization.string()), + metricValue: core.serialization.property("metric_value", core.serialization.number()), +}); + +export declare namespace MetricValueResponse { + interface Raw { + metric_id: string; + metric_name: string; + metric_value: number; + } +} diff --git a/src/serialization/types/ModelConfigRequest.ts b/src/serialization/types/ModelConfigRequest.ts new file mode 100644 index 0000000..30638ae --- /dev/null +++ b/src/serialization/types/ModelConfigRequest.ts @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ModelProviders } from "./ModelProviders"; +import { ModelConfigRequestStop } from "./ModelConfigRequestStop"; +import { ResponseFormat } from "./ResponseFormat"; +import { ModelEndpoints } from "./ModelEndpoints"; +import { ChatMessageWithToolCall } from "./ChatMessageWithToolCall"; +import { ModelConfigRequestToolsItem } from "./ModelConfigRequestToolsItem"; + +export const ModelConfigRequest: core.serialization.ObjectSchema< + serializers.ModelConfigRequest.Raw, + Humanloop.ModelConfigRequest +> = core.serialization.object({ + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + provider: ModelProviders.optional(), + model: core.serialization.string(), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + topP: core.serialization.property("top_p", core.serialization.number().optional()), + stop: ModelConfigRequestStop.optional(), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + seed: core.serialization.number().optional(), + responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), + endpoint: ModelEndpoints.optional(), + promptTemplate: core.serialization.property("prompt_template", core.serialization.string().optional()), + chatTemplate: core.serialization.property( + "chat_template", + core.serialization.list(ChatMessageWithToolCall).optional() + ), + tools: core.serialization.list(ModelConfigRequestToolsItem).optional(), + type: core.serialization.stringLiteral("model").optional(), +}); + +export declare namespace ModelConfigRequest { + interface Raw { + name?: string | null; + description?: string | null; + provider?: ModelProviders.Raw | null; + model: string; + max_tokens?: number | null; + temperature?: number | null; + top_p?: number | null; + stop?: ModelConfigRequestStop.Raw | null; + presence_penalty?: number | null; + frequency_penalty?: number | null; + other?: Record | null; + seed?: number | null; + response_format?: ResponseFormat.Raw | null; + endpoint?: ModelEndpoints.Raw | null; + prompt_template?: string | null; + chat_template?: ChatMessageWithToolCall.Raw[] | null; + tools?: ModelConfigRequestToolsItem.Raw[] | null; + type?: "model" | null; + } +} diff --git a/src/serialization/types/ModelConfigRequestStop.ts b/src/serialization/types/ModelConfigRequestStop.ts new file mode 100644 index 0000000..f94a2f2 --- /dev/null +++ b/src/serialization/types/ModelConfigRequestStop.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ModelConfigRequestStop: core.serialization.Schema< + serializers.ModelConfigRequestStop.Raw, + Humanloop.ModelConfigRequestStop +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(core.serialization.string()), +]); + +export declare namespace ModelConfigRequestStop { + type Raw = string | string[]; +} diff --git a/src/serialization/types/ModelConfigRequestToolsItem.ts b/src/serialization/types/ModelConfigRequestToolsItem.ts new file mode 100644 index 0000000..2bbb9db --- /dev/null +++ b/src/serialization/types/ModelConfigRequestToolsItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { LinkedToolRequest } from "./LinkedToolRequest"; +import { ModelConfigToolRequest } from "./ModelConfigToolRequest"; + +export const ModelConfigRequestToolsItem: core.serialization.Schema< + serializers.ModelConfigRequestToolsItem.Raw, + Humanloop.ModelConfigRequestToolsItem +> = core.serialization.undiscriminatedUnion([LinkedToolRequest, ModelConfigToolRequest]); + +export declare namespace ModelConfigRequestToolsItem { + type Raw = LinkedToolRequest.Raw | ModelConfigToolRequest.Raw; +} diff --git a/src/serialization/types/ModelConfigResponse.ts b/src/serialization/types/ModelConfigResponse.ts new file mode 100644 index 0000000..a51f9e5 --- /dev/null +++ b/src/serialization/types/ModelConfigResponse.ts @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ModelProviders } from "./ModelProviders"; +import { ModelConfigResponseStop } from "./ModelConfigResponseStop"; +import { ResponseFormat } from "./ResponseFormat"; +import { ChatMessageWithToolCall } from "./ChatMessageWithToolCall"; +import { ToolConfigResponse } from "./ToolConfigResponse"; +import { ConfigToolResponse } from "./ConfigToolResponse"; +import { ModelEndpoints } from "./ModelEndpoints"; + +export const ModelConfigResponse: core.serialization.ObjectSchema< + serializers.ModelConfigResponse.Raw, + Humanloop.ModelConfigResponse +> = core.serialization.object({ + id: core.serialization.string(), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + type: core.serialization.stringLiteral("model"), + name: core.serialization.string().optional(), + description: core.serialization.string().optional(), + provider: ModelProviders.optional(), + model: core.serialization.string(), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + topP: core.serialization.property("top_p", core.serialization.number().optional()), + stop: ModelConfigResponseStop.optional(), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + seed: core.serialization.number().optional(), + responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), + promptTemplate: core.serialization.property("prompt_template", core.serialization.string().optional()), + chatTemplate: core.serialization.property( + "chat_template", + core.serialization.list(ChatMessageWithToolCall).optional() + ), + toolConfigs: core.serialization.property("tool_configs", core.serialization.list(ToolConfigResponse).optional()), + tools: core.serialization.list(ConfigToolResponse).optional(), + endpoint: ModelEndpoints.optional(), +}); + +export declare namespace ModelConfigResponse { + interface Raw { + id: string; + other?: Record | null; + type: "model"; + name?: string | null; + description?: string | null; + provider?: ModelProviders.Raw | null; + model: string; + max_tokens?: number | null; + temperature?: number | null; + top_p?: number | null; + stop?: ModelConfigResponseStop.Raw | null; + presence_penalty?: number | null; + frequency_penalty?: number | null; + seed?: number | null; + response_format?: ResponseFormat.Raw | null; + prompt_template?: string | null; + chat_template?: ChatMessageWithToolCall.Raw[] | null; + tool_configs?: ToolConfigResponse.Raw[] | null; + tools?: ConfigToolResponse.Raw[] | null; + endpoint?: ModelEndpoints.Raw | null; + } +} diff --git a/src/serialization/types/ModelConfigResponseStop.ts b/src/serialization/types/ModelConfigResponseStop.ts new file mode 100644 index 0000000..b13c812 --- /dev/null +++ b/src/serialization/types/ModelConfigResponseStop.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ModelConfigResponseStop: core.serialization.Schema< + serializers.ModelConfigResponseStop.Raw, + Humanloop.ModelConfigResponseStop +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(core.serialization.string()), +]); + +export declare namespace ModelConfigResponseStop { + type Raw = string | string[]; +} diff --git a/src/serialization/types/ModelConfigToolRequest.ts b/src/serialization/types/ModelConfigToolRequest.ts new file mode 100644 index 0000000..4952c82 --- /dev/null +++ b/src/serialization/types/ModelConfigToolRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolSource } from "./ToolSource"; + +export const ModelConfigToolRequest: core.serialization.ObjectSchema< + serializers.ModelConfigToolRequest.Raw, + Humanloop.ModelConfigToolRequest +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: ToolSource.optional(), + sourceCode: core.serialization.property("source_code", core.serialization.string().optional()), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + presetName: core.serialization.property("preset_name", core.serialization.string().optional()), +}); + +export declare namespace ModelConfigToolRequest { + interface Raw { + name: string; + description?: string | null; + parameters?: Record | null; + source?: ToolSource.Raw | null; + source_code?: string | null; + other?: Record | null; + preset_name?: string | null; + } +} diff --git a/src/serialization/types/ModelEndpoints.ts b/src/serialization/types/ModelEndpoints.ts new file mode 100644 index 0000000..56ec922 --- /dev/null +++ b/src/serialization/types/ModelEndpoints.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ModelEndpoints: core.serialization.Schema = + core.serialization.enum_(["complete", "chat", "edit"]); + +export declare namespace ModelEndpoints { + type Raw = "complete" | "chat" | "edit"; +} diff --git a/src/serialization/types/ModelProviders.ts b/src/serialization/types/ModelProviders.ts new file mode 100644 index 0000000..2dc546b --- /dev/null +++ b/src/serialization/types/ModelProviders.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ModelProviders: core.serialization.Schema = + core.serialization.enum_([ + "openai", + "openai_azure", + "ai21", + "mock", + "anthropic", + "langchain", + "cohere", + "replicate", + "google", + "groq", + ]); + +export declare namespace ModelProviders { + type Raw = + | "openai" + | "openai_azure" + | "ai21" + | "mock" + | "anthropic" + | "langchain" + | "cohere" + | "replicate" + | "google" + | "groq"; +} diff --git a/src/serialization/types/MonitoringEvaluatorEnvironmentRequest.ts b/src/serialization/types/MonitoringEvaluatorEnvironmentRequest.ts new file mode 100644 index 0000000..a7c3ced --- /dev/null +++ b/src/serialization/types/MonitoringEvaluatorEnvironmentRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const MonitoringEvaluatorEnvironmentRequest: core.serialization.ObjectSchema< + serializers.MonitoringEvaluatorEnvironmentRequest.Raw, + Humanloop.MonitoringEvaluatorEnvironmentRequest +> = core.serialization.object({ + evaluatorId: core.serialization.property("evaluator_id", core.serialization.string()), + environmentId: core.serialization.property("environment_id", core.serialization.string()), +}); + +export declare namespace MonitoringEvaluatorEnvironmentRequest { + interface Raw { + evaluator_id: string; + environment_id: string; + } +} diff --git a/src/serialization/types/MonitoringEvaluatorResponse.ts b/src/serialization/types/MonitoringEvaluatorResponse.ts new file mode 100644 index 0000000..4586672 --- /dev/null +++ b/src/serialization/types/MonitoringEvaluatorResponse.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { VersionReferenceResponse } from "./VersionReferenceResponse"; +import { EvaluatorResponse } from "./EvaluatorResponse"; +import { MonitoringEvaluatorState } from "./MonitoringEvaluatorState"; + +export const MonitoringEvaluatorResponse: core.serialization.ObjectSchema< + serializers.MonitoringEvaluatorResponse.Raw, + Humanloop.MonitoringEvaluatorResponse +> = core.serialization.object({ + versionReference: core.serialization.property("version_reference", VersionReferenceResponse), + version: EvaluatorResponse.optional(), + state: MonitoringEvaluatorState, + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace MonitoringEvaluatorResponse { + interface Raw { + version_reference: VersionReferenceResponse.Raw; + version?: EvaluatorResponse.Raw | null; + state: MonitoringEvaluatorState.Raw; + created_at: string; + updated_at: string; + } +} diff --git a/src/serialization/types/MonitoringEvaluatorState.ts b/src/serialization/types/MonitoringEvaluatorState.ts new file mode 100644 index 0000000..3323dbf --- /dev/null +++ b/src/serialization/types/MonitoringEvaluatorState.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const MonitoringEvaluatorState: core.serialization.Schema< + serializers.MonitoringEvaluatorState.Raw, + Humanloop.MonitoringEvaluatorState +> = core.serialization.enum_(["active", "inactive"]); + +export declare namespace MonitoringEvaluatorState { + type Raw = "active" | "inactive"; +} diff --git a/src/serialization/types/MonitoringEvaluatorVersionRequest.ts b/src/serialization/types/MonitoringEvaluatorVersionRequest.ts new file mode 100644 index 0000000..6f2e519 --- /dev/null +++ b/src/serialization/types/MonitoringEvaluatorVersionRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const MonitoringEvaluatorVersionRequest: core.serialization.ObjectSchema< + serializers.MonitoringEvaluatorVersionRequest.Raw, + Humanloop.MonitoringEvaluatorVersionRequest +> = core.serialization.object({ + evaluatorVersionId: core.serialization.property("evaluator_version_id", core.serialization.string()), +}); + +export declare namespace MonitoringEvaluatorVersionRequest { + interface Raw { + evaluator_version_id: string; + } +} diff --git a/src/serialization/types/NumericEvaluatorVersionStats.ts b/src/serialization/types/NumericEvaluatorVersionStats.ts new file mode 100644 index 0000000..0bf31df --- /dev/null +++ b/src/serialization/types/NumericEvaluatorVersionStats.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const NumericEvaluatorVersionStats: core.serialization.ObjectSchema< + serializers.NumericEvaluatorVersionStats.Raw, + Humanloop.NumericEvaluatorVersionStats +> = core.serialization.object({ + evaluatorVersionId: core.serialization.property("evaluator_version_id", core.serialization.string()), + totalLogs: core.serialization.property("total_logs", core.serialization.number()), + numJudgments: core.serialization.property("num_judgments", core.serialization.number()), + numNulls: core.serialization.property("num_nulls", core.serialization.number()), + numErrors: core.serialization.property("num_errors", core.serialization.number()), + mean: core.serialization.number().optional(), + std: core.serialization.number().optional(), + percentiles: core.serialization.record(core.serialization.string(), core.serialization.number()), +}); + +export declare namespace NumericEvaluatorVersionStats { + interface Raw { + evaluator_version_id: string; + total_logs: number; + num_judgments: number; + num_nulls: number; + num_errors: number; + mean?: number | null; + std?: number | null; + percentiles: Record; + } +} diff --git a/src/serialization/types/ObservabilityStatus.ts b/src/serialization/types/ObservabilityStatus.ts new file mode 100644 index 0000000..fdd5c22 --- /dev/null +++ b/src/serialization/types/ObservabilityStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ObservabilityStatus: core.serialization.Schema< + serializers.ObservabilityStatus.Raw, + Humanloop.ObservabilityStatus +> = core.serialization.enum_(["pending", "running", "completed", "failed"]); + +export declare namespace ObservabilityStatus { + type Raw = "pending" | "running" | "completed" | "failed"; +} diff --git a/src/serialization/types/OverallStats.ts b/src/serialization/types/OverallStats.ts new file mode 100644 index 0000000..f3a4b2a --- /dev/null +++ b/src/serialization/types/OverallStats.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const OverallStats: core.serialization.ObjectSchema = + core.serialization.object({ + numDatapoints: core.serialization.property("num_datapoints", core.serialization.number()), + totalLogs: core.serialization.property("total_logs", core.serialization.number()), + totalEvaluatorLogs: core.serialization.property("total_evaluator_logs", core.serialization.number()), + }); + +export declare namespace OverallStats { + interface Raw { + num_datapoints: number; + total_logs: number; + total_evaluator_logs: number; + } +} diff --git a/src/serialization/types/PaginatedDatapointResponse.ts b/src/serialization/types/PaginatedDatapointResponse.ts new file mode 100644 index 0000000..42f650c --- /dev/null +++ b/src/serialization/types/PaginatedDatapointResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { DatapointResponse } from "./DatapointResponse"; + +export const PaginatedDatapointResponse: core.serialization.ObjectSchema< + serializers.PaginatedDatapointResponse.Raw, + Humanloop.PaginatedDatapointResponse +> = core.serialization.object({ + records: core.serialization.list(DatapointResponse), + page: core.serialization.number(), + size: core.serialization.number(), + total: core.serialization.number(), +}); + +export declare namespace PaginatedDatapointResponse { + interface Raw { + records: DatapointResponse.Raw[]; + page: number; + size: number; + total: number; + } +} diff --git a/src/serialization/types/PaginatedDatasetResponse.ts b/src/serialization/types/PaginatedDatasetResponse.ts new file mode 100644 index 0000000..6e43405 --- /dev/null +++ b/src/serialization/types/PaginatedDatasetResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { DatasetResponse } from "./DatasetResponse"; + +export const PaginatedDatasetResponse: core.serialization.ObjectSchema< + serializers.PaginatedDatasetResponse.Raw, + Humanloop.PaginatedDatasetResponse +> = core.serialization.object({ + records: core.serialization.list(DatasetResponse), + page: core.serialization.number(), + size: core.serialization.number(), + total: core.serialization.number(), +}); + +export declare namespace PaginatedDatasetResponse { + interface Raw { + records: DatasetResponse.Raw[]; + page: number; + size: number; + total: number; + } +} diff --git a/src/serialization/types/PaginatedEvaluationResponse.ts b/src/serialization/types/PaginatedEvaluationResponse.ts new file mode 100644 index 0000000..5d1a552 --- /dev/null +++ b/src/serialization/types/PaginatedEvaluationResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EvaluationResponse } from "./EvaluationResponse"; + +export const PaginatedEvaluationResponse: core.serialization.ObjectSchema< + serializers.PaginatedEvaluationResponse.Raw, + Humanloop.PaginatedEvaluationResponse +> = core.serialization.object({ + records: core.serialization.list(EvaluationResponse), + page: core.serialization.number(), + size: core.serialization.number(), + total: core.serialization.number(), +}); + +export declare namespace PaginatedEvaluationResponse { + interface Raw { + records: EvaluationResponse.Raw[]; + page: number; + size: number; + total: number; + } +} diff --git a/src/serialization/types/PaginatedPromptLogResponse.ts b/src/serialization/types/PaginatedPromptLogResponse.ts new file mode 100644 index 0000000..6fd9c38 --- /dev/null +++ b/src/serialization/types/PaginatedPromptLogResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptLogResponse } from "./PromptLogResponse"; + +export const PaginatedPromptLogResponse: core.serialization.ObjectSchema< + serializers.PaginatedPromptLogResponse.Raw, + Humanloop.PaginatedPromptLogResponse +> = core.serialization.object({ + records: core.serialization.list(PromptLogResponse), + page: core.serialization.number(), + size: core.serialization.number(), + total: core.serialization.number(), +}); + +export declare namespace PaginatedPromptLogResponse { + interface Raw { + records: PromptLogResponse.Raw[]; + page: number; + size: number; + total: number; + } +} diff --git a/src/serialization/types/PaginatedSessionResponse.ts b/src/serialization/types/PaginatedSessionResponse.ts new file mode 100644 index 0000000..ac819a0 --- /dev/null +++ b/src/serialization/types/PaginatedSessionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { SessionResponse } from "./SessionResponse"; + +export const PaginatedSessionResponse: core.serialization.ObjectSchema< + serializers.PaginatedSessionResponse.Raw, + Humanloop.PaginatedSessionResponse +> = core.serialization.object({ + records: core.serialization.list(SessionResponse), + page: core.serialization.number(), + size: core.serialization.number(), + total: core.serialization.number(), +}); + +export declare namespace PaginatedSessionResponse { + interface Raw { + records: SessionResponse.Raw[]; + page: number; + size: number; + total: number; + } +} diff --git a/src/serialization/types/PlatformAccessEnum.ts b/src/serialization/types/PlatformAccessEnum.ts new file mode 100644 index 0000000..f141917 --- /dev/null +++ b/src/serialization/types/PlatformAccessEnum.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const PlatformAccessEnum: core.serialization.Schema< + serializers.PlatformAccessEnum.Raw, + Humanloop.PlatformAccessEnum +> = core.serialization.enum_(["superadmin", "supportadmin", "user"]); + +export declare namespace PlatformAccessEnum { + type Raw = "superadmin" | "supportadmin" | "user"; +} diff --git a/src/serialization/types/PositiveLabel.ts b/src/serialization/types/PositiveLabel.ts new file mode 100644 index 0000000..3f9ed90 --- /dev/null +++ b/src/serialization/types/PositiveLabel.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const PositiveLabel: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.string(), + value: core.serialization.string(), + }); + +export declare namespace PositiveLabel { + interface Raw { + type: string; + value: string; + } +} diff --git a/src/serialization/types/ProjectSortBy.ts b/src/serialization/types/ProjectSortBy.ts new file mode 100644 index 0000000..d5c7f30 --- /dev/null +++ b/src/serialization/types/ProjectSortBy.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ProjectSortBy: core.serialization.Schema = + core.serialization.enum_(["created_at", "updated_at", "name"]); + +export declare namespace ProjectSortBy { + type Raw = "created_at" | "updated_at" | "name"; +} diff --git a/src/serialization/types/PromptCallLogResponse.ts b/src/serialization/types/PromptCallLogResponse.ts new file mode 100644 index 0000000..1d524e4 --- /dev/null +++ b/src/serialization/types/PromptCallLogResponse.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; + +export const PromptCallLogResponse: core.serialization.ObjectSchema< + serializers.PromptCallLogResponse.Raw, + Humanloop.PromptCallLogResponse +> = core.serialization.object({ + output: core.serialization.string().optional(), + rawOutput: core.serialization.property("raw_output", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + error: core.serialization.string().optional(), + providerLatency: core.serialization.property("provider_latency", core.serialization.number().optional()), + outputMessage: core.serialization.property("output_message", ChatMessage.optional()), + promptTokens: core.serialization.property("prompt_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + promptCost: core.serialization.property("prompt_cost", core.serialization.number().optional()), + outputCost: core.serialization.property("output_cost", core.serialization.number().optional()), + finishReason: core.serialization.property("finish_reason", core.serialization.string().optional()), + index: core.serialization.number(), +}); + +export declare namespace PromptCallLogResponse { + interface Raw { + output?: string | null; + raw_output?: string | null; + created_at?: string | null; + error?: string | null; + provider_latency?: number | null; + output_message?: ChatMessage.Raw | null; + prompt_tokens?: number | null; + output_tokens?: number | null; + prompt_cost?: number | null; + output_cost?: number | null; + finish_reason?: string | null; + index: number; + } +} diff --git a/src/serialization/types/PromptCallResponse.ts b/src/serialization/types/PromptCallResponse.ts new file mode 100644 index 0000000..2adb257 --- /dev/null +++ b/src/serialization/types/PromptCallResponse.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; +import { ChatMessage } from "./ChatMessage"; +import { PromptCallResponseToolChoice } from "./PromptCallResponseToolChoice"; +import { PromptCallLogResponse } from "./PromptCallLogResponse"; + +export const PromptCallResponse: core.serialization.ObjectSchema< + serializers.PromptCallResponse.Raw, + Humanloop.PromptCallResponse +> = core.serialization.object({ + prompt: PromptResponse, + messages: core.serialization.list(ChatMessage).optional(), + toolChoice: core.serialization.property("tool_choice", PromptCallResponseToolChoice.optional()), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + inputs: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), + metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + save: core.serialization.boolean().optional(), + sourceDatapointId: core.serialization.property("source_datapoint_id", core.serialization.string().optional()), + batches: core.serialization.list(core.serialization.string()).optional(), + user: core.serialization.string().optional(), + environment: core.serialization.string().optional(), + id: core.serialization.string(), + logs: core.serialization.list(PromptCallLogResponse), +}); + +export declare namespace PromptCallResponse { + interface Raw { + prompt: PromptResponse.Raw; + messages?: ChatMessage.Raw[] | null; + tool_choice?: PromptCallResponseToolChoice.Raw | null; + session_id?: string | null; + parent_id?: string | null; + inputs?: Record | null; + source?: string | null; + metadata?: Record | null; + save?: boolean | null; + source_datapoint_id?: string | null; + batches?: string[] | null; + user?: string | null; + environment?: string | null; + id: string; + logs: PromptCallLogResponse.Raw[]; + } +} diff --git a/src/serialization/types/PromptCallResponseToolChoice.ts b/src/serialization/types/PromptCallResponseToolChoice.ts new file mode 100644 index 0000000..61c3e15 --- /dev/null +++ b/src/serialization/types/PromptCallResponseToolChoice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolChoice } from "./ToolChoice"; + +export const PromptCallResponseToolChoice: core.serialization.Schema< + serializers.PromptCallResponseToolChoice.Raw, + Humanloop.PromptCallResponseToolChoice +> = core.serialization.undiscriminatedUnion([ + core.serialization.stringLiteral("none"), + core.serialization.stringLiteral("auto"), + core.serialization.stringLiteral("required"), + ToolChoice, +]); + +export declare namespace PromptCallResponseToolChoice { + type Raw = "none" | "auto" | "required" | ToolChoice.Raw; +} diff --git a/src/serialization/types/PromptCallStreamResponse.ts b/src/serialization/types/PromptCallStreamResponse.ts new file mode 100644 index 0000000..7032f9d --- /dev/null +++ b/src/serialization/types/PromptCallStreamResponse.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; + +export const PromptCallStreamResponse: core.serialization.ObjectSchema< + serializers.PromptCallStreamResponse.Raw, + Humanloop.PromptCallStreamResponse +> = core.serialization.object({ + output: core.serialization.string().optional(), + rawOutput: core.serialization.property("raw_output", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + error: core.serialization.string().optional(), + providerLatency: core.serialization.property("provider_latency", core.serialization.number().optional()), + outputMessage: core.serialization.property("output_message", ChatMessage.optional()), + promptTokens: core.serialization.property("prompt_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + promptCost: core.serialization.property("prompt_cost", core.serialization.number().optional()), + outputCost: core.serialization.property("output_cost", core.serialization.number().optional()), + finishReason: core.serialization.property("finish_reason", core.serialization.string().optional()), + index: core.serialization.number(), + id: core.serialization.string(), + promptId: core.serialization.property("prompt_id", core.serialization.string()), + versionId: core.serialization.property("version_id", core.serialization.string()), +}); + +export declare namespace PromptCallStreamResponse { + interface Raw { + output?: string | null; + raw_output?: string | null; + created_at?: string | null; + error?: string | null; + provider_latency?: number | null; + output_message?: ChatMessage.Raw | null; + prompt_tokens?: number | null; + output_tokens?: number | null; + prompt_cost?: number | null; + output_cost?: number | null; + finish_reason?: string | null; + index: number; + id: string; + prompt_id: string; + version_id: string; + } +} diff --git a/src/serialization/types/PromptKernelRequest.ts b/src/serialization/types/PromptKernelRequest.ts new file mode 100644 index 0000000..4140320 --- /dev/null +++ b/src/serialization/types/PromptKernelRequest.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ModelEndpoints } from "./ModelEndpoints"; +import { PromptKernelRequestTemplate } from "./PromptKernelRequestTemplate"; +import { ModelProviders } from "./ModelProviders"; +import { PromptKernelRequestStop } from "./PromptKernelRequestStop"; +import { ResponseFormat } from "./ResponseFormat"; +import { ToolFunction } from "./ToolFunction"; + +export const PromptKernelRequest: core.serialization.ObjectSchema< + serializers.PromptKernelRequest.Raw, + Humanloop.PromptKernelRequest +> = core.serialization.object({ + model: core.serialization.string(), + endpoint: ModelEndpoints.optional(), + template: PromptKernelRequestTemplate.optional(), + provider: ModelProviders.optional(), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + topP: core.serialization.property("top_p", core.serialization.number().optional()), + stop: PromptKernelRequestStop.optional(), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + seed: core.serialization.number().optional(), + responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), + tools: core.serialization.list(ToolFunction).optional(), + linkedTools: core.serialization.property( + "linked_tools", + core.serialization.list(core.serialization.string()).optional() + ), +}); + +export declare namespace PromptKernelRequest { + interface Raw { + model: string; + endpoint?: ModelEndpoints.Raw | null; + template?: PromptKernelRequestTemplate.Raw | null; + provider?: ModelProviders.Raw | null; + max_tokens?: number | null; + temperature?: number | null; + top_p?: number | null; + stop?: PromptKernelRequestStop.Raw | null; + presence_penalty?: number | null; + frequency_penalty?: number | null; + other?: Record | null; + seed?: number | null; + response_format?: ResponseFormat.Raw | null; + tools?: ToolFunction.Raw[] | null; + linked_tools?: string[] | null; + } +} diff --git a/src/serialization/types/PromptKernelRequestStop.ts b/src/serialization/types/PromptKernelRequestStop.ts new file mode 100644 index 0000000..aae6ac6 --- /dev/null +++ b/src/serialization/types/PromptKernelRequestStop.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const PromptKernelRequestStop: core.serialization.Schema< + serializers.PromptKernelRequestStop.Raw, + Humanloop.PromptKernelRequestStop +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(core.serialization.string()), +]); + +export declare namespace PromptKernelRequestStop { + type Raw = string | string[]; +} diff --git a/src/serialization/types/PromptKernelRequestTemplate.ts b/src/serialization/types/PromptKernelRequestTemplate.ts new file mode 100644 index 0000000..9ba46c9 --- /dev/null +++ b/src/serialization/types/PromptKernelRequestTemplate.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; + +export const PromptKernelRequestTemplate: core.serialization.Schema< + serializers.PromptKernelRequestTemplate.Raw, + Humanloop.PromptKernelRequestTemplate +> = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(ChatMessage)]); + +export declare namespace PromptKernelRequestTemplate { + type Raw = string | ChatMessage.Raw[]; +} diff --git a/src/serialization/types/PromptLogResponse.ts b/src/serialization/types/PromptLogResponse.ts new file mode 100644 index 0000000..c8f92b3 --- /dev/null +++ b/src/serialization/types/PromptLogResponse.ts @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; +import { PromptResponse } from "./PromptResponse"; +import { PromptLogResponseToolChoice } from "./PromptLogResponseToolChoice"; + +export const PromptLogResponse: core.serialization.ObjectSchema< + serializers.PromptLogResponse.Raw, + Humanloop.PromptLogResponse +> = core.serialization.object({ + id: core.serialization.string(), + outputMessage: core.serialization.property("output_message", ChatMessage.optional()), + promptTokens: core.serialization.property("prompt_tokens", core.serialization.number().optional()), + outputTokens: core.serialization.property("output_tokens", core.serialization.number().optional()), + promptCost: core.serialization.property("prompt_cost", core.serialization.number().optional()), + outputCost: core.serialization.property("output_cost", core.serialization.number().optional()), + finishReason: core.serialization.property("finish_reason", core.serialization.string().optional()), + prompt: PromptResponse, + messages: core.serialization.list(ChatMessage).optional(), + toolChoice: core.serialization.property("tool_choice", PromptLogResponseToolChoice.optional()), + output: core.serialization.string().optional(), + rawOutput: core.serialization.property("raw_output", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + error: core.serialization.string().optional(), + providerLatency: core.serialization.property("provider_latency", core.serialization.number().optional()), + providerRequest: core.serialization.property( + "provider_request", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + providerResponse: core.serialization.property( + "provider_response", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + sessionId: core.serialization.property("session_id", core.serialization.string().optional()), + parentId: core.serialization.property("parent_id", core.serialization.string().optional()), + inputs: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: core.serialization.string().optional(), + metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + save: core.serialization.boolean().optional(), + sourceDatapointId: core.serialization.property("source_datapoint_id", core.serialization.string().optional()), + batches: core.serialization.list(core.serialization.string()).optional(), + user: core.serialization.string().optional(), + environment: core.serialization.string().optional(), +}); + +export declare namespace PromptLogResponse { + interface Raw { + id: string; + output_message?: ChatMessage.Raw | null; + prompt_tokens?: number | null; + output_tokens?: number | null; + prompt_cost?: number | null; + output_cost?: number | null; + finish_reason?: string | null; + prompt: PromptResponse.Raw; + messages?: ChatMessage.Raw[] | null; + tool_choice?: PromptLogResponseToolChoice.Raw | null; + output?: string | null; + raw_output?: string | null; + created_at?: string | null; + error?: string | null; + provider_latency?: number | null; + provider_request?: Record | null; + provider_response?: Record | null; + session_id?: string | null; + parent_id?: string | null; + inputs?: Record | null; + source?: string | null; + metadata?: Record | null; + save?: boolean | null; + source_datapoint_id?: string | null; + batches?: string[] | null; + user?: string | null; + environment?: string | null; + } +} diff --git a/src/serialization/types/PromptLogResponseToolChoice.ts b/src/serialization/types/PromptLogResponseToolChoice.ts new file mode 100644 index 0000000..a5af36b --- /dev/null +++ b/src/serialization/types/PromptLogResponseToolChoice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolChoice } from "./ToolChoice"; + +export const PromptLogResponseToolChoice: core.serialization.Schema< + serializers.PromptLogResponseToolChoice.Raw, + Humanloop.PromptLogResponseToolChoice +> = core.serialization.undiscriminatedUnion([ + core.serialization.stringLiteral("none"), + core.serialization.stringLiteral("auto"), + core.serialization.stringLiteral("required"), + ToolChoice, +]); + +export declare namespace PromptLogResponseToolChoice { + type Raw = "none" | "auto" | "required" | ToolChoice.Raw; +} diff --git a/src/serialization/types/PromptResponse.ts b/src/serialization/types/PromptResponse.ts new file mode 100644 index 0000000..222e81d --- /dev/null +++ b/src/serialization/types/PromptResponse.ts @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EnvironmentResponse } from "./EnvironmentResponse"; +import { UserResponse } from "./UserResponse"; +import { VersionStatus } from "./VersionStatus"; +import { ModelEndpoints } from "./ModelEndpoints"; +import { PromptResponseTemplate } from "./PromptResponseTemplate"; +import { ModelProviders } from "./ModelProviders"; +import { PromptResponseStop } from "./PromptResponseStop"; +import { ResponseFormat } from "./ResponseFormat"; +import { ToolFunction } from "./ToolFunction"; +import { LinkedToolResponse } from "./LinkedToolResponse"; +import { InputResponse } from "./InputResponse"; +import { EvaluatorAggregate } from "./EvaluatorAggregate"; + +export const PromptResponse: core.serialization.ObjectSchema = + core.serialization.object({ + path: core.serialization.string(), + id: core.serialization.string(), + name: core.serialization.string(), + versionId: core.serialization.property("version_id", core.serialization.string()), + type: core.serialization.stringLiteral("prompt").optional(), + environments: core.serialization.list(EnvironmentResponse).optional(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + createdBy: core.serialization.property("created_by", UserResponse.optional()), + status: VersionStatus, + lastUsedAt: core.serialization.property("last_used_at", core.serialization.date()), + model: core.serialization.string(), + endpoint: ModelEndpoints.optional(), + template: PromptResponseTemplate.optional(), + provider: ModelProviders.optional(), + maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), + temperature: core.serialization.number().optional(), + topP: core.serialization.property("top_p", core.serialization.number().optional()), + stop: PromptResponseStop.optional(), + presencePenalty: core.serialization.property("presence_penalty", core.serialization.number().optional()), + frequencyPenalty: core.serialization.property("frequency_penalty", core.serialization.number().optional()), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + seed: core.serialization.number().optional(), + responseFormat: core.serialization.property("response_format", ResponseFormat.optional()), + tools: core.serialization.list(ToolFunction).optional(), + linkedTools: core.serialization.property( + "linked_tools", + core.serialization.list(LinkedToolResponse).optional() + ), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + versionLogsCount: core.serialization.property("version_logs_count", core.serialization.number()), + totalLogsCount: core.serialization.property("total_logs_count", core.serialization.number()), + inputs: core.serialization.list(InputResponse), + evaluatorAggregates: core.serialization.property( + "evaluator_aggregates", + core.serialization.list(EvaluatorAggregate).optional() + ), + }); + +export declare namespace PromptResponse { + interface Raw { + path: string; + id: string; + name: string; + version_id: string; + type?: "prompt" | null; + environments?: EnvironmentResponse.Raw[] | null; + created_at: string; + updated_at: string; + created_by?: UserResponse.Raw | null; + status: VersionStatus.Raw; + last_used_at: string; + model: string; + endpoint?: ModelEndpoints.Raw | null; + template?: PromptResponseTemplate.Raw | null; + provider?: ModelProviders.Raw | null; + max_tokens?: number | null; + temperature?: number | null; + top_p?: number | null; + stop?: PromptResponseStop.Raw | null; + presence_penalty?: number | null; + frequency_penalty?: number | null; + other?: Record | null; + seed?: number | null; + response_format?: ResponseFormat.Raw | null; + tools?: ToolFunction.Raw[] | null; + linked_tools?: LinkedToolResponse.Raw[] | null; + commit_message?: string | null; + version_logs_count: number; + total_logs_count: number; + inputs: InputResponse.Raw[]; + evaluator_aggregates?: EvaluatorAggregate.Raw[] | null; + } +} diff --git a/src/serialization/types/PromptResponseStop.ts b/src/serialization/types/PromptResponseStop.ts new file mode 100644 index 0000000..2b6388d --- /dev/null +++ b/src/serialization/types/PromptResponseStop.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const PromptResponseStop: core.serialization.Schema< + serializers.PromptResponseStop.Raw, + Humanloop.PromptResponseStop +> = core.serialization.undiscriminatedUnion([ + core.serialization.string(), + core.serialization.list(core.serialization.string()), +]); + +export declare namespace PromptResponseStop { + type Raw = string | string[]; +} diff --git a/src/serialization/types/PromptResponseTemplate.ts b/src/serialization/types/PromptResponseTemplate.ts new file mode 100644 index 0000000..179baf8 --- /dev/null +++ b/src/serialization/types/PromptResponseTemplate.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatMessage } from "./ChatMessage"; + +export const PromptResponseTemplate: core.serialization.Schema< + serializers.PromptResponseTemplate.Raw, + Humanloop.PromptResponseTemplate +> = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(ChatMessage)]); + +export declare namespace PromptResponseTemplate { + type Raw = string | ChatMessage.Raw[]; +} diff --git a/src/serialization/types/ProviderApiKeys.ts b/src/serialization/types/ProviderApiKeys.ts new file mode 100644 index 0000000..50245c6 --- /dev/null +++ b/src/serialization/types/ProviderApiKeys.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ProviderApiKeys: core.serialization.ObjectSchema< + serializers.ProviderApiKeys.Raw, + Humanloop.ProviderApiKeys +> = core.serialization.object({ + openai: core.serialization.string().optional(), + ai21: core.serialization.string().optional(), + mock: core.serialization.string().optional(), + anthropic: core.serialization.string().optional(), + cohere: core.serialization.string().optional(), + openaiAzure: core.serialization.property("openai_azure", core.serialization.string().optional()), + openaiAzureEndpoint: core.serialization.property("openai_azure_endpoint", core.serialization.string().optional()), +}); + +export declare namespace ProviderApiKeys { + interface Raw { + openai?: string | null; + ai21?: string | null; + mock?: string | null; + anthropic?: string | null; + cohere?: string | null; + openai_azure?: string | null; + openai_azure_endpoint?: string | null; + } +} diff --git a/src/serialization/types/ResponseFormat.ts b/src/serialization/types/ResponseFormat.ts new file mode 100644 index 0000000..c774221 --- /dev/null +++ b/src/serialization/types/ResponseFormat.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ResponseFormat: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.stringLiteral("json_object"), + }); + +export declare namespace ResponseFormat { + interface Raw { + type: "json_object"; + } +} diff --git a/src/serialization/types/SessionResponse.ts b/src/serialization/types/SessionResponse.ts new file mode 100644 index 0000000..6759685 --- /dev/null +++ b/src/serialization/types/SessionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptLogResponse } from "./PromptLogResponse"; + +export const SessionResponse: core.serialization.ObjectSchema< + serializers.SessionResponse.Raw, + Humanloop.SessionResponse +> = core.serialization.object({ + id: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + logs: core.serialization.list(PromptLogResponse), +}); + +export declare namespace SessionResponse { + interface Raw { + id: string; + created_at: string; + updated_at: string; + logs: PromptLogResponse.Raw[]; + } +} diff --git a/src/serialization/types/SortOrder.ts b/src/serialization/types/SortOrder.ts new file mode 100644 index 0000000..a86c25d --- /dev/null +++ b/src/serialization/types/SortOrder.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const SortOrder: core.serialization.Schema = + core.serialization.enum_(["asc", "desc"]); + +export declare namespace SortOrder { + type Raw = "asc" | "desc"; +} diff --git a/src/serialization/types/TextChatContent.ts b/src/serialization/types/TextChatContent.ts new file mode 100644 index 0000000..1199e16 --- /dev/null +++ b/src/serialization/types/TextChatContent.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const TextChatContent: core.serialization.ObjectSchema< + serializers.TextChatContent.Raw, + Humanloop.TextChatContent +> = core.serialization.object({ + type: core.serialization.stringLiteral("text"), + text: core.serialization.string(), +}); + +export declare namespace TextChatContent { + interface Raw { + type: "text"; + text: string; + } +} diff --git a/src/serialization/types/TimeUnit.ts b/src/serialization/types/TimeUnit.ts new file mode 100644 index 0000000..9d93590 --- /dev/null +++ b/src/serialization/types/TimeUnit.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const TimeUnit: core.serialization.Schema = + core.serialization.enum_(["day", "week", "month"]); + +export declare namespace TimeUnit { + type Raw = "day" | "week" | "month"; +} diff --git a/src/serialization/types/ToolCall.ts b/src/serialization/types/ToolCall.ts new file mode 100644 index 0000000..63ba508 --- /dev/null +++ b/src/serialization/types/ToolCall.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatToolType } from "./ChatToolType"; +import { FunctionTool } from "./FunctionTool"; + +export const ToolCall: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + type: ChatToolType, + function: FunctionTool, + }); + +export declare namespace ToolCall { + interface Raw { + id: string; + type: ChatToolType.Raw; + function: FunctionTool.Raw; + } +} diff --git a/src/serialization/types/ToolChoice.ts b/src/serialization/types/ToolChoice.ts new file mode 100644 index 0000000..c0c4d39 --- /dev/null +++ b/src/serialization/types/ToolChoice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ChatToolType } from "./ChatToolType"; +import { FunctionToolChoice } from "./FunctionToolChoice"; + +export const ToolChoice: core.serialization.ObjectSchema = + core.serialization.object({ + type: ChatToolType, + function: FunctionToolChoice, + }); + +export declare namespace ToolChoice { + interface Raw { + type: ChatToolType.Raw; + function: FunctionToolChoice.Raw; + } +} diff --git a/src/serialization/types/ToolConfigRequest.ts b/src/serialization/types/ToolConfigRequest.ts new file mode 100644 index 0000000..54c15c4 --- /dev/null +++ b/src/serialization/types/ToolConfigRequest.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolSource } from "./ToolSource"; + +export const ToolConfigRequest: core.serialization.ObjectSchema< + serializers.ToolConfigRequest.Raw, + Humanloop.ToolConfigRequest +> = core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string().optional(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + source: ToolSource.optional(), + sourceCode: core.serialization.property("source_code", core.serialization.string().optional()), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + presetName: core.serialization.property("preset_name", core.serialization.string().optional()), + type: core.serialization.stringLiteral("tool"), +}); + +export declare namespace ToolConfigRequest { + interface Raw { + name: string; + description?: string | null; + parameters?: Record | null; + source?: ToolSource.Raw | null; + source_code?: string | null; + other?: Record | null; + preset_name?: string | null; + type: "tool"; + } +} diff --git a/src/serialization/types/ToolConfigResponse.ts b/src/serialization/types/ToolConfigResponse.ts new file mode 100644 index 0000000..1f3467d --- /dev/null +++ b/src/serialization/types/ToolConfigResponse.ts @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { BaseModelsUserResponse } from "./BaseModelsUserResponse"; +import { ToolSource } from "./ToolSource"; + +export const ToolConfigResponse: core.serialization.ObjectSchema< + serializers.ToolConfigResponse.Raw, + Humanloop.ToolConfigResponse +> = core.serialization.object({ + id: core.serialization.string(), + other: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + type: core.serialization.stringLiteral("tool"), + createdBy: core.serialization.property("created_by", BaseModelsUserResponse.optional()), + status: core.serialization.string(), + name: core.serialization.string(), + description: core.serialization.string().optional(), + source: ToolSource.optional(), + sourceCode: core.serialization.property("source_code", core.serialization.string().optional()), + setupSchema: core.serialization.property( + "setup_schema", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + signature: core.serialization.string().optional(), + isPreset: core.serialization.property("is_preset", core.serialization.boolean().optional()), + presetName: core.serialization.property("preset_name", core.serialization.string().optional()), +}); + +export declare namespace ToolConfigResponse { + interface Raw { + id: string; + other?: Record | null; + type: "tool"; + created_by?: BaseModelsUserResponse.Raw | null; + status: string; + name: string; + description?: string | null; + source?: ToolSource.Raw | null; + source_code?: string | null; + setup_schema?: Record | null; + parameters?: Record | null; + signature?: string | null; + is_preset?: boolean | null; + preset_name?: string | null; + } +} diff --git a/src/serialization/types/ToolFunction.ts b/src/serialization/types/ToolFunction.ts new file mode 100644 index 0000000..fdf807c --- /dev/null +++ b/src/serialization/types/ToolFunction.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ToolFunction: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string(), + description: core.serialization.string(), + parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + }); + +export declare namespace ToolFunction { + interface Raw { + name: string; + description: string; + parameters?: Record | null; + } +} diff --git a/src/serialization/types/ToolKernelRequest.ts b/src/serialization/types/ToolKernelRequest.ts new file mode 100644 index 0000000..da16a37 --- /dev/null +++ b/src/serialization/types/ToolKernelRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ToolFunction } from "./ToolFunction"; + +export const ToolKernelRequest: core.serialization.ObjectSchema< + serializers.ToolKernelRequest.Raw, + Humanloop.ToolKernelRequest +> = core.serialization.object({ + function: ToolFunction.optional(), + sourceCode: core.serialization.property("source_code", core.serialization.string().optional()), + setupValues: core.serialization.property( + "setup_values", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), +}); + +export declare namespace ToolKernelRequest { + interface Raw { + function?: ToolFunction.Raw | null; + source_code?: string | null; + setup_values?: Record | null; + } +} diff --git a/src/serialization/types/ToolResponse.ts b/src/serialization/types/ToolResponse.ts new file mode 100644 index 0000000..ff90866 --- /dev/null +++ b/src/serialization/types/ToolResponse.ts @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { EnvironmentResponse } from "./EnvironmentResponse"; +import { UserResponse } from "./UserResponse"; +import { VersionStatus } from "./VersionStatus"; +import { ToolFunction } from "./ToolFunction"; +import { FilesToolType } from "./FilesToolType"; +import { InputResponse } from "./InputResponse"; +import { EvaluatorAggregate } from "./EvaluatorAggregate"; + +export const ToolResponse: core.serialization.ObjectSchema = + core.serialization.object({ + path: core.serialization.string(), + id: core.serialization.string(), + name: core.serialization.string(), + versionId: core.serialization.property("version_id", core.serialization.string()), + type: core.serialization.stringLiteral("tool").optional(), + environments: core.serialization.list(EnvironmentResponse).optional(), + createdAt: core.serialization.property("created_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + createdBy: core.serialization.property("created_by", UserResponse.optional()), + status: VersionStatus, + lastUsedAt: core.serialization.property("last_used_at", core.serialization.date()), + function: ToolFunction.optional(), + sourceCode: core.serialization.property("source_code", core.serialization.string().optional()), + setupValues: core.serialization.property( + "setup_values", + core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional() + ), + toolType: core.serialization.property("tool_type", FilesToolType.optional()), + commitMessage: core.serialization.property("commit_message", core.serialization.string().optional()), + versionLogsCount: core.serialization.property("version_logs_count", core.serialization.number()), + totalLogsCount: core.serialization.property("total_logs_count", core.serialization.number()), + inputs: core.serialization.list(InputResponse), + signature: core.serialization.string().optional(), + evaluatorAggregates: core.serialization.property( + "evaluator_aggregates", + core.serialization.list(EvaluatorAggregate).optional() + ), + }); + +export declare namespace ToolResponse { + interface Raw { + path: string; + id: string; + name: string; + version_id: string; + type?: "tool" | null; + environments?: EnvironmentResponse.Raw[] | null; + created_at: string; + updated_at: string; + created_by?: UserResponse.Raw | null; + status: VersionStatus.Raw; + last_used_at: string; + function?: ToolFunction.Raw | null; + source_code?: string | null; + setup_values?: Record | null; + tool_type?: FilesToolType.Raw | null; + commit_message?: string | null; + version_logs_count: number; + total_logs_count: number; + inputs: InputResponse.Raw[]; + signature?: string | null; + evaluator_aggregates?: EvaluatorAggregate.Raw[] | null; + } +} diff --git a/src/serialization/types/ToolResultResponse.ts b/src/serialization/types/ToolResultResponse.ts new file mode 100644 index 0000000..02be442 --- /dev/null +++ b/src/serialization/types/ToolResultResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ToolResultResponse: core.serialization.ObjectSchema< + serializers.ToolResultResponse.Raw, + Humanloop.ToolResultResponse +> = core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + signature: core.serialization.string(), + result: core.serialization.string(), +}); + +export declare namespace ToolResultResponse { + interface Raw { + id: string; + name: string; + signature: string; + result: string; + } +} diff --git a/src/serialization/types/ToolSource.ts b/src/serialization/types/ToolSource.ts new file mode 100644 index 0000000..307e0e3 --- /dev/null +++ b/src/serialization/types/ToolSource.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ToolSource: core.serialization.Schema = + core.serialization.enum_(["organization", "inline"]); + +export declare namespace ToolSource { + type Raw = "organization" | "inline"; +} diff --git a/src/serialization/types/UpdateDatesetAction.ts b/src/serialization/types/UpdateDatesetAction.ts new file mode 100644 index 0000000..b8a2518 --- /dev/null +++ b/src/serialization/types/UpdateDatesetAction.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const UpdateDatesetAction: core.serialization.Schema< + serializers.UpdateDatesetAction.Raw, + Humanloop.UpdateDatesetAction +> = core.serialization.enum_(["set", "add", "remove"]); + +export declare namespace UpdateDatesetAction { + type Raw = "set" | "add" | "remove"; +} diff --git a/src/serialization/types/UserResponse.ts b/src/serialization/types/UserResponse.ts new file mode 100644 index 0000000..82a315c --- /dev/null +++ b/src/serialization/types/UserResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const UserResponse: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + emailAddress: core.serialization.property("email_address", core.serialization.string()), + fullName: core.serialization.property("full_name", core.serialization.string().optional()), + }); + +export declare namespace UserResponse { + interface Raw { + id: string; + email_address: string; + full_name?: string | null; + } +} diff --git a/src/serialization/types/ValidationError.ts b/src/serialization/types/ValidationError.ts new file mode 100644 index 0000000..2d9af03 --- /dev/null +++ b/src/serialization/types/ValidationError.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { ValidationErrorLocItem } from "./ValidationErrorLocItem"; + +export const ValidationError: core.serialization.ObjectSchema< + serializers.ValidationError.Raw, + Humanloop.ValidationError +> = core.serialization.object({ + loc: core.serialization.list(ValidationErrorLocItem), + msg: core.serialization.string(), + type: core.serialization.string(), +}); + +export declare namespace ValidationError { + interface Raw { + loc: ValidationErrorLocItem.Raw[]; + msg: string; + type: string; + } +} diff --git a/src/serialization/types/ValidationErrorLocItem.ts b/src/serialization/types/ValidationErrorLocItem.ts new file mode 100644 index 0000000..8afe32d --- /dev/null +++ b/src/serialization/types/ValidationErrorLocItem.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const ValidationErrorLocItem: core.serialization.Schema< + serializers.ValidationErrorLocItem.Raw, + Humanloop.ValidationErrorLocItem +> = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.number()]); + +export declare namespace ValidationErrorLocItem { + type Raw = string | number; +} diff --git a/src/serialization/types/VersionDeploymentResponse.ts b/src/serialization/types/VersionDeploymentResponse.ts new file mode 100644 index 0000000..966840d --- /dev/null +++ b/src/serialization/types/VersionDeploymentResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { VersionDeploymentResponseFile } from "./VersionDeploymentResponseFile"; +import { EnvironmentResponse } from "./EnvironmentResponse"; + +export const VersionDeploymentResponse: core.serialization.ObjectSchema< + serializers.VersionDeploymentResponse.Raw, + Humanloop.VersionDeploymentResponse +> = core.serialization.object({ + file: VersionDeploymentResponseFile, + environment: EnvironmentResponse, + type: core.serialization.stringLiteral("environment"), +}); + +export declare namespace VersionDeploymentResponse { + interface Raw { + file: VersionDeploymentResponseFile.Raw; + environment: EnvironmentResponse.Raw; + type: "environment"; + } +} diff --git a/src/serialization/types/VersionDeploymentResponseFile.ts b/src/serialization/types/VersionDeploymentResponseFile.ts new file mode 100644 index 0000000..34b3284 --- /dev/null +++ b/src/serialization/types/VersionDeploymentResponseFile.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; +import { ToolResponse } from "./ToolResponse"; +import { DatasetResponse } from "./DatasetResponse"; +import { EvaluatorResponse } from "./EvaluatorResponse"; + +export const VersionDeploymentResponseFile: core.serialization.Schema< + serializers.VersionDeploymentResponseFile.Raw, + Humanloop.VersionDeploymentResponseFile +> = core.serialization.undiscriminatedUnion([PromptResponse, ToolResponse, DatasetResponse, EvaluatorResponse]); + +export declare namespace VersionDeploymentResponseFile { + type Raw = PromptResponse.Raw | ToolResponse.Raw | DatasetResponse.Raw | EvaluatorResponse.Raw; +} diff --git a/src/serialization/types/VersionIdResponse.ts b/src/serialization/types/VersionIdResponse.ts new file mode 100644 index 0000000..bdcfb6f --- /dev/null +++ b/src/serialization/types/VersionIdResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { VersionIdResponseVersion } from "./VersionIdResponseVersion"; + +export const VersionIdResponse: core.serialization.ObjectSchema< + serializers.VersionIdResponse.Raw, + Humanloop.VersionIdResponse +> = core.serialization.object({ + version: VersionIdResponseVersion, + type: core.serialization.stringLiteral("version"), +}); + +export declare namespace VersionIdResponse { + interface Raw { + version: VersionIdResponseVersion.Raw; + type: "version"; + } +} diff --git a/src/serialization/types/VersionIdResponseVersion.ts b/src/serialization/types/VersionIdResponseVersion.ts new file mode 100644 index 0000000..231a388 --- /dev/null +++ b/src/serialization/types/VersionIdResponseVersion.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { PromptResponse } from "./PromptResponse"; +import { ToolResponse } from "./ToolResponse"; +import { DatasetResponse } from "./DatasetResponse"; +import { EvaluatorResponse } from "./EvaluatorResponse"; + +export const VersionIdResponseVersion: core.serialization.Schema< + serializers.VersionIdResponseVersion.Raw, + Humanloop.VersionIdResponseVersion +> = core.serialization.undiscriminatedUnion([PromptResponse, ToolResponse, DatasetResponse, EvaluatorResponse]); + +export declare namespace VersionIdResponseVersion { + type Raw = PromptResponse.Raw | ToolResponse.Raw | DatasetResponse.Raw | EvaluatorResponse.Raw; +} diff --git a/src/serialization/types/VersionReferenceResponse.ts b/src/serialization/types/VersionReferenceResponse.ts new file mode 100644 index 0000000..fd69909 --- /dev/null +++ b/src/serialization/types/VersionReferenceResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { VersionDeploymentResponse } from "./VersionDeploymentResponse"; +import { VersionIdResponse } from "./VersionIdResponse"; + +export const VersionReferenceResponse: core.serialization.Schema< + serializers.VersionReferenceResponse.Raw, + Humanloop.VersionReferenceResponse +> = core.serialization.undiscriminatedUnion([VersionDeploymentResponse, VersionIdResponse]); + +export declare namespace VersionReferenceResponse { + type Raw = VersionDeploymentResponse.Raw | VersionIdResponse.Raw; +} diff --git a/src/serialization/types/VersionStats.ts b/src/serialization/types/VersionStats.ts new file mode 100644 index 0000000..e475187 --- /dev/null +++ b/src/serialization/types/VersionStats.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { VersionStatsEvaluatorVersionStatsItem } from "./VersionStatsEvaluatorVersionStatsItem"; + +export const VersionStats: core.serialization.ObjectSchema = + core.serialization.object({ + versionId: core.serialization.property("version_id", core.serialization.string()), + numLogs: core.serialization.property("num_logs", core.serialization.number()), + evaluatorVersionStats: core.serialization.property( + "evaluator_version_stats", + core.serialization.list(VersionStatsEvaluatorVersionStatsItem) + ), + }); + +export declare namespace VersionStats { + interface Raw { + version_id: string; + num_logs: number; + evaluator_version_stats: VersionStatsEvaluatorVersionStatsItem.Raw[]; + } +} diff --git a/src/serialization/types/VersionStatsEvaluatorVersionStatsItem.ts b/src/serialization/types/VersionStatsEvaluatorVersionStatsItem.ts new file mode 100644 index 0000000..fe4cfdf --- /dev/null +++ b/src/serialization/types/VersionStatsEvaluatorVersionStatsItem.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; +import { NumericEvaluatorVersionStats } from "./NumericEvaluatorVersionStats"; +import { BooleanEvaluatorVersionStats } from "./BooleanEvaluatorVersionStats"; + +export const VersionStatsEvaluatorVersionStatsItem: core.serialization.Schema< + serializers.VersionStatsEvaluatorVersionStatsItem.Raw, + Humanloop.VersionStatsEvaluatorVersionStatsItem +> = core.serialization.undiscriminatedUnion([NumericEvaluatorVersionStats, BooleanEvaluatorVersionStats]); + +export declare namespace VersionStatsEvaluatorVersionStatsItem { + type Raw = NumericEvaluatorVersionStats.Raw | BooleanEvaluatorVersionStats.Raw; +} diff --git a/src/serialization/types/VersionStatus.ts b/src/serialization/types/VersionStatus.ts new file mode 100644 index 0000000..946cf18 --- /dev/null +++ b/src/serialization/types/VersionStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Humanloop from "../../api/index"; +import * as core from "../../core"; + +export const VersionStatus: core.serialization.Schema = + core.serialization.enum_(["uncommitted", "committed", "deleted"]); + +export declare namespace VersionStatus { + type Raw = "uncommitted" | "committed" | "deleted"; +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts new file mode 100644 index 0000000..0be8d33 --- /dev/null +++ b/src/serialization/types/index.ts @@ -0,0 +1,151 @@ +export * from "./AgentConfigResponse"; +export * from "./BaseMetricResponse"; +export * from "./BooleanEvaluatorVersionStats"; +export * from "./CategoricalFeedbackLabel"; +export * from "./ChatMessageContentItem"; +export * from "./ChatMessageContent"; +export * from "./ChatMessage"; +export * from "./ChatMessageWithToolCallContentItem"; +export * from "./ChatMessageWithToolCallContent"; +export * from "./ChatMessageWithToolCall"; +export * from "./ChatRole"; +export * from "./CodeEvaluatorRequest"; +export * from "./CommitRequest"; +export * from "./ConfigResponse"; +export * from "./CreateDatapointRequestTargetValue"; +export * from "./CreateDatapointRequest"; +export * from "./CreateEvaluationRequest"; +export * from "./CreatePromptLogResponse"; +export * from "./CreateToolLogResponse"; +export * from "./DashboardConfiguration"; +export * from "./DatapointResponseTargetValue"; +export * from "./DatapointResponse"; +export * from "./DatasetResponse"; +export * from "./DirectoryResponse"; +export * from "./DirectoryWithParentsAndChildrenResponseFilesItem"; +export * from "./DirectoryWithParentsAndChildrenResponse"; +export * from "./EnvironmentResponse"; +export * from "./EnvironmentTag"; +export * from "./EvaluatedVersionResponse"; +export * from "./EvaluateeRequest"; +export * from "./EvaluateeResponse"; +export * from "./EvaluationDebugResultResponseValue"; +export * from "./EvaluationDebugResultResponse"; +export * from "./EvaluationEvaluatorResponse"; +export * from "./EvaluationResponse"; +export * from "./EvaluationResultResponseValue"; +export * from "./EvaluationResultResponse"; +export * from "./EvaluationStats"; +export * from "./EvaluationStatus"; +export * from "./EvaluatorActivationDeactivationRequestEvaluatorsToActivateItem"; +export * from "./EvaluatorActivationDeactivationRequestEvaluatorsToDeactivateItem"; +export * from "./EvaluatorActivationDeactivationRequest"; +export * from "./EvaluatorAggregate"; +export * from "./EvaluatorArgumentsType"; +export * from "./EvaluatorConfigResponse"; +export * from "./EvaluatorResponseSpec"; +export * from "./EvaluatorResponse"; +export * from "./EvaluatorReturnTypeEnum"; +export * from "./ExperimentResponse"; +export * from "./ExperimentStatus"; +export * from "./ExperimentVersionResponse"; +export * from "./FeedbackClass"; +export * from "./FeedbackLabelStatus"; +export * from "./FeedbackResponseType"; +export * from "./FeedbackResponseValue"; +export * from "./FeedbackResponse"; +export * from "./FeedbackTypeModelType"; +export * from "./FeedbackTypeModel"; +export * from "./FeedbackTypes"; +export * from "./FileEnvironmentResponseFile"; +export * from "./FileEnvironmentResponse"; +export * from "./FunctionTool"; +export * from "./FunctionToolChoice"; +export * from "./GenericConfigResponse"; +export * from "./HttpValidationError"; +export * from "./HumanEvaluatorRequest"; +export * from "./ImageChatContent"; +export * from "./ImageUrlDetail"; +export * from "./ImageUrl"; +export * from "./InputResponse"; +export * from "./LlmEvaluatorRequest"; +export * from "./LabelSentiment"; +export * from "./LinkedToolRequest"; +export * from "./LinkedToolResponse"; +export * from "./ListDatasets"; +export * from "./ListEvaluators"; +export * from "./ListPrompts"; +export * from "./ListTools"; +export * from "./LogResponseJudgment"; +export * from "./LogResponseToolChoice"; +export * from "./LogResponse"; +export * from "./MetricValueResponse"; +export * from "./ModelConfigRequestStop"; +export * from "./ModelConfigRequestToolsItem"; +export * from "./ModelConfigRequest"; +export * from "./ModelConfigResponseStop"; +export * from "./ModelConfigResponse"; +export * from "./ModelConfigToolRequest"; +export * from "./ModelEndpoints"; +export * from "./ModelProviders"; +export * from "./MonitoringEvaluatorEnvironmentRequest"; +export * from "./MonitoringEvaluatorResponse"; +export * from "./MonitoringEvaluatorState"; +export * from "./MonitoringEvaluatorVersionRequest"; +export * from "./NumericEvaluatorVersionStats"; +export * from "./ObservabilityStatus"; +export * from "./OverallStats"; +export * from "./PaginatedDatapointResponse"; +export * from "./PaginatedDatasetResponse"; +export * from "./PaginatedEvaluationResponse"; +export * from "./PaginatedPromptLogResponse"; +export * from "./PaginatedSessionResponse"; +export * from "./PlatformAccessEnum"; +export * from "./PositiveLabel"; +export * from "./ProjectSortBy"; +export * from "./PromptCallLogResponse"; +export * from "./PromptCallResponseToolChoice"; +export * from "./PromptCallResponse"; +export * from "./PromptCallStreamResponse"; +export * from "./PromptKernelRequestTemplate"; +export * from "./PromptKernelRequestStop"; +export * from "./PromptKernelRequest"; +export * from "./PromptLogResponseToolChoice"; +export * from "./PromptLogResponse"; +export * from "./PromptResponseTemplate"; +export * from "./PromptResponseStop"; +export * from "./PromptResponse"; +export * from "./ProviderApiKeys"; +export * from "./ResponseFormat"; +export * from "./SessionResponse"; +export * from "./SortOrder"; +export * from "./TextChatContent"; +export * from "./TimeUnit"; +export * from "./ToolCall"; +export * from "./ToolChoice"; +export * from "./ToolConfigRequest"; +export * from "./ToolConfigResponse"; +export * from "./ToolFunction"; +export * from "./ToolKernelRequest"; +export * from "./ToolResultResponse"; +export * from "./ToolSource"; +export * from "./UpdateDatesetAction"; +export * from "./ValidationErrorLocItem"; +export * from "./ValidationError"; +export * from "./VersionDeploymentResponseFile"; +export * from "./VersionDeploymentResponse"; +export * from "./VersionIdResponseVersion"; +export * from "./VersionIdResponse"; +export * from "./VersionReferenceResponse"; +export * from "./VersionStatsEvaluatorVersionStatsItem"; +export * from "./VersionStats"; +export * from "./VersionStatus"; +export * from "./ChatToolType"; +export * from "./FilesToolType"; +export * from "./ConfigToolResponse"; +export * from "./FeedbackType"; +export * from "./BaseModelsUserResponse"; +export * from "./EvaluationsDatasetRequest"; +export * from "./EvaluationsRequest"; +export * from "./ToolResponse"; +export * from "./UserResponse"; diff --git a/tests/custom.test.ts b/tests/custom.test.ts new file mode 100644 index 0000000..7f5e031 --- /dev/null +++ b/tests/custom.test.ts @@ -0,0 +1,13 @@ +/** + * This is a custom test file, if you wish to add more tests + * to your SDK. + * Be sure to mark this file in `.fernignore`. + * + * If you include example requests/responses in your fern definition, + * you will have tests automatically generated for you. + */ +describe("test", () => { + it("default", () => { + expect(true).toBe(true); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..538c94f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "extendedDiagnostics": true, + "strict": true, + "target": "ES6", + "module": "CommonJS", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "baseUrl": "src" + }, + "include": ["src"], + "exclude": [] +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..f797611 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,2705 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ampproject/remapping@^2.2.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== + dependencies: + "@babel/highlight" "^7.24.7" + picocolors "^1.0.0" + +"@babel/compat-data@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.7.tgz#d23bbea508c3883ba8251fb4164982c36ea577ed" + integrity sha512-qJzAIcv03PyaWqxRgO4mSU3lihncDT296vnyuE2O8uA4w3UHWI4S3hgeZd1L8W1Bft40w9JxJ2b412iDUFFRhw== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.7.tgz#b676450141e0b52a3d43bc91da86aa608f950ac4" + integrity sha512-nykK+LEK86ahTkX/3TgauT0ikKoNCfKHEaZYTUVupJdTLzGNvrblu4u6fa7DhZONAltdf8e662t/abY8idrd/g== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.24.7" + "@babel/helper-compilation-targets" "^7.24.7" + "@babel/helper-module-transforms" "^7.24.7" + "@babel/helpers" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/template" "^7.24.7" + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.24.7", "@babel/generator@^7.7.2": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.7.tgz#1654d01de20ad66b4b4d99c135471bc654c55e6d" + integrity sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA== + dependencies: + "@babel/types" "^7.24.7" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^2.5.1" + +"@babel/helper-compilation-targets@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.7.tgz#4eb6c4a80d6ffeac25ab8cd9a21b5dfa48d503a9" + integrity sha512-ctSdRHBi20qWOfy27RUb4Fhp07KSJ3sXcuSvTrXrc4aG8NSYDo1ici3Vhg9bg69y5bj0Mr1lh0aeEgTvc12rMg== + dependencies: + "@babel/compat-data" "^7.24.7" + "@babel/helper-validator-option" "^7.24.7" + browserslist "^4.22.2" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-environment-visitor@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz#4b31ba9551d1f90781ba83491dd59cf9b269f7d9" + integrity sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-function-name@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2" + integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA== + dependencies: + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-hoist-variables@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz#b4ede1cde2fd89436397f30dc9376ee06b0f25ee" + integrity sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-module-imports@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" + integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-module-transforms@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.7.tgz#31b6c9a2930679498db65b685b1698bfd6c7daf8" + integrity sha512-1fuJEwIrp+97rM4RWdO+qrRsZlAeL1lQJoPqtCYWv0NL115XM93hIH4CSRln2w52SqvmY5hqdtauB6QFCDiZNQ== + dependencies: + "@babel/helper-environment-visitor" "^7.24.7" + "@babel/helper-module-imports" "^7.24.7" + "@babel/helper-simple-access" "^7.24.7" + "@babel/helper-split-export-declaration" "^7.24.7" + "@babel/helper-validator-identifier" "^7.24.7" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.8.0": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.7.tgz#98c84fe6fe3d0d3ae7bfc3a5e166a46844feb2a0" + integrity sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg== + +"@babel/helper-simple-access@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" + integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== + dependencies: + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/helper-split-export-declaration@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" + integrity sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-string-parser@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz#4d2d0f14820ede3b9807ea5fc36dfc8cd7da07f2" + integrity sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg== + +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + +"@babel/helper-validator-option@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.24.7.tgz#24c3bb77c7a425d1742eec8fb433b5a1b38e62f6" + integrity sha512-yy1/KvjhV/ZCL+SM7hBrvnZJ3ZuT9OuZgIJAGpPEToANvc3iM6iDvBnRjtElWibHU6n8/LPR/EjX9EtIEYO3pw== + +"@babel/helpers@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.7.tgz#aa2ccda29f62185acb5d42fb4a3a1b1082107416" + integrity sha512-NlmJJtvcw72yRJRcnCmGvSi+3jDEg8qFu3z0AFoymmzLx5ERVWyzd9kVXr7Th9/8yIJi2Zc6av4Tqz3wFs8QWg== + dependencies: + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/highlight@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.7" + chalk "^2.4.2" + js-tokens "^4.0.0" + picocolors "^1.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.7.tgz#9a5226f92f0c5c8ead550b750f5608e766c8ce85" + integrity sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw== + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.8.3": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-import-meta@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz#39a1fa4a7e3d3d7f34e2acc6be585b718d30e02d" + integrity sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ== + dependencies: + "@babel/helper-plugin-utils" "^7.24.7" + +"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.8.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-top-level-await@^7.8.3": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz#58d458271b4d3b6bb27ee6ac9525acbb259bad1c" + integrity sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA== + dependencies: + "@babel/helper-plugin-utils" "^7.24.7" + +"@babel/template@^7.24.7", "@babel/template@^7.3.3": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.7.tgz#02efcee317d0609d2c07117cb70ef8fb17ab7315" + integrity sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/traverse@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.7.tgz#de2b900163fa741721ba382163fe46a936c40cf5" + integrity sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.24.7" + "@babel/helper-environment-visitor" "^7.24.7" + "@babel/helper-function-name" "^7.24.7" + "@babel/helper-hoist-variables" "^7.24.7" + "@babel/helper-split-export-declaration" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.24.7", "@babel/types@^7.3.3": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.7.tgz#6027fe12bc1aa724cd32ab113fb7f1988f1f66f2" + integrity sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q== + dependencies: + "@babel/helper-string-parser" "^7.24.7" + "@babel/helper-validator-identifier" "^7.24.7" + to-fast-properties "^2.0.0" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== + dependencies: + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + ci-info "^3.2.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== + dependencies: + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== + dependencies: + expect "^29.7.0" + jest-snapshot "^29.7.0" + +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" + "@types/node" "*" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" + +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^6.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" + slash "^3.0.0" + string-length "^4.0.1" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + +"@jest/source-map@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" + integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== + dependencies: + "@jridgewell/trace-mapping" "^0.3.18" + callsites "^3.0.0" + graceful-fs "^4.2.9" + +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== + dependencies: + "@jest/console" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== + dependencies: + "@jest/test-result" "^29.7.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + slash "^3.0.0" + +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.2" + +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + +"@sinonjs/commons@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^10.0.2": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" + integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== + dependencies: + "@sinonjs/commons" "^3.0.0" + +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + +"@types/babel__core@^7.1.14": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== + dependencies: + "@babel/parser" "^7.20.7" + "@babel/types" "^7.20.7" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.8" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" + integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" + integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== + dependencies: + "@babel/types" "^7.20.7" + +"@types/graceful-fs@^4.1.3": + version "4.1.9" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" + integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== + dependencies: + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@29.5.5": + version "29.5.5" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.5.tgz#727204e06228fe24373df9bae76b90f3e8236a2a" + integrity sha512-ebylz2hnsWR9mYvmBFbXJXr+33UPc4+ZdxyDXh5w0FlPBTfCVN3wPL+kuOiQt3xvrK419v7XWeAs+AeOksafXg== + dependencies: + expect "^29.0.0" + pretty-format "^29.0.0" + +"@types/jsdom@^20.0.0": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" + integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== + dependencies: + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^7.0.0" + +"@types/node-fetch@2.6.9": + version "2.6.9" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" + integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + +"@types/node@*": + version "20.14.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420" + integrity sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg== + dependencies: + undici-types "~5.26.4" + +"@types/node@17.0.33": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" + integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== + +"@types/qs@6.9.8": + version "6.9.8" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.8.tgz#f2a7de3c107b89b441e071d5472e6b726b4adf45" + integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== + +"@types/stack-utils@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== + +"@types/tough-cookie@*": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" + integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== + +"@types/url-join@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.1.tgz#4989c97f969464647a8586c7252d97b449cdc045" + integrity sha512-wDXw9LEEUHyV+7UWy7U315nrJGJ7p1BzaCxDpEoLr789Dk1WDVMMlf3iBfbG2F8NdWnYyFbtTxUn2ZNbm1Q4LQ== + +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.8": + version "17.0.32" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" + integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== + dependencies: + "@types/yargs-parser" "*" + +abab@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== + +acorn-globals@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" + integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== + dependencies: + acorn "^8.1.0" + acorn-walk "^8.0.2" + +acorn-walk@^8.0.2: + version "8.3.3" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" + integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + dependencies: + acorn "^8.11.0" + +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ansi-escapes@^4.2.1: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + +anymatch@^3.0.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== + dependencies: + "@jest/transform" "^29.7.0" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^29.6.3" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + +babel-plugin-istanbul@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^5.0.4" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" + integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.1.14" + "@types/babel__traverse" "^7.0.6" + +babel-preset-current-node-syntax@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" + integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.8.3" + "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-top-level-await" "^7.8.3" + +babel-preset-jest@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" + integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== + dependencies: + babel-plugin-jest-hoist "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + +browserslist@^4.22.2: + version "4.23.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.1.tgz#ce4af0534b3d37db5c1a4ca98b9080f985041e96" + integrity sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw== + dependencies: + caniuse-lite "^1.0.30001629" + electron-to-chromium "^1.4.796" + node-releases "^2.0.14" + update-browserslist-db "^1.0.16" + +bs-logger@0.x: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001629: + version "1.0.30001640" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz#32c467d4bf1f1a0faa63fc793c2ba81169e7652f" + integrity sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA== + +chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + +ci-info@^3.2.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== + +cjs-module-lexer@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" + integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== + +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +collect-v8-coverage@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" + integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" + +cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +cssom@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" + integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== + +cssom@~0.3.6: + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" + integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== + dependencies: + cssom "~0.3.6" + +data-urls@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" + integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== + dependencies: + abab "^2.0.6" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== + dependencies: + ms "2.1.2" + +decimal.js@^10.4.2: + version "10.4.3" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" + integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== + +dedent@^1.0.0: + version "1.5.3" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" + integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== + +deepmerge@^4.2.2: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + +define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +detect-newline@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== + +domexception@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" + integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== + dependencies: + webidl-conversions "^7.0.0" + +electron-to-chromium@^1.4.796: + version "1.4.816" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.816.tgz#3624649d1e7fde5cdbadf59d31a524245d8ee85f" + integrity sha512-EKH5X5oqC6hLmiS7/vYtZHZFTNdhsYG5NVPRN6Yn0kQHNBlT59+xSM8HBy66P5fxWpKgZbPqb+diC64ng295Jw== + +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +entities@^4.4.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" + integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +escalade@^3.1.1, escalade@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" + integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +escodegen@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" + integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionalDependencies: + source-map "~0.6.1" + +esprima@^4.0.0, esprima@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== + +expect@^29.0.0, expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fb-watchman@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== + dependencies: + bser "2.1.1" + +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +form-data@4.0.0, form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +formdata-node@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-6.0.3.tgz#48f8e2206ae2befded82af621ef015f08168dc6d" + integrity sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@^2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +glob@^7.1.3, glob@^7.1.4: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== + +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +hasown@^2.0.0, hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +html-encoding-sniffer@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" + integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== + dependencies: + whatwg-encoding "^2.0.0" + +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + +https-proxy-agent@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +iconv-lite@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + +import-local@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + +is-core-module@^2.13.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.14.0.tgz#43b8ef9f46a6a08888db67b1ffd4ec9e3dfd59d1" + integrity sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A== + dependencies: + hasown "^2.0.2" + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== + +istanbul-lib-instrument@^5.0.4: + version "5.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^6.3.0" + +istanbul-lib-instrument@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-report@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.3: + version "3.1.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" + integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== + dependencies: + execa "^5.0.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^1.0.0" + is-generator-fn "^2.0.0" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + pretty-format "^29.7.0" + pure-rand "^6.0.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== + dependencies: + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + chalk "^4.0.0" + create-jest "^29.7.0" + exit "^0.1.2" + import-local "^3.0.2" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" + +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.7.0" + "@jest/types" "^29.6.3" + babel-jest "^29.7.0" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" + jest-get-type "^29.6.3" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== + dependencies: + detect-newline "^3.0.0" + +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + +jest-environment-jsdom@29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" + integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/jsdom" "^20.0.0" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + jsdom "^20.0.0" + +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== + dependencies: + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== + dependencies: + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-util "^29.7.0" + +jest-pnp-resolver@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== + +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== + dependencies: + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" + +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-pnp-resolver "^1.2.2" + jest-util "^29.7.0" + jest-validate "^29.7.0" + resolve "^1.20.0" + resolve.exports "^2.0.0" + slash "^3.0.0" + +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== + dependencies: + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.13.1" + graceful-fs "^4.2.9" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.7.0" + graceful-fs "^4.2.9" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + natural-compare "^1.4.0" + pretty-format "^29.7.0" + semver "^7.5.3" + +jest-util@^29.0.0, jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== + dependencies: + "@jest/types" "^29.6.3" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^29.6.3" + leven "^3.1.0" + pretty-format "^29.7.0" + +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== + dependencies: + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.13.1" + jest-util "^29.7.0" + string-length "^4.0.1" + +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== + dependencies: + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" + import-local "^3.0.2" + jest-cli "^29.7.0" + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsdom@^20.0.0: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" + integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== + dependencies: + abab "^2.0.6" + acorn "^8.8.1" + acorn-globals "^7.0.0" + cssom "^0.5.0" + cssstyle "^2.3.0" + data-urls "^3.0.2" + decimal.js "^10.4.2" + domexception "^4.0.0" + escodegen "^2.0.0" + form-data "^4.0.0" + html-encoding-sniffer "^3.0.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.1" + is-potential-custom-element-name "^1.0.1" + nwsapi "^2.2.2" + parse5 "^7.1.1" + saxes "^6.0.0" + symbol-tree "^3.2.4" + tough-cookie "^4.1.2" + w3c-xmlserializer "^4.0.0" + webidl-conversions "^7.0.0" + whatwg-encoding "^2.0.0" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + ws "^8.11.0" + xml-name-validator "^4.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +lodash.memoize@4.x: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + +make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" + +make-error@1.x: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +micromatch@^4.0.4: + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^3.0.4, minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +node-fetch@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + +node-releases@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +nwsapi@^2.2.2: + version "2.2.10" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.10.tgz#0b77a68e21a0b483db70b11fad055906e867cda8" + integrity sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ== + +object-inspect@^1.13.1: + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +parse5@^7.0.0, parse5@^7.1.1: + version "7.1.2" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" + integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw== + dependencies: + entities "^4.4.0" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +picocolors@^1.0.0, picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + +picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pirates@^4.0.4: + version "4.0.6" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" + integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +prettier@2.7.1: + version "2.7.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" + integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== + +pretty-format@^29.0.0, pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + +prompts@^2.0.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + +psl@^1.1.33: + version "1.9.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" + integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== + +punycode@^2.1.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +pure-rand@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== + +qs@6.11.2: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + +react-is@^18.0.0: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve.exports@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== + +resolve@^1.20.0: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +saxes@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" + integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== + dependencies: + xmlchars "^2.2.0" + +semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + +semver@^7.5.3, semver@^7.5.4: + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== + +set-function-length@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +side-channel@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" + integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + object-inspect "^1.13.1" + +signal-exit@^3.0.3, signal-exit@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +string-length@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tough-cookie@^4.1.2: + version "4.1.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" + integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + +tr46@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" + integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== + dependencies: + punycode "^2.1.1" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +ts-jest@29.1.1: + version "29.1.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" + integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== + dependencies: + bs-logger "0.x" + fast-json-stable-stringify "2.x" + jest-util "^29.0.0" + json5 "^2.2.3" + lodash.memoize "4.x" + make-error "1.x" + semver "^7.5.3" + yargs-parser "^21.0.1" + +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +typescript@4.6.4: + version "4.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" + integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + +update-browserslist-db@^1.0.16: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" + integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== + dependencies: + escalade "^3.1.2" + picocolors "^1.0.1" + +url-join@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +v8-to-istanbul@^9.0.1: + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^2.0.0" + +w3c-xmlserializer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" + integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== + dependencies: + xml-name-validator "^4.0.0" + +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +webidl-conversions@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" + integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== + +whatwg-encoding@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" + integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== + dependencies: + iconv-lite "0.6.3" + +whatwg-mimetype@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" + integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== + +whatwg-url@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" + integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== + dependencies: + tr46 "^3.0.0" + webidl-conversions "^7.0.0" + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^3.0.7" + +ws@^8.11.0: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== + +xml-name-validator@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" + integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== + +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yargs-parser@^21.0.1, yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^17.3.1: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==