Class: Twilio::REST::Intelligence::V3::VersionInstance
- Inherits:
-
Twilio::REST::InstanceResource
- Object
- Twilio::REST::InstanceResource
- Twilio::REST::Intelligence::V3::VersionInstance
- Defined in:
- lib/twilio-ruby/rest/intelligence/v3/version.rb
Instance Method Summary collapse
- #author ⇒ OperatorAuthor
- #context ⇒ OperatorContext
-
#date_created ⇒ Time
Timestamp of when this version was created.
-
#date_deprecated ⇒ Time
Timestamp of when this version was deprecated.
-
#date_retired ⇒ Time
Timestamp of when this version was retired.
-
#description ⇒ String
Description of the Language Operator further explaining its purpose.
-
#display_name ⇒ String
Display name of the Language Operator describing its purpose.
-
#fetch ⇒ VersionInstance
Fetch the VersionInstance.
-
#id ⇒ String
The unique identifier for the Language Operator.
-
#initialize(version, payload, id: nil, version_: nil) ⇒ VersionInstance
constructor
Initialize the VersionInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
- #output_format ⇒ OperatorOutputFormat
-
#output_schema ⇒ Hash
Required for ‘JSON` output only.
-
#parameters ⇒ 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.
-
#prompt ⇒ String
The natural language instructions used by the operator to analyze the conversation.
-
#retirement_date ⇒ Time
Scheduled retirement date for this version.
- #status ⇒ OperatorVersionStatus
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#training_examples ⇒ Array<OperatorTrainingExample>
An array of example input/output pairs used to illustrate the intended behavior of the Language Operator.
-
#version ⇒ String
Numeric Operator version.
Constructor Details
#initialize(version, payload, id: nil, version_: nil) ⇒ VersionInstance
Initialize the VersionInstance
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
#author ⇒ OperatorAuthor
460 461 462 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 460 def @properties['author'] end |
#context ⇒ OperatorContext
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_created ⇒ Time
Returns 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_deprecated ⇒ Time
Returns 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_retired ⇒ Time
Returns 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 |
#description ⇒ String
Returns 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_name ⇒ String
Returns 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 |
#fetch ⇒ VersionInstance
Fetch the VersionInstance
533 534 535 536 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 533 def fetch context.fetch end |
#id ⇒ String
Returns 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 |
#inspect ⇒ Object
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_format ⇒ OperatorOutputFormat
472 473 474 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 472 def output_format @properties['output_format'] end |
#output_schema ⇒ Hash
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.
478 479 480 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 478 def output_schema @properties['output_schema'] end |
#parameters ⇒ Hash<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.
496 497 498 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 496 def parameters @properties['parameters'] end |
#prompt ⇒ String
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.
466 467 468 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 466 def prompt @properties['prompt'] end |
#retirement_date ⇒ Time
Returns 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 |
#status ⇒ OperatorVersionStatus
502 503 504 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 502 def status @properties['status'] end |
#to_s ⇒ Object
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_examples ⇒ Array<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.
484 485 486 |
# File 'lib/twilio-ruby/rest/intelligence/v3/version.rb', line 484 def training_examples @properties['training_examples'] end |
#version ⇒ String
Returns 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 |