Class: Openlayer::Resources::Tests

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/resources/tests.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tests

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Tests.

Parameters:



91
92
93
# File 'lib/openlayer/resources/tests.rb', line 91

def initialize(client:)
  @client = client
end

Instance Method Details

#evaluate(test_id, end_timestamp:, start_timestamp:, inference_pipeline_id: nil, overwrite_results: nil, request_options: {}) ⇒ Openlayer::Models::TestEvaluateResponse

Some parameter documentations has been truncated, see Models::TestEvaluateParams for more details.

Triggers one-off evaluation of a specific monitoring test for a custom timestamp range. This allows evaluating tests for historical data or custom time periods outside the regular evaluation window schedule. It also allows overwriting the existing test results.

Parameters:

  • test_id (String)

    The test id.

  • end_timestamp (Integer)

    End timestamp in seconds (Unix epoch)

  • start_timestamp (Integer)

    Start timestamp in seconds (Unix epoch)

  • inference_pipeline_id (String)

    ID of the inference pipeline to evaluate. If not provided, all inference pipelin

  • overwrite_results (Boolean)

    Whether to overwrite existing test results

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
# File 'lib/openlayer/resources/tests.rb', line 31

def evaluate(test_id, params)
  parsed, options = Openlayer::TestEvaluateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["tests/%1$s/evaluate", test_id],
    body: parsed,
    model: Openlayer::Models::TestEvaluateResponse,
    options: options
  )
end

#list_results(test_id, end_timestamp: nil, include_insights: nil, inference_pipeline_id: nil, page: nil, per_page: nil, project_version_id: nil, start_timestamp: nil, status: nil, request_options: {}) ⇒ Openlayer::Models::TestListResultsResponse

List the test results for a test.

Parameters:

  • test_id (String)

    The test id.

  • end_timestamp (Float)

    Filter for results that use data starting before the end timestamp.

  • include_insights (Boolean)

    Include the insights linked to each test result

  • inference_pipeline_id (String, nil)

    Retrive test results for a specific inference pipeline.

  • page (Integer)

    The page to return in a paginated query.

  • per_page (Integer)

    Maximum number of items to return per page.

  • project_version_id (String, nil)

    Retrive test results for a specific project version.

  • start_timestamp (Float)

    Filter for results that use data ending after the start timestamp.

  • status (Array<String>)

    Filter by status(es).

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/openlayer/resources/tests.rb', line 69

def list_results(test_id, params = {})
  parsed, options = Openlayer::TestListResultsParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["tests/%1$s/results", test_id],
    query: query.transform_keys(
      end_timestamp: "endTimestamp",
      include_insights: "includeInsights",
      inference_pipeline_id: "inferencePipelineId",
      per_page: "perPage",
      project_version_id: "projectVersionId",
      start_timestamp: "startTimestamp"
    ),
    model: Openlayer::Models::TestListResultsResponse,
    options: options
  )
end