From 0d7606ca259388a8768ad6c0c3fd908a85f3a86d Mon Sep 17 00:00:00 2001 From: BorisTkachenko <35521895+BorisTkachenko@users.noreply.github.com> Date: Mon, 27 Jan 2025 15:56:52 +0100 Subject: [PATCH] OPIK-844 Autogenerated code (#1146) --- .../documentation/rest_api/opik.yaml | 443 +++++++++++++- .../code_generation/fern/openapi/openapi.yaml | 443 +++++++++++++- sdks/python/src/opik/rest_api/__init__.py | 12 + .../automation_rule_evaluators/client.py | 133 ++++ .../types/provider_api_key_write_provider.py | 2 +- sdks/python/src/opik/rest_api/spans/client.py | 577 ++++++++++++++++- .../python/src/opik/rest_api/traces/client.py | 578 +++++++++++++++++- .../src/opik/rest_api/types/__init__.py | 12 + .../types/automation_rule_evaluator.py | 26 +- ...automation_rule_evaluator_object_public.py | 26 +- .../types/automation_rule_evaluator_public.py | 26 +- .../types/automation_rule_evaluator_write.py | 6 +- .../python/src/opik/rest_api/types/comment.py | 27 + .../opik/rest_api/types/comment_compare.py | 27 + .../src/opik/rest_api/types/comment_public.py | 27 + .../src/opik/rest_api/types/experiment.py | 2 + .../opik/rest_api/types/experiment_item.py | 2 + .../rest_api/types/experiment_item_compare.py | 2 + .../opik/rest_api/types/experiment_public.py | 2 + .../types/feedback_score_batch_item_source.py | 4 +- .../types/feedback_score_compare_source.py | 4 +- .../types/feedback_score_public_source.py | 4 +- .../rest_api/types/feedback_score_source.py | 4 +- .../src/opik/rest_api/types/log_item.py | 27 + .../src/opik/rest_api/types/log_item_level.py | 7 + .../src/opik/rest_api/types/log_page.py | 25 + .../types/provider_api_key_provider.py | 4 +- .../types/provider_api_key_public_provider.py | 2 +- sdks/python/src/opik/rest_api/types/span.py | 2 + .../src/opik/rest_api/types/span_public.py | 2 + sdks/python/src/opik/rest_api/types/trace.py | 2 + .../src/opik/rest_api/types/trace_public.py | 2 + .../automationRuleEvaluators/client/Client.ts | 89 +++ .../requests/GetEvaluatorLogsByIdRequest.ts | 11 + .../client/requests/index.ts | 1 + .../types/ProviderApiKeyWriteProvider.ts | 3 +- .../api/resources/spans/client/Client.ts | 322 ++++++++++ .../api/resources/traces/client/Client.ts | 322 ++++++++++ .../src/opik/rest_api/api/types/Comment.ts | 12 + .../opik/rest_api/api/types/CommentCompare.ts | 12 + .../opik/rest_api/api/types/CommentPublic.ts | 12 + .../src/opik/rest_api/api/types/Experiment.ts | 1 + .../opik/rest_api/api/types/ExperimentItem.ts | 1 + .../api/types/ExperimentItemCompare.ts | 1 + .../rest_api/api/types/ExperimentPublic.ts | 1 + .../api/types/FeedbackScoreBatchItemSource.ts | 3 +- .../api/types/FeedbackScoreCompareSource.ts | 3 +- .../api/types/FeedbackScorePublicSource.ts | 3 +- .../rest_api/api/types/FeedbackScoreSource.ts | 3 +- .../src/opik/rest_api/api/types/LogItem.ts | 13 + .../opik/rest_api/api/types/LogItemLevel.ts | 13 + .../src/opik/rest_api/api/types/LogPage.ts | 12 + .../api/types/ProviderApiKeyProvider.ts | 3 +- .../api/types/ProviderApiKeyPublicProvider.ts | 3 +- .../src/opik/rest_api/api/types/Span.ts | 1 + .../src/opik/rest_api/api/types/SpanPublic.ts | 1 + .../src/opik/rest_api/api/types/Trace.ts | 1 + .../opik/rest_api/api/types/TracePublic.ts | 1 + .../src/opik/rest_api/api/types/index.ts | 6 + .../types/ProviderApiKeyWriteProvider.ts | 4 +- .../types/AutomationRuleEvaluator.ts | 24 +- .../AutomationRuleEvaluatorObjectPublic.ts | 24 +- .../types/AutomationRuleEvaluatorPublic.ts | 24 +- .../types/AutomationRuleEvaluatorWrite.ts | 4 +- .../rest_api/serialization/types/Comment.ts | 28 + .../serialization/types/CommentCompare.ts | 28 + .../serialization/types/CommentPublic.ts | 28 + .../serialization/types/Experiment.ts | 3 + .../serialization/types/ExperimentItem.ts | 3 + .../types/ExperimentItemCompare.ts | 3 + .../serialization/types/ExperimentPublic.ts | 3 + .../types/FeedbackScoreBatchItemSource.ts | 4 +- .../types/FeedbackScoreCompareSource.ts | 4 +- .../types/FeedbackScorePublicSource.ts | 4 +- .../types/FeedbackScoreSource.ts | 4 +- .../rest_api/serialization/types/LogItem.ts | 27 + .../serialization/types/LogItemLevel.ts | 14 + .../rest_api/serialization/types/LogPage.ts | 25 + .../types/ProviderApiKeyProvider.ts | 4 +- .../types/ProviderApiKeyPublicProvider.ts | 4 +- .../opik/rest_api/serialization/types/Span.ts | 3 + .../serialization/types/SpanPublic.ts | 3 + .../rest_api/serialization/types/Trace.ts | 3 + .../serialization/types/TracePublic.ts | 3 + .../rest_api/serialization/types/index.ts | 6 + 85 files changed, 3429 insertions(+), 171 deletions(-) create mode 100644 sdks/python/src/opik/rest_api/types/comment.py create mode 100644 sdks/python/src/opik/rest_api/types/comment_compare.py create mode 100644 sdks/python/src/opik/rest_api/types/comment_public.py create mode 100644 sdks/python/src/opik/rest_api/types/log_item.py create mode 100644 sdks/python/src/opik/rest_api/types/log_item_level.py create mode 100644 sdks/python/src/opik/rest_api/types/log_page.py create mode 100644 sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/GetEvaluatorLogsByIdRequest.ts create mode 100644 sdks/typescript/src/opik/rest_api/api/types/Comment.ts create mode 100644 sdks/typescript/src/opik/rest_api/api/types/CommentCompare.ts create mode 100644 sdks/typescript/src/opik/rest_api/api/types/CommentPublic.ts create mode 100644 sdks/typescript/src/opik/rest_api/api/types/LogItem.ts create mode 100644 sdks/typescript/src/opik/rest_api/api/types/LogItemLevel.ts create mode 100644 sdks/typescript/src/opik/rest_api/api/types/LogPage.ts create mode 100644 sdks/typescript/src/opik/rest_api/serialization/types/Comment.ts create mode 100644 sdks/typescript/src/opik/rest_api/serialization/types/CommentCompare.ts create mode 100644 sdks/typescript/src/opik/rest_api/serialization/types/CommentPublic.ts create mode 100644 sdks/typescript/src/opik/rest_api/serialization/types/LogItem.ts create mode 100644 sdks/typescript/src/opik/rest_api/serialization/types/LogItemLevel.ts create mode 100644 sdks/typescript/src/opik/rest_api/serialization/types/LogPage.ts diff --git a/apps/opik-documentation/documentation/rest_api/opik.yaml b/apps/opik-documentation/documentation/rest_api/opik.yaml index a3a536036c..f41972236a 100644 --- a/apps/opik-documentation/documentation/rest_api/opik.yaml +++ b/apps/opik-documentation/documentation/rest_api/opik.yaml @@ -286,6 +286,40 @@ paths: responses: "204": description: No content + /v1/private/automations/projects/{projectId}/evaluators/{id}/logs: + get: + tags: + - Automation rule evaluators + summary: Get automation rule evaluator logs by id + description: Get automation rule evaluator logs by id + operationId: getEvaluatorLogsById + parameters: + - name: projectId + in: path + required: true + schema: + type: string + format: uuid + - name: id + in: path + required: true + schema: + type: string + format: uuid + - name: size + in: query + schema: + minimum: 1 + type: integer + format: int32 + default: 1000 + responses: + "200": + description: Automation rule evaluator logs resource + content: + application/json: + schema: + $ref: '#/components/schemas/LogPage' /v1/private/chat/completions: post: tags: @@ -1743,6 +1777,35 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorMessage_Detail' + /v1/private/spans/{id}/comments: + post: + tags: + - Spans + summary: Add span comment + description: Add span comment + operationId: addSpanComment + parameters: + - name: id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "201": + description: Created + headers: + Location: + required: true + style: simple + schema: + type: string + example: "${basePath}/v1/private/spans/{spanId}/comments/{commentId}" /v1/private/spans/{id}/feedback-scores: put: tags: @@ -1930,6 +1993,21 @@ paths: description: No Content "404": description: Not found + /v1/private/spans/comments/delete: + post: + tags: + - Spans + summary: Delete span comments + description: Delete span comments + operationId: deleteSpanComments + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDelete' + responses: + "204": + description: No Content /v1/private/spans/{id}/feedback-scores/delete: post: tags: @@ -1982,6 +2060,39 @@ paths: type: array items: type: string + /v1/private/spans/{spanId}/comments/{commentId}: + get: + tags: + - Spans + summary: Get span comment + description: Get span comment + operationId: getSpanComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + - name: spanId + in: path + required: true + schema: + type: string + format: uuid + responses: + "200": + description: Comment resource + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + "404": + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' /v1/private/spans/stats: get: tags: @@ -2038,6 +2149,59 @@ paths: responses: "204": description: No Content + /v1/private/spans/comments/{commentId}: + patch: + tags: + - Spans + summary: Update span comment by id + description: Update span comment by id + operationId: updateSpanComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "204": + description: No Content + "404": + description: Not found + /v1/private/traces/{id}/comments: + post: + tags: + - Traces + summary: Add trace comment + description: Add trace comment + operationId: addTraceComment + parameters: + - name: id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "201": + description: Created + headers: + Location: + required: true + style: simple + schema: + type: string + example: "${basePath}/v1/private/traces/{traceId}/comments/{commentId}" /v1/private/traces/{id}/feedback-scores: put: tags: @@ -2201,6 +2365,21 @@ paths: responses: "204": description: No Content + /v1/private/traces/comments/delete: + post: + tags: + - Traces + summary: Delete trace comments + description: Delete trace comments + operationId: deleteTraceComments + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDelete' + responses: + "204": + description: No Content /v1/private/traces/{id}/feedback-scores/delete: post: tags: @@ -2288,6 +2467,39 @@ paths: application/json: schema: $ref: '#/components/schemas/ProjectStats_Public' + /v1/private/traces/{traceId}/comments/{commentId}: + get: + tags: + - Traces + summary: Get trace comment + description: Get trace comment + operationId: getTraceComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + - name: traceId + in: path + required: true + schema: + type: string + format: uuid + responses: + "200": + description: Comment resource + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + "404": + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' /v1/private/traces/feedback-scores: put: tags: @@ -2303,6 +2515,30 @@ paths: responses: "204": description: No Content + /v1/private/traces/comments/{commentId}: + patch: + tags: + - Traces + summary: Update trace comment by id + description: Update trace comment by id + operationId: updateTraceComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "204": + description: No Content + "404": + description: Not found /is-alive/ping: get: operationId: isAlive @@ -2375,27 +2611,27 @@ components: type: string format: uuid readOnly: true - projectId: + project_id: type: string format: uuid readOnly: true name: type: string - samplingRate: + sampling_rate: type: number format: float - createdAt: + created_at: type: string format: date-time readOnly: true - createdBy: + created_by: type: string readOnly: true - lastUpdatedAt: + last_updated_at: type: string format: date-time readOnly: true - lastUpdatedBy: + last_updated_by: type: string readOnly: true type: @@ -2507,7 +2743,7 @@ components: properties: name: type: string - samplingRate: + sampling_rate: type: number format: float type: @@ -2622,27 +2858,27 @@ components: type: string format: uuid readOnly: true - projectId: + project_id: type: string format: uuid readOnly: true name: type: string - samplingRate: + sampling_rate: type: number format: float - createdAt: + created_at: type: string format: date-time readOnly: true - createdBy: + created_by: type: string readOnly: true - lastUpdatedAt: + last_updated_at: type: string format: date-time readOnly: true - lastUpdatedBy: + last_updated_by: type: string readOnly: true type: @@ -2748,27 +2984,27 @@ components: type: string format: uuid readOnly: true - projectId: + project_id: type: string format: uuid readOnly: true name: type: string - samplingRate: + sampling_rate: type: number format: float - createdAt: + created_at: type: string format: date-time readOnly: true - createdBy: + created_by: type: string readOnly: true - lastUpdatedAt: + last_updated_at: type: string format: date-time readOnly: true - lastUpdatedBy: + last_updated_by: type: string readOnly: true type: @@ -2783,6 +3019,51 @@ components: propertyName: type mapping: llm_as_judge: '#/components/schemas/AutomationRuleEvaluatorLlmAsJudge_Public' + LogItem: + type: object + properties: + timestamp: + type: string + format: date-time + readOnly: true + rule_id: + type: string + format: uuid + readOnly: true + level: + type: string + readOnly: true + enum: + - INFO + - WARN + - ERROR + - DEBUG + - TRACE + message: + type: string + readOnly: true + markers: + type: object + additionalProperties: + type: string + readOnly: true + readOnly: true + LogPage: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/LogItem' + page: + type: integer + format: int32 + size: + type: integer + format: int32 + total: + type: integer + format: int64 AutomationRuleEvaluatorUpdate: required: - code @@ -3103,6 +3384,31 @@ components: description: pattern: (?s)^\s*(\S.*\S|\S)\s*$ type: string + Comment: + required: + - text + type: object + properties: + id: + type: string + format: uuid + readOnly: true + text: + type: string + created_at: + type: string + format: date-time + readOnly: true + last_updated_at: + type: string + format: date-time + readOnly: true + created_by: + type: string + readOnly: true + last_updated_by: + type: string + readOnly: true DatasetItem: required: - data @@ -3193,6 +3499,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' created_at: type: string format: date-time @@ -3231,6 +3542,7 @@ components: enum: - ui - sdk + - online_scoring created_at: type: string format: date-time @@ -3333,6 +3645,32 @@ components: type: string description: The field to use for filtering readOnly: true + Comment_Compare: + required: + - text + type: object + properties: + id: + type: string + format: uuid + readOnly: true + text: + type: string + created_at: + type: string + format: date-time + readOnly: true + last_updated_at: + type: string + format: date-time + readOnly: true + created_by: + type: string + readOnly: true + last_updated_by: + type: string + readOnly: true + readOnly: true DatasetItemPage_Compare: type: object properties: @@ -3425,6 +3763,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore_Compare' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Compare' created_at: type: string format: date-time @@ -3464,6 +3807,7 @@ components: enum: - ui - sdk + - online_scoring created_at: type: string format: date-time @@ -3754,6 +4098,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScoreAverage' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' trace_count: type: integer format: int64 @@ -3864,6 +4213,32 @@ components: items: type: string format: uuid + Comment_Public: + required: + - text + type: object + properties: + id: + type: string + format: uuid + readOnly: true + text: + type: string + created_at: + type: string + format: date-time + readOnly: true + last_updated_at: + type: string + format: date-time + readOnly: true + created_by: + type: string + readOnly: true + last_updated_by: + type: string + readOnly: true + readOnly: true ExperimentPage_Public: type: object properties: @@ -3903,6 +4278,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScoreAverage_Public' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Public' trace_count: type: integer format: int64 @@ -4417,6 +4797,7 @@ components: enum: - openai - anthropic + - gemini api_key: type: string name: @@ -4452,6 +4833,7 @@ components: enum: - openai - anthropic + - gemini api_key: type: string name: @@ -4483,6 +4865,7 @@ components: enum: - openai - anthropic + - gemini api_key: type: string name: @@ -5116,6 +5499,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' total_estimated_cost: minimum: 0.0 exclusiveMinimum: false @@ -5268,6 +5656,7 @@ components: enum: - ui - sdk + - online_scoring created_at: type: string format: date-time @@ -5359,6 +5748,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore_Public' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Public' total_estimated_cost: minimum: 0.0 exclusiveMinimum: false @@ -5480,6 +5874,7 @@ components: enum: - ui - sdk + - online_scoring SpanUpdate: required: - trace_id @@ -5593,6 +5988,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' total_estimated_cost: type: number readOnly: true @@ -5718,6 +6118,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore_Public' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Public' total_estimated_cost: type: number readOnly: true diff --git a/sdks/code_generation/fern/openapi/openapi.yaml b/sdks/code_generation/fern/openapi/openapi.yaml index a3a536036c..f41972236a 100644 --- a/sdks/code_generation/fern/openapi/openapi.yaml +++ b/sdks/code_generation/fern/openapi/openapi.yaml @@ -286,6 +286,40 @@ paths: responses: "204": description: No content + /v1/private/automations/projects/{projectId}/evaluators/{id}/logs: + get: + tags: + - Automation rule evaluators + summary: Get automation rule evaluator logs by id + description: Get automation rule evaluator logs by id + operationId: getEvaluatorLogsById + parameters: + - name: projectId + in: path + required: true + schema: + type: string + format: uuid + - name: id + in: path + required: true + schema: + type: string + format: uuid + - name: size + in: query + schema: + minimum: 1 + type: integer + format: int32 + default: 1000 + responses: + "200": + description: Automation rule evaluator logs resource + content: + application/json: + schema: + $ref: '#/components/schemas/LogPage' /v1/private/chat/completions: post: tags: @@ -1743,6 +1777,35 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorMessage_Detail' + /v1/private/spans/{id}/comments: + post: + tags: + - Spans + summary: Add span comment + description: Add span comment + operationId: addSpanComment + parameters: + - name: id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "201": + description: Created + headers: + Location: + required: true + style: simple + schema: + type: string + example: "${basePath}/v1/private/spans/{spanId}/comments/{commentId}" /v1/private/spans/{id}/feedback-scores: put: tags: @@ -1930,6 +1993,21 @@ paths: description: No Content "404": description: Not found + /v1/private/spans/comments/delete: + post: + tags: + - Spans + summary: Delete span comments + description: Delete span comments + operationId: deleteSpanComments + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDelete' + responses: + "204": + description: No Content /v1/private/spans/{id}/feedback-scores/delete: post: tags: @@ -1982,6 +2060,39 @@ paths: type: array items: type: string + /v1/private/spans/{spanId}/comments/{commentId}: + get: + tags: + - Spans + summary: Get span comment + description: Get span comment + operationId: getSpanComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + - name: spanId + in: path + required: true + schema: + type: string + format: uuid + responses: + "200": + description: Comment resource + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + "404": + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' /v1/private/spans/stats: get: tags: @@ -2038,6 +2149,59 @@ paths: responses: "204": description: No Content + /v1/private/spans/comments/{commentId}: + patch: + tags: + - Spans + summary: Update span comment by id + description: Update span comment by id + operationId: updateSpanComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "204": + description: No Content + "404": + description: Not found + /v1/private/traces/{id}/comments: + post: + tags: + - Traces + summary: Add trace comment + description: Add trace comment + operationId: addTraceComment + parameters: + - name: id + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "201": + description: Created + headers: + Location: + required: true + style: simple + schema: + type: string + example: "${basePath}/v1/private/traces/{traceId}/comments/{commentId}" /v1/private/traces/{id}/feedback-scores: put: tags: @@ -2201,6 +2365,21 @@ paths: responses: "204": description: No Content + /v1/private/traces/comments/delete: + post: + tags: + - Traces + summary: Delete trace comments + description: Delete trace comments + operationId: deleteTraceComments + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BatchDelete' + responses: + "204": + description: No Content /v1/private/traces/{id}/feedback-scores/delete: post: tags: @@ -2288,6 +2467,39 @@ paths: application/json: schema: $ref: '#/components/schemas/ProjectStats_Public' + /v1/private/traces/{traceId}/comments/{commentId}: + get: + tags: + - Traces + summary: Get trace comment + description: Get trace comment + operationId: getTraceComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + - name: traceId + in: path + required: true + schema: + type: string + format: uuid + responses: + "200": + description: Comment resource + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + "404": + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' /v1/private/traces/feedback-scores: put: tags: @@ -2303,6 +2515,30 @@ paths: responses: "204": description: No Content + /v1/private/traces/comments/{commentId}: + patch: + tags: + - Traces + summary: Update trace comment by id + description: Update trace comment by id + operationId: updateTraceComment + parameters: + - name: commentId + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Comment' + responses: + "204": + description: No Content + "404": + description: Not found /is-alive/ping: get: operationId: isAlive @@ -2375,27 +2611,27 @@ components: type: string format: uuid readOnly: true - projectId: + project_id: type: string format: uuid readOnly: true name: type: string - samplingRate: + sampling_rate: type: number format: float - createdAt: + created_at: type: string format: date-time readOnly: true - createdBy: + created_by: type: string readOnly: true - lastUpdatedAt: + last_updated_at: type: string format: date-time readOnly: true - lastUpdatedBy: + last_updated_by: type: string readOnly: true type: @@ -2507,7 +2743,7 @@ components: properties: name: type: string - samplingRate: + sampling_rate: type: number format: float type: @@ -2622,27 +2858,27 @@ components: type: string format: uuid readOnly: true - projectId: + project_id: type: string format: uuid readOnly: true name: type: string - samplingRate: + sampling_rate: type: number format: float - createdAt: + created_at: type: string format: date-time readOnly: true - createdBy: + created_by: type: string readOnly: true - lastUpdatedAt: + last_updated_at: type: string format: date-time readOnly: true - lastUpdatedBy: + last_updated_by: type: string readOnly: true type: @@ -2748,27 +2984,27 @@ components: type: string format: uuid readOnly: true - projectId: + project_id: type: string format: uuid readOnly: true name: type: string - samplingRate: + sampling_rate: type: number format: float - createdAt: + created_at: type: string format: date-time readOnly: true - createdBy: + created_by: type: string readOnly: true - lastUpdatedAt: + last_updated_at: type: string format: date-time readOnly: true - lastUpdatedBy: + last_updated_by: type: string readOnly: true type: @@ -2783,6 +3019,51 @@ components: propertyName: type mapping: llm_as_judge: '#/components/schemas/AutomationRuleEvaluatorLlmAsJudge_Public' + LogItem: + type: object + properties: + timestamp: + type: string + format: date-time + readOnly: true + rule_id: + type: string + format: uuid + readOnly: true + level: + type: string + readOnly: true + enum: + - INFO + - WARN + - ERROR + - DEBUG + - TRACE + message: + type: string + readOnly: true + markers: + type: object + additionalProperties: + type: string + readOnly: true + readOnly: true + LogPage: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/LogItem' + page: + type: integer + format: int32 + size: + type: integer + format: int32 + total: + type: integer + format: int64 AutomationRuleEvaluatorUpdate: required: - code @@ -3103,6 +3384,31 @@ components: description: pattern: (?s)^\s*(\S.*\S|\S)\s*$ type: string + Comment: + required: + - text + type: object + properties: + id: + type: string + format: uuid + readOnly: true + text: + type: string + created_at: + type: string + format: date-time + readOnly: true + last_updated_at: + type: string + format: date-time + readOnly: true + created_by: + type: string + readOnly: true + last_updated_by: + type: string + readOnly: true DatasetItem: required: - data @@ -3193,6 +3499,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' created_at: type: string format: date-time @@ -3231,6 +3542,7 @@ components: enum: - ui - sdk + - online_scoring created_at: type: string format: date-time @@ -3333,6 +3645,32 @@ components: type: string description: The field to use for filtering readOnly: true + Comment_Compare: + required: + - text + type: object + properties: + id: + type: string + format: uuid + readOnly: true + text: + type: string + created_at: + type: string + format: date-time + readOnly: true + last_updated_at: + type: string + format: date-time + readOnly: true + created_by: + type: string + readOnly: true + last_updated_by: + type: string + readOnly: true + readOnly: true DatasetItemPage_Compare: type: object properties: @@ -3425,6 +3763,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore_Compare' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Compare' created_at: type: string format: date-time @@ -3464,6 +3807,7 @@ components: enum: - ui - sdk + - online_scoring created_at: type: string format: date-time @@ -3754,6 +4098,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScoreAverage' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' trace_count: type: integer format: int64 @@ -3864,6 +4213,32 @@ components: items: type: string format: uuid + Comment_Public: + required: + - text + type: object + properties: + id: + type: string + format: uuid + readOnly: true + text: + type: string + created_at: + type: string + format: date-time + readOnly: true + last_updated_at: + type: string + format: date-time + readOnly: true + created_by: + type: string + readOnly: true + last_updated_by: + type: string + readOnly: true + readOnly: true ExperimentPage_Public: type: object properties: @@ -3903,6 +4278,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScoreAverage_Public' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Public' trace_count: type: integer format: int64 @@ -4417,6 +4797,7 @@ components: enum: - openai - anthropic + - gemini api_key: type: string name: @@ -4452,6 +4833,7 @@ components: enum: - openai - anthropic + - gemini api_key: type: string name: @@ -4483,6 +4865,7 @@ components: enum: - openai - anthropic + - gemini api_key: type: string name: @@ -5116,6 +5499,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' total_estimated_cost: minimum: 0.0 exclusiveMinimum: false @@ -5268,6 +5656,7 @@ components: enum: - ui - sdk + - online_scoring created_at: type: string format: date-time @@ -5359,6 +5748,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore_Public' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Public' total_estimated_cost: minimum: 0.0 exclusiveMinimum: false @@ -5480,6 +5874,7 @@ components: enum: - ui - sdk + - online_scoring SpanUpdate: required: - trace_id @@ -5593,6 +5988,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment' total_estimated_cost: type: number readOnly: true @@ -5718,6 +6118,11 @@ components: readOnly: true items: $ref: '#/components/schemas/FeedbackScore_Public' + comments: + type: array + readOnly: true + items: + $ref: '#/components/schemas/Comment_Public' total_estimated_cost: type: number readOnly: true diff --git a/sdks/python/src/opik/rest_api/__init__.py b/sdks/python/src/opik/rest_api/__init__.py index 7922429543..78cd20bad1 100644 --- a/sdks/python/src/opik/rest_api/__init__.py +++ b/sdks/python/src/opik/rest_api/__init__.py @@ -38,6 +38,9 @@ ColumnPublic, ColumnPublicTypesItem, ColumnTypesItem, + Comment, + CommentCompare, + CommentPublic, CompletionTokensDetails, CountValueStatPublic, DataPointNumberPublic, @@ -126,6 +129,9 @@ LlmAsJudgeOutputSchemaType, LlmAsJudgeOutputSchemaWrite, LlmAsJudgeOutputSchemaWriteType, + LogItem, + LogItemLevel, + LogPage, Message, NumericalFeedbackDefinition, NumericalFeedbackDefinitionCreate, @@ -266,6 +272,9 @@ "ColumnPublic", "ColumnPublicTypesItem", "ColumnTypesItem", + "Comment", + "CommentCompare", + "CommentPublic", "CompletionTokensDetails", "ConflictError", "CountValueStatPublic", @@ -360,6 +369,9 @@ "LlmAsJudgeOutputSchemaType", "LlmAsJudgeOutputSchemaWrite", "LlmAsJudgeOutputSchemaWriteType", + "LogItem", + "LogItemLevel", + "LogPage", "Message", "NotFoundError", "NotImplementedError", diff --git a/sdks/python/src/opik/rest_api/automation_rule_evaluators/client.py b/sdks/python/src/opik/rest_api/automation_rule_evaluators/client.py index 17dd68f3d0..01467006b8 100644 --- a/sdks/python/src/opik/rest_api/automation_rule_evaluators/client.py +++ b/sdks/python/src/opik/rest_api/automation_rule_evaluators/client.py @@ -14,6 +14,7 @@ from ..core.serialization import convert_and_respect_annotation_metadata from ..types.automation_rule_evaluator_public import AutomationRuleEvaluatorPublic from ..types.llm_as_judge_code import LlmAsJudgeCode +from ..types.log_page import LogPage from ..core.client_wrapper import AsyncClientWrapper # this is used as the default value for optional parameters @@ -351,6 +352,68 @@ def update_automation_rule_evaluator( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def get_evaluator_logs_by_id( + self, + project_id: str, + id: str, + *, + size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> LogPage: + """ + Get automation rule evaluator logs by id + + Parameters + ---------- + project_id : str + + id : str + + size : typing.Optional[int] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LogPage + Automation rule evaluator logs resource + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.automation_rule_evaluators.get_evaluator_logs_by_id( + project_id="projectId", + id="id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/automations/projects/{jsonable_encoder(project_id)}/evaluators/{jsonable_encoder(id)}/logs", + method="GET", + params={ + "size": size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + LogPage, + parse_obj_as( + type_=LogPage, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncAutomationRuleEvaluatorsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -722,3 +785,73 @@ async def main() -> None: except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_evaluator_logs_by_id( + self, + project_id: str, + id: str, + *, + size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> LogPage: + """ + Get automation rule evaluator logs by id + + Parameters + ---------- + project_id : str + + id : str + + size : typing.Optional[int] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LogPage + Automation rule evaluator logs resource + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.automation_rule_evaluators.get_evaluator_logs_by_id( + project_id="projectId", + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/automations/projects/{jsonable_encoder(project_id)}/evaluators/{jsonable_encoder(id)}/logs", + method="GET", + params={ + "size": size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + LogPage, + parse_obj_as( + type_=LogPage, # type: ignore + object_=_response.json(), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/sdks/python/src/opik/rest_api/llm_provider_key/types/provider_api_key_write_provider.py b/sdks/python/src/opik/rest_api/llm_provider_key/types/provider_api_key_write_provider.py index c4d407d0d7..7dc3b010eb 100644 --- a/sdks/python/src/opik/rest_api/llm_provider_key/types/provider_api_key_write_provider.py +++ b/sdks/python/src/opik/rest_api/llm_provider_key/types/provider_api_key_write_provider.py @@ -3,5 +3,5 @@ import typing ProviderApiKeyWriteProvider = typing.Union[ - typing.Literal["openai", "anthropic"], typing.Any + typing.Literal["openai", "anthropic", "gemini"], typing.Any ] diff --git a/sdks/python/src/opik/rest_api/spans/client.py b/sdks/python/src/opik/rest_api/spans/client.py index f3f21f2bcd..3612d075f3 100644 --- a/sdks/python/src/opik/rest_api/spans/client.py +++ b/sdks/python/src/opik/rest_api/spans/client.py @@ -2,12 +2,12 @@ import typing from ..core.client_wrapper import SyncClientWrapper -from ..types.feedback_score_source import FeedbackScoreSource import datetime as dt from ..core.request_options import RequestOptions from ..core.jsonable_encoder import jsonable_encoder from json.decoder import JSONDecodeError from ..core.api_error import ApiError +from ..types.feedback_score_source import FeedbackScoreSource from .types.get_spans_by_project_request_type import GetSpansByProjectRequestType from ..types.span_page_public import SpanPagePublic from ..core.pydantic_utilities import parse_obj_as @@ -24,6 +24,7 @@ from .types.find_feedback_score_names_1_request_type import ( FindFeedbackScoreNames1RequestType, ) +from ..types.comment import Comment from .types.get_span_stats_request_type import GetSpanStatsRequestType from ..types.project_stats_public import ProjectStatsPublic from ..types.feedback_score_batch_item import FeedbackScoreBatchItem @@ -37,6 +38,79 @@ class SpansClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper + def add_span_comment( + self, + id_: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Add span comment + + Parameters + ---------- + id_ : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.spans.add_span_comment( + id_="id", + text="text", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/spans/{jsonable_encoder(id_)}/comments", + method="POST", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def add_span_feedback_score( self, id: str, @@ -632,6 +706,55 @@ def update_span( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def delete_span_comments( + self, + *, + ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete span comments + + Parameters + ---------- + ids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.spans.delete_span_comments( + ids=["ids"], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/private/spans/comments/delete", + method="POST", + json={ + "ids": ids, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def delete_span_feedback_score( self, id: str, @@ -742,6 +865,72 @@ def find_feedback_score_names_1( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def get_span_comment( + self, + comment_id: str, + span_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> Comment: + """ + Get span comment + + Parameters + ---------- + comment_id : str + + span_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Comment + Comment resource + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.spans.get_span_comment( + comment_id="commentId", + span_id="spanId", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/spans/{jsonable_encoder(span_id)}/comments/{jsonable_encoder(comment_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Comment, + parse_obj_as( + type_=Comment, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def get_span_stats( self, *, @@ -871,11 +1060,175 @@ def score_batch_of_spans( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def update_span_comment( + self, + comment_id: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Update span comment by id + + Parameters + ---------- + comment_id : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.spans.update_span_comment( + comment_id="commentId", + text="text", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/spans/comments/{jsonable_encoder(comment_id)}", + method="PATCH", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncSpansClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper + async def add_span_comment( + self, + id_: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Add span comment + + Parameters + ---------- + id_ : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.spans.add_span_comment( + id_="id", + text="text", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/spans/{jsonable_encoder(id_)}/comments", + method="POST", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def add_span_feedback_score( self, id: str, @@ -1525,6 +1878,63 @@ async def main() -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def delete_span_comments( + self, + *, + ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete span comments + + Parameters + ---------- + ids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.spans.delete_span_comments( + ids=["ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/private/spans/comments/delete", + method="POST", + json={ + "ids": ids, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def delete_span_feedback_score( self, id: str, @@ -1651,6 +2061,80 @@ async def main() -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def get_span_comment( + self, + comment_id: str, + span_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> Comment: + """ + Get span comment + + Parameters + ---------- + comment_id : str + + span_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Comment + Comment resource + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.spans.get_span_comment( + comment_id="commentId", + span_id="spanId", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/spans/{jsonable_encoder(span_id)}/comments/{jsonable_encoder(comment_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Comment, + parse_obj_as( + type_=Comment, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def get_span_stats( self, *, @@ -1795,3 +2279,94 @@ async def main() -> None: except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_span_comment( + self, + comment_id: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Update span comment by id + + Parameters + ---------- + comment_id : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.spans.update_span_comment( + comment_id="commentId", + text="text", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/spans/comments/{jsonable_encoder(comment_id)}", + method="PATCH", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/sdks/python/src/opik/rest_api/traces/client.py b/sdks/python/src/opik/rest_api/traces/client.py index 9e89065057..9d27f921cd 100644 --- a/sdks/python/src/opik/rest_api/traces/client.py +++ b/sdks/python/src/opik/rest_api/traces/client.py @@ -2,12 +2,12 @@ import typing from ..core.client_wrapper import SyncClientWrapper -from ..types.feedback_score_source import FeedbackScoreSource import datetime as dt from ..core.request_options import RequestOptions from ..core.jsonable_encoder import jsonable_encoder from json.decoder import JSONDecodeError from ..core.api_error import ApiError +from ..types.feedback_score_source import FeedbackScoreSource from ..types.trace_page_public import TracePagePublic from ..core.pydantic_utilities import parse_obj_as from ..types.json_node_write import JsonNodeWrite @@ -18,6 +18,8 @@ from ..types.json_node import JsonNode from ..types.error_info import ErrorInfo from ..types.project_stats_public import ProjectStatsPublic +from ..types.comment import Comment +from ..errors.not_found_error import NotFoundError from ..types.feedback_score_batch_item import FeedbackScoreBatchItem from ..core.client_wrapper import AsyncClientWrapper @@ -29,6 +31,79 @@ class TracesClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper + def add_trace_comment( + self, + id_: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Add trace comment + + Parameters + ---------- + id_ : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.traces.add_trace_comment( + id_="id", + text="text", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/traces/{jsonable_encoder(id_)}/comments", + method="POST", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def add_trace_feedback_score( self, id: str, @@ -525,6 +600,55 @@ def update_trace( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def delete_trace_comments( + self, + *, + ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete trace comments + + Parameters + ---------- + ids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.traces.delete_trace_comments( + ids=["ids"], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "v1/private/traces/comments/delete", + method="POST", + json={ + "ids": ids, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def delete_trace_feedback_score( self, id: str, @@ -741,6 +865,72 @@ def get_trace_stats( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def get_trace_comment( + self, + comment_id: str, + trace_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> Comment: + """ + Get trace comment + + Parameters + ---------- + comment_id : str + + trace_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Comment + Comment resource + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.traces.get_trace_comment( + comment_id="commentId", + trace_id="traceId", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/traces/{jsonable_encoder(trace_id)}/comments/{jsonable_encoder(comment_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Comment, + parse_obj_as( + type_=Comment, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def score_batch_of_traces( self, *, @@ -801,11 +991,175 @@ def score_batch_of_traces( raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def update_trace_comment( + self, + comment_id: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Update trace comment by id + + Parameters + ---------- + comment_id : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from Opik import OpikApi + + client = OpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + client.traces.update_trace_comment( + comment_id="commentId", + text="text", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/private/traces/comments/{jsonable_encoder(comment_id)}", + method="PATCH", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncTracesClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper + async def add_trace_comment( + self, + id_: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Add trace comment + + Parameters + ---------- + id_ : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.traces.add_trace_comment( + id_="id", + text="text", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/traces/{jsonable_encoder(id_)}/comments", + method="POST", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def add_trace_feedback_score( self, id: str, @@ -1356,6 +1710,63 @@ async def main() -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def delete_trace_comments( + self, + *, + ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete trace comments + + Parameters + ---------- + ids : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.traces.delete_trace_comments( + ids=["ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/private/traces/comments/delete", + method="POST", + json={ + "ids": ids, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def delete_trace_feedback_score( self, id: str, @@ -1604,6 +2015,80 @@ async def main() -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def get_trace_comment( + self, + comment_id: str, + trace_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> Comment: + """ + Get trace comment + + Parameters + ---------- + comment_id : str + + trace_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Comment + Comment resource + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.traces.get_trace_comment( + comment_id="commentId", + trace_id="traceId", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/traces/{jsonable_encoder(trace_id)}/comments/{jsonable_encoder(comment_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast( + Comment, + parse_obj_as( + type_=Comment, # type: ignore + object_=_response.json(), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def score_batch_of_traces( self, *, @@ -1671,3 +2156,94 @@ async def main() -> None: except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_trace_comment( + self, + comment_id: str, + *, + text: str, + id: typing.Optional[str] = OMIT, + created_at: typing.Optional[dt.datetime] = OMIT, + last_updated_at: typing.Optional[dt.datetime] = OMIT, + created_by: typing.Optional[str] = OMIT, + last_updated_by: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Update trace comment by id + + Parameters + ---------- + comment_id : str + + text : str + + id : typing.Optional[str] + + created_at : typing.Optional[dt.datetime] + + last_updated_at : typing.Optional[dt.datetime] + + created_by : typing.Optional[str] + + last_updated_by : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from Opik import AsyncOpikApi + + client = AsyncOpikApi( + api_key="YOUR_API_KEY", + workspace_name="YOUR_WORKSPACE_NAME", + ) + + + async def main() -> None: + await client.traces.update_trace_comment( + comment_id="commentId", + text="text", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/private/traces/comments/{jsonable_encoder(comment_id)}", + method="PATCH", + json={ + "id": id, + "text": text, + "created_at": created_at, + "last_updated_at": last_updated_at, + "created_by": created_by, + "last_updated_by": last_updated_by, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + if _response.status_code == 404: + raise NotFoundError( + typing.cast( + typing.Optional[typing.Any], + parse_obj_as( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/sdks/python/src/opik/rest_api/types/__init__.py b/sdks/python/src/opik/rest_api/types/__init__.py index 24b5948ed9..91cf76b51e 100644 --- a/sdks/python/src/opik/rest_api/types/__init__.py +++ b/sdks/python/src/opik/rest_api/types/__init__.py @@ -49,6 +49,9 @@ from .column_public import ColumnPublic from .column_public_types_item import ColumnPublicTypesItem from .column_types_item import ColumnTypesItem +from .comment import Comment +from .comment_compare import CommentCompare +from .comment_public import CommentPublic from .completion_tokens_details import CompletionTokensDetails from .count_value_stat_public import CountValueStatPublic from .data_point_number_public import DataPointNumberPublic @@ -143,6 +146,9 @@ from .llm_as_judge_output_schema_type import LlmAsJudgeOutputSchemaType from .llm_as_judge_output_schema_write import LlmAsJudgeOutputSchemaWrite from .llm_as_judge_output_schema_write_type import LlmAsJudgeOutputSchemaWriteType +from .log_item import LogItem +from .log_item_level import LogItemLevel +from .log_page import LogPage from .message import Message from .numerical_feedback_definition import NumericalFeedbackDefinition from .numerical_feedback_definition_create import NumericalFeedbackDefinitionCreate @@ -248,6 +254,9 @@ "ColumnPublic", "ColumnPublicTypesItem", "ColumnTypesItem", + "Comment", + "CommentCompare", + "CommentPublic", "CompletionTokensDetails", "CountValueStatPublic", "DataPointNumberPublic", @@ -336,6 +345,9 @@ "LlmAsJudgeOutputSchemaType", "LlmAsJudgeOutputSchemaWrite", "LlmAsJudgeOutputSchemaWriteType", + "LogItem", + "LogItemLevel", + "LogPage", "Message", "NumericalFeedbackDefinition", "NumericalFeedbackDefinitionCreate", diff --git a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator.py b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator.py index dcaa2b4c67..1622048594 100644 --- a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator.py +++ b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator.py @@ -3,8 +3,6 @@ from __future__ import annotations from ..core.pydantic_utilities import UniversalBaseModel import typing -import typing_extensions -from ..core.serialization import FieldMetadata import datetime as dt from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic @@ -13,25 +11,13 @@ class Base(UniversalBaseModel): id: typing.Optional[str] = None - project_id: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="projectId") - ] = None + project_id: typing.Optional[str] = None name: str - sampling_rate: typing_extensions.Annotated[ - typing.Optional[float], FieldMetadata(alias="samplingRate") - ] = None - created_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="createdAt") - ] = None - created_by: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="createdBy") - ] = None - last_updated_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="lastUpdatedAt") - ] = None - last_updated_by: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="lastUpdatedBy") - ] = None + sampling_rate: typing.Optional[float] = None + created_at: typing.Optional[dt.datetime] = None + created_by: typing.Optional[str] = None + last_updated_at: typing.Optional[dt.datetime] = None + last_updated_by: typing.Optional[str] = None action: typing.Optional[typing.Literal["evaluator"]] = None if IS_PYDANTIC_V2: diff --git a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_object_public.py b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_object_public.py index 96eb0ced24..968640132b 100644 --- a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_object_public.py +++ b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_object_public.py @@ -3,8 +3,6 @@ from __future__ import annotations from ..core.pydantic_utilities import UniversalBaseModel import typing -import typing_extensions -from ..core.serialization import FieldMetadata import datetime as dt from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic @@ -13,25 +11,13 @@ class Base(UniversalBaseModel): id: typing.Optional[str] = None - project_id: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="projectId") - ] = None + project_id: typing.Optional[str] = None name: str - sampling_rate: typing_extensions.Annotated[ - typing.Optional[float], FieldMetadata(alias="samplingRate") - ] = None - created_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="createdAt") - ] = None - created_by: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="createdBy") - ] = None - last_updated_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="lastUpdatedAt") - ] = None - last_updated_by: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="lastUpdatedBy") - ] = None + sampling_rate: typing.Optional[float] = None + created_at: typing.Optional[dt.datetime] = None + created_by: typing.Optional[str] = None + last_updated_at: typing.Optional[dt.datetime] = None + last_updated_by: typing.Optional[str] = None action: typing.Optional[typing.Literal["evaluator"]] = None if IS_PYDANTIC_V2: diff --git a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_public.py b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_public.py index 3805ff57c4..ca01e58114 100644 --- a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_public.py +++ b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_public.py @@ -3,8 +3,6 @@ from __future__ import annotations from ..core.pydantic_utilities import UniversalBaseModel import typing -import typing_extensions -from ..core.serialization import FieldMetadata import datetime as dt from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic @@ -13,25 +11,13 @@ class Base(UniversalBaseModel): id: typing.Optional[str] = None - project_id: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="projectId") - ] = None + project_id: typing.Optional[str] = None name: str - sampling_rate: typing_extensions.Annotated[ - typing.Optional[float], FieldMetadata(alias="samplingRate") - ] = None - created_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="createdAt") - ] = None - created_by: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="createdBy") - ] = None - last_updated_at: typing_extensions.Annotated[ - typing.Optional[dt.datetime], FieldMetadata(alias="lastUpdatedAt") - ] = None - last_updated_by: typing_extensions.Annotated[ - typing.Optional[str], FieldMetadata(alias="lastUpdatedBy") - ] = None + sampling_rate: typing.Optional[float] = None + created_at: typing.Optional[dt.datetime] = None + created_by: typing.Optional[str] = None + last_updated_at: typing.Optional[dt.datetime] = None + last_updated_by: typing.Optional[str] = None action: typing.Optional[typing.Literal["evaluator"]] = None if IS_PYDANTIC_V2: diff --git a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_write.py b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_write.py index 33c8cf87c9..b6d282ce73 100644 --- a/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_write.py +++ b/sdks/python/src/opik/rest_api/types/automation_rule_evaluator_write.py @@ -2,9 +2,7 @@ from __future__ import annotations from ..core.pydantic_utilities import UniversalBaseModel -import typing_extensions import typing -from ..core.serialization import FieldMetadata from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic from .llm_as_judge_code_write import LlmAsJudgeCodeWrite @@ -12,9 +10,7 @@ class Base(UniversalBaseModel): name: str - sampling_rate: typing_extensions.Annotated[ - typing.Optional[float], FieldMetadata(alias="samplingRate") - ] = None + sampling_rate: typing.Optional[float] = None action: typing.Optional[typing.Literal["evaluator"]] = None if IS_PYDANTIC_V2: diff --git a/sdks/python/src/opik/rest_api/types/comment.py b/sdks/python/src/opik/rest_api/types/comment.py new file mode 100644 index 0000000000..f911770345 --- /dev/null +++ b/sdks/python/src/opik/rest_api/types/comment.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +import datetime as dt +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class Comment(UniversalBaseModel): + id: typing.Optional[str] = None + text: str + created_at: typing.Optional[dt.datetime] = None + last_updated_at: typing.Optional[dt.datetime] = None + created_by: typing.Optional[str] = None + last_updated_by: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( + extra="allow", frozen=True + ) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/sdks/python/src/opik/rest_api/types/comment_compare.py b/sdks/python/src/opik/rest_api/types/comment_compare.py new file mode 100644 index 0000000000..beeb18c9a7 --- /dev/null +++ b/sdks/python/src/opik/rest_api/types/comment_compare.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +import datetime as dt +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class CommentCompare(UniversalBaseModel): + id: typing.Optional[str] = None + text: str + created_at: typing.Optional[dt.datetime] = None + last_updated_at: typing.Optional[dt.datetime] = None + created_by: typing.Optional[str] = None + last_updated_by: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( + extra="allow", frozen=True + ) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/sdks/python/src/opik/rest_api/types/comment_public.py b/sdks/python/src/opik/rest_api/types/comment_public.py new file mode 100644 index 0000000000..4642c6d3c4 --- /dev/null +++ b/sdks/python/src/opik/rest_api/types/comment_public.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +import datetime as dt +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class CommentPublic(UniversalBaseModel): + id: typing.Optional[str] = None + text: str + created_at: typing.Optional[dt.datetime] = None + last_updated_at: typing.Optional[dt.datetime] = None + created_by: typing.Optional[str] = None + last_updated_by: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( + extra="allow", frozen=True + ) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/sdks/python/src/opik/rest_api/types/experiment.py b/sdks/python/src/opik/rest_api/types/experiment.py index 9e9a5a043d..1ea15530df 100644 --- a/sdks/python/src/opik/rest_api/types/experiment.py +++ b/sdks/python/src/opik/rest_api/types/experiment.py @@ -4,6 +4,7 @@ import typing from .json_node import JsonNode from .feedback_score_average import FeedbackScoreAverage +from .comment import Comment import datetime as dt from .prompt_version_link import PromptVersionLink from ..core.pydantic_utilities import IS_PYDANTIC_V2 @@ -17,6 +18,7 @@ class Experiment(UniversalBaseModel): name: typing.Optional[str] = None metadata: typing.Optional[JsonNode] = None feedback_scores: typing.Optional[typing.List[FeedbackScoreAverage]] = None + comments: typing.Optional[typing.List[Comment]] = None trace_count: typing.Optional[int] = None created_at: typing.Optional[dt.datetime] = None last_updated_at: typing.Optional[dt.datetime] = None diff --git a/sdks/python/src/opik/rest_api/types/experiment_item.py b/sdks/python/src/opik/rest_api/types/experiment_item.py index 993fe7e2ee..0937c5273d 100644 --- a/sdks/python/src/opik/rest_api/types/experiment_item.py +++ b/sdks/python/src/opik/rest_api/types/experiment_item.py @@ -4,6 +4,7 @@ import typing from .json_node import JsonNode from .feedback_score import FeedbackScore +from .comment import Comment import datetime as dt from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic @@ -17,6 +18,7 @@ class ExperimentItem(UniversalBaseModel): input: typing.Optional[JsonNode] = None output: typing.Optional[JsonNode] = None feedback_scores: typing.Optional[typing.List[FeedbackScore]] = None + comments: typing.Optional[typing.List[Comment]] = None created_at: typing.Optional[dt.datetime] = None last_updated_at: typing.Optional[dt.datetime] = None created_by: typing.Optional[str] = None diff --git a/sdks/python/src/opik/rest_api/types/experiment_item_compare.py b/sdks/python/src/opik/rest_api/types/experiment_item_compare.py index 76a016d2f8..01e3cc2ac6 100644 --- a/sdks/python/src/opik/rest_api/types/experiment_item_compare.py +++ b/sdks/python/src/opik/rest_api/types/experiment_item_compare.py @@ -4,6 +4,7 @@ import typing from .json_node_compare import JsonNodeCompare from .feedback_score_compare import FeedbackScoreCompare +from .comment_compare import CommentCompare import datetime as dt from ..core.pydantic_utilities import IS_PYDANTIC_V2 import pydantic @@ -17,6 +18,7 @@ class ExperimentItemCompare(UniversalBaseModel): input: typing.Optional[JsonNodeCompare] = None output: typing.Optional[JsonNodeCompare] = None feedback_scores: typing.Optional[typing.List[FeedbackScoreCompare]] = None + comments: typing.Optional[typing.List[CommentCompare]] = None created_at: typing.Optional[dt.datetime] = None last_updated_at: typing.Optional[dt.datetime] = None created_by: typing.Optional[str] = None diff --git a/sdks/python/src/opik/rest_api/types/experiment_public.py b/sdks/python/src/opik/rest_api/types/experiment_public.py index 1f3983d097..97c1a88ab2 100644 --- a/sdks/python/src/opik/rest_api/types/experiment_public.py +++ b/sdks/python/src/opik/rest_api/types/experiment_public.py @@ -4,6 +4,7 @@ import typing from .json_node_public import JsonNodePublic from .feedback_score_average_public import FeedbackScoreAveragePublic +from .comment_public import CommentPublic import datetime as dt from .prompt_version_link_public import PromptVersionLinkPublic from ..core.pydantic_utilities import IS_PYDANTIC_V2 @@ -17,6 +18,7 @@ class ExperimentPublic(UniversalBaseModel): name: typing.Optional[str] = None metadata: typing.Optional[JsonNodePublic] = None feedback_scores: typing.Optional[typing.List[FeedbackScoreAveragePublic]] = None + comments: typing.Optional[typing.List[CommentPublic]] = None trace_count: typing.Optional[int] = None created_at: typing.Optional[dt.datetime] = None last_updated_at: typing.Optional[dt.datetime] = None diff --git a/sdks/python/src/opik/rest_api/types/feedback_score_batch_item_source.py b/sdks/python/src/opik/rest_api/types/feedback_score_batch_item_source.py index 3218d38868..faef59cc55 100644 --- a/sdks/python/src/opik/rest_api/types/feedback_score_batch_item_source.py +++ b/sdks/python/src/opik/rest_api/types/feedback_score_batch_item_source.py @@ -2,4 +2,6 @@ import typing -FeedbackScoreBatchItemSource = typing.Union[typing.Literal["ui", "sdk"], typing.Any] +FeedbackScoreBatchItemSource = typing.Union[ + typing.Literal["ui", "sdk", "online_scoring"], typing.Any +] diff --git a/sdks/python/src/opik/rest_api/types/feedback_score_compare_source.py b/sdks/python/src/opik/rest_api/types/feedback_score_compare_source.py index 88d5034a51..12be8033cd 100644 --- a/sdks/python/src/opik/rest_api/types/feedback_score_compare_source.py +++ b/sdks/python/src/opik/rest_api/types/feedback_score_compare_source.py @@ -2,4 +2,6 @@ import typing -FeedbackScoreCompareSource = typing.Union[typing.Literal["ui", "sdk"], typing.Any] +FeedbackScoreCompareSource = typing.Union[ + typing.Literal["ui", "sdk", "online_scoring"], typing.Any +] diff --git a/sdks/python/src/opik/rest_api/types/feedback_score_public_source.py b/sdks/python/src/opik/rest_api/types/feedback_score_public_source.py index 85406dfc38..44b670c72e 100644 --- a/sdks/python/src/opik/rest_api/types/feedback_score_public_source.py +++ b/sdks/python/src/opik/rest_api/types/feedback_score_public_source.py @@ -2,4 +2,6 @@ import typing -FeedbackScorePublicSource = typing.Union[typing.Literal["ui", "sdk"], typing.Any] +FeedbackScorePublicSource = typing.Union[ + typing.Literal["ui", "sdk", "online_scoring"], typing.Any +] diff --git a/sdks/python/src/opik/rest_api/types/feedback_score_source.py b/sdks/python/src/opik/rest_api/types/feedback_score_source.py index 9d8f38bf4c..28c265642a 100644 --- a/sdks/python/src/opik/rest_api/types/feedback_score_source.py +++ b/sdks/python/src/opik/rest_api/types/feedback_score_source.py @@ -2,4 +2,6 @@ import typing -FeedbackScoreSource = typing.Union[typing.Literal["ui", "sdk"], typing.Any] +FeedbackScoreSource = typing.Union[ + typing.Literal["ui", "sdk", "online_scoring"], typing.Any +] diff --git a/sdks/python/src/opik/rest_api/types/log_item.py b/sdks/python/src/opik/rest_api/types/log_item.py new file mode 100644 index 0000000000..aad47e4a8a --- /dev/null +++ b/sdks/python/src/opik/rest_api/types/log_item.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +import datetime as dt +from .log_item_level import LogItemLevel +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class LogItem(UniversalBaseModel): + timestamp: typing.Optional[dt.datetime] = None + rule_id: typing.Optional[str] = None + level: typing.Optional[LogItemLevel] = None + message: typing.Optional[str] = None + markers: typing.Optional[typing.Dict[str, str]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( + extra="allow", frozen=True + ) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/sdks/python/src/opik/rest_api/types/log_item_level.py b/sdks/python/src/opik/rest_api/types/log_item_level.py new file mode 100644 index 0000000000..2da62cee8a --- /dev/null +++ b/sdks/python/src/opik/rest_api/types/log_item_level.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LogItemLevel = typing.Union[ + typing.Literal["INFO", "WARN", "ERROR", "DEBUG", "TRACE"], typing.Any +] diff --git a/sdks/python/src/opik/rest_api/types/log_page.py b/sdks/python/src/opik/rest_api/types/log_page.py new file mode 100644 index 0000000000..72009a2099 --- /dev/null +++ b/sdks/python/src/opik/rest_api/types/log_page.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.pydantic_utilities import UniversalBaseModel +import typing +from .log_item import LogItem +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +import pydantic + + +class LogPage(UniversalBaseModel): + content: typing.Optional[typing.List[LogItem]] = None + page: typing.Optional[int] = None + size: typing.Optional[int] = None + total: typing.Optional[int] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( + extra="allow", frozen=True + ) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/sdks/python/src/opik/rest_api/types/provider_api_key_provider.py b/sdks/python/src/opik/rest_api/types/provider_api_key_provider.py index 09c3c37a46..5e62847079 100644 --- a/sdks/python/src/opik/rest_api/types/provider_api_key_provider.py +++ b/sdks/python/src/opik/rest_api/types/provider_api_key_provider.py @@ -2,4 +2,6 @@ import typing -ProviderApiKeyProvider = typing.Union[typing.Literal["openai", "anthropic"], typing.Any] +ProviderApiKeyProvider = typing.Union[ + typing.Literal["openai", "anthropic", "gemini"], typing.Any +] diff --git a/sdks/python/src/opik/rest_api/types/provider_api_key_public_provider.py b/sdks/python/src/opik/rest_api/types/provider_api_key_public_provider.py index 8e955c7cbd..5c9ef2458c 100644 --- a/sdks/python/src/opik/rest_api/types/provider_api_key_public_provider.py +++ b/sdks/python/src/opik/rest_api/types/provider_api_key_public_provider.py @@ -3,5 +3,5 @@ import typing ProviderApiKeyPublicProvider = typing.Union[ - typing.Literal["openai", "anthropic"], typing.Any + typing.Literal["openai", "anthropic", "gemini"], typing.Any ] diff --git a/sdks/python/src/opik/rest_api/types/span.py b/sdks/python/src/opik/rest_api/types/span.py index b6d0ff446a..89be4251e9 100644 --- a/sdks/python/src/opik/rest_api/types/span.py +++ b/sdks/python/src/opik/rest_api/types/span.py @@ -8,6 +8,7 @@ from .json_node import JsonNode from .error_info import ErrorInfo from .feedback_score import FeedbackScore +from .comment import Comment from ..core.pydantic_utilities import IS_PYDANTIC_V2 @@ -38,6 +39,7 @@ class Span(UniversalBaseModel): created_by: typing.Optional[str] = None last_updated_by: typing.Optional[str] = None feedback_scores: typing.Optional[typing.List[FeedbackScore]] = None + comments: typing.Optional[typing.List[Comment]] = None total_estimated_cost: typing.Optional[float] = None total_estimated_cost_version: typing.Optional[str] = None duration: typing.Optional[float] = pydantic.Field(default=None) diff --git a/sdks/python/src/opik/rest_api/types/span_public.py b/sdks/python/src/opik/rest_api/types/span_public.py index 961f531a52..006aee7ad6 100644 --- a/sdks/python/src/opik/rest_api/types/span_public.py +++ b/sdks/python/src/opik/rest_api/types/span_public.py @@ -7,6 +7,7 @@ from .json_node_public import JsonNodePublic from .error_info_public import ErrorInfoPublic from .feedback_score_public import FeedbackScorePublic +from .comment_public import CommentPublic import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 @@ -33,6 +34,7 @@ class SpanPublic(UniversalBaseModel): created_by: typing.Optional[str] = None last_updated_by: typing.Optional[str] = None feedback_scores: typing.Optional[typing.List[FeedbackScorePublic]] = None + comments: typing.Optional[typing.List[CommentPublic]] = None total_estimated_cost: typing.Optional[float] = None total_estimated_cost_version: typing.Optional[str] = None duration: typing.Optional[float] = pydantic.Field(default=None) diff --git a/sdks/python/src/opik/rest_api/types/trace.py b/sdks/python/src/opik/rest_api/types/trace.py index 74263d5eec..6e33814872 100644 --- a/sdks/python/src/opik/rest_api/types/trace.py +++ b/sdks/python/src/opik/rest_api/types/trace.py @@ -7,6 +7,7 @@ from .json_node import JsonNode from .error_info import ErrorInfo from .feedback_score import FeedbackScore +from .comment import Comment from ..core.pydantic_utilities import IS_PYDANTIC_V2 @@ -32,6 +33,7 @@ class Trace(UniversalBaseModel): created_by: typing.Optional[str] = None last_updated_by: typing.Optional[str] = None feedback_scores: typing.Optional[typing.List[FeedbackScore]] = None + comments: typing.Optional[typing.List[Comment]] = None total_estimated_cost: typing.Optional[float] = None duration: typing.Optional[float] = pydantic.Field(default=None) """ diff --git a/sdks/python/src/opik/rest_api/types/trace_public.py b/sdks/python/src/opik/rest_api/types/trace_public.py index ee83d6bb76..9714e9e023 100644 --- a/sdks/python/src/opik/rest_api/types/trace_public.py +++ b/sdks/python/src/opik/rest_api/types/trace_public.py @@ -6,6 +6,7 @@ from .json_node_public import JsonNodePublic from .error_info_public import ErrorInfoPublic from .feedback_score_public import FeedbackScorePublic +from .comment_public import CommentPublic import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 @@ -27,6 +28,7 @@ class TracePublic(UniversalBaseModel): created_by: typing.Optional[str] = None last_updated_by: typing.Optional[str] = None feedback_scores: typing.Optional[typing.List[FeedbackScorePublic]] = None + comments: typing.Optional[typing.List[CommentPublic]] = None total_estimated_cost: typing.Optional[float] = None duration: typing.Optional[float] = pydantic.Field(default=None) """ diff --git a/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/Client.ts b/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/Client.ts index bacf6c2d10..eb82bfc781 100644 --- a/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/Client.ts +++ b/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/Client.ts @@ -470,6 +470,95 @@ export class AutomationRuleEvaluators { ); } + /** + * Get automation rule evaluator logs by id + * + * @param {string} projectId + * @param {string} id + * @param {OpikApi.GetEvaluatorLogsByIdRequest} request + * @param {AutomationRuleEvaluators.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.automationRuleEvaluators.getEvaluatorLogsById("projectId", "id") + */ + public getEvaluatorLogsById( + projectId: string, + id: string, + request: OpikApi.GetEvaluatorLogsByIdRequest = {}, + requestOptions?: AutomationRuleEvaluators.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const { size } = request; + const _queryParams: Record = {}; + if (size != null) { + _queryParams["size"] = size.toString(); + } + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/automations/projects/${encodeURIComponent( + projectId + )}/evaluators/${encodeURIComponent(id)}/logs` + ), + method: "GET", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: serializers.LogPage.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }), + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling GET /v1/private/automations/projects/{projectId}/evaluators/{id}/logs." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + protected async _getCustomAuthorizationHeaders() { const apiKeyValue = await core.Supplier.get(this._options.apiKey); return { Authorization: apiKeyValue }; diff --git a/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/GetEvaluatorLogsByIdRequest.ts b/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/GetEvaluatorLogsByIdRequest.ts new file mode 100644 index 0000000000..3deb5aebb1 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/GetEvaluatorLogsByIdRequest.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface GetEvaluatorLogsByIdRequest { + size?: number; +} diff --git a/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/index.ts b/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/index.ts index 73a8ed21f9..7c66093b43 100644 --- a/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/index.ts +++ b/sdks/typescript/src/opik/rest_api/api/resources/automationRuleEvaluators/client/requests/index.ts @@ -1,2 +1,3 @@ export { type FindEvaluatorsRequest } from "./FindEvaluatorsRequest"; export { type AutomationRuleEvaluatorUpdate } from "./AutomationRuleEvaluatorUpdate"; +export { type GetEvaluatorLogsByIdRequest } from "./GetEvaluatorLogsByIdRequest"; diff --git a/sdks/typescript/src/opik/rest_api/api/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts b/sdks/typescript/src/opik/rest_api/api/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts index f023c2a281..97c072a289 100644 --- a/sdks/typescript/src/opik/rest_api/api/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts +++ b/sdks/typescript/src/opik/rest_api/api/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type ProviderApiKeyWriteProvider = "openai" | "anthropic"; +export type ProviderApiKeyWriteProvider = "openai" | "anthropic" | "gemini"; export const ProviderApiKeyWriteProvider = { Openai: "openai", Anthropic: "anthropic", + Gemini: "gemini", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/resources/spans/client/Client.ts b/sdks/typescript/src/opik/rest_api/api/resources/spans/client/Client.ts index 06afd62030..5b99addb3e 100644 --- a/sdks/typescript/src/opik/rest_api/api/resources/spans/client/Client.ts +++ b/sdks/typescript/src/opik/rest_api/api/resources/spans/client/Client.ts @@ -40,6 +40,83 @@ export declare namespace Spans { export class Spans { constructor(protected readonly _options: Spans.Options = {}) {} + /** + * Add span comment + * + * @param {string} id + * @param {OpikApi.Comment} request + * @param {Spans.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.spans.addSpanComment("id", { + * text: "text" + * }) + */ + public addSpanComment( + id: string, + request: OpikApi.Comment, + requestOptions?: Spans.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/spans/${encodeURIComponent(id)}/comments` + ), + method: "POST", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.Comment.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: undefined, + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling POST /v1/private/spans/{id}/comments." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + /** * Add span feedback score * @@ -612,6 +689,81 @@ export class Spans { ); } + /** + * Delete span comments + * + * @param {OpikApi.BatchDelete} request + * @param {Spans.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.spans.deleteSpanComments({ + * ids: ["ids"] + * }) + */ + public deleteSpanComments( + request: OpikApi.BatchDelete, + requestOptions?: Spans.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + "v1/private/spans/comments/delete" + ), + method: "POST", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchDelete.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: undefined, + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling POST /v1/private/spans/comments/delete." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + /** * Delete span feedback score * @@ -775,6 +927,92 @@ export class Spans { ); } + /** + * Get span comment + * + * @param {string} commentId + * @param {string} spanId + * @param {Spans.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link OpikApi.NotFoundError} + * + * @example + * await client.spans.getSpanComment("commentId", "spanId") + */ + public getSpanComment( + commentId: string, + spanId: string, + requestOptions?: Spans.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/spans/${encodeURIComponent(spanId)}/comments/${encodeURIComponent(commentId)}` + ), + method: "GET", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: serializers.Comment.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }), + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new OpikApi.NotFoundError(_response.error.body); + default: + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling GET /v1/private/spans/{spanId}/comments/{commentId}." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + /** * Get span stats * @@ -950,6 +1188,90 @@ export class Spans { ); } + /** + * Update span comment by id + * + * @param {string} commentId + * @param {OpikApi.Comment} request + * @param {Spans.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link OpikApi.NotFoundError} + * + * @example + * await client.spans.updateSpanComment("commentId", { + * text: "text" + * }) + */ + public updateSpanComment( + commentId: string, + request: OpikApi.Comment, + requestOptions?: Spans.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/spans/comments/${encodeURIComponent(commentId)}` + ), + method: "PATCH", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.Comment.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: undefined, + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new OpikApi.NotFoundError(_response.error.body); + default: + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling PATCH /v1/private/spans/comments/{commentId}." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + protected async _getCustomAuthorizationHeaders() { const apiKeyValue = await core.Supplier.get(this._options.apiKey); return { Authorization: apiKeyValue }; diff --git a/sdks/typescript/src/opik/rest_api/api/resources/traces/client/Client.ts b/sdks/typescript/src/opik/rest_api/api/resources/traces/client/Client.ts index 8b1a310717..8dc47e78c7 100644 --- a/sdks/typescript/src/opik/rest_api/api/resources/traces/client/Client.ts +++ b/sdks/typescript/src/opik/rest_api/api/resources/traces/client/Client.ts @@ -40,6 +40,83 @@ export declare namespace Traces { export class Traces { constructor(protected readonly _options: Traces.Options = {}) {} + /** + * Add trace comment + * + * @param {string} id + * @param {OpikApi.Comment} request + * @param {Traces.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.traces.addTraceComment("id", { + * text: "text" + * }) + */ + public addTraceComment( + id: string, + request: OpikApi.Comment, + requestOptions?: Traces.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/traces/${encodeURIComponent(id)}/comments` + ), + method: "POST", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.Comment.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: undefined, + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling POST /v1/private/traces/{id}/comments." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + /** * Add trace feedback score * @@ -582,6 +659,81 @@ export class Traces { ); } + /** + * Delete trace comments + * + * @param {OpikApi.BatchDelete} request + * @param {Traces.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.traces.deleteTraceComments({ + * ids: ["ids"] + * }) + */ + public deleteTraceComments( + request: OpikApi.BatchDelete, + requestOptions?: Traces.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + "v1/private/traces/comments/delete" + ), + method: "POST", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchDelete.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: undefined, + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling POST /v1/private/traces/comments/delete." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + /** * Delete trace feedback score * @@ -903,6 +1055,92 @@ export class Traces { ); } + /** + * Get trace comment + * + * @param {string} commentId + * @param {string} traceId + * @param {Traces.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link OpikApi.NotFoundError} + * + * @example + * await client.traces.getTraceComment("commentId", "traceId") + */ + public getTraceComment( + commentId: string, + traceId: string, + requestOptions?: Traces.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/traces/${encodeURIComponent(traceId)}/comments/${encodeURIComponent(commentId)}` + ), + method: "GET", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: serializers.Comment.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + breadcrumbsPrefix: ["response"], + }), + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new OpikApi.NotFoundError(_response.error.body); + default: + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling GET /v1/private/traces/{traceId}/comments/{commentId}." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + /** * Batch feedback scoring for traces * @@ -983,6 +1221,90 @@ export class Traces { ); } + /** + * Update trace comment by id + * + * @param {string} commentId + * @param {OpikApi.Comment} request + * @param {Traces.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link OpikApi.NotFoundError} + * + * @example + * await client.traces.updateTraceComment("commentId", { + * text: "text" + * }) + */ + public updateTraceComment( + commentId: string, + request: OpikApi.Comment, + requestOptions?: Traces.RequestOptions + ): core.APIPromise { + return core.APIPromise.from( + (async () => { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.OpikApiEnvironment.Default, + `v1/private/traces/comments/${encodeURIComponent(commentId)}` + ), + method: "PATCH", + headers: { + "Comet-Workspace": + (await core.Supplier.get(this._options.workspaceName)) != null + ? await core.Supplier.get(this._options.workspaceName) + : undefined, + "X-Fern-Language": "JavaScript", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...(await this._getCustomAuthorizationHeaders()), + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.Comment.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: + requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + withCredentials: true, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + ok: _response.ok, + body: undefined, + headers: _response.headers, + }; + } + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new OpikApi.NotFoundError(_response.error.body); + default: + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + } + switch (_response.error.reason) { + case "non-json": + throw new errors.OpikApiError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.OpikApiTimeoutError( + "Timeout exceeded when calling PATCH /v1/private/traces/comments/{commentId}." + ); + case "unknown": + throw new errors.OpikApiError({ + message: _response.error.errorMessage, + }); + } + })() + ); + } + protected async _getCustomAuthorizationHeaders() { const apiKeyValue = await core.Supplier.get(this._options.apiKey); return { Authorization: apiKeyValue }; diff --git a/sdks/typescript/src/opik/rest_api/api/types/Comment.ts b/sdks/typescript/src/opik/rest_api/api/types/Comment.ts new file mode 100644 index 0000000000..877c07f25b --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/types/Comment.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface Comment { + id?: string; + text: string; + createdAt?: Date; + lastUpdatedAt?: Date; + createdBy?: string; + lastUpdatedBy?: string; +} diff --git a/sdks/typescript/src/opik/rest_api/api/types/CommentCompare.ts b/sdks/typescript/src/opik/rest_api/api/types/CommentCompare.ts new file mode 100644 index 0000000000..470e8b9e61 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/types/CommentCompare.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CommentCompare { + id?: string; + text: string; + createdAt?: Date; + lastUpdatedAt?: Date; + createdBy?: string; + lastUpdatedBy?: string; +} diff --git a/sdks/typescript/src/opik/rest_api/api/types/CommentPublic.ts b/sdks/typescript/src/opik/rest_api/api/types/CommentPublic.ts new file mode 100644 index 0000000000..13c4e57c4a --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/types/CommentPublic.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CommentPublic { + id?: string; + text: string; + createdAt?: Date; + lastUpdatedAt?: Date; + createdBy?: string; + lastUpdatedBy?: string; +} diff --git a/sdks/typescript/src/opik/rest_api/api/types/Experiment.ts b/sdks/typescript/src/opik/rest_api/api/types/Experiment.ts index 5752bd0b8c..a164c41af9 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/Experiment.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/Experiment.ts @@ -11,6 +11,7 @@ export interface Experiment { name?: string; metadata?: OpikApi.JsonNode; feedbackScores?: OpikApi.FeedbackScoreAverage[]; + comments?: OpikApi.Comment[]; traceCount?: number; createdAt?: Date; lastUpdatedAt?: Date; diff --git a/sdks/typescript/src/opik/rest_api/api/types/ExperimentItem.ts b/sdks/typescript/src/opik/rest_api/api/types/ExperimentItem.ts index 40d755ead0..4c83290719 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/ExperimentItem.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/ExperimentItem.ts @@ -12,6 +12,7 @@ export interface ExperimentItem { input?: OpikApi.JsonNode; output?: OpikApi.JsonNode; feedbackScores?: OpikApi.FeedbackScore[]; + comments?: OpikApi.Comment[]; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; diff --git a/sdks/typescript/src/opik/rest_api/api/types/ExperimentItemCompare.ts b/sdks/typescript/src/opik/rest_api/api/types/ExperimentItemCompare.ts index f5d584b4f3..3cd09cfb04 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/ExperimentItemCompare.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/ExperimentItemCompare.ts @@ -12,6 +12,7 @@ export interface ExperimentItemCompare { input?: OpikApi.JsonNodeCompare; output?: OpikApi.JsonNodeCompare; feedbackScores?: OpikApi.FeedbackScoreCompare[]; + comments?: OpikApi.CommentCompare[]; createdAt?: Date; lastUpdatedAt?: Date; createdBy?: string; diff --git a/sdks/typescript/src/opik/rest_api/api/types/ExperimentPublic.ts b/sdks/typescript/src/opik/rest_api/api/types/ExperimentPublic.ts index fa00292bb3..632e6d90d5 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/ExperimentPublic.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/ExperimentPublic.ts @@ -11,6 +11,7 @@ export interface ExperimentPublic { name?: string; metadata?: OpikApi.JsonNodePublic; feedbackScores?: OpikApi.FeedbackScoreAveragePublic[]; + comments?: OpikApi.CommentPublic[]; traceCount?: number; createdAt?: Date; lastUpdatedAt?: Date; diff --git a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts index b81707e144..e5b6d2cc21 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreBatchItemSource.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type FeedbackScoreBatchItemSource = "ui" | "sdk"; +export type FeedbackScoreBatchItemSource = "ui" | "sdk" | "online_scoring"; export const FeedbackScoreBatchItemSource = { Ui: "ui", Sdk: "sdk", + OnlineScoring: "online_scoring", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts index 9c48eb57b6..db514ba978 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreCompareSource.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type FeedbackScoreCompareSource = "ui" | "sdk"; +export type FeedbackScoreCompareSource = "ui" | "sdk" | "online_scoring"; export const FeedbackScoreCompareSource = { Ui: "ui", Sdk: "sdk", + OnlineScoring: "online_scoring", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts index 0476f0e0ac..c5923fe390 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScorePublicSource.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type FeedbackScorePublicSource = "ui" | "sdk"; +export type FeedbackScorePublicSource = "ui" | "sdk" | "online_scoring"; export const FeedbackScorePublicSource = { Ui: "ui", Sdk: "sdk", + OnlineScoring: "online_scoring", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreSource.ts b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreSource.ts index 6ca22edae2..fcbe935260 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreSource.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/FeedbackScoreSource.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type FeedbackScoreSource = "ui" | "sdk"; +export type FeedbackScoreSource = "ui" | "sdk" | "online_scoring"; export const FeedbackScoreSource = { Ui: "ui", Sdk: "sdk", + OnlineScoring: "online_scoring", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/LogItem.ts b/sdks/typescript/src/opik/rest_api/api/types/LogItem.ts new file mode 100644 index 0000000000..667ab70c78 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/types/LogItem.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as OpikApi from "../index"; + +export interface LogItem { + timestamp?: Date; + ruleId?: string; + level?: OpikApi.LogItemLevel; + message?: string; + markers?: Record; +} diff --git a/sdks/typescript/src/opik/rest_api/api/types/LogItemLevel.ts b/sdks/typescript/src/opik/rest_api/api/types/LogItemLevel.ts new file mode 100644 index 0000000000..887017f876 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/types/LogItemLevel.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type LogItemLevel = "INFO" | "WARN" | "ERROR" | "DEBUG" | "TRACE"; + +export const LogItemLevel = { + Info: "INFO", + Warn: "WARN", + Error: "ERROR", + Debug: "DEBUG", + Trace: "TRACE", +} as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/LogPage.ts b/sdks/typescript/src/opik/rest_api/api/types/LogPage.ts new file mode 100644 index 0000000000..28ba37cf22 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/api/types/LogPage.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as OpikApi from "../index"; + +export interface LogPage { + content?: OpikApi.LogItem[]; + page?: number; + size?: number; + total?: number; +} diff --git a/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyProvider.ts b/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyProvider.ts index 57fa1d05d2..6e3e4d6103 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyProvider.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyProvider.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type ProviderApiKeyProvider = "openai" | "anthropic"; +export type ProviderApiKeyProvider = "openai" | "anthropic" | "gemini"; export const ProviderApiKeyProvider = { Openai: "openai", Anthropic: "anthropic", + Gemini: "gemini", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyPublicProvider.ts b/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyPublicProvider.ts index 2589de6cab..9a98c1c81c 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyPublicProvider.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/ProviderApiKeyPublicProvider.ts @@ -2,9 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -export type ProviderApiKeyPublicProvider = "openai" | "anthropic"; +export type ProviderApiKeyPublicProvider = "openai" | "anthropic" | "gemini"; export const ProviderApiKeyPublicProvider = { Openai: "openai", Anthropic: "anthropic", + Gemini: "gemini", } as const; diff --git a/sdks/typescript/src/opik/rest_api/api/types/Span.ts b/sdks/typescript/src/opik/rest_api/api/types/Span.ts index d5c535dd90..6f9a13d104 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/Span.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/Span.ts @@ -28,6 +28,7 @@ export interface Span { createdBy?: string; lastUpdatedBy?: string; feedbackScores?: OpikApi.FeedbackScore[]; + comments?: OpikApi.Comment[]; totalEstimatedCost?: number; totalEstimatedCostVersion?: string; /** Duration in milliseconds as a decimal number to support sub-millisecond precision */ diff --git a/sdks/typescript/src/opik/rest_api/api/types/SpanPublic.ts b/sdks/typescript/src/opik/rest_api/api/types/SpanPublic.ts index d6cad4bfeb..91430a13f8 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/SpanPublic.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/SpanPublic.ts @@ -26,6 +26,7 @@ export interface SpanPublic { createdBy?: string; lastUpdatedBy?: string; feedbackScores?: OpikApi.FeedbackScorePublic[]; + comments?: OpikApi.CommentPublic[]; totalEstimatedCost?: number; totalEstimatedCostVersion?: string; /** Duration in milliseconds as a decimal number to support sub-millisecond precision */ diff --git a/sdks/typescript/src/opik/rest_api/api/types/Trace.ts b/sdks/typescript/src/opik/rest_api/api/types/Trace.ts index 9742031561..54e64a3a8b 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/Trace.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/Trace.ts @@ -23,6 +23,7 @@ export interface Trace { createdBy?: string; lastUpdatedBy?: string; feedbackScores?: OpikApi.FeedbackScore[]; + comments?: OpikApi.Comment[]; totalEstimatedCost?: number; /** Duration in milliseconds as a decimal number to support sub-millisecond precision */ duration?: number; diff --git a/sdks/typescript/src/opik/rest_api/api/types/TracePublic.ts b/sdks/typescript/src/opik/rest_api/api/types/TracePublic.ts index a7a8789039..aab851a169 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/TracePublic.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/TracePublic.ts @@ -21,6 +21,7 @@ export interface TracePublic { createdBy?: string; lastUpdatedBy?: string; feedbackScores?: OpikApi.FeedbackScorePublic[]; + comments?: OpikApi.CommentPublic[]; totalEstimatedCost?: number; /** Duration in milliseconds as a decimal number to support sub-millisecond precision */ duration?: number; diff --git a/sdks/typescript/src/opik/rest_api/api/types/index.ts b/sdks/typescript/src/opik/rest_api/api/types/index.ts index 515a2bb7c4..8af8972697 100644 --- a/sdks/typescript/src/opik/rest_api/api/types/index.ts +++ b/sdks/typescript/src/opik/rest_api/api/types/index.ts @@ -31,6 +31,9 @@ export * from "./LlmAsJudgeModelParametersPublic"; export * from "./LlmAsJudgeOutputSchemaPublicType"; export * from "./LlmAsJudgeOutputSchemaPublic"; export * from "./AutomationRuleEvaluatorPublic"; +export * from "./LogItemLevel"; +export * from "./LogItem"; +export * from "./LogPage"; export * from "./AssistantMessageRole"; export * from "./AssistantMessage"; export * from "./ChatCompletionChoice"; @@ -51,6 +54,7 @@ export * from "./ResponseFormat"; export * from "./StreamOptions"; export * from "./Tool"; export * from "./Dataset"; +export * from "./Comment"; export * from "./DatasetItemSource"; export * from "./DatasetItem"; export * from "./DatasetItemBatch"; @@ -62,6 +66,7 @@ export * from "./DatasetItemWriteSource"; export * from "./DatasetItemWrite"; export * from "./ColumnCompareTypesItem"; export * from "./ColumnCompare"; +export * from "./CommentCompare"; export * from "./DatasetItemPageCompare"; export * from "./DatasetItemCompareSource"; export * from "./DatasetItemCompare"; @@ -87,6 +92,7 @@ export * from "./FeedbackScoreAverage"; export * from "./PromptVersionLink"; export * from "./JsonNodeWrite"; export * from "./PromptVersionLinkWrite"; +export * from "./CommentPublic"; export * from "./ExperimentPagePublic"; export * from "./ExperimentPublic"; export * from "./FeedbackScoreAveragePublic"; diff --git a/sdks/typescript/src/opik/rest_api/serialization/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts b/sdks/typescript/src/opik/rest_api/serialization/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts index 6f3ba116e2..d43de040c4 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/resources/llmProviderKey/types/ProviderApiKeyWriteProvider.ts @@ -9,8 +9,8 @@ import * as core from "../../../../core"; export const ProviderApiKeyWriteProvider: core.serialization.Schema< serializers.ProviderApiKeyWriteProvider.Raw, OpikApi.ProviderApiKeyWriteProvider -> = core.serialization.enum_(["openai", "anthropic"]); +> = core.serialization.enum_(["openai", "anthropic", "gemini"]); export declare namespace ProviderApiKeyWriteProvider { - type Raw = "openai" | "anthropic"; + type Raw = "openai" | "anthropic" | "gemini"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluator.ts b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluator.ts index b9c967607a..c6d6d4670a 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluator.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluator.ts @@ -9,13 +9,13 @@ import { AutomationRuleEvaluatorLlmAsJudge } from "./AutomationRuleEvaluatorLlmA const _Base = core.serialization.object({ id: core.serialization.string().optional(), - projectId: core.serialization.string().optional(), + projectId: core.serialization.property("project_id", core.serialization.string().optional()), name: core.serialization.string(), - samplingRate: core.serialization.number().optional(), - createdAt: core.serialization.date().optional(), - createdBy: core.serialization.string().optional(), - lastUpdatedAt: core.serialization.date().optional(), - lastUpdatedBy: core.serialization.string().optional(), + samplingRate: core.serialization.property("sampling_rate", core.serialization.number().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + createdBy: core.serialization.property("created_by", core.serialization.string().optional()), + lastUpdatedAt: core.serialization.property("last_updated_at", core.serialization.date().optional()), + lastUpdatedBy: core.serialization.property("last_updated_by", core.serialization.string().optional()), action: core.serialization.stringLiteral("evaluator").optional(), }); export const AutomationRuleEvaluator: core.serialization.Schema< @@ -39,13 +39,13 @@ export declare namespace AutomationRuleEvaluator { interface _Base { id?: string | null; - projectId?: string | null; + project_id?: string | null; name: string; - samplingRate?: number | null; - createdAt?: string | null; - createdBy?: string | null; - lastUpdatedAt?: string | null; - lastUpdatedBy?: string | null; + sampling_rate?: number | null; + created_at?: string | null; + created_by?: string | null; + last_updated_at?: string | null; + last_updated_by?: string | null; action?: "evaluator" | null; } } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorObjectPublic.ts b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorObjectPublic.ts index 978e41a189..de3ea4da35 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorObjectPublic.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorObjectPublic.ts @@ -9,13 +9,13 @@ import { AutomationRuleEvaluatorLlmAsJudgePublic } from "./AutomationRuleEvaluat const _Base = core.serialization.object({ id: core.serialization.string().optional(), - projectId: core.serialization.string().optional(), + projectId: core.serialization.property("project_id", core.serialization.string().optional()), name: core.serialization.string(), - samplingRate: core.serialization.number().optional(), - createdAt: core.serialization.date().optional(), - createdBy: core.serialization.string().optional(), - lastUpdatedAt: core.serialization.date().optional(), - lastUpdatedBy: core.serialization.string().optional(), + samplingRate: core.serialization.property("sampling_rate", core.serialization.number().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + createdBy: core.serialization.property("created_by", core.serialization.string().optional()), + lastUpdatedAt: core.serialization.property("last_updated_at", core.serialization.date().optional()), + lastUpdatedBy: core.serialization.property("last_updated_by", core.serialization.string().optional()), action: core.serialization.stringLiteral("evaluator").optional(), }); export const AutomationRuleEvaluatorObjectPublic: core.serialization.Schema< @@ -39,13 +39,13 @@ export declare namespace AutomationRuleEvaluatorObjectPublic { interface _Base { id?: string | null; - projectId?: string | null; + project_id?: string | null; name: string; - samplingRate?: number | null; - createdAt?: string | null; - createdBy?: string | null; - lastUpdatedAt?: string | null; - lastUpdatedBy?: string | null; + sampling_rate?: number | null; + created_at?: string | null; + created_by?: string | null; + last_updated_at?: string | null; + last_updated_by?: string | null; action?: "evaluator" | null; } } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorPublic.ts b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorPublic.ts index d55f79c0e2..3092a75811 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorPublic.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorPublic.ts @@ -9,13 +9,13 @@ import { AutomationRuleEvaluatorLlmAsJudgePublic } from "./AutomationRuleEvaluat const _Base = core.serialization.object({ id: core.serialization.string().optional(), - projectId: core.serialization.string().optional(), + projectId: core.serialization.property("project_id", core.serialization.string().optional()), name: core.serialization.string(), - samplingRate: core.serialization.number().optional(), - createdAt: core.serialization.date().optional(), - createdBy: core.serialization.string().optional(), - lastUpdatedAt: core.serialization.date().optional(), - lastUpdatedBy: core.serialization.string().optional(), + samplingRate: core.serialization.property("sampling_rate", core.serialization.number().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + createdBy: core.serialization.property("created_by", core.serialization.string().optional()), + lastUpdatedAt: core.serialization.property("last_updated_at", core.serialization.date().optional()), + lastUpdatedBy: core.serialization.property("last_updated_by", core.serialization.string().optional()), action: core.serialization.stringLiteral("evaluator").optional(), }); export const AutomationRuleEvaluatorPublic: core.serialization.Schema< @@ -39,13 +39,13 @@ export declare namespace AutomationRuleEvaluatorPublic { interface _Base { id?: string | null; - projectId?: string | null; + project_id?: string | null; name: string; - samplingRate?: number | null; - createdAt?: string | null; - createdBy?: string | null; - lastUpdatedAt?: string | null; - lastUpdatedBy?: string | null; + sampling_rate?: number | null; + created_at?: string | null; + created_by?: string | null; + last_updated_at?: string | null; + last_updated_by?: string | null; action?: "evaluator" | null; } } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorWrite.ts b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorWrite.ts index 839b4692e8..bfc4ada3ea 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorWrite.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/AutomationRuleEvaluatorWrite.ts @@ -9,7 +9,7 @@ import { AutomationRuleEvaluatorLlmAsJudgeWrite } from "./AutomationRuleEvaluato const _Base = core.serialization.object({ name: core.serialization.string(), - samplingRate: core.serialization.number().optional(), + samplingRate: core.serialization.property("sampling_rate", core.serialization.number().optional()), action: core.serialization.stringLiteral("evaluator").optional(), }); export const AutomationRuleEvaluatorWrite: core.serialization.Schema< @@ -33,7 +33,7 @@ export declare namespace AutomationRuleEvaluatorWrite { interface _Base { name: string; - samplingRate?: number | null; + sampling_rate?: number | null; action?: "evaluator" | null; } } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/Comment.ts b/sdks/typescript/src/opik/rest_api/serialization/types/Comment.ts new file mode 100644 index 0000000000..1ffe533f1b --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/serialization/types/Comment.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as OpikApi from "../../api/index"; +import * as core from "../../core"; + +export const Comment: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + text: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + lastUpdatedAt: core.serialization.property("last_updated_at", core.serialization.date().optional()), + createdBy: core.serialization.property("created_by", core.serialization.string().optional()), + lastUpdatedBy: core.serialization.property("last_updated_by", core.serialization.string().optional()), + }); + +export declare namespace Comment { + interface Raw { + id?: string | null; + text: string; + created_at?: string | null; + last_updated_at?: string | null; + created_by?: string | null; + last_updated_by?: string | null; + } +} diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/CommentCompare.ts b/sdks/typescript/src/opik/rest_api/serialization/types/CommentCompare.ts new file mode 100644 index 0000000000..80537f04d4 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/serialization/types/CommentCompare.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as OpikApi from "../../api/index"; +import * as core from "../../core"; + +export const CommentCompare: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + text: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + lastUpdatedAt: core.serialization.property("last_updated_at", core.serialization.date().optional()), + createdBy: core.serialization.property("created_by", core.serialization.string().optional()), + lastUpdatedBy: core.serialization.property("last_updated_by", core.serialization.string().optional()), + }); + +export declare namespace CommentCompare { + interface Raw { + id?: string | null; + text: string; + created_at?: string | null; + last_updated_at?: string | null; + created_by?: string | null; + last_updated_by?: string | null; + } +} diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/CommentPublic.ts b/sdks/typescript/src/opik/rest_api/serialization/types/CommentPublic.ts new file mode 100644 index 0000000000..57163b51e7 --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/serialization/types/CommentPublic.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as OpikApi from "../../api/index"; +import * as core from "../../core"; + +export const CommentPublic: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + text: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.date().optional()), + lastUpdatedAt: core.serialization.property("last_updated_at", core.serialization.date().optional()), + createdBy: core.serialization.property("created_by", core.serialization.string().optional()), + lastUpdatedBy: core.serialization.property("last_updated_by", core.serialization.string().optional()), + }); + +export declare namespace CommentPublic { + interface Raw { + id?: string | null; + text: string; + created_at?: string | null; + last_updated_at?: string | null; + created_by?: string | null; + last_updated_by?: string | null; + } +} diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/Experiment.ts b/sdks/typescript/src/opik/rest_api/serialization/types/Experiment.ts index 9fe15babea..5fe0e3378d 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/Experiment.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/Experiment.ts @@ -7,6 +7,7 @@ import * as OpikApi from "../../api/index"; import * as core from "../../core"; import { JsonNode } from "./JsonNode"; import { FeedbackScoreAverage } from "./FeedbackScoreAverage"; +import { Comment } from "./Comment"; import { PromptVersionLink } from "./PromptVersionLink"; export const Experiment: core.serialization.ObjectSchema = @@ -20,6 +21,7 @@ export const Experiment: core.serialization.ObjectSchema = core.serialization.object({ @@ -20,6 +21,7 @@ export const ExperimentItem: core.serialization.ObjectSchema = core.serialization.enum_(["ui", "sdk"]); +> = core.serialization.enum_(["ui", "sdk", "online_scoring"]); export declare namespace FeedbackScoreBatchItemSource { - type Raw = "ui" | "sdk"; + type Raw = "ui" | "sdk" | "online_scoring"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts b/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts index d034982d56..a84c70a8c2 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreCompareSource.ts @@ -9,8 +9,8 @@ import * as core from "../../core"; export const FeedbackScoreCompareSource: core.serialization.Schema< serializers.FeedbackScoreCompareSource.Raw, OpikApi.FeedbackScoreCompareSource -> = core.serialization.enum_(["ui", "sdk"]); +> = core.serialization.enum_(["ui", "sdk", "online_scoring"]); export declare namespace FeedbackScoreCompareSource { - type Raw = "ui" | "sdk"; + type Raw = "ui" | "sdk" | "online_scoring"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts b/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts index 0df8b258c1..523d91ae2e 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScorePublicSource.ts @@ -9,8 +9,8 @@ import * as core from "../../core"; export const FeedbackScorePublicSource: core.serialization.Schema< serializers.FeedbackScorePublicSource.Raw, OpikApi.FeedbackScorePublicSource -> = core.serialization.enum_(["ui", "sdk"]); +> = core.serialization.enum_(["ui", "sdk", "online_scoring"]); export declare namespace FeedbackScorePublicSource { - type Raw = "ui" | "sdk"; + type Raw = "ui" | "sdk" | "online_scoring"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts b/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts index 42876910e9..940f8288c1 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/FeedbackScoreSource.ts @@ -9,8 +9,8 @@ import * as core from "../../core"; export const FeedbackScoreSource: core.serialization.Schema< serializers.FeedbackScoreSource.Raw, OpikApi.FeedbackScoreSource -> = core.serialization.enum_(["ui", "sdk"]); +> = core.serialization.enum_(["ui", "sdk", "online_scoring"]); export declare namespace FeedbackScoreSource { - type Raw = "ui" | "sdk"; + type Raw = "ui" | "sdk" | "online_scoring"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/LogItem.ts b/sdks/typescript/src/opik/rest_api/serialization/types/LogItem.ts new file mode 100644 index 0000000000..af7718c24b --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/serialization/types/LogItem.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as OpikApi from "../../api/index"; +import * as core from "../../core"; +import { LogItemLevel } from "./LogItemLevel"; + +export const LogItem: core.serialization.ObjectSchema = + core.serialization.object({ + timestamp: core.serialization.date().optional(), + ruleId: core.serialization.property("rule_id", core.serialization.string().optional()), + level: LogItemLevel.optional(), + message: core.serialization.string().optional(), + markers: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(), + }); + +export declare namespace LogItem { + interface Raw { + timestamp?: string | null; + rule_id?: string | null; + level?: LogItemLevel.Raw | null; + message?: string | null; + markers?: Record | null; + } +} diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/LogItemLevel.ts b/sdks/typescript/src/opik/rest_api/serialization/types/LogItemLevel.ts new file mode 100644 index 0000000000..e1f24f74ff --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/serialization/types/LogItemLevel.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as OpikApi from "../../api/index"; +import * as core from "../../core"; + +export const LogItemLevel: core.serialization.Schema = + core.serialization.enum_(["INFO", "WARN", "ERROR", "DEBUG", "TRACE"]); + +export declare namespace LogItemLevel { + type Raw = "INFO" | "WARN" | "ERROR" | "DEBUG" | "TRACE"; +} diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/LogPage.ts b/sdks/typescript/src/opik/rest_api/serialization/types/LogPage.ts new file mode 100644 index 0000000000..c0b8ab9e5a --- /dev/null +++ b/sdks/typescript/src/opik/rest_api/serialization/types/LogPage.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as OpikApi from "../../api/index"; +import * as core from "../../core"; +import { LogItem } from "./LogItem"; + +export const LogPage: core.serialization.ObjectSchema = + core.serialization.object({ + content: core.serialization.list(LogItem).optional(), + page: core.serialization.number().optional(), + size: core.serialization.number().optional(), + total: core.serialization.number().optional(), + }); + +export declare namespace LogPage { + interface Raw { + content?: LogItem.Raw[] | null; + page?: number | null; + size?: number | null; + total?: number | null; + } +} diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyProvider.ts b/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyProvider.ts index 4e80168fe4..8139165ca3 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyProvider.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyProvider.ts @@ -9,8 +9,8 @@ import * as core from "../../core"; export const ProviderApiKeyProvider: core.serialization.Schema< serializers.ProviderApiKeyProvider.Raw, OpikApi.ProviderApiKeyProvider -> = core.serialization.enum_(["openai", "anthropic"]); +> = core.serialization.enum_(["openai", "anthropic", "gemini"]); export declare namespace ProviderApiKeyProvider { - type Raw = "openai" | "anthropic"; + type Raw = "openai" | "anthropic" | "gemini"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyPublicProvider.ts b/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyPublicProvider.ts index 46dca3bb04..e2bd98f70b 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyPublicProvider.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/ProviderApiKeyPublicProvider.ts @@ -9,8 +9,8 @@ import * as core from "../../core"; export const ProviderApiKeyPublicProvider: core.serialization.Schema< serializers.ProviderApiKeyPublicProvider.Raw, OpikApi.ProviderApiKeyPublicProvider -> = core.serialization.enum_(["openai", "anthropic"]); +> = core.serialization.enum_(["openai", "anthropic", "gemini"]); export declare namespace ProviderApiKeyPublicProvider { - type Raw = "openai" | "anthropic"; + type Raw = "openai" | "anthropic" | "gemini"; } diff --git a/sdks/typescript/src/opik/rest_api/serialization/types/Span.ts b/sdks/typescript/src/opik/rest_api/serialization/types/Span.ts index 199c945711..0e61a1202a 100644 --- a/sdks/typescript/src/opik/rest_api/serialization/types/Span.ts +++ b/sdks/typescript/src/opik/rest_api/serialization/types/Span.ts @@ -9,6 +9,7 @@ import { SpanType } from "./SpanType"; import { JsonNode } from "./JsonNode"; import { ErrorInfo } from "./ErrorInfo"; import { FeedbackScore } from "./FeedbackScore"; +import { Comment } from "./Comment"; export const Span: core.serialization.ObjectSchema = core.serialization.object({ id: core.serialization.string().optional(), @@ -33,6 +34,7 @@ export const Span: core.serialization.ObjectSchema = core.serialization.object({ @@ -36,6 +37,7 @@ export const SpanPublic: core.serialization.ObjectSchema = core.serialization.object({ id: core.serialization.string().optional(), @@ -27,6 +28,7 @@ export const Trace: core.serialization.ObjectSchema = core.serialization.object({ @@ -30,6 +31,7 @@ export const TracePublic: core.serialization.ObjectSchema