メニュー

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 unique ID of the Account that created this Query.

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

results
オブジェクト Not PII

The natural language analysis results which include the Task recognized, the confidence score, and a list of identified Fields.

language
文字列 Not PII

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

modelBuildSid
sid<UG> Not PII

The unique ID of the Model Build queried.

query
文字列 PII MTL: 30 DAYS

The end-user's natural language input.

sampleSid
sid<UF> Not PII

An optional reference to the Sample created from this query.

assistantSid
sid<UA> Not PII

The unique ID of the parent Assistant.

sid
sid<UH> Not PII

A 34-character string that uniquely identifies this resource.

status
文字列 Not PII

A string that describes the query status. The values can be: pending_review, reviewed, discarded

url
url Not PII

sourceChannel
文字列 Not PII

The communication channel where this end-user input came from

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 unique ID of the parent Assistant.

language
必須
post 文字列 Not PII

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

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

A user-provided string that uniquely identifies this resource as an alternative to the sid. It can be up to 2048 characters long.

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

Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated task-unique-name-1, task-unique-name-2

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 unique ID of the Assistant.

        sid
        必須
        GET sid_like<UH> Not PII

        A 34-character string that uniquely identifies this resource.

        例 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 unique ID of the parent Assistant.

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

              An ISO language-country string that specifies the language used for this query. 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

              A string that described the query status. The values can be: pending_review, reviewed, 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 unique ID of the parent Assistant.

                    sid
                    必須
                    post sid_like<UH> Not PII

                    A 34-character string that uniquely identifies this resource.

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

                    An optional reference to the Sample created from this query.

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

                    A string that described the query status. The values can be: pending_review, reviewed, 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 unique ID of the Assistant.

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

                          A 34-character string that uniquely identifies this resource.

                          例 1
                                
                                
                                
                                
                                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.