Class: Telnyx::Resources::AI::Assistants::CanaryDeploys

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

Overview

Configure AI assistant specifications

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CanaryDeploys

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

Parameters:



119
120
121
# File 'lib/telnyx/resources/ai/assistants/canary_deploys.rb', line 119

def initialize(client:)
  @client = client
end

Instance Method Details

#create(assistant_id, rules: nil, idempotency_key: nil, request_options: {}) ⇒ Telnyx::Models::AI::Assistants::CanaryDeployResponse

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

Endpoint to create a canary deploy configuration for an assistant.

Creates a new canary deploy configuration with multiple version IDs and their traffic percentages for A/B testing or gradual rollouts of assistant versions.

Parameters:

  • assistant_id (String)

    Path param: Unique identifier of the assistant.

  • rules (Array<Telnyx::Models::AI::Assistants::RuleInput>)

    Body param

  • idempotency_key (String)

    Header param: Optional opaque, unquoted key for safely retrying the same logical

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/telnyx/resources/ai/assistants/canary_deploys.rb', line 30

def create(assistant_id, params = {})
  parsed, options = Telnyx::AI::Assistants::CanaryDeployCreateParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: ["ai/assistants/%1$s/canary-deploys", assistant_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Telnyx::AI::Assistants::CanaryDeployResponse,
    options: options
  )
end

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

Endpoint to delete a canary deploy configuration for an assistant.

Removes all canary deploy configurations for the specified assistant.

Parameters:

  • assistant_id (String)

    Unique identifier of the assistant.

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

Returns:

  • (nil)

See Also:



107
108
109
110
111
112
113
114
# File 'lib/telnyx/resources/ai/assistants/canary_deploys.rb', line 107

def delete(assistant_id, params = {})
  @client.request(
    method: :delete,
    path: ["ai/assistants/%1$s/canary-deploys", assistant_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#retrieve(assistant_id, request_options: {}) ⇒ Telnyx::Models::AI::Assistants::CanaryDeployResponse

Endpoint to get a canary deploy configuration for an assistant.

Retrieves the current canary deploy configuration with all version IDs and their traffic percentages for the specified assistant.

Parameters:

  • assistant_id (String)

    Unique identifier of the assistant.

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

Returns:

See Also:



57
58
59
60
61
62
63
64
# File 'lib/telnyx/resources/ai/assistants/canary_deploys.rb', line 57

def retrieve(assistant_id, params = {})
  @client.request(
    method: :get,
    path: ["ai/assistants/%1$s/canary-deploys", assistant_id],
    model: Telnyx::AI::Assistants::CanaryDeployResponse,
    options: params[:request_options]
  )
end

#update(assistant_id, rules: nil, request_options: {}) ⇒ Telnyx::Models::AI::Assistants::CanaryDeployResponse

Endpoint to update a canary deploy configuration for an assistant.

Updates the existing canary deploy configuration with new version IDs and percentages. All old versions and percentages are replaces by new ones from this request.

Parameters:

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
# File 'lib/telnyx/resources/ai/assistants/canary_deploys.rb', line 83

def update(assistant_id, params = {})
  parsed, options = Telnyx::AI::Assistants::CanaryDeployUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["ai/assistants/%1$s/canary-deploys", assistant_id],
    body: parsed,
    model: Telnyx::AI::Assistants::CanaryDeployResponse,
    options: options
  )
end