Class: Telnyx::Models::AI::Assistants::CanaryDeploy::Rule

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/telnyx/models/ai/assistants/canary_deploy.rb

Defined Under Namespace

Classes: Match, Serve

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(version_id:, weight:) ⇒ Object

One slot in a percentage rollout.

Parameters:

  • version_id (String)
  • weight (Float)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/telnyx/models/ai/assistants/canary_deploy.rb', line 20

class Rule < Telnyx::Internal::Type::BaseModel
  # @!attribute serve
  #   What a rule serves when matched.
  #
  #   Exactly one of:
  #
  #   - `version_id` — serve a specific version
  #   - `rollout` — weighted random across versions; weights must sum to less than
  #     100, with the leftover routing to the main version
  #
  #   @return [Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Serve]
  required :serve, -> { Telnyx::AI::Assistants::CanaryDeploy::Rule::Serve }

  # @!attribute match
  #
  #   @return [Array<Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Match>, nil]
  optional :match, -> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::Assistants::CanaryDeploy::Rule::Match] }

  # @!method initialize(serve:, match: nil)
  #   Some parameter documentations has been truncated, see
  #   {Telnyx::Models::AI::Assistants::CanaryDeploy::Rule} for more details.
  #
  #   A targeting rule: `match` clauses (AND) gate `serve`.
  #
  #   An empty `match` is a catch-all (always fires).
  #
  #   @param serve [Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Serve] What a rule serves when matched.
  #
  #   @param match [Array<Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Match>]

  # @see Telnyx::Models::AI::Assistants::CanaryDeploy::Rule#serve
  class Serve < Telnyx::Internal::Type::BaseModel
    # @!attribute rollout
    #
    #   @return [Array<Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Serve::Rollout>, nil]
    optional :rollout,
             -> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::Assistants::CanaryDeploy::Rule::Serve::Rollout] }

    # @!attribute version_id
    #
    #   @return [String, nil]
    optional :version_id, String

    # @!method initialize(rollout: nil, version_id: nil)
    #   What a rule serves when matched.
    #
    #   Exactly one of:
    #
    #   - `version_id` — serve a specific version
    #   - `rollout` — weighted random across versions; weights must sum to less than
    #     100, with the leftover routing to the main version
    #
    #   @param rollout [Array<Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Serve::Rollout>]
    #   @param version_id [String]

    class Rollout < Telnyx::Internal::Type::BaseModel
      # @!attribute version_id
      #
      #   @return [String]
      required :version_id, String

      # @!attribute weight
      #
      #   @return [Float]
      required :weight, Float

      # @!method initialize(version_id:, weight:)
      #   One slot in a percentage rollout.
      #
      #   @param version_id [String]
      #   @param weight [Float]
    end
  end

  class Match < Telnyx::Internal::Type::BaseModel
    # @!attribute attribute
    #   Attribute name from the routing context
    #
    #   @return [String]
    required :attribute, String

    # @!attribute operator
    #   Match operator
    #
    #   @return [Symbol, Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Match::Operator]
    required :operator, enum: -> { Telnyx::AI::Assistants::CanaryDeploy::Rule::Match::Operator }

    # @!attribute values
    #
    #   @return [Array<String>]
    required :values, Telnyx::Internal::Type::ArrayOf[String]

    # @!method initialize(attribute:, operator:, values:)
    #   A single attribute/operator/values check.
    #
    #   A clause matches when the routing context's value for `attribute` satisfies
    #   `operator` against any of `values`.
    #
    #   @param attribute [String] Attribute name from the routing context
    #
    #   @param operator [Symbol, Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Match::Operator] Match operator
    #
    #   @param values [Array<String>]

    # Match operator
    #
    # @see Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Match#operator
    module Operator
      extend Telnyx::Internal::Type::Enum

      IN = :in
      NOT_IN = :not_in
      STARTS_WITH = :starts_with

      # @!method self.values
      #   @return [Array<Symbol>]
    end
  end
end

Instance Attribute Details

#matchArray<Telnyx::Models::AI::Assistants::CanaryDeploy::Rule::Match>?



36
# File 'lib/telnyx/models/ai/assistants/canary_deploy.rb', line 36

optional :match, -> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::Assistants::CanaryDeploy::Rule::Match] }

#serveTelnyx::Models::AI::Assistants::CanaryDeploy::Rule::Serve

What a rule serves when matched.

Exactly one of:

  • ‘version_id` — serve a specific version

  • ‘rollout` — weighted random across versions; weights must sum to less than 100, with the leftover routing to the main version



31
# File 'lib/telnyx/models/ai/assistants/canary_deploy.rb', line 31

required :serve, -> { Telnyx::AI::Assistants::CanaryDeploy::Rule::Serve }