Class: Vellum::AsyncDocumentIndexesClient
- Inherits:
-
Object
- Object
- Vellum::AsyncDocumentIndexesClient
- Defined in:
- lib/vellum_ai/document_indexes/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
-
#create(label:, name:, indexing_config:, status: nil, environment: nil, copy_documents_from_index_id: nil, request_options: nil) ⇒ DocumentIndexRead
Creates a new document index.
-
#destroy(id:, request_options: nil) ⇒ Void
Used to delete a Document Index given its ID.
- #initialize(request_client:) ⇒ AsyncDocumentIndexesClient constructor
-
#list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedDocumentIndexReadList
Used to retrieve a list of Document Indexes.
-
#partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil) ⇒ DocumentIndexRead
Used to partial update a Document Index given its ID.
-
#retrieve(id:, request_options: nil) ⇒ DocumentIndexRead
Used to retrieve a Document Index given its ID or name.
-
#update(id:, label:, status: nil, environment: nil, request_options: nil) ⇒ DocumentIndexRead
Used to fully update a Document Index given its ID.
Constructor Details
#initialize(request_client:) ⇒ AsyncDocumentIndexesClient
177 178 179 180 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 177 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.
173 174 175 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 173 def request_client @request_client end |
Instance Method Details
#create(label:, name:, indexing_config:, status: nil, environment: nil, copy_documents_from_index_id: nil, request_options: nil) ⇒ DocumentIndexRead
Creates a new document index.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 226 def create(label:, name:, indexing_config:, status: nil, environment: nil, copy_documents_from_index_id: 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 || {}), label: label, name: name, status: status, environment: environment, indexing_config: indexing_config, copy_documents_from_index_id: copy_documents_from_index_id }.compact req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes" end DocumentIndexRead.from_json(json_object: response.body) end end |
#destroy(id:, request_options: nil) ⇒ Void
Used to delete a Document Index given its ID.
301 302 303 304 305 306 307 308 309 310 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 301 def destroy(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/document-indexes/#{id}" end end end |
#list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) ⇒ PaginatedDocumentIndexReadList
Used to retrieve a list of Document Indexes.
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 192 def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil) Async do response = @request_client.conn.get 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.params = { **(&.additional_query_parameters || {}), "limit": limit, "offset": offset, "ordering": ordering, "status": status }.compact req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes" end PaginatedDocumentIndexReadList.from_json(json_object: response.body) end end |
#partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil) ⇒ DocumentIndexRead
Used to partial update a Document Index given its ID.
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 325 def partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil) Async do response = @request_client.conn.patch 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 || {}), label: label, status: status, environment: environment }.compact req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}" end DocumentIndexRead.from_json(json_object: response.body) end end |
#retrieve(id:, request_options: nil) ⇒ DocumentIndexRead
Used to retrieve a Document Index given its ID or name.
253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 253 def retrieve(id:, request_options: nil) Async do response = @request_client.conn.get 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/document-indexes/#{id}" end DocumentIndexRead.from_json(json_object: response.body) end end |
#update(id:, label:, status: nil, environment: nil, request_options: nil) ⇒ DocumentIndexRead
Used to fully update a Document Index given its ID.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/vellum_ai/document_indexes/client.rb', line 278 def update(id:, label:, status: nil, environment: nil, request_options: nil) Async do response = @request_client.conn.put 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 || {}), label: label, status: status, environment: environment }.compact req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}" end DocumentIndexRead.from_json(json_object: response.body) end end |