Class: Braintrust::Resources::Experiments
- Inherits:
-
Object
- Object
- Braintrust::Resources::Experiments
- Defined in:
- lib/braintrust/resources/experiments.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Experiment
Create a new experiment.
-
#delete(experiment_id, opts = {}) ⇒ Braintrust::Models::Experiment
Delete an experiment object by its id.
-
#feedback(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::FeedbackResponseSchema
Log feedback for a set of experiment events.
-
#fetch(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchExperimentEventsResponse
Fetch the events in an experiment.
-
#fetch_post(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchExperimentEventsResponse
Fetch the events in an experiment.
-
#initialize(client:) ⇒ Experiments
constructor
A new instance of Experiments.
-
#insert(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::InsertEventsResponse
Insert a set of events into the experiment.
-
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Experiment>
List out all experiments.
-
#retrieve(experiment_id, opts = {}) ⇒ Braintrust::Models::Experiment
Get an experiment object by its id.
-
#summarize(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::SummarizeExperimentResponse
Summarize experiment.
-
#update(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::Experiment
Partially update an experiment object.
Constructor Details
#initialize(client:) ⇒ Experiments
Returns a new instance of Experiments.
6 7 8 |
# File 'lib/braintrust/resources/experiments.rb', line 6 def initialize(client:) @client = client end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Experiment
Create a new experiment. If there is an existing experiment in the project with the same name as the one specified in the request, will return the existing experiment unmodified
35 36 37 38 39 40 41 42 |
# File 'lib/braintrust/resources/experiments.rb', line 35 def create(params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/experiment" req[:body] = params req[:model] = Braintrust::Models::Experiment @client.request(req, opts) end |
#delete(experiment_id, opts = {}) ⇒ Braintrust::Models::Experiment
Delete an experiment object by its id
130 131 132 133 134 135 136 |
# File 'lib/braintrust/resources/experiments.rb', line 130 def delete(experiment_id, opts = {}) req = {} req[:method] = :delete req[:path] = "/v1/experiment/#{experiment_id}" req[:model] = Braintrust::Models::Experiment @client.request(req, opts) end |
#feedback(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::FeedbackResponseSchema
Log feedback for a set of experiment events
148 149 150 151 152 153 154 155 |
# File 'lib/braintrust/resources/experiments.rb', line 148 def feedback(experiment_id, params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/experiment/#{experiment_id}/feedback" req[:body] = params req[:model] = Braintrust::Models::FeedbackResponseSchema @client.request(req, opts) end |
#fetch(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchExperimentEventsResponse
Fetch the events in an experiment. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body
206 207 208 209 210 211 212 213 |
# File 'lib/braintrust/resources/experiments.rb', line 206 def fetch(experiment_id, params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/experiment/#{experiment_id}/fetch" req[:query] = params req[:model] = Braintrust::Models::FetchExperimentEventsResponse @client.request(req, opts) end |
#fetch_post(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchExperimentEventsResponse
Fetch the events in an experiment. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query
275 276 277 278 279 280 281 282 |
# File 'lib/braintrust/resources/experiments.rb', line 275 def fetch_post(experiment_id, params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/experiment/#{experiment_id}/fetch" req[:body] = params req[:model] = Braintrust::Models::FetchExperimentEventsResponse @client.request(req, opts) end |
#insert(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::InsertEventsResponse
Insert a set of events into the experiment
294 295 296 297 298 299 300 301 |
# File 'lib/braintrust/resources/experiments.rb', line 294 def insert(experiment_id, params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/experiment/#{experiment_id}/insert" req[:body] = params req[:model] = Braintrust::Models::InsertEventsResponse @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Experiment>
List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first
114 115 116 117 118 119 120 121 122 |
# File 'lib/braintrust/resources/experiments.rb', line 114 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/experiment" req[:query] = params req[:page] = Braintrust::ListObjects req[:model] = Braintrust::Models::Experiment @client.request(req, opts) end |
#retrieve(experiment_id, opts = {}) ⇒ Braintrust::Models::Experiment
Get an experiment object by its id
50 51 52 53 54 55 56 |
# File 'lib/braintrust/resources/experiments.rb', line 50 def retrieve(experiment_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/experiment/#{experiment_id}" req[:model] = Braintrust::Models::Experiment @client.request(req, opts) end |
#summarize(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::SummarizeExperimentResponse
Summarize experiment
318 319 320 321 322 323 324 325 |
# File 'lib/braintrust/resources/experiments.rb', line 318 def summarize(experiment_id, params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/experiment/#{experiment_id}/summarize" req[:query] = params req[:model] = Braintrust::Models::SummarizeExperimentResponse @client.request(req, opts) end |
#update(experiment_id, params = {}, opts = {}) ⇒ Braintrust::Models::Experiment
Partially update an experiment object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.
80 81 82 83 84 85 86 87 |
# File 'lib/braintrust/resources/experiments.rb', line 80 def update(experiment_id, params = {}, opts = {}) req = {} req[:method] = :patch req[:path] = "/v1/experiment/#{experiment_id}" req[:body] = params req[:model] = Braintrust::Models::Experiment @client.request(req, opts) end |