Class: Telnyx::Resources::AI::Assistants::Versions

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/assistants/versions.rb

Overview

Configure AI assistant specifications

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Versions

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

Parameters:



186
187
188
# File 'lib/telnyx/resources/ai/assistants/versions.rb', line 186

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(version_id, assistant_id:, request_options: {}) ⇒ nil

Permanently removes a specific version of an assistant. Can not delete main version

Parameters:

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

Returns:

  • (nil)

See Also:



142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/telnyx/resources/ai/assistants/versions.rb', line 142

def delete(version_id, params)
  parsed, options = Telnyx::AI::Assistants::VersionDeleteParams.dump_request(params)
  assistant_id =
    parsed.delete(:assistant_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["ai/assistants/%1$s/versions/%2$s", assistant_id, version_id],
    model: NilClass,
    options: options
  )
end

#list(assistant_id, request_options: {}) ⇒ Telnyx::Models::AI::AssistantsList

Retrieves all versions of a specific assistant with complete configuration and metadata

Parameters:

Returns:

See Also:



121
122
123
124
125
126
127
128
# File 'lib/telnyx/resources/ai/assistants/versions.rb', line 121

def list(assistant_id, params = {})
  @client.request(
    method: :get,
    path: ["ai/assistants/%1$s/versions", assistant_id],
    model: Telnyx::AI::AssistantsList,
    options: params[:request_options]
  )
end

#promote(version_id, assistant_id:, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding

Promotes a specific version to be the main/current version of the assistant. This will delete any existing canary deploy configuration and send all live production traffic to this version.

Parameters:

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

Returns:

See Also:



169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/telnyx/resources/ai/assistants/versions.rb', line 169

def promote(version_id, params)
  parsed, options = Telnyx::AI::Assistants::VersionPromoteParams.dump_request(params)
  assistant_id =
    parsed.delete(:assistant_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["ai/assistants/%1$s/versions/%2$s/promote", assistant_id, version_id],
    model: Telnyx::AI::InferenceEmbedding,
    options: options
  )
end

#retrieve(version_id, assistant_id:, include_mcp_servers: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding

Retrieves a specific version of an assistant by assistant_id and version_id

Parameters:

  • version_id (String)

    Path param

  • assistant_id (String)

    Path param

  • include_mcp_servers (Boolean)

    Query param

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

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/telnyx/resources/ai/assistants/versions.rb', line 24

def retrieve(version_id, params)
  parsed, options = Telnyx::AI::Assistants::VersionRetrieveParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  assistant_id =
    parsed.delete(:assistant_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["ai/assistants/%1$s/versions/%2$s", assistant_id, version_id],
    query: query,
    model: Telnyx::AI::InferenceEmbedding,
    options: options
  )
end

#update(version_id, assistant_id:, description: nil, dynamic_variables: nil, dynamic_variables_webhook_url: nil, enabled_features: nil, greeting: nil, insight_settings: nil, instructions: nil, llm_api_key_ref: nil, messaging_settings: nil, model: nil, name: nil, observability_settings: nil, privacy_settings: nil, telephony_settings: nil, tool_ids: nil, tools: nil, transcription: nil, voice_settings: nil, widget_settings: nil, request_options: {}) ⇒ Telnyx::Models::AI::InferenceEmbedding

Some parameter documentations has been truncated, see Models::AI::Assistants::VersionUpdateParams for more details.

Updates the configuration of a specific assistant version. Can not update main version

Parameters:

Returns:

See Also:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/telnyx/resources/ai/assistants/versions.rb', line 95

def update(version_id, params)
  parsed, options = Telnyx::AI::Assistants::VersionUpdateParams.dump_request(params)
  assistant_id =
    parsed.delete(:assistant_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["ai/assistants/%1$s/versions/%2$s", assistant_id, version_id],
    body: parsed,
    model: Telnyx::AI::InferenceEmbedding,
    options: options
  )
end