:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(aio): type the evaluation run response (#104253)
Julian Bezc1679abff328
diff --git a/products/ai_observability/backend/api/evaluation_runs.py b/products/ai_observability/backend/api/evaluation_runs.pyindex 3cd148945356..32bec59bec7e 100644--- a/products/ai_observability/backend/api/evaluation_runs.py+++ b/products/ai_observability/backend/api/evaluation_runs.py@@ -5,7 +5,6 @@ from datetime import timedeltafrom django.conf import settingsimport structlog-from drf_spectacular.types import OpenApiTypesfrom drf_spectacular.utils import extend_schemafrom rest_framework import serializers, viewsetsfrom rest_framework.exceptions import APIException, NotFound, ValidationError@@ -52,11 +51,23 @@ class EvaluationRunRequestSerializer(serializers.Serializer):)+class EvaluationRunEvaluationSerializer(serializers.Serializer):+ id = serializers.UUIDField(help_text="UUID of the evaluation being run.")+ name = serializers.CharField(help_text="Display name of the evaluation being run.")+++class EvaluationRunResponseSerializer(serializers.Serializer):+ workflow_id = serializers.CharField(help_text="Temporal workflow ID of the enqueued run.")+ status = serializers.CharField(help_text="Workflow status at the time of the response.")+ evaluation = EvaluationRunEvaluationSerializer(help_text="Evaluation selected for this run.")+ target_event_id = serializers.UUIDField(help_text="UUID of the event being evaluated.")++class EvaluationRunViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):scope_object = "evaluation"permission_classes = [IsAuthenticated, AccessControlPermission]- @extend_schema(request=EvaluationRunRequestSerializer, responses={200: OpenApiTypes.OBJECT})+ @extend_schema(request=EvaluationRunRequestSerializer, responses={202: EvaluationRunResponseSerializer})@llma_track_latency("llma_evaluation_runs_create")@monitor(feature=None, endpoint="llma_evaluation_runs_create", method="POST")def create(self, request: Request, **kwargs) -> Response:diff --git a/products/ai_observability/frontend/generated/api.schemas.ts b/products/ai_observability/frontend/generated/api.schemas.tsindex ca36ebd4e839..d3564858c3c7 100644--- a/products/ai_observability/frontend/generated/api.schemas.ts+++ b/products/ai_observability/frontend/generated/api.schemas.ts@@ -743,6 +743,24 @@ export interface EvaluationRunRequestApi {distinct_id?: string | null}+export interface EvaluationRunEvaluationApi {+ /** UUID of the evaluation being run. */+ id: string+ /** Display name of the evaluation being run. */+ name: string+}++export interface EvaluationRunResponseApi {+ /** Temporal workflow ID of the enqueued run. */+ workflow_id: string+ /** Workflow status at the time of the response. */+ status: string+ /** Evaluation selected for this run. */+ evaluation: EvaluationRunEvaluationApi+ /** UUID of the event being evaluated. */+ target_event_id: string+}+/*** * `active` - Active* * `paused` - Paused@@ -3405,8 +3423,6 @@ export type DatasetsRevisionsListParams = {offset?: number}-export type EvaluationRunsCreate200 = { [key: string]: unknown }-export type EvaluationsListParams = {/*** Filter evaluations by directory UUID.diff --git a/products/ai_observability/frontend/generated/api.ts b/products/ai_observability/frontend/generated/api.tsindex d15dba93991a..c4aa6b149073 100644--- a/products/ai_observability/frontend/generated/api.ts+++ b/products/ai_observability/frontend/generated/api.ts@@ -40,7 +40,7 @@ import type {EvaluationReportApi,EvaluationReportUpdateApi,EvaluationRunRequestApi,- EvaluationRunsCreate200,+ EvaluationRunResponseApi,EvaluationsBackfillsListParams,EvaluationsListParams,InstrumentationCheckActionApi,@@ -748,8 +748,8 @@ export const evaluationRunsCreate = async (projectId: string,evaluationRunRequestApi: EvaluationRunRequestApi,options?: RequestInit-): Promise<EvaluationRunsCreate200> => {- return apiMutator<EvaluationRunsCreate200>(getEvaluationRunsCreateUrl(projectId), {+): Promise<EvaluationRunResponseApi> => {+ return apiMutator<EvaluationRunResponseApi>(getEvaluationRunsCreateUrl(projectId), {...options,method: 'POST',headers: { 'Content-Type': 'application/json', ...options?.headers },diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 2045207ded72..96fbbcde7e15 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -37106,6 +37106,13 @@ export namespace Schemas {readonly created_at: string;}+ export interface EvaluationRunEvaluation {+ /** UUID of the evaluation being run. */+ id: string;+ /** Display name of the evaluation being run. */+ name: string;+ }+export interface EvaluationRunRequest {/** UUID of the evaluation to run. */evaluation_id: string;@@ -37122,6 +37129,17 @@ export namespace Schemas {distinct_id?: string | null;}+ export interface EvaluationRunResponse {+ /** Temporal workflow ID of the enqueued run. */+ workflow_id: string;+ /** Workflow status at the time of the response. */+ status: string;+ /** Evaluation selected for this run. */+ evaluation: EvaluationRunEvaluation;+ /** UUID of the event being evaluated. */+ target_event_id: string;+ }+export interface EventDefinitionBasic {id: string;name: string;@@ -105192,8 +105210,6 @@ export namespace Schemas {Invalid: 'invalid',} as const;- export type EvaluationRunsCreate200 = { [key: string]: unknown };-export type EvaluationsListParams = {/*** Filter evaluations by directory UUID.