Class: Telnyx::Resources::AI::Collections::Sources

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/collections/sources.rb,
sig/telnyx/resources/ai/collections/sources.rbs

Overview

Create and manage logical collections of your Telnyx data, tune retrieval settings, manage sources, and run collection-scoped semantic search.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Sources

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 Sources.

Parameters:



116
117
118
# File 'lib/telnyx/resources/ai/collections/sources.rb', line 116

def initialize(client:)
  @client = client
end

Instance Method Details

#create(uuid, source_type:, bucket_id: nil, request_options: {}) ⇒ Telnyx::Models::AI::Collections::SourceCreateResponse

Some parameter documentations has been truncated, see Models::AI::Collections::SourceCreateParams for more details.

Attaches a new content source to the specified collection and returns the created source. The source's content is ingested and embedded so it becomes searchable within the collection.

Parameters:

  • uuid (String)

    The collection's unique identifier.

  • source_type (Symbol, Telnyx::Models::AI::Collections::SourceType)

    The type of Telnyx data attached as a source. bucket requires an additional `b

  • bucket_id (String)

    The Telnyx Storage bucket name. Required when source_type is bucket; ignored

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/telnyx/resources/ai/collections/sources.rb', line 30

def create(uuid, params)
  parsed, options = Telnyx::AI::Collections::SourceCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["ai/collections/%1$s/sources", uuid],
    body: parsed,
    model: Telnyx::Models::AI::Collections::SourceCreateResponse,
    options: options
  )
end

#delete(source_id, uuid:, request_options: {}) ⇒ nil

Removes a single source from a collection.

Parameters:

  • source_id (String)

    The identifier of the source to remove.

  • uuid (String)

    The collection's unique identifier.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/telnyx/resources/ai/collections/sources.rb', line 74

def delete(source_id, params)
  parsed, options = Telnyx::AI::Collections::SourceDeleteParams.dump_request(params)
  uuid =
    parsed.delete(:uuid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["ai/collections/%1$s/sources/%2$s", uuid, source_id],
    model: NilClass,
    options: options
  )
end

#list(uuid, request_options: {}) ⇒ Telnyx::Models::AI::Collections::SourceListResponse

Returns the sources attached to a collection.

Parameters:

  • uuid (String)

    The collection's unique identifier.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



52
53
54
55
56
57
58
59
# File 'lib/telnyx/resources/ai/collections/sources.rb', line 52

def list(uuid, params = {})
  @client.request(
    method: :get,
    path: ["ai/collections/%1$s/sources", uuid],
    model: Telnyx::Models::AI::Collections::SourceListResponse,
    options: params[:request_options]
  )
end

#replace(uuid, sources:, request_options: {}) ⇒ Telnyx::Models::AI::Collections::SourceReplaceResponse

Replaces the collection's entire source set. The response meta reports which sources were added, retained, and removed.

Parameters:

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
# File 'lib/telnyx/resources/ai/collections/sources.rb', line 102

def replace(uuid, params)
  parsed, options = Telnyx::AI::Collections::SourceReplaceParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["ai/collections/%1$s/sources", uuid],
    body: parsed,
    model: Telnyx::Models::AI::Collections::SourceReplaceResponse,
    options: options
  )
end