メニュー

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sample

A Sample is the training data for your Assistant.

Samples capture how end users would naturally express a task when speaking or texting. Users may express what they would want to do in many different ways – this training data is what powers the natural language model to understand your user's intent.

All Autopilot REST API resources use the following base URL.

https://autopilot.twilio.com/v1/

Sample properties

Names in PHP format
accountSid
sid<AC> Not PII

The unique ID of the Account that created this Sample.

dateCreated
date_time<iso8601> Not PII

The date that this resource was created

dateUpdated
date_time<iso8601> Not PII

The date that this resource was last updated

taskSid
sid<UD> Not PII

The unique ID of the Task associated with this Sample.

language
文字列 Not PII

An ISO language-country string that specifies the language used for this sample. For example: en-US.

assistantSid
sid<UA> Not PII

The unique ID of the Assistant.

sid
sid<UF> Not PII

A 34-character string that uniquely identifies this resource.

taggedText
文字列 Not PII

The text example of how end-users may express this task. The sample may contain Field tag blocks.

url
url Not PII

sourceChannel
文字列 Not PII

The communication channel from which the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included, the value will be null

Create a Sample resource

post
https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples

Creates a new Sample for the Task specified with {TaskSid}

Most samples will be words, phrases, or complete sentences that train your Assistant on what input to expect from a user asking for this task. For example, your task is tell-a-joke, you may add samples with the tagged text "joke", "tell a joke", or "I'd like to hear something funny".

We recommend using at least ten samples for any given task: this gives your assistant enough data to begin properly mapping user input to the task.

Samples may also contain tags in curly brackets. The body of the curly bracket must match a valid Field instance resource defined in this sample's task. See Field Tagging below for more information.

パラメーター
Names in None format
assistant_sid
必須
post sid_like<UA> Not PII

The unique ID of the Assistant.

task_sid
必須
post sid_like<UD> Not PII

The unique ID of the Task associated with this Sample.

language
必須
post 文字列 Not PII

An ISO language-country string that specifies the language used for this sample. For example: en-US.

tagged_text
必須
post 文字列 Not PII

The text example of how end-users may express this task. The sample may contain Field tag blocks.

source_channel
オプション
post 文字列 Not PII

The communication channel from which the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included, the value will be null

例 1
        
        
        
        

        Fetch a Sample resource

        GET
        https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}

        Returns the Task Sample instance identified by {SampleSid}

        パラメーター
        Names in None format
        assistant_sid
        必須
        GET sid_like<UA> Not PII

        The unique ID of the Assistant.

        task_sid
        必須
        GET sid_like<UD> Not PII

        The unique ID of the Task associated with this Sample.

        sid
        必須
        GET sid<UF> Not PII

        A 34-character string that uniquely identifies this resource.

        例 1
              
              
              
              

              Read multiple Sample resources

              GET
              https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples

              Returns a list of Samples for a given Task specified by{TaskSid}. The list includes paging information.

              パラメーター
              Names in None format
              assistant_sid
              必須
              GET sid_like<UA> Not PII

              The unique ID of the Assistant.

              task_sid
              必須
              GET sid_like<UD> Not PII

              The unique ID of the Task associated with this Sample.

              language
              オプション
              GET 文字列 Not PII

              An ISO language-country string that specifies the language used for this sample. For example: en-US.

              例 1
                    
                    
                    
                    

                    Update a Sample resource

                    post
                    https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}

                    Updates the specific Sample.

                    パラメーター
                    Names in None format
                    assistant_sid
                    必須
                    post sid_like<UA> Not PII

                    The unique ID of the Assistant.

                    task_sid
                    必須
                    post sid_like<UD> Not PII

                    The unique ID of the Task associated with this Sample.

                    sid
                    必須
                    post sid<UF> Not PII

                    A 34-character string that uniquely identifies this resource.

                    language
                    オプション
                    post 文字列 Not PII

                    An ISO language-country string that specifies the language used for this sample. For example: en-US.

                    tagged_text
                    オプション
                    post 文字列 Not PII

                    The text example of how end-users may express this task. The sample may contain Field tag blocks.

                    source_channel
                    オプション
                    post 文字列 Not PII

                    The communication channel from which the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included, the value will be null

                    例 1
                          
                          
                          
                          

                          Delete a Sample resource

                          削除する
                          https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}
                          パラメーター
                          Names in None format
                          assistant_sid
                          必須
                          削除する sid_like<UA> Not PII

                          The unique ID of the Assistant.

                          task_sid
                          必須
                          削除する sid_like<UD> Not PII

                          The unique ID of the Task associated with this Sample.

                          sid
                          必須
                          削除する sid<UF> Not PII

                          A 34-character string that uniquely identifies this resource.

                          例 1
                                
                                
                                
                                

                                Field Tagging

                                The Sample's TaggedText allows you to specify what part of the Sample corresponds to a Field if you are leveraging fields on a given task.

                                Fields are specified within the sample by using bracketed text blocks in the format {field_unique_name}. This enables Autopilot to associate the part of the sample that corresponds with the Field and train the machine learning model to identify that Field.

                                If using fields in your task, you must create the Fields before creating Samples.

                                Example 1: tag a single field

                                In the case your task is talk_to_sales and you have multiple products, you need a Field sales_product. With one of your products being shiny widgets, the TaggedText should look like:

                                Original Text: "I want to talk to sales about shiny widgets"
                                Tagged Text: "I want to talk to sales about {sales_product}"
                                

                                Example 2: tag multiple fields

                                There can be multiple tags and a mix of tags. Each tag must reference the unique_name of a Field that exists in the same Assistant.

                                In the case where the task is order_pizza and the Fields are quantity, size, and ingredient, your TaggedText should look like:

                                Original Text: "I want two large pepperoni pizzas"
                                Tagged Text: "I want {quantity} {size} {ingredient} pizzas"
                                

                                Example 3: tag multiple complex fields

                                You can build more advanced schemas depending on your business needs. For example, if your pizza shop supports split ingredient orders, meaning you can order with different ingredients on each half of the pizza.

                                Here the task would be order_split_ingredient_pizza and your Fields would be quantity, size, and split_ingredient_1, and split_ingredient_2. Your TaggedText would look like:

                                Original Text: "i would like a large pizza one half with pepperoni and mushrooms and the other half with vegetarian with anchovies"
                                Tagged Text: "i would like {quantity} {size} pizza one half with {split_1_ingredient} and {split_1_ingredient} and the other half {split_2_ingredient} and {split_2_ingredient}"
                                

                                Tagging rules

                                • Tags cannot be nested.
                                • Tags cannot reference a non-existent Field.
                                • Once referenced, Fields cannot be deleted or renamed.
                                Rate this page:

                                ヘルプが必要ですか?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.