opik 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Node18UniversalStreamWrapper-5PLK6H2I.js +216 -0
- package/dist/NodePre18StreamWrapper-PJE27LW2.js +88 -0
- package/dist/UndiciStreamWrapper-M2WUKUR4.js +204 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/index.cjs +10735 -0
- package/dist/index.d.cts +3653 -0
- package/dist/index.d.ts +3653 -0
- package/dist/index.js +10173 -0
- package/examples/manual-trace.js +16 -0
- package/package.json +56 -0
- package/src/opik/client/Client.ts +65 -0
- package/src/opik/config/Config.ts +35 -0
- package/src/opik/index.ts +2 -0
- package/src/opik/rest_api/Client.ts +247 -0
- package/src/opik/rest_api/api/errors/BadRequestError.ts +16 -0
- package/src/opik/rest_api/api/errors/ConflictError.ts +16 -0
- package/src/opik/rest_api/api/errors/ForbiddenError.ts +17 -0
- package/src/opik/rest_api/api/errors/NotFoundError.ts +16 -0
- package/src/opik/rest_api/api/errors/NotImplementedError.ts +16 -0
- package/src/opik/rest_api/api/errors/UnauthorizedError.ts +17 -0
- package/src/opik/rest_api/api/errors/UnprocessableEntityError.ts +16 -0
- package/src/opik/rest_api/api/errors/index.ts +7 -0
- package/src/opik/rest_api/api/index.ts +3 -0
- package/src/opik/rest_api/api/resources/chatCompletions/client/Client.ts +125 -0
- package/src/opik/rest_api/api/resources/chatCompletions/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/chatCompletions/client/requests/ChatCompletionRequest.ts +33 -0
- package/src/opik/rest_api/api/resources/chatCompletions/client/requests/index.ts +1 -0
- package/src/opik/rest_api/api/resources/chatCompletions/index.ts +1 -0
- package/src/opik/rest_api/api/resources/check/client/Client.ts +141 -0
- package/src/opik/rest_api/api/resources/check/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/check/index.ts +1 -0
- package/src/opik/rest_api/api/resources/datasets/client/Client.ts +1244 -0
- package/src/opik/rest_api/api/resources/datasets/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetIdentifier.ts +13 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetIdentifierPublic.ts +13 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemBatchWrite.ts +21 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemStreamRequest.ts +9 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetItemsDelete.ts +13 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetUpdate.ts +14 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/DatasetWrite.ts +15 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/FindDatasetItemsWithExperimentItemsRequest.ts +17 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/FindDatasetsRequest.ts +16 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/GetDatasetItemsOutputColumnsRequest.ts +11 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/GetDatasetItemsRequest.ts +13 -0
- package/src/opik/rest_api/api/resources/datasets/client/requests/index.ts +11 -0
- package/src/opik/rest_api/api/resources/datasets/index.ts +1 -0
- package/src/opik/rest_api/api/resources/experiments/client/Client.ts +858 -0
- package/src/opik/rest_api/api/resources/experiments/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemStreamRequest.ts +9 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemsBatch.ts +19 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentItemsDelete.ts +13 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentWrite.ts +19 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/ExperimentsDelete.ts +13 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/FindExperimentsRequest.ts +16 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/FindFeedbackScoreNamesRequest.ts +11 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/IdentifierPublic.ts +13 -0
- package/src/opik/rest_api/api/resources/experiments/client/requests/index.ts +8 -0
- package/src/opik/rest_api/api/resources/experiments/index.ts +1 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/Client.ts +515 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/requests/FindFeedbackDefinitionsRequest.ts +16 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/client/requests/index.ts +1 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/index.ts +2 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/types/FindFeedbackDefinitionsRequestType.ts +10 -0
- package/src/opik/rest_api/api/resources/feedbackDefinitions/types/index.ts +1 -0
- package/src/opik/rest_api/api/resources/index.ts +23 -0
- package/src/opik/rest_api/api/resources/llmProviderKey/client/Client.ts +412 -0
- package/src/opik/rest_api/api/resources/llmProviderKey/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/ProviderApiKeyUpdate.ts +13 -0
- package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/ProviderApiKeyWrite.ts +13 -0
- package/src/opik/rest_api/api/resources/llmProviderKey/client/requests/index.ts +2 -0
- package/src/opik/rest_api/api/resources/llmProviderKey/index.ts +1 -0
- package/src/opik/rest_api/api/resources/projects/client/Client.ts +720 -0
- package/src/opik/rest_api/api/resources/projects/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/projects/client/requests/FindProjectsRequest.ts +14 -0
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectMetricRequestPublic.ts +16 -0
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectRetrievePublic.ts +13 -0
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectUpdate.ts +12 -0
- package/src/opik/rest_api/api/resources/projects/client/requests/ProjectWrite.ts +14 -0
- package/src/opik/rest_api/api/resources/projects/client/requests/index.ts +5 -0
- package/src/opik/rest_api/api/resources/projects/index.ts +2 -0
- package/src/opik/rest_api/api/resources/projects/types/ProjectMetricRequestPublicInterval.ts +11 -0
- package/src/opik/rest_api/api/resources/projects/types/ProjectMetricRequestPublicMetricType.ts +18 -0
- package/src/opik/rest_api/api/resources/projects/types/index.ts +2 -0
- package/src/opik/rest_api/api/resources/prompts/client/Client.ts +900 -0
- package/src/opik/rest_api/api/resources/prompts/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/CreatePromptVersionDetail.ts +19 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/GetPromptVersionsRequest.ts +12 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/GetPromptsRequest.ts +13 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/PromptUpdatable.ts +14 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/PromptVersionRetrieveDetail.ts +14 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/PromptWrite.ts +16 -0
- package/src/opik/rest_api/api/resources/prompts/client/requests/index.ts +6 -0
- package/src/opik/rest_api/api/resources/prompts/index.ts +1 -0
- package/src/opik/rest_api/api/resources/spans/client/Client.ts +957 -0
- package/src/opik/rest_api/api/resources/spans/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/spans/client/requests/FindFeedbackScoreNames1Request.ts +14 -0
- package/src/opik/rest_api/api/resources/spans/client/requests/GetSpanStatsRequest.ts +17 -0
- package/src/opik/rest_api/api/resources/spans/client/requests/GetSpansByProjectRequest.ts +20 -0
- package/src/opik/rest_api/api/resources/spans/client/requests/SpanBatchWrite.ts +20 -0
- package/src/opik/rest_api/api/resources/spans/client/requests/SpanUpdate.ts +29 -0
- package/src/opik/rest_api/api/resources/spans/client/requests/index.ts +5 -0
- package/src/opik/rest_api/api/resources/spans/index.ts +2 -0
- package/src/opik/rest_api/api/resources/spans/types/FindFeedbackScoreNames1RequestType.ts +11 -0
- package/src/opik/rest_api/api/resources/spans/types/GetSpanStatsRequestType.ts +11 -0
- package/src/opik/rest_api/api/resources/spans/types/GetSpansByProjectRequestType.ts +11 -0
- package/src/opik/rest_api/api/resources/spans/types/index.ts +3 -0
- package/src/opik/rest_api/api/resources/systemUsage/client/Client.ts +347 -0
- package/src/opik/rest_api/api/resources/systemUsage/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/systemUsage/index.ts +1 -0
- package/src/opik/rest_api/api/resources/traces/client/Client.ts +990 -0
- package/src/opik/rest_api/api/resources/traces/client/index.ts +1 -0
- package/src/opik/rest_api/api/resources/traces/client/requests/FindFeedbackScoreNames2Request.ts +11 -0
- package/src/opik/rest_api/api/resources/traces/client/requests/GetTraceStatsRequest.ts +13 -0
- package/src/opik/rest_api/api/resources/traces/client/requests/GetTracesByProjectRequest.ts +16 -0
- package/src/opik/rest_api/api/resources/traces/client/requests/TraceBatchWrite.ts +18 -0
- package/src/opik/rest_api/api/resources/traces/client/requests/TraceUpdate.ts +22 -0
- package/src/opik/rest_api/api/resources/traces/client/requests/index.ts +5 -0
- package/src/opik/rest_api/api/resources/traces/index.ts +1 -0
- package/src/opik/rest_api/api/types/AssistantMessage.ts +14 -0
- package/src/opik/rest_api/api/types/AssistantMessageRole.ts +13 -0
- package/src/opik/rest_api/api/types/AuthDetailsHolder.ts +5 -0
- package/src/opik/rest_api/api/types/AvgValueStatPublic.ts +7 -0
- package/src/opik/rest_api/api/types/BatchDelete.ts +7 -0
- package/src/opik/rest_api/api/types/BiInformation.ts +9 -0
- package/src/opik/rest_api/api/types/BiInformationResponse.ts +9 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinition.ts +13 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionCreate.ts +9 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionPublic.ts +13 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDefinitionUpdate.ts +9 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetail.ts +7 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetailCreate.ts +7 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetailPublic.ts +7 -0
- package/src/opik/rest_api/api/types/CategoricalFeedbackDetailUpdate.ts +7 -0
- package/src/opik/rest_api/api/types/ChatCompletionChoice.ts +12 -0
- package/src/opik/rest_api/api/types/ChatCompletionResponse.ts +14 -0
- package/src/opik/rest_api/api/types/ChunkedOutputJsonNode.ts +10 -0
- package/src/opik/rest_api/api/types/ChunkedOutputJsonNodeType.ts +7 -0
- package/src/opik/rest_api/api/types/Column.ts +13 -0
- package/src/opik/rest_api/api/types/ColumnCompare.ts +13 -0
- package/src/opik/rest_api/api/types/ColumnCompareTypesItem.ts +14 -0
- package/src/opik/rest_api/api/types/ColumnPublic.ts +13 -0
- package/src/opik/rest_api/api/types/ColumnPublicTypesItem.ts +14 -0
- package/src/opik/rest_api/api/types/ColumnTypesItem.ts +14 -0
- package/src/opik/rest_api/api/types/CompletionTokensDetails.ts +7 -0
- package/src/opik/rest_api/api/types/CountValueStatPublic.ts +7 -0
- package/src/opik/rest_api/api/types/DataPointNumberPublic.ts +8 -0
- package/src/opik/rest_api/api/types/Dataset.ts +17 -0
- package/src/opik/rest_api/api/types/DatasetItem.ts +21 -0
- package/src/opik/rest_api/api/types/DatasetItemBatch.ts +13 -0
- package/src/opik/rest_api/api/types/DatasetItemCompare.ts +21 -0
- package/src/opik/rest_api/api/types/DatasetItemCompareSource.ts +12 -0
- package/src/opik/rest_api/api/types/DatasetItemPageCompare.ts +13 -0
- package/src/opik/rest_api/api/types/DatasetItemPagePublic.ts +13 -0
- package/src/opik/rest_api/api/types/DatasetItemPublic.ts +21 -0
- package/src/opik/rest_api/api/types/DatasetItemPublicSource.ts +12 -0
- package/src/opik/rest_api/api/types/DatasetItemSource.ts +12 -0
- package/src/opik/rest_api/api/types/DatasetItemWrite.ts +16 -0
- package/src/opik/rest_api/api/types/DatasetItemWriteSource.ts +12 -0
- package/src/opik/rest_api/api/types/DatasetPagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/DatasetPublic.ts +17 -0
- package/src/opik/rest_api/api/types/DeleteFeedbackScore.ts +7 -0
- package/src/opik/rest_api/api/types/Delta.ts +12 -0
- package/src/opik/rest_api/api/types/DeltaRole.ts +13 -0
- package/src/opik/rest_api/api/types/ErrorInfo.ts +9 -0
- package/src/opik/rest_api/api/types/ErrorInfoPublic.ts +9 -0
- package/src/opik/rest_api/api/types/ErrorInfoWrite.ts +9 -0
- package/src/opik/rest_api/api/types/ErrorMessage.ts +9 -0
- package/src/opik/rest_api/api/types/ErrorMessageDetail.ts +9 -0
- package/src/opik/rest_api/api/types/ErrorMessagePublic.ts +7 -0
- package/src/opik/rest_api/api/types/Experiment.ts +20 -0
- package/src/opik/rest_api/api/types/ExperimentItem.ts +19 -0
- package/src/opik/rest_api/api/types/ExperimentItemCompare.ts +19 -0
- package/src/opik/rest_api/api/types/ExperimentItemPublic.ts +14 -0
- package/src/opik/rest_api/api/types/ExperimentPagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/ExperimentPublic.ts +20 -0
- package/src/opik/rest_api/api/types/Feedback.ts +26 -0
- package/src/opik/rest_api/api/types/FeedbackCreate.ts +22 -0
- package/src/opik/rest_api/api/types/FeedbackDefinitionPagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/FeedbackObjectPublic.ts +26 -0
- package/src/opik/rest_api/api/types/FeedbackPublic.ts +26 -0
- package/src/opik/rest_api/api/types/FeedbackScore.ts +17 -0
- package/src/opik/rest_api/api/types/FeedbackScoreAverage.ts +8 -0
- package/src/opik/rest_api/api/types/FeedbackScoreAveragePublic.ts +8 -0
- package/src/opik/rest_api/api/types/FeedbackScoreBatch.ts +9 -0
- package/src/opik/rest_api/api/types/FeedbackScoreBatchItem.ts +16 -0
- package/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts +10 -0
- package/src/opik/rest_api/api/types/FeedbackScoreCompare.ts +17 -0
- package/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts +10 -0
- package/src/opik/rest_api/api/types/FeedbackScorePublic.ts +17 -0
- package/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts +10 -0
- package/src/opik/rest_api/api/types/FeedbackScoreSource.ts +10 -0
- package/src/opik/rest_api/api/types/FeedbackUpdate.ts +22 -0
- package/src/opik/rest_api/api/types/Function.ts +12 -0
- package/src/opik/rest_api/api/types/FunctionCall.ts +8 -0
- package/src/opik/rest_api/api/types/JsonNode.ts +5 -0
- package/src/opik/rest_api/api/types/JsonNodeCompare.ts +5 -0
- package/src/opik/rest_api/api/types/JsonNodePublic.ts +5 -0
- package/src/opik/rest_api/api/types/JsonNodeWrite.ts +5 -0
- package/src/opik/rest_api/api/types/JsonObjectSchema.ts +14 -0
- package/src/opik/rest_api/api/types/JsonSchema.ts +11 -0
- package/src/opik/rest_api/api/types/JsonSchemaElement.ts +7 -0
- package/src/opik/rest_api/api/types/Message.ts +5 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinition.ts +13 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionCreate.ts +9 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionPublic.ts +13 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDefinitionUpdate.ts +9 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDetail.ts +8 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDetailCreate.ts +8 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDetailPublic.ts +8 -0
- package/src/opik/rest_api/api/types/NumericalFeedbackDetailUpdate.ts +8 -0
- package/src/opik/rest_api/api/types/PageColumns.ts +9 -0
- package/src/opik/rest_api/api/types/PercentageValueStatPublic.ts +9 -0
- package/src/opik/rest_api/api/types/PercentageValuesPublic.ts +9 -0
- package/src/opik/rest_api/api/types/Project.ts +14 -0
- package/src/opik/rest_api/api/types/ProjectMetricResponsePublic.ts +12 -0
- package/src/opik/rest_api/api/types/ProjectMetricResponsePublicInterval.ts +11 -0
- package/src/opik/rest_api/api/types/ProjectMetricResponsePublicMetricType.ts +18 -0
- package/src/opik/rest_api/api/types/ProjectPagePublic.ts +13 -0
- package/src/opik/rest_api/api/types/ProjectPublic.ts +14 -0
- package/src/opik/rest_api/api/types/ProjectStatItemObjectPublic.ts +28 -0
- package/src/opik/rest_api/api/types/ProjectStatsPublic.ts +9 -0
- package/src/opik/rest_api/api/types/Prompt.ts +18 -0
- package/src/opik/rest_api/api/types/PromptDetail.ts +17 -0
- package/src/opik/rest_api/api/types/PromptPagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/PromptPublic.ts +14 -0
- package/src/opik/rest_api/api/types/PromptVersion.ts +15 -0
- package/src/opik/rest_api/api/types/PromptVersionDetail.ts +15 -0
- package/src/opik/rest_api/api/types/PromptVersionLink.ts +9 -0
- package/src/opik/rest_api/api/types/PromptVersionLinkPublic.ts +9 -0
- package/src/opik/rest_api/api/types/PromptVersionLinkWrite.ts +7 -0
- package/src/opik/rest_api/api/types/PromptVersionPagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/PromptVersionPublic.ts +14 -0
- package/src/opik/rest_api/api/types/ProviderApiKey.ts +13 -0
- package/src/opik/rest_api/api/types/ProviderApiKeyPublic.ts +12 -0
- package/src/opik/rest_api/api/types/ResponseFormat.ts +10 -0
- package/src/opik/rest_api/api/types/ResponseFormatType.ts +11 -0
- package/src/opik/rest_api/api/types/ResultsNumberPublic.ts +10 -0
- package/src/opik/rest_api/api/types/Span.ts +32 -0
- package/src/opik/rest_api/api/types/SpanBatch.ts +9 -0
- package/src/opik/rest_api/api/types/SpanPagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/SpanPublic.ts +30 -0
- package/src/opik/rest_api/api/types/SpanPublicType.ts +11 -0
- package/src/opik/rest_api/api/types/SpanType.ts +11 -0
- package/src/opik/rest_api/api/types/SpanWrite.ts +25 -0
- package/src/opik/rest_api/api/types/SpanWriteType.ts +11 -0
- package/src/opik/rest_api/api/types/StreamOptions.ts +7 -0
- package/src/opik/rest_api/api/types/Tool.ts +10 -0
- package/src/opik/rest_api/api/types/ToolCall.ts +12 -0
- package/src/opik/rest_api/api/types/Trace.ts +27 -0
- package/src/opik/rest_api/api/types/TraceBatch.ts +9 -0
- package/src/opik/rest_api/api/types/TraceCountResponse.ts +9 -0
- package/src/opik/rest_api/api/types/TracePagePublic.ts +12 -0
- package/src/opik/rest_api/api/types/TracePublic.ts +25 -0
- package/src/opik/rest_api/api/types/TraceWrite.ts +19 -0
- package/src/opik/rest_api/api/types/Usage.ts +12 -0
- package/src/opik/rest_api/api/types/WorkspaceTraceCount.ts +8 -0
- package/src/opik/rest_api/api/types/index.ts +138 -0
- package/src/opik/rest_api/core/api-promise/APIPromise.ts +54 -0
- package/src/opik/rest_api/core/api-promise/index.ts +1 -0
- package/src/opik/rest_api/core/fetcher/APIResponse.ts +12 -0
- package/src/opik/rest_api/core/fetcher/Fetcher.ts +143 -0
- package/src/opik/rest_api/core/fetcher/Supplier.ts +11 -0
- package/src/opik/rest_api/core/fetcher/createRequestUrl.ts +10 -0
- package/src/opik/rest_api/core/fetcher/getFetchFn.ts +25 -0
- package/src/opik/rest_api/core/fetcher/getHeader.ts +8 -0
- package/src/opik/rest_api/core/fetcher/getRequestBody.ts +14 -0
- package/src/opik/rest_api/core/fetcher/getResponseBody.ts +34 -0
- package/src/opik/rest_api/core/fetcher/index.ts +5 -0
- package/src/opik/rest_api/core/fetcher/makeRequest.ts +44 -0
- package/src/opik/rest_api/core/fetcher/requestWithRetries.ts +33 -0
- package/src/opik/rest_api/core/fetcher/signals.ts +38 -0
- package/src/opik/rest_api/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +256 -0
- package/src/opik/rest_api/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +106 -0
- package/src/opik/rest_api/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +243 -0
- package/src/opik/rest_api/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +33 -0
- package/src/opik/rest_api/core/index.ts +4 -0
- package/src/opik/rest_api/core/runtime/index.ts +1 -0
- package/src/opik/rest_api/core/runtime/runtime.ts +126 -0
- package/src/opik/rest_api/core/schemas/Schema.ts +99 -0
- package/src/opik/rest_api/core/schemas/builders/bigint/bigint.ts +50 -0
- package/src/opik/rest_api/core/schemas/builders/bigint/index.ts +1 -0
- package/src/opik/rest_api/core/schemas/builders/date/date.ts +65 -0
- package/src/opik/rest_api/core/schemas/builders/date/index.ts +1 -0
- package/src/opik/rest_api/core/schemas/builders/enum/enum.ts +43 -0
- package/src/opik/rest_api/core/schemas/builders/enum/index.ts +1 -0
- package/src/opik/rest_api/core/schemas/builders/index.ts +14 -0
- package/src/opik/rest_api/core/schemas/builders/lazy/index.ts +3 -0
- package/src/opik/rest_api/core/schemas/builders/lazy/lazy.ts +32 -0
- package/src/opik/rest_api/core/schemas/builders/lazy/lazyObject.ts +20 -0
- package/src/opik/rest_api/core/schemas/builders/list/index.ts +1 -0
- package/src/opik/rest_api/core/schemas/builders/list/list.ts +73 -0
- package/src/opik/rest_api/core/schemas/builders/literals/booleanLiteral.ts +29 -0
- package/src/opik/rest_api/core/schemas/builders/literals/index.ts +2 -0
- package/src/opik/rest_api/core/schemas/builders/literals/stringLiteral.ts +29 -0
- package/src/opik/rest_api/core/schemas/builders/object/index.ts +22 -0
- package/src/opik/rest_api/core/schemas/builders/object/object.ts +324 -0
- package/src/opik/rest_api/core/schemas/builders/object/objectWithoutOptionalProperties.ts +18 -0
- package/src/opik/rest_api/core/schemas/builders/object/property.ts +23 -0
- package/src/opik/rest_api/core/schemas/builders/object/types.ts +72 -0
- package/src/opik/rest_api/core/schemas/builders/object-like/getObjectLikeUtils.ts +79 -0
- package/src/opik/rest_api/core/schemas/builders/object-like/index.ts +2 -0
- package/src/opik/rest_api/core/schemas/builders/object-like/types.ts +11 -0
- package/src/opik/rest_api/core/schemas/builders/primitives/any.ts +4 -0
- package/src/opik/rest_api/core/schemas/builders/primitives/boolean.ts +25 -0
- package/src/opik/rest_api/core/schemas/builders/primitives/index.ts +5 -0
- package/src/opik/rest_api/core/schemas/builders/primitives/number.ts +25 -0
- package/src/opik/rest_api/core/schemas/builders/primitives/string.ts +25 -0
- package/src/opik/rest_api/core/schemas/builders/primitives/unknown.ts +4 -0
- package/src/opik/rest_api/core/schemas/builders/record/index.ts +2 -0
- package/src/opik/rest_api/core/schemas/builders/record/record.ts +130 -0
- package/src/opik/rest_api/core/schemas/builders/record/types.ts +17 -0
- package/src/opik/rest_api/core/schemas/builders/schema-utils/JsonError.ts +9 -0
- package/src/opik/rest_api/core/schemas/builders/schema-utils/ParseError.ts +9 -0
- package/src/opik/rest_api/core/schemas/builders/schema-utils/getSchemaUtils.ts +105 -0
- package/src/opik/rest_api/core/schemas/builders/schema-utils/index.ts +4 -0
- package/src/opik/rest_api/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +8 -0
- package/src/opik/rest_api/core/schemas/builders/set/index.ts +1 -0
- package/src/opik/rest_api/core/schemas/builders/set/set.ts +43 -0
- package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/index.ts +6 -0
- package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/types.ts +10 -0
- package/src/opik/rest_api/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +60 -0
- package/src/opik/rest_api/core/schemas/builders/union/discriminant.ts +14 -0
- package/src/opik/rest_api/core/schemas/builders/union/index.ts +10 -0
- package/src/opik/rest_api/core/schemas/builders/union/types.ts +26 -0
- package/src/opik/rest_api/core/schemas/builders/union/union.ts +170 -0
- package/src/opik/rest_api/core/schemas/index.ts +2 -0
- package/src/opik/rest_api/core/schemas/utils/MaybePromise.ts +1 -0
- package/src/opik/rest_api/core/schemas/utils/addQuestionMarksToNullableProperties.ts +15 -0
- package/src/opik/rest_api/core/schemas/utils/createIdentitySchemaCreator.ts +21 -0
- package/src/opik/rest_api/core/schemas/utils/entries.ts +3 -0
- package/src/opik/rest_api/core/schemas/utils/filterObject.ts +10 -0
- package/src/opik/rest_api/core/schemas/utils/getErrorMessageForIncorrectType.ts +25 -0
- package/src/opik/rest_api/core/schemas/utils/isPlainObject.ts +17 -0
- package/src/opik/rest_api/core/schemas/utils/keys.ts +3 -0
- package/src/opik/rest_api/core/schemas/utils/maybeSkipValidation.ts +38 -0
- package/src/opik/rest_api/core/schemas/utils/partition.ts +12 -0
- package/src/opik/rest_api/environments.ts +9 -0
- package/src/opik/rest_api/errors/OpikApiError.ts +45 -0
- package/src/opik/rest_api/errors/OpikApiTimeoutError.ts +10 -0
- package/src/opik/rest_api/errors/index.ts +2 -0
- package/src/opik/rest_api/index.ts +4 -0
- package/src/opik/rest_api/serialization/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/chatCompletions/client/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/chatCompletions/client/requests/ChatCompletionRequest.ts +72 -0
- package/src/opik/rest_api/serialization/resources/chatCompletions/client/requests/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/chatCompletions/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetIdentifier.ts +20 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetIdentifierPublic.ts +20 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemBatchWrite.ts +25 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemStreamRequest.ts +24 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetItemsDelete.ts +20 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetUpdate.ts +20 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/DatasetWrite.ts +22 -0
- package/src/opik/rest_api/serialization/resources/datasets/client/requests/index.ts +7 -0
- package/src/opik/rest_api/serialization/resources/datasets/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/findFeedbackScoreNames.ts +15 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemStreamRequest.ts +24 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemsBatch.ts +21 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentItemsDelete.ts +20 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentWrite.ts +28 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/ExperimentsDelete.ts +20 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/IdentifierPublic.ts +18 -0
- package/src/opik/rest_api/serialization/resources/experiments/client/requests/index.ts +6 -0
- package/src/opik/rest_api/serialization/resources/experiments/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/feedbackDefinitions/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/feedbackDefinitions/types/FindFeedbackDefinitionsRequestType.ts +16 -0
- package/src/opik/rest_api/serialization/resources/feedbackDefinitions/types/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/index.ts +20 -0
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/ProviderApiKeyUpdate.ts +20 -0
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/ProviderApiKeyWrite.ts +20 -0
- package/src/opik/rest_api/serialization/resources/llmProviderKey/client/requests/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/llmProviderKey/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/projects/client/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectMetricRequestPublic.ts +28 -0
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectRetrievePublic.ts +20 -0
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectUpdate.ts +20 -0
- package/src/opik/rest_api/serialization/resources/projects/client/requests/ProjectWrite.ts +20 -0
- package/src/opik/rest_api/serialization/resources/projects/client/requests/index.ts +4 -0
- package/src/opik/rest_api/serialization/resources/projects/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/projects/types/ProjectMetricRequestPublicInterval.ts +16 -0
- package/src/opik/rest_api/serialization/resources/projects/types/ProjectMetricRequestPublicMetricType.ts +16 -0
- package/src/opik/rest_api/serialization/resources/projects/types/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/prompts/client/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/CreatePromptVersionDetail.ts +23 -0
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptUpdatable.ts +20 -0
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptVersionRetrieveDetail.ts +22 -0
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/PromptWrite.ts +24 -0
- package/src/opik/rest_api/serialization/resources/prompts/client/requests/index.ts +4 -0
- package/src/opik/rest_api/serialization/resources/prompts/index.ts +1 -0
- package/src/opik/rest_api/serialization/resources/spans/client/findFeedbackScoreNames1.ts +13 -0
- package/src/opik/rest_api/serialization/resources/spans/client/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/spans/client/requests/SpanBatchWrite.ts +19 -0
- package/src/opik/rest_api/serialization/resources/spans/client/requests/SpanUpdate.ts +44 -0
- package/src/opik/rest_api/serialization/resources/spans/client/requests/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/spans/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/spans/types/FindFeedbackScoreNames1RequestType.ts +16 -0
- package/src/opik/rest_api/serialization/resources/spans/types/GetSpanStatsRequestType.ts +16 -0
- package/src/opik/rest_api/serialization/resources/spans/types/GetSpansByProjectRequestType.ts +16 -0
- package/src/opik/rest_api/serialization/resources/spans/types/index.ts +3 -0
- package/src/opik/rest_api/serialization/resources/traces/client/findFeedbackScoreNames2.ts +13 -0
- package/src/opik/rest_api/serialization/resources/traces/client/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/traces/client/requests/TraceBatchWrite.ts +19 -0
- package/src/opik/rest_api/serialization/resources/traces/client/requests/TraceUpdate.ts +34 -0
- package/src/opik/rest_api/serialization/resources/traces/client/requests/index.ts +2 -0
- package/src/opik/rest_api/serialization/resources/traces/index.ts +1 -0
- package/src/opik/rest_api/serialization/types/AssistantMessage.ts +33 -0
- package/src/opik/rest_api/serialization/types/AssistantMessageRole.ts +16 -0
- package/src/opik/rest_api/serialization/types/AuthDetailsHolder.ts +16 -0
- package/src/opik/rest_api/serialization/types/AvgValueStatPublic.ts +20 -0
- package/src/opik/rest_api/serialization/types/BatchDelete.ts +18 -0
- package/src/opik/rest_api/serialization/types/BiInformation.ts +22 -0
- package/src/opik/rest_api/serialization/types/BiInformationResponse.ts +21 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinition.ts +29 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionCreate.ts +21 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionPublic.ts +29 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDefinitionUpdate.ts +21 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetail.ts +20 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailCreate.ts +20 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailPublic.ts +20 -0
- package/src/opik/rest_api/serialization/types/CategoricalFeedbackDetailUpdate.ts +20 -0
- package/src/opik/rest_api/serialization/types/ChatCompletionChoice.ts +28 -0
- package/src/opik/rest_api/serialization/types/ChatCompletionResponse.ts +32 -0
- package/src/opik/rest_api/serialization/types/ChunkedOutputJsonNode.ts +23 -0
- package/src/opik/rest_api/serialization/types/ChunkedOutputJsonNodeType.ts +20 -0
- package/src/opik/rest_api/serialization/types/Column.ts +25 -0
- package/src/opik/rest_api/serialization/types/ColumnCompare.ts +25 -0
- package/src/opik/rest_api/serialization/types/ColumnCompareTypesItem.ts +16 -0
- package/src/opik/rest_api/serialization/types/ColumnPublic.ts +25 -0
- package/src/opik/rest_api/serialization/types/ColumnPublicTypesItem.ts +16 -0
- package/src/opik/rest_api/serialization/types/ColumnTypesItem.ts +14 -0
- package/src/opik/rest_api/serialization/types/CompletionTokensDetails.ts +20 -0
- package/src/opik/rest_api/serialization/types/CountValueStatPublic.ts +20 -0
- package/src/opik/rest_api/serialization/types/DataPointNumberPublic.ts +22 -0
- package/src/opik/rest_api/serialization/types/Dataset.ts +44 -0
- package/src/opik/rest_api/serialization/types/DatasetItem.ts +48 -0
- package/src/opik/rest_api/serialization/types/DatasetItemBatch.ts +25 -0
- package/src/opik/rest_api/serialization/types/DatasetItemCompare.ts +51 -0
- package/src/opik/rest_api/serialization/types/DatasetItemCompareSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/DatasetItemPageCompare.ts +30 -0
- package/src/opik/rest_api/serialization/types/DatasetItemPagePublic.ts +30 -0
- package/src/opik/rest_api/serialization/types/DatasetItemPublic.ts +51 -0
- package/src/opik/rest_api/serialization/types/DatasetItemPublicSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/DatasetItemSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/DatasetItemWrite.ts +37 -0
- package/src/opik/rest_api/serialization/types/DatasetItemWriteSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/DatasetPagePublic.ts +27 -0
- package/src/opik/rest_api/serialization/types/DatasetPublic.ts +44 -0
- package/src/opik/rest_api/serialization/types/DeleteFeedbackScore.ts +20 -0
- package/src/opik/rest_api/serialization/types/Delta.ts +26 -0
- package/src/opik/rest_api/serialization/types/DeltaRole.ts +14 -0
- package/src/opik/rest_api/serialization/types/ErrorInfo.ts +22 -0
- package/src/opik/rest_api/serialization/types/ErrorInfoPublic.ts +24 -0
- package/src/opik/rest_api/serialization/types/ErrorInfoWrite.ts +22 -0
- package/src/opik/rest_api/serialization/types/ErrorMessage.ts +22 -0
- package/src/opik/rest_api/serialization/types/ErrorMessageDetail.ts +24 -0
- package/src/opik/rest_api/serialization/types/ErrorMessagePublic.ts +20 -0
- package/src/opik/rest_api/serialization/types/Experiment.ts +46 -0
- package/src/opik/rest_api/serialization/types/ExperimentItem.ts +43 -0
- package/src/opik/rest_api/serialization/types/ExperimentItemCompare.ts +45 -0
- package/src/opik/rest_api/serialization/types/ExperimentItemPublic.ts +34 -0
- package/src/opik/rest_api/serialization/types/ExperimentPagePublic.ts +27 -0
- package/src/opik/rest_api/serialization/types/ExperimentPublic.ts +48 -0
- package/src/opik/rest_api/serialization/types/Feedback.ts +48 -0
- package/src/opik/rest_api/serialization/types/FeedbackCreate.ts +41 -0
- package/src/opik/rest_api/serialization/types/FeedbackDefinitionPagePublic.ts +27 -0
- package/src/opik/rest_api/serialization/types/FeedbackObjectPublic.ts +51 -0
- package/src/opik/rest_api/serialization/types/FeedbackPublic.ts +49 -0
- package/src/opik/rest_api/serialization/types/FeedbackScore.ts +35 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreAverage.ts +22 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreAveragePublic.ts +22 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreBatch.ts +21 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreBatchItem.ts +33 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreBatchItemSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreCompare.ts +37 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/FeedbackScorePublic.ts +37 -0
- package/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts +16 -0
- package/src/opik/rest_api/serialization/types/FeedbackUpdate.ts +41 -0
- package/src/opik/rest_api/serialization/types/Function.ts +25 -0
- package/src/opik/rest_api/serialization/types/FunctionCall.ts +20 -0
- package/src/opik/rest_api/serialization/types/JsonNode.ts +14 -0
- package/src/opik/rest_api/serialization/types/JsonNodeCompare.ts +14 -0
- package/src/opik/rest_api/serialization/types/JsonNodePublic.ts +14 -0
- package/src/opik/rest_api/serialization/types/JsonNodeWrite.ts +14 -0
- package/src/opik/rest_api/serialization/types/JsonObjectSchema.ts +34 -0
- package/src/opik/rest_api/serialization/types/JsonSchema.ts +23 -0
- package/src/opik/rest_api/serialization/types/JsonSchemaElement.ts +20 -0
- package/src/opik/rest_api/serialization/types/Message.ts +16 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinition.ts +29 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionCreate.ts +21 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionPublic.ts +29 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDefinitionUpdate.ts +21 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetail.ts +22 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailCreate.ts +22 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailPublic.ts +22 -0
- package/src/opik/rest_api/serialization/types/NumericalFeedbackDetailUpdate.ts +22 -0
- package/src/opik/rest_api/serialization/types/PageColumns.ts +19 -0
- package/src/opik/rest_api/serialization/types/PercentageValueStatPublic.ts +21 -0
- package/src/opik/rest_api/serialization/types/PercentageValuesPublic.ts +24 -0
- package/src/opik/rest_api/serialization/types/Project.ts +32 -0
- package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublic.ts +29 -0
- package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublicInterval.ts +16 -0
- package/src/opik/rest_api/serialization/types/ProjectMetricResponsePublicMetricType.ts +16 -0
- package/src/opik/rest_api/serialization/types/ProjectPagePublic.ts +29 -0
- package/src/opik/rest_api/serialization/types/ProjectPublic.ts +32 -0
- package/src/opik/rest_api/serialization/types/ProjectStatItemObjectPublic.ts +50 -0
- package/src/opik/rest_api/serialization/types/ProjectStatsPublic.ts +21 -0
- package/src/opik/rest_api/serialization/types/Prompt.ts +37 -0
- package/src/opik/rest_api/serialization/types/PromptDetail.ts +35 -0
- package/src/opik/rest_api/serialization/types/PromptPagePublic.ts +27 -0
- package/src/opik/rest_api/serialization/types/PromptPublic.ts +32 -0
- package/src/opik/rest_api/serialization/types/PromptVersion.ts +30 -0
- package/src/opik/rest_api/serialization/types/PromptVersionDetail.ts +32 -0
- package/src/opik/rest_api/serialization/types/PromptVersionLink.ts +24 -0
- package/src/opik/rest_api/serialization/types/PromptVersionLinkPublic.ts +24 -0
- package/src/opik/rest_api/serialization/types/PromptVersionLinkWrite.ts +20 -0
- package/src/opik/rest_api/serialization/types/PromptVersionPagePublic.ts +27 -0
- package/src/opik/rest_api/serialization/types/PromptVersionPublic.ts +30 -0
- package/src/opik/rest_api/serialization/types/ProviderApiKey.ts +30 -0
- package/src/opik/rest_api/serialization/types/ProviderApiKeyPublic.ts +30 -0
- package/src/opik/rest_api/serialization/types/ResponseFormat.ts +22 -0
- package/src/opik/rest_api/serialization/types/ResponseFormatType.ts +16 -0
- package/src/opik/rest_api/serialization/types/ResultsNumberPublic.ts +23 -0
- package/src/opik/rest_api/serialization/types/Span.ts +65 -0
- package/src/opik/rest_api/serialization/types/SpanBatch.ts +19 -0
- package/src/opik/rest_api/serialization/types/SpanPagePublic.ts +25 -0
- package/src/opik/rest_api/serialization/types/SpanPublic.ts +67 -0
- package/src/opik/rest_api/serialization/types/SpanPublicType.ts +14 -0
- package/src/opik/rest_api/serialization/types/SpanType.ts +15 -0
- package/src/opik/rest_api/serialization/types/SpanWrite.ts +51 -0
- package/src/opik/rest_api/serialization/types/SpanWriteType.ts +14 -0
- package/src/opik/rest_api/serialization/types/StreamOptions.ts +18 -0
- package/src/opik/rest_api/serialization/types/Tool.ts +20 -0
- package/src/opik/rest_api/serialization/types/ToolCall.ts +25 -0
- package/src/opik/rest_api/serialization/types/Trace.ts +54 -0
- package/src/opik/rest_api/serialization/types/TraceBatch.ts +19 -0
- package/src/opik/rest_api/serialization/types/TraceCountResponse.ts +24 -0
- package/src/opik/rest_api/serialization/types/TracePagePublic.ts +27 -0
- package/src/opik/rest_api/serialization/types/TracePublic.ts +56 -0
- package/src/opik/rest_api/serialization/types/TraceWrite.ts +38 -0
- package/src/opik/rest_api/serialization/types/Usage.ts +27 -0
- package/src/opik/rest_api/serialization/types/WorkspaceTraceCount.ts +22 -0
- package/src/opik/rest_api/serialization/types/index.ts +138 -0
- package/src/opik/tracer/Span.ts +34 -0
- package/src/opik/tracer/Trace.ts +61 -0
- package/tests/client.test.ts +25 -0
- package/tsconfig.json +25 -0
- package/tsup.config.ts +11 -0
- package/vitest.config.ts +13 -0
|
@@ -0,0 +1,957 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as environments from "../../../../environments";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
import * as OpikApi from "../../../index";
|
|
8
|
+
import * as serializers from "../../../../serialization/index";
|
|
9
|
+
import urlJoin from "url-join";
|
|
10
|
+
import * as errors from "../../../../errors/index";
|
|
11
|
+
|
|
12
|
+
export declare namespace Spans {
|
|
13
|
+
interface Options {
|
|
14
|
+
environment?: core.Supplier<environments.OpikApiEnvironment | string>;
|
|
15
|
+
/** Override the Authorization header */
|
|
16
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
17
|
+
/** Override the Comet-Workspace header */
|
|
18
|
+
workspaceName?: core.Supplier<string | undefined>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface RequestOptions {
|
|
22
|
+
/** The maximum time to wait for a response in seconds. */
|
|
23
|
+
timeoutInSeconds?: number;
|
|
24
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
25
|
+
maxRetries?: number;
|
|
26
|
+
/** A hook to abort the request. */
|
|
27
|
+
abortSignal?: AbortSignal;
|
|
28
|
+
/** Override the Authorization header */
|
|
29
|
+
apiKey?: string | undefined;
|
|
30
|
+
/** Override the Comet-Workspace header */
|
|
31
|
+
workspaceName?: string | undefined;
|
|
32
|
+
/** Additional headers to include in the request. */
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Span related resources
|
|
39
|
+
*/
|
|
40
|
+
export class Spans {
|
|
41
|
+
constructor(protected readonly _options: Spans.Options = {}) {}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Add span feedback score
|
|
45
|
+
*
|
|
46
|
+
* @param {string} id
|
|
47
|
+
* @param {OpikApi.FeedbackScore} request
|
|
48
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* await client.spans.addSpanFeedbackScore("id", {
|
|
52
|
+
* name: "name",
|
|
53
|
+
* value: 1.1,
|
|
54
|
+
* source: "ui"
|
|
55
|
+
* })
|
|
56
|
+
*/
|
|
57
|
+
public addSpanFeedbackScore(
|
|
58
|
+
id: string,
|
|
59
|
+
request: OpikApi.FeedbackScore,
|
|
60
|
+
requestOptions?: Spans.RequestOptions
|
|
61
|
+
): core.APIPromise<void> {
|
|
62
|
+
return core.APIPromise.from(
|
|
63
|
+
(async () => {
|
|
64
|
+
const _response = await core.fetcher({
|
|
65
|
+
url: urlJoin(
|
|
66
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
67
|
+
`v1/private/spans/${encodeURIComponent(id)}/feedback-scores`
|
|
68
|
+
),
|
|
69
|
+
method: "PUT",
|
|
70
|
+
headers: {
|
|
71
|
+
"Comet-Workspace":
|
|
72
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
73
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
74
|
+
: undefined,
|
|
75
|
+
"X-Fern-Language": "JavaScript",
|
|
76
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
77
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
78
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
79
|
+
...requestOptions?.headers,
|
|
80
|
+
},
|
|
81
|
+
contentType: "application/json",
|
|
82
|
+
requestType: "json",
|
|
83
|
+
body: serializers.FeedbackScore.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
84
|
+
timeoutMs:
|
|
85
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
86
|
+
maxRetries: requestOptions?.maxRetries,
|
|
87
|
+
withCredentials: true,
|
|
88
|
+
abortSignal: requestOptions?.abortSignal,
|
|
89
|
+
});
|
|
90
|
+
if (_response.ok) {
|
|
91
|
+
return {
|
|
92
|
+
ok: _response.ok,
|
|
93
|
+
body: undefined,
|
|
94
|
+
headers: _response.headers,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (_response.error.reason === "status-code") {
|
|
98
|
+
throw new errors.OpikApiError({
|
|
99
|
+
statusCode: _response.error.statusCode,
|
|
100
|
+
body: _response.error.body,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
switch (_response.error.reason) {
|
|
104
|
+
case "non-json":
|
|
105
|
+
throw new errors.OpikApiError({
|
|
106
|
+
statusCode: _response.error.statusCode,
|
|
107
|
+
body: _response.error.rawBody,
|
|
108
|
+
});
|
|
109
|
+
case "timeout":
|
|
110
|
+
throw new errors.OpikApiTimeoutError(
|
|
111
|
+
"Timeout exceeded when calling PUT /v1/private/spans/{id}/feedback-scores."
|
|
112
|
+
);
|
|
113
|
+
case "unknown":
|
|
114
|
+
throw new errors.OpikApiError({
|
|
115
|
+
message: _response.error.errorMessage,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
})()
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get spans by project_name or project_id and optionally by trace_id and/or type
|
|
124
|
+
*
|
|
125
|
+
* @param {OpikApi.GetSpansByProjectRequest} request
|
|
126
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.spans.getSpansByProject()
|
|
130
|
+
*/
|
|
131
|
+
public getSpansByProject(
|
|
132
|
+
request: OpikApi.GetSpansByProjectRequest = {},
|
|
133
|
+
requestOptions?: Spans.RequestOptions
|
|
134
|
+
): core.APIPromise<OpikApi.SpanPagePublic> {
|
|
135
|
+
return core.APIPromise.from(
|
|
136
|
+
(async () => {
|
|
137
|
+
const { page, size, projectName, projectId, traceId, type: type_, filters, truncate } = request;
|
|
138
|
+
const _queryParams: Record<string, string | string[] | object | object[]> = {};
|
|
139
|
+
if (page != null) {
|
|
140
|
+
_queryParams["page"] = page.toString();
|
|
141
|
+
}
|
|
142
|
+
if (size != null) {
|
|
143
|
+
_queryParams["size"] = size.toString();
|
|
144
|
+
}
|
|
145
|
+
if (projectName != null) {
|
|
146
|
+
_queryParams["project_name"] = projectName;
|
|
147
|
+
}
|
|
148
|
+
if (projectId != null) {
|
|
149
|
+
_queryParams["project_id"] = projectId;
|
|
150
|
+
}
|
|
151
|
+
if (traceId != null) {
|
|
152
|
+
_queryParams["trace_id"] = traceId;
|
|
153
|
+
}
|
|
154
|
+
if (type_ != null) {
|
|
155
|
+
_queryParams["type"] = type_;
|
|
156
|
+
}
|
|
157
|
+
if (filters != null) {
|
|
158
|
+
_queryParams["filters"] = filters;
|
|
159
|
+
}
|
|
160
|
+
if (truncate != null) {
|
|
161
|
+
_queryParams["truncate"] = truncate.toString();
|
|
162
|
+
}
|
|
163
|
+
const _response = await core.fetcher({
|
|
164
|
+
url: urlJoin(
|
|
165
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
166
|
+
"v1/private/spans"
|
|
167
|
+
),
|
|
168
|
+
method: "GET",
|
|
169
|
+
headers: {
|
|
170
|
+
"Comet-Workspace":
|
|
171
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
172
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
173
|
+
: undefined,
|
|
174
|
+
"X-Fern-Language": "JavaScript",
|
|
175
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
176
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
177
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
178
|
+
...requestOptions?.headers,
|
|
179
|
+
},
|
|
180
|
+
contentType: "application/json",
|
|
181
|
+
queryParameters: _queryParams,
|
|
182
|
+
requestType: "json",
|
|
183
|
+
timeoutMs:
|
|
184
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
185
|
+
maxRetries: requestOptions?.maxRetries,
|
|
186
|
+
withCredentials: true,
|
|
187
|
+
abortSignal: requestOptions?.abortSignal,
|
|
188
|
+
});
|
|
189
|
+
if (_response.ok) {
|
|
190
|
+
return {
|
|
191
|
+
ok: _response.ok,
|
|
192
|
+
body: serializers.SpanPagePublic.parseOrThrow(_response.body, {
|
|
193
|
+
unrecognizedObjectKeys: "passthrough",
|
|
194
|
+
allowUnrecognizedUnionMembers: true,
|
|
195
|
+
allowUnrecognizedEnumValues: true,
|
|
196
|
+
breadcrumbsPrefix: ["response"],
|
|
197
|
+
}),
|
|
198
|
+
headers: _response.headers,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (_response.error.reason === "status-code") {
|
|
202
|
+
throw new errors.OpikApiError({
|
|
203
|
+
statusCode: _response.error.statusCode,
|
|
204
|
+
body: _response.error.body,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
switch (_response.error.reason) {
|
|
208
|
+
case "non-json":
|
|
209
|
+
throw new errors.OpikApiError({
|
|
210
|
+
statusCode: _response.error.statusCode,
|
|
211
|
+
body: _response.error.rawBody,
|
|
212
|
+
});
|
|
213
|
+
case "timeout":
|
|
214
|
+
throw new errors.OpikApiTimeoutError("Timeout exceeded when calling GET /v1/private/spans.");
|
|
215
|
+
case "unknown":
|
|
216
|
+
throw new errors.OpikApiError({
|
|
217
|
+
message: _response.error.errorMessage,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
})()
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Create span
|
|
226
|
+
*
|
|
227
|
+
* @param {OpikApi.SpanWrite} request
|
|
228
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* await client.spans.createSpan({
|
|
232
|
+
* traceId: "trace_id",
|
|
233
|
+
* name: "name",
|
|
234
|
+
* type: "general",
|
|
235
|
+
* startTime: "2024-01-15T09:30:00Z"
|
|
236
|
+
* })
|
|
237
|
+
*/
|
|
238
|
+
public createSpan(request: OpikApi.SpanWrite, requestOptions?: Spans.RequestOptions): core.APIPromise<void> {
|
|
239
|
+
return core.APIPromise.from(
|
|
240
|
+
(async () => {
|
|
241
|
+
const _response = await core.fetcher({
|
|
242
|
+
url: urlJoin(
|
|
243
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
244
|
+
"v1/private/spans"
|
|
245
|
+
),
|
|
246
|
+
method: "POST",
|
|
247
|
+
headers: {
|
|
248
|
+
"Comet-Workspace":
|
|
249
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
250
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
251
|
+
: undefined,
|
|
252
|
+
"X-Fern-Language": "JavaScript",
|
|
253
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
254
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
255
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
256
|
+
...requestOptions?.headers,
|
|
257
|
+
},
|
|
258
|
+
contentType: "application/json",
|
|
259
|
+
requestType: "json",
|
|
260
|
+
body: serializers.SpanWrite.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
261
|
+
timeoutMs:
|
|
262
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
263
|
+
maxRetries: requestOptions?.maxRetries,
|
|
264
|
+
withCredentials: true,
|
|
265
|
+
abortSignal: requestOptions?.abortSignal,
|
|
266
|
+
});
|
|
267
|
+
if (_response.ok) {
|
|
268
|
+
return {
|
|
269
|
+
ok: _response.ok,
|
|
270
|
+
body: undefined,
|
|
271
|
+
headers: _response.headers,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
if (_response.error.reason === "status-code") {
|
|
275
|
+
throw new errors.OpikApiError({
|
|
276
|
+
statusCode: _response.error.statusCode,
|
|
277
|
+
body: _response.error.body,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
switch (_response.error.reason) {
|
|
281
|
+
case "non-json":
|
|
282
|
+
throw new errors.OpikApiError({
|
|
283
|
+
statusCode: _response.error.statusCode,
|
|
284
|
+
body: _response.error.rawBody,
|
|
285
|
+
});
|
|
286
|
+
case "timeout":
|
|
287
|
+
throw new errors.OpikApiTimeoutError("Timeout exceeded when calling POST /v1/private/spans.");
|
|
288
|
+
case "unknown":
|
|
289
|
+
throw new errors.OpikApiError({
|
|
290
|
+
message: _response.error.errorMessage,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
})()
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Create spans
|
|
299
|
+
*
|
|
300
|
+
* @param {OpikApi.SpanBatchWrite} request
|
|
301
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* await client.spans.createSpans({
|
|
305
|
+
* spans: [{
|
|
306
|
+
* traceId: "trace_id",
|
|
307
|
+
* name: "name",
|
|
308
|
+
* type: "general",
|
|
309
|
+
* startTime: "2024-01-15T09:30:00Z"
|
|
310
|
+
* }]
|
|
311
|
+
* })
|
|
312
|
+
*/
|
|
313
|
+
public createSpans(request: OpikApi.SpanBatchWrite, requestOptions?: Spans.RequestOptions): core.APIPromise<void> {
|
|
314
|
+
return core.APIPromise.from(
|
|
315
|
+
(async () => {
|
|
316
|
+
const _response = await core.fetcher({
|
|
317
|
+
url: urlJoin(
|
|
318
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
319
|
+
"v1/private/spans/batch"
|
|
320
|
+
),
|
|
321
|
+
method: "POST",
|
|
322
|
+
headers: {
|
|
323
|
+
"Comet-Workspace":
|
|
324
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
325
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
326
|
+
: undefined,
|
|
327
|
+
"X-Fern-Language": "JavaScript",
|
|
328
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
329
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
330
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
331
|
+
...requestOptions?.headers,
|
|
332
|
+
},
|
|
333
|
+
contentType: "application/json",
|
|
334
|
+
requestType: "json",
|
|
335
|
+
body: serializers.SpanBatchWrite.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
336
|
+
timeoutMs:
|
|
337
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
338
|
+
maxRetries: requestOptions?.maxRetries,
|
|
339
|
+
withCredentials: true,
|
|
340
|
+
abortSignal: requestOptions?.abortSignal,
|
|
341
|
+
});
|
|
342
|
+
if (_response.ok) {
|
|
343
|
+
return {
|
|
344
|
+
ok: _response.ok,
|
|
345
|
+
body: undefined,
|
|
346
|
+
headers: _response.headers,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
if (_response.error.reason === "status-code") {
|
|
350
|
+
throw new errors.OpikApiError({
|
|
351
|
+
statusCode: _response.error.statusCode,
|
|
352
|
+
body: _response.error.body,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
switch (_response.error.reason) {
|
|
356
|
+
case "non-json":
|
|
357
|
+
throw new errors.OpikApiError({
|
|
358
|
+
statusCode: _response.error.statusCode,
|
|
359
|
+
body: _response.error.rawBody,
|
|
360
|
+
});
|
|
361
|
+
case "timeout":
|
|
362
|
+
throw new errors.OpikApiTimeoutError(
|
|
363
|
+
"Timeout exceeded when calling POST /v1/private/spans/batch."
|
|
364
|
+
);
|
|
365
|
+
case "unknown":
|
|
366
|
+
throw new errors.OpikApiError({
|
|
367
|
+
message: _response.error.errorMessage,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
})()
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Get span by id
|
|
376
|
+
*
|
|
377
|
+
* @param {string} id
|
|
378
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
379
|
+
*
|
|
380
|
+
* @throws {@link OpikApi.NotFoundError}
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* await client.spans.getSpanById("id")
|
|
384
|
+
*/
|
|
385
|
+
public getSpanById(id: string, requestOptions?: Spans.RequestOptions): core.APIPromise<OpikApi.SpanPublic> {
|
|
386
|
+
return core.APIPromise.from(
|
|
387
|
+
(async () => {
|
|
388
|
+
const _response = await core.fetcher({
|
|
389
|
+
url: urlJoin(
|
|
390
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
391
|
+
`v1/private/spans/${encodeURIComponent(id)}`
|
|
392
|
+
),
|
|
393
|
+
method: "GET",
|
|
394
|
+
headers: {
|
|
395
|
+
"Comet-Workspace":
|
|
396
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
397
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
398
|
+
: undefined,
|
|
399
|
+
"X-Fern-Language": "JavaScript",
|
|
400
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
401
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
402
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
403
|
+
...requestOptions?.headers,
|
|
404
|
+
},
|
|
405
|
+
contentType: "application/json",
|
|
406
|
+
requestType: "json",
|
|
407
|
+
timeoutMs:
|
|
408
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
409
|
+
maxRetries: requestOptions?.maxRetries,
|
|
410
|
+
withCredentials: true,
|
|
411
|
+
abortSignal: requestOptions?.abortSignal,
|
|
412
|
+
});
|
|
413
|
+
if (_response.ok) {
|
|
414
|
+
return {
|
|
415
|
+
ok: _response.ok,
|
|
416
|
+
body: serializers.SpanPublic.parseOrThrow(_response.body, {
|
|
417
|
+
unrecognizedObjectKeys: "passthrough",
|
|
418
|
+
allowUnrecognizedUnionMembers: true,
|
|
419
|
+
allowUnrecognizedEnumValues: true,
|
|
420
|
+
breadcrumbsPrefix: ["response"],
|
|
421
|
+
}),
|
|
422
|
+
headers: _response.headers,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
if (_response.error.reason === "status-code") {
|
|
426
|
+
switch (_response.error.statusCode) {
|
|
427
|
+
case 404:
|
|
428
|
+
throw new OpikApi.NotFoundError(_response.error.body);
|
|
429
|
+
default:
|
|
430
|
+
throw new errors.OpikApiError({
|
|
431
|
+
statusCode: _response.error.statusCode,
|
|
432
|
+
body: _response.error.body,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
switch (_response.error.reason) {
|
|
437
|
+
case "non-json":
|
|
438
|
+
throw new errors.OpikApiError({
|
|
439
|
+
statusCode: _response.error.statusCode,
|
|
440
|
+
body: _response.error.rawBody,
|
|
441
|
+
});
|
|
442
|
+
case "timeout":
|
|
443
|
+
throw new errors.OpikApiTimeoutError(
|
|
444
|
+
"Timeout exceeded when calling GET /v1/private/spans/{id}."
|
|
445
|
+
);
|
|
446
|
+
case "unknown":
|
|
447
|
+
throw new errors.OpikApiError({
|
|
448
|
+
message: _response.error.errorMessage,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
})()
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Delete span by id
|
|
457
|
+
*
|
|
458
|
+
* @param {string} id
|
|
459
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
460
|
+
*
|
|
461
|
+
* @throws {@link OpikApi.NotImplementedError}
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* await client.spans.deleteSpanById("id")
|
|
465
|
+
*/
|
|
466
|
+
public deleteSpanById(id: string, requestOptions?: Spans.RequestOptions): core.APIPromise<void> {
|
|
467
|
+
return core.APIPromise.from(
|
|
468
|
+
(async () => {
|
|
469
|
+
const _response = await core.fetcher({
|
|
470
|
+
url: urlJoin(
|
|
471
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
472
|
+
`v1/private/spans/${encodeURIComponent(id)}`
|
|
473
|
+
),
|
|
474
|
+
method: "DELETE",
|
|
475
|
+
headers: {
|
|
476
|
+
"Comet-Workspace":
|
|
477
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
478
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
479
|
+
: undefined,
|
|
480
|
+
"X-Fern-Language": "JavaScript",
|
|
481
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
482
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
483
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
484
|
+
...requestOptions?.headers,
|
|
485
|
+
},
|
|
486
|
+
contentType: "application/json",
|
|
487
|
+
requestType: "json",
|
|
488
|
+
timeoutMs:
|
|
489
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
490
|
+
maxRetries: requestOptions?.maxRetries,
|
|
491
|
+
withCredentials: true,
|
|
492
|
+
abortSignal: requestOptions?.abortSignal,
|
|
493
|
+
});
|
|
494
|
+
if (_response.ok) {
|
|
495
|
+
return {
|
|
496
|
+
ok: _response.ok,
|
|
497
|
+
body: undefined,
|
|
498
|
+
headers: _response.headers,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
if (_response.error.reason === "status-code") {
|
|
502
|
+
switch (_response.error.statusCode) {
|
|
503
|
+
case 501:
|
|
504
|
+
throw new OpikApi.NotImplementedError(_response.error.body);
|
|
505
|
+
default:
|
|
506
|
+
throw new errors.OpikApiError({
|
|
507
|
+
statusCode: _response.error.statusCode,
|
|
508
|
+
body: _response.error.body,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
switch (_response.error.reason) {
|
|
513
|
+
case "non-json":
|
|
514
|
+
throw new errors.OpikApiError({
|
|
515
|
+
statusCode: _response.error.statusCode,
|
|
516
|
+
body: _response.error.rawBody,
|
|
517
|
+
});
|
|
518
|
+
case "timeout":
|
|
519
|
+
throw new errors.OpikApiTimeoutError(
|
|
520
|
+
"Timeout exceeded when calling DELETE /v1/private/spans/{id}."
|
|
521
|
+
);
|
|
522
|
+
case "unknown":
|
|
523
|
+
throw new errors.OpikApiError({
|
|
524
|
+
message: _response.error.errorMessage,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
})()
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Update span by id
|
|
533
|
+
*
|
|
534
|
+
* @param {string} id
|
|
535
|
+
* @param {OpikApi.SpanUpdate} request
|
|
536
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
537
|
+
*
|
|
538
|
+
* @throws {@link OpikApi.NotFoundError}
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* await client.spans.updateSpan("id", {
|
|
542
|
+
* traceId: "trace_id"
|
|
543
|
+
* })
|
|
544
|
+
*/
|
|
545
|
+
public updateSpan(
|
|
546
|
+
id: string,
|
|
547
|
+
request: OpikApi.SpanUpdate,
|
|
548
|
+
requestOptions?: Spans.RequestOptions
|
|
549
|
+
): core.APIPromise<void> {
|
|
550
|
+
return core.APIPromise.from(
|
|
551
|
+
(async () => {
|
|
552
|
+
const _response = await core.fetcher({
|
|
553
|
+
url: urlJoin(
|
|
554
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
555
|
+
`v1/private/spans/${encodeURIComponent(id)}`
|
|
556
|
+
),
|
|
557
|
+
method: "PATCH",
|
|
558
|
+
headers: {
|
|
559
|
+
"Comet-Workspace":
|
|
560
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
561
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
562
|
+
: undefined,
|
|
563
|
+
"X-Fern-Language": "JavaScript",
|
|
564
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
565
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
566
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
567
|
+
...requestOptions?.headers,
|
|
568
|
+
},
|
|
569
|
+
contentType: "application/json",
|
|
570
|
+
requestType: "json",
|
|
571
|
+
body: serializers.SpanUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
572
|
+
timeoutMs:
|
|
573
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
574
|
+
maxRetries: requestOptions?.maxRetries,
|
|
575
|
+
withCredentials: true,
|
|
576
|
+
abortSignal: requestOptions?.abortSignal,
|
|
577
|
+
});
|
|
578
|
+
if (_response.ok) {
|
|
579
|
+
return {
|
|
580
|
+
ok: _response.ok,
|
|
581
|
+
body: undefined,
|
|
582
|
+
headers: _response.headers,
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
if (_response.error.reason === "status-code") {
|
|
586
|
+
switch (_response.error.statusCode) {
|
|
587
|
+
case 404:
|
|
588
|
+
throw new OpikApi.NotFoundError(_response.error.body);
|
|
589
|
+
default:
|
|
590
|
+
throw new errors.OpikApiError({
|
|
591
|
+
statusCode: _response.error.statusCode,
|
|
592
|
+
body: _response.error.body,
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
switch (_response.error.reason) {
|
|
597
|
+
case "non-json":
|
|
598
|
+
throw new errors.OpikApiError({
|
|
599
|
+
statusCode: _response.error.statusCode,
|
|
600
|
+
body: _response.error.rawBody,
|
|
601
|
+
});
|
|
602
|
+
case "timeout":
|
|
603
|
+
throw new errors.OpikApiTimeoutError(
|
|
604
|
+
"Timeout exceeded when calling PATCH /v1/private/spans/{id}."
|
|
605
|
+
);
|
|
606
|
+
case "unknown":
|
|
607
|
+
throw new errors.OpikApiError({
|
|
608
|
+
message: _response.error.errorMessage,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
})()
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Delete span feedback score
|
|
617
|
+
*
|
|
618
|
+
* @param {string} id
|
|
619
|
+
* @param {OpikApi.DeleteFeedbackScore} request
|
|
620
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
621
|
+
*
|
|
622
|
+
* @example
|
|
623
|
+
* await client.spans.deleteSpanFeedbackScore("id", {
|
|
624
|
+
* name: "name"
|
|
625
|
+
* })
|
|
626
|
+
*/
|
|
627
|
+
public deleteSpanFeedbackScore(
|
|
628
|
+
id: string,
|
|
629
|
+
request: OpikApi.DeleteFeedbackScore,
|
|
630
|
+
requestOptions?: Spans.RequestOptions
|
|
631
|
+
): core.APIPromise<void> {
|
|
632
|
+
return core.APIPromise.from(
|
|
633
|
+
(async () => {
|
|
634
|
+
const _response = await core.fetcher({
|
|
635
|
+
url: urlJoin(
|
|
636
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
637
|
+
`v1/private/spans/${encodeURIComponent(id)}/feedback-scores/delete`
|
|
638
|
+
),
|
|
639
|
+
method: "POST",
|
|
640
|
+
headers: {
|
|
641
|
+
"Comet-Workspace":
|
|
642
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
643
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
644
|
+
: undefined,
|
|
645
|
+
"X-Fern-Language": "JavaScript",
|
|
646
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
647
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
648
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
649
|
+
...requestOptions?.headers,
|
|
650
|
+
},
|
|
651
|
+
contentType: "application/json",
|
|
652
|
+
requestType: "json",
|
|
653
|
+
body: serializers.DeleteFeedbackScore.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
654
|
+
timeoutMs:
|
|
655
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
656
|
+
maxRetries: requestOptions?.maxRetries,
|
|
657
|
+
withCredentials: true,
|
|
658
|
+
abortSignal: requestOptions?.abortSignal,
|
|
659
|
+
});
|
|
660
|
+
if (_response.ok) {
|
|
661
|
+
return {
|
|
662
|
+
ok: _response.ok,
|
|
663
|
+
body: undefined,
|
|
664
|
+
headers: _response.headers,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
if (_response.error.reason === "status-code") {
|
|
668
|
+
throw new errors.OpikApiError({
|
|
669
|
+
statusCode: _response.error.statusCode,
|
|
670
|
+
body: _response.error.body,
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
switch (_response.error.reason) {
|
|
674
|
+
case "non-json":
|
|
675
|
+
throw new errors.OpikApiError({
|
|
676
|
+
statusCode: _response.error.statusCode,
|
|
677
|
+
body: _response.error.rawBody,
|
|
678
|
+
});
|
|
679
|
+
case "timeout":
|
|
680
|
+
throw new errors.OpikApiTimeoutError(
|
|
681
|
+
"Timeout exceeded when calling POST /v1/private/spans/{id}/feedback-scores/delete."
|
|
682
|
+
);
|
|
683
|
+
case "unknown":
|
|
684
|
+
throw new errors.OpikApiError({
|
|
685
|
+
message: _response.error.errorMessage,
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
})()
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Find Feedback Score names
|
|
694
|
+
*
|
|
695
|
+
* @param {OpikApi.FindFeedbackScoreNames1Request} request
|
|
696
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* await client.spans.findFeedbackScoreNames1()
|
|
700
|
+
*/
|
|
701
|
+
public findFeedbackScoreNames1(
|
|
702
|
+
request: OpikApi.FindFeedbackScoreNames1Request = {},
|
|
703
|
+
requestOptions?: Spans.RequestOptions
|
|
704
|
+
): core.APIPromise<string[]> {
|
|
705
|
+
return core.APIPromise.from(
|
|
706
|
+
(async () => {
|
|
707
|
+
const { projectId, type: type_ } = request;
|
|
708
|
+
const _queryParams: Record<string, string | string[] | object | object[]> = {};
|
|
709
|
+
if (projectId != null) {
|
|
710
|
+
_queryParams["project_id"] = projectId;
|
|
711
|
+
}
|
|
712
|
+
if (type_ != null) {
|
|
713
|
+
_queryParams["type"] = type_;
|
|
714
|
+
}
|
|
715
|
+
const _response = await core.fetcher({
|
|
716
|
+
url: urlJoin(
|
|
717
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
718
|
+
"v1/private/spans/feedback-scores/names"
|
|
719
|
+
),
|
|
720
|
+
method: "GET",
|
|
721
|
+
headers: {
|
|
722
|
+
"Comet-Workspace":
|
|
723
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
724
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
725
|
+
: undefined,
|
|
726
|
+
"X-Fern-Language": "JavaScript",
|
|
727
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
728
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
729
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
730
|
+
...requestOptions?.headers,
|
|
731
|
+
},
|
|
732
|
+
contentType: "application/json",
|
|
733
|
+
queryParameters: _queryParams,
|
|
734
|
+
requestType: "json",
|
|
735
|
+
timeoutMs:
|
|
736
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
737
|
+
maxRetries: requestOptions?.maxRetries,
|
|
738
|
+
withCredentials: true,
|
|
739
|
+
abortSignal: requestOptions?.abortSignal,
|
|
740
|
+
});
|
|
741
|
+
if (_response.ok) {
|
|
742
|
+
return {
|
|
743
|
+
ok: _response.ok,
|
|
744
|
+
body: serializers.spans.findFeedbackScoreNames1.Response.parseOrThrow(_response.body, {
|
|
745
|
+
unrecognizedObjectKeys: "passthrough",
|
|
746
|
+
allowUnrecognizedUnionMembers: true,
|
|
747
|
+
allowUnrecognizedEnumValues: true,
|
|
748
|
+
breadcrumbsPrefix: ["response"],
|
|
749
|
+
}),
|
|
750
|
+
headers: _response.headers,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
if (_response.error.reason === "status-code") {
|
|
754
|
+
throw new errors.OpikApiError({
|
|
755
|
+
statusCode: _response.error.statusCode,
|
|
756
|
+
body: _response.error.body,
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
switch (_response.error.reason) {
|
|
760
|
+
case "non-json":
|
|
761
|
+
throw new errors.OpikApiError({
|
|
762
|
+
statusCode: _response.error.statusCode,
|
|
763
|
+
body: _response.error.rawBody,
|
|
764
|
+
});
|
|
765
|
+
case "timeout":
|
|
766
|
+
throw new errors.OpikApiTimeoutError(
|
|
767
|
+
"Timeout exceeded when calling GET /v1/private/spans/feedback-scores/names."
|
|
768
|
+
);
|
|
769
|
+
case "unknown":
|
|
770
|
+
throw new errors.OpikApiError({
|
|
771
|
+
message: _response.error.errorMessage,
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
})()
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Get span stats
|
|
780
|
+
*
|
|
781
|
+
* @param {OpikApi.GetSpanStatsRequest} request
|
|
782
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* await client.spans.getSpanStats()
|
|
786
|
+
*/
|
|
787
|
+
public getSpanStats(
|
|
788
|
+
request: OpikApi.GetSpanStatsRequest = {},
|
|
789
|
+
requestOptions?: Spans.RequestOptions
|
|
790
|
+
): core.APIPromise<OpikApi.ProjectStatsPublic> {
|
|
791
|
+
return core.APIPromise.from(
|
|
792
|
+
(async () => {
|
|
793
|
+
const { projectId, projectName, traceId, type: type_, filters } = request;
|
|
794
|
+
const _queryParams: Record<string, string | string[] | object | object[]> = {};
|
|
795
|
+
if (projectId != null) {
|
|
796
|
+
_queryParams["project_id"] = projectId;
|
|
797
|
+
}
|
|
798
|
+
if (projectName != null) {
|
|
799
|
+
_queryParams["project_name"] = projectName;
|
|
800
|
+
}
|
|
801
|
+
if (traceId != null) {
|
|
802
|
+
_queryParams["trace_id"] = traceId;
|
|
803
|
+
}
|
|
804
|
+
if (type_ != null) {
|
|
805
|
+
_queryParams["type"] = type_;
|
|
806
|
+
}
|
|
807
|
+
if (filters != null) {
|
|
808
|
+
_queryParams["filters"] = filters;
|
|
809
|
+
}
|
|
810
|
+
const _response = await core.fetcher({
|
|
811
|
+
url: urlJoin(
|
|
812
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
813
|
+
"v1/private/spans/stats"
|
|
814
|
+
),
|
|
815
|
+
method: "GET",
|
|
816
|
+
headers: {
|
|
817
|
+
"Comet-Workspace":
|
|
818
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
819
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
820
|
+
: undefined,
|
|
821
|
+
"X-Fern-Language": "JavaScript",
|
|
822
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
823
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
824
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
825
|
+
...requestOptions?.headers,
|
|
826
|
+
},
|
|
827
|
+
contentType: "application/json",
|
|
828
|
+
queryParameters: _queryParams,
|
|
829
|
+
requestType: "json",
|
|
830
|
+
timeoutMs:
|
|
831
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
832
|
+
maxRetries: requestOptions?.maxRetries,
|
|
833
|
+
withCredentials: true,
|
|
834
|
+
abortSignal: requestOptions?.abortSignal,
|
|
835
|
+
});
|
|
836
|
+
if (_response.ok) {
|
|
837
|
+
return {
|
|
838
|
+
ok: _response.ok,
|
|
839
|
+
body: serializers.ProjectStatsPublic.parseOrThrow(_response.body, {
|
|
840
|
+
unrecognizedObjectKeys: "passthrough",
|
|
841
|
+
allowUnrecognizedUnionMembers: true,
|
|
842
|
+
allowUnrecognizedEnumValues: true,
|
|
843
|
+
breadcrumbsPrefix: ["response"],
|
|
844
|
+
}),
|
|
845
|
+
headers: _response.headers,
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
if (_response.error.reason === "status-code") {
|
|
849
|
+
throw new errors.OpikApiError({
|
|
850
|
+
statusCode: _response.error.statusCode,
|
|
851
|
+
body: _response.error.body,
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
switch (_response.error.reason) {
|
|
855
|
+
case "non-json":
|
|
856
|
+
throw new errors.OpikApiError({
|
|
857
|
+
statusCode: _response.error.statusCode,
|
|
858
|
+
body: _response.error.rawBody,
|
|
859
|
+
});
|
|
860
|
+
case "timeout":
|
|
861
|
+
throw new errors.OpikApiTimeoutError(
|
|
862
|
+
"Timeout exceeded when calling GET /v1/private/spans/stats."
|
|
863
|
+
);
|
|
864
|
+
case "unknown":
|
|
865
|
+
throw new errors.OpikApiError({
|
|
866
|
+
message: _response.error.errorMessage,
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
})()
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Batch feedback scoring for spans
|
|
875
|
+
*
|
|
876
|
+
* @param {OpikApi.FeedbackScoreBatch} request
|
|
877
|
+
* @param {Spans.RequestOptions} requestOptions - Request-specific configuration.
|
|
878
|
+
*
|
|
879
|
+
* @example
|
|
880
|
+
* await client.spans.scoreBatchOfSpans({
|
|
881
|
+
* scores: [{
|
|
882
|
+
* id: "id",
|
|
883
|
+
* name: "name",
|
|
884
|
+
* value: 1.1,
|
|
885
|
+
* source: "ui"
|
|
886
|
+
* }]
|
|
887
|
+
* })
|
|
888
|
+
*/
|
|
889
|
+
public scoreBatchOfSpans(
|
|
890
|
+
request: OpikApi.FeedbackScoreBatch,
|
|
891
|
+
requestOptions?: Spans.RequestOptions
|
|
892
|
+
): core.APIPromise<void> {
|
|
893
|
+
return core.APIPromise.from(
|
|
894
|
+
(async () => {
|
|
895
|
+
const _response = await core.fetcher({
|
|
896
|
+
url: urlJoin(
|
|
897
|
+
(await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default,
|
|
898
|
+
"v1/private/spans/feedback-scores"
|
|
899
|
+
),
|
|
900
|
+
method: "PUT",
|
|
901
|
+
headers: {
|
|
902
|
+
"Comet-Workspace":
|
|
903
|
+
(await core.Supplier.get(this._options.workspaceName)) != null
|
|
904
|
+
? await core.Supplier.get(this._options.workspaceName)
|
|
905
|
+
: undefined,
|
|
906
|
+
"X-Fern-Language": "JavaScript",
|
|
907
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
908
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
909
|
+
...(await this._getCustomAuthorizationHeaders()),
|
|
910
|
+
...requestOptions?.headers,
|
|
911
|
+
},
|
|
912
|
+
contentType: "application/json",
|
|
913
|
+
requestType: "json",
|
|
914
|
+
body: serializers.FeedbackScoreBatch.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
915
|
+
timeoutMs:
|
|
916
|
+
requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
917
|
+
maxRetries: requestOptions?.maxRetries,
|
|
918
|
+
withCredentials: true,
|
|
919
|
+
abortSignal: requestOptions?.abortSignal,
|
|
920
|
+
});
|
|
921
|
+
if (_response.ok) {
|
|
922
|
+
return {
|
|
923
|
+
ok: _response.ok,
|
|
924
|
+
body: undefined,
|
|
925
|
+
headers: _response.headers,
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
if (_response.error.reason === "status-code") {
|
|
929
|
+
throw new errors.OpikApiError({
|
|
930
|
+
statusCode: _response.error.statusCode,
|
|
931
|
+
body: _response.error.body,
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
switch (_response.error.reason) {
|
|
935
|
+
case "non-json":
|
|
936
|
+
throw new errors.OpikApiError({
|
|
937
|
+
statusCode: _response.error.statusCode,
|
|
938
|
+
body: _response.error.rawBody,
|
|
939
|
+
});
|
|
940
|
+
case "timeout":
|
|
941
|
+
throw new errors.OpikApiTimeoutError(
|
|
942
|
+
"Timeout exceeded when calling PUT /v1/private/spans/feedback-scores."
|
|
943
|
+
);
|
|
944
|
+
case "unknown":
|
|
945
|
+
throw new errors.OpikApiError({
|
|
946
|
+
message: _response.error.errorMessage,
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
})()
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
protected async _getCustomAuthorizationHeaders() {
|
|
954
|
+
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
|
|
955
|
+
return { Authorization: apiKeyValue };
|
|
956
|
+
}
|
|
957
|
+
}
|