Class: Twilio::REST::Intelligence::V3::VersionInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/intelligence/v3/version.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, id: nil, version_: nil) ⇒ VersionInstance

Initialize the VersionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Version resource.

  • sid (String)

    The SID of the Call resource to fetch.



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 393

def initialize(version, payload , id: nil, version_: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'display_name' => payload['display_name'],
        'description' => payload['description'],
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
        'author' => payload['author'],
        'prompt' => payload['prompt'],
        'output_format' => payload['output_format'],
        'output_schema' => payload['output_schema'],
        'training_examples' => payload['training_examples'],
        'context' => payload['context'],
        'parameters' => payload['parameters'],
        'status' => payload['status'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_deprecated' => Twilio.deserialize_iso8601_datetime(payload['date_deprecated']),
        'retirement_date' => Twilio.deserialize_iso8601_datetime(payload['retirement_date']),
        'date_retired' => Twilio.deserialize_iso8601_datetime(payload['date_retired']),
    }

    # Context
    @instance_context = nil
    @params = { 'id' => id  || @properties['id']  ,'version_' => version_  || @properties['version_']  , }
end

Instance Method Details

#authorOperatorAuthor

Returns:

  • (OperatorAuthor)


460
461
462
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 460

def author
    @properties['author']
end

#contextOperatorContext

Returns:



427
428
429
430
431
432
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 427

def context
    unless @instance_context
        @instance_context = VersionContext.new(@version , @params['id'], @params['version_'])
    end
    @instance_context
end

#date_createdTime

Returns Timestamp of when this version was created.

Returns:

  • (Time)

    Timestamp of when this version was created.



508
509
510
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 508

def date_created
    @properties['date_created']
end

#date_deprecatedTime

Returns Timestamp of when this version was deprecated. Present when status is ‘DEPRECATED` or `RETIRED`.

Returns:

  • (Time)

    Timestamp of when this version was deprecated. Present when status is ‘DEPRECATED` or `RETIRED`.



514
515
516
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 514

def date_deprecated
    @properties['date_deprecated']
end

#date_retiredTime

Returns Timestamp of when this version was retired. Present when status is ‘RETIRED`.

Returns:

  • (Time)

    Timestamp of when this version was retired. Present when status is ‘RETIRED`.



526
527
528
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 526

def date_retired
    @properties['date_retired']
end

#descriptionString

Returns Description of the Language Operator further explaining its purpose.

Returns:

  • (String)

    Description of the Language Operator further explaining its purpose.



448
449
450
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 448

def description
    @properties['description']
end

#display_nameString

Returns Display name of the Language Operator describing its purpose.

Returns:

  • (String)

    Display name of the Language Operator describing its purpose.



442
443
444
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 442

def display_name
    @properties['display_name']
end

#fetchVersionInstance

Fetch the VersionInstance

Returns:



533
534
535
536
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 533

def fetch

    context.fetch
end

#idString

Returns The unique identifier for the Language Operator. Assigned by Twilio (TTID).

Returns:

  • (String)

    The unique identifier for the Language Operator. Assigned by Twilio (TTID).



436
437
438
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 436

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



547
548
549
550
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 547

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Intelligence.V3.VersionInstance #{values}>"
end

#output_formatOperatorOutputFormat

Returns:

  • (OperatorOutputFormat)


472
473
474
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 472

def output_format
    @properties['output_format']
end

#output_schemaHash

Returns Required for ‘JSON` output only. this will be set to a JSON Schema object describing the properties & data types of the response. Please see platform.openai.com/docs/guides/structured-outputs#supported-schemas Will include the following keywords: - `type` : Must be set to `object` - `properties`: An object containing the property names and their data types you would like the LLM to return Additional details on JSON output formatting: - The root level `type` of a JSON schema must be set to `object` - The following property data types are supported : `string`, `number`, `boolean`, `integer`, `object`, `array`, `anyOf` - Definitions with `$defs` / `$ref` are supported - Max 100 object properties and 10 levels of nesting are supported - Max 1000 enum values across all enum properties are supported - Notable JSON Schema keywords not supported include: - For `strings`: `minLength`, `maxLength` - For `objects`: `patternProperties`, `unevaluatedProperties`, `propertyNames`, `minProperties`, `maxProperties` - For `arrays`: `unevaluatedItems`, `contains`, `minContains`, `maxContains`, `uniqueItems` - Structured Operator Results will be returned in the same order as the ordering of keys in the schema - In the event an Operator execution request is refused for safety reasons the Operator Result API response will include a new field called `refusal` to indicate that the LLM refused to fulfill the request - Twilio will automatically set `additionalProperties` to false and specify all provided fields as required (constraints of Structured Outputs). You don’t need to pass these fields as part of your JSON schema. Twilio will automatically overwrite any user-provided values for these fields.

Returns:

  • (Hash)

    Required for ‘JSON` output only. this will be set to a JSON Schema object describing the properties & data types of the response. Please see platform.openai.com/docs/guides/structured-outputs#supported-schemas Will include the following keywords: - `type` : Must be set to `object` - `properties`: An object containing the property names and their data types you would like the LLM to return Additional details on JSON output formatting: - The root level `type` of a JSON schema must be set to `object` - The following property data types are supported : `string`, `number`, `boolean`, `integer`, `object`, `array`, `anyOf` - Definitions with `$defs` / `$ref` are supported - Max 100 object properties and 10 levels of nesting are supported - Max 1000 enum values across all enum properties are supported - Notable JSON Schema keywords not supported include: - For `strings`: `minLength`, `maxLength` - For `objects`: `patternProperties`, `unevaluatedProperties`, `propertyNames`, `minProperties`, `maxProperties` - For `arrays`: `unevaluatedItems`, `contains`, `minContains`, `maxContains`, `uniqueItems` - Structured Operator Results will be returned in the same order as the ordering of keys in the schema - In the event an Operator execution request is refused for safety reasons the Operator Result API response will include a new field called `refusal` to indicate that the LLM refused to fulfill the request - Twilio will automatically set `additionalProperties` to false and specify all provided fields as required (constraints of Structured Outputs). You don’t need to pass these fields as part of your JSON schema. Twilio will automatically overwrite any user-provided values for these fields.



478
479
480
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 478

def output_schema
    @properties['output_schema']
end

#parametersHash<String, OperatorParameter>

Returns Defines the schema of the parameters that are provided when running the operator, including required and optional values that determine the operator’s behavior. The values of the parameters themselves are passed in by the attached Intelligence Configuration.

Returns:

  • (Hash<String, OperatorParameter>)

    Defines the schema of the parameters that are provided when running the operator, including required and optional values that determine the operator’s behavior. The values of the parameters themselves are passed in by the attached Intelligence Configuration.



496
497
498
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 496

def parameters
    @properties['parameters']
end

#promptString

Returns The natural language instructions used by the operator to analyze the conversation. Within the prompt, users can reference parameters using the ‘href="param_name">parameters.}` syntax. Parameter values are provided to the Operator by the Intelligence Configuration Rule at runtime. Note: Prompts will only be exposed for Custom Operators (`author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their prompts omitted from the API.

