Class: Vellum::TestSuiteRunsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/test_suite_runs/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ TestSuiteRunsClient

Parameters:



15
16
17
18
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 15

def initialize(request_client:)
  # @type [RequestClient]
  @request_client = request_client
end

Instance Attribute Details

#request_clientObject (readonly)

Returns the value of attribute request_client.



11
12
13
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 11

def request_client
  @request_client
end

Instance Method Details

#create(test_suite_id:, exec_config:, request_options: nil) ⇒ TestSuiteRunRead

Trigger a Test Suite and create a new Test Suite Run

Parameters:

  • test_suite_id (String)

    The ID of the Test Suite to run

  • exec_config (Hash)

    Configuration that defines how the Test Suite should be runRequest of type TestSuiteRunExecConfigRequest, as a Hash

  • request_options (RequestOptions) (defaults to: nil)

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 26

def create(test_suite_id:, exec_config:, request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      test_suite_id: test_suite_id,
      exec_config: exec_config
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/test-suite-runs"
  end
  TestSuiteRunRead.from_json(json_object: response.body)
end

#list_executions(id:, limit: nil, offset: nil, request_options: nil) ⇒ PaginatedTestSuiteRunExecutionList

Parameters:

  • id (String)

    A UUID string identifying this test suite run.

  • limit (Integer) (defaults to: nil)

    Number of results to return per page.

  • offset (Integer) (defaults to: nil)

    The initial index from which to return the results.

  • request_options (RequestOptions) (defaults to: nil)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 61

def list_executions(id:, limit: nil, offset: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "limit": limit,
      "offset": offset
    }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/test-suite-runs/#{id}/executions"
  end
  PaginatedTestSuiteRunExecutionList.from_json(json_object: response.body)
end

#retrieve(id:, request_options: nil) ⇒ TestSuiteRunRead

Retrieve a specific Test Suite Run by ID

Parameters:

  • id (String)

    A UUID string identifying this test suite run.

  • request_options (RequestOptions) (defaults to: nil)

Returns:



46
47
48
49
50
51
52
53
54
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 46

def retrieve(id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/test-suite-runs/#{id}"
  end
  TestSuiteRunRead.from_json(json_object: response.body)
end