Class: Vellum::AsyncTestSuiteRunsClient

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:) ⇒ AsyncTestSuiteRunsClient

Parameters:



82
83
84
85
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 82

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

Instance Attribute Details

#request_clientObject (readonly)

Returns the value of attribute request_client.



78
79
80
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 78

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:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 93

def create(test_suite_id:, exec_config:, request_options: nil)
  Async do
    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
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:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 132

def list_executions(id:, limit: nil, offset: nil, request_options: nil)
  Async do
    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
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:



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/vellum_ai/test_suite_runs/client.rb', line 115

def retrieve(id:, request_options: nil)
  Async do
    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
end