Returns:

  • (String)

    The natural language instructions used by the operator to analyze the conversation. Within the prompt, users can reference parameters using the ‘href="param_name">parameters.}` syntax. Parameter values are provided to the Operator by the Intelligence Configuration Rule at runtime. Note: Prompts will only be exposed for Custom Operators (`author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their prompts omitted from the API.



466
467
468
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 466

def prompt
    @properties['prompt']
end

#retirement_dateTime

Returns Scheduled retirement date for this version. Present when status is ‘DEPRECATED`.

Returns:

  • (Time)

    Scheduled retirement date for this version. Present when status is ‘DEPRECATED`.



520
521
522
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 520

def retirement_date
    @properties['retirement_date']
end

#statusOperatorVersionStatus

Returns:

  • (OperatorVersionStatus)


502
503
504
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 502

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



540
541
542
543
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 540

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Intelligence.V3.VersionInstance #{values}>"
end

#training_examplesArray<OperatorTrainingExample>

Returns An array of example input/output pairs used to illustrate the intended behavior of the Language Operator. These examples help guide the model’s understanding of expected input–output relationships and improve consistency during evaluation and testing. Note: Training examples will only be exposed for Custom Operators (‘author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their training examples omitted from the API.

Returns:

  • (Array<OperatorTrainingExample>)

    An array of example input/output pairs used to illustrate the intended behavior of the Language Operator. These examples help guide the model’s understanding of expected input–output relationships and improve consistency during evaluation and testing. Note: Training examples will only be exposed for Custom Operators (‘author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their training examples omitted from the API.



484
485
486
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 484

def training_examples
    @properties['training_examples']
end

#versionString

Returns Numeric Operator version. Automatically incremented with each update on the resource, used to ensure integrity when updating the Operator.

Returns:

  • (String)

    Numeric Operator version. Automatically incremented with each update on the resource, used to ensure integrity when updating the Operator.



454
455
456
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 454

def version
    @properties['version']
end