Class: Telnyx::Resources::AI::Collections
- Inherits:
-
Object
- Object
- Telnyx::Resources::AI::Collections
- Defined in:
- lib/telnyx/resources/ai/collections.rb,
lib/telnyx/resources/ai/collections/sources.rb,
lib/telnyx/resources/ai/collections/settings.rb,
sig/telnyx/resources/ai/collections.rbs,
sig/telnyx/resources/ai/collections/sources.rbs,
sig/telnyx/resources/ai/collections/settings.rbs
Overview
Create and manage logical collections of your Telnyx data, tune retrieval settings, manage sources, and run collection-scoped semantic search.
Defined Under Namespace
Instance Attribute Summary collapse
-
#settings ⇒ Telnyx::Resources::AI::Collections::Settings
readonly
Create and manage logical collections of your Telnyx data, tune retrieval settings, manage sources, and run collection-scoped semantic search.
-
#sources ⇒ Telnyx::Resources::AI::Collections::Sources
readonly
Create and manage logical collections of your Telnyx data, tune retrieval settings, manage sources, and run collection-scoped semantic search.
Instance Method Summary collapse
-
#create(name:, description: nil, settings: nil, slug: nil, sources: nil, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Creates a new collection scoped to your organization.
-
#delete(uuid, request_options: {}) ⇒ nil
Soft-deletes a collection.
-
#initialize(client:) ⇒ Collections
constructor
private
A new instance of Collections.
-
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Collection>
Returns a paginated list of collections in your organization.
-
#retrieve(slug, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Fetches a single collection by its
slug. -
#retrieve_by_id(uuid, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Fetches a single collection by its
uuid. -
#update(uuid, description: nil, name: nil, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Updates a collection's metadata (
nameand/ordescription).
Constructor Details
#initialize(client:) ⇒ Collections
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Collections.
168 169 170 171 172 |
# File 'lib/telnyx/resources/ai/collections.rb', line 168 def initialize(client:) @client = client @settings = Telnyx::Resources::AI::Collections::Settings.new(client: client) @sources = Telnyx::Resources::AI::Collections::Sources.new(client: client) end |
Instance Attribute Details
#settings ⇒ Telnyx::Resources::AI::Collections::Settings (readonly)
Create and manage logical collections of your Telnyx data, tune retrieval settings, manage sources, and run collection-scoped semantic search.
12 13 14 |
# File 'lib/telnyx/resources/ai/collections.rb', line 12 def settings @settings end |
#sources ⇒ Telnyx::Resources::AI::Collections::Sources (readonly)
Create and manage logical collections of your Telnyx data, tune retrieval settings, manage sources, and run collection-scoped semantic search.
17 18 19 |
# File 'lib/telnyx/resources/ai/collections.rb', line 17 def sources @sources end |
Instance Method Details
#create(name:, description: nil, settings: nil, slug: nil, sources: nil, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Creates a new collection scoped to your organization. Optionally attach sources
and retrieval settings at creation time. If slug is omitted, one is derived
from name and must be unique within your organization.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/telnyx/resources/ai/collections.rb', line 40 def create(params) parsed, = Telnyx::AI::CollectionCreateParams.dump_request(params) @client.request( method: :post, path: "ai/collections", body: parsed, model: Telnyx::AI::CollectionEnvelope, options: ) end |
#delete(uuid, request_options: {}) ⇒ nil
Soft-deletes a collection. Its slug is freed and may be reused by a new
collection.
136 137 138 139 140 141 142 143 |
# File 'lib/telnyx/resources/ai/collections.rb', line 136 def delete(uuid, params = {}) @client.request( method: :delete, path: ["ai/collections/%1$s", uuid], model: NilClass, options: params[:request_options] ) end |
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AI::Collection>
Returns a paginated list of collections in your organization.
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/telnyx/resources/ai/collections.rb', line 111 def list(params = {}) parsed, = Telnyx::AI::CollectionListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "ai/collections", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::AI::Collection, options: ) end |
#retrieve(slug, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Fetches a single collection by its slug.
62 63 64 65 66 67 68 69 |
# File 'lib/telnyx/resources/ai/collections.rb', line 62 def retrieve(slug, params = {}) @client.request( method: :get, path: ["ai/collections/slug/%1$s", slug], model: Telnyx::AI::CollectionEnvelope, options: params[:request_options] ) end |
#retrieve_by_id(uuid, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Fetches a single collection by its uuid.
156 157 158 159 160 161 162 163 |
# File 'lib/telnyx/resources/ai/collections.rb', line 156 def retrieve_by_id(uuid, params = {}) @client.request( method: :get, path: ["ai/collections/%1$s", uuid], model: Telnyx::AI::CollectionEnvelope, options: params[:request_options] ) end |
#update(uuid, description: nil, name: nil, request_options: {}) ⇒ Telnyx::Models::AI::CollectionEnvelope
Updates a collection's metadata (name and/or description). Sources and
settings are managed through their own sub-resources.
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/telnyx/resources/ai/collections.rb', line 87 def update(uuid, params = {}) parsed, = Telnyx::AI::CollectionUpdateParams.dump_request(params) @client.request( method: :patch, path: ["ai/collections/%1$s", uuid], body: parsed, model: Telnyx::AI::CollectionEnvelope, options: ) end |