From 773c56c93858bfec9e73ccb22950919bd968d606 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 02:53:05 +0000 Subject: [PATCH 01/26] feat(client): support custom http clients (#80) --- internal/requestconfig/requestconfig.go | 10 +++++++++ option/requestoption.go | 29 ++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 902e94f..dc60973 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -192,6 +192,12 @@ func UseDefaultParam[T any](dst *param.Field[T], src *T) { } } +// This interface is primarily used to describe an [*http.Client], but also +// supports custom HTTP implementations. +type HTTPDoer interface { + Do(req *http.Request) (*http.Response, error) +} + // RequestConfig represents all the state related to one request. // // Editing the variables inside RequestConfig directly is unstable api. Prefer @@ -202,6 +208,7 @@ type RequestConfig struct { Context context.Context Request *http.Request BaseURL *url.URL + CustomHTTPDoer HTTPDoer HTTPClient *http.Client Middlewares []middleware APIKey string @@ -399,6 +406,9 @@ func (cfg *RequestConfig) Execute() (err error) { } handler := cfg.HTTPClient.Do + if cfg.CustomHTTPDoer != nil { + handler = cfg.CustomHTTPDoer.Do + } for i := len(cfg.Middlewares) - 1; i >= 0; i -= 1 { handler = applyMiddleware(cfg.Middlewares[i], handler) } diff --git a/option/requestoption.go b/option/requestoption.go index 5c59183..72ef762 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -40,11 +40,34 @@ func WithBaseURL(base string) RequestOption { }) } -// WithHTTPClient returns a RequestOption that changes the underlying [http.Client] used to make this +// HTTPClient is primarily used to describe an [*http.Client], but also +// supports custom implementations. +// +// For bespoke implementations, prefer using an [*http.Client] with a +// custom transport. See [http.RoundTripper] for further information. +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +// WithHTTPClient returns a RequestOption that changes the underlying http client used to make this // request, which by default is [http.DefaultClient]. -func WithHTTPClient(client *http.Client) RequestOption { +// +// For custom uses cases, it is recommended to provide an [*http.Client] with a custom +// [http.RoundTripper] as its transport, rather than directly implementing [HTTPClient]. +func WithHTTPClient(client HTTPClient) RequestOption { return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error { - r.HTTPClient = client + if client == nil { + return fmt.Errorf("requestoption: custom http client cannot be nil") + } + + if c, ok := client.(*http.Client); ok { + // Prefer the native client if possible. + r.HTTPClient = c + r.CustomHTTPDoer = nil + } else { + r.CustomHTTPDoer = client + } + return nil }) } From c4047aeebaf1c7ae8aa176572a1615746bee8bb5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 02:32:36 +0000 Subject: [PATCH 02/26] chore(tests): improve enum examples (#82) --- committestresult_test.go | 2 +- inferencepipelinetestresult_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/committestresult_test.go b/committestresult_test.go index 3d82ea5..f1e86c0 100644 --- a/committestresult_test.go +++ b/committestresult_test.go @@ -32,7 +32,7 @@ func TestCommitTestResultListWithOptionalParams(t *testing.T) { IncludeArchived: openlayer.F(true), Page: openlayer.F(int64(1)), PerPage: openlayer.F(int64(1)), - Status: openlayer.F(openlayer.CommitTestResultListParamsStatusRunning), + Status: openlayer.F(openlayer.CommitTestResultListParamsStatusPassing), Type: openlayer.F(openlayer.CommitTestResultListParamsTypeIntegrity), }, ) diff --git a/inferencepipelinetestresult_test.go b/inferencepipelinetestresult_test.go index 216fb1d..359da70 100644 --- a/inferencepipelinetestresult_test.go +++ b/inferencepipelinetestresult_test.go @@ -31,7 +31,7 @@ func TestInferencePipelineTestResultListWithOptionalParams(t *testing.T) { openlayer.InferencePipelineTestResultListParams{ Page: openlayer.F(int64(1)), PerPage: openlayer.F(int64(1)), - Status: openlayer.F(openlayer.InferencePipelineTestResultListParamsStatusRunning), + Status: openlayer.F(openlayer.InferencePipelineTestResultListParamsStatusPassing), Type: openlayer.F(openlayer.InferencePipelineTestResultListParamsTypeIntegrity), }, ) From 14067c7e9dfa7c1bcdfb9ded29ce3eaea12d1bd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 02:47:54 +0000 Subject: [PATCH 03/26] chore(internal): expand CI branch coverage --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02d8f19..938d4c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From 08c00cadee41cd7f6b3bd2873a0a1f18ba997a99 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 02:50:38 +0000 Subject: [PATCH 04/26] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 938d4c1..7806290 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,17 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - main + pull_request: + branches: + - main + - next jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 From 6245eac124bdfa974d36963c293b4f6d1b791021 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 03:06:37 +0000 Subject: [PATCH 05/26] docs: update documentation links to be more uniform --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6da5283..c7284e0 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ Go Reference -The Openlayer Go library provides convenient access to [the Openlayer REST -API](https://openlayer.com/docs/api-reference/rest/overview) from applications written in Go. The full API of this library can be found in [api.md](api.md). +The Openlayer Go library provides convenient access to the [Openlayer REST API](https://openlayer.com/docs/api-reference/rest/overview) +from applications written in Go. It is generated with [Stainless](https://www.stainless.com/). From 6cc028136dc67f77881c5c1f4d466254694a0679 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 02:47:44 +0000 Subject: [PATCH 06/26] chore(docs): document pre-request options --- internal/requestconfig/requestconfig.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index dc60973..40b1461 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -589,16 +589,20 @@ func (cfg *RequestConfig) Apply(opts ...RequestOption) error { return nil } +// PreRequestOptions is used to collect all the options which need to be known before +// a call to [RequestConfig.ExecuteNewRequest], such as path parameters +// or global defaults. +// PreRequestOptions will return a [RequestConfig] with the options applied. +// +// Only request option functions of type [PreRequestOptionFunc] are applied. func PreRequestOptions(opts ...RequestOption) (RequestConfig, error) { cfg := RequestConfig{} for _, opt := range opts { - if _, ok := opt.(PreRequestOptionFunc); !ok { - continue - } - - err := opt.Apply(&cfg) - if err != nil { - return cfg, err + if opt, ok := opt.(PreRequestOptionFunc); ok { + err := opt.Apply(&cfg) + if err != nil { + return cfg, err + } } } return cfg, nil From 9fd23557e5355ae4280fdea454c024eab8d9dc4d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 02:51:06 +0000 Subject: [PATCH 07/26] feat(client): add support for reading base URL from environment variable --- client.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index 9e268e0..bb93cb9 100644 --- a/client.go +++ b/client.go @@ -22,10 +22,13 @@ type Client struct { Storage *StorageService } -// DefaultClientOptions read from the environment (OPENLAYER_API_KEY). This should -// be used to initialize new clients. +// DefaultClientOptions read from the environment (OPENLAYER_API_KEY, +// OPENLAYER_BASE_URL). This should be used to initialize new clients. func DefaultClientOptions() []option.RequestOption { defaults := []option.RequestOption{option.WithEnvironmentProduction()} + if o, ok := os.LookupEnv("OPENLAYER_BASE_URL"); ok { + defaults = append(defaults, option.WithBaseURL(o)) + } if o, ok := os.LookupEnv("OPENLAYER_API_KEY"); ok { defaults = append(defaults, option.WithAPIKey(o)) } @@ -33,9 +36,9 @@ func DefaultClientOptions() []option.RequestOption { } // NewClient generates a new client with the default option read from the -// environment (OPENLAYER_API_KEY). The option passed in as arguments are applied -// after these default arguments, and all option will be passed down to the -// services and requests that this client makes. +// environment (OPENLAYER_API_KEY, OPENLAYER_BASE_URL). The option passed in as +// arguments are applied after these default arguments, and all option will be +// passed down to the services and requests that this client makes. func NewClient(opts ...option.RequestOption) (r *Client) { opts = append(DefaultClientOptions(), opts...) From 915af773e51144f74c1517bb43eb6807867d4015 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 19:52:01 +0000 Subject: [PATCH 08/26] feat(api): api update --- .stats.yml | 2 +- committestresult.go | 71 ++++++++++++++++++++++++++++++++-- inferencepipelinetestresult.go | 71 ++++++++++++++++++++++++++++++++-- 3 files changed, 137 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5fc516d..959df2a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 15 -openapi_spec_hash: 9a0b363025305f6b086bcdfe43274830 +openapi_spec_hash: c01d40349b63e0d636eb3ae352a41341 config_hash: 21fb9730d1cdc9e3fd38724c4774b894 diff --git a/committestresult.go b/committestresult.go index 3375958..3dea10b 100644 --- a/committestresult.go +++ b/committestresult.go @@ -229,12 +229,15 @@ func (r commitTestResultListResponseItemsGoalJSON) RawJSON() string { type CommitTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - InsightParameters []interface{} `json:"insightParameters"` + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. + InsightParameters []CommitTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` // The operator to be used for the evaluation. - Operator string `json:"operator"` + Operator CommitTestResultListResponseItemsGoalThresholdsOperator `json:"operator"` + // Whether to use automatic anomaly detection or manual thresholds + ThresholdMode CommitTestResultListResponseItemsGoalThresholdsThresholdMode `json:"thresholdMode"` // The value to be compared. Value CommitTestResultListResponseItemsGoalThresholdsValueUnion `json:"value"` JSON commitTestResultListResponseItemsGoalThresholdJSON `json:"-"` @@ -247,6 +250,7 @@ type commitTestResultListResponseItemsGoalThresholdJSON struct { InsightParameters apijson.Field Measurement apijson.Field Operator apijson.Field + ThresholdMode apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field @@ -260,6 +264,67 @@ func (r commitTestResultListResponseItemsGoalThresholdJSON) RawJSON() string { return r.raw } +type CommitTestResultListResponseItemsGoalThresholdsInsightParameter struct { + // The name of the insight filter. + Name string `json:"name,required"` + Value interface{} `json:"value,required"` + JSON commitTestResultListResponseItemsGoalThresholdsInsightParameterJSON `json:"-"` +} + +// commitTestResultListResponseItemsGoalThresholdsInsightParameterJSON contains the +// JSON metadata for the struct +// [CommitTestResultListResponseItemsGoalThresholdsInsightParameter] +type commitTestResultListResponseItemsGoalThresholdsInsightParameterJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *CommitTestResultListResponseItemsGoalThresholdsInsightParameter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r commitTestResultListResponseItemsGoalThresholdsInsightParameterJSON) RawJSON() string { + return r.raw +} + +// The operator to be used for the evaluation. +type CommitTestResultListResponseItemsGoalThresholdsOperator string + +const ( + CommitTestResultListResponseItemsGoalThresholdsOperatorIs CommitTestResultListResponseItemsGoalThresholdsOperator = "is" + CommitTestResultListResponseItemsGoalThresholdsOperatorGreater CommitTestResultListResponseItemsGoalThresholdsOperator = ">" + CommitTestResultListResponseItemsGoalThresholdsOperatorGreaterOrEquals CommitTestResultListResponseItemsGoalThresholdsOperator = ">=" + CommitTestResultListResponseItemsGoalThresholdsOperatorLess CommitTestResultListResponseItemsGoalThresholdsOperator = "<" + CommitTestResultListResponseItemsGoalThresholdsOperatorLessOrEquals CommitTestResultListResponseItemsGoalThresholdsOperator = "<=" + CommitTestResultListResponseItemsGoalThresholdsOperatorNotEquals CommitTestResultListResponseItemsGoalThresholdsOperator = "!=" +) + +func (r CommitTestResultListResponseItemsGoalThresholdsOperator) IsKnown() bool { + switch r { + case CommitTestResultListResponseItemsGoalThresholdsOperatorIs, CommitTestResultListResponseItemsGoalThresholdsOperatorGreater, CommitTestResultListResponseItemsGoalThresholdsOperatorGreaterOrEquals, CommitTestResultListResponseItemsGoalThresholdsOperatorLess, CommitTestResultListResponseItemsGoalThresholdsOperatorLessOrEquals, CommitTestResultListResponseItemsGoalThresholdsOperatorNotEquals: + return true + } + return false +} + +// Whether to use automatic anomaly detection or manual thresholds +type CommitTestResultListResponseItemsGoalThresholdsThresholdMode string + +const ( + CommitTestResultListResponseItemsGoalThresholdsThresholdModeAutomatic CommitTestResultListResponseItemsGoalThresholdsThresholdMode = "automatic" + CommitTestResultListResponseItemsGoalThresholdsThresholdModeManual CommitTestResultListResponseItemsGoalThresholdsThresholdMode = "manual" +) + +func (r CommitTestResultListResponseItemsGoalThresholdsThresholdMode) IsKnown() bool { + switch r { + case CommitTestResultListResponseItemsGoalThresholdsThresholdModeAutomatic, CommitTestResultListResponseItemsGoalThresholdsThresholdModeManual: + return true + } + return false +} + // The value to be compared. // // Union satisfied by [shared.UnionFloat], [shared.UnionBool], [shared.UnionString] diff --git a/inferencepipelinetestresult.go b/inferencepipelinetestresult.go index e6e1a5d..40e6bda 100644 --- a/inferencepipelinetestresult.go +++ b/inferencepipelinetestresult.go @@ -229,12 +229,15 @@ func (r inferencePipelineTestResultListResponseItemsGoalJSON) RawJSON() string { type InferencePipelineTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - InsightParameters []interface{} `json:"insightParameters"` + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. + InsightParameters []InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` // The operator to be used for the evaluation. - Operator string `json:"operator"` + Operator InferencePipelineTestResultListResponseItemsGoalThresholdsOperator `json:"operator"` + // Whether to use automatic anomaly detection or manual thresholds + ThresholdMode InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdMode `json:"thresholdMode"` // The value to be compared. Value InferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion `json:"value"` JSON inferencePipelineTestResultListResponseItemsGoalThresholdJSON `json:"-"` @@ -248,6 +251,7 @@ type inferencePipelineTestResultListResponseItemsGoalThresholdJSON struct { InsightParameters apijson.Field Measurement apijson.Field Operator apijson.Field + ThresholdMode apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field @@ -261,6 +265,67 @@ func (r inferencePipelineTestResultListResponseItemsGoalThresholdJSON) RawJSON() return r.raw } +type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter struct { + // The name of the insight filter. + Name string `json:"name,required"` + Value interface{} `json:"value,required"` + JSON inferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameterJSON `json:"-"` +} + +// inferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameterJSON +// contains the JSON metadata for the struct +// [InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter] +type inferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameterJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r inferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameterJSON) RawJSON() string { + return r.raw +} + +// The operator to be used for the evaluation. +type InferencePipelineTestResultListResponseItemsGoalThresholdsOperator string + +const ( + InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorIs InferencePipelineTestResultListResponseItemsGoalThresholdsOperator = "is" + InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorGreater InferencePipelineTestResultListResponseItemsGoalThresholdsOperator = ">" + InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorGreaterOrEquals InferencePipelineTestResultListResponseItemsGoalThresholdsOperator = ">=" + InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorLess InferencePipelineTestResultListResponseItemsGoalThresholdsOperator = "<" + InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorLessOrEquals InferencePipelineTestResultListResponseItemsGoalThresholdsOperator = "<=" + InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorNotEquals InferencePipelineTestResultListResponseItemsGoalThresholdsOperator = "!=" +) + +func (r InferencePipelineTestResultListResponseItemsGoalThresholdsOperator) IsKnown() bool { + switch r { + case InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorIs, InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorGreater, InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorGreaterOrEquals, InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorLess, InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorLessOrEquals, InferencePipelineTestResultListResponseItemsGoalThresholdsOperatorNotEquals: + return true + } + return false +} + +// Whether to use automatic anomaly detection or manual thresholds +type InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdMode string + +const ( + InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdModeAutomatic InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdMode = "automatic" + InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdModeManual InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdMode = "manual" +) + +func (r InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdMode) IsKnown() bool { + switch r { + case InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdModeAutomatic, InferencePipelineTestResultListResponseItemsGoalThresholdsThresholdModeManual: + return true + } + return false +} + // The value to be compared. // // Union satisfied by [shared.UnionFloat], [shared.UnionBool], [shared.UnionString] From 994513d9661af5cca31b86060b7807c01e3a2099 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 20:08:46 +0000 Subject: [PATCH 09/26] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 959df2a..11f2aab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 15 -openapi_spec_hash: c01d40349b63e0d636eb3ae352a41341 +openapi_spec_hash: 7dd38774b534c352620bca63efa85b19 config_hash: 21fb9730d1cdc9e3fd38724c4774b894 From 50fa1ac7d9d7bff9402b7be595e176cfab4d18e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 13:11:43 +0000 Subject: [PATCH 10/26] feat(api): add test creation endpoint --- .stats.yml | 4 +- api.md | 10 ++ project.go | 2 + projecttest.go | 383 ++++++++++++++++++++++++++++++++++++++++++++ projecttest_test.go | 65 ++++++++ shared/union.go | 6 + 6 files changed, 468 insertions(+), 2 deletions(-) create mode 100644 projecttest.go create mode 100644 projecttest_test.go diff --git a/.stats.yml b/.stats.yml index 11f2aab..81ceaeb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 15 +configured_endpoints: 16 openapi_spec_hash: 7dd38774b534c352620bca63efa85b19 -config_hash: 21fb9730d1cdc9e3fd38724c4774b894 +config_hash: 0383360784fc87d799bad2be203142b5 diff --git a/api.md b/api.md index bf0898d..35dc109 100644 --- a/api.md +++ b/api.md @@ -34,6 +34,16 @@ Methods: - client.Projects.InferencePipelines.New(ctx context.Context, projectID string, body openlayer.ProjectInferencePipelineNewParams) (openlayer.ProjectInferencePipelineNewResponse, error) - client.Projects.InferencePipelines.List(ctx context.Context, projectID string, query openlayer.ProjectInferencePipelineListParams) (openlayer.ProjectInferencePipelineListResponse, error) +## Tests + +Response Types: + +- openlayer.ProjectTestNewResponse + +Methods: + +- client.Projects.Tests.New(ctx context.Context, projectID string, body openlayer.ProjectTestNewParams) (openlayer.ProjectTestNewResponse, error) + # Commits Response Types: diff --git a/project.go b/project.go index 43149c5..3e761e3 100644 --- a/project.go +++ b/project.go @@ -25,6 +25,7 @@ type ProjectService struct { Options []option.RequestOption Commits *ProjectCommitService InferencePipelines *ProjectInferencePipelineService + Tests *ProjectTestService } // NewProjectService generates a new service that applies the given options to each @@ -35,6 +36,7 @@ func NewProjectService(opts ...option.RequestOption) (r *ProjectService) { r.Options = opts r.Commits = NewProjectCommitService(opts...) r.InferencePipelines = NewProjectInferencePipelineService(opts...) + r.Tests = NewProjectTestService(opts...) return } diff --git a/projecttest.go b/projecttest.go new file mode 100644 index 0000000..ecf1285 --- /dev/null +++ b/projecttest.go @@ -0,0 +1,383 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package openlayer + +import ( + "context" + "errors" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/openlayer-ai/openlayer-go/internal/apijson" + "github.com/openlayer-ai/openlayer-go/internal/param" + "github.com/openlayer-ai/openlayer-go/internal/requestconfig" + "github.com/openlayer-ai/openlayer-go/option" + "github.com/openlayer-ai/openlayer-go/shared" + "github.com/tidwall/gjson" +) + +// ProjectTestService contains methods and other services that help with +// interacting with the openlayer API. +// +// Note, unlike clients, this service does not read variables from the environment +// automatically. You should not instantiate this service directly, and instead use +// the [NewProjectTestService] method instead. +type ProjectTestService struct { + Options []option.RequestOption +} + +// NewProjectTestService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewProjectTestService(opts ...option.RequestOption) (r *ProjectTestService) { + r = &ProjectTestService{} + r.Options = opts + return +} + +// Create a test. +func (r *ProjectTestService) New(ctx context.Context, projectID string, body ProjectTestNewParams, opts ...option.RequestOption) (res *ProjectTestNewResponse, err error) { + opts = append(r.Options[:], opts...) + if projectID == "" { + err = errors.New("missing required projectId parameter") + return + } + path := fmt.Sprintf("projects/%s/tests", projectID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + +type ProjectTestNewResponse struct { + // The test id. + ID string `json:"id,required" format:"uuid"` + // The number of comments on the test. + CommentCount int64 `json:"commentCount,required"` + // The test creator id. + CreatorID string `json:"creatorId,required,nullable" format:"uuid"` + // The date the test was archived. + DateArchived time.Time `json:"dateArchived,required,nullable" format:"date-time"` + // The creation date. + DateCreated time.Time `json:"dateCreated,required" format:"date-time"` + // The last updated date. + DateUpdated time.Time `json:"dateUpdated,required" format:"date-time"` + // The test description. + Description interface{} `json:"description,required,nullable"` + // The test name. + Name string `json:"name,required"` + // The test number. + Number int64 `json:"number,required"` + // The project version (commit) id where the test was created. + OriginProjectVersionID string `json:"originProjectVersionId,required,nullable" format:"uuid"` + // The test subtype. + Subtype string `json:"subtype,required"` + // Whether the test is suggested or user-created. + Suggested bool `json:"suggested,required"` + Thresholds []ProjectTestNewResponseThreshold `json:"thresholds,required"` + // The test type. + Type string `json:"type,required"` + // Whether the test is archived. + Archived bool `json:"archived"` + // The delay window in seconds. Only applies to tests that use production data. + DelayWindow float64 `json:"delayWindow,nullable"` + // The evaluation window in seconds. Only applies to tests that use production + // data. + EvaluationWindow float64 `json:"evaluationWindow,nullable"` + // Whether the test uses an ML model. + UsesMlModel bool `json:"usesMlModel"` + // Whether the test uses production data (monitoring mode only). + UsesProductionData bool `json:"usesProductionData"` + // Whether the test uses a reference dataset (monitoring mode only). + UsesReferenceDataset bool `json:"usesReferenceDataset"` + // Whether the test uses a training dataset. + UsesTrainingDataset bool `json:"usesTrainingDataset"` + // Whether the test uses a validation dataset. + UsesValidationDataset bool `json:"usesValidationDataset"` + JSON projectTestNewResponseJSON `json:"-"` +} + +// projectTestNewResponseJSON contains the JSON metadata for the struct +// [ProjectTestNewResponse] +type projectTestNewResponseJSON struct { + ID apijson.Field + CommentCount apijson.Field + CreatorID apijson.Field + DateArchived apijson.Field + DateCreated apijson.Field + DateUpdated apijson.Field + Description apijson.Field + Name apijson.Field + Number apijson.Field + OriginProjectVersionID apijson.Field + Subtype apijson.Field + Suggested apijson.Field + Thresholds apijson.Field + Type apijson.Field + Archived apijson.Field + DelayWindow apijson.Field + EvaluationWindow apijson.Field + UsesMlModel apijson.Field + UsesProductionData apijson.Field + UsesReferenceDataset apijson.Field + UsesTrainingDataset apijson.Field + UsesValidationDataset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestNewResponseJSON) RawJSON() string { + return r.raw +} + +type ProjectTestNewResponseThreshold struct { + // The insight name to be evaluated. + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. + InsightParameters []ProjectTestNewResponseThresholdsInsightParameter `json:"insightParameters,nullable"` + // The measurement to be evaluated. + Measurement string `json:"measurement"` + // The operator to be used for the evaluation. + Operator ProjectTestNewResponseThresholdsOperator `json:"operator"` + // Whether to use automatic anomaly detection or manual thresholds + ThresholdMode ProjectTestNewResponseThresholdsThresholdMode `json:"thresholdMode"` + // The value to be compared. + Value ProjectTestNewResponseThresholdsValueUnion `json:"value"` + JSON projectTestNewResponseThresholdJSON `json:"-"` +} + +// projectTestNewResponseThresholdJSON contains the JSON metadata for the struct +// [ProjectTestNewResponseThreshold] +type projectTestNewResponseThresholdJSON struct { + InsightName apijson.Field + InsightParameters apijson.Field + Measurement apijson.Field + Operator apijson.Field + ThresholdMode apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestNewResponseThreshold) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestNewResponseThresholdJSON) RawJSON() string { + return r.raw +} + +type ProjectTestNewResponseThresholdsInsightParameter struct { + // The name of the insight filter. + Name string `json:"name,required"` + Value interface{} `json:"value,required"` + JSON projectTestNewResponseThresholdsInsightParameterJSON `json:"-"` +} + +// projectTestNewResponseThresholdsInsightParameterJSON contains the JSON metadata +// for the struct [ProjectTestNewResponseThresholdsInsightParameter] +type projectTestNewResponseThresholdsInsightParameterJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestNewResponseThresholdsInsightParameter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestNewResponseThresholdsInsightParameterJSON) RawJSON() string { + return r.raw +} + +// The operator to be used for the evaluation. +type ProjectTestNewResponseThresholdsOperator string + +const ( + ProjectTestNewResponseThresholdsOperatorIs ProjectTestNewResponseThresholdsOperator = "is" + ProjectTestNewResponseThresholdsOperatorGreater ProjectTestNewResponseThresholdsOperator = ">" + ProjectTestNewResponseThresholdsOperatorGreaterOrEquals ProjectTestNewResponseThresholdsOperator = ">=" + ProjectTestNewResponseThresholdsOperatorLess ProjectTestNewResponseThresholdsOperator = "<" + ProjectTestNewResponseThresholdsOperatorLessOrEquals ProjectTestNewResponseThresholdsOperator = "<=" + ProjectTestNewResponseThresholdsOperatorNotEquals ProjectTestNewResponseThresholdsOperator = "!=" +) + +func (r ProjectTestNewResponseThresholdsOperator) IsKnown() bool { + switch r { + case ProjectTestNewResponseThresholdsOperatorIs, ProjectTestNewResponseThresholdsOperatorGreater, ProjectTestNewResponseThresholdsOperatorGreaterOrEquals, ProjectTestNewResponseThresholdsOperatorLess, ProjectTestNewResponseThresholdsOperatorLessOrEquals, ProjectTestNewResponseThresholdsOperatorNotEquals: + return true + } + return false +} + +// Whether to use automatic anomaly detection or manual thresholds +type ProjectTestNewResponseThresholdsThresholdMode string + +const ( + ProjectTestNewResponseThresholdsThresholdModeAutomatic ProjectTestNewResponseThresholdsThresholdMode = "automatic" + ProjectTestNewResponseThresholdsThresholdModeManual ProjectTestNewResponseThresholdsThresholdMode = "manual" +) + +func (r ProjectTestNewResponseThresholdsThresholdMode) IsKnown() bool { + switch r { + case ProjectTestNewResponseThresholdsThresholdModeAutomatic, ProjectTestNewResponseThresholdsThresholdModeManual: + return true + } + return false +} + +// The value to be compared. +// +// Union satisfied by [shared.UnionFloat], [shared.UnionBool], [shared.UnionString] +// or [ProjectTestNewResponseThresholdsValueArray]. +type ProjectTestNewResponseThresholdsValueUnion interface { + ImplementsProjectTestNewResponseThresholdsValueUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ProjectTestNewResponseThresholdsValueUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.True, + Type: reflect.TypeOf(shared.UnionBool(false)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.False, + Type: reflect.TypeOf(shared.UnionBool(false)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ProjectTestNewResponseThresholdsValueArray{}), + }, + ) +} + +type ProjectTestNewResponseThresholdsValueArray []string + +func (r ProjectTestNewResponseThresholdsValueArray) ImplementsProjectTestNewResponseThresholdsValueUnion() { +} + +type ProjectTestNewParams struct { + // The test description. + Description param.Field[interface{}] `json:"description,required"` + // The test name. + Name param.Field[string] `json:"name,required"` + // The test subtype. + Subtype param.Field[string] `json:"subtype,required"` + Thresholds param.Field[[]ProjectTestNewParamsThreshold] `json:"thresholds,required"` + // The test type. + Type param.Field[string] `json:"type,required"` + // Whether the test is archived. + Archived param.Field[bool] `json:"archived"` + // The delay window in seconds. Only applies to tests that use production data. + DelayWindow param.Field[float64] `json:"delayWindow"` + // The evaluation window in seconds. Only applies to tests that use production + // data. + EvaluationWindow param.Field[float64] `json:"evaluationWindow"` + // Whether the test uses an ML model. + UsesMlModel param.Field[bool] `json:"usesMlModel"` + // Whether the test uses production data (monitoring mode only). + UsesProductionData param.Field[bool] `json:"usesProductionData"` + // Whether the test uses a reference dataset (monitoring mode only). + UsesReferenceDataset param.Field[bool] `json:"usesReferenceDataset"` + // Whether the test uses a training dataset. + UsesTrainingDataset param.Field[bool] `json:"usesTrainingDataset"` + // Whether the test uses a validation dataset. + UsesValidationDataset param.Field[bool] `json:"usesValidationDataset"` +} + +func (r ProjectTestNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ProjectTestNewParamsThreshold struct { + // The insight name to be evaluated. + InsightName param.Field[string] `json:"insightName"` + // The insight parameters. Required only for some test subtypes. + InsightParameters param.Field[[]ProjectTestNewParamsThresholdsInsightParameter] `json:"insightParameters"` + // The measurement to be evaluated. + Measurement param.Field[string] `json:"measurement"` + // The operator to be used for the evaluation. + Operator param.Field[ProjectTestNewParamsThresholdsOperator] `json:"operator"` + // Whether to use automatic anomaly detection or manual thresholds + ThresholdMode param.Field[ProjectTestNewParamsThresholdsThresholdMode] `json:"thresholdMode"` + // The value to be compared. + Value param.Field[ProjectTestNewParamsThresholdsValueUnion] `json:"value"` +} + +func (r ProjectTestNewParamsThreshold) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ProjectTestNewParamsThresholdsInsightParameter struct { + // The name of the insight filter. + Name param.Field[string] `json:"name,required"` + Value param.Field[interface{}] `json:"value,required"` +} + +func (r ProjectTestNewParamsThresholdsInsightParameter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The operator to be used for the evaluation. +type ProjectTestNewParamsThresholdsOperator string + +const ( + ProjectTestNewParamsThresholdsOperatorIs ProjectTestNewParamsThresholdsOperator = "is" + ProjectTestNewParamsThresholdsOperatorGreater ProjectTestNewParamsThresholdsOperator = ">" + ProjectTestNewParamsThresholdsOperatorGreaterOrEquals ProjectTestNewParamsThresholdsOperator = ">=" + ProjectTestNewParamsThresholdsOperatorLess ProjectTestNewParamsThresholdsOperator = "<" + ProjectTestNewParamsThresholdsOperatorLessOrEquals ProjectTestNewParamsThresholdsOperator = "<=" + ProjectTestNewParamsThresholdsOperatorNotEquals ProjectTestNewParamsThresholdsOperator = "!=" +) + +func (r ProjectTestNewParamsThresholdsOperator) IsKnown() bool { + switch r { + case ProjectTestNewParamsThresholdsOperatorIs, ProjectTestNewParamsThresholdsOperatorGreater, ProjectTestNewParamsThresholdsOperatorGreaterOrEquals, ProjectTestNewParamsThresholdsOperatorLess, ProjectTestNewParamsThresholdsOperatorLessOrEquals, ProjectTestNewParamsThresholdsOperatorNotEquals: + return true + } + return false +} + +// Whether to use automatic anomaly detection or manual thresholds +type ProjectTestNewParamsThresholdsThresholdMode string + +const ( + ProjectTestNewParamsThresholdsThresholdModeAutomatic ProjectTestNewParamsThresholdsThresholdMode = "automatic" + ProjectTestNewParamsThresholdsThresholdModeManual ProjectTestNewParamsThresholdsThresholdMode = "manual" +) + +func (r ProjectTestNewParamsThresholdsThresholdMode) IsKnown() bool { + switch r { + case ProjectTestNewParamsThresholdsThresholdModeAutomatic, ProjectTestNewParamsThresholdsThresholdModeManual: + return true + } + return false +} + +// The value to be compared. +// +// Satisfied by [shared.UnionFloat], [shared.UnionBool], [shared.UnionString], +// [ProjectTestNewParamsThresholdsValueArray]. +type ProjectTestNewParamsThresholdsValueUnion interface { + ImplementsProjectTestNewParamsThresholdsValueUnion() +} + +type ProjectTestNewParamsThresholdsValueArray []string + +func (r ProjectTestNewParamsThresholdsValueArray) ImplementsProjectTestNewParamsThresholdsValueUnion() { +} diff --git a/projecttest_test.go b/projecttest_test.go new file mode 100644 index 0000000..623a9b9 --- /dev/null +++ b/projecttest_test.go @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package openlayer_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/openlayer-ai/openlayer-go" + "github.com/openlayer-ai/openlayer-go/internal/testutil" + "github.com/openlayer-ai/openlayer-go/option" + "github.com/openlayer-ai/openlayer-go/shared" +) + +func TestProjectTestNewWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := openlayer.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + _, err := client.Projects.Tests.New( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + openlayer.ProjectTestNewParams{ + Description: openlayer.F[any]("This test checks for duplicate rows in the dataset."), + Name: openlayer.F("No duplicate rows"), + Subtype: openlayer.F("duplicateRowCount"), + Thresholds: openlayer.F([]openlayer.ProjectTestNewParamsThreshold{{ + InsightName: openlayer.F("duplicateRowCount"), + InsightParameters: openlayer.F([]openlayer.ProjectTestNewParamsThresholdsInsightParameter{{ + Name: openlayer.F("column_name"), + Value: openlayer.F[any]("Age"), + }}), + Measurement: openlayer.F("duplicateRowCount"), + Operator: openlayer.F(openlayer.ProjectTestNewParamsThresholdsOperatorLessOrEquals), + ThresholdMode: openlayer.F(openlayer.ProjectTestNewParamsThresholdsThresholdModeAutomatic), + Value: openlayer.F[openlayer.ProjectTestNewParamsThresholdsValueUnion](shared.UnionFloat(0.000000)), + }}), + Type: openlayer.F("integrity"), + Archived: openlayer.F(false), + DelayWindow: openlayer.F(0.000000), + EvaluationWindow: openlayer.F(3600.000000), + UsesMlModel: openlayer.F(false), + UsesProductionData: openlayer.F(false), + UsesReferenceDataset: openlayer.F(false), + UsesTrainingDataset: openlayer.F(false), + UsesValidationDataset: openlayer.F(true), + }, + ) + if err != nil { + var apierr *openlayer.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/shared/union.go b/shared/union.go index c3c50a4..56219e9 100644 --- a/shared/union.go +++ b/shared/union.go @@ -4,15 +4,21 @@ package shared type UnionString string +func (UnionString) ImplementsProjectTestNewResponseThresholdsValueUnion() {} +func (UnionString) ImplementsProjectTestNewParamsThresholdsValueUnion() {} func (UnionString) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionString) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} type UnionBool bool +func (UnionBool) ImplementsProjectTestNewResponseThresholdsValueUnion() {} +func (UnionBool) ImplementsProjectTestNewParamsThresholdsValueUnion() {} func (UnionBool) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionBool) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} type UnionFloat float64 +func (UnionFloat) ImplementsProjectTestNewResponseThresholdsValueUnion() {} +func (UnionFloat) ImplementsProjectTestNewParamsThresholdsValueUnion() {} func (UnionFloat) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionFloat) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} From a41c7b6366a1b1b380fa714ac527cd4c8a019112 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 02:27:19 +0000 Subject: [PATCH 11/26] chore(ci): add timeout thresholds for CI jobs --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7806290..04c08a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: From 8ad39a515b9bc3c3a752682500f37193c6f44a70 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:15:24 +0000 Subject: [PATCH 12/26] chore(internal): codegen related update --- .github/workflows/ci.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04c08a4..029e0b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,19 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 + steps: - uses: actions/checkout@v4 From abc6c92db4e9cbfd5e199571c521f9c3a7b02c73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 02:15:49 +0000 Subject: [PATCH 13/26] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 029e0b2..13ce848 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openlayer-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 From df57e5e7d49d2fe25ec25c7efcfa925b6d3624a1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 12:40:35 +0000 Subject: [PATCH 14/26] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 81ceaeb..a9edd5d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 16 -openapi_spec_hash: 7dd38774b534c352620bca63efa85b19 +openapi_spec_hash: a3b4490f36a68f474989d080a436fe81 config_hash: 0383360784fc87d799bad2be203142b5 From 52e73942a6e6107e74d2547f84b2c9356e61dc19 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 12:45:18 +0000 Subject: [PATCH 15/26] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index a9edd5d..94b4f83 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 16 -openapi_spec_hash: a3b4490f36a68f474989d080a436fe81 +openapi_spec_hash: 7c835c55ec387350b647a302c48edb9d config_hash: 0383360784fc87d799bad2be203142b5 From 20c21a5bfc2a02ef41317797e52b966a29880738 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:05:35 +0000 Subject: [PATCH 16/26] feat(api): api update --- .stats.yml | 2 +- committestresult.go | 78 ++++++++++++++++- inferencepipelinetestresult.go | 76 ++++++++++++++++- projecttest.go | 152 ++++++++++++++++++++++++++++++++- projecttest_test.go | 4 +- 5 files changed, 300 insertions(+), 12 deletions(-) diff --git a/.stats.yml b/.stats.yml index 94b4f83..00b73d5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 16 -openapi_spec_hash: 7c835c55ec387350b647a302c48edb9d +openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 config_hash: 0383360784fc87d799bad2be203142b5 diff --git a/committestresult.go b/committestresult.go index 3dea10b..0ec5ff1 100644 --- a/committestresult.go +++ b/committestresult.go @@ -164,12 +164,12 @@ type CommitTestResultListResponseItemsGoal struct { // The project version (commit) id where the test was created. OriginProjectVersionID string `json:"originProjectVersionId,required,nullable" format:"uuid"` // The test subtype. - Subtype string `json:"subtype,required"` + Subtype CommitTestResultListResponseItemsGoalSubtype `json:"subtype,required"` // Whether the test is suggested or user-created. Suggested bool `json:"suggested,required"` Thresholds []CommitTestResultListResponseItemsGoalThreshold `json:"thresholds,required"` // The test type. - Type string `json:"type,required"` + Type CommitTestResultListResponseItemsGoalType `json:"type,required"` // Whether the test is archived. Archived bool `json:"archived"` // The delay window in seconds. Only applies to tests that use production data. @@ -227,6 +227,61 @@ func (r commitTestResultListResponseItemsGoalJSON) RawJSON() string { return r.raw } +// The test subtype. +type CommitTestResultListResponseItemsGoalSubtype string + +const ( + CommitTestResultListResponseItemsGoalSubtypeAnomalousColumnCount CommitTestResultListResponseItemsGoalSubtype = "anomalousColumnCount" + CommitTestResultListResponseItemsGoalSubtypeCharacterLength CommitTestResultListResponseItemsGoalSubtype = "characterLength" + CommitTestResultListResponseItemsGoalSubtypeClassImbalanceRatio CommitTestResultListResponseItemsGoalSubtype = "classImbalanceRatio" + CommitTestResultListResponseItemsGoalSubtypeExpectColumnAToBeInColumnB CommitTestResultListResponseItemsGoalSubtype = "expectColumnAToBeInColumnB" + CommitTestResultListResponseItemsGoalSubtypeColumnAverage CommitTestResultListResponseItemsGoalSubtype = "columnAverage" + CommitTestResultListResponseItemsGoalSubtypeColumnDrift CommitTestResultListResponseItemsGoalSubtype = "columnDrift" + CommitTestResultListResponseItemsGoalSubtypeColumnStatistic CommitTestResultListResponseItemsGoalSubtype = "columnStatistic" + CommitTestResultListResponseItemsGoalSubtypeColumnValuesMatch CommitTestResultListResponseItemsGoalSubtype = "columnValuesMatch" + CommitTestResultListResponseItemsGoalSubtypeConflictingLabelRowCount CommitTestResultListResponseItemsGoalSubtype = "conflictingLabelRowCount" + CommitTestResultListResponseItemsGoalSubtypeContainsPii CommitTestResultListResponseItemsGoalSubtype = "containsPii" + CommitTestResultListResponseItemsGoalSubtypeContainsValidURL CommitTestResultListResponseItemsGoalSubtype = "containsValidUrl" + CommitTestResultListResponseItemsGoalSubtypeCorrelatedFeatureCount CommitTestResultListResponseItemsGoalSubtype = "correlatedFeatureCount" + CommitTestResultListResponseItemsGoalSubtypeCustomMetricThreshold CommitTestResultListResponseItemsGoalSubtype = "customMetricThreshold" + CommitTestResultListResponseItemsGoalSubtypeDuplicateRowCount CommitTestResultListResponseItemsGoalSubtype = "duplicateRowCount" + CommitTestResultListResponseItemsGoalSubtypeEmptyFeature CommitTestResultListResponseItemsGoalSubtype = "emptyFeature" + CommitTestResultListResponseItemsGoalSubtypeEmptyFeatureCount CommitTestResultListResponseItemsGoalSubtype = "emptyFeatureCount" + CommitTestResultListResponseItemsGoalSubtypeDriftedFeatureCount CommitTestResultListResponseItemsGoalSubtype = "driftedFeatureCount" + CommitTestResultListResponseItemsGoalSubtypeFeatureMissingValues CommitTestResultListResponseItemsGoalSubtype = "featureMissingValues" + CommitTestResultListResponseItemsGoalSubtypeFeatureValueValidation CommitTestResultListResponseItemsGoalSubtype = "featureValueValidation" + CommitTestResultListResponseItemsGoalSubtypeGreatExpectations CommitTestResultListResponseItemsGoalSubtype = "greatExpectations" + CommitTestResultListResponseItemsGoalSubtypeGroupByColumnStatsCheck CommitTestResultListResponseItemsGoalSubtype = "groupByColumnStatsCheck" + CommitTestResultListResponseItemsGoalSubtypeIllFormedRowCount CommitTestResultListResponseItemsGoalSubtype = "illFormedRowCount" + CommitTestResultListResponseItemsGoalSubtypeIsCode CommitTestResultListResponseItemsGoalSubtype = "isCode" + CommitTestResultListResponseItemsGoalSubtypeIsJson CommitTestResultListResponseItemsGoalSubtype = "isJson" + CommitTestResultListResponseItemsGoalSubtypeLlmRubricThresholdV2 CommitTestResultListResponseItemsGoalSubtype = "llmRubricThresholdV2" + CommitTestResultListResponseItemsGoalSubtypeLabelDrift CommitTestResultListResponseItemsGoalSubtype = "labelDrift" + CommitTestResultListResponseItemsGoalSubtypeMetricThreshold CommitTestResultListResponseItemsGoalSubtype = "metricThreshold" + CommitTestResultListResponseItemsGoalSubtypeNewCategoryCount CommitTestResultListResponseItemsGoalSubtype = "newCategoryCount" + CommitTestResultListResponseItemsGoalSubtypeNewLabelCount CommitTestResultListResponseItemsGoalSubtype = "newLabelCount" + CommitTestResultListResponseItemsGoalSubtypeNullRowCount CommitTestResultListResponseItemsGoalSubtype = "nullRowCount" + CommitTestResultListResponseItemsGoalSubtypeRowCount CommitTestResultListResponseItemsGoalSubtype = "rowCount" + CommitTestResultListResponseItemsGoalSubtypePpScoreValueValidation CommitTestResultListResponseItemsGoalSubtype = "ppScoreValueValidation" + CommitTestResultListResponseItemsGoalSubtypeQuasiConstantFeature CommitTestResultListResponseItemsGoalSubtype = "quasiConstantFeature" + CommitTestResultListResponseItemsGoalSubtypeQuasiConstantFeatureCount CommitTestResultListResponseItemsGoalSubtype = "quasiConstantFeatureCount" + CommitTestResultListResponseItemsGoalSubtypeSqlQuery CommitTestResultListResponseItemsGoalSubtype = "sqlQuery" + CommitTestResultListResponseItemsGoalSubtypeDtypeValidation CommitTestResultListResponseItemsGoalSubtype = "dtypeValidation" + CommitTestResultListResponseItemsGoalSubtypeSentenceLength CommitTestResultListResponseItemsGoalSubtype = "sentenceLength" + CommitTestResultListResponseItemsGoalSubtypeSizeRatio CommitTestResultListResponseItemsGoalSubtype = "sizeRatio" + CommitTestResultListResponseItemsGoalSubtypeSpecialCharactersRatio CommitTestResultListResponseItemsGoalSubtype = "specialCharactersRatio" + CommitTestResultListResponseItemsGoalSubtypeStringValidation CommitTestResultListResponseItemsGoalSubtype = "stringValidation" + CommitTestResultListResponseItemsGoalSubtypeTrainValLeakageRowCount CommitTestResultListResponseItemsGoalSubtype = "trainValLeakageRowCount" +) + +func (r CommitTestResultListResponseItemsGoalSubtype) IsKnown() bool { + switch r { + case CommitTestResultListResponseItemsGoalSubtypeAnomalousColumnCount, CommitTestResultListResponseItemsGoalSubtypeCharacterLength, CommitTestResultListResponseItemsGoalSubtypeClassImbalanceRatio, CommitTestResultListResponseItemsGoalSubtypeExpectColumnAToBeInColumnB, CommitTestResultListResponseItemsGoalSubtypeColumnAverage, CommitTestResultListResponseItemsGoalSubtypeColumnDrift, CommitTestResultListResponseItemsGoalSubtypeColumnStatistic, CommitTestResultListResponseItemsGoalSubtypeColumnValuesMatch, CommitTestResultListResponseItemsGoalSubtypeConflictingLabelRowCount, CommitTestResultListResponseItemsGoalSubtypeContainsPii, CommitTestResultListResponseItemsGoalSubtypeContainsValidURL, CommitTestResultListResponseItemsGoalSubtypeCorrelatedFeatureCount, CommitTestResultListResponseItemsGoalSubtypeCustomMetricThreshold, CommitTestResultListResponseItemsGoalSubtypeDuplicateRowCount, CommitTestResultListResponseItemsGoalSubtypeEmptyFeature, CommitTestResultListResponseItemsGoalSubtypeEmptyFeatureCount, CommitTestResultListResponseItemsGoalSubtypeDriftedFeatureCount, CommitTestResultListResponseItemsGoalSubtypeFeatureMissingValues, CommitTestResultListResponseItemsGoalSubtypeFeatureValueValidation, CommitTestResultListResponseItemsGoalSubtypeGreatExpectations, CommitTestResultListResponseItemsGoalSubtypeGroupByColumnStatsCheck, CommitTestResultListResponseItemsGoalSubtypeIllFormedRowCount, CommitTestResultListResponseItemsGoalSubtypeIsCode, CommitTestResultListResponseItemsGoalSubtypeIsJson, CommitTestResultListResponseItemsGoalSubtypeLlmRubricThresholdV2, CommitTestResultListResponseItemsGoalSubtypeLabelDrift, CommitTestResultListResponseItemsGoalSubtypeMetricThreshold, CommitTestResultListResponseItemsGoalSubtypeNewCategoryCount, CommitTestResultListResponseItemsGoalSubtypeNewLabelCount, CommitTestResultListResponseItemsGoalSubtypeNullRowCount, CommitTestResultListResponseItemsGoalSubtypeRowCount, CommitTestResultListResponseItemsGoalSubtypePpScoreValueValidation, CommitTestResultListResponseItemsGoalSubtypeQuasiConstantFeature, CommitTestResultListResponseItemsGoalSubtypeQuasiConstantFeatureCount, CommitTestResultListResponseItemsGoalSubtypeSqlQuery, CommitTestResultListResponseItemsGoalSubtypeDtypeValidation, CommitTestResultListResponseItemsGoalSubtypeSentenceLength, CommitTestResultListResponseItemsGoalSubtypeSizeRatio, CommitTestResultListResponseItemsGoalSubtypeSpecialCharactersRatio, CommitTestResultListResponseItemsGoalSubtypeStringValidation, CommitTestResultListResponseItemsGoalSubtypeTrainValLeakageRowCount: + return true + } + return false +} + type CommitTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. InsightName string `json:"insightName"` @@ -365,8 +420,25 @@ type CommitTestResultListResponseItemsGoalThresholdsValueArray []string func (r CommitTestResultListResponseItemsGoalThresholdsValueArray) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() { } +// The test type. +type CommitTestResultListResponseItemsGoalType string + +const ( + CommitTestResultListResponseItemsGoalTypeIntegrity CommitTestResultListResponseItemsGoalType = "integrity" + CommitTestResultListResponseItemsGoalTypeConsistency CommitTestResultListResponseItemsGoalType = "consistency" + CommitTestResultListResponseItemsGoalTypePerformance CommitTestResultListResponseItemsGoalType = "performance" +) + +func (r CommitTestResultListResponseItemsGoalType) IsKnown() bool { + switch r { + case CommitTestResultListResponseItemsGoalTypeIntegrity, CommitTestResultListResponseItemsGoalTypeConsistency, CommitTestResultListResponseItemsGoalTypePerformance: + return true + } + return false +} + type CommitTestResultListParams struct { - // Include archived goals. + // Filter for archived tests. IncludeArchived param.Field[bool] `query:"includeArchived"` // The page to return in a paginated query. Page param.Field[int64] `query:"page"` diff --git a/inferencepipelinetestresult.go b/inferencepipelinetestresult.go index 40e6bda..1125cd3 100644 --- a/inferencepipelinetestresult.go +++ b/inferencepipelinetestresult.go @@ -164,12 +164,12 @@ type InferencePipelineTestResultListResponseItemsGoal struct { // The project version (commit) id where the test was created. OriginProjectVersionID string `json:"originProjectVersionId,required,nullable" format:"uuid"` // The test subtype. - Subtype string `json:"subtype,required"` + Subtype InferencePipelineTestResultListResponseItemsGoalSubtype `json:"subtype,required"` // Whether the test is suggested or user-created. Suggested bool `json:"suggested,required"` Thresholds []InferencePipelineTestResultListResponseItemsGoalThreshold `json:"thresholds,required"` // The test type. - Type string `json:"type,required"` + Type InferencePipelineTestResultListResponseItemsGoalType `json:"type,required"` // Whether the test is archived. Archived bool `json:"archived"` // The delay window in seconds. Only applies to tests that use production data. @@ -227,6 +227,61 @@ func (r inferencePipelineTestResultListResponseItemsGoalJSON) RawJSON() string { return r.raw } +// The test subtype. +type InferencePipelineTestResultListResponseItemsGoalSubtype string + +const ( + InferencePipelineTestResultListResponseItemsGoalSubtypeAnomalousColumnCount InferencePipelineTestResultListResponseItemsGoalSubtype = "anomalousColumnCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeCharacterLength InferencePipelineTestResultListResponseItemsGoalSubtype = "characterLength" + InferencePipelineTestResultListResponseItemsGoalSubtypeClassImbalanceRatio InferencePipelineTestResultListResponseItemsGoalSubtype = "classImbalanceRatio" + InferencePipelineTestResultListResponseItemsGoalSubtypeExpectColumnAToBeInColumnB InferencePipelineTestResultListResponseItemsGoalSubtype = "expectColumnAToBeInColumnB" + InferencePipelineTestResultListResponseItemsGoalSubtypeColumnAverage InferencePipelineTestResultListResponseItemsGoalSubtype = "columnAverage" + InferencePipelineTestResultListResponseItemsGoalSubtypeColumnDrift InferencePipelineTestResultListResponseItemsGoalSubtype = "columnDrift" + InferencePipelineTestResultListResponseItemsGoalSubtypeColumnStatistic InferencePipelineTestResultListResponseItemsGoalSubtype = "columnStatistic" + InferencePipelineTestResultListResponseItemsGoalSubtypeColumnValuesMatch InferencePipelineTestResultListResponseItemsGoalSubtype = "columnValuesMatch" + InferencePipelineTestResultListResponseItemsGoalSubtypeConflictingLabelRowCount InferencePipelineTestResultListResponseItemsGoalSubtype = "conflictingLabelRowCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeContainsPii InferencePipelineTestResultListResponseItemsGoalSubtype = "containsPii" + InferencePipelineTestResultListResponseItemsGoalSubtypeContainsValidURL InferencePipelineTestResultListResponseItemsGoalSubtype = "containsValidUrl" + InferencePipelineTestResultListResponseItemsGoalSubtypeCorrelatedFeatureCount InferencePipelineTestResultListResponseItemsGoalSubtype = "correlatedFeatureCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeCustomMetricThreshold InferencePipelineTestResultListResponseItemsGoalSubtype = "customMetricThreshold" + InferencePipelineTestResultListResponseItemsGoalSubtypeDuplicateRowCount InferencePipelineTestResultListResponseItemsGoalSubtype = "duplicateRowCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeEmptyFeature InferencePipelineTestResultListResponseItemsGoalSubtype = "emptyFeature" + InferencePipelineTestResultListResponseItemsGoalSubtypeEmptyFeatureCount InferencePipelineTestResultListResponseItemsGoalSubtype = "emptyFeatureCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeDriftedFeatureCount InferencePipelineTestResultListResponseItemsGoalSubtype = "driftedFeatureCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeFeatureMissingValues InferencePipelineTestResultListResponseItemsGoalSubtype = "featureMissingValues" + InferencePipelineTestResultListResponseItemsGoalSubtypeFeatureValueValidation InferencePipelineTestResultListResponseItemsGoalSubtype = "featureValueValidation" + InferencePipelineTestResultListResponseItemsGoalSubtypeGreatExpectations InferencePipelineTestResultListResponseItemsGoalSubtype = "greatExpectations" + InferencePipelineTestResultListResponseItemsGoalSubtypeGroupByColumnStatsCheck InferencePipelineTestResultListResponseItemsGoalSubtype = "groupByColumnStatsCheck" + InferencePipelineTestResultListResponseItemsGoalSubtypeIllFormedRowCount InferencePipelineTestResultListResponseItemsGoalSubtype = "illFormedRowCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeIsCode InferencePipelineTestResultListResponseItemsGoalSubtype = "isCode" + InferencePipelineTestResultListResponseItemsGoalSubtypeIsJson InferencePipelineTestResultListResponseItemsGoalSubtype = "isJson" + InferencePipelineTestResultListResponseItemsGoalSubtypeLlmRubricThresholdV2 InferencePipelineTestResultListResponseItemsGoalSubtype = "llmRubricThresholdV2" + InferencePipelineTestResultListResponseItemsGoalSubtypeLabelDrift InferencePipelineTestResultListResponseItemsGoalSubtype = "labelDrift" + InferencePipelineTestResultListResponseItemsGoalSubtypeMetricThreshold InferencePipelineTestResultListResponseItemsGoalSubtype = "metricThreshold" + InferencePipelineTestResultListResponseItemsGoalSubtypeNewCategoryCount InferencePipelineTestResultListResponseItemsGoalSubtype = "newCategoryCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeNewLabelCount InferencePipelineTestResultListResponseItemsGoalSubtype = "newLabelCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeNullRowCount InferencePipelineTestResultListResponseItemsGoalSubtype = "nullRowCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeRowCount InferencePipelineTestResultListResponseItemsGoalSubtype = "rowCount" + InferencePipelineTestResultListResponseItemsGoalSubtypePpScoreValueValidation InferencePipelineTestResultListResponseItemsGoalSubtype = "ppScoreValueValidation" + InferencePipelineTestResultListResponseItemsGoalSubtypeQuasiConstantFeature InferencePipelineTestResultListResponseItemsGoalSubtype = "quasiConstantFeature" + InferencePipelineTestResultListResponseItemsGoalSubtypeQuasiConstantFeatureCount InferencePipelineTestResultListResponseItemsGoalSubtype = "quasiConstantFeatureCount" + InferencePipelineTestResultListResponseItemsGoalSubtypeSqlQuery InferencePipelineTestResultListResponseItemsGoalSubtype = "sqlQuery" + InferencePipelineTestResultListResponseItemsGoalSubtypeDtypeValidation InferencePipelineTestResultListResponseItemsGoalSubtype = "dtypeValidation" + InferencePipelineTestResultListResponseItemsGoalSubtypeSentenceLength InferencePipelineTestResultListResponseItemsGoalSubtype = "sentenceLength" + InferencePipelineTestResultListResponseItemsGoalSubtypeSizeRatio InferencePipelineTestResultListResponseItemsGoalSubtype = "sizeRatio" + InferencePipelineTestResultListResponseItemsGoalSubtypeSpecialCharactersRatio InferencePipelineTestResultListResponseItemsGoalSubtype = "specialCharactersRatio" + InferencePipelineTestResultListResponseItemsGoalSubtypeStringValidation InferencePipelineTestResultListResponseItemsGoalSubtype = "stringValidation" + InferencePipelineTestResultListResponseItemsGoalSubtypeTrainValLeakageRowCount InferencePipelineTestResultListResponseItemsGoalSubtype = "trainValLeakageRowCount" +) + +func (r InferencePipelineTestResultListResponseItemsGoalSubtype) IsKnown() bool { + switch r { + case InferencePipelineTestResultListResponseItemsGoalSubtypeAnomalousColumnCount, InferencePipelineTestResultListResponseItemsGoalSubtypeCharacterLength, InferencePipelineTestResultListResponseItemsGoalSubtypeClassImbalanceRatio, InferencePipelineTestResultListResponseItemsGoalSubtypeExpectColumnAToBeInColumnB, InferencePipelineTestResultListResponseItemsGoalSubtypeColumnAverage, InferencePipelineTestResultListResponseItemsGoalSubtypeColumnDrift, InferencePipelineTestResultListResponseItemsGoalSubtypeColumnStatistic, InferencePipelineTestResultListResponseItemsGoalSubtypeColumnValuesMatch, InferencePipelineTestResultListResponseItemsGoalSubtypeConflictingLabelRowCount, InferencePipelineTestResultListResponseItemsGoalSubtypeContainsPii, InferencePipelineTestResultListResponseItemsGoalSubtypeContainsValidURL, InferencePipelineTestResultListResponseItemsGoalSubtypeCorrelatedFeatureCount, InferencePipelineTestResultListResponseItemsGoalSubtypeCustomMetricThreshold, InferencePipelineTestResultListResponseItemsGoalSubtypeDuplicateRowCount, InferencePipelineTestResultListResponseItemsGoalSubtypeEmptyFeature, InferencePipelineTestResultListResponseItemsGoalSubtypeEmptyFeatureCount, InferencePipelineTestResultListResponseItemsGoalSubtypeDriftedFeatureCount, InferencePipelineTestResultListResponseItemsGoalSubtypeFeatureMissingValues, InferencePipelineTestResultListResponseItemsGoalSubtypeFeatureValueValidation, InferencePipelineTestResultListResponseItemsGoalSubtypeGreatExpectations, InferencePipelineTestResultListResponseItemsGoalSubtypeGroupByColumnStatsCheck, InferencePipelineTestResultListResponseItemsGoalSubtypeIllFormedRowCount, InferencePipelineTestResultListResponseItemsGoalSubtypeIsCode, InferencePipelineTestResultListResponseItemsGoalSubtypeIsJson, InferencePipelineTestResultListResponseItemsGoalSubtypeLlmRubricThresholdV2, InferencePipelineTestResultListResponseItemsGoalSubtypeLabelDrift, InferencePipelineTestResultListResponseItemsGoalSubtypeMetricThreshold, InferencePipelineTestResultListResponseItemsGoalSubtypeNewCategoryCount, InferencePipelineTestResultListResponseItemsGoalSubtypeNewLabelCount, InferencePipelineTestResultListResponseItemsGoalSubtypeNullRowCount, InferencePipelineTestResultListResponseItemsGoalSubtypeRowCount, InferencePipelineTestResultListResponseItemsGoalSubtypePpScoreValueValidation, InferencePipelineTestResultListResponseItemsGoalSubtypeQuasiConstantFeature, InferencePipelineTestResultListResponseItemsGoalSubtypeQuasiConstantFeatureCount, InferencePipelineTestResultListResponseItemsGoalSubtypeSqlQuery, InferencePipelineTestResultListResponseItemsGoalSubtypeDtypeValidation, InferencePipelineTestResultListResponseItemsGoalSubtypeSentenceLength, InferencePipelineTestResultListResponseItemsGoalSubtypeSizeRatio, InferencePipelineTestResultListResponseItemsGoalSubtypeSpecialCharactersRatio, InferencePipelineTestResultListResponseItemsGoalSubtypeStringValidation, InferencePipelineTestResultListResponseItemsGoalSubtypeTrainValLeakageRowCount: + return true + } + return false +} + type InferencePipelineTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. InsightName string `json:"insightName"` @@ -366,6 +421,23 @@ type InferencePipelineTestResultListResponseItemsGoalThresholdsValueArray []stri func (r InferencePipelineTestResultListResponseItemsGoalThresholdsValueArray) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() { } +// The test type. +type InferencePipelineTestResultListResponseItemsGoalType string + +const ( + InferencePipelineTestResultListResponseItemsGoalTypeIntegrity InferencePipelineTestResultListResponseItemsGoalType = "integrity" + InferencePipelineTestResultListResponseItemsGoalTypeConsistency InferencePipelineTestResultListResponseItemsGoalType = "consistency" + InferencePipelineTestResultListResponseItemsGoalTypePerformance InferencePipelineTestResultListResponseItemsGoalType = "performance" +) + +func (r InferencePipelineTestResultListResponseItemsGoalType) IsKnown() bool { + switch r { + case InferencePipelineTestResultListResponseItemsGoalTypeIntegrity, InferencePipelineTestResultListResponseItemsGoalTypeConsistency, InferencePipelineTestResultListResponseItemsGoalTypePerformance: + return true + } + return false +} + type InferencePipelineTestResultListParams struct { // The page to return in a paginated query. Page param.Field[int64] `query:"page"` diff --git a/projecttest.go b/projecttest.go index ecf1285..3d046ee 100644 --- a/projecttest.go +++ b/projecttest.go @@ -71,12 +71,12 @@ type ProjectTestNewResponse struct { // The project version (commit) id where the test was created. OriginProjectVersionID string `json:"originProjectVersionId,required,nullable" format:"uuid"` // The test subtype. - Subtype string `json:"subtype,required"` + Subtype ProjectTestNewResponseSubtype `json:"subtype,required"` // Whether the test is suggested or user-created. Suggested bool `json:"suggested,required"` Thresholds []ProjectTestNewResponseThreshold `json:"thresholds,required"` // The test type. - Type string `json:"type,required"` + Type ProjectTestNewResponseType `json:"type,required"` // Whether the test is archived. Archived bool `json:"archived"` // The delay window in seconds. Only applies to tests that use production data. @@ -134,6 +134,61 @@ func (r projectTestNewResponseJSON) RawJSON() string { return r.raw } +// The test subtype. +type ProjectTestNewResponseSubtype string + +const ( + ProjectTestNewResponseSubtypeAnomalousColumnCount ProjectTestNewResponseSubtype = "anomalousColumnCount" + ProjectTestNewResponseSubtypeCharacterLength ProjectTestNewResponseSubtype = "characterLength" + ProjectTestNewResponseSubtypeClassImbalanceRatio ProjectTestNewResponseSubtype = "classImbalanceRatio" + ProjectTestNewResponseSubtypeExpectColumnAToBeInColumnB ProjectTestNewResponseSubtype = "expectColumnAToBeInColumnB" + ProjectTestNewResponseSubtypeColumnAverage ProjectTestNewResponseSubtype = "columnAverage" + ProjectTestNewResponseSubtypeColumnDrift ProjectTestNewResponseSubtype = "columnDrift" + ProjectTestNewResponseSubtypeColumnStatistic ProjectTestNewResponseSubtype = "columnStatistic" + ProjectTestNewResponseSubtypeColumnValuesMatch ProjectTestNewResponseSubtype = "columnValuesMatch" + ProjectTestNewResponseSubtypeConflictingLabelRowCount ProjectTestNewResponseSubtype = "conflictingLabelRowCount" + ProjectTestNewResponseSubtypeContainsPii ProjectTestNewResponseSubtype = "containsPii" + ProjectTestNewResponseSubtypeContainsValidURL ProjectTestNewResponseSubtype = "containsValidUrl" + ProjectTestNewResponseSubtypeCorrelatedFeatureCount ProjectTestNewResponseSubtype = "correlatedFeatureCount" + ProjectTestNewResponseSubtypeCustomMetricThreshold ProjectTestNewResponseSubtype = "customMetricThreshold" + ProjectTestNewResponseSubtypeDuplicateRowCount ProjectTestNewResponseSubtype = "duplicateRowCount" + ProjectTestNewResponseSubtypeEmptyFeature ProjectTestNewResponseSubtype = "emptyFeature" + ProjectTestNewResponseSubtypeEmptyFeatureCount ProjectTestNewResponseSubtype = "emptyFeatureCount" + ProjectTestNewResponseSubtypeDriftedFeatureCount ProjectTestNewResponseSubtype = "driftedFeatureCount" + ProjectTestNewResponseSubtypeFeatureMissingValues ProjectTestNewResponseSubtype = "featureMissingValues" + ProjectTestNewResponseSubtypeFeatureValueValidation ProjectTestNewResponseSubtype = "featureValueValidation" + ProjectTestNewResponseSubtypeGreatExpectations ProjectTestNewResponseSubtype = "greatExpectations" + ProjectTestNewResponseSubtypeGroupByColumnStatsCheck ProjectTestNewResponseSubtype = "groupByColumnStatsCheck" + ProjectTestNewResponseSubtypeIllFormedRowCount ProjectTestNewResponseSubtype = "illFormedRowCount" + ProjectTestNewResponseSubtypeIsCode ProjectTestNewResponseSubtype = "isCode" + ProjectTestNewResponseSubtypeIsJson ProjectTestNewResponseSubtype = "isJson" + ProjectTestNewResponseSubtypeLlmRubricThresholdV2 ProjectTestNewResponseSubtype = "llmRubricThresholdV2" + ProjectTestNewResponseSubtypeLabelDrift ProjectTestNewResponseSubtype = "labelDrift" + ProjectTestNewResponseSubtypeMetricThreshold ProjectTestNewResponseSubtype = "metricThreshold" + ProjectTestNewResponseSubtypeNewCategoryCount ProjectTestNewResponseSubtype = "newCategoryCount" + ProjectTestNewResponseSubtypeNewLabelCount ProjectTestNewResponseSubtype = "newLabelCount" + ProjectTestNewResponseSubtypeNullRowCount ProjectTestNewResponseSubtype = "nullRowCount" + ProjectTestNewResponseSubtypeRowCount ProjectTestNewResponseSubtype = "rowCount" + ProjectTestNewResponseSubtypePpScoreValueValidation ProjectTestNewResponseSubtype = "ppScoreValueValidation" + ProjectTestNewResponseSubtypeQuasiConstantFeature ProjectTestNewResponseSubtype = "quasiConstantFeature" + ProjectTestNewResponseSubtypeQuasiConstantFeatureCount ProjectTestNewResponseSubtype = "quasiConstantFeatureCount" + ProjectTestNewResponseSubtypeSqlQuery ProjectTestNewResponseSubtype = "sqlQuery" + ProjectTestNewResponseSubtypeDtypeValidation ProjectTestNewResponseSubtype = "dtypeValidation" + ProjectTestNewResponseSubtypeSentenceLength ProjectTestNewResponseSubtype = "sentenceLength" + ProjectTestNewResponseSubtypeSizeRatio ProjectTestNewResponseSubtype = "sizeRatio" + ProjectTestNewResponseSubtypeSpecialCharactersRatio ProjectTestNewResponseSubtype = "specialCharactersRatio" + ProjectTestNewResponseSubtypeStringValidation ProjectTestNewResponseSubtype = "stringValidation" + ProjectTestNewResponseSubtypeTrainValLeakageRowCount ProjectTestNewResponseSubtype = "trainValLeakageRowCount" +) + +func (r ProjectTestNewResponseSubtype) IsKnown() bool { + switch r { + case ProjectTestNewResponseSubtypeAnomalousColumnCount, ProjectTestNewResponseSubtypeCharacterLength, ProjectTestNewResponseSubtypeClassImbalanceRatio, ProjectTestNewResponseSubtypeExpectColumnAToBeInColumnB, ProjectTestNewResponseSubtypeColumnAverage, ProjectTestNewResponseSubtypeColumnDrift, ProjectTestNewResponseSubtypeColumnStatistic, ProjectTestNewResponseSubtypeColumnValuesMatch, ProjectTestNewResponseSubtypeConflictingLabelRowCount, ProjectTestNewResponseSubtypeContainsPii, ProjectTestNewResponseSubtypeContainsValidURL, ProjectTestNewResponseSubtypeCorrelatedFeatureCount, ProjectTestNewResponseSubtypeCustomMetricThreshold, ProjectTestNewResponseSubtypeDuplicateRowCount, ProjectTestNewResponseSubtypeEmptyFeature, ProjectTestNewResponseSubtypeEmptyFeatureCount, ProjectTestNewResponseSubtypeDriftedFeatureCount, ProjectTestNewResponseSubtypeFeatureMissingValues, ProjectTestNewResponseSubtypeFeatureValueValidation, ProjectTestNewResponseSubtypeGreatExpectations, ProjectTestNewResponseSubtypeGroupByColumnStatsCheck, ProjectTestNewResponseSubtypeIllFormedRowCount, ProjectTestNewResponseSubtypeIsCode, ProjectTestNewResponseSubtypeIsJson, ProjectTestNewResponseSubtypeLlmRubricThresholdV2, ProjectTestNewResponseSubtypeLabelDrift, ProjectTestNewResponseSubtypeMetricThreshold, ProjectTestNewResponseSubtypeNewCategoryCount, ProjectTestNewResponseSubtypeNewLabelCount, ProjectTestNewResponseSubtypeNullRowCount, ProjectTestNewResponseSubtypeRowCount, ProjectTestNewResponseSubtypePpScoreValueValidation, ProjectTestNewResponseSubtypeQuasiConstantFeature, ProjectTestNewResponseSubtypeQuasiConstantFeatureCount, ProjectTestNewResponseSubtypeSqlQuery, ProjectTestNewResponseSubtypeDtypeValidation, ProjectTestNewResponseSubtypeSentenceLength, ProjectTestNewResponseSubtypeSizeRatio, ProjectTestNewResponseSubtypeSpecialCharactersRatio, ProjectTestNewResponseSubtypeStringValidation, ProjectTestNewResponseSubtypeTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestNewResponseThreshold struct { // The insight name to be evaluated. InsightName string `json:"insightName"` @@ -271,16 +326,33 @@ type ProjectTestNewResponseThresholdsValueArray []string func (r ProjectTestNewResponseThresholdsValueArray) ImplementsProjectTestNewResponseThresholdsValueUnion() { } +// The test type. +type ProjectTestNewResponseType string + +const ( + ProjectTestNewResponseTypeIntegrity ProjectTestNewResponseType = "integrity" + ProjectTestNewResponseTypeConsistency ProjectTestNewResponseType = "consistency" + ProjectTestNewResponseTypePerformance ProjectTestNewResponseType = "performance" +) + +func (r ProjectTestNewResponseType) IsKnown() bool { + switch r { + case ProjectTestNewResponseTypeIntegrity, ProjectTestNewResponseTypeConsistency, ProjectTestNewResponseTypePerformance: + return true + } + return false +} + type ProjectTestNewParams struct { // The test description. Description param.Field[interface{}] `json:"description,required"` // The test name. Name param.Field[string] `json:"name,required"` // The test subtype. - Subtype param.Field[string] `json:"subtype,required"` + Subtype param.Field[ProjectTestNewParamsSubtype] `json:"subtype,required"` Thresholds param.Field[[]ProjectTestNewParamsThreshold] `json:"thresholds,required"` // The test type. - Type param.Field[string] `json:"type,required"` + Type param.Field[ProjectTestNewParamsType] `json:"type,required"` // Whether the test is archived. Archived param.Field[bool] `json:"archived"` // The delay window in seconds. Only applies to tests that use production data. @@ -304,6 +376,61 @@ func (r ProjectTestNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// The test subtype. +type ProjectTestNewParamsSubtype string + +const ( + ProjectTestNewParamsSubtypeAnomalousColumnCount ProjectTestNewParamsSubtype = "anomalousColumnCount" + ProjectTestNewParamsSubtypeCharacterLength ProjectTestNewParamsSubtype = "characterLength" + ProjectTestNewParamsSubtypeClassImbalanceRatio ProjectTestNewParamsSubtype = "classImbalanceRatio" + ProjectTestNewParamsSubtypeExpectColumnAToBeInColumnB ProjectTestNewParamsSubtype = "expectColumnAToBeInColumnB" + ProjectTestNewParamsSubtypeColumnAverage ProjectTestNewParamsSubtype = "columnAverage" + ProjectTestNewParamsSubtypeColumnDrift ProjectTestNewParamsSubtype = "columnDrift" + ProjectTestNewParamsSubtypeColumnStatistic ProjectTestNewParamsSubtype = "columnStatistic" + ProjectTestNewParamsSubtypeColumnValuesMatch ProjectTestNewParamsSubtype = "columnValuesMatch" + ProjectTestNewParamsSubtypeConflictingLabelRowCount ProjectTestNewParamsSubtype = "conflictingLabelRowCount" + ProjectTestNewParamsSubtypeContainsPii ProjectTestNewParamsSubtype = "containsPii" + ProjectTestNewParamsSubtypeContainsValidURL ProjectTestNewParamsSubtype = "containsValidUrl" + ProjectTestNewParamsSubtypeCorrelatedFeatureCount ProjectTestNewParamsSubtype = "correlatedFeatureCount" + ProjectTestNewParamsSubtypeCustomMetricThreshold ProjectTestNewParamsSubtype = "customMetricThreshold" + ProjectTestNewParamsSubtypeDuplicateRowCount ProjectTestNewParamsSubtype = "duplicateRowCount" + ProjectTestNewParamsSubtypeEmptyFeature ProjectTestNewParamsSubtype = "emptyFeature" + ProjectTestNewParamsSubtypeEmptyFeatureCount ProjectTestNewParamsSubtype = "emptyFeatureCount" + ProjectTestNewParamsSubtypeDriftedFeatureCount ProjectTestNewParamsSubtype = "driftedFeatureCount" + ProjectTestNewParamsSubtypeFeatureMissingValues ProjectTestNewParamsSubtype = "featureMissingValues" + ProjectTestNewParamsSubtypeFeatureValueValidation ProjectTestNewParamsSubtype = "featureValueValidation" + ProjectTestNewParamsSubtypeGreatExpectations ProjectTestNewParamsSubtype = "greatExpectations" + ProjectTestNewParamsSubtypeGroupByColumnStatsCheck ProjectTestNewParamsSubtype = "groupByColumnStatsCheck" + ProjectTestNewParamsSubtypeIllFormedRowCount ProjectTestNewParamsSubtype = "illFormedRowCount" + ProjectTestNewParamsSubtypeIsCode ProjectTestNewParamsSubtype = "isCode" + ProjectTestNewParamsSubtypeIsJson ProjectTestNewParamsSubtype = "isJson" + ProjectTestNewParamsSubtypeLlmRubricThresholdV2 ProjectTestNewParamsSubtype = "llmRubricThresholdV2" + ProjectTestNewParamsSubtypeLabelDrift ProjectTestNewParamsSubtype = "labelDrift" + ProjectTestNewParamsSubtypeMetricThreshold ProjectTestNewParamsSubtype = "metricThreshold" + ProjectTestNewParamsSubtypeNewCategoryCount ProjectTestNewParamsSubtype = "newCategoryCount" + ProjectTestNewParamsSubtypeNewLabelCount ProjectTestNewParamsSubtype = "newLabelCount" + ProjectTestNewParamsSubtypeNullRowCount ProjectTestNewParamsSubtype = "nullRowCount" + ProjectTestNewParamsSubtypeRowCount ProjectTestNewParamsSubtype = "rowCount" + ProjectTestNewParamsSubtypePpScoreValueValidation ProjectTestNewParamsSubtype = "ppScoreValueValidation" + ProjectTestNewParamsSubtypeQuasiConstantFeature ProjectTestNewParamsSubtype = "quasiConstantFeature" + ProjectTestNewParamsSubtypeQuasiConstantFeatureCount ProjectTestNewParamsSubtype = "quasiConstantFeatureCount" + ProjectTestNewParamsSubtypeSqlQuery ProjectTestNewParamsSubtype = "sqlQuery" + ProjectTestNewParamsSubtypeDtypeValidation ProjectTestNewParamsSubtype = "dtypeValidation" + ProjectTestNewParamsSubtypeSentenceLength ProjectTestNewParamsSubtype = "sentenceLength" + ProjectTestNewParamsSubtypeSizeRatio ProjectTestNewParamsSubtype = "sizeRatio" + ProjectTestNewParamsSubtypeSpecialCharactersRatio ProjectTestNewParamsSubtype = "specialCharactersRatio" + ProjectTestNewParamsSubtypeStringValidation ProjectTestNewParamsSubtype = "stringValidation" + ProjectTestNewParamsSubtypeTrainValLeakageRowCount ProjectTestNewParamsSubtype = "trainValLeakageRowCount" +) + +func (r ProjectTestNewParamsSubtype) IsKnown() bool { + switch r { + case ProjectTestNewParamsSubtypeAnomalousColumnCount, ProjectTestNewParamsSubtypeCharacterLength, ProjectTestNewParamsSubtypeClassImbalanceRatio, ProjectTestNewParamsSubtypeExpectColumnAToBeInColumnB, ProjectTestNewParamsSubtypeColumnAverage, ProjectTestNewParamsSubtypeColumnDrift, ProjectTestNewParamsSubtypeColumnStatistic, ProjectTestNewParamsSubtypeColumnValuesMatch, ProjectTestNewParamsSubtypeConflictingLabelRowCount, ProjectTestNewParamsSubtypeContainsPii, ProjectTestNewParamsSubtypeContainsValidURL, ProjectTestNewParamsSubtypeCorrelatedFeatureCount, ProjectTestNewParamsSubtypeCustomMetricThreshold, ProjectTestNewParamsSubtypeDuplicateRowCount, ProjectTestNewParamsSubtypeEmptyFeature, ProjectTestNewParamsSubtypeEmptyFeatureCount, ProjectTestNewParamsSubtypeDriftedFeatureCount, ProjectTestNewParamsSubtypeFeatureMissingValues, ProjectTestNewParamsSubtypeFeatureValueValidation, ProjectTestNewParamsSubtypeGreatExpectations, ProjectTestNewParamsSubtypeGroupByColumnStatsCheck, ProjectTestNewParamsSubtypeIllFormedRowCount, ProjectTestNewParamsSubtypeIsCode, ProjectTestNewParamsSubtypeIsJson, ProjectTestNewParamsSubtypeLlmRubricThresholdV2, ProjectTestNewParamsSubtypeLabelDrift, ProjectTestNewParamsSubtypeMetricThreshold, ProjectTestNewParamsSubtypeNewCategoryCount, ProjectTestNewParamsSubtypeNewLabelCount, ProjectTestNewParamsSubtypeNullRowCount, ProjectTestNewParamsSubtypeRowCount, ProjectTestNewParamsSubtypePpScoreValueValidation, ProjectTestNewParamsSubtypeQuasiConstantFeature, ProjectTestNewParamsSubtypeQuasiConstantFeatureCount, ProjectTestNewParamsSubtypeSqlQuery, ProjectTestNewParamsSubtypeDtypeValidation, ProjectTestNewParamsSubtypeSentenceLength, ProjectTestNewParamsSubtypeSizeRatio, ProjectTestNewParamsSubtypeSpecialCharactersRatio, ProjectTestNewParamsSubtypeStringValidation, ProjectTestNewParamsSubtypeTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestNewParamsThreshold struct { // The insight name to be evaluated. InsightName param.Field[string] `json:"insightName"` @@ -381,3 +508,20 @@ type ProjectTestNewParamsThresholdsValueArray []string func (r ProjectTestNewParamsThresholdsValueArray) ImplementsProjectTestNewParamsThresholdsValueUnion() { } + +// The test type. +type ProjectTestNewParamsType string + +const ( + ProjectTestNewParamsTypeIntegrity ProjectTestNewParamsType = "integrity" + ProjectTestNewParamsTypeConsistency ProjectTestNewParamsType = "consistency" + ProjectTestNewParamsTypePerformance ProjectTestNewParamsType = "performance" +) + +func (r ProjectTestNewParamsType) IsKnown() bool { + switch r { + case ProjectTestNewParamsTypeIntegrity, ProjectTestNewParamsTypeConsistency, ProjectTestNewParamsTypePerformance: + return true + } + return false +} diff --git a/projecttest_test.go b/projecttest_test.go index 623a9b9..8a888bd 100644 --- a/projecttest_test.go +++ b/projecttest_test.go @@ -32,7 +32,7 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { openlayer.ProjectTestNewParams{ Description: openlayer.F[any]("This test checks for duplicate rows in the dataset."), Name: openlayer.F("No duplicate rows"), - Subtype: openlayer.F("duplicateRowCount"), + Subtype: openlayer.F(openlayer.ProjectTestNewParamsSubtypeDuplicateRowCount), Thresholds: openlayer.F([]openlayer.ProjectTestNewParamsThreshold{{ InsightName: openlayer.F("duplicateRowCount"), InsightParameters: openlayer.F([]openlayer.ProjectTestNewParamsThresholdsInsightParameter{{ @@ -44,7 +44,7 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { ThresholdMode: openlayer.F(openlayer.ProjectTestNewParamsThresholdsThresholdModeAutomatic), Value: openlayer.F[openlayer.ProjectTestNewParamsThresholdsValueUnion](shared.UnionFloat(0.000000)), }}), - Type: openlayer.F("integrity"), + Type: openlayer.F(openlayer.ProjectTestNewParamsTypeIntegrity), Archived: openlayer.F(false), DelayWindow: openlayer.F(0.000000), EvaluationWindow: openlayer.F(3600.000000), From 7ac3c6ccac9752d807519538a54b0afe223154fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:11:01 +0000 Subject: [PATCH 17/26] feat(api): expose test retrieval endpoint --- .stats.yml | 4 +- api.md | 2 + projecttest.go | 408 ++++++++++++++++++++++++++++++++++++++++++++ projecttest_test.go | 34 ++++ shared/union.go | 3 + 5 files changed, 449 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 00b73d5..1dee804 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 16 +configured_endpoints: 17 openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 -config_hash: 0383360784fc87d799bad2be203142b5 +config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/api.md b/api.md index 35dc109..7d888a4 100644 --- a/api.md +++ b/api.md @@ -39,10 +39,12 @@ Methods: Response Types: - openlayer.ProjectTestNewResponse +- openlayer.ProjectTestListResponse Methods: - client.Projects.Tests.New(ctx context.Context, projectID string, body openlayer.ProjectTestNewParams) (openlayer.ProjectTestNewResponse, error) +- client.Projects.Tests.List(ctx context.Context, projectID string, query openlayer.ProjectTestListParams) (openlayer.ProjectTestListResponse, error) # Commits diff --git a/projecttest.go b/projecttest.go index 3d046ee..4e96534 100644 --- a/projecttest.go +++ b/projecttest.go @@ -7,10 +7,12 @@ import ( "errors" "fmt" "net/http" + "net/url" "reflect" "time" "github.com/openlayer-ai/openlayer-go/internal/apijson" + "github.com/openlayer-ai/openlayer-go/internal/apiquery" "github.com/openlayer-ai/openlayer-go/internal/param" "github.com/openlayer-ai/openlayer-go/internal/requestconfig" "github.com/openlayer-ai/openlayer-go/option" @@ -49,6 +51,18 @@ func (r *ProjectTestService) New(ctx context.Context, projectID string, body Pro return } +// List tests under a project. +func (r *ProjectTestService) List(ctx context.Context, projectID string, query ProjectTestListParams, opts ...option.RequestOption) (res *ProjectTestListResponse, err error) { + opts = append(r.Options[:], opts...) + if projectID == "" { + err = errors.New("missing required projectId parameter") + return + } + path := fmt.Sprintf("projects/%s/tests", projectID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) + return +} + type ProjectTestNewResponse struct { // The test id. ID string `json:"id,required" format:"uuid"` @@ -343,6 +357,354 @@ func (r ProjectTestNewResponseType) IsKnown() bool { return false } +type ProjectTestListResponse struct { + Meta ProjectTestListResponse_Meta `json:"_meta,required"` + Items []ProjectTestListResponseItem `json:"items,required"` + JSON projectTestListResponseJSON `json:"-"` +} + +// projectTestListResponseJSON contains the JSON metadata for the struct +// [ProjectTestListResponse] +type projectTestListResponseJSON struct { + Meta apijson.Field + Items apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseJSON) RawJSON() string { + return r.raw +} + +type ProjectTestListResponse_Meta struct { + // The current page. + Page int64 `json:"page,required"` + // The number of items per page. + PerPage int64 `json:"perPage,required"` + // The total number of items. + TotalItems int64 `json:"totalItems,required"` + // The total number of pages. + TotalPages int64 `json:"totalPages,required"` + JSON projectTestListResponseMetaJSON `json:"-"` +} + +// projectTestListResponseMetaJSON contains the JSON metadata for the struct +// [ProjectTestListResponse_Meta] +type projectTestListResponseMetaJSON struct { + Page apijson.Field + PerPage apijson.Field + TotalItems apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponse_Meta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseMetaJSON) RawJSON() string { + return r.raw +} + +type ProjectTestListResponseItem struct { + // The test id. + ID string `json:"id,required" format:"uuid"` + // The number of comments on the test. + CommentCount int64 `json:"commentCount,required"` + // The test creator id. + CreatorID string `json:"creatorId,required,nullable" format:"uuid"` + // The date the test was archived. + DateArchived time.Time `json:"dateArchived,required,nullable" format:"date-time"` + // The creation date. + DateCreated time.Time `json:"dateCreated,required" format:"date-time"` + // The last updated date. + DateUpdated time.Time `json:"dateUpdated,required" format:"date-time"` + // The test description. + Description interface{} `json:"description,required,nullable"` + // The test name. + Name string `json:"name,required"` + // The test number. + Number int64 `json:"number,required"` + // The project version (commit) id where the test was created. + OriginProjectVersionID string `json:"originProjectVersionId,required,nullable" format:"uuid"` + // The test subtype. + Subtype ProjectTestListResponseItemsSubtype `json:"subtype,required"` + // Whether the test is suggested or user-created. + Suggested bool `json:"suggested,required"` + Thresholds []ProjectTestListResponseItemsThreshold `json:"thresholds,required"` + // The test type. + Type ProjectTestListResponseItemsType `json:"type,required"` + // Whether the test is archived. + Archived bool `json:"archived"` + // The delay window in seconds. Only applies to tests that use production data. + DelayWindow float64 `json:"delayWindow,nullable"` + // The evaluation window in seconds. Only applies to tests that use production + // data. + EvaluationWindow float64 `json:"evaluationWindow,nullable"` + // Whether the test uses an ML model. + UsesMlModel bool `json:"usesMlModel"` + // Whether the test uses production data (monitoring mode only). + UsesProductionData bool `json:"usesProductionData"` + // Whether the test uses a reference dataset (monitoring mode only). + UsesReferenceDataset bool `json:"usesReferenceDataset"` + // Whether the test uses a training dataset. + UsesTrainingDataset bool `json:"usesTrainingDataset"` + // Whether the test uses a validation dataset. + UsesValidationDataset bool `json:"usesValidationDataset"` + JSON projectTestListResponseItemJSON `json:"-"` +} + +// projectTestListResponseItemJSON contains the JSON metadata for the struct +// [ProjectTestListResponseItem] +type projectTestListResponseItemJSON struct { + ID apijson.Field + CommentCount apijson.Field + CreatorID apijson.Field + DateArchived apijson.Field + DateCreated apijson.Field + DateUpdated apijson.Field + Description apijson.Field + Name apijson.Field + Number apijson.Field + OriginProjectVersionID apijson.Field + Subtype apijson.Field + Suggested apijson.Field + Thresholds apijson.Field + Type apijson.Field + Archived apijson.Field + DelayWindow apijson.Field + EvaluationWindow apijson.Field + UsesMlModel apijson.Field + UsesProductionData apijson.Field + UsesReferenceDataset apijson.Field + UsesTrainingDataset apijson.Field + UsesValidationDataset apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponseItem) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseItemJSON) RawJSON() string { + return r.raw +} + +// The test subtype. +type ProjectTestListResponseItemsSubtype string + +const ( + ProjectTestListResponseItemsSubtypeAnomalousColumnCount ProjectTestListResponseItemsSubtype = "anomalousColumnCount" + ProjectTestListResponseItemsSubtypeCharacterLength ProjectTestListResponseItemsSubtype = "characterLength" + ProjectTestListResponseItemsSubtypeClassImbalanceRatio ProjectTestListResponseItemsSubtype = "classImbalanceRatio" + ProjectTestListResponseItemsSubtypeExpectColumnAToBeInColumnB ProjectTestListResponseItemsSubtype = "expectColumnAToBeInColumnB" + ProjectTestListResponseItemsSubtypeColumnAverage ProjectTestListResponseItemsSubtype = "columnAverage" + ProjectTestListResponseItemsSubtypeColumnDrift ProjectTestListResponseItemsSubtype = "columnDrift" + ProjectTestListResponseItemsSubtypeColumnStatistic ProjectTestListResponseItemsSubtype = "columnStatistic" + ProjectTestListResponseItemsSubtypeColumnValuesMatch ProjectTestListResponseItemsSubtype = "columnValuesMatch" + ProjectTestListResponseItemsSubtypeConflictingLabelRowCount ProjectTestListResponseItemsSubtype = "conflictingLabelRowCount" + ProjectTestListResponseItemsSubtypeContainsPii ProjectTestListResponseItemsSubtype = "containsPii" + ProjectTestListResponseItemsSubtypeContainsValidURL ProjectTestListResponseItemsSubtype = "containsValidUrl" + ProjectTestListResponseItemsSubtypeCorrelatedFeatureCount ProjectTestListResponseItemsSubtype = "correlatedFeatureCount" + ProjectTestListResponseItemsSubtypeCustomMetricThreshold ProjectTestListResponseItemsSubtype = "customMetricThreshold" + ProjectTestListResponseItemsSubtypeDuplicateRowCount ProjectTestListResponseItemsSubtype = "duplicateRowCount" + ProjectTestListResponseItemsSubtypeEmptyFeature ProjectTestListResponseItemsSubtype = "emptyFeature" + ProjectTestListResponseItemsSubtypeEmptyFeatureCount ProjectTestListResponseItemsSubtype = "emptyFeatureCount" + ProjectTestListResponseItemsSubtypeDriftedFeatureCount ProjectTestListResponseItemsSubtype = "driftedFeatureCount" + ProjectTestListResponseItemsSubtypeFeatureMissingValues ProjectTestListResponseItemsSubtype = "featureMissingValues" + ProjectTestListResponseItemsSubtypeFeatureValueValidation ProjectTestListResponseItemsSubtype = "featureValueValidation" + ProjectTestListResponseItemsSubtypeGreatExpectations ProjectTestListResponseItemsSubtype = "greatExpectations" + ProjectTestListResponseItemsSubtypeGroupByColumnStatsCheck ProjectTestListResponseItemsSubtype = "groupByColumnStatsCheck" + ProjectTestListResponseItemsSubtypeIllFormedRowCount ProjectTestListResponseItemsSubtype = "illFormedRowCount" + ProjectTestListResponseItemsSubtypeIsCode ProjectTestListResponseItemsSubtype = "isCode" + ProjectTestListResponseItemsSubtypeIsJson ProjectTestListResponseItemsSubtype = "isJson" + ProjectTestListResponseItemsSubtypeLlmRubricThresholdV2 ProjectTestListResponseItemsSubtype = "llmRubricThresholdV2" + ProjectTestListResponseItemsSubtypeLabelDrift ProjectTestListResponseItemsSubtype = "labelDrift" + ProjectTestListResponseItemsSubtypeMetricThreshold ProjectTestListResponseItemsSubtype = "metricThreshold" + ProjectTestListResponseItemsSubtypeNewCategoryCount ProjectTestListResponseItemsSubtype = "newCategoryCount" + ProjectTestListResponseItemsSubtypeNewLabelCount ProjectTestListResponseItemsSubtype = "newLabelCount" + ProjectTestListResponseItemsSubtypeNullRowCount ProjectTestListResponseItemsSubtype = "nullRowCount" + ProjectTestListResponseItemsSubtypeRowCount ProjectTestListResponseItemsSubtype = "rowCount" + ProjectTestListResponseItemsSubtypePpScoreValueValidation ProjectTestListResponseItemsSubtype = "ppScoreValueValidation" + ProjectTestListResponseItemsSubtypeQuasiConstantFeature ProjectTestListResponseItemsSubtype = "quasiConstantFeature" + ProjectTestListResponseItemsSubtypeQuasiConstantFeatureCount ProjectTestListResponseItemsSubtype = "quasiConstantFeatureCount" + ProjectTestListResponseItemsSubtypeSqlQuery ProjectTestListResponseItemsSubtype = "sqlQuery" + ProjectTestListResponseItemsSubtypeDtypeValidation ProjectTestListResponseItemsSubtype = "dtypeValidation" + ProjectTestListResponseItemsSubtypeSentenceLength ProjectTestListResponseItemsSubtype = "sentenceLength" + ProjectTestListResponseItemsSubtypeSizeRatio ProjectTestListResponseItemsSubtype = "sizeRatio" + ProjectTestListResponseItemsSubtypeSpecialCharactersRatio ProjectTestListResponseItemsSubtype = "specialCharactersRatio" + ProjectTestListResponseItemsSubtypeStringValidation ProjectTestListResponseItemsSubtype = "stringValidation" + ProjectTestListResponseItemsSubtypeTrainValLeakageRowCount ProjectTestListResponseItemsSubtype = "trainValLeakageRowCount" +) + +func (r ProjectTestListResponseItemsSubtype) IsKnown() bool { + switch r { + case ProjectTestListResponseItemsSubtypeAnomalousColumnCount, ProjectTestListResponseItemsSubtypeCharacterLength, ProjectTestListResponseItemsSubtypeClassImbalanceRatio, ProjectTestListResponseItemsSubtypeExpectColumnAToBeInColumnB, ProjectTestListResponseItemsSubtypeColumnAverage, ProjectTestListResponseItemsSubtypeColumnDrift, ProjectTestListResponseItemsSubtypeColumnStatistic, ProjectTestListResponseItemsSubtypeColumnValuesMatch, ProjectTestListResponseItemsSubtypeConflictingLabelRowCount, ProjectTestListResponseItemsSubtypeContainsPii, ProjectTestListResponseItemsSubtypeContainsValidURL, ProjectTestListResponseItemsSubtypeCorrelatedFeatureCount, ProjectTestListResponseItemsSubtypeCustomMetricThreshold, ProjectTestListResponseItemsSubtypeDuplicateRowCount, ProjectTestListResponseItemsSubtypeEmptyFeature, ProjectTestListResponseItemsSubtypeEmptyFeatureCount, ProjectTestListResponseItemsSubtypeDriftedFeatureCount, ProjectTestListResponseItemsSubtypeFeatureMissingValues, ProjectTestListResponseItemsSubtypeFeatureValueValidation, ProjectTestListResponseItemsSubtypeGreatExpectations, ProjectTestListResponseItemsSubtypeGroupByColumnStatsCheck, ProjectTestListResponseItemsSubtypeIllFormedRowCount, ProjectTestListResponseItemsSubtypeIsCode, ProjectTestListResponseItemsSubtypeIsJson, ProjectTestListResponseItemsSubtypeLlmRubricThresholdV2, ProjectTestListResponseItemsSubtypeLabelDrift, ProjectTestListResponseItemsSubtypeMetricThreshold, ProjectTestListResponseItemsSubtypeNewCategoryCount, ProjectTestListResponseItemsSubtypeNewLabelCount, ProjectTestListResponseItemsSubtypeNullRowCount, ProjectTestListResponseItemsSubtypeRowCount, ProjectTestListResponseItemsSubtypePpScoreValueValidation, ProjectTestListResponseItemsSubtypeQuasiConstantFeature, ProjectTestListResponseItemsSubtypeQuasiConstantFeatureCount, ProjectTestListResponseItemsSubtypeSqlQuery, ProjectTestListResponseItemsSubtypeDtypeValidation, ProjectTestListResponseItemsSubtypeSentenceLength, ProjectTestListResponseItemsSubtypeSizeRatio, ProjectTestListResponseItemsSubtypeSpecialCharactersRatio, ProjectTestListResponseItemsSubtypeStringValidation, ProjectTestListResponseItemsSubtypeTrainValLeakageRowCount: + return true + } + return false +} + +type ProjectTestListResponseItemsThreshold struct { + // The insight name to be evaluated. + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. + InsightParameters []ProjectTestListResponseItemsThresholdsInsightParameter `json:"insightParameters,nullable"` + // The measurement to be evaluated. + Measurement string `json:"measurement"` + // The operator to be used for the evaluation. + Operator ProjectTestListResponseItemsThresholdsOperator `json:"operator"` + // Whether to use automatic anomaly detection or manual thresholds + ThresholdMode ProjectTestListResponseItemsThresholdsThresholdMode `json:"thresholdMode"` + // The value to be compared. + Value ProjectTestListResponseItemsThresholdsValueUnion `json:"value"` + JSON projectTestListResponseItemsThresholdJSON `json:"-"` +} + +// projectTestListResponseItemsThresholdJSON contains the JSON metadata for the +// struct [ProjectTestListResponseItemsThreshold] +type projectTestListResponseItemsThresholdJSON struct { + InsightName apijson.Field + InsightParameters apijson.Field + Measurement apijson.Field + Operator apijson.Field + ThresholdMode apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponseItemsThreshold) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseItemsThresholdJSON) RawJSON() string { + return r.raw +} + +type ProjectTestListResponseItemsThresholdsInsightParameter struct { + // The name of the insight filter. + Name string `json:"name,required"` + Value interface{} `json:"value,required"` + JSON projectTestListResponseItemsThresholdsInsightParameterJSON `json:"-"` +} + +// projectTestListResponseItemsThresholdsInsightParameterJSON contains the JSON +// metadata for the struct [ProjectTestListResponseItemsThresholdsInsightParameter] +type projectTestListResponseItemsThresholdsInsightParameterJSON struct { + Name apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponseItemsThresholdsInsightParameter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseItemsThresholdsInsightParameterJSON) RawJSON() string { + return r.raw +} + +// The operator to be used for the evaluation. +type ProjectTestListResponseItemsThresholdsOperator string + +const ( + ProjectTestListResponseItemsThresholdsOperatorIs ProjectTestListResponseItemsThresholdsOperator = "is" + ProjectTestListResponseItemsThresholdsOperatorGreater ProjectTestListResponseItemsThresholdsOperator = ">" + ProjectTestListResponseItemsThresholdsOperatorGreaterOrEquals ProjectTestListResponseItemsThresholdsOperator = ">=" + ProjectTestListResponseItemsThresholdsOperatorLess ProjectTestListResponseItemsThresholdsOperator = "<" + ProjectTestListResponseItemsThresholdsOperatorLessOrEquals ProjectTestListResponseItemsThresholdsOperator = "<=" + ProjectTestListResponseItemsThresholdsOperatorNotEquals ProjectTestListResponseItemsThresholdsOperator = "!=" +) + +func (r ProjectTestListResponseItemsThresholdsOperator) IsKnown() bool { + switch r { + case ProjectTestListResponseItemsThresholdsOperatorIs, ProjectTestListResponseItemsThresholdsOperatorGreater, ProjectTestListResponseItemsThresholdsOperatorGreaterOrEquals, ProjectTestListResponseItemsThresholdsOperatorLess, ProjectTestListResponseItemsThresholdsOperatorLessOrEquals, ProjectTestListResponseItemsThresholdsOperatorNotEquals: + return true + } + return false +} + +// Whether to use automatic anomaly detection or manual thresholds +type ProjectTestListResponseItemsThresholdsThresholdMode string + +const ( + ProjectTestListResponseItemsThresholdsThresholdModeAutomatic ProjectTestListResponseItemsThresholdsThresholdMode = "automatic" + ProjectTestListResponseItemsThresholdsThresholdModeManual ProjectTestListResponseItemsThresholdsThresholdMode = "manual" +) + +func (r ProjectTestListResponseItemsThresholdsThresholdMode) IsKnown() bool { + switch r { + case ProjectTestListResponseItemsThresholdsThresholdModeAutomatic, ProjectTestListResponseItemsThresholdsThresholdModeManual: + return true + } + return false +} + +// The value to be compared. +// +// Union satisfied by [shared.UnionFloat], [shared.UnionBool], [shared.UnionString] +// or [ProjectTestListResponseItemsThresholdsValueArray]. +type ProjectTestListResponseItemsThresholdsValueUnion interface { + ImplementsProjectTestListResponseItemsThresholdsValueUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ProjectTestListResponseItemsThresholdsValueUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.Number, + Type: reflect.TypeOf(shared.UnionFloat(0)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.True, + Type: reflect.TypeOf(shared.UnionBool(false)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.False, + Type: reflect.TypeOf(shared.UnionBool(false)), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ProjectTestListResponseItemsThresholdsValueArray{}), + }, + ) +} + +type ProjectTestListResponseItemsThresholdsValueArray []string + +func (r ProjectTestListResponseItemsThresholdsValueArray) ImplementsProjectTestListResponseItemsThresholdsValueUnion() { +} + +// The test type. +type ProjectTestListResponseItemsType string + +const ( + ProjectTestListResponseItemsTypeIntegrity ProjectTestListResponseItemsType = "integrity" + ProjectTestListResponseItemsTypeConsistency ProjectTestListResponseItemsType = "consistency" + ProjectTestListResponseItemsTypePerformance ProjectTestListResponseItemsType = "performance" +) + +func (r ProjectTestListResponseItemsType) IsKnown() bool { + switch r { + case ProjectTestListResponseItemsTypeIntegrity, ProjectTestListResponseItemsTypeConsistency, ProjectTestListResponseItemsTypePerformance: + return true + } + return false +} + type ProjectTestNewParams struct { // The test description. Description param.Field[interface{}] `json:"description,required"` @@ -525,3 +887,49 @@ func (r ProjectTestNewParamsType) IsKnown() bool { } return false } + +type ProjectTestListParams struct { + // Filter for archived tests. + IncludeArchived param.Field[bool] `query:"includeArchived"` + // Retrive tests created by a specific project version. + OriginVersionID param.Field[string] `query:"originVersionId" format:"uuid"` + // The page to return in a paginated query. + Page param.Field[int64] `query:"page"` + // Maximum number of items to return per page. + PerPage param.Field[int64] `query:"perPage"` + // Filter for suggested tests. + Suggested param.Field[bool] `query:"suggested"` + // Filter objects by test type. Available types are `integrity`, `consistency`, + // `performance`, `fairness`, and `robustness`. + Type param.Field[ProjectTestListParamsType] `query:"type"` + // Retrive tests with usesProductionData (monitoring). + UsesProductionData param.Field[bool] `query:"usesProductionData"` +} + +// URLQuery serializes [ProjectTestListParams]'s query parameters as `url.Values`. +func (r ProjectTestListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatComma, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Filter objects by test type. Available types are `integrity`, `consistency`, +// `performance`, `fairness`, and `robustness`. +type ProjectTestListParamsType string + +const ( + ProjectTestListParamsTypeIntegrity ProjectTestListParamsType = "integrity" + ProjectTestListParamsTypeConsistency ProjectTestListParamsType = "consistency" + ProjectTestListParamsTypePerformance ProjectTestListParamsType = "performance" + ProjectTestListParamsTypeFairness ProjectTestListParamsType = "fairness" + ProjectTestListParamsTypeRobustness ProjectTestListParamsType = "robustness" +) + +func (r ProjectTestListParamsType) IsKnown() bool { + switch r { + case ProjectTestListParamsTypeIntegrity, ProjectTestListParamsTypeConsistency, ProjectTestListParamsTypePerformance, ProjectTestListParamsTypeFairness, ProjectTestListParamsTypeRobustness: + return true + } + return false +} diff --git a/projecttest_test.go b/projecttest_test.go index 8a888bd..95d0833 100644 --- a/projecttest_test.go +++ b/projecttest_test.go @@ -63,3 +63,37 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestProjectTestListWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := openlayer.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + _, err := client.Projects.Tests.List( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + openlayer.ProjectTestListParams{ + IncludeArchived: openlayer.F(true), + OriginVersionID: openlayer.F("3fa85f64-5717-4562-b3fc-2c963f66afa6"), + Page: openlayer.F(int64(1)), + PerPage: openlayer.F(int64(1)), + Suggested: openlayer.F(true), + Type: openlayer.F(openlayer.ProjectTestListParamsTypeIntegrity), + UsesProductionData: openlayer.F(true), + }, + ) + if err != nil { + var apierr *openlayer.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/shared/union.go b/shared/union.go index 56219e9..ce00b2b 100644 --- a/shared/union.go +++ b/shared/union.go @@ -5,6 +5,7 @@ package shared type UnionString string func (UnionString) ImplementsProjectTestNewResponseThresholdsValueUnion() {} +func (UnionString) ImplementsProjectTestListResponseItemsThresholdsValueUnion() {} func (UnionString) ImplementsProjectTestNewParamsThresholdsValueUnion() {} func (UnionString) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionString) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} @@ -12,6 +13,7 @@ func (UnionString) ImplementsInferencePipelineTestResultListResponseItemsGoalThr type UnionBool bool func (UnionBool) ImplementsProjectTestNewResponseThresholdsValueUnion() {} +func (UnionBool) ImplementsProjectTestListResponseItemsThresholdsValueUnion() {} func (UnionBool) ImplementsProjectTestNewParamsThresholdsValueUnion() {} func (UnionBool) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionBool) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} @@ -19,6 +21,7 @@ func (UnionBool) ImplementsInferencePipelineTestResultListResponseItemsGoalThres type UnionFloat float64 func (UnionFloat) ImplementsProjectTestNewResponseThresholdsValueUnion() {} +func (UnionFloat) ImplementsProjectTestListResponseItemsThresholdsValueUnion() {} func (UnionFloat) ImplementsProjectTestNewParamsThresholdsValueUnion() {} func (UnionFloat) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionFloat) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} From 945314e51ecff9e88c9fafe693a612d3d350c313 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:17:18 +0000 Subject: [PATCH 18/26] feat(api): api update --- .stats.yml | 2 +- projecttest.go | 33 --------------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1dee804..279dd7b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +openapi_spec_hash: a9c2f380c41389904ec243caa6fd4cc8 config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/projecttest.go b/projecttest.go index 4e96534..f4ba2be 100644 --- a/projecttest.go +++ b/projecttest.go @@ -358,7 +358,6 @@ func (r ProjectTestNewResponseType) IsKnown() bool { } type ProjectTestListResponse struct { - Meta ProjectTestListResponse_Meta `json:"_meta,required"` Items []ProjectTestListResponseItem `json:"items,required"` JSON projectTestListResponseJSON `json:"-"` } @@ -366,7 +365,6 @@ type ProjectTestListResponse struct { // projectTestListResponseJSON contains the JSON metadata for the struct // [ProjectTestListResponse] type projectTestListResponseJSON struct { - Meta apijson.Field Items apijson.Field raw string ExtraFields map[string]apijson.Field @@ -380,37 +378,6 @@ func (r projectTestListResponseJSON) RawJSON() string { return r.raw } -type ProjectTestListResponse_Meta struct { - // The current page. - Page int64 `json:"page,required"` - // The number of items per page. - PerPage int64 `json:"perPage,required"` - // The total number of items. - TotalItems int64 `json:"totalItems,required"` - // The total number of pages. - TotalPages int64 `json:"totalPages,required"` - JSON projectTestListResponseMetaJSON `json:"-"` -} - -// projectTestListResponseMetaJSON contains the JSON metadata for the struct -// [ProjectTestListResponse_Meta] -type projectTestListResponseMetaJSON struct { - Page apijson.Field - PerPage apijson.Field - TotalItems apijson.Field - TotalPages apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectTestListResponse_Meta) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectTestListResponseMetaJSON) RawJSON() string { - return r.raw -} - type ProjectTestListResponseItem struct { // The test id. ID string `json:"id,required" format:"uuid"` From d6c9d2b4a3e0c1778af44d4d9a429211603901be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:23:51 +0000 Subject: [PATCH 19/26] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 279dd7b..69b1757 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: a9c2f380c41389904ec243caa6fd4cc8 +openapi_spec_hash: 17fb5502c19253c7c89785273e89b023 config_hash: 087e6b8013c398a6d24031d24594fdec From cddc990ebb0004ddee4ca0f8c538b543c700d254 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:24:29 +0000 Subject: [PATCH 20/26] feat(api): expose test retrieval endpoint --- .stats.yml | 2 +- projecttest.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 69b1757..1dee804 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 17fb5502c19253c7c89785273e89b023 +openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/projecttest.go b/projecttest.go index f4ba2be..4e96534 100644 --- a/projecttest.go +++ b/projecttest.go @@ -358,6 +358,7 @@ func (r ProjectTestNewResponseType) IsKnown() bool { } type ProjectTestListResponse struct { + Meta ProjectTestListResponse_Meta `json:"_meta,required"` Items []ProjectTestListResponseItem `json:"items,required"` JSON projectTestListResponseJSON `json:"-"` } @@ -365,6 +366,7 @@ type ProjectTestListResponse struct { // projectTestListResponseJSON contains the JSON metadata for the struct // [ProjectTestListResponse] type projectTestListResponseJSON struct { + Meta apijson.Field Items apijson.Field raw string ExtraFields map[string]apijson.Field @@ -378,6 +380,37 @@ func (r projectTestListResponseJSON) RawJSON() string { return r.raw } +type ProjectTestListResponse_Meta struct { + // The current page. + Page int64 `json:"page,required"` + // The number of items per page. + PerPage int64 `json:"perPage,required"` + // The total number of items. + TotalItems int64 `json:"totalItems,required"` + // The total number of pages. + TotalPages int64 `json:"totalPages,required"` + JSON projectTestListResponseMetaJSON `json:"-"` +} + +// projectTestListResponseMetaJSON contains the JSON metadata for the struct +// [ProjectTestListResponse_Meta] +type projectTestListResponseMetaJSON struct { + Page apijson.Field + PerPage apijson.Field + TotalItems apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponse_Meta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseMetaJSON) RawJSON() string { + return r.raw +} + type ProjectTestListResponseItem struct { // The test id. ID string `json:"id,required" format:"uuid"` From 146455956798caf86c90a1e76a06663c862ab02a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:21:44 +0000 Subject: [PATCH 21/26] feat(api): api update --- .stats.yml | 2 +- committestresult.go | 54 ++++++++- inferencepipelinetestresult.go | 54 ++++++++- projecttest.go | 195 ++++++++++++++++++++++++++------- projecttest_test.go | 2 +- 5 files changed, 262 insertions(+), 45 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1dee804..5c7a03f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce config_hash: 087e6b8013c398a6d24031d24594fdec diff --git a/committestresult.go b/committestresult.go index 0ec5ff1..936a268 100644 --- a/committestresult.go +++ b/committestresult.go @@ -284,8 +284,10 @@ func (r CommitTestResultListResponseItemsGoalSubtype) IsKnown() bool { type CommitTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName CommitTestResultListResponseItemsGoalThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []CommitTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -319,6 +321,54 @@ func (r commitTestResultListResponseItemsGoalThresholdJSON) RawJSON() string { return r.raw } +// The insight name to be evaluated. +type CommitTestResultListResponseItemsGoalThresholdsInsightName string + +const ( + CommitTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength CommitTestResultListResponseItemsGoalThresholdsInsightName = "characterLength" + CommitTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance CommitTestResultListResponseItemsGoalThresholdsInsightName = "classImbalance" + CommitTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB CommitTestResultListResponseItemsGoalThresholdsInsightName = "expectColumnAToBeInColumnB" + CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnAverage" + CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnDrift" + CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnValuesMatch" + CommitTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution CommitTestResultListResponseItemsGoalThresholdsInsightName = "confidenceDistribution" + CommitTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "conflictingLabelRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsPii CommitTestResultListResponseItemsGoalThresholdsInsightName = "containsPii" + CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL CommitTestResultListResponseItemsGoalThresholdsInsightName = "containsValidUrl" + CommitTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "correlatedFeatures" + CommitTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric CommitTestResultListResponseItemsGoalThresholdsInsightName = "customMetric" + CommitTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "duplicateRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "emptyFeatures" + CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "featureDrift" + CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile CommitTestResultListResponseItemsGoalThresholdsInsightName = "featureProfile" + CommitTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations CommitTestResultListResponseItemsGoalThresholdsInsightName = "greatExpectations" + CommitTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck CommitTestResultListResponseItemsGoalThresholdsInsightName = "groupByColumnStatsCheck" + CommitTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "illFormedRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNameIsCode CommitTestResultListResponseItemsGoalThresholdsInsightName = "isCode" + CommitTestResultListResponseItemsGoalThresholdsInsightNameIsJson CommitTestResultListResponseItemsGoalThresholdsInsightName = "isJson" + CommitTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2 CommitTestResultListResponseItemsGoalThresholdsInsightName = "llmRubricV2" + CommitTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "labelDrift" + CommitTestResultListResponseItemsGoalThresholdsInsightNameMetrics CommitTestResultListResponseItemsGoalThresholdsInsightName = "metrics" + CommitTestResultListResponseItemsGoalThresholdsInsightNameNewCategories CommitTestResultListResponseItemsGoalThresholdsInsightName = "newCategories" + CommitTestResultListResponseItemsGoalThresholdsInsightNameNewLabels CommitTestResultListResponseItemsGoalThresholdsInsightName = "newLabels" + CommitTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "nullRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNamePpScore CommitTestResultListResponseItemsGoalThresholdsInsightName = "ppScore" + CommitTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "quasiConstantFeatures" + CommitTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength CommitTestResultListResponseItemsGoalThresholdsInsightName = "sentenceLength" + CommitTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio CommitTestResultListResponseItemsGoalThresholdsInsightName = "sizeRatio" + CommitTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters CommitTestResultListResponseItemsGoalThresholdsInsightName = "specialCharacters" + CommitTestResultListResponseItemsGoalThresholdsInsightNameStringValidation CommitTestResultListResponseItemsGoalThresholdsInsightName = "stringValidation" + CommitTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r CommitTestResultListResponseItemsGoalThresholdsInsightName) IsKnown() bool { + switch r { + case CommitTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength, CommitTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance, CommitTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch, CommitTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution, CommitTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsPii, CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL, CommitTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric, CommitTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile, CommitTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations, CommitTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck, CommitTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameIsCode, CommitTestResultListResponseItemsGoalThresholdsInsightNameIsJson, CommitTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2, CommitTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameMetrics, CommitTestResultListResponseItemsGoalThresholdsInsightNameNewCategories, CommitTestResultListResponseItemsGoalThresholdsInsightNameNewLabels, CommitTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNamePpScore, CommitTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength, CommitTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio, CommitTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters, CommitTestResultListResponseItemsGoalThresholdsInsightNameStringValidation, CommitTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type CommitTestResultListResponseItemsGoalThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` diff --git a/inferencepipelinetestresult.go b/inferencepipelinetestresult.go index 1125cd3..d21a8df 100644 --- a/inferencepipelinetestresult.go +++ b/inferencepipelinetestresult.go @@ -284,8 +284,10 @@ func (r InferencePipelineTestResultListResponseItemsGoalSubtype) IsKnown() bool type InferencePipelineTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -320,6 +322,54 @@ func (r inferencePipelineTestResultListResponseItemsGoalThresholdJSON) RawJSON() return r.raw } +// The insight name to be evaluated. +type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName string + +const ( + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "characterLength" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "classImbalance" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "expectColumnAToBeInColumnB" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnAverage" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnDrift" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnValuesMatch" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "confidenceDistribution" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "conflictingLabelRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsPii InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "containsPii" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "containsValidUrl" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "correlatedFeatures" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "customMetric" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "duplicateRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "emptyFeatures" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "featureDrift" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "featureProfile" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "greatExpectations" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "groupByColumnStatsCheck" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "illFormedRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsCode InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "isCode" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsJson InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "isJson" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2 InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "llmRubricV2" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "labelDrift" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameMetrics InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "metrics" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewCategories InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "newCategories" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewLabels InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "newLabels" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "nullRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNamePpScore InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "ppScore" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "quasiConstantFeatures" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "sentenceLength" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "sizeRatio" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "specialCharacters" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameStringValidation InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "stringValidation" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName) IsKnown() bool { + switch r { + case InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsPii, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsCode, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsJson, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameMetrics, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewCategories, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewLabels, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNamePpScore, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameStringValidation, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` diff --git a/projecttest.go b/projecttest.go index 4e96534..7dc4afd 100644 --- a/projecttest.go +++ b/projecttest.go @@ -205,8 +205,10 @@ func (r ProjectTestNewResponseSubtype) IsKnown() bool { type ProjectTestNewResponseThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName ProjectTestNewResponseThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []ProjectTestNewResponseThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -240,6 +242,54 @@ func (r projectTestNewResponseThresholdJSON) RawJSON() string { return r.raw } +// The insight name to be evaluated. +type ProjectTestNewResponseThresholdsInsightName string + +const ( + ProjectTestNewResponseThresholdsInsightNameCharacterLength ProjectTestNewResponseThresholdsInsightName = "characterLength" + ProjectTestNewResponseThresholdsInsightNameClassImbalance ProjectTestNewResponseThresholdsInsightName = "classImbalance" + ProjectTestNewResponseThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestNewResponseThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestNewResponseThresholdsInsightNameColumnAverage ProjectTestNewResponseThresholdsInsightName = "columnAverage" + ProjectTestNewResponseThresholdsInsightNameColumnDrift ProjectTestNewResponseThresholdsInsightName = "columnDrift" + ProjectTestNewResponseThresholdsInsightNameColumnValuesMatch ProjectTestNewResponseThresholdsInsightName = "columnValuesMatch" + ProjectTestNewResponseThresholdsInsightNameConfidenceDistribution ProjectTestNewResponseThresholdsInsightName = "confidenceDistribution" + ProjectTestNewResponseThresholdsInsightNameConflictingLabelRowCount ProjectTestNewResponseThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestNewResponseThresholdsInsightNameContainsPii ProjectTestNewResponseThresholdsInsightName = "containsPii" + ProjectTestNewResponseThresholdsInsightNameContainsValidURL ProjectTestNewResponseThresholdsInsightName = "containsValidUrl" + ProjectTestNewResponseThresholdsInsightNameCorrelatedFeatures ProjectTestNewResponseThresholdsInsightName = "correlatedFeatures" + ProjectTestNewResponseThresholdsInsightNameCustomMetric ProjectTestNewResponseThresholdsInsightName = "customMetric" + ProjectTestNewResponseThresholdsInsightNameDuplicateRowCount ProjectTestNewResponseThresholdsInsightName = "duplicateRowCount" + ProjectTestNewResponseThresholdsInsightNameEmptyFeatures ProjectTestNewResponseThresholdsInsightName = "emptyFeatures" + ProjectTestNewResponseThresholdsInsightNameFeatureDrift ProjectTestNewResponseThresholdsInsightName = "featureDrift" + ProjectTestNewResponseThresholdsInsightNameFeatureProfile ProjectTestNewResponseThresholdsInsightName = "featureProfile" + ProjectTestNewResponseThresholdsInsightNameGreatExpectations ProjectTestNewResponseThresholdsInsightName = "greatExpectations" + ProjectTestNewResponseThresholdsInsightNameGroupByColumnStatsCheck ProjectTestNewResponseThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestNewResponseThresholdsInsightNameIllFormedRowCount ProjectTestNewResponseThresholdsInsightName = "illFormedRowCount" + ProjectTestNewResponseThresholdsInsightNameIsCode ProjectTestNewResponseThresholdsInsightName = "isCode" + ProjectTestNewResponseThresholdsInsightNameIsJson ProjectTestNewResponseThresholdsInsightName = "isJson" + ProjectTestNewResponseThresholdsInsightNameLlmRubricV2 ProjectTestNewResponseThresholdsInsightName = "llmRubricV2" + ProjectTestNewResponseThresholdsInsightNameLabelDrift ProjectTestNewResponseThresholdsInsightName = "labelDrift" + ProjectTestNewResponseThresholdsInsightNameMetrics ProjectTestNewResponseThresholdsInsightName = "metrics" + ProjectTestNewResponseThresholdsInsightNameNewCategories ProjectTestNewResponseThresholdsInsightName = "newCategories" + ProjectTestNewResponseThresholdsInsightNameNewLabels ProjectTestNewResponseThresholdsInsightName = "newLabels" + ProjectTestNewResponseThresholdsInsightNameNullRowCount ProjectTestNewResponseThresholdsInsightName = "nullRowCount" + ProjectTestNewResponseThresholdsInsightNamePpScore ProjectTestNewResponseThresholdsInsightName = "ppScore" + ProjectTestNewResponseThresholdsInsightNameQuasiConstantFeatures ProjectTestNewResponseThresholdsInsightName = "quasiConstantFeatures" + ProjectTestNewResponseThresholdsInsightNameSentenceLength ProjectTestNewResponseThresholdsInsightName = "sentenceLength" + ProjectTestNewResponseThresholdsInsightNameSizeRatio ProjectTestNewResponseThresholdsInsightName = "sizeRatio" + ProjectTestNewResponseThresholdsInsightNameSpecialCharacters ProjectTestNewResponseThresholdsInsightName = "specialCharacters" + ProjectTestNewResponseThresholdsInsightNameStringValidation ProjectTestNewResponseThresholdsInsightName = "stringValidation" + ProjectTestNewResponseThresholdsInsightNameTrainValLeakageRowCount ProjectTestNewResponseThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestNewResponseThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestNewResponseThresholdsInsightNameCharacterLength, ProjectTestNewResponseThresholdsInsightNameClassImbalance, ProjectTestNewResponseThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestNewResponseThresholdsInsightNameColumnAverage, ProjectTestNewResponseThresholdsInsightNameColumnDrift, ProjectTestNewResponseThresholdsInsightNameColumnValuesMatch, ProjectTestNewResponseThresholdsInsightNameConfidenceDistribution, ProjectTestNewResponseThresholdsInsightNameConflictingLabelRowCount, ProjectTestNewResponseThresholdsInsightNameContainsPii, ProjectTestNewResponseThresholdsInsightNameContainsValidURL, ProjectTestNewResponseThresholdsInsightNameCorrelatedFeatures, ProjectTestNewResponseThresholdsInsightNameCustomMetric, ProjectTestNewResponseThresholdsInsightNameDuplicateRowCount, ProjectTestNewResponseThresholdsInsightNameEmptyFeatures, ProjectTestNewResponseThresholdsInsightNameFeatureDrift, ProjectTestNewResponseThresholdsInsightNameFeatureProfile, ProjectTestNewResponseThresholdsInsightNameGreatExpectations, ProjectTestNewResponseThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestNewResponseThresholdsInsightNameIllFormedRowCount, ProjectTestNewResponseThresholdsInsightNameIsCode, ProjectTestNewResponseThresholdsInsightNameIsJson, ProjectTestNewResponseThresholdsInsightNameLlmRubricV2, ProjectTestNewResponseThresholdsInsightNameLabelDrift, ProjectTestNewResponseThresholdsInsightNameMetrics, ProjectTestNewResponseThresholdsInsightNameNewCategories, ProjectTestNewResponseThresholdsInsightNameNewLabels, ProjectTestNewResponseThresholdsInsightNameNullRowCount, ProjectTestNewResponseThresholdsInsightNamePpScore, ProjectTestNewResponseThresholdsInsightNameQuasiConstantFeatures, ProjectTestNewResponseThresholdsInsightNameSentenceLength, ProjectTestNewResponseThresholdsInsightNameSizeRatio, ProjectTestNewResponseThresholdsInsightNameSpecialCharacters, ProjectTestNewResponseThresholdsInsightNameStringValidation, ProjectTestNewResponseThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestNewResponseThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` @@ -358,7 +408,6 @@ func (r ProjectTestNewResponseType) IsKnown() bool { } type ProjectTestListResponse struct { - Meta ProjectTestListResponse_Meta `json:"_meta,required"` Items []ProjectTestListResponseItem `json:"items,required"` JSON projectTestListResponseJSON `json:"-"` } @@ -366,7 +415,6 @@ type ProjectTestListResponse struct { // projectTestListResponseJSON contains the JSON metadata for the struct // [ProjectTestListResponse] type projectTestListResponseJSON struct { - Meta apijson.Field Items apijson.Field raw string ExtraFields map[string]apijson.Field @@ -380,37 +428,6 @@ func (r projectTestListResponseJSON) RawJSON() string { return r.raw } -type ProjectTestListResponse_Meta struct { - // The current page. - Page int64 `json:"page,required"` - // The number of items per page. - PerPage int64 `json:"perPage,required"` - // The total number of items. - TotalItems int64 `json:"totalItems,required"` - // The total number of pages. - TotalPages int64 `json:"totalPages,required"` - JSON projectTestListResponseMetaJSON `json:"-"` -} - -// projectTestListResponseMetaJSON contains the JSON metadata for the struct -// [ProjectTestListResponse_Meta] -type projectTestListResponseMetaJSON struct { - Page apijson.Field - PerPage apijson.Field - TotalItems apijson.Field - TotalPages apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectTestListResponse_Meta) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectTestListResponseMetaJSON) RawJSON() string { - return r.raw -} - type ProjectTestListResponseItem struct { // The test id. ID string `json:"id,required" format:"uuid"` @@ -553,8 +570,10 @@ func (r ProjectTestListResponseItemsSubtype) IsKnown() bool { type ProjectTestListResponseItemsThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName ProjectTestListResponseItemsThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []ProjectTestListResponseItemsThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -588,6 +607,54 @@ func (r projectTestListResponseItemsThresholdJSON) RawJSON() string { return r.raw } +// The insight name to be evaluated. +type ProjectTestListResponseItemsThresholdsInsightName string + +const ( + ProjectTestListResponseItemsThresholdsInsightNameCharacterLength ProjectTestListResponseItemsThresholdsInsightName = "characterLength" + ProjectTestListResponseItemsThresholdsInsightNameClassImbalance ProjectTestListResponseItemsThresholdsInsightName = "classImbalance" + ProjectTestListResponseItemsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestListResponseItemsThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestListResponseItemsThresholdsInsightNameColumnAverage ProjectTestListResponseItemsThresholdsInsightName = "columnAverage" + ProjectTestListResponseItemsThresholdsInsightNameColumnDrift ProjectTestListResponseItemsThresholdsInsightName = "columnDrift" + ProjectTestListResponseItemsThresholdsInsightNameColumnValuesMatch ProjectTestListResponseItemsThresholdsInsightName = "columnValuesMatch" + ProjectTestListResponseItemsThresholdsInsightNameConfidenceDistribution ProjectTestListResponseItemsThresholdsInsightName = "confidenceDistribution" + ProjectTestListResponseItemsThresholdsInsightNameConflictingLabelRowCount ProjectTestListResponseItemsThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestListResponseItemsThresholdsInsightNameContainsPii ProjectTestListResponseItemsThresholdsInsightName = "containsPii" + ProjectTestListResponseItemsThresholdsInsightNameContainsValidURL ProjectTestListResponseItemsThresholdsInsightName = "containsValidUrl" + ProjectTestListResponseItemsThresholdsInsightNameCorrelatedFeatures ProjectTestListResponseItemsThresholdsInsightName = "correlatedFeatures" + ProjectTestListResponseItemsThresholdsInsightNameCustomMetric ProjectTestListResponseItemsThresholdsInsightName = "customMetric" + ProjectTestListResponseItemsThresholdsInsightNameDuplicateRowCount ProjectTestListResponseItemsThresholdsInsightName = "duplicateRowCount" + ProjectTestListResponseItemsThresholdsInsightNameEmptyFeatures ProjectTestListResponseItemsThresholdsInsightName = "emptyFeatures" + ProjectTestListResponseItemsThresholdsInsightNameFeatureDrift ProjectTestListResponseItemsThresholdsInsightName = "featureDrift" + ProjectTestListResponseItemsThresholdsInsightNameFeatureProfile ProjectTestListResponseItemsThresholdsInsightName = "featureProfile" + ProjectTestListResponseItemsThresholdsInsightNameGreatExpectations ProjectTestListResponseItemsThresholdsInsightName = "greatExpectations" + ProjectTestListResponseItemsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestListResponseItemsThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestListResponseItemsThresholdsInsightNameIllFormedRowCount ProjectTestListResponseItemsThresholdsInsightName = "illFormedRowCount" + ProjectTestListResponseItemsThresholdsInsightNameIsCode ProjectTestListResponseItemsThresholdsInsightName = "isCode" + ProjectTestListResponseItemsThresholdsInsightNameIsJson ProjectTestListResponseItemsThresholdsInsightName = "isJson" + ProjectTestListResponseItemsThresholdsInsightNameLlmRubricV2 ProjectTestListResponseItemsThresholdsInsightName = "llmRubricV2" + ProjectTestListResponseItemsThresholdsInsightNameLabelDrift ProjectTestListResponseItemsThresholdsInsightName = "labelDrift" + ProjectTestListResponseItemsThresholdsInsightNameMetrics ProjectTestListResponseItemsThresholdsInsightName = "metrics" + ProjectTestListResponseItemsThresholdsInsightNameNewCategories ProjectTestListResponseItemsThresholdsInsightName = "newCategories" + ProjectTestListResponseItemsThresholdsInsightNameNewLabels ProjectTestListResponseItemsThresholdsInsightName = "newLabels" + ProjectTestListResponseItemsThresholdsInsightNameNullRowCount ProjectTestListResponseItemsThresholdsInsightName = "nullRowCount" + ProjectTestListResponseItemsThresholdsInsightNamePpScore ProjectTestListResponseItemsThresholdsInsightName = "ppScore" + ProjectTestListResponseItemsThresholdsInsightNameQuasiConstantFeatures ProjectTestListResponseItemsThresholdsInsightName = "quasiConstantFeatures" + ProjectTestListResponseItemsThresholdsInsightNameSentenceLength ProjectTestListResponseItemsThresholdsInsightName = "sentenceLength" + ProjectTestListResponseItemsThresholdsInsightNameSizeRatio ProjectTestListResponseItemsThresholdsInsightName = "sizeRatio" + ProjectTestListResponseItemsThresholdsInsightNameSpecialCharacters ProjectTestListResponseItemsThresholdsInsightName = "specialCharacters" + ProjectTestListResponseItemsThresholdsInsightNameStringValidation ProjectTestListResponseItemsThresholdsInsightName = "stringValidation" + ProjectTestListResponseItemsThresholdsInsightNameTrainValLeakageRowCount ProjectTestListResponseItemsThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestListResponseItemsThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestListResponseItemsThresholdsInsightNameCharacterLength, ProjectTestListResponseItemsThresholdsInsightNameClassImbalance, ProjectTestListResponseItemsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestListResponseItemsThresholdsInsightNameColumnAverage, ProjectTestListResponseItemsThresholdsInsightNameColumnDrift, ProjectTestListResponseItemsThresholdsInsightNameColumnValuesMatch, ProjectTestListResponseItemsThresholdsInsightNameConfidenceDistribution, ProjectTestListResponseItemsThresholdsInsightNameConflictingLabelRowCount, ProjectTestListResponseItemsThresholdsInsightNameContainsPii, ProjectTestListResponseItemsThresholdsInsightNameContainsValidURL, ProjectTestListResponseItemsThresholdsInsightNameCorrelatedFeatures, ProjectTestListResponseItemsThresholdsInsightNameCustomMetric, ProjectTestListResponseItemsThresholdsInsightNameDuplicateRowCount, ProjectTestListResponseItemsThresholdsInsightNameEmptyFeatures, ProjectTestListResponseItemsThresholdsInsightNameFeatureDrift, ProjectTestListResponseItemsThresholdsInsightNameFeatureProfile, ProjectTestListResponseItemsThresholdsInsightNameGreatExpectations, ProjectTestListResponseItemsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestListResponseItemsThresholdsInsightNameIllFormedRowCount, ProjectTestListResponseItemsThresholdsInsightNameIsCode, ProjectTestListResponseItemsThresholdsInsightNameIsJson, ProjectTestListResponseItemsThresholdsInsightNameLlmRubricV2, ProjectTestListResponseItemsThresholdsInsightNameLabelDrift, ProjectTestListResponseItemsThresholdsInsightNameMetrics, ProjectTestListResponseItemsThresholdsInsightNameNewCategories, ProjectTestListResponseItemsThresholdsInsightNameNewLabels, ProjectTestListResponseItemsThresholdsInsightNameNullRowCount, ProjectTestListResponseItemsThresholdsInsightNamePpScore, ProjectTestListResponseItemsThresholdsInsightNameQuasiConstantFeatures, ProjectTestListResponseItemsThresholdsInsightNameSentenceLength, ProjectTestListResponseItemsThresholdsInsightNameSizeRatio, ProjectTestListResponseItemsThresholdsInsightNameSpecialCharacters, ProjectTestListResponseItemsThresholdsInsightNameStringValidation, ProjectTestListResponseItemsThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestListResponseItemsThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` @@ -795,8 +862,10 @@ func (r ProjectTestNewParamsSubtype) IsKnown() bool { type ProjectTestNewParamsThreshold struct { // The insight name to be evaluated. - InsightName param.Field[string] `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName param.Field[ProjectTestNewParamsThresholdsInsightName] `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters param.Field[[]ProjectTestNewParamsThresholdsInsightParameter] `json:"insightParameters"` // The measurement to be evaluated. Measurement param.Field[string] `json:"measurement"` @@ -812,6 +881,54 @@ func (r ProjectTestNewParamsThreshold) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// The insight name to be evaluated. +type ProjectTestNewParamsThresholdsInsightName string + +const ( + ProjectTestNewParamsThresholdsInsightNameCharacterLength ProjectTestNewParamsThresholdsInsightName = "characterLength" + ProjectTestNewParamsThresholdsInsightNameClassImbalance ProjectTestNewParamsThresholdsInsightName = "classImbalance" + ProjectTestNewParamsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestNewParamsThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestNewParamsThresholdsInsightNameColumnAverage ProjectTestNewParamsThresholdsInsightName = "columnAverage" + ProjectTestNewParamsThresholdsInsightNameColumnDrift ProjectTestNewParamsThresholdsInsightName = "columnDrift" + ProjectTestNewParamsThresholdsInsightNameColumnValuesMatch ProjectTestNewParamsThresholdsInsightName = "columnValuesMatch" + ProjectTestNewParamsThresholdsInsightNameConfidenceDistribution ProjectTestNewParamsThresholdsInsightName = "confidenceDistribution" + ProjectTestNewParamsThresholdsInsightNameConflictingLabelRowCount ProjectTestNewParamsThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestNewParamsThresholdsInsightNameContainsPii ProjectTestNewParamsThresholdsInsightName = "containsPii" + ProjectTestNewParamsThresholdsInsightNameContainsValidURL ProjectTestNewParamsThresholdsInsightName = "containsValidUrl" + ProjectTestNewParamsThresholdsInsightNameCorrelatedFeatures ProjectTestNewParamsThresholdsInsightName = "correlatedFeatures" + ProjectTestNewParamsThresholdsInsightNameCustomMetric ProjectTestNewParamsThresholdsInsightName = "customMetric" + ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount ProjectTestNewParamsThresholdsInsightName = "duplicateRowCount" + ProjectTestNewParamsThresholdsInsightNameEmptyFeatures ProjectTestNewParamsThresholdsInsightName = "emptyFeatures" + ProjectTestNewParamsThresholdsInsightNameFeatureDrift ProjectTestNewParamsThresholdsInsightName = "featureDrift" + ProjectTestNewParamsThresholdsInsightNameFeatureProfile ProjectTestNewParamsThresholdsInsightName = "featureProfile" + ProjectTestNewParamsThresholdsInsightNameGreatExpectations ProjectTestNewParamsThresholdsInsightName = "greatExpectations" + ProjectTestNewParamsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestNewParamsThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestNewParamsThresholdsInsightNameIllFormedRowCount ProjectTestNewParamsThresholdsInsightName = "illFormedRowCount" + ProjectTestNewParamsThresholdsInsightNameIsCode ProjectTestNewParamsThresholdsInsightName = "isCode" + ProjectTestNewParamsThresholdsInsightNameIsJson ProjectTestNewParamsThresholdsInsightName = "isJson" + ProjectTestNewParamsThresholdsInsightNameLlmRubricV2 ProjectTestNewParamsThresholdsInsightName = "llmRubricV2" + ProjectTestNewParamsThresholdsInsightNameLabelDrift ProjectTestNewParamsThresholdsInsightName = "labelDrift" + ProjectTestNewParamsThresholdsInsightNameMetrics ProjectTestNewParamsThresholdsInsightName = "metrics" + ProjectTestNewParamsThresholdsInsightNameNewCategories ProjectTestNewParamsThresholdsInsightName = "newCategories" + ProjectTestNewParamsThresholdsInsightNameNewLabels ProjectTestNewParamsThresholdsInsightName = "newLabels" + ProjectTestNewParamsThresholdsInsightNameNullRowCount ProjectTestNewParamsThresholdsInsightName = "nullRowCount" + ProjectTestNewParamsThresholdsInsightNamePpScore ProjectTestNewParamsThresholdsInsightName = "ppScore" + ProjectTestNewParamsThresholdsInsightNameQuasiConstantFeatures ProjectTestNewParamsThresholdsInsightName = "quasiConstantFeatures" + ProjectTestNewParamsThresholdsInsightNameSentenceLength ProjectTestNewParamsThresholdsInsightName = "sentenceLength" + ProjectTestNewParamsThresholdsInsightNameSizeRatio ProjectTestNewParamsThresholdsInsightName = "sizeRatio" + ProjectTestNewParamsThresholdsInsightNameSpecialCharacters ProjectTestNewParamsThresholdsInsightName = "specialCharacters" + ProjectTestNewParamsThresholdsInsightNameStringValidation ProjectTestNewParamsThresholdsInsightName = "stringValidation" + ProjectTestNewParamsThresholdsInsightNameTrainValLeakageRowCount ProjectTestNewParamsThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestNewParamsThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestNewParamsThresholdsInsightNameCharacterLength, ProjectTestNewParamsThresholdsInsightNameClassImbalance, ProjectTestNewParamsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestNewParamsThresholdsInsightNameColumnAverage, ProjectTestNewParamsThresholdsInsightNameColumnDrift, ProjectTestNewParamsThresholdsInsightNameColumnValuesMatch, ProjectTestNewParamsThresholdsInsightNameConfidenceDistribution, ProjectTestNewParamsThresholdsInsightNameConflictingLabelRowCount, ProjectTestNewParamsThresholdsInsightNameContainsPii, ProjectTestNewParamsThresholdsInsightNameContainsValidURL, ProjectTestNewParamsThresholdsInsightNameCorrelatedFeatures, ProjectTestNewParamsThresholdsInsightNameCustomMetric, ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount, ProjectTestNewParamsThresholdsInsightNameEmptyFeatures, ProjectTestNewParamsThresholdsInsightNameFeatureDrift, ProjectTestNewParamsThresholdsInsightNameFeatureProfile, ProjectTestNewParamsThresholdsInsightNameGreatExpectations, ProjectTestNewParamsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestNewParamsThresholdsInsightNameIllFormedRowCount, ProjectTestNewParamsThresholdsInsightNameIsCode, ProjectTestNewParamsThresholdsInsightNameIsJson, ProjectTestNewParamsThresholdsInsightNameLlmRubricV2, ProjectTestNewParamsThresholdsInsightNameLabelDrift, ProjectTestNewParamsThresholdsInsightNameMetrics, ProjectTestNewParamsThresholdsInsightNameNewCategories, ProjectTestNewParamsThresholdsInsightNameNewLabels, ProjectTestNewParamsThresholdsInsightNameNullRowCount, ProjectTestNewParamsThresholdsInsightNamePpScore, ProjectTestNewParamsThresholdsInsightNameQuasiConstantFeatures, ProjectTestNewParamsThresholdsInsightNameSentenceLength, ProjectTestNewParamsThresholdsInsightNameSizeRatio, ProjectTestNewParamsThresholdsInsightNameSpecialCharacters, ProjectTestNewParamsThresholdsInsightNameStringValidation, ProjectTestNewParamsThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestNewParamsThresholdsInsightParameter struct { // The name of the insight filter. Name param.Field[string] `json:"name,required"` diff --git a/projecttest_test.go b/projecttest_test.go index 95d0833..7273a54 100644 --- a/projecttest_test.go +++ b/projecttest_test.go @@ -34,7 +34,7 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { Name: openlayer.F("No duplicate rows"), Subtype: openlayer.F(openlayer.ProjectTestNewParamsSubtypeDuplicateRowCount), Thresholds: openlayer.F([]openlayer.ProjectTestNewParamsThreshold{{ - InsightName: openlayer.F("duplicateRowCount"), + InsightName: openlayer.F(openlayer.ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount), InsightParameters: openlayer.F([]openlayer.ProjectTestNewParamsThresholdsInsightParameter{{ Name: openlayer.F("column_name"), Value: openlayer.F[any]("Age"), From e8aba5e6f17d645f5ccb543d259739d534a3da3a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:22:22 +0000 Subject: [PATCH 22/26] feat(api): expose test update endpoint --- .stats.yml | 4 +- committestresult.go | 54 +-------- inferencepipelinetestresult.go | 54 +-------- projecttest.go | 195 +++++++-------------------------- projecttest_test.go | 2 +- 5 files changed, 46 insertions(+), 263 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5c7a03f..4546c8a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 17 -openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce -config_hash: 087e6b8013c398a6d24031d24594fdec +openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +config_hash: 30422a4611d93ca69e4f1aff60b9ddb5 diff --git a/committestresult.go b/committestresult.go index 936a268..0ec5ff1 100644 --- a/committestresult.go +++ b/committestresult.go @@ -284,10 +284,8 @@ func (r CommitTestResultListResponseItemsGoalSubtype) IsKnown() bool { type CommitTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName CommitTestResultListResponseItemsGoalThresholdsInsightName `json:"insightName"` - // The insight parameters. Required only for some test subtypes. For example, for - // tests that require a column name, the insight parameters will be [{'name': - // 'column_name', 'value': 'Age'}] + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. InsightParameters []CommitTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -321,54 +319,6 @@ func (r commitTestResultListResponseItemsGoalThresholdJSON) RawJSON() string { return r.raw } -// The insight name to be evaluated. -type CommitTestResultListResponseItemsGoalThresholdsInsightName string - -const ( - CommitTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength CommitTestResultListResponseItemsGoalThresholdsInsightName = "characterLength" - CommitTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance CommitTestResultListResponseItemsGoalThresholdsInsightName = "classImbalance" - CommitTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB CommitTestResultListResponseItemsGoalThresholdsInsightName = "expectColumnAToBeInColumnB" - CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnAverage" - CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnDrift" - CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnValuesMatch" - CommitTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution CommitTestResultListResponseItemsGoalThresholdsInsightName = "confidenceDistribution" - CommitTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "conflictingLabelRowCount" - CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsPii CommitTestResultListResponseItemsGoalThresholdsInsightName = "containsPii" - CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL CommitTestResultListResponseItemsGoalThresholdsInsightName = "containsValidUrl" - CommitTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "correlatedFeatures" - CommitTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric CommitTestResultListResponseItemsGoalThresholdsInsightName = "customMetric" - CommitTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "duplicateRowCount" - CommitTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "emptyFeatures" - CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "featureDrift" - CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile CommitTestResultListResponseItemsGoalThresholdsInsightName = "featureProfile" - CommitTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations CommitTestResultListResponseItemsGoalThresholdsInsightName = "greatExpectations" - CommitTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck CommitTestResultListResponseItemsGoalThresholdsInsightName = "groupByColumnStatsCheck" - CommitTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "illFormedRowCount" - CommitTestResultListResponseItemsGoalThresholdsInsightNameIsCode CommitTestResultListResponseItemsGoalThresholdsInsightName = "isCode" - CommitTestResultListResponseItemsGoalThresholdsInsightNameIsJson CommitTestResultListResponseItemsGoalThresholdsInsightName = "isJson" - CommitTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2 CommitTestResultListResponseItemsGoalThresholdsInsightName = "llmRubricV2" - CommitTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "labelDrift" - CommitTestResultListResponseItemsGoalThresholdsInsightNameMetrics CommitTestResultListResponseItemsGoalThresholdsInsightName = "metrics" - CommitTestResultListResponseItemsGoalThresholdsInsightNameNewCategories CommitTestResultListResponseItemsGoalThresholdsInsightName = "newCategories" - CommitTestResultListResponseItemsGoalThresholdsInsightNameNewLabels CommitTestResultListResponseItemsGoalThresholdsInsightName = "newLabels" - CommitTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "nullRowCount" - CommitTestResultListResponseItemsGoalThresholdsInsightNamePpScore CommitTestResultListResponseItemsGoalThresholdsInsightName = "ppScore" - CommitTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "quasiConstantFeatures" - CommitTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength CommitTestResultListResponseItemsGoalThresholdsInsightName = "sentenceLength" - CommitTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio CommitTestResultListResponseItemsGoalThresholdsInsightName = "sizeRatio" - CommitTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters CommitTestResultListResponseItemsGoalThresholdsInsightName = "specialCharacters" - CommitTestResultListResponseItemsGoalThresholdsInsightNameStringValidation CommitTestResultListResponseItemsGoalThresholdsInsightName = "stringValidation" - CommitTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "trainValLeakageRowCount" -) - -func (r CommitTestResultListResponseItemsGoalThresholdsInsightName) IsKnown() bool { - switch r { - case CommitTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength, CommitTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance, CommitTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch, CommitTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution, CommitTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsPii, CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL, CommitTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric, CommitTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile, CommitTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations, CommitTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck, CommitTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameIsCode, CommitTestResultListResponseItemsGoalThresholdsInsightNameIsJson, CommitTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2, CommitTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameMetrics, CommitTestResultListResponseItemsGoalThresholdsInsightNameNewCategories, CommitTestResultListResponseItemsGoalThresholdsInsightNameNewLabels, CommitTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNamePpScore, CommitTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength, CommitTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio, CommitTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters, CommitTestResultListResponseItemsGoalThresholdsInsightNameStringValidation, CommitTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount: - return true - } - return false -} - type CommitTestResultListResponseItemsGoalThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` diff --git a/inferencepipelinetestresult.go b/inferencepipelinetestresult.go index d21a8df..1125cd3 100644 --- a/inferencepipelinetestresult.go +++ b/inferencepipelinetestresult.go @@ -284,10 +284,8 @@ func (r InferencePipelineTestResultListResponseItemsGoalSubtype) IsKnown() bool type InferencePipelineTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName `json:"insightName"` - // The insight parameters. Required only for some test subtypes. For example, for - // tests that require a column name, the insight parameters will be [{'name': - // 'column_name', 'value': 'Age'}] + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. InsightParameters []InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -322,54 +320,6 @@ func (r inferencePipelineTestResultListResponseItemsGoalThresholdJSON) RawJSON() return r.raw } -// The insight name to be evaluated. -type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName string - -const ( - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "characterLength" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "classImbalance" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "expectColumnAToBeInColumnB" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnAverage" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnDrift" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnValuesMatch" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "confidenceDistribution" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "conflictingLabelRowCount" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsPii InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "containsPii" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "containsValidUrl" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "correlatedFeatures" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "customMetric" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "duplicateRowCount" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "emptyFeatures" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "featureDrift" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "featureProfile" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "greatExpectations" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "groupByColumnStatsCheck" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "illFormedRowCount" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsCode InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "isCode" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsJson InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "isJson" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2 InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "llmRubricV2" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "labelDrift" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameMetrics InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "metrics" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewCategories InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "newCategories" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewLabels InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "newLabels" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "nullRowCount" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNamePpScore InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "ppScore" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "quasiConstantFeatures" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "sentenceLength" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "sizeRatio" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "specialCharacters" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameStringValidation InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "stringValidation" - InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "trainValLeakageRowCount" -) - -func (r InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName) IsKnown() bool { - switch r { - case InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsPii, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsCode, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsJson, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameMetrics, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewCategories, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewLabels, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNamePpScore, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameStringValidation, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount: - return true - } - return false -} - type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` diff --git a/projecttest.go b/projecttest.go index 7dc4afd..4e96534 100644 --- a/projecttest.go +++ b/projecttest.go @@ -205,10 +205,8 @@ func (r ProjectTestNewResponseSubtype) IsKnown() bool { type ProjectTestNewResponseThreshold struct { // The insight name to be evaluated. - InsightName ProjectTestNewResponseThresholdsInsightName `json:"insightName"` - // The insight parameters. Required only for some test subtypes. For example, for - // tests that require a column name, the insight parameters will be [{'name': - // 'column_name', 'value': 'Age'}] + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. InsightParameters []ProjectTestNewResponseThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -242,54 +240,6 @@ func (r projectTestNewResponseThresholdJSON) RawJSON() string { return r.raw } -// The insight name to be evaluated. -type ProjectTestNewResponseThresholdsInsightName string - -const ( - ProjectTestNewResponseThresholdsInsightNameCharacterLength ProjectTestNewResponseThresholdsInsightName = "characterLength" - ProjectTestNewResponseThresholdsInsightNameClassImbalance ProjectTestNewResponseThresholdsInsightName = "classImbalance" - ProjectTestNewResponseThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestNewResponseThresholdsInsightName = "expectColumnAToBeInColumnB" - ProjectTestNewResponseThresholdsInsightNameColumnAverage ProjectTestNewResponseThresholdsInsightName = "columnAverage" - ProjectTestNewResponseThresholdsInsightNameColumnDrift ProjectTestNewResponseThresholdsInsightName = "columnDrift" - ProjectTestNewResponseThresholdsInsightNameColumnValuesMatch ProjectTestNewResponseThresholdsInsightName = "columnValuesMatch" - ProjectTestNewResponseThresholdsInsightNameConfidenceDistribution ProjectTestNewResponseThresholdsInsightName = "confidenceDistribution" - ProjectTestNewResponseThresholdsInsightNameConflictingLabelRowCount ProjectTestNewResponseThresholdsInsightName = "conflictingLabelRowCount" - ProjectTestNewResponseThresholdsInsightNameContainsPii ProjectTestNewResponseThresholdsInsightName = "containsPii" - ProjectTestNewResponseThresholdsInsightNameContainsValidURL ProjectTestNewResponseThresholdsInsightName = "containsValidUrl" - ProjectTestNewResponseThresholdsInsightNameCorrelatedFeatures ProjectTestNewResponseThresholdsInsightName = "correlatedFeatures" - ProjectTestNewResponseThresholdsInsightNameCustomMetric ProjectTestNewResponseThresholdsInsightName = "customMetric" - ProjectTestNewResponseThresholdsInsightNameDuplicateRowCount ProjectTestNewResponseThresholdsInsightName = "duplicateRowCount" - ProjectTestNewResponseThresholdsInsightNameEmptyFeatures ProjectTestNewResponseThresholdsInsightName = "emptyFeatures" - ProjectTestNewResponseThresholdsInsightNameFeatureDrift ProjectTestNewResponseThresholdsInsightName = "featureDrift" - ProjectTestNewResponseThresholdsInsightNameFeatureProfile ProjectTestNewResponseThresholdsInsightName = "featureProfile" - ProjectTestNewResponseThresholdsInsightNameGreatExpectations ProjectTestNewResponseThresholdsInsightName = "greatExpectations" - ProjectTestNewResponseThresholdsInsightNameGroupByColumnStatsCheck ProjectTestNewResponseThresholdsInsightName = "groupByColumnStatsCheck" - ProjectTestNewResponseThresholdsInsightNameIllFormedRowCount ProjectTestNewResponseThresholdsInsightName = "illFormedRowCount" - ProjectTestNewResponseThresholdsInsightNameIsCode ProjectTestNewResponseThresholdsInsightName = "isCode" - ProjectTestNewResponseThresholdsInsightNameIsJson ProjectTestNewResponseThresholdsInsightName = "isJson" - ProjectTestNewResponseThresholdsInsightNameLlmRubricV2 ProjectTestNewResponseThresholdsInsightName = "llmRubricV2" - ProjectTestNewResponseThresholdsInsightNameLabelDrift ProjectTestNewResponseThresholdsInsightName = "labelDrift" - ProjectTestNewResponseThresholdsInsightNameMetrics ProjectTestNewResponseThresholdsInsightName = "metrics" - ProjectTestNewResponseThresholdsInsightNameNewCategories ProjectTestNewResponseThresholdsInsightName = "newCategories" - ProjectTestNewResponseThresholdsInsightNameNewLabels ProjectTestNewResponseThresholdsInsightName = "newLabels" - ProjectTestNewResponseThresholdsInsightNameNullRowCount ProjectTestNewResponseThresholdsInsightName = "nullRowCount" - ProjectTestNewResponseThresholdsInsightNamePpScore ProjectTestNewResponseThresholdsInsightName = "ppScore" - ProjectTestNewResponseThresholdsInsightNameQuasiConstantFeatures ProjectTestNewResponseThresholdsInsightName = "quasiConstantFeatures" - ProjectTestNewResponseThresholdsInsightNameSentenceLength ProjectTestNewResponseThresholdsInsightName = "sentenceLength" - ProjectTestNewResponseThresholdsInsightNameSizeRatio ProjectTestNewResponseThresholdsInsightName = "sizeRatio" - ProjectTestNewResponseThresholdsInsightNameSpecialCharacters ProjectTestNewResponseThresholdsInsightName = "specialCharacters" - ProjectTestNewResponseThresholdsInsightNameStringValidation ProjectTestNewResponseThresholdsInsightName = "stringValidation" - ProjectTestNewResponseThresholdsInsightNameTrainValLeakageRowCount ProjectTestNewResponseThresholdsInsightName = "trainValLeakageRowCount" -) - -func (r ProjectTestNewResponseThresholdsInsightName) IsKnown() bool { - switch r { - case ProjectTestNewResponseThresholdsInsightNameCharacterLength, ProjectTestNewResponseThresholdsInsightNameClassImbalance, ProjectTestNewResponseThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestNewResponseThresholdsInsightNameColumnAverage, ProjectTestNewResponseThresholdsInsightNameColumnDrift, ProjectTestNewResponseThresholdsInsightNameColumnValuesMatch, ProjectTestNewResponseThresholdsInsightNameConfidenceDistribution, ProjectTestNewResponseThresholdsInsightNameConflictingLabelRowCount, ProjectTestNewResponseThresholdsInsightNameContainsPii, ProjectTestNewResponseThresholdsInsightNameContainsValidURL, ProjectTestNewResponseThresholdsInsightNameCorrelatedFeatures, ProjectTestNewResponseThresholdsInsightNameCustomMetric, ProjectTestNewResponseThresholdsInsightNameDuplicateRowCount, ProjectTestNewResponseThresholdsInsightNameEmptyFeatures, ProjectTestNewResponseThresholdsInsightNameFeatureDrift, ProjectTestNewResponseThresholdsInsightNameFeatureProfile, ProjectTestNewResponseThresholdsInsightNameGreatExpectations, ProjectTestNewResponseThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestNewResponseThresholdsInsightNameIllFormedRowCount, ProjectTestNewResponseThresholdsInsightNameIsCode, ProjectTestNewResponseThresholdsInsightNameIsJson, ProjectTestNewResponseThresholdsInsightNameLlmRubricV2, ProjectTestNewResponseThresholdsInsightNameLabelDrift, ProjectTestNewResponseThresholdsInsightNameMetrics, ProjectTestNewResponseThresholdsInsightNameNewCategories, ProjectTestNewResponseThresholdsInsightNameNewLabels, ProjectTestNewResponseThresholdsInsightNameNullRowCount, ProjectTestNewResponseThresholdsInsightNamePpScore, ProjectTestNewResponseThresholdsInsightNameQuasiConstantFeatures, ProjectTestNewResponseThresholdsInsightNameSentenceLength, ProjectTestNewResponseThresholdsInsightNameSizeRatio, ProjectTestNewResponseThresholdsInsightNameSpecialCharacters, ProjectTestNewResponseThresholdsInsightNameStringValidation, ProjectTestNewResponseThresholdsInsightNameTrainValLeakageRowCount: - return true - } - return false -} - type ProjectTestNewResponseThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` @@ -408,6 +358,7 @@ func (r ProjectTestNewResponseType) IsKnown() bool { } type ProjectTestListResponse struct { + Meta ProjectTestListResponse_Meta `json:"_meta,required"` Items []ProjectTestListResponseItem `json:"items,required"` JSON projectTestListResponseJSON `json:"-"` } @@ -415,6 +366,7 @@ type ProjectTestListResponse struct { // projectTestListResponseJSON contains the JSON metadata for the struct // [ProjectTestListResponse] type projectTestListResponseJSON struct { + Meta apijson.Field Items apijson.Field raw string ExtraFields map[string]apijson.Field @@ -428,6 +380,37 @@ func (r projectTestListResponseJSON) RawJSON() string { return r.raw } +type ProjectTestListResponse_Meta struct { + // The current page. + Page int64 `json:"page,required"` + // The number of items per page. + PerPage int64 `json:"perPage,required"` + // The total number of items. + TotalItems int64 `json:"totalItems,required"` + // The total number of pages. + TotalPages int64 `json:"totalPages,required"` + JSON projectTestListResponseMetaJSON `json:"-"` +} + +// projectTestListResponseMetaJSON contains the JSON metadata for the struct +// [ProjectTestListResponse_Meta] +type projectTestListResponseMetaJSON struct { + Page apijson.Field + PerPage apijson.Field + TotalItems apijson.Field + TotalPages apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestListResponse_Meta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestListResponseMetaJSON) RawJSON() string { + return r.raw +} + type ProjectTestListResponseItem struct { // The test id. ID string `json:"id,required" format:"uuid"` @@ -570,10 +553,8 @@ func (r ProjectTestListResponseItemsSubtype) IsKnown() bool { type ProjectTestListResponseItemsThreshold struct { // The insight name to be evaluated. - InsightName ProjectTestListResponseItemsThresholdsInsightName `json:"insightName"` - // The insight parameters. Required only for some test subtypes. For example, for - // tests that require a column name, the insight parameters will be [{'name': - // 'column_name', 'value': 'Age'}] + InsightName string `json:"insightName"` + // The insight parameters. Required only for some test subtypes. InsightParameters []ProjectTestListResponseItemsThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -607,54 +588,6 @@ func (r projectTestListResponseItemsThresholdJSON) RawJSON() string { return r.raw } -// The insight name to be evaluated. -type ProjectTestListResponseItemsThresholdsInsightName string - -const ( - ProjectTestListResponseItemsThresholdsInsightNameCharacterLength ProjectTestListResponseItemsThresholdsInsightName = "characterLength" - ProjectTestListResponseItemsThresholdsInsightNameClassImbalance ProjectTestListResponseItemsThresholdsInsightName = "classImbalance" - ProjectTestListResponseItemsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestListResponseItemsThresholdsInsightName = "expectColumnAToBeInColumnB" - ProjectTestListResponseItemsThresholdsInsightNameColumnAverage ProjectTestListResponseItemsThresholdsInsightName = "columnAverage" - ProjectTestListResponseItemsThresholdsInsightNameColumnDrift ProjectTestListResponseItemsThresholdsInsightName = "columnDrift" - ProjectTestListResponseItemsThresholdsInsightNameColumnValuesMatch ProjectTestListResponseItemsThresholdsInsightName = "columnValuesMatch" - ProjectTestListResponseItemsThresholdsInsightNameConfidenceDistribution ProjectTestListResponseItemsThresholdsInsightName = "confidenceDistribution" - ProjectTestListResponseItemsThresholdsInsightNameConflictingLabelRowCount ProjectTestListResponseItemsThresholdsInsightName = "conflictingLabelRowCount" - ProjectTestListResponseItemsThresholdsInsightNameContainsPii ProjectTestListResponseItemsThresholdsInsightName = "containsPii" - ProjectTestListResponseItemsThresholdsInsightNameContainsValidURL ProjectTestListResponseItemsThresholdsInsightName = "containsValidUrl" - ProjectTestListResponseItemsThresholdsInsightNameCorrelatedFeatures ProjectTestListResponseItemsThresholdsInsightName = "correlatedFeatures" - ProjectTestListResponseItemsThresholdsInsightNameCustomMetric ProjectTestListResponseItemsThresholdsInsightName = "customMetric" - ProjectTestListResponseItemsThresholdsInsightNameDuplicateRowCount ProjectTestListResponseItemsThresholdsInsightName = "duplicateRowCount" - ProjectTestListResponseItemsThresholdsInsightNameEmptyFeatures ProjectTestListResponseItemsThresholdsInsightName = "emptyFeatures" - ProjectTestListResponseItemsThresholdsInsightNameFeatureDrift ProjectTestListResponseItemsThresholdsInsightName = "featureDrift" - ProjectTestListResponseItemsThresholdsInsightNameFeatureProfile ProjectTestListResponseItemsThresholdsInsightName = "featureProfile" - ProjectTestListResponseItemsThresholdsInsightNameGreatExpectations ProjectTestListResponseItemsThresholdsInsightName = "greatExpectations" - ProjectTestListResponseItemsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestListResponseItemsThresholdsInsightName = "groupByColumnStatsCheck" - ProjectTestListResponseItemsThresholdsInsightNameIllFormedRowCount ProjectTestListResponseItemsThresholdsInsightName = "illFormedRowCount" - ProjectTestListResponseItemsThresholdsInsightNameIsCode ProjectTestListResponseItemsThresholdsInsightName = "isCode" - ProjectTestListResponseItemsThresholdsInsightNameIsJson ProjectTestListResponseItemsThresholdsInsightName = "isJson" - ProjectTestListResponseItemsThresholdsInsightNameLlmRubricV2 ProjectTestListResponseItemsThresholdsInsightName = "llmRubricV2" - ProjectTestListResponseItemsThresholdsInsightNameLabelDrift ProjectTestListResponseItemsThresholdsInsightName = "labelDrift" - ProjectTestListResponseItemsThresholdsInsightNameMetrics ProjectTestListResponseItemsThresholdsInsightName = "metrics" - ProjectTestListResponseItemsThresholdsInsightNameNewCategories ProjectTestListResponseItemsThresholdsInsightName = "newCategories" - ProjectTestListResponseItemsThresholdsInsightNameNewLabels ProjectTestListResponseItemsThresholdsInsightName = "newLabels" - ProjectTestListResponseItemsThresholdsInsightNameNullRowCount ProjectTestListResponseItemsThresholdsInsightName = "nullRowCount" - ProjectTestListResponseItemsThresholdsInsightNamePpScore ProjectTestListResponseItemsThresholdsInsightName = "ppScore" - ProjectTestListResponseItemsThresholdsInsightNameQuasiConstantFeatures ProjectTestListResponseItemsThresholdsInsightName = "quasiConstantFeatures" - ProjectTestListResponseItemsThresholdsInsightNameSentenceLength ProjectTestListResponseItemsThresholdsInsightName = "sentenceLength" - ProjectTestListResponseItemsThresholdsInsightNameSizeRatio ProjectTestListResponseItemsThresholdsInsightName = "sizeRatio" - ProjectTestListResponseItemsThresholdsInsightNameSpecialCharacters ProjectTestListResponseItemsThresholdsInsightName = "specialCharacters" - ProjectTestListResponseItemsThresholdsInsightNameStringValidation ProjectTestListResponseItemsThresholdsInsightName = "stringValidation" - ProjectTestListResponseItemsThresholdsInsightNameTrainValLeakageRowCount ProjectTestListResponseItemsThresholdsInsightName = "trainValLeakageRowCount" -) - -func (r ProjectTestListResponseItemsThresholdsInsightName) IsKnown() bool { - switch r { - case ProjectTestListResponseItemsThresholdsInsightNameCharacterLength, ProjectTestListResponseItemsThresholdsInsightNameClassImbalance, ProjectTestListResponseItemsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestListResponseItemsThresholdsInsightNameColumnAverage, ProjectTestListResponseItemsThresholdsInsightNameColumnDrift, ProjectTestListResponseItemsThresholdsInsightNameColumnValuesMatch, ProjectTestListResponseItemsThresholdsInsightNameConfidenceDistribution, ProjectTestListResponseItemsThresholdsInsightNameConflictingLabelRowCount, ProjectTestListResponseItemsThresholdsInsightNameContainsPii, ProjectTestListResponseItemsThresholdsInsightNameContainsValidURL, ProjectTestListResponseItemsThresholdsInsightNameCorrelatedFeatures, ProjectTestListResponseItemsThresholdsInsightNameCustomMetric, ProjectTestListResponseItemsThresholdsInsightNameDuplicateRowCount, ProjectTestListResponseItemsThresholdsInsightNameEmptyFeatures, ProjectTestListResponseItemsThresholdsInsightNameFeatureDrift, ProjectTestListResponseItemsThresholdsInsightNameFeatureProfile, ProjectTestListResponseItemsThresholdsInsightNameGreatExpectations, ProjectTestListResponseItemsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestListResponseItemsThresholdsInsightNameIllFormedRowCount, ProjectTestListResponseItemsThresholdsInsightNameIsCode, ProjectTestListResponseItemsThresholdsInsightNameIsJson, ProjectTestListResponseItemsThresholdsInsightNameLlmRubricV2, ProjectTestListResponseItemsThresholdsInsightNameLabelDrift, ProjectTestListResponseItemsThresholdsInsightNameMetrics, ProjectTestListResponseItemsThresholdsInsightNameNewCategories, ProjectTestListResponseItemsThresholdsInsightNameNewLabels, ProjectTestListResponseItemsThresholdsInsightNameNullRowCount, ProjectTestListResponseItemsThresholdsInsightNamePpScore, ProjectTestListResponseItemsThresholdsInsightNameQuasiConstantFeatures, ProjectTestListResponseItemsThresholdsInsightNameSentenceLength, ProjectTestListResponseItemsThresholdsInsightNameSizeRatio, ProjectTestListResponseItemsThresholdsInsightNameSpecialCharacters, ProjectTestListResponseItemsThresholdsInsightNameStringValidation, ProjectTestListResponseItemsThresholdsInsightNameTrainValLeakageRowCount: - return true - } - return false -} - type ProjectTestListResponseItemsThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` @@ -862,10 +795,8 @@ func (r ProjectTestNewParamsSubtype) IsKnown() bool { type ProjectTestNewParamsThreshold struct { // The insight name to be evaluated. - InsightName param.Field[ProjectTestNewParamsThresholdsInsightName] `json:"insightName"` - // The insight parameters. Required only for some test subtypes. For example, for - // tests that require a column name, the insight parameters will be [{'name': - // 'column_name', 'value': 'Age'}] + InsightName param.Field[string] `json:"insightName"` + // The insight parameters. Required only for some test subtypes. InsightParameters param.Field[[]ProjectTestNewParamsThresholdsInsightParameter] `json:"insightParameters"` // The measurement to be evaluated. Measurement param.Field[string] `json:"measurement"` @@ -881,54 +812,6 @@ func (r ProjectTestNewParamsThreshold) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The insight name to be evaluated. -type ProjectTestNewParamsThresholdsInsightName string - -const ( - ProjectTestNewParamsThresholdsInsightNameCharacterLength ProjectTestNewParamsThresholdsInsightName = "characterLength" - ProjectTestNewParamsThresholdsInsightNameClassImbalance ProjectTestNewParamsThresholdsInsightName = "classImbalance" - ProjectTestNewParamsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestNewParamsThresholdsInsightName = "expectColumnAToBeInColumnB" - ProjectTestNewParamsThresholdsInsightNameColumnAverage ProjectTestNewParamsThresholdsInsightName = "columnAverage" - ProjectTestNewParamsThresholdsInsightNameColumnDrift ProjectTestNewParamsThresholdsInsightName = "columnDrift" - ProjectTestNewParamsThresholdsInsightNameColumnValuesMatch ProjectTestNewParamsThresholdsInsightName = "columnValuesMatch" - ProjectTestNewParamsThresholdsInsightNameConfidenceDistribution ProjectTestNewParamsThresholdsInsightName = "confidenceDistribution" - ProjectTestNewParamsThresholdsInsightNameConflictingLabelRowCount ProjectTestNewParamsThresholdsInsightName = "conflictingLabelRowCount" - ProjectTestNewParamsThresholdsInsightNameContainsPii ProjectTestNewParamsThresholdsInsightName = "containsPii" - ProjectTestNewParamsThresholdsInsightNameContainsValidURL ProjectTestNewParamsThresholdsInsightName = "containsValidUrl" - ProjectTestNewParamsThresholdsInsightNameCorrelatedFeatures ProjectTestNewParamsThresholdsInsightName = "correlatedFeatures" - ProjectTestNewParamsThresholdsInsightNameCustomMetric ProjectTestNewParamsThresholdsInsightName = "customMetric" - ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount ProjectTestNewParamsThresholdsInsightName = "duplicateRowCount" - ProjectTestNewParamsThresholdsInsightNameEmptyFeatures ProjectTestNewParamsThresholdsInsightName = "emptyFeatures" - ProjectTestNewParamsThresholdsInsightNameFeatureDrift ProjectTestNewParamsThresholdsInsightName = "featureDrift" - ProjectTestNewParamsThresholdsInsightNameFeatureProfile ProjectTestNewParamsThresholdsInsightName = "featureProfile" - ProjectTestNewParamsThresholdsInsightNameGreatExpectations ProjectTestNewParamsThresholdsInsightName = "greatExpectations" - ProjectTestNewParamsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestNewParamsThresholdsInsightName = "groupByColumnStatsCheck" - ProjectTestNewParamsThresholdsInsightNameIllFormedRowCount ProjectTestNewParamsThresholdsInsightName = "illFormedRowCount" - ProjectTestNewParamsThresholdsInsightNameIsCode ProjectTestNewParamsThresholdsInsightName = "isCode" - ProjectTestNewParamsThresholdsInsightNameIsJson ProjectTestNewParamsThresholdsInsightName = "isJson" - ProjectTestNewParamsThresholdsInsightNameLlmRubricV2 ProjectTestNewParamsThresholdsInsightName = "llmRubricV2" - ProjectTestNewParamsThresholdsInsightNameLabelDrift ProjectTestNewParamsThresholdsInsightName = "labelDrift" - ProjectTestNewParamsThresholdsInsightNameMetrics ProjectTestNewParamsThresholdsInsightName = "metrics" - ProjectTestNewParamsThresholdsInsightNameNewCategories ProjectTestNewParamsThresholdsInsightName = "newCategories" - ProjectTestNewParamsThresholdsInsightNameNewLabels ProjectTestNewParamsThresholdsInsightName = "newLabels" - ProjectTestNewParamsThresholdsInsightNameNullRowCount ProjectTestNewParamsThresholdsInsightName = "nullRowCount" - ProjectTestNewParamsThresholdsInsightNamePpScore ProjectTestNewParamsThresholdsInsightName = "ppScore" - ProjectTestNewParamsThresholdsInsightNameQuasiConstantFeatures ProjectTestNewParamsThresholdsInsightName = "quasiConstantFeatures" - ProjectTestNewParamsThresholdsInsightNameSentenceLength ProjectTestNewParamsThresholdsInsightName = "sentenceLength" - ProjectTestNewParamsThresholdsInsightNameSizeRatio ProjectTestNewParamsThresholdsInsightName = "sizeRatio" - ProjectTestNewParamsThresholdsInsightNameSpecialCharacters ProjectTestNewParamsThresholdsInsightName = "specialCharacters" - ProjectTestNewParamsThresholdsInsightNameStringValidation ProjectTestNewParamsThresholdsInsightName = "stringValidation" - ProjectTestNewParamsThresholdsInsightNameTrainValLeakageRowCount ProjectTestNewParamsThresholdsInsightName = "trainValLeakageRowCount" -) - -func (r ProjectTestNewParamsThresholdsInsightName) IsKnown() bool { - switch r { - case ProjectTestNewParamsThresholdsInsightNameCharacterLength, ProjectTestNewParamsThresholdsInsightNameClassImbalance, ProjectTestNewParamsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestNewParamsThresholdsInsightNameColumnAverage, ProjectTestNewParamsThresholdsInsightNameColumnDrift, ProjectTestNewParamsThresholdsInsightNameColumnValuesMatch, ProjectTestNewParamsThresholdsInsightNameConfidenceDistribution, ProjectTestNewParamsThresholdsInsightNameConflictingLabelRowCount, ProjectTestNewParamsThresholdsInsightNameContainsPii, ProjectTestNewParamsThresholdsInsightNameContainsValidURL, ProjectTestNewParamsThresholdsInsightNameCorrelatedFeatures, ProjectTestNewParamsThresholdsInsightNameCustomMetric, ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount, ProjectTestNewParamsThresholdsInsightNameEmptyFeatures, ProjectTestNewParamsThresholdsInsightNameFeatureDrift, ProjectTestNewParamsThresholdsInsightNameFeatureProfile, ProjectTestNewParamsThresholdsInsightNameGreatExpectations, ProjectTestNewParamsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestNewParamsThresholdsInsightNameIllFormedRowCount, ProjectTestNewParamsThresholdsInsightNameIsCode, ProjectTestNewParamsThresholdsInsightNameIsJson, ProjectTestNewParamsThresholdsInsightNameLlmRubricV2, ProjectTestNewParamsThresholdsInsightNameLabelDrift, ProjectTestNewParamsThresholdsInsightNameMetrics, ProjectTestNewParamsThresholdsInsightNameNewCategories, ProjectTestNewParamsThresholdsInsightNameNewLabels, ProjectTestNewParamsThresholdsInsightNameNullRowCount, ProjectTestNewParamsThresholdsInsightNamePpScore, ProjectTestNewParamsThresholdsInsightNameQuasiConstantFeatures, ProjectTestNewParamsThresholdsInsightNameSentenceLength, ProjectTestNewParamsThresholdsInsightNameSizeRatio, ProjectTestNewParamsThresholdsInsightNameSpecialCharacters, ProjectTestNewParamsThresholdsInsightNameStringValidation, ProjectTestNewParamsThresholdsInsightNameTrainValLeakageRowCount: - return true - } - return false -} - type ProjectTestNewParamsThresholdsInsightParameter struct { // The name of the insight filter. Name param.Field[string] `json:"name,required"` diff --git a/projecttest_test.go b/projecttest_test.go index 7273a54..95d0833 100644 --- a/projecttest_test.go +++ b/projecttest_test.go @@ -34,7 +34,7 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { Name: openlayer.F("No duplicate rows"), Subtype: openlayer.F(openlayer.ProjectTestNewParamsSubtypeDuplicateRowCount), Thresholds: openlayer.F([]openlayer.ProjectTestNewParamsThreshold{{ - InsightName: openlayer.F(openlayer.ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount), + InsightName: openlayer.F("duplicateRowCount"), InsightParameters: openlayer.F([]openlayer.ProjectTestNewParamsThresholdsInsightParameter{{ Name: openlayer.F("column_name"), Value: openlayer.F[any]("Age"), From 9ca34f2376b8e7736bc178b64fb8de6f14dc09f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:38:01 +0000 Subject: [PATCH 23/26] feat(api): api update --- .stats.yml | 4 +- api.md | 2 + committestresult.go | 54 ++++- inferencepipelinetestresult.go | 54 ++++- projecttest.go | 396 +++++++++++++++++++++++++++++---- projecttest_test.go | 47 +++- shared/union.go | 3 + 7 files changed, 514 insertions(+), 46 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4546c8a..0998013 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 17 -openapi_spec_hash: 8827ead72aa0c635ccafac5e008fe247 +configured_endpoints: 18 +openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce config_hash: 30422a4611d93ca69e4f1aff60b9ddb5 diff --git a/api.md b/api.md index 7d888a4..86f7139 100644 --- a/api.md +++ b/api.md @@ -39,11 +39,13 @@ Methods: Response Types: - openlayer.ProjectTestNewResponse +- openlayer.ProjectTestUpdateResponse - openlayer.ProjectTestListResponse Methods: - client.Projects.Tests.New(ctx context.Context, projectID string, body openlayer.ProjectTestNewParams) (openlayer.ProjectTestNewResponse, error) +- client.Projects.Tests.Update(ctx context.Context, projectID string, body openlayer.ProjectTestUpdateParams) (openlayer.ProjectTestUpdateResponse, error) - client.Projects.Tests.List(ctx context.Context, projectID string, query openlayer.ProjectTestListParams) (openlayer.ProjectTestListResponse, error) # Commits diff --git a/committestresult.go b/committestresult.go index 0ec5ff1..936a268 100644 --- a/committestresult.go +++ b/committestresult.go @@ -284,8 +284,10 @@ func (r CommitTestResultListResponseItemsGoalSubtype) IsKnown() bool { type CommitTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName CommitTestResultListResponseItemsGoalThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []CommitTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -319,6 +321,54 @@ func (r commitTestResultListResponseItemsGoalThresholdJSON) RawJSON() string { return r.raw } +// The insight name to be evaluated. +type CommitTestResultListResponseItemsGoalThresholdsInsightName string + +const ( + CommitTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength CommitTestResultListResponseItemsGoalThresholdsInsightName = "characterLength" + CommitTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance CommitTestResultListResponseItemsGoalThresholdsInsightName = "classImbalance" + CommitTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB CommitTestResultListResponseItemsGoalThresholdsInsightName = "expectColumnAToBeInColumnB" + CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnAverage" + CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnDrift" + CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch CommitTestResultListResponseItemsGoalThresholdsInsightName = "columnValuesMatch" + CommitTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution CommitTestResultListResponseItemsGoalThresholdsInsightName = "confidenceDistribution" + CommitTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "conflictingLabelRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsPii CommitTestResultListResponseItemsGoalThresholdsInsightName = "containsPii" + CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL CommitTestResultListResponseItemsGoalThresholdsInsightName = "containsValidUrl" + CommitTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "correlatedFeatures" + CommitTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric CommitTestResultListResponseItemsGoalThresholdsInsightName = "customMetric" + CommitTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "duplicateRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "emptyFeatures" + CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "featureDrift" + CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile CommitTestResultListResponseItemsGoalThresholdsInsightName = "featureProfile" + CommitTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations CommitTestResultListResponseItemsGoalThresholdsInsightName = "greatExpectations" + CommitTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck CommitTestResultListResponseItemsGoalThresholdsInsightName = "groupByColumnStatsCheck" + CommitTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "illFormedRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNameIsCode CommitTestResultListResponseItemsGoalThresholdsInsightName = "isCode" + CommitTestResultListResponseItemsGoalThresholdsInsightNameIsJson CommitTestResultListResponseItemsGoalThresholdsInsightName = "isJson" + CommitTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2 CommitTestResultListResponseItemsGoalThresholdsInsightName = "llmRubricV2" + CommitTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift CommitTestResultListResponseItemsGoalThresholdsInsightName = "labelDrift" + CommitTestResultListResponseItemsGoalThresholdsInsightNameMetrics CommitTestResultListResponseItemsGoalThresholdsInsightName = "metrics" + CommitTestResultListResponseItemsGoalThresholdsInsightNameNewCategories CommitTestResultListResponseItemsGoalThresholdsInsightName = "newCategories" + CommitTestResultListResponseItemsGoalThresholdsInsightNameNewLabels CommitTestResultListResponseItemsGoalThresholdsInsightName = "newLabels" + CommitTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "nullRowCount" + CommitTestResultListResponseItemsGoalThresholdsInsightNamePpScore CommitTestResultListResponseItemsGoalThresholdsInsightName = "ppScore" + CommitTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures CommitTestResultListResponseItemsGoalThresholdsInsightName = "quasiConstantFeatures" + CommitTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength CommitTestResultListResponseItemsGoalThresholdsInsightName = "sentenceLength" + CommitTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio CommitTestResultListResponseItemsGoalThresholdsInsightName = "sizeRatio" + CommitTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters CommitTestResultListResponseItemsGoalThresholdsInsightName = "specialCharacters" + CommitTestResultListResponseItemsGoalThresholdsInsightNameStringValidation CommitTestResultListResponseItemsGoalThresholdsInsightName = "stringValidation" + CommitTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount CommitTestResultListResponseItemsGoalThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r CommitTestResultListResponseItemsGoalThresholdsInsightName) IsKnown() bool { + switch r { + case CommitTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength, CommitTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance, CommitTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch, CommitTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution, CommitTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsPii, CommitTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL, CommitTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric, CommitTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile, CommitTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations, CommitTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck, CommitTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNameIsCode, CommitTestResultListResponseItemsGoalThresholdsInsightNameIsJson, CommitTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2, CommitTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift, CommitTestResultListResponseItemsGoalThresholdsInsightNameMetrics, CommitTestResultListResponseItemsGoalThresholdsInsightNameNewCategories, CommitTestResultListResponseItemsGoalThresholdsInsightNameNewLabels, CommitTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount, CommitTestResultListResponseItemsGoalThresholdsInsightNamePpScore, CommitTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures, CommitTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength, CommitTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio, CommitTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters, CommitTestResultListResponseItemsGoalThresholdsInsightNameStringValidation, CommitTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type CommitTestResultListResponseItemsGoalThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` diff --git a/inferencepipelinetestresult.go b/inferencepipelinetestresult.go index 1125cd3..d21a8df 100644 --- a/inferencepipelinetestresult.go +++ b/inferencepipelinetestresult.go @@ -284,8 +284,10 @@ func (r InferencePipelineTestResultListResponseItemsGoalSubtype) IsKnown() bool type InferencePipelineTestResultListResponseItemsGoalThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -320,6 +322,54 @@ func (r inferencePipelineTestResultListResponseItemsGoalThresholdJSON) RawJSON() return r.raw } +// The insight name to be evaluated. +type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName string + +const ( + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "characterLength" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "classImbalance" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "expectColumnAToBeInColumnB" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnAverage" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnDrift" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "columnValuesMatch" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "confidenceDistribution" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "conflictingLabelRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsPii InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "containsPii" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "containsValidUrl" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "correlatedFeatures" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "customMetric" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "duplicateRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "emptyFeatures" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "featureDrift" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "featureProfile" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "greatExpectations" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "groupByColumnStatsCheck" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "illFormedRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsCode InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "isCode" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsJson InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "isJson" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2 InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "llmRubricV2" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "labelDrift" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameMetrics InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "metrics" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewCategories InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "newCategories" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewLabels InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "newLabels" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "nullRowCount" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNamePpScore InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "ppScore" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "quasiConstantFeatures" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "sentenceLength" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "sizeRatio" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "specialCharacters" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameStringValidation InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "stringValidation" + InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r InferencePipelineTestResultListResponseItemsGoalThresholdsInsightName) IsKnown() bool { + switch r { + case InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCharacterLength, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameClassImbalance, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameExpectColumnAToBeInColumnB, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnAverage, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameColumnValuesMatch, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConfidenceDistribution, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameConflictingLabelRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsPii, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameContainsValidURL, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCorrelatedFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameCustomMetric, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameDuplicateRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameEmptyFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameFeatureProfile, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGreatExpectations, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameGroupByColumnStatsCheck, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIllFormedRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsCode, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameIsJson, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLlmRubricV2, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameLabelDrift, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameMetrics, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewCategories, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNewLabels, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameNullRowCount, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNamePpScore, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameQuasiConstantFeatures, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSentenceLength, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSizeRatio, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameSpecialCharacters, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameStringValidation, InferencePipelineTestResultListResponseItemsGoalThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type InferencePipelineTestResultListResponseItemsGoalThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` diff --git a/projecttest.go b/projecttest.go index 4e96534..661b32b 100644 --- a/projecttest.go +++ b/projecttest.go @@ -51,6 +51,18 @@ func (r *ProjectTestService) New(ctx context.Context, projectID string, body Pro return } +// Update tests. +func (r *ProjectTestService) Update(ctx context.Context, projectID string, body ProjectTestUpdateParams, opts ...option.RequestOption) (res *ProjectTestUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + if projectID == "" { + err = errors.New("missing required projectId parameter") + return + } + path := fmt.Sprintf("projects/%s/tests", projectID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...) + return +} + // List tests under a project. func (r *ProjectTestService) List(ctx context.Context, projectID string, query ProjectTestListParams, opts ...option.RequestOption) (res *ProjectTestListResponse, err error) { opts = append(r.Options[:], opts...) @@ -205,8 +217,10 @@ func (r ProjectTestNewResponseSubtype) IsKnown() bool { type ProjectTestNewResponseThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName ProjectTestNewResponseThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []ProjectTestNewResponseThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -240,6 +254,54 @@ func (r projectTestNewResponseThresholdJSON) RawJSON() string { return r.raw } +// The insight name to be evaluated. +type ProjectTestNewResponseThresholdsInsightName string + +const ( + ProjectTestNewResponseThresholdsInsightNameCharacterLength ProjectTestNewResponseThresholdsInsightName = "characterLength" + ProjectTestNewResponseThresholdsInsightNameClassImbalance ProjectTestNewResponseThresholdsInsightName = "classImbalance" + ProjectTestNewResponseThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestNewResponseThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestNewResponseThresholdsInsightNameColumnAverage ProjectTestNewResponseThresholdsInsightName = "columnAverage" + ProjectTestNewResponseThresholdsInsightNameColumnDrift ProjectTestNewResponseThresholdsInsightName = "columnDrift" + ProjectTestNewResponseThresholdsInsightNameColumnValuesMatch ProjectTestNewResponseThresholdsInsightName = "columnValuesMatch" + ProjectTestNewResponseThresholdsInsightNameConfidenceDistribution ProjectTestNewResponseThresholdsInsightName = "confidenceDistribution" + ProjectTestNewResponseThresholdsInsightNameConflictingLabelRowCount ProjectTestNewResponseThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestNewResponseThresholdsInsightNameContainsPii ProjectTestNewResponseThresholdsInsightName = "containsPii" + ProjectTestNewResponseThresholdsInsightNameContainsValidURL ProjectTestNewResponseThresholdsInsightName = "containsValidUrl" + ProjectTestNewResponseThresholdsInsightNameCorrelatedFeatures ProjectTestNewResponseThresholdsInsightName = "correlatedFeatures" + ProjectTestNewResponseThresholdsInsightNameCustomMetric ProjectTestNewResponseThresholdsInsightName = "customMetric" + ProjectTestNewResponseThresholdsInsightNameDuplicateRowCount ProjectTestNewResponseThresholdsInsightName = "duplicateRowCount" + ProjectTestNewResponseThresholdsInsightNameEmptyFeatures ProjectTestNewResponseThresholdsInsightName = "emptyFeatures" + ProjectTestNewResponseThresholdsInsightNameFeatureDrift ProjectTestNewResponseThresholdsInsightName = "featureDrift" + ProjectTestNewResponseThresholdsInsightNameFeatureProfile ProjectTestNewResponseThresholdsInsightName = "featureProfile" + ProjectTestNewResponseThresholdsInsightNameGreatExpectations ProjectTestNewResponseThresholdsInsightName = "greatExpectations" + ProjectTestNewResponseThresholdsInsightNameGroupByColumnStatsCheck ProjectTestNewResponseThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestNewResponseThresholdsInsightNameIllFormedRowCount ProjectTestNewResponseThresholdsInsightName = "illFormedRowCount" + ProjectTestNewResponseThresholdsInsightNameIsCode ProjectTestNewResponseThresholdsInsightName = "isCode" + ProjectTestNewResponseThresholdsInsightNameIsJson ProjectTestNewResponseThresholdsInsightName = "isJson" + ProjectTestNewResponseThresholdsInsightNameLlmRubricV2 ProjectTestNewResponseThresholdsInsightName = "llmRubricV2" + ProjectTestNewResponseThresholdsInsightNameLabelDrift ProjectTestNewResponseThresholdsInsightName = "labelDrift" + ProjectTestNewResponseThresholdsInsightNameMetrics ProjectTestNewResponseThresholdsInsightName = "metrics" + ProjectTestNewResponseThresholdsInsightNameNewCategories ProjectTestNewResponseThresholdsInsightName = "newCategories" + ProjectTestNewResponseThresholdsInsightNameNewLabels ProjectTestNewResponseThresholdsInsightName = "newLabels" + ProjectTestNewResponseThresholdsInsightNameNullRowCount ProjectTestNewResponseThresholdsInsightName = "nullRowCount" + ProjectTestNewResponseThresholdsInsightNamePpScore ProjectTestNewResponseThresholdsInsightName = "ppScore" + ProjectTestNewResponseThresholdsInsightNameQuasiConstantFeatures ProjectTestNewResponseThresholdsInsightName = "quasiConstantFeatures" + ProjectTestNewResponseThresholdsInsightNameSentenceLength ProjectTestNewResponseThresholdsInsightName = "sentenceLength" + ProjectTestNewResponseThresholdsInsightNameSizeRatio ProjectTestNewResponseThresholdsInsightName = "sizeRatio" + ProjectTestNewResponseThresholdsInsightNameSpecialCharacters ProjectTestNewResponseThresholdsInsightName = "specialCharacters" + ProjectTestNewResponseThresholdsInsightNameStringValidation ProjectTestNewResponseThresholdsInsightName = "stringValidation" + ProjectTestNewResponseThresholdsInsightNameTrainValLeakageRowCount ProjectTestNewResponseThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestNewResponseThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestNewResponseThresholdsInsightNameCharacterLength, ProjectTestNewResponseThresholdsInsightNameClassImbalance, ProjectTestNewResponseThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestNewResponseThresholdsInsightNameColumnAverage, ProjectTestNewResponseThresholdsInsightNameColumnDrift, ProjectTestNewResponseThresholdsInsightNameColumnValuesMatch, ProjectTestNewResponseThresholdsInsightNameConfidenceDistribution, ProjectTestNewResponseThresholdsInsightNameConflictingLabelRowCount, ProjectTestNewResponseThresholdsInsightNameContainsPii, ProjectTestNewResponseThresholdsInsightNameContainsValidURL, ProjectTestNewResponseThresholdsInsightNameCorrelatedFeatures, ProjectTestNewResponseThresholdsInsightNameCustomMetric, ProjectTestNewResponseThresholdsInsightNameDuplicateRowCount, ProjectTestNewResponseThresholdsInsightNameEmptyFeatures, ProjectTestNewResponseThresholdsInsightNameFeatureDrift, ProjectTestNewResponseThresholdsInsightNameFeatureProfile, ProjectTestNewResponseThresholdsInsightNameGreatExpectations, ProjectTestNewResponseThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestNewResponseThresholdsInsightNameIllFormedRowCount, ProjectTestNewResponseThresholdsInsightNameIsCode, ProjectTestNewResponseThresholdsInsightNameIsJson, ProjectTestNewResponseThresholdsInsightNameLlmRubricV2, ProjectTestNewResponseThresholdsInsightNameLabelDrift, ProjectTestNewResponseThresholdsInsightNameMetrics, ProjectTestNewResponseThresholdsInsightNameNewCategories, ProjectTestNewResponseThresholdsInsightNameNewLabels, ProjectTestNewResponseThresholdsInsightNameNullRowCount, ProjectTestNewResponseThresholdsInsightNamePpScore, ProjectTestNewResponseThresholdsInsightNameQuasiConstantFeatures, ProjectTestNewResponseThresholdsInsightNameSentenceLength, ProjectTestNewResponseThresholdsInsightNameSizeRatio, ProjectTestNewResponseThresholdsInsightNameSpecialCharacters, ProjectTestNewResponseThresholdsInsightNameStringValidation, ProjectTestNewResponseThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestNewResponseThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` @@ -357,8 +419,30 @@ func (r ProjectTestNewResponseType) IsKnown() bool { return false } +type ProjectTestUpdateResponse struct { + TaskResultID string `json:"taskResultId"` + TaskResultURL string `json:"taskResultUrl"` + JSON projectTestUpdateResponseJSON `json:"-"` +} + +// projectTestUpdateResponseJSON contains the JSON metadata for the struct +// [ProjectTestUpdateResponse] +type projectTestUpdateResponseJSON struct { + TaskResultID apijson.Field + TaskResultURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ProjectTestUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r projectTestUpdateResponseJSON) RawJSON() string { + return r.raw +} + type ProjectTestListResponse struct { - Meta ProjectTestListResponse_Meta `json:"_meta,required"` Items []ProjectTestListResponseItem `json:"items,required"` JSON projectTestListResponseJSON `json:"-"` } @@ -366,7 +450,6 @@ type ProjectTestListResponse struct { // projectTestListResponseJSON contains the JSON metadata for the struct // [ProjectTestListResponse] type projectTestListResponseJSON struct { - Meta apijson.Field Items apijson.Field raw string ExtraFields map[string]apijson.Field @@ -380,37 +463,6 @@ func (r projectTestListResponseJSON) RawJSON() string { return r.raw } -type ProjectTestListResponse_Meta struct { - // The current page. - Page int64 `json:"page,required"` - // The number of items per page. - PerPage int64 `json:"perPage,required"` - // The total number of items. - TotalItems int64 `json:"totalItems,required"` - // The total number of pages. - TotalPages int64 `json:"totalPages,required"` - JSON projectTestListResponseMetaJSON `json:"-"` -} - -// projectTestListResponseMetaJSON contains the JSON metadata for the struct -// [ProjectTestListResponse_Meta] -type projectTestListResponseMetaJSON struct { - Page apijson.Field - PerPage apijson.Field - TotalItems apijson.Field - TotalPages apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ProjectTestListResponse_Meta) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r projectTestListResponseMetaJSON) RawJSON() string { - return r.raw -} - type ProjectTestListResponseItem struct { // The test id. ID string `json:"id,required" format:"uuid"` @@ -553,8 +605,10 @@ func (r ProjectTestListResponseItemsSubtype) IsKnown() bool { type ProjectTestListResponseItemsThreshold struct { // The insight name to be evaluated. - InsightName string `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName ProjectTestListResponseItemsThresholdsInsightName `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters []ProjectTestListResponseItemsThresholdsInsightParameter `json:"insightParameters,nullable"` // The measurement to be evaluated. Measurement string `json:"measurement"` @@ -588,6 +642,54 @@ func (r projectTestListResponseItemsThresholdJSON) RawJSON() string { return r.raw } +// The insight name to be evaluated. +type ProjectTestListResponseItemsThresholdsInsightName string + +const ( + ProjectTestListResponseItemsThresholdsInsightNameCharacterLength ProjectTestListResponseItemsThresholdsInsightName = "characterLength" + ProjectTestListResponseItemsThresholdsInsightNameClassImbalance ProjectTestListResponseItemsThresholdsInsightName = "classImbalance" + ProjectTestListResponseItemsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestListResponseItemsThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestListResponseItemsThresholdsInsightNameColumnAverage ProjectTestListResponseItemsThresholdsInsightName = "columnAverage" + ProjectTestListResponseItemsThresholdsInsightNameColumnDrift ProjectTestListResponseItemsThresholdsInsightName = "columnDrift" + ProjectTestListResponseItemsThresholdsInsightNameColumnValuesMatch ProjectTestListResponseItemsThresholdsInsightName = "columnValuesMatch" + ProjectTestListResponseItemsThresholdsInsightNameConfidenceDistribution ProjectTestListResponseItemsThresholdsInsightName = "confidenceDistribution" + ProjectTestListResponseItemsThresholdsInsightNameConflictingLabelRowCount ProjectTestListResponseItemsThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestListResponseItemsThresholdsInsightNameContainsPii ProjectTestListResponseItemsThresholdsInsightName = "containsPii" + ProjectTestListResponseItemsThresholdsInsightNameContainsValidURL ProjectTestListResponseItemsThresholdsInsightName = "containsValidUrl" + ProjectTestListResponseItemsThresholdsInsightNameCorrelatedFeatures ProjectTestListResponseItemsThresholdsInsightName = "correlatedFeatures" + ProjectTestListResponseItemsThresholdsInsightNameCustomMetric ProjectTestListResponseItemsThresholdsInsightName = "customMetric" + ProjectTestListResponseItemsThresholdsInsightNameDuplicateRowCount ProjectTestListResponseItemsThresholdsInsightName = "duplicateRowCount" + ProjectTestListResponseItemsThresholdsInsightNameEmptyFeatures ProjectTestListResponseItemsThresholdsInsightName = "emptyFeatures" + ProjectTestListResponseItemsThresholdsInsightNameFeatureDrift ProjectTestListResponseItemsThresholdsInsightName = "featureDrift" + ProjectTestListResponseItemsThresholdsInsightNameFeatureProfile ProjectTestListResponseItemsThresholdsInsightName = "featureProfile" + ProjectTestListResponseItemsThresholdsInsightNameGreatExpectations ProjectTestListResponseItemsThresholdsInsightName = "greatExpectations" + ProjectTestListResponseItemsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestListResponseItemsThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestListResponseItemsThresholdsInsightNameIllFormedRowCount ProjectTestListResponseItemsThresholdsInsightName = "illFormedRowCount" + ProjectTestListResponseItemsThresholdsInsightNameIsCode ProjectTestListResponseItemsThresholdsInsightName = "isCode" + ProjectTestListResponseItemsThresholdsInsightNameIsJson ProjectTestListResponseItemsThresholdsInsightName = "isJson" + ProjectTestListResponseItemsThresholdsInsightNameLlmRubricV2 ProjectTestListResponseItemsThresholdsInsightName = "llmRubricV2" + ProjectTestListResponseItemsThresholdsInsightNameLabelDrift ProjectTestListResponseItemsThresholdsInsightName = "labelDrift" + ProjectTestListResponseItemsThresholdsInsightNameMetrics ProjectTestListResponseItemsThresholdsInsightName = "metrics" + ProjectTestListResponseItemsThresholdsInsightNameNewCategories ProjectTestListResponseItemsThresholdsInsightName = "newCategories" + ProjectTestListResponseItemsThresholdsInsightNameNewLabels ProjectTestListResponseItemsThresholdsInsightName = "newLabels" + ProjectTestListResponseItemsThresholdsInsightNameNullRowCount ProjectTestListResponseItemsThresholdsInsightName = "nullRowCount" + ProjectTestListResponseItemsThresholdsInsightNamePpScore ProjectTestListResponseItemsThresholdsInsightName = "ppScore" + ProjectTestListResponseItemsThresholdsInsightNameQuasiConstantFeatures ProjectTestListResponseItemsThresholdsInsightName = "quasiConstantFeatures" + ProjectTestListResponseItemsThresholdsInsightNameSentenceLength ProjectTestListResponseItemsThresholdsInsightName = "sentenceLength" + ProjectTestListResponseItemsThresholdsInsightNameSizeRatio ProjectTestListResponseItemsThresholdsInsightName = "sizeRatio" + ProjectTestListResponseItemsThresholdsInsightNameSpecialCharacters ProjectTestListResponseItemsThresholdsInsightName = "specialCharacters" + ProjectTestListResponseItemsThresholdsInsightNameStringValidation ProjectTestListResponseItemsThresholdsInsightName = "stringValidation" + ProjectTestListResponseItemsThresholdsInsightNameTrainValLeakageRowCount ProjectTestListResponseItemsThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestListResponseItemsThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestListResponseItemsThresholdsInsightNameCharacterLength, ProjectTestListResponseItemsThresholdsInsightNameClassImbalance, ProjectTestListResponseItemsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestListResponseItemsThresholdsInsightNameColumnAverage, ProjectTestListResponseItemsThresholdsInsightNameColumnDrift, ProjectTestListResponseItemsThresholdsInsightNameColumnValuesMatch, ProjectTestListResponseItemsThresholdsInsightNameConfidenceDistribution, ProjectTestListResponseItemsThresholdsInsightNameConflictingLabelRowCount, ProjectTestListResponseItemsThresholdsInsightNameContainsPii, ProjectTestListResponseItemsThresholdsInsightNameContainsValidURL, ProjectTestListResponseItemsThresholdsInsightNameCorrelatedFeatures, ProjectTestListResponseItemsThresholdsInsightNameCustomMetric, ProjectTestListResponseItemsThresholdsInsightNameDuplicateRowCount, ProjectTestListResponseItemsThresholdsInsightNameEmptyFeatures, ProjectTestListResponseItemsThresholdsInsightNameFeatureDrift, ProjectTestListResponseItemsThresholdsInsightNameFeatureProfile, ProjectTestListResponseItemsThresholdsInsightNameGreatExpectations, ProjectTestListResponseItemsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestListResponseItemsThresholdsInsightNameIllFormedRowCount, ProjectTestListResponseItemsThresholdsInsightNameIsCode, ProjectTestListResponseItemsThresholdsInsightNameIsJson, ProjectTestListResponseItemsThresholdsInsightNameLlmRubricV2, ProjectTestListResponseItemsThresholdsInsightNameLabelDrift, ProjectTestListResponseItemsThresholdsInsightNameMetrics, ProjectTestListResponseItemsThresholdsInsightNameNewCategories, ProjectTestListResponseItemsThresholdsInsightNameNewLabels, ProjectTestListResponseItemsThresholdsInsightNameNullRowCount, ProjectTestListResponseItemsThresholdsInsightNamePpScore, ProjectTestListResponseItemsThresholdsInsightNameQuasiConstantFeatures, ProjectTestListResponseItemsThresholdsInsightNameSentenceLength, ProjectTestListResponseItemsThresholdsInsightNameSizeRatio, ProjectTestListResponseItemsThresholdsInsightNameSpecialCharacters, ProjectTestListResponseItemsThresholdsInsightNameStringValidation, ProjectTestListResponseItemsThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestListResponseItemsThresholdsInsightParameter struct { // The name of the insight filter. Name string `json:"name,required"` @@ -795,8 +897,10 @@ func (r ProjectTestNewParamsSubtype) IsKnown() bool { type ProjectTestNewParamsThreshold struct { // The insight name to be evaluated. - InsightName param.Field[string] `json:"insightName"` - // The insight parameters. Required only for some test subtypes. + InsightName param.Field[ProjectTestNewParamsThresholdsInsightName] `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] InsightParameters param.Field[[]ProjectTestNewParamsThresholdsInsightParameter] `json:"insightParameters"` // The measurement to be evaluated. Measurement param.Field[string] `json:"measurement"` @@ -812,6 +916,54 @@ func (r ProjectTestNewParamsThreshold) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// The insight name to be evaluated. +type ProjectTestNewParamsThresholdsInsightName string + +const ( + ProjectTestNewParamsThresholdsInsightNameCharacterLength ProjectTestNewParamsThresholdsInsightName = "characterLength" + ProjectTestNewParamsThresholdsInsightNameClassImbalance ProjectTestNewParamsThresholdsInsightName = "classImbalance" + ProjectTestNewParamsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestNewParamsThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestNewParamsThresholdsInsightNameColumnAverage ProjectTestNewParamsThresholdsInsightName = "columnAverage" + ProjectTestNewParamsThresholdsInsightNameColumnDrift ProjectTestNewParamsThresholdsInsightName = "columnDrift" + ProjectTestNewParamsThresholdsInsightNameColumnValuesMatch ProjectTestNewParamsThresholdsInsightName = "columnValuesMatch" + ProjectTestNewParamsThresholdsInsightNameConfidenceDistribution ProjectTestNewParamsThresholdsInsightName = "confidenceDistribution" + ProjectTestNewParamsThresholdsInsightNameConflictingLabelRowCount ProjectTestNewParamsThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestNewParamsThresholdsInsightNameContainsPii ProjectTestNewParamsThresholdsInsightName = "containsPii" + ProjectTestNewParamsThresholdsInsightNameContainsValidURL ProjectTestNewParamsThresholdsInsightName = "containsValidUrl" + ProjectTestNewParamsThresholdsInsightNameCorrelatedFeatures ProjectTestNewParamsThresholdsInsightName = "correlatedFeatures" + ProjectTestNewParamsThresholdsInsightNameCustomMetric ProjectTestNewParamsThresholdsInsightName = "customMetric" + ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount ProjectTestNewParamsThresholdsInsightName = "duplicateRowCount" + ProjectTestNewParamsThresholdsInsightNameEmptyFeatures ProjectTestNewParamsThresholdsInsightName = "emptyFeatures" + ProjectTestNewParamsThresholdsInsightNameFeatureDrift ProjectTestNewParamsThresholdsInsightName = "featureDrift" + ProjectTestNewParamsThresholdsInsightNameFeatureProfile ProjectTestNewParamsThresholdsInsightName = "featureProfile" + ProjectTestNewParamsThresholdsInsightNameGreatExpectations ProjectTestNewParamsThresholdsInsightName = "greatExpectations" + ProjectTestNewParamsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestNewParamsThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestNewParamsThresholdsInsightNameIllFormedRowCount ProjectTestNewParamsThresholdsInsightName = "illFormedRowCount" + ProjectTestNewParamsThresholdsInsightNameIsCode ProjectTestNewParamsThresholdsInsightName = "isCode" + ProjectTestNewParamsThresholdsInsightNameIsJson ProjectTestNewParamsThresholdsInsightName = "isJson" + ProjectTestNewParamsThresholdsInsightNameLlmRubricV2 ProjectTestNewParamsThresholdsInsightName = "llmRubricV2" + ProjectTestNewParamsThresholdsInsightNameLabelDrift ProjectTestNewParamsThresholdsInsightName = "labelDrift" + ProjectTestNewParamsThresholdsInsightNameMetrics ProjectTestNewParamsThresholdsInsightName = "metrics" + ProjectTestNewParamsThresholdsInsightNameNewCategories ProjectTestNewParamsThresholdsInsightName = "newCategories" + ProjectTestNewParamsThresholdsInsightNameNewLabels ProjectTestNewParamsThresholdsInsightName = "newLabels" + ProjectTestNewParamsThresholdsInsightNameNullRowCount ProjectTestNewParamsThresholdsInsightName = "nullRowCount" + ProjectTestNewParamsThresholdsInsightNamePpScore ProjectTestNewParamsThresholdsInsightName = "ppScore" + ProjectTestNewParamsThresholdsInsightNameQuasiConstantFeatures ProjectTestNewParamsThresholdsInsightName = "quasiConstantFeatures" + ProjectTestNewParamsThresholdsInsightNameSentenceLength ProjectTestNewParamsThresholdsInsightName = "sentenceLength" + ProjectTestNewParamsThresholdsInsightNameSizeRatio ProjectTestNewParamsThresholdsInsightName = "sizeRatio" + ProjectTestNewParamsThresholdsInsightNameSpecialCharacters ProjectTestNewParamsThresholdsInsightName = "specialCharacters" + ProjectTestNewParamsThresholdsInsightNameStringValidation ProjectTestNewParamsThresholdsInsightName = "stringValidation" + ProjectTestNewParamsThresholdsInsightNameTrainValLeakageRowCount ProjectTestNewParamsThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestNewParamsThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestNewParamsThresholdsInsightNameCharacterLength, ProjectTestNewParamsThresholdsInsightNameClassImbalance, ProjectTestNewParamsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestNewParamsThresholdsInsightNameColumnAverage, ProjectTestNewParamsThresholdsInsightNameColumnDrift, ProjectTestNewParamsThresholdsInsightNameColumnValuesMatch, ProjectTestNewParamsThresholdsInsightNameConfidenceDistribution, ProjectTestNewParamsThresholdsInsightNameConflictingLabelRowCount, ProjectTestNewParamsThresholdsInsightNameContainsPii, ProjectTestNewParamsThresholdsInsightNameContainsValidURL, ProjectTestNewParamsThresholdsInsightNameCorrelatedFeatures, ProjectTestNewParamsThresholdsInsightNameCustomMetric, ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount, ProjectTestNewParamsThresholdsInsightNameEmptyFeatures, ProjectTestNewParamsThresholdsInsightNameFeatureDrift, ProjectTestNewParamsThresholdsInsightNameFeatureProfile, ProjectTestNewParamsThresholdsInsightNameGreatExpectations, ProjectTestNewParamsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestNewParamsThresholdsInsightNameIllFormedRowCount, ProjectTestNewParamsThresholdsInsightNameIsCode, ProjectTestNewParamsThresholdsInsightNameIsJson, ProjectTestNewParamsThresholdsInsightNameLlmRubricV2, ProjectTestNewParamsThresholdsInsightNameLabelDrift, ProjectTestNewParamsThresholdsInsightNameMetrics, ProjectTestNewParamsThresholdsInsightNameNewCategories, ProjectTestNewParamsThresholdsInsightNameNewLabels, ProjectTestNewParamsThresholdsInsightNameNullRowCount, ProjectTestNewParamsThresholdsInsightNamePpScore, ProjectTestNewParamsThresholdsInsightNameQuasiConstantFeatures, ProjectTestNewParamsThresholdsInsightNameSentenceLength, ProjectTestNewParamsThresholdsInsightNameSizeRatio, ProjectTestNewParamsThresholdsInsightNameSpecialCharacters, ProjectTestNewParamsThresholdsInsightNameStringValidation, ProjectTestNewParamsThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + type ProjectTestNewParamsThresholdsInsightParameter struct { // The name of the insight filter. Name param.Field[string] `json:"name,required"` @@ -888,6 +1040,172 @@ func (r ProjectTestNewParamsType) IsKnown() bool { return false } +type ProjectTestUpdateParams struct { + Payloads param.Field[[]ProjectTestUpdateParamsPayload] `json:"payloads,required"` +} + +func (r ProjectTestUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ProjectTestUpdateParamsPayload struct { + ID param.Field[string] `json:"id,required" format:"uuid"` + // Whether the test is archived. + Archived param.Field[bool] `json:"archived"` + // The test description. + Description param.Field[interface{}] `json:"description"` + // The test name. + Name param.Field[string] `json:"name"` + Suggested param.Field[ProjectTestUpdateParamsPayloadsSuggested] `json:"suggested"` + Thresholds param.Field[[]ProjectTestUpdateParamsPayloadsThreshold] `json:"thresholds"` +} + +func (r ProjectTestUpdateParamsPayload) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type ProjectTestUpdateParamsPayloadsSuggested bool + +const ( + ProjectTestUpdateParamsPayloadsSuggestedFalse ProjectTestUpdateParamsPayloadsSuggested = false +) + +func (r ProjectTestUpdateParamsPayloadsSuggested) IsKnown() bool { + switch r { + case ProjectTestUpdateParamsPayloadsSuggestedFalse: + return true + } + return false +} + +type ProjectTestUpdateParamsPayloadsThreshold struct { + // The insight name to be evaluated. + InsightName param.Field[ProjectTestUpdateParamsPayloadsThresholdsInsightName] `json:"insightName"` + // The insight parameters. Required only for some test subtypes. For example, for + // tests that require a column name, the insight parameters will be [{'name': + // 'column_name', 'value': 'Age'}] + InsightParameters param.Field[[]ProjectTestUpdateParamsPayloadsThresholdsInsightParameter] `json:"insightParameters"` + // The measurement to be evaluated. + Measurement param.Field[string] `json:"measurement"` + // The operator to be used for the evaluation. + Operator param.Field[ProjectTestUpdateParamsPayloadsThresholdsOperator] `json:"operator"` + // Whether to use automatic anomaly detection or manual thresholds + ThresholdMode param.Field[ProjectTestUpdateParamsPayloadsThresholdsThresholdMode] `json:"thresholdMode"` + // The value to be compared. + Value param.Field[ProjectTestUpdateParamsPayloadsThresholdsValueUnion] `json:"value"` +} + +func (r ProjectTestUpdateParamsPayloadsThreshold) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The insight name to be evaluated. +type ProjectTestUpdateParamsPayloadsThresholdsInsightName string + +const ( + ProjectTestUpdateParamsPayloadsThresholdsInsightNameCharacterLength ProjectTestUpdateParamsPayloadsThresholdsInsightName = "characterLength" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameClassImbalance ProjectTestUpdateParamsPayloadsThresholdsInsightName = "classImbalance" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameExpectColumnAToBeInColumnB ProjectTestUpdateParamsPayloadsThresholdsInsightName = "expectColumnAToBeInColumnB" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameColumnAverage ProjectTestUpdateParamsPayloadsThresholdsInsightName = "columnAverage" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameColumnDrift ProjectTestUpdateParamsPayloadsThresholdsInsightName = "columnDrift" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameColumnValuesMatch ProjectTestUpdateParamsPayloadsThresholdsInsightName = "columnValuesMatch" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameConfidenceDistribution ProjectTestUpdateParamsPayloadsThresholdsInsightName = "confidenceDistribution" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameConflictingLabelRowCount ProjectTestUpdateParamsPayloadsThresholdsInsightName = "conflictingLabelRowCount" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameContainsPii ProjectTestUpdateParamsPayloadsThresholdsInsightName = "containsPii" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameContainsValidURL ProjectTestUpdateParamsPayloadsThresholdsInsightName = "containsValidUrl" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameCorrelatedFeatures ProjectTestUpdateParamsPayloadsThresholdsInsightName = "correlatedFeatures" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameCustomMetric ProjectTestUpdateParamsPayloadsThresholdsInsightName = "customMetric" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameDuplicateRowCount ProjectTestUpdateParamsPayloadsThresholdsInsightName = "duplicateRowCount" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameEmptyFeatures ProjectTestUpdateParamsPayloadsThresholdsInsightName = "emptyFeatures" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameFeatureDrift ProjectTestUpdateParamsPayloadsThresholdsInsightName = "featureDrift" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameFeatureProfile ProjectTestUpdateParamsPayloadsThresholdsInsightName = "featureProfile" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameGreatExpectations ProjectTestUpdateParamsPayloadsThresholdsInsightName = "greatExpectations" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameGroupByColumnStatsCheck ProjectTestUpdateParamsPayloadsThresholdsInsightName = "groupByColumnStatsCheck" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameIllFormedRowCount ProjectTestUpdateParamsPayloadsThresholdsInsightName = "illFormedRowCount" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameIsCode ProjectTestUpdateParamsPayloadsThresholdsInsightName = "isCode" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameIsJson ProjectTestUpdateParamsPayloadsThresholdsInsightName = "isJson" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameLlmRubricV2 ProjectTestUpdateParamsPayloadsThresholdsInsightName = "llmRubricV2" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameLabelDrift ProjectTestUpdateParamsPayloadsThresholdsInsightName = "labelDrift" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameMetrics ProjectTestUpdateParamsPayloadsThresholdsInsightName = "metrics" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameNewCategories ProjectTestUpdateParamsPayloadsThresholdsInsightName = "newCategories" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameNewLabels ProjectTestUpdateParamsPayloadsThresholdsInsightName = "newLabels" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameNullRowCount ProjectTestUpdateParamsPayloadsThresholdsInsightName = "nullRowCount" + ProjectTestUpdateParamsPayloadsThresholdsInsightNamePpScore ProjectTestUpdateParamsPayloadsThresholdsInsightName = "ppScore" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameQuasiConstantFeatures ProjectTestUpdateParamsPayloadsThresholdsInsightName = "quasiConstantFeatures" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameSentenceLength ProjectTestUpdateParamsPayloadsThresholdsInsightName = "sentenceLength" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameSizeRatio ProjectTestUpdateParamsPayloadsThresholdsInsightName = "sizeRatio" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameSpecialCharacters ProjectTestUpdateParamsPayloadsThresholdsInsightName = "specialCharacters" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameStringValidation ProjectTestUpdateParamsPayloadsThresholdsInsightName = "stringValidation" + ProjectTestUpdateParamsPayloadsThresholdsInsightNameTrainValLeakageRowCount ProjectTestUpdateParamsPayloadsThresholdsInsightName = "trainValLeakageRowCount" +) + +func (r ProjectTestUpdateParamsPayloadsThresholdsInsightName) IsKnown() bool { + switch r { + case ProjectTestUpdateParamsPayloadsThresholdsInsightNameCharacterLength, ProjectTestUpdateParamsPayloadsThresholdsInsightNameClassImbalance, ProjectTestUpdateParamsPayloadsThresholdsInsightNameExpectColumnAToBeInColumnB, ProjectTestUpdateParamsPayloadsThresholdsInsightNameColumnAverage, ProjectTestUpdateParamsPayloadsThresholdsInsightNameColumnDrift, ProjectTestUpdateParamsPayloadsThresholdsInsightNameColumnValuesMatch, ProjectTestUpdateParamsPayloadsThresholdsInsightNameConfidenceDistribution, ProjectTestUpdateParamsPayloadsThresholdsInsightNameConflictingLabelRowCount, ProjectTestUpdateParamsPayloadsThresholdsInsightNameContainsPii, ProjectTestUpdateParamsPayloadsThresholdsInsightNameContainsValidURL, ProjectTestUpdateParamsPayloadsThresholdsInsightNameCorrelatedFeatures, ProjectTestUpdateParamsPayloadsThresholdsInsightNameCustomMetric, ProjectTestUpdateParamsPayloadsThresholdsInsightNameDuplicateRowCount, ProjectTestUpdateParamsPayloadsThresholdsInsightNameEmptyFeatures, ProjectTestUpdateParamsPayloadsThresholdsInsightNameFeatureDrift, ProjectTestUpdateParamsPayloadsThresholdsInsightNameFeatureProfile, ProjectTestUpdateParamsPayloadsThresholdsInsightNameGreatExpectations, ProjectTestUpdateParamsPayloadsThresholdsInsightNameGroupByColumnStatsCheck, ProjectTestUpdateParamsPayloadsThresholdsInsightNameIllFormedRowCount, ProjectTestUpdateParamsPayloadsThresholdsInsightNameIsCode, ProjectTestUpdateParamsPayloadsThresholdsInsightNameIsJson, ProjectTestUpdateParamsPayloadsThresholdsInsightNameLlmRubricV2, ProjectTestUpdateParamsPayloadsThresholdsInsightNameLabelDrift, ProjectTestUpdateParamsPayloadsThresholdsInsightNameMetrics, ProjectTestUpdateParamsPayloadsThresholdsInsightNameNewCategories, ProjectTestUpdateParamsPayloadsThresholdsInsightNameNewLabels, ProjectTestUpdateParamsPayloadsThresholdsInsightNameNullRowCount, ProjectTestUpdateParamsPayloadsThresholdsInsightNamePpScore, ProjectTestUpdateParamsPayloadsThresholdsInsightNameQuasiConstantFeatures, ProjectTestUpdateParamsPayloadsThresholdsInsightNameSentenceLength, ProjectTestUpdateParamsPayloadsThresholdsInsightNameSizeRatio, ProjectTestUpdateParamsPayloadsThresholdsInsightNameSpecialCharacters, ProjectTestUpdateParamsPayloadsThresholdsInsightNameStringValidation, ProjectTestUpdateParamsPayloadsThresholdsInsightNameTrainValLeakageRowCount: + return true + } + return false +} + +type ProjectTestUpdateParamsPayloadsThresholdsInsightParameter struct { + // The name of the insight filter. + Name param.Field[string] `json:"name,required"` + Value param.Field[interface{}] `json:"value,required"` +} + +func (r ProjectTestUpdateParamsPayloadsThresholdsInsightParameter) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The operator to be used for the evaluation. +type ProjectTestUpdateParamsPayloadsThresholdsOperator string + +const ( + ProjectTestUpdateParamsPayloadsThresholdsOperatorIs ProjectTestUpdateParamsPayloadsThresholdsOperator = "is" + ProjectTestUpdateParamsPayloadsThresholdsOperatorGreater ProjectTestUpdateParamsPayloadsThresholdsOperator = ">" + ProjectTestUpdateParamsPayloadsThresholdsOperatorGreaterOrEquals ProjectTestUpdateParamsPayloadsThresholdsOperator = ">=" + ProjectTestUpdateParamsPayloadsThresholdsOperatorLess ProjectTestUpdateParamsPayloadsThresholdsOperator = "<" + ProjectTestUpdateParamsPayloadsThresholdsOperatorLessOrEquals ProjectTestUpdateParamsPayloadsThresholdsOperator = "<=" + ProjectTestUpdateParamsPayloadsThresholdsOperatorNotEquals ProjectTestUpdateParamsPayloadsThresholdsOperator = "!=" +) + +func (r ProjectTestUpdateParamsPayloadsThresholdsOperator) IsKnown() bool { + switch r { + case ProjectTestUpdateParamsPayloadsThresholdsOperatorIs, ProjectTestUpdateParamsPayloadsThresholdsOperatorGreater, ProjectTestUpdateParamsPayloadsThresholdsOperatorGreaterOrEquals, ProjectTestUpdateParamsPayloadsThresholdsOperatorLess, ProjectTestUpdateParamsPayloadsThresholdsOperatorLessOrEquals, ProjectTestUpdateParamsPayloadsThresholdsOperatorNotEquals: + return true + } + return false +} + +// Whether to use automatic anomaly detection or manual thresholds +type ProjectTestUpdateParamsPayloadsThresholdsThresholdMode string + +const ( + ProjectTestUpdateParamsPayloadsThresholdsThresholdModeAutomatic ProjectTestUpdateParamsPayloadsThresholdsThresholdMode = "automatic" + ProjectTestUpdateParamsPayloadsThresholdsThresholdModeManual ProjectTestUpdateParamsPayloadsThresholdsThresholdMode = "manual" +) + +func (r ProjectTestUpdateParamsPayloadsThresholdsThresholdMode) IsKnown() bool { + switch r { + case ProjectTestUpdateParamsPayloadsThresholdsThresholdModeAutomatic, ProjectTestUpdateParamsPayloadsThresholdsThresholdModeManual: + return true + } + return false +} + +// The value to be compared. +// +// Satisfied by [shared.UnionFloat], [shared.UnionBool], [shared.UnionString], +// [ProjectTestUpdateParamsPayloadsThresholdsValueArray]. +type ProjectTestUpdateParamsPayloadsThresholdsValueUnion interface { + ImplementsProjectTestUpdateParamsPayloadsThresholdsValueUnion() +} + +type ProjectTestUpdateParamsPayloadsThresholdsValueArray []string + +func (r ProjectTestUpdateParamsPayloadsThresholdsValueArray) ImplementsProjectTestUpdateParamsPayloadsThresholdsValueUnion() { +} + type ProjectTestListParams struct { // Filter for archived tests. IncludeArchived param.Field[bool] `query:"includeArchived"` diff --git a/projecttest_test.go b/projecttest_test.go index 95d0833..bd54a3a 100644 --- a/projecttest_test.go +++ b/projecttest_test.go @@ -34,7 +34,7 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { Name: openlayer.F("No duplicate rows"), Subtype: openlayer.F(openlayer.ProjectTestNewParamsSubtypeDuplicateRowCount), Thresholds: openlayer.F([]openlayer.ProjectTestNewParamsThreshold{{ - InsightName: openlayer.F("duplicateRowCount"), + InsightName: openlayer.F(openlayer.ProjectTestNewParamsThresholdsInsightNameDuplicateRowCount), InsightParameters: openlayer.F([]openlayer.ProjectTestNewParamsThresholdsInsightParameter{{ Name: openlayer.F("column_name"), Value: openlayer.F[any]("Age"), @@ -64,6 +64,51 @@ func TestProjectTestNewWithOptionalParams(t *testing.T) { } } +func TestProjectTestUpdate(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := openlayer.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + _, err := client.Projects.Tests.Update( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + openlayer.ProjectTestUpdateParams{ + Payloads: openlayer.F([]openlayer.ProjectTestUpdateParamsPayload{{ + ID: openlayer.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Archived: openlayer.F(false), + Description: openlayer.F[any]("This test checks for duplicate rows in the dataset."), + Name: openlayer.F("No duplicate rows"), + Suggested: openlayer.F(openlayer.ProjectTestUpdateParamsPayloadsSuggestedFalse), + Thresholds: openlayer.F([]openlayer.ProjectTestUpdateParamsPayloadsThreshold{{ + InsightName: openlayer.F(openlayer.ProjectTestUpdateParamsPayloadsThresholdsInsightNameDuplicateRowCount), + InsightParameters: openlayer.F([]openlayer.ProjectTestUpdateParamsPayloadsThresholdsInsightParameter{{ + Name: openlayer.F("column_name"), + Value: openlayer.F[any]("Age"), + }}), + Measurement: openlayer.F("duplicateRowCount"), + Operator: openlayer.F(openlayer.ProjectTestUpdateParamsPayloadsThresholdsOperatorLessOrEquals), + ThresholdMode: openlayer.F(openlayer.ProjectTestUpdateParamsPayloadsThresholdsThresholdModeAutomatic), + Value: openlayer.F[openlayer.ProjectTestUpdateParamsPayloadsThresholdsValueUnion](shared.UnionFloat(0.000000)), + }}), + }}), + }, + ) + if err != nil { + var apierr *openlayer.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + func TestProjectTestListWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { diff --git a/shared/union.go b/shared/union.go index ce00b2b..fc40b09 100644 --- a/shared/union.go +++ b/shared/union.go @@ -7,6 +7,7 @@ type UnionString string func (UnionString) ImplementsProjectTestNewResponseThresholdsValueUnion() {} func (UnionString) ImplementsProjectTestListResponseItemsThresholdsValueUnion() {} func (UnionString) ImplementsProjectTestNewParamsThresholdsValueUnion() {} +func (UnionString) ImplementsProjectTestUpdateParamsPayloadsThresholdsValueUnion() {} func (UnionString) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionString) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} @@ -15,6 +16,7 @@ type UnionBool bool func (UnionBool) ImplementsProjectTestNewResponseThresholdsValueUnion() {} func (UnionBool) ImplementsProjectTestListResponseItemsThresholdsValueUnion() {} func (UnionBool) ImplementsProjectTestNewParamsThresholdsValueUnion() {} +func (UnionBool) ImplementsProjectTestUpdateParamsPayloadsThresholdsValueUnion() {} func (UnionBool) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionBool) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} @@ -23,5 +25,6 @@ type UnionFloat float64 func (UnionFloat) ImplementsProjectTestNewResponseThresholdsValueUnion() {} func (UnionFloat) ImplementsProjectTestListResponseItemsThresholdsValueUnion() {} func (UnionFloat) ImplementsProjectTestNewParamsThresholdsValueUnion() {} +func (UnionFloat) ImplementsProjectTestUpdateParamsPayloadsThresholdsValueUnion() {} func (UnionFloat) ImplementsCommitTestResultListResponseItemsGoalThresholdsValueUnion() {} func (UnionFloat) ImplementsInferencePipelineTestResultListResponseItemsGoalThresholdsValueUnion() {} From 907273a9250ebe773c48860b1e1f8052813cdae0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 11:31:44 +0000 Subject: [PATCH 24/26] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0998013..2b09528 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 18 -openapi_spec_hash: 4f09f95fd31c148d1be80b7e643346ce +openapi_spec_hash: 20f058101a252f7500803d66aff58eb3 config_hash: 30422a4611d93ca69e4f1aff60b9ddb5 From dfd870a9923922602af776bf62ae5da696c4f9f1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 02:25:24 +0000 Subject: [PATCH 25/26] fix: handle empty bodies in WithJSONSet --- option/requestoption.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/option/requestoption.go b/option/requestoption.go index 72ef762..74326b8 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -169,17 +169,26 @@ func WithQueryDel(key string) RequestOption { // [sjson format]: https://github.com/tidwall/sjson func WithJSONSet(key string, value interface{}) RequestOption { return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) (err error) { - if buffer, ok := r.Body.(*bytes.Buffer); ok { - b := buffer.Bytes() + var b []byte + + if r.Body == nil { + b, err = sjson.SetBytes(nil, key, value) + if err != nil { + return err + } + } else if buffer, ok := r.Body.(*bytes.Buffer); ok { + b = buffer.Bytes() b, err = sjson.SetBytes(b, key, value) if err != nil { return err } - r.Body = bytes.NewBuffer(b) return nil + } else { + return fmt.Errorf("cannot use WithJSONSet on a body that is not serialized as *bytes.Buffer") } - return fmt.Errorf("cannot use WithJSONSet on a body that is not serialized as *bytes.Buffer") + r.Body = bytes.NewBuffer(b) + return nil }) } From bb4190c3c7cc16df35a4387c7738e0e5eae3ae2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 02:25:47 +0000 Subject: [PATCH 26/26] release: 0.1.0-alpha.17 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 39 +++++++++++++++++++++++++++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7e56fe2..e2f2c07 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.16" + ".": "0.1.0-alpha.17" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 26b1582..fb64588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # Changelog +## 0.1.0-alpha.17 (2025-04-30) + +Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/openlayer-ai/openlayer-go/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) + +### Features + +* **api:** add test creation endpoint ([50fa1ac](https://github.com/openlayer-ai/openlayer-go/commit/50fa1ac7d9d7bff9402b7be595e176cfab4d18e9)) +* **api:** api update ([9ca34f2](https://github.com/openlayer-ai/openlayer-go/commit/9ca34f2376b8e7736bc178b64fb8de6f14dc09f5)) +* **api:** api update ([1464559](https://github.com/openlayer-ai/openlayer-go/commit/146455956798caf86c90a1e76a06663c862ab02a)) +* **api:** api update ([945314e](https://github.com/openlayer-ai/openlayer-go/commit/945314e51ecff9e88c9fafe693a612d3d350c313)) +* **api:** api update ([20c21a5](https://github.com/openlayer-ai/openlayer-go/commit/20c21a5bfc2a02ef41317797e52b966a29880738)) +* **api:** api update ([915af77](https://github.com/openlayer-ai/openlayer-go/commit/915af773e51144f74c1517bb43eb6807867d4015)) +* **api:** expose test retrieval endpoint ([cddc990](https://github.com/openlayer-ai/openlayer-go/commit/cddc990ebb0004ddee4ca0f8c538b543c700d254)) +* **api:** expose test retrieval endpoint ([7ac3c6c](https://github.com/openlayer-ai/openlayer-go/commit/7ac3c6ccac9752d807519538a54b0afe223154fe)) +* **api:** expose test update endpoint ([e8aba5e](https://github.com/openlayer-ai/openlayer-go/commit/e8aba5e6f17d645f5ccb543d259739d534a3da3a)) +* **client:** add support for reading base URL from environment variable ([9fd2355](https://github.com/openlayer-ai/openlayer-go/commit/9fd23557e5355ae4280fdea454c024eab8d9dc4d)) +* **client:** support custom http clients ([#80](https://github.com/openlayer-ai/openlayer-go/issues/80)) ([773c56c](https://github.com/openlayer-ai/openlayer-go/commit/773c56c93858bfec9e73ccb22950919bd968d606)) + + +### Bug Fixes + +* handle empty bodies in WithJSONSet ([dfd870a](https://github.com/openlayer-ai/openlayer-go/commit/dfd870a9923922602af776bf62ae5da696c4f9f1)) + + +### Chores + +* **ci:** add timeout thresholds for CI jobs ([a41c7b6](https://github.com/openlayer-ai/openlayer-go/commit/a41c7b6366a1b1b380fa714ac527cd4c8a019112)) +* **ci:** only use depot for staging repos ([abc6c92](https://github.com/openlayer-ai/openlayer-go/commit/abc6c92db4e9cbfd5e199571c521f9c3a7b02c73)) +* **docs:** document pre-request options ([6cc0281](https://github.com/openlayer-ai/openlayer-go/commit/6cc028136dc67f77881c5c1f4d466254694a0679)) +* **internal:** codegen related update ([8ad39a5](https://github.com/openlayer-ai/openlayer-go/commit/8ad39a515b9bc3c3a752682500f37193c6f44a70)) +* **internal:** expand CI branch coverage ([14067c7](https://github.com/openlayer-ai/openlayer-go/commit/14067c7e9dfa7c1bcdfb9ded29ce3eaea12d1bd2)) +* **internal:** reduce CI branch coverage ([08c00ca](https://github.com/openlayer-ai/openlayer-go/commit/08c00cadee41cd7f6b3bd2873a0a1f18ba997a99)) +* **tests:** improve enum examples ([#82](https://github.com/openlayer-ai/openlayer-go/issues/82)) ([c4047ae](https://github.com/openlayer-ai/openlayer-go/commit/c4047aeebaf1c7ae8aa176572a1615746bee8bb5)) + + +### Documentation + +* update documentation links to be more uniform ([6245eac](https://github.com/openlayer-ai/openlayer-go/commit/6245eac124bdfa974d36963c293b4f6d1b791021)) + ## 0.1.0-alpha.16 (2025-04-03) Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/openlayer-ai/openlayer-go/compare/v0.1.0-alpha.15...v0.1.0-alpha.16) diff --git a/README.md b/README.md index c7284e0..416c2f7 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/openlayer-ai/openlayer-go@v0.1.0-alpha.16' +go get -u 'github.com/openlayer-ai/openlayer-go@v0.1.0-alpha.17' ``` diff --git a/internal/version.go b/internal/version.go index f578972..b85b90f 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.16" // x-release-please-version +const PackageVersion = "0.1.0-alpha.17" // x-release-please-version