メニュー

Expand
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?

query

Twilio Autopilot's Query API resource is the endpoint where Autopilot's natural language understanding analysis is performed.

The Query endpoint takes your user's natural language input (text or speech) and returns structured JSON output with the results.

This resource can behave in two different ways:

  1. It can be used in a RESTful manner, where POSTing creates a Query instance resource which logs the query that can be reviewed and used as additional training data if posted as a tagged Sample.
  2. It can also be used in an "ephemeral" mode, where POSTs to the Query resource returns results, but do not create a Query instance resource. You can specify whether to log the queries or not in the LogQuery property of an Assistant.

End-user queries can be a great source of training data. The Query resource not only enables you to log Queries but also keep track of whether a query was already reviewed and used as a Sample or not by updating the status and sample_sid fields.

Samples are not created automatically from Queries. You have to determine the task and tag the Sample with the Fields to create the Sample.

All Autopilot REST API resources use the following base URL:

https://autopilot.twilio.com/v1

Query properties

Names in PHP format
accountSid
sid<AC> Not PII

The SID of the Account that created the Query resource.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

results
オブジェクト Not PII

The natural language analysis results that include the Task recognized and a list of identified Fields.

language
文字列 Not PII

The ISO language-country string that specifies the language used by the Query. For example: en-US.

modelBuildSid
sid<UG> Not PII

The SID of the Model Build queried.

query
文字列 PII MTL: 30 DAYS

The end-user's natural language input.

sampleSid
sid<UF> Not PII

The SID of an optional reference to the Sample created from the query.

assistantSid
sid<UA> Not PII

The SID of the Assistant that is the parent of the resource.

sid
sid<UH> Not PII

The unique string that we created to identify the Query resource.

status
文字列 Not PII

The status of the Query. Can be: pending-review, reviewed, or discarded

url
url Not PII

The absolute URL of the Query resource.

sourceChannel
文字列 Not PII

The communication channel from where the end-user input came.

Create a Query resource

post
https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Queries

Creates a Query against the Model Build for the Assistant identified by {AssistantSid}.

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

The SID of the Assistant that is the parent of the new resource.

language
必須
post 文字列 Not PII

The ISO language-country string that specifies the language used for the new query. For example: en-US.

query
必須
post 文字列 PII MTL: 30 DAYS

The end-user's natural language input. It can be up to 2048 characters long.

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

The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task unique_name values. For example, task-unique_name-1, task-unique_name-2. Listing specific tasks is useful to constrain the paths that a user can take.

model_build
オプション
post sid_like<UG> Not PII

The SID or unique name of the Model Build to be queried.

例 1
        
        
        
        

        Fetch a Query resource

        GET
        https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Queries/{Sid}

        Returns the Query instance identified by {QuerySid}.

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

        The SID of the Assistant that is the parent of the resource to fetch.

        sid
        必須
        GET sid_like<UH> Not PII

        The Twilio-provided string that uniquely identifies the Query resource to fetch.

        例 1
              
              
              
              

              Read multiple Query resources

              GET
              https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Queries

              Returns a list of Queries for this Assistant. The list returned includes paging information.

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

              The SID of the Assistant that is the parent of the resources to read.

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

              The ISO language-country string that specifies the language used by the Query resources to read. For example: en-US.

              model_build
              オプション
              GET sid_like<UG> Not PII

              The SID or unique name of the Model Build to be queried.

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

              The status of the resources to read. Can be: pending-review, reviewed, or discarded

              例 1
                    
                    
                    
                    

                    Update a Query resource

                    post
                    https://autopilot.twilio.com/v1/Assistants/{AssistantSid}/Queries/{Sid}

                    Updates the Query identified by {QuerySid}.

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

                    The SID of the Assistant that is the parent of the resource to update.

                    sid
                    必須
                    post sid_like<UH> Not PII

                    The Twilio-provided string that uniquely identifies the Query resource to update.

                    sample_sid
                    オプション
                    post sid<UF> Not PII

                    The SID of an optional reference to the Sample created from the query.

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

                    The new status of the resource. Can be: pending-review, reviewed, or discarded

                    例 1
                          
                          
                          
                          

                          Delete a Query resource

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

                          The SID of the Assistant that is the parent of the resources to delete.

                          sid
                          必須
                          削除する sid_like<UH> Not PII

                          The Twilio-provided string that uniquely identifies the Query resource to delete.

                          例 1
                                
                                
                                
                                
                                Rate this page:

                                ヘルプが必要ですか?

                                誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。