Class: Vellum::AsyncTestSuitesClient
- Inherits:
-
Object
- Object
- Vellum::AsyncTestSuitesClient
- Defined in:
- lib/vellum_ai/test_suites/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
-
#delete_test_suite_test_case(id:, test_case_id:, request_options: nil) ⇒ Void
Deletes an existing test case for a test suite, keying off of the test case id.
- #initialize(request_client:) ⇒ AsyncTestSuitesClient constructor
-
#upsert_test_suite_test_case(id:, input_values:, evaluation_values:, upsert_test_suite_test_case_request_id: nil, label: nil, request_options: nil) ⇒ TestSuiteTestCase
Upserts a new test case for a test suite, keying off of the optionally provided test case id.
Constructor Details
#initialize(request_client:) ⇒ AsyncTestSuitesClient
73 74 75 76 |
# File 'lib/vellum_ai/test_suites/client.rb', line 73 def initialize(request_client:) # @type [AsyncRequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
69 70 71 |
# File 'lib/vellum_ai/test_suites/client.rb', line 69 def request_client @request_client end |
Instance Method Details
#delete_test_suite_test_case(id:, test_case_id:, request_options: nil) ⇒ Void
Deletes an existing test case for a test suite, keying off of the test case id.
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/vellum_ai/test_suites/client.rb', line 119 def delete_test_suite_test_case(id:, test_case_id:, request_options: nil) Async do @request_client.conn.delete do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X_API_KEY"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.default_environment[:Default]}/v1/test-suites/#{id}/test-cases/#{test_case_id}" end end end |
#upsert_test_suite_test_case(id:, input_values:, evaluation_values:, upsert_test_suite_test_case_request_id: nil, label: nil, request_options: nil) ⇒ TestSuiteTestCase
Upserts a new test case for a test suite, keying off of the optionally provided test case id.
If an id is provided and has a match, the test case will be updated. If no id is provided or no match is found, a new test case will be appended to the end.
Note that a full replacement of the test case is performed, so any fields not provided will be removed or overwritten with default values.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/vellum_ai/test_suites/client.rb', line 93 def upsert_test_suite_test_case(id:, input_values:, evaluation_values:, upsert_test_suite_test_case_request_id: nil, label: nil, request_options: nil) Async do response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X_API_KEY"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), id: upsert_test_suite_test_case_request_id, label: label, input_values: input_values, evaluation_values: evaluation_values }.compact req.url "#{@request_client.default_environment[:Default]}/v1/test-suites/#{id}/test-cases" end TestSuiteTestCase.from_json(json_object: response.body) end end |