scorecard-ai 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +9 -0
- package/Client.js +15 -0
- package/api/errors/ForbiddenError.d.ts +2 -2
- package/api/errors/ForbiddenError.js +1 -1
- package/api/errors/NotFoundError.d.ts +2 -2
- package/api/errors/NotFoundError.js +1 -1
- package/api/errors/UnauthorizedError.d.ts +2 -2
- package/api/errors/UnauthorizedError.js +1 -1
- package/api/errors/UnprocessableEntityError.d.ts +2 -2
- package/api/errors/UnprocessableEntityError.js +1 -1
- package/api/resources/index.d.ts +5 -0
- package/api/resources/index.js +6 -1
- package/api/resources/prompt/client/Client.d.ts +151 -0
- package/api/resources/prompt/client/Client.js +699 -0
- package/api/resources/prompt/client/index.d.ts +1 -0
- package/api/resources/prompt/client/index.js +17 -0
- package/api/resources/prompt/client/requests/PromptCreateParams.d.ts +40 -0
- package/api/resources/prompt/client/requests/PromptUpdateParams.d.ts +13 -0
- package/api/resources/prompt/client/requests/index.d.ts +2 -0
- package/api/resources/prompt/client/requests/index.js +2 -0
- package/api/resources/prompt/index.d.ts +2 -0
- package/api/resources/prompt/index.js +18 -0
- package/api/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +4 -0
- package/api/resources/prompt/types/index.d.ts +1 -0
- package/api/resources/prompt/types/index.js +17 -0
- package/api/resources/run/client/Client.d.ts +19 -3
- package/api/resources/run/client/Client.js +30 -25
- package/api/resources/run/client/requests/RunCreateParams.d.ts +3 -2
- package/api/resources/run/client/requests/UpdateStatusParams.d.ts +1 -1
- package/api/resources/run/client/requests/index.d.ts +2 -2
- package/api/resources/runMetric/client/Client.d.ts +38 -0
- package/api/resources/runMetric/client/Client.js +150 -0
- package/api/resources/runMetric/client/index.d.ts +1 -0
- package/api/resources/runMetric/client/index.js +2 -0
- package/api/resources/runMetric/index.d.ts +1 -0
- package/api/resources/runMetric/index.js +17 -0
- package/api/resources/score/client/Client.d.ts +18 -2
- package/api/resources/score/client/Client.js +28 -18
- package/api/resources/score/client/requests/index.d.ts +2 -2
- package/api/resources/testcase/client/Client.d.ts +19 -1
- package/api/resources/testcase/client/Client.js +31 -24
- package/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +1 -1
- package/api/resources/testcase/client/requests/index.d.ts +1 -1
- package/api/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +1 -1
- package/api/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +1 -1
- package/api/resources/testrecord/client/Client.d.ts +15 -2
- package/api/resources/testrecord/client/Client.js +25 -18
- package/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +1 -1
- package/api/resources/testrecord/client/requests/index.d.ts +1 -1
- package/api/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +1 -1
- package/api/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +1 -1
- package/api/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +1 -1
- package/api/resources/testset/client/Client.d.ts +26 -2
- package/api/resources/testset/client/Client.js +41 -38
- package/api/resources/testset/client/requests/TestsetCreateParams.d.ts +1 -1
- package/api/resources/testset/client/requests/index.d.ts +2 -2
- package/api/resources/traces/client/Client.d.ts +38 -0
- package/api/resources/traces/client/Client.js +150 -0
- package/api/resources/traces/client/index.d.ts +1 -0
- package/api/resources/traces/client/index.js +2 -0
- package/api/resources/traces/index.d.ts +1 -0
- package/api/resources/traces/index.js +17 -0
- package/api/types/CustomSchema.d.ts +1 -1
- package/api/types/CustomVariable.d.ts +1 -1
- package/api/types/Grade.d.ts +4 -2
- package/api/types/HttpValidationError.d.ts +1 -1
- package/api/types/JsonObject.d.ts +1 -1
- package/api/types/JsonObjectInputValue.d.ts +1 -1
- package/api/types/JsonObjectOutputValue.d.ts +1 -1
- package/api/types/PaginatedTestcaseResponse.d.ts +1 -1
- package/api/types/Prompt.d.ts +18 -0
- package/api/types/{AppCreateRunParams.d.ts → PromptModelParamsValue.d.ts} +1 -1
- package/api/types/RunMetric.d.ts +9 -0
- package/api/types/Span.d.ts +29 -0
- package/api/types/TestCase.d.ts +1 -1
- package/api/types/TestCaseCustomInputsValue.d.ts +1 -1
- package/api/types/TestCaseCustomLabelsValue.d.ts +1 -1
- package/api/types/Testrecord.d.ts +1 -1
- package/api/types/TestrecordCustomInputsValue.d.ts +1 -1
- package/api/types/TestrecordCustomLabelsValue.d.ts +1 -1
- package/api/types/TestrecordCustomOutputsValue.d.ts +1 -1
- package/api/types/Testset.d.ts +1 -1
- package/api/types/Trace.d.ts +8 -0
- package/api/types/ValidationError.d.ts +1 -1
- package/api/types/index.d.ts +5 -8
- package/api/types/index.js +5 -8
- package/core/fetcher/Fetcher.d.ts +2 -2
- package/core/fetcher/Fetcher.js +78 -23
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/runtime/index.d.ts +1 -0
- package/core/runtime/index.js +5 -0
- package/core/runtime/runtime.d.ts +8 -0
- package/core/runtime/runtime.js +82 -0
- package/core/schemas/builders/object/object.js +11 -15
- package/dist/Client.d.ts +9 -0
- package/dist/Client.js +15 -0
- package/dist/api/errors/ForbiddenError.d.ts +2 -2
- package/dist/api/errors/ForbiddenError.js +1 -1
- package/dist/api/errors/NotFoundError.d.ts +2 -2
- package/dist/api/errors/NotFoundError.js +1 -1
- package/dist/api/errors/UnauthorizedError.d.ts +2 -2
- package/dist/api/errors/UnauthorizedError.js +1 -1
- package/dist/api/errors/UnprocessableEntityError.d.ts +2 -2
- package/dist/api/errors/UnprocessableEntityError.js +1 -1
- package/dist/api/resources/index.d.ts +5 -0
- package/dist/api/resources/index.js +6 -1
- package/dist/api/resources/prompt/client/Client.d.ts +151 -0
- package/dist/api/resources/prompt/client/Client.js +699 -0
- package/dist/api/resources/prompt/client/index.d.ts +1 -0
- package/dist/api/resources/prompt/client/index.js +17 -0
- package/dist/api/resources/prompt/client/requests/PromptCreateParams.d.ts +40 -0
- package/dist/api/resources/prompt/client/requests/PromptUpdateParams.d.ts +13 -0
- package/dist/api/resources/prompt/client/requests/index.d.ts +2 -0
- package/dist/api/resources/prompt/client/requests/index.js +2 -0
- package/dist/api/resources/prompt/index.d.ts +2 -0
- package/dist/api/resources/prompt/index.js +18 -0
- package/dist/api/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +4 -0
- package/dist/api/resources/prompt/types/index.d.ts +1 -0
- package/dist/api/resources/prompt/types/index.js +17 -0
- package/dist/api/resources/run/client/Client.d.ts +19 -3
- package/dist/api/resources/run/client/Client.js +30 -25
- package/dist/api/resources/run/client/requests/RunCreateParams.d.ts +3 -2
- package/dist/api/resources/run/client/requests/UpdateStatusParams.d.ts +1 -1
- package/dist/api/resources/run/client/requests/index.d.ts +2 -2
- package/dist/api/resources/runMetric/client/Client.d.ts +38 -0
- package/dist/api/resources/runMetric/client/Client.js +150 -0
- package/dist/api/resources/runMetric/client/index.d.ts +1 -0
- package/dist/api/resources/runMetric/client/index.js +2 -0
- package/dist/api/resources/runMetric/index.d.ts +1 -0
- package/dist/api/resources/runMetric/index.js +17 -0
- package/dist/api/resources/score/client/Client.d.ts +18 -2
- package/dist/api/resources/score/client/Client.js +28 -18
- package/dist/api/resources/score/client/requests/index.d.ts +2 -2
- package/dist/api/resources/testcase/client/Client.d.ts +19 -1
- package/dist/api/resources/testcase/client/Client.js +31 -24
- package/dist/api/resources/testcase/client/requests/TestcaseCreateParams.d.ts +1 -1
- package/dist/api/resources/testcase/client/requests/index.d.ts +1 -1
- package/dist/api/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +1 -1
- package/dist/api/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +1 -1
- package/dist/api/resources/testrecord/client/Client.d.ts +15 -2
- package/dist/api/resources/testrecord/client/Client.js +25 -18
- package/dist/api/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +1 -1
- package/dist/api/resources/testrecord/client/requests/index.d.ts +1 -1
- package/dist/api/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +1 -1
- package/dist/api/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +1 -1
- package/dist/api/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +1 -1
- package/dist/api/resources/testset/client/Client.d.ts +26 -2
- package/dist/api/resources/testset/client/Client.js +41 -38
- package/dist/api/resources/testset/client/requests/TestsetCreateParams.d.ts +1 -1
- package/dist/api/resources/testset/client/requests/index.d.ts +2 -2
- package/dist/api/resources/traces/client/Client.d.ts +38 -0
- package/dist/api/resources/traces/client/Client.js +150 -0
- package/dist/api/resources/traces/client/index.d.ts +1 -0
- package/dist/api/resources/traces/client/index.js +2 -0
- package/dist/api/resources/traces/index.d.ts +1 -0
- package/dist/api/resources/traces/index.js +17 -0
- package/dist/api/types/CustomSchema.d.ts +1 -1
- package/dist/api/types/CustomVariable.d.ts +1 -1
- package/dist/api/types/Grade.d.ts +4 -2
- package/dist/api/types/HttpValidationError.d.ts +1 -1
- package/dist/api/types/JsonObject.d.ts +1 -1
- package/dist/api/types/JsonObjectInputValue.d.ts +1 -1
- package/dist/api/types/JsonObjectOutputValue.d.ts +1 -1
- package/dist/api/types/PaginatedTestcaseResponse.d.ts +1 -1
- package/dist/api/types/Prompt.d.ts +18 -0
- package/{api/types/AppTestSetCreate.d.ts → dist/api/types/PromptModelParamsValue.d.ts} +1 -1
- package/dist/api/types/RunMetric.d.ts +9 -0
- package/dist/api/types/Span.d.ts +29 -0
- package/dist/api/types/TestCase.d.ts +1 -1
- package/dist/api/types/TestCaseCustomInputsValue.d.ts +1 -1
- package/dist/api/types/TestCaseCustomLabelsValue.d.ts +1 -1
- package/dist/api/types/Testrecord.d.ts +1 -1
- package/dist/api/types/TestrecordCustomInputsValue.d.ts +1 -1
- package/dist/api/types/TestrecordCustomLabelsValue.d.ts +1 -1
- package/dist/api/types/TestrecordCustomOutputsValue.d.ts +1 -1
- package/dist/api/types/Testset.d.ts +1 -1
- package/dist/api/types/Trace.d.ts +8 -0
- package/dist/api/types/ValidationError.d.ts +1 -1
- package/dist/api/types/index.d.ts +5 -8
- package/dist/api/types/index.js +5 -8
- package/dist/core/fetcher/Fetcher.d.ts +2 -2
- package/dist/core/fetcher/Fetcher.js +78 -23
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +8 -0
- package/dist/core/runtime/runtime.js +82 -0
- package/dist/core/schemas/builders/object/object.js +11 -15
- package/dist/serialization/resources/index.d.ts +5 -0
- package/dist/serialization/resources/index.js +6 -1
- package/dist/serialization/resources/prompt/client/getGraph.d.ts +11 -0
- package/dist/serialization/{types/AppCreateRunParams.js → resources/prompt/client/getGraph.js} +4 -3
- package/dist/serialization/resources/prompt/client/getProds.d.ts +11 -0
- package/dist/serialization/{types/AppTestRecordCreate.js → resources/prompt/client/getProds.js} +4 -3
- package/dist/serialization/resources/prompt/client/getRoots.d.ts +11 -0
- package/dist/serialization/{types/AppTestSetCreate.js → resources/prompt/client/getRoots.js} +4 -3
- package/dist/serialization/resources/prompt/client/index.d.ts +4 -0
- package/dist/serialization/resources/prompt/client/index.js +33 -0
- package/dist/serialization/resources/prompt/client/requests/PromptCreateParams.d.ts +18 -0
- package/dist/serialization/resources/prompt/client/requests/PromptCreateParams.js +39 -0
- package/dist/serialization/resources/prompt/client/requests/PromptUpdateParams.d.ts +13 -0
- package/dist/serialization/resources/prompt/client/requests/PromptUpdateParams.js +34 -0
- package/dist/serialization/resources/prompt/client/requests/index.d.ts +2 -0
- package/dist/serialization/resources/prompt/client/requests/index.js +7 -0
- package/dist/serialization/resources/prompt/index.d.ts +2 -0
- package/dist/serialization/resources/prompt/index.js +18 -0
- package/dist/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +10 -0
- package/dist/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.js +36 -0
- package/dist/serialization/resources/prompt/types/index.d.ts +1 -0
- package/dist/serialization/resources/prompt/types/index.js +17 -0
- package/dist/serialization/resources/run/client/requests/RunCreateParams.d.ts +3 -2
- package/dist/serialization/resources/run/client/requests/RunCreateParams.js +1 -0
- package/dist/serialization/resources/run/client/requests/UpdateStatusParams.d.ts +4 -3
- package/dist/serialization/resources/run/client/requests/UpdateStatusParams.js +2 -10
- package/dist/serialization/resources/runMetric/client/get.d.ts +11 -0
- package/dist/serialization/resources/runMetric/client/get.js +32 -0
- package/dist/serialization/resources/runMetric/client/index.d.ts +1 -0
- package/dist/serialization/{types/ModelParams.js → resources/runMetric/client/index.js} +2 -6
- package/dist/serialization/resources/runMetric/index.d.ts +1 -0
- package/dist/serialization/resources/runMetric/index.js +17 -0
- package/dist/serialization/resources/score/client/requests/ScoreCreateParams.d.ts +2 -2
- package/dist/serialization/resources/score/client/requests/ScoreUpdateParams.d.ts +2 -2
- package/dist/serialization/resources/testcase/client/requests/TestcaseCreateParams.d.ts +6 -4
- package/dist/serialization/resources/testcase/client/requests/TestcaseCreateParams.js +4 -15
- package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +4 -3
- package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.js +2 -1
- package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +4 -3
- package/dist/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.js +2 -1
- package/dist/serialization/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +12 -7
- package/dist/serialization/resources/testrecord/client/requests/TestrecordCreateParams.js +10 -24
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +4 -3
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.js +2 -1
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +4 -3
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.js +2 -1
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +4 -3
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.js +2 -1
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsModelDebugInfoValue.d.ts +2 -2
- package/dist/serialization/resources/testrecord/types/TestrecordCreateParamsModelParamsValue.d.ts +2 -2
- package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +4 -3
- package/dist/serialization/resources/testset/client/requests/TestsetCreateParams.js +2 -10
- package/dist/serialization/resources/traces/client/get.d.ts +10 -0
- package/dist/serialization/resources/traces/client/get.js +40 -0
- package/dist/serialization/resources/traces/client/index.d.ts +1 -0
- package/{serialization/types/ModelParams.js → dist/serialization/resources/traces/client/index.js} +2 -6
- package/dist/serialization/resources/traces/index.d.ts +1 -0
- package/dist/serialization/resources/traces/index.js +17 -0
- package/dist/serialization/types/CreateGithubWorkflowParams.d.ts +2 -2
- package/dist/serialization/types/CreateRunParams.d.ts +2 -2
- package/dist/serialization/types/CustomSchema.d.ts +4 -3
- package/dist/serialization/types/CustomSchema.js +2 -12
- package/dist/serialization/types/CustomVariable.d.ts +6 -4
- package/dist/serialization/types/CustomVariable.js +4 -11
- package/dist/serialization/types/DataTypeEnum.d.ts +2 -2
- package/dist/serialization/types/FileUrl.d.ts +2 -2
- package/dist/serialization/types/Grade.d.ts +7 -4
- package/dist/serialization/types/Grade.js +5 -11
- package/dist/serialization/types/HttpValidationError.d.ts +4 -3
- package/dist/serialization/types/HttpValidationError.js +2 -12
- package/dist/serialization/types/JsonObject.d.ts +2 -2
- package/dist/serialization/types/JsonObjectInputValue.d.ts +2 -2
- package/dist/serialization/types/JsonObjectOutputValue.d.ts +2 -2
- package/dist/serialization/types/NotFoundErrorBody.d.ts +2 -2
- package/dist/serialization/types/PaginatedTestcaseResponse.d.ts +4 -3
- package/dist/serialization/types/PaginatedTestcaseResponse.js +2 -10
- package/dist/serialization/types/Prompt.d.ts +24 -0
- package/dist/serialization/types/Prompt.js +45 -0
- package/dist/serialization/types/PromptModelParamsValue.d.ts +10 -0
- package/dist/serialization/types/PromptModelParamsValue.js +35 -0
- package/dist/serialization/types/RoleEnum.d.ts +2 -2
- package/dist/serialization/types/Run.d.ts +2 -2
- package/dist/serialization/types/RunMetric.d.ts +15 -0
- package/dist/serialization/types/RunMetric.js +36 -0
- package/dist/serialization/types/RunStatus.d.ts +2 -2
- package/dist/serialization/types/ScoreStatus.d.ts +2 -2
- package/dist/serialization/types/Span.d.ts +34 -0
- package/dist/serialization/types/Span.js +64 -0
- package/dist/serialization/types/TestCase.d.ts +6 -4
- package/dist/serialization/types/TestCase.js +4 -15
- package/dist/serialization/types/TestCaseCreate.d.ts +2 -2
- package/dist/serialization/types/TestCaseCustomInputsValue.d.ts +4 -3
- package/dist/serialization/types/TestCaseCustomInputsValue.js +2 -1
- package/dist/serialization/types/TestCaseCustomLabelsValue.d.ts +4 -3
- package/dist/serialization/types/TestCaseCustomLabelsValue.js +2 -1
- package/dist/serialization/types/TestRecordCreate.d.ts +2 -2
- package/dist/serialization/types/TestSetCreate.d.ts +2 -2
- package/dist/serialization/types/Testrecord.d.ts +12 -7
- package/dist/serialization/types/Testrecord.js +10 -24
- package/dist/serialization/types/TestrecordCustomInputsValue.d.ts +4 -3
- package/dist/serialization/types/TestrecordCustomInputsValue.js +2 -1
- package/dist/serialization/types/TestrecordCustomLabelsValue.d.ts +4 -3
- package/dist/serialization/types/TestrecordCustomLabelsValue.js +2 -1
- package/dist/serialization/types/TestrecordCustomOutputsValue.d.ts +4 -3
- package/dist/serialization/types/TestrecordCustomOutputsValue.js +2 -1
- package/dist/serialization/types/TestrecordModelDebugInfoValue.d.ts +2 -2
- package/dist/serialization/types/TestrecordModelParamsValue.d.ts +2 -2
- package/dist/serialization/types/Testset.d.ts +4 -3
- package/dist/serialization/types/Testset.js +2 -10
- package/dist/serialization/types/Trace.d.ts +14 -0
- package/dist/serialization/types/Trace.js +35 -0
- package/dist/serialization/types/UnauthenticatedError.d.ts +2 -2
- package/dist/serialization/types/UnauthorizedErrorBody.d.ts +2 -2
- package/dist/serialization/types/ValidationError.d.ts +4 -3
- package/dist/serialization/types/ValidationError.js +2 -10
- package/dist/serialization/types/ValidationErrorLocItem.d.ts +2 -2
- package/dist/serialization/types/index.d.ts +5 -8
- package/dist/serialization/types/index.js +5 -8
- package/jest.config.js +5 -0
- package/package.json +10 -4
- package/reference.md +2145 -0
- package/serialization/resources/index.d.ts +5 -0
- package/serialization/resources/index.js +6 -1
- package/serialization/resources/prompt/client/getGraph.d.ts +11 -0
- package/{dist/serialization/types/ExecutionParams.js → serialization/resources/prompt/client/getGraph.js} +4 -3
- package/serialization/resources/prompt/client/getProds.d.ts +11 -0
- package/serialization/resources/prompt/client/getProds.js +32 -0
- package/serialization/resources/prompt/client/getRoots.d.ts +11 -0
- package/serialization/resources/prompt/client/getRoots.js +32 -0
- package/serialization/resources/prompt/client/index.d.ts +4 -0
- package/serialization/resources/prompt/client/index.js +33 -0
- package/serialization/resources/prompt/client/requests/PromptCreateParams.d.ts +18 -0
- package/serialization/resources/prompt/client/requests/PromptCreateParams.js +39 -0
- package/serialization/resources/prompt/client/requests/PromptUpdateParams.d.ts +13 -0
- package/serialization/resources/prompt/client/requests/PromptUpdateParams.js +34 -0
- package/serialization/resources/prompt/client/requests/index.d.ts +2 -0
- package/serialization/resources/prompt/client/requests/index.js +7 -0
- package/serialization/resources/prompt/index.d.ts +2 -0
- package/serialization/resources/prompt/index.js +18 -0
- package/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.d.ts +10 -0
- package/serialization/resources/prompt/types/PromptCreateParamsModelParamsValue.js +36 -0
- package/serialization/resources/prompt/types/index.d.ts +1 -0
- package/serialization/resources/prompt/types/index.js +17 -0
- package/serialization/resources/run/client/requests/RunCreateParams.d.ts +3 -2
- package/serialization/resources/run/client/requests/RunCreateParams.js +1 -0
- package/serialization/resources/run/client/requests/UpdateStatusParams.d.ts +4 -3
- package/serialization/resources/run/client/requests/UpdateStatusParams.js +2 -10
- package/serialization/resources/runMetric/client/get.d.ts +11 -0
- package/serialization/resources/runMetric/client/get.js +32 -0
- package/serialization/resources/runMetric/client/index.d.ts +1 -0
- package/{dist/serialization/types/ScoringParams.js → serialization/resources/runMetric/client/index.js} +2 -6
- package/serialization/resources/runMetric/index.d.ts +1 -0
- package/serialization/resources/runMetric/index.js +17 -0
- package/serialization/resources/score/client/requests/ScoreCreateParams.d.ts +2 -2
- package/serialization/resources/score/client/requests/ScoreUpdateParams.d.ts +2 -2
- package/serialization/resources/testcase/client/requests/TestcaseCreateParams.d.ts +6 -4
- package/serialization/resources/testcase/client/requests/TestcaseCreateParams.js +4 -15
- package/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.d.ts +4 -3
- package/serialization/resources/testcase/types/TestcaseCreateParamsCustomInputsValue.js +2 -1
- package/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.d.ts +4 -3
- package/serialization/resources/testcase/types/TestcaseCreateParamsCustomLabelsValue.js +2 -1
- package/serialization/resources/testrecord/client/requests/TestrecordCreateParams.d.ts +12 -7
- package/serialization/resources/testrecord/client/requests/TestrecordCreateParams.js +10 -24
- package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.d.ts +4 -3
- package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomInputsValue.js +2 -1
- package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.d.ts +4 -3
- package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomLabelsValue.js +2 -1
- package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.d.ts +4 -3
- package/serialization/resources/testrecord/types/TestrecordCreateParamsCustomOutputsValue.js +2 -1
- package/serialization/resources/testrecord/types/TestrecordCreateParamsModelDebugInfoValue.d.ts +2 -2
- package/serialization/resources/testrecord/types/TestrecordCreateParamsModelParamsValue.d.ts +2 -2
- package/serialization/resources/testset/client/requests/TestsetCreateParams.d.ts +4 -3
- package/serialization/resources/testset/client/requests/TestsetCreateParams.js +2 -10
- package/serialization/resources/traces/client/get.d.ts +10 -0
- package/serialization/resources/traces/client/get.js +40 -0
- package/serialization/resources/traces/client/index.d.ts +1 -0
- package/serialization/{types/ScoringParams.js → resources/traces/client/index.js} +2 -6
- package/serialization/resources/traces/index.d.ts +1 -0
- package/serialization/resources/traces/index.js +17 -0
- package/serialization/types/CreateGithubWorkflowParams.d.ts +2 -2
- package/serialization/types/CreateRunParams.d.ts +2 -2
- package/serialization/types/CustomSchema.d.ts +4 -3
- package/serialization/types/CustomSchema.js +2 -12
- package/serialization/types/CustomVariable.d.ts +6 -4
- package/serialization/types/CustomVariable.js +4 -11
- package/serialization/types/DataTypeEnum.d.ts +2 -2
- package/serialization/types/FileUrl.d.ts +2 -2
- package/serialization/types/Grade.d.ts +7 -4
- package/serialization/types/Grade.js +5 -11
- package/serialization/types/HttpValidationError.d.ts +4 -3
- package/serialization/types/HttpValidationError.js +2 -12
- package/serialization/types/JsonObject.d.ts +2 -2
- package/serialization/types/JsonObjectInputValue.d.ts +2 -2
- package/serialization/types/JsonObjectOutputValue.d.ts +2 -2
- package/serialization/types/NotFoundErrorBody.d.ts +2 -2
- package/serialization/types/PaginatedTestcaseResponse.d.ts +4 -3
- package/serialization/types/PaginatedTestcaseResponse.js +2 -10
- package/serialization/types/Prompt.d.ts +24 -0
- package/serialization/types/Prompt.js +45 -0
- package/serialization/types/PromptModelParamsValue.d.ts +10 -0
- package/serialization/types/PromptModelParamsValue.js +35 -0
- package/serialization/types/RoleEnum.d.ts +2 -2
- package/serialization/types/Run.d.ts +2 -2
- package/serialization/types/RunMetric.d.ts +15 -0
- package/serialization/types/RunMetric.js +36 -0
- package/serialization/types/RunStatus.d.ts +2 -2
- package/serialization/types/ScoreStatus.d.ts +2 -2
- package/serialization/types/Span.d.ts +34 -0
- package/serialization/types/Span.js +64 -0
- package/serialization/types/TestCase.d.ts +6 -4
- package/serialization/types/TestCase.js +4 -15
- package/serialization/types/TestCaseCreate.d.ts +2 -2
- package/serialization/types/TestCaseCustomInputsValue.d.ts +4 -3
- package/serialization/types/TestCaseCustomInputsValue.js +2 -1
- package/serialization/types/TestCaseCustomLabelsValue.d.ts +4 -3
- package/serialization/types/TestCaseCustomLabelsValue.js +2 -1
- package/serialization/types/TestRecordCreate.d.ts +2 -2
- package/serialization/types/TestSetCreate.d.ts +2 -2
- package/serialization/types/Testrecord.d.ts +12 -7
- package/serialization/types/Testrecord.js +10 -24
- package/serialization/types/TestrecordCustomInputsValue.d.ts +4 -3
- package/serialization/types/TestrecordCustomInputsValue.js +2 -1
- package/serialization/types/TestrecordCustomLabelsValue.d.ts +4 -3
- package/serialization/types/TestrecordCustomLabelsValue.js +2 -1
- package/serialization/types/TestrecordCustomOutputsValue.d.ts +4 -3
- package/serialization/types/TestrecordCustomOutputsValue.js +2 -1
- package/serialization/types/TestrecordModelDebugInfoValue.d.ts +2 -2
- package/serialization/types/TestrecordModelParamsValue.d.ts +2 -2
- package/serialization/types/Testset.d.ts +4 -3
- package/serialization/types/Testset.js +2 -10
- package/serialization/types/Trace.d.ts +14 -0
- package/serialization/types/Trace.js +35 -0
- package/serialization/types/UnauthenticatedError.d.ts +2 -2
- package/serialization/types/UnauthorizedErrorBody.d.ts +2 -2
- package/serialization/types/ValidationError.d.ts +4 -3
- package/serialization/types/ValidationError.js +2 -10
- package/serialization/types/ValidationErrorLocItem.d.ts +2 -2
- package/serialization/types/index.d.ts +5 -8
- package/serialization/types/index.js +5 -8
- package/api/types/AppTestRecordCreate.d.ts +0 -4
- package/api/types/ExecutionParams.d.ts +0 -4
- package/api/types/ModelParams.d.ts +0 -4
- package/api/types/ScoreExecutionParams.d.ts +0 -4
- package/api/types/ScoringParams.d.ts +0 -4
- package/api/types/TestCaseCreateInput.d.ts +0 -4
- package/dist/api/types/AppCreateRunParams.d.ts +0 -4
- package/dist/api/types/AppTestRecordCreate.d.ts +0 -4
- package/dist/api/types/AppTestSetCreate.d.ts +0 -4
- package/dist/api/types/ExecutionParams.d.ts +0 -4
- package/dist/api/types/ModelParams.d.ts +0 -4
- package/dist/api/types/ScoreExecutionParams.d.ts +0 -4
- package/dist/api/types/ScoringParams.d.ts +0 -4
- package/dist/api/types/TestCaseCreateInput.d.ts +0 -4
- package/dist/serialization/types/AppCreateRunParams.d.ts +0 -10
- package/dist/serialization/types/AppTestRecordCreate.d.ts +0 -10
- package/dist/serialization/types/AppTestSetCreate.d.ts +0 -10
- package/dist/serialization/types/ExecutionParams.d.ts +0 -10
- package/dist/serialization/types/ModelParams.d.ts +0 -10
- package/dist/serialization/types/ScoreExecutionParams.d.ts +0 -10
- package/dist/serialization/types/ScoreExecutionParams.js +0 -31
- package/dist/serialization/types/ScoringParams.d.ts +0 -10
- package/dist/serialization/types/TestCaseCreateInput.d.ts +0 -10
- package/dist/serialization/types/TestCaseCreateInput.js +0 -31
- package/serialization/types/AppCreateRunParams.d.ts +0 -10
- package/serialization/types/AppCreateRunParams.js +0 -31
- package/serialization/types/AppTestRecordCreate.d.ts +0 -10
- package/serialization/types/AppTestRecordCreate.js +0 -31
- package/serialization/types/AppTestSetCreate.d.ts +0 -10
- package/serialization/types/AppTestSetCreate.js +0 -31
- package/serialization/types/ExecutionParams.d.ts +0 -10
- package/serialization/types/ExecutionParams.js +0 -31
- package/serialization/types/ModelParams.d.ts +0 -10
- package/serialization/types/ScoreExecutionParams.d.ts +0 -10
- package/serialization/types/ScoreExecutionParams.js +0 -31
- package/serialization/types/ScoringParams.d.ts +0 -10
- package/serialization/types/TestCaseCreateInput.d.ts +0 -10
- package/serialization/types/TestCaseCreateInput.js +0 -31
- /package/api/{types/AppCreateRunParams.js → resources/prompt/client/requests/PromptCreateParams.js} +0 -0
- /package/api/{types/AppTestRecordCreate.js → resources/prompt/client/requests/PromptUpdateParams.js} +0 -0
- /package/api/{types/AppTestSetCreate.js → resources/prompt/types/PromptCreateParamsModelParamsValue.js} +0 -0
- /package/api/types/{ExecutionParams.js → Prompt.js} +0 -0
- /package/api/types/{ModelParams.js → PromptModelParamsValue.js} +0 -0
- /package/api/types/{ScoreExecutionParams.js → RunMetric.js} +0 -0
- /package/api/types/{ScoringParams.js → Span.js} +0 -0
- /package/api/types/{TestCaseCreateInput.js → Trace.js} +0 -0
- /package/dist/api/{types/AppCreateRunParams.js → resources/prompt/client/requests/PromptCreateParams.js} +0 -0
- /package/dist/api/{types/AppTestRecordCreate.js → resources/prompt/client/requests/PromptUpdateParams.js} +0 -0
- /package/dist/api/{types/AppTestSetCreate.js → resources/prompt/types/PromptCreateParamsModelParamsValue.js} +0 -0
- /package/dist/api/types/{ExecutionParams.js → Prompt.js} +0 -0
- /package/dist/api/types/{ModelParams.js → PromptModelParamsValue.js} +0 -0
- /package/dist/api/types/{ScoreExecutionParams.js → RunMetric.js} +0 -0
- /package/dist/api/types/{ScoringParams.js → Span.js} +0 -0
- /package/dist/api/types/{TestCaseCreateInput.js → Trace.js} +0 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.Prompt = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../environments"));
|
|
43
|
+
const core = __importStar(require("../../../../core"));
|
|
44
|
+
const Scorecard = __importStar(require("../../../index"));
|
|
45
|
+
const serializers = __importStar(require("../../../../serialization/index"));
|
|
46
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
47
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
48
|
+
class Prompt {
|
|
49
|
+
constructor(_options) {
|
|
50
|
+
this._options = _options;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a new prompt
|
|
54
|
+
*
|
|
55
|
+
* @param {Scorecard.PromptCreateParams} request
|
|
56
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
57
|
+
*
|
|
58
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
59
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
60
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
61
|
+
* @throws {@link Scorecard.UnprocessableEntityError}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await scorecard.prompt.create({
|
|
65
|
+
* promptTemplate: "You are a virtual assistant",
|
|
66
|
+
* name: "Prompt Name",
|
|
67
|
+
* description: "Description of the prompt",
|
|
68
|
+
* modelParams: {
|
|
69
|
+
* "param1": "value1",
|
|
70
|
+
* "param2": 0.1,
|
|
71
|
+
* "param3": 100,
|
|
72
|
+
* "param4": true
|
|
73
|
+
* }
|
|
74
|
+
* })
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await scorecard.prompt.create({
|
|
78
|
+
* promptTemplate: "You are a virtual assistant",
|
|
79
|
+
* parentId: "7ac3cbd5-3b99-4e72-97f3-9cd2e749cace",
|
|
80
|
+
* description: "Description of the prompt",
|
|
81
|
+
* modelParams: {
|
|
82
|
+
* "param1": "value1",
|
|
83
|
+
* "param2": 0.1,
|
|
84
|
+
* "param3": 100,
|
|
85
|
+
* "param4": true
|
|
86
|
+
* },
|
|
87
|
+
* isProd: true
|
|
88
|
+
* })
|
|
89
|
+
*/
|
|
90
|
+
create(request, requestOptions) {
|
|
91
|
+
var _a;
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const _response = yield core.fetcher({
|
|
94
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, "v1/prompt"),
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
97
|
+
contentType: "application/json",
|
|
98
|
+
body: yield serializers.PromptCreateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
99
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
100
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
101
|
+
});
|
|
102
|
+
if (_response.ok) {
|
|
103
|
+
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
104
|
+
unrecognizedObjectKeys: "passthrough",
|
|
105
|
+
allowUnrecognizedUnionMembers: true,
|
|
106
|
+
allowUnrecognizedEnumValues: true,
|
|
107
|
+
skipValidation: true,
|
|
108
|
+
breadcrumbsPrefix: ["response"],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (_response.error.reason === "status-code") {
|
|
112
|
+
switch (_response.error.statusCode) {
|
|
113
|
+
case 401:
|
|
114
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
115
|
+
unrecognizedObjectKeys: "passthrough",
|
|
116
|
+
allowUnrecognizedUnionMembers: true,
|
|
117
|
+
allowUnrecognizedEnumValues: true,
|
|
118
|
+
skipValidation: true,
|
|
119
|
+
breadcrumbsPrefix: ["response"],
|
|
120
|
+
}));
|
|
121
|
+
case 403:
|
|
122
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
123
|
+
unrecognizedObjectKeys: "passthrough",
|
|
124
|
+
allowUnrecognizedUnionMembers: true,
|
|
125
|
+
allowUnrecognizedEnumValues: true,
|
|
126
|
+
skipValidation: true,
|
|
127
|
+
breadcrumbsPrefix: ["response"],
|
|
128
|
+
}));
|
|
129
|
+
case 404:
|
|
130
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
131
|
+
unrecognizedObjectKeys: "passthrough",
|
|
132
|
+
allowUnrecognizedUnionMembers: true,
|
|
133
|
+
allowUnrecognizedEnumValues: true,
|
|
134
|
+
skipValidation: true,
|
|
135
|
+
breadcrumbsPrefix: ["response"],
|
|
136
|
+
}));
|
|
137
|
+
case 422:
|
|
138
|
+
throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
139
|
+
unrecognizedObjectKeys: "passthrough",
|
|
140
|
+
allowUnrecognizedUnionMembers: true,
|
|
141
|
+
allowUnrecognizedEnumValues: true,
|
|
142
|
+
skipValidation: true,
|
|
143
|
+
breadcrumbsPrefix: ["response"],
|
|
144
|
+
}));
|
|
145
|
+
default:
|
|
146
|
+
throw new errors.ScorecardError({
|
|
147
|
+
statusCode: _response.error.statusCode,
|
|
148
|
+
body: _response.error.body,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
switch (_response.error.reason) {
|
|
153
|
+
case "non-json":
|
|
154
|
+
throw new errors.ScorecardError({
|
|
155
|
+
statusCode: _response.error.statusCode,
|
|
156
|
+
body: _response.error.rawBody,
|
|
157
|
+
});
|
|
158
|
+
case "timeout":
|
|
159
|
+
throw new errors.ScorecardTimeoutError();
|
|
160
|
+
case "unknown":
|
|
161
|
+
throw new errors.ScorecardError({
|
|
162
|
+
message: _response.error.errorMessage,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Retrieve active root prompts for the org
|
|
169
|
+
*
|
|
170
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
171
|
+
*
|
|
172
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
173
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
174
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* await scorecard.prompt.getRoots()
|
|
178
|
+
*/
|
|
179
|
+
getRoots(requestOptions) {
|
|
180
|
+
var _a;
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const _response = yield core.fetcher({
|
|
183
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, "v1/prompt/roots"),
|
|
184
|
+
method: "GET",
|
|
185
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
186
|
+
contentType: "application/json",
|
|
187
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
188
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
189
|
+
});
|
|
190
|
+
if (_response.ok) {
|
|
191
|
+
return yield serializers.prompt.getRoots.Response.parseOrThrow(_response.body, {
|
|
192
|
+
unrecognizedObjectKeys: "passthrough",
|
|
193
|
+
allowUnrecognizedUnionMembers: true,
|
|
194
|
+
allowUnrecognizedEnumValues: true,
|
|
195
|
+
skipValidation: true,
|
|
196
|
+
breadcrumbsPrefix: ["response"],
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (_response.error.reason === "status-code") {
|
|
200
|
+
switch (_response.error.statusCode) {
|
|
201
|
+
case 401:
|
|
202
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
203
|
+
unrecognizedObjectKeys: "passthrough",
|
|
204
|
+
allowUnrecognizedUnionMembers: true,
|
|
205
|
+
allowUnrecognizedEnumValues: true,
|
|
206
|
+
skipValidation: true,
|
|
207
|
+
breadcrumbsPrefix: ["response"],
|
|
208
|
+
}));
|
|
209
|
+
case 403:
|
|
210
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
211
|
+
unrecognizedObjectKeys: "passthrough",
|
|
212
|
+
allowUnrecognizedUnionMembers: true,
|
|
213
|
+
allowUnrecognizedEnumValues: true,
|
|
214
|
+
skipValidation: true,
|
|
215
|
+
breadcrumbsPrefix: ["response"],
|
|
216
|
+
}));
|
|
217
|
+
case 404:
|
|
218
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
219
|
+
unrecognizedObjectKeys: "passthrough",
|
|
220
|
+
allowUnrecognizedUnionMembers: true,
|
|
221
|
+
allowUnrecognizedEnumValues: true,
|
|
222
|
+
skipValidation: true,
|
|
223
|
+
breadcrumbsPrefix: ["response"],
|
|
224
|
+
}));
|
|
225
|
+
default:
|
|
226
|
+
throw new errors.ScorecardError({
|
|
227
|
+
statusCode: _response.error.statusCode,
|
|
228
|
+
body: _response.error.body,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
switch (_response.error.reason) {
|
|
233
|
+
case "non-json":
|
|
234
|
+
throw new errors.ScorecardError({
|
|
235
|
+
statusCode: _response.error.statusCode,
|
|
236
|
+
body: _response.error.rawBody,
|
|
237
|
+
});
|
|
238
|
+
case "timeout":
|
|
239
|
+
throw new errors.ScorecardTimeoutError();
|
|
240
|
+
case "unknown":
|
|
241
|
+
throw new errors.ScorecardError({
|
|
242
|
+
message: _response.error.errorMessage,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Retrieve prod prompts for the org
|
|
249
|
+
*
|
|
250
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
251
|
+
*
|
|
252
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
253
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
254
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* await scorecard.prompt.getProds()
|
|
258
|
+
*/
|
|
259
|
+
getProds(requestOptions) {
|
|
260
|
+
var _a;
|
|
261
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
const _response = yield core.fetcher({
|
|
263
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, "v1/prompt/prods"),
|
|
264
|
+
method: "GET",
|
|
265
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
266
|
+
contentType: "application/json",
|
|
267
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
268
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
269
|
+
});
|
|
270
|
+
if (_response.ok) {
|
|
271
|
+
return yield serializers.prompt.getProds.Response.parseOrThrow(_response.body, {
|
|
272
|
+
unrecognizedObjectKeys: "passthrough",
|
|
273
|
+
allowUnrecognizedUnionMembers: true,
|
|
274
|
+
allowUnrecognizedEnumValues: true,
|
|
275
|
+
skipValidation: true,
|
|
276
|
+
breadcrumbsPrefix: ["response"],
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (_response.error.reason === "status-code") {
|
|
280
|
+
switch (_response.error.statusCode) {
|
|
281
|
+
case 401:
|
|
282
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
283
|
+
unrecognizedObjectKeys: "passthrough",
|
|
284
|
+
allowUnrecognizedUnionMembers: true,
|
|
285
|
+
allowUnrecognizedEnumValues: true,
|
|
286
|
+
skipValidation: true,
|
|
287
|
+
breadcrumbsPrefix: ["response"],
|
|
288
|
+
}));
|
|
289
|
+
case 403:
|
|
290
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
291
|
+
unrecognizedObjectKeys: "passthrough",
|
|
292
|
+
allowUnrecognizedUnionMembers: true,
|
|
293
|
+
allowUnrecognizedEnumValues: true,
|
|
294
|
+
skipValidation: true,
|
|
295
|
+
breadcrumbsPrefix: ["response"],
|
|
296
|
+
}));
|
|
297
|
+
case 404:
|
|
298
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
299
|
+
unrecognizedObjectKeys: "passthrough",
|
|
300
|
+
allowUnrecognizedUnionMembers: true,
|
|
301
|
+
allowUnrecognizedEnumValues: true,
|
|
302
|
+
skipValidation: true,
|
|
303
|
+
breadcrumbsPrefix: ["response"],
|
|
304
|
+
}));
|
|
305
|
+
default:
|
|
306
|
+
throw new errors.ScorecardError({
|
|
307
|
+
statusCode: _response.error.statusCode,
|
|
308
|
+
body: _response.error.body,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
switch (_response.error.reason) {
|
|
313
|
+
case "non-json":
|
|
314
|
+
throw new errors.ScorecardError({
|
|
315
|
+
statusCode: _response.error.statusCode,
|
|
316
|
+
body: _response.error.rawBody,
|
|
317
|
+
});
|
|
318
|
+
case "timeout":
|
|
319
|
+
throw new errors.ScorecardTimeoutError();
|
|
320
|
+
case "unknown":
|
|
321
|
+
throw new errors.ScorecardError({
|
|
322
|
+
message: _response.error.errorMessage,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Retrieve a prompt by id
|
|
329
|
+
*
|
|
330
|
+
* @param {string} id - The id of the prompt to get.
|
|
331
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
332
|
+
*
|
|
333
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
334
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
335
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
336
|
+
* @throws {@link Scorecard.UnprocessableEntityError}
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* await scorecard.prompt.get("id")
|
|
340
|
+
*/
|
|
341
|
+
get(id, requestOptions) {
|
|
342
|
+
var _a;
|
|
343
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
344
|
+
const _response = yield core.fetcher({
|
|
345
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
|
|
346
|
+
method: "GET",
|
|
347
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
348
|
+
contentType: "application/json",
|
|
349
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
350
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
351
|
+
});
|
|
352
|
+
if (_response.ok) {
|
|
353
|
+
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
354
|
+
unrecognizedObjectKeys: "passthrough",
|
|
355
|
+
allowUnrecognizedUnionMembers: true,
|
|
356
|
+
allowUnrecognizedEnumValues: true,
|
|
357
|
+
skipValidation: true,
|
|
358
|
+
breadcrumbsPrefix: ["response"],
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (_response.error.reason === "status-code") {
|
|
362
|
+
switch (_response.error.statusCode) {
|
|
363
|
+
case 401:
|
|
364
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
365
|
+
unrecognizedObjectKeys: "passthrough",
|
|
366
|
+
allowUnrecognizedUnionMembers: true,
|
|
367
|
+
allowUnrecognizedEnumValues: true,
|
|
368
|
+
skipValidation: true,
|
|
369
|
+
breadcrumbsPrefix: ["response"],
|
|
370
|
+
}));
|
|
371
|
+
case 403:
|
|
372
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
373
|
+
unrecognizedObjectKeys: "passthrough",
|
|
374
|
+
allowUnrecognizedUnionMembers: true,
|
|
375
|
+
allowUnrecognizedEnumValues: true,
|
|
376
|
+
skipValidation: true,
|
|
377
|
+
breadcrumbsPrefix: ["response"],
|
|
378
|
+
}));
|
|
379
|
+
case 404:
|
|
380
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
381
|
+
unrecognizedObjectKeys: "passthrough",
|
|
382
|
+
allowUnrecognizedUnionMembers: true,
|
|
383
|
+
allowUnrecognizedEnumValues: true,
|
|
384
|
+
skipValidation: true,
|
|
385
|
+
breadcrumbsPrefix: ["response"],
|
|
386
|
+
}));
|
|
387
|
+
case 422:
|
|
388
|
+
throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
389
|
+
unrecognizedObjectKeys: "passthrough",
|
|
390
|
+
allowUnrecognizedUnionMembers: true,
|
|
391
|
+
allowUnrecognizedEnumValues: true,
|
|
392
|
+
skipValidation: true,
|
|
393
|
+
breadcrumbsPrefix: ["response"],
|
|
394
|
+
}));
|
|
395
|
+
default:
|
|
396
|
+
throw new errors.ScorecardError({
|
|
397
|
+
statusCode: _response.error.statusCode,
|
|
398
|
+
body: _response.error.body,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
switch (_response.error.reason) {
|
|
403
|
+
case "non-json":
|
|
404
|
+
throw new errors.ScorecardError({
|
|
405
|
+
statusCode: _response.error.statusCode,
|
|
406
|
+
body: _response.error.rawBody,
|
|
407
|
+
});
|
|
408
|
+
case "timeout":
|
|
409
|
+
throw new errors.ScorecardTimeoutError();
|
|
410
|
+
case "unknown":
|
|
411
|
+
throw new errors.ScorecardError({
|
|
412
|
+
message: _response.error.errorMessage,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Update a prompt
|
|
419
|
+
*
|
|
420
|
+
* @param {string} id - The id of the prompt to update.
|
|
421
|
+
* @param {Scorecard.PromptUpdateParams} request
|
|
422
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
423
|
+
*
|
|
424
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
425
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
426
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
427
|
+
* @throws {@link Scorecard.UnprocessableEntityError}
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* await scorecard.prompt.update("id", {
|
|
431
|
+
* isArchived: true
|
|
432
|
+
* })
|
|
433
|
+
*/
|
|
434
|
+
update(id, request = {}, requestOptions) {
|
|
435
|
+
var _a;
|
|
436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
const _response = yield core.fetcher({
|
|
438
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}`),
|
|
439
|
+
method: "PATCH",
|
|
440
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
441
|
+
contentType: "application/json",
|
|
442
|
+
body: yield serializers.PromptUpdateParams.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
443
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
444
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
445
|
+
});
|
|
446
|
+
if (_response.ok) {
|
|
447
|
+
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
448
|
+
unrecognizedObjectKeys: "passthrough",
|
|
449
|
+
allowUnrecognizedUnionMembers: true,
|
|
450
|
+
allowUnrecognizedEnumValues: true,
|
|
451
|
+
skipValidation: true,
|
|
452
|
+
breadcrumbsPrefix: ["response"],
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
if (_response.error.reason === "status-code") {
|
|
456
|
+
switch (_response.error.statusCode) {
|
|
457
|
+
case 401:
|
|
458
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
459
|
+
unrecognizedObjectKeys: "passthrough",
|
|
460
|
+
allowUnrecognizedUnionMembers: true,
|
|
461
|
+
allowUnrecognizedEnumValues: true,
|
|
462
|
+
skipValidation: true,
|
|
463
|
+
breadcrumbsPrefix: ["response"],
|
|
464
|
+
}));
|
|
465
|
+
case 403:
|
|
466
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
467
|
+
unrecognizedObjectKeys: "passthrough",
|
|
468
|
+
allowUnrecognizedUnionMembers: true,
|
|
469
|
+
allowUnrecognizedEnumValues: true,
|
|
470
|
+
skipValidation: true,
|
|
471
|
+
breadcrumbsPrefix: ["response"],
|
|
472
|
+
}));
|
|
473
|
+
case 404:
|
|
474
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
475
|
+
unrecognizedObjectKeys: "passthrough",
|
|
476
|
+
allowUnrecognizedUnionMembers: true,
|
|
477
|
+
allowUnrecognizedEnumValues: true,
|
|
478
|
+
skipValidation: true,
|
|
479
|
+
breadcrumbsPrefix: ["response"],
|
|
480
|
+
}));
|
|
481
|
+
case 422:
|
|
482
|
+
throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
483
|
+
unrecognizedObjectKeys: "passthrough",
|
|
484
|
+
allowUnrecognizedUnionMembers: true,
|
|
485
|
+
allowUnrecognizedEnumValues: true,
|
|
486
|
+
skipValidation: true,
|
|
487
|
+
breadcrumbsPrefix: ["response"],
|
|
488
|
+
}));
|
|
489
|
+
default:
|
|
490
|
+
throw new errors.ScorecardError({
|
|
491
|
+
statusCode: _response.error.statusCode,
|
|
492
|
+
body: _response.error.body,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
switch (_response.error.reason) {
|
|
497
|
+
case "non-json":
|
|
498
|
+
throw new errors.ScorecardError({
|
|
499
|
+
statusCode: _response.error.statusCode,
|
|
500
|
+
body: _response.error.rawBody,
|
|
501
|
+
});
|
|
502
|
+
case "timeout":
|
|
503
|
+
throw new errors.ScorecardTimeoutError();
|
|
504
|
+
case "unknown":
|
|
505
|
+
throw new errors.ScorecardError({
|
|
506
|
+
message: _response.error.errorMessage,
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Retrieve a prod prompt by name
|
|
513
|
+
*
|
|
514
|
+
* @param {string} name - Name of the prompt.
|
|
515
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
516
|
+
*
|
|
517
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
518
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
519
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
520
|
+
* @throws {@link Scorecard.UnprocessableEntityError}
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* await scorecard.prompt.getByName("name")
|
|
524
|
+
*/
|
|
525
|
+
getByName(name, requestOptions) {
|
|
526
|
+
var _a;
|
|
527
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
528
|
+
const _response = yield core.fetcher({
|
|
529
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/name/${encodeURIComponent(name)}`),
|
|
530
|
+
method: "GET",
|
|
531
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
532
|
+
contentType: "application/json",
|
|
533
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
534
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
535
|
+
});
|
|
536
|
+
if (_response.ok) {
|
|
537
|
+
return yield serializers.Prompt.parseOrThrow(_response.body, {
|
|
538
|
+
unrecognizedObjectKeys: "passthrough",
|
|
539
|
+
allowUnrecognizedUnionMembers: true,
|
|
540
|
+
allowUnrecognizedEnumValues: true,
|
|
541
|
+
skipValidation: true,
|
|
542
|
+
breadcrumbsPrefix: ["response"],
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
if (_response.error.reason === "status-code") {
|
|
546
|
+
switch (_response.error.statusCode) {
|
|
547
|
+
case 401:
|
|
548
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
549
|
+
unrecognizedObjectKeys: "passthrough",
|
|
550
|
+
allowUnrecognizedUnionMembers: true,
|
|
551
|
+
allowUnrecognizedEnumValues: true,
|
|
552
|
+
skipValidation: true,
|
|
553
|
+
breadcrumbsPrefix: ["response"],
|
|
554
|
+
}));
|
|
555
|
+
case 403:
|
|
556
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
557
|
+
unrecognizedObjectKeys: "passthrough",
|
|
558
|
+
allowUnrecognizedUnionMembers: true,
|
|
559
|
+
allowUnrecognizedEnumValues: true,
|
|
560
|
+
skipValidation: true,
|
|
561
|
+
breadcrumbsPrefix: ["response"],
|
|
562
|
+
}));
|
|
563
|
+
case 404:
|
|
564
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
565
|
+
unrecognizedObjectKeys: "passthrough",
|
|
566
|
+
allowUnrecognizedUnionMembers: true,
|
|
567
|
+
allowUnrecognizedEnumValues: true,
|
|
568
|
+
skipValidation: true,
|
|
569
|
+
breadcrumbsPrefix: ["response"],
|
|
570
|
+
}));
|
|
571
|
+
case 422:
|
|
572
|
+
throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
573
|
+
unrecognizedObjectKeys: "passthrough",
|
|
574
|
+
allowUnrecognizedUnionMembers: true,
|
|
575
|
+
allowUnrecognizedEnumValues: true,
|
|
576
|
+
skipValidation: true,
|
|
577
|
+
breadcrumbsPrefix: ["response"],
|
|
578
|
+
}));
|
|
579
|
+
default:
|
|
580
|
+
throw new errors.ScorecardError({
|
|
581
|
+
statusCode: _response.error.statusCode,
|
|
582
|
+
body: _response.error.body,
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
switch (_response.error.reason) {
|
|
587
|
+
case "non-json":
|
|
588
|
+
throw new errors.ScorecardError({
|
|
589
|
+
statusCode: _response.error.statusCode,
|
|
590
|
+
body: _response.error.rawBody,
|
|
591
|
+
});
|
|
592
|
+
case "timeout":
|
|
593
|
+
throw new errors.ScorecardTimeoutError();
|
|
594
|
+
case "unknown":
|
|
595
|
+
throw new errors.ScorecardError({
|
|
596
|
+
message: _response.error.errorMessage,
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Retrieve all nodes within the same graph as the prompt, sorted by created_at desc
|
|
603
|
+
*
|
|
604
|
+
* @param {string} id - The id of the prompt.
|
|
605
|
+
* @param {Prompt.RequestOptions} requestOptions - Request-specific configuration.
|
|
606
|
+
*
|
|
607
|
+
* @throws {@link Scorecard.UnauthorizedError}
|
|
608
|
+
* @throws {@link Scorecard.ForbiddenError}
|
|
609
|
+
* @throws {@link Scorecard.NotFoundError}
|
|
610
|
+
* @throws {@link Scorecard.UnprocessableEntityError}
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* await scorecard.prompt.getGraph("id")
|
|
614
|
+
*/
|
|
615
|
+
getGraph(id, requestOptions) {
|
|
616
|
+
var _a;
|
|
617
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
618
|
+
const _response = yield core.fetcher({
|
|
619
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.ScorecardEnvironment.Default, `v1/prompt/${encodeURIComponent(id)}/graph`),
|
|
620
|
+
method: "GET",
|
|
621
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "scorecard-ai", "X-Fern-SDK-Version": "0.3.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
622
|
+
contentType: "application/json",
|
|
623
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
624
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
625
|
+
});
|
|
626
|
+
if (_response.ok) {
|
|
627
|
+
return yield serializers.prompt.getGraph.Response.parseOrThrow(_response.body, {
|
|
628
|
+
unrecognizedObjectKeys: "passthrough",
|
|
629
|
+
allowUnrecognizedUnionMembers: true,
|
|
630
|
+
allowUnrecognizedEnumValues: true,
|
|
631
|
+
skipValidation: true,
|
|
632
|
+
breadcrumbsPrefix: ["response"],
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
if (_response.error.reason === "status-code") {
|
|
636
|
+
switch (_response.error.statusCode) {
|
|
637
|
+
case 401:
|
|
638
|
+
throw new Scorecard.UnauthorizedError(yield serializers.UnauthenticatedError.parseOrThrow(_response.error.body, {
|
|
639
|
+
unrecognizedObjectKeys: "passthrough",
|
|
640
|
+
allowUnrecognizedUnionMembers: true,
|
|
641
|
+
allowUnrecognizedEnumValues: true,
|
|
642
|
+
skipValidation: true,
|
|
643
|
+
breadcrumbsPrefix: ["response"],
|
|
644
|
+
}));
|
|
645
|
+
case 403:
|
|
646
|
+
throw new Scorecard.ForbiddenError(yield serializers.UnauthorizedErrorBody.parseOrThrow(_response.error.body, {
|
|
647
|
+
unrecognizedObjectKeys: "passthrough",
|
|
648
|
+
allowUnrecognizedUnionMembers: true,
|
|
649
|
+
allowUnrecognizedEnumValues: true,
|
|
650
|
+
skipValidation: true,
|
|
651
|
+
breadcrumbsPrefix: ["response"],
|
|
652
|
+
}));
|
|
653
|
+
case 404:
|
|
654
|
+
throw new Scorecard.NotFoundError(yield serializers.NotFoundErrorBody.parseOrThrow(_response.error.body, {
|
|
655
|
+
unrecognizedObjectKeys: "passthrough",
|
|
656
|
+
allowUnrecognizedUnionMembers: true,
|
|
657
|
+
allowUnrecognizedEnumValues: true,
|
|
658
|
+
skipValidation: true,
|
|
659
|
+
breadcrumbsPrefix: ["response"],
|
|
660
|
+
}));
|
|
661
|
+
case 422:
|
|
662
|
+
throw new Scorecard.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
663
|
+
unrecognizedObjectKeys: "passthrough",
|
|
664
|
+
allowUnrecognizedUnionMembers: true,
|
|
665
|
+
allowUnrecognizedEnumValues: true,
|
|
666
|
+
skipValidation: true,
|
|
667
|
+
breadcrumbsPrefix: ["response"],
|
|
668
|
+
}));
|
|
669
|
+
default:
|
|
670
|
+
throw new errors.ScorecardError({
|
|
671
|
+
statusCode: _response.error.statusCode,
|
|
672
|
+
body: _response.error.body,
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
switch (_response.error.reason) {
|
|
677
|
+
case "non-json":
|
|
678
|
+
throw new errors.ScorecardError({
|
|
679
|
+
statusCode: _response.error.statusCode,
|
|
680
|
+
body: _response.error.rawBody,
|
|
681
|
+
});
|
|
682
|
+
case "timeout":
|
|
683
|
+
throw new errors.ScorecardTimeoutError();
|
|
684
|
+
case "unknown":
|
|
685
|
+
throw new errors.ScorecardError({
|
|
686
|
+
message: _response.error.errorMessage,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
_getCustomAuthorizationHeaders() {
|
|
692
|
+
var _a;
|
|
693
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
694
|
+
const apiKeyValue = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["SCORECARD_API_KEY"];
|
|
695
|
+
return { "X-API-Key": apiKeyValue };
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
exports.Prompt = Prompt;
|