Class: Braintrust::Resources::Datasets
- Inherits:
-
Object
- Object
- Braintrust::Resources::Datasets
- Defined in:
- lib/braintrust/resources/datasets.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Dataset
Create a new dataset.
-
#delete(dataset_id, opts = {}) ⇒ Braintrust::Models::Dataset
Delete a dataset object by its id.
-
#feedback(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::FeedbackResponseSchema
Log feedback for a set of dataset events.
-
#fetch(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchDatasetEventsResponse
Fetch the events in a dataset.
-
#fetch_post(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchDatasetEventsResponse
Fetch the events in a dataset.
-
#initialize(client:) ⇒ Datasets
constructor
A new instance of Datasets.
-
#insert(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::InsertEventsResponse
Insert a set of events into the dataset.
-
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Dataset>
List out all datasets.
-
#retrieve(dataset_id, opts = {}) ⇒ Braintrust::Models::Dataset
Get a dataset object by its id.
-
#summarize(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::SummarizeDatasetResponse
Summarize dataset.
-
#update(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::Dataset
Partially update a dataset object.
Constructor Details
#initialize(client:) ⇒ Datasets
Returns a new instance of Datasets.
6 7 8 |
# File 'lib/braintrust/resources/datasets.rb', line 6 def initialize(client:) @client = client end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Braintrust::Models::Dataset
Create a new dataset. If there is an existing dataset in the project with the same name as the one specified in the request, will return the existing dataset unmodified
22 23 24 25 26 27 28 29 |
# File 'lib/braintrust/resources/datasets.rb', line 22 def create(params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/dataset" req[:body] = params req[:model] = Braintrust::Models::Dataset @client.request(req, opts) end |
#delete(dataset_id, opts = {}) ⇒ Braintrust::Models::Dataset
Delete a dataset object by its id
109 110 111 112 113 114 115 |
# File 'lib/braintrust/resources/datasets.rb', line 109 def delete(dataset_id, opts = {}) req = {} req[:method] = :delete req[:path] = "/v1/dataset/#{dataset_id}" req[:model] = Braintrust::Models::Dataset @client.request(req, opts) end |
#feedback(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::FeedbackResponseSchema
Log feedback for a set of dataset events
127 128 129 130 131 132 133 134 |
# File 'lib/braintrust/resources/datasets.rb', line 127 def feedback(dataset_id, params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/dataset/#{dataset_id}/feedback" req[:body] = params req[:model] = Braintrust::Models::FeedbackResponseSchema @client.request(req, opts) end |
#fetch(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchDatasetEventsResponse
Fetch the events in a dataset. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body
185 186 187 188 189 190 191 192 |
# File 'lib/braintrust/resources/datasets.rb', line 185 def fetch(dataset_id, params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/dataset/#{dataset_id}/fetch" req[:query] = params req[:model] = Braintrust::Models::FetchDatasetEventsResponse @client.request(req, opts) end |
#fetch_post(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::FetchDatasetEventsResponse
Fetch the events in a dataset. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query
254 255 256 257 258 259 260 261 |
# File 'lib/braintrust/resources/datasets.rb', line 254 def fetch_post(dataset_id, params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/dataset/#{dataset_id}/fetch" req[:body] = params req[:model] = Braintrust::Models::FetchDatasetEventsResponse @client.request(req, opts) end |
#insert(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::InsertEventsResponse
Insert a set of events into the dataset
273 274 275 276 277 278 279 280 |
# File 'lib/braintrust/resources/datasets.rb', line 273 def insert(dataset_id, params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/v1/dataset/#{dataset_id}/insert" req[:body] = params req[:model] = Braintrust::Models::InsertEventsResponse @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Braintrust::ListObjects<Braintrust::Models::Dataset>
List out all datasets. The datasets are sorted by creation date, with the most recently-created datasets coming first
93 94 95 96 97 98 99 100 101 |
# File 'lib/braintrust/resources/datasets.rb', line 93 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/dataset" req[:query] = params req[:page] = Braintrust::ListObjects req[:model] = Braintrust::Models::Dataset @client.request(req, opts) end |
#retrieve(dataset_id, opts = {}) ⇒ Braintrust::Models::Dataset
Get a dataset object by its id
37 38 39 40 41 42 43 |
# File 'lib/braintrust/resources/datasets.rb', line 37 def retrieve(dataset_id, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/dataset/#{dataset_id}" req[:model] = Braintrust::Models::Dataset @client.request(req, opts) end |
#summarize(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::SummarizeDatasetResponse
Summarize dataset
293 294 295 296 297 298 299 300 |
# File 'lib/braintrust/resources/datasets.rb', line 293 def summarize(dataset_id, params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/v1/dataset/#{dataset_id}/summarize" req[:query] = params req[:model] = Braintrust::Models::SummarizeDatasetResponse @client.request(req, opts) end |
#update(dataset_id, params = {}, opts = {}) ⇒ Braintrust::Models::Dataset
Partially update a dataset 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.
59 60 61 62 63 64 65 66 |
# File 'lib/braintrust/resources/datasets.rb', line 59 def update(dataset_id, params = {}, opts = {}) req = {} req[:method] = :patch req[:path] = "/v1/dataset/#{dataset_id}" req[:body] = params req[:model] = Braintrust::Models::Dataset @client.request(req, opts) end |