Retrieve an Operator
Legal information
Conversation Intelligence, including the APIs, may use artificial intelligence or machine learning technologies and is subject to the terms of the Predictive and Generative AI/ML Features Addendum. For more details on AI usage and data, see AI Nutrition Facts for Conversation Intelligence.
Conversation Intelligence is not PCI compliant or a HIPAA Eligible Service and should not be used in workflows that are subject to HIPAA or PCI.
Conversations products are only available in the new Twilio Console. If your account hasn't been migrated, you'll be redirected to the legacy Console where these products won't appear.
GET/v3/ControlPlane/Operators/{id}
Base url: https://intelligence.twilio.com (Twilio Intelligence API)
The unique identifier (TTID) of the Language Operator.
intelligence_operator_01k6fc25s7epm9qtk8rszbv3q5Pattern: ^intelligence_operator_[0-7][0-9a-z]{25}$A Language Operator resource.
The unique identifier for the Language Operator. Assigned by Twilio (TTID).
intelligence_operator_01k6fc25s7epm9qtk8rszbv3q5Pattern: ^intelligence_operator_[0-7][0-9a-z]{25}$Description of the Language Operator further explaining its purpose.
Numeric Operator version. Automatically incremented with each update on the resource, used to ensure integrity when updating the Operator.
The creator and maintainer of the Language Operator.
Available values:
SELF- Created and maintained by the customer (Custom Operator)TWILIO- Created and maintained by Twilio (Twilio-Authored Operator)
SELFTWILIOThe natural language instructions used by the operator to analyze the conversation.
Within the prompt, users can reference parameters using the {{parameters.[param_name]}} 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.
The structure of the result returned by the Language Operator (specific to what the LLM returns, not the entirety of the Operator Result resource).
Available values:
TEXT: The Operator will return plaintext from the LLM.JSON: the Operator will return a structured object with schema defined inoutput_schemaCLASSIFICATION: The Operator will return the determined classifier string.
TEXTJSONCLASSIFICATIONRequired for JSON output only. this will be set to a JSON Schema object describing the properties & data types of the response. Please see https://platform.openai.com/docs/guides/structured-outputs#supported-schemas
Will include the following keywords:
type: Must be set toobjectproperties: 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
typeof a JSON schema must be set toobject - The following property data types are supported :
string,number,boolean,integer,object,array,anyOf - Definitions with
$defs/$refare 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
- For
- 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
refusalto indicate that the LLM refused to fulfill the request - Twilio will automatically set
additionalPropertiesto 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.
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.
Optionally specifies which contextual data sources (Memory, Knowledge) the operator can access during execution. Context objects will be passed in by the Intelligence Configuration Rule at runtime.
Note: this simply gives the LLM access to these context objects – ultimately the LLM will determine whether to actually call for context at runtime.
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.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchOperator() {11const operator = await client.intelligence.v312.operators("intelligence_operator_01k6fc25s7epm9qtk8rszbv3q5")13.fetch();1415console.log(operator.id);16}1718fetchOperator();
Response
1{2"id": "intelligence_operator_01k6fc25s7epm9qtk8rszbv3q5",3"displayName": "Script Adherence",4"description": "Measuring whether the agent stuck to the script",5"version": 1,6"author": "SELF",7"prompt": "Your job is to determine if a contact center agent sticks to the script. Fetch the script from Knowledge using the Knowledge tool. Rate the interaction from 0-{{parameters.scale}}.",8"outputFormat": "JSON",9"outputSchema": {10"type": "object",11"properties": {12"score": {13"type": "integer"14},15"explanation": {16"type": "string"17}18},19"required": [20"score",21"explanation"22],23"additionalProperties": false24},25"trainingExamples": [26{27"input": "This is an example sentence which qualifies the lead as HOT.",28"output": "{\"score\": 5, \"explanation\": \"The agent followed the script closely and addressed all key points effectively.\"}"29}30],31"context": {32"memory": {33"enabled": true34},35"knowledge": {36"enabled": true37}38},39"parameters": {40"scale": {41"type": "integer",42"default": 5,43"description": "Maximum score for evaluating script adherence."44}45}46}