vania-janet/multiturn-rag-retrieval-data huggingface dataset:
"description": "string"
},
{
"name": "resource-name",
"value": "<RESOURCE_NAME>",
"description": "string"
}
]
}]

Example

[{
"query_type": "workspaces",
"query_condition":
{
"name": "workspace-id",
"value": "us-east.workspace.ID1231",
"description": "string"
},
{
"name": "resource-name",
"value": "tf00vpc-pubpriv-frontend-vsi",
"description": "string"
}
]
}]

ibmcloud schematics resource-query create --name myquery --type vsi --query-file queries.json





 Using the interactive mode 

Instead of entering your resource query details by using the command options or a payload file, you can use the interactive mode for the command. This mode prompts you to enter the required values to create a resource query in Schematics. You can create resource conditions by using [resource queries](https://cloud.ibm.com/docs/schematics?topic=schematics-inventories-setupsupported-queries).



1. Enter the command to create the resource query without any command options.

ibmcloud schematics resource-query create
2. Enter a name for your resource query and press the return key.
3. Enter the path to your payload file. For a sample payload file, see [Using the payload file](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referencerq-create-payload). Then, press the return key.
4. Review the details of the resource query that was created for you.









 ibmcloud schematics resource query delete
Context variable A variable that you can use to collect information during a conversation, and reference it later in the same conversation. For example, you might want to ask for the customer's name and then address the person by name later on. A context variable is used by the dialog skill. [Learn more](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-runtime-contextdialog-runtime-context-variables). 
 Dialog The component where you build the conversation that your assistant has with your customers. For each defined intent, you can author the response your assistant should return. [Learn more](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview). 
 Digression A feature that gives the user the power to direct the conversation. It prevents customers from getting stuck in a dialog thread; they can switch topics whenever they choose. [Learn more](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-runtimedialog-runtime-digressions). 
 Disambiguation A feature that enables the assistant to ask customers to clarify their meaning when the assistant isn't sure what a user wants to do next. [Learn more](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-runtimedialog-runtime-disambiguation). 
 Entity Information in the user input that is related to the user's purpose. An intent represents the action a user wants to do. An entity represents the object of that action. [Learn more](https://cloud.ibm.com/docs/assistant?topic=assistant-entities). 
 Integrations Ways you can deploy your assistant to existing platforms or social media channels. [Learn more](https://cloud.ibm.com/docs/assistant?topic=assistant-deploy-integration-add). 
 Intent The goal that is expressed in the user input, such as answering a question or processing a bill payment.
You can increase the maximum number of passages to return per document by specifying a higher number in the passages.max_per_document parameter.<-- </section "id="section-passages_max-per-doc" "> --><-- </section "id="section-passages" "> --><-- <section "id="section-similar" "> --> similar Finds documents that are similar to documents that you identify as being of interest to you. To find similar documents, Discovery identifies the 25 most relevant terms from the original document and then searches for documents with similar relevant terms.If similar.enabled is true, you must specify the similar.document_ids field to include a comma-separated list of the documents of interest.In installed deployments, support for this parameter was added with the 4.6.0 release.<-- </section "id="section-similar" "> --><-- <section "id="section-table_retrieval" "> --> table retrieval If Table understanding]] is enabled in your collection, a natural_language_query finds tables with content or context that match a search query.Example query: curl -H "Authorization: Bearer {token}" 'https://{hostname}/{instance_name}/v2/projects/{project_id}/collections/{collection_id}/query?version=2019-11-29&natural_language_query=interest%20appraised&table_results=true'
The JSON that is returned from the query has the following format: {
"matching_results": 1,
"session_token": "1_FDjAVkn9SW6oH9y5_9Ek3KsNFG",
"results":
{}
]
{
"table_results":
{
"table_id": "e883d3df1d45251121cd3d5aef86e4edc9658b21",
"source_document_id": "c774c3df0c90255191cc0d4bb8b5e8edc6638d96",
This failure rarely happens with the Google custom search extension, but it might happen if you are searching a site with large volumes of metadata that is returned by Google custom search. If you think that this might be a problem, try running the query in an API testing tool like curl, [Insomnia](https://insomnia.rest/), or [Postman](https://www.postman.com/). Check how many bytes of data you are getting as search results. If the total is at or near 100 kb, you might be able to work around the issue by reducing num_of_results and getting fewer results for each query or by excluding sites or pages with large volumes of metadata.

For more information, see [Limit on Size of Search Results](https://github.com/watson-developer-cloud/assistant-toolkit/blob/master/integrations/extensions/starter-kits/watson-discovery/README.mdlimit-on-size-of-search-results) in a starter kit for IBM Watson® Discovery.
When false, the results are sorted by the highest number of matching_results.<-- </section "id="section-group_by-syntax" "> --><-- <section "id="section-group_by-example" "> --> Example The following request looks for documents that mention the term engine, and groups them by car manufacturing year. The documents are sorted into 3 groups, one group of traffic incident reports involving cars that were manufactured before 2000, one group for cars manufactured in 2000, and one group for cars manufactured after 2000. {
"query":"engine",
"aggregation": "group_by(condition:(YEARTXT<2000),(YEARTXT=2000),(YEARTXT>2000)] ,relevancy:true)"
}
The results might look like this: {
"type": "group_by",
"results":
{
"key": "YEARTXT<2000",
"matching_results": 2034,
"relevancy": 1.0,
"total_matching_documents": 2034,
"estimated_matching_results": 2034
},
{
"key": "YEARTXT=2000",
"matching_results": 1738,
"relevancy": 1.0,
"total_matching_documents": 1738,
"estimated_matching_results": 1738
},
{
"key": "YEARTXT>2000",
"matching_results": 32708,
"relevancy": 1.0,
"total_matching_documents": 32708,
"estimated_matching_results": 32708
}
] ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
}
Show more
In that case, Discovery stays within the limit of twice the passages.characters parameter, so the passages that are returned might not include the entire sentence and can omit the beginning, end, or both.Since sentence boundary adjustments expand passage size, the average passage length can increase. If your application has limited screen space, you might want to set a smaller value for passages.characters or truncate the passages that are returned by Discovery. Sentence boundary detection works for all supported languages and uses language-specific logic.Passages are grouped with each document result and are ordered by passage relevance. Including passage retrieval in queries increases the response time because it takes more time to score the passages.You can adjust the fields in the documents for passage retrieval to search with the passages.fields]passages.fields] parameter.The passages parameter returns matching passages (passage_text), and the score, document_id, the name of the field that the passage was extracted from (field), and the starting and ending characters of the passage text within the field (start_offset and end_offset), as shown in the following example. curl -H "Authorization: Bearer {token}" 'https://{hostname}/{instance_name}/v2/projects/{project_id}/collections/{collection_id}/query?version=2019-11-29&natural_language_query=Hybrid%20cloud%20companies&passages=true&passages.per_document=false'
The JSON that is returned from the query has the following format: {
"matching_results":2,
"passages":
{
"document_id":"ab7be56bcc9476493516b511169739f0",
"passage_score":15.230205287402338,
"passage_text":"a privately held company that provides hybrid cloud recovery, cloud migration and business continuity software for enterprise data centers and cloud infrastructure.",
"start_offset":120,
"end_offset":300,
"field":"text"
},
{
Error: Training data quality standards not met: Training examples have no relevance label variety for X queries. 



* One of the requirements for training is to have sufficient label diversity, meaning that if you want to get a well-trained system, it is recommended that you not only add documents that are the best relevance match, but also documents that are “good” relevant documents. In other words, if you have a scale of 0-4, it helps to have documents rated as 2's and 3's, in addition to those rated as 4's. If you are using the Discovery tooling, documents are rated either Relevant (10) or Not relevant (0). At least 25% of the questions must have some label variety.
The number of rows that are returned can be changed by using the [limit parameter](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-cloudant-searchquery-parameters-search).

If the search query does not specify the "group_field" argument, the response includes a bookmark. If this bookmark is later provided as a URL parameter, the response skips the rows that were seen already, making it quick and easy to get the next set of results.

The response never includes a bookmark if the ["group_field" parameter](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-cloudant-searchquery-parameters-search) is included in the search query.

The group_field, group_limit, and group_sort options are only available when you make global queries.

The following characters require escaping if you want to search on them:

+ - && || ! ( ) { } [ ] ^ " * ? : /

To escape one of these characters, use a preceding backslash character ().

The response to a search query includes an order field for each of the results. The order field is an array where the first element is the field or fields that are specified in the sort parameter. If no [sort parameter](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-cloudant-searchquery-parameters-search) is included in the query, then the order field contains the [Lucene relevance score](https://lucene.apache.org/core/3_6_0/scoring.html). If you use the sort by distance feature as described in [Geographical searches](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-cloudant-searchgeographical-searches), then the first element is the distance from a point. The distance is measured by using either kilometers or miles.

The second element in the order array can be ignored. It is used for troubleshooting purposes only.





 Faceting
For more information about splitting documents, see [Split documents to make query results more succinct](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-split-documents).





 Step 8: Test the project again 

Let's find out whether we improved the search function by adding a user-trained SDU model for the document. To do so, let's retest the project.



1. From the navigation panel, click Improve and customize to open the Improve and customize page.
2. First, to make sure that we didn't degrade the quality of the search, let's ask one of the questions that returned a good response when we tested earlier.

In the Search field, enter What is the purpose of Rule 15c3-5?

Zoom

![Shows a query that is being entered into the Improve and customize page.](https://cloud.ibm.com/docs-content/v1/content/f16b1f78a92498247223b337bd9303c2758b9ba8/discovery-data/images/tut-sdu-retest-query.png)

Figure 25. Query added to the Improve and customize page

Multiple responses are returned this time. The following response contains the exact answer to the question without any extraneous text:

In November 2011, the SEC implemented the final provision of Rule 15c3-5 curbing unfiltered market access. The provision mandated that brokers verify their clients’ order flow for compliance with credit and capital thresholds before routing to market centers.

Zoom

![Shows that multiple responses are returned for the query.](https://cloud.ibm.com/docs-content/v1/content/f16b1f78a92498247223b337bd9303c2758b9ba8/discovery-data/images/tut-sdu-rule-response.png)

Figure 26. Multiple responses are returned for the query
Check your progress to see when enough rating information is available to meet the training threshold needs. Your progress is broken into the following tasks:



* Add more queries
* Rate more results
* Add more variety to your ratings



You must evaluate at least 50 unique queries, maybe more, depending on the complexity of your data. You cannot add more than 10,000 training queries.
8. You can continue adding queries and rating results after you reach the threshold. Enter all of the queries that you think your users will ask.

To delete a training query, click the Delete icon. To delete all of the training queries in your collection at one time, use the API. For more information, see [Delete training queries](https://cloud.ibm.com/apidocs/discovery-datadeletetrainingqueries).



If two or more users attempt to train identical queries at the same time, the ratings that are submitted by one of the users overwrites the others.





 Testing and iterating on the relevancy of results 

When you are done rating results, and training is completed, test to see whether your query results are better. To do so, run test natural language queries that are related (but not identical) to your training queries. Review the results.

If you want to continue to improve the results after testing, you can:



* Add more documents to your collection.
* Add more training queries.
* Rate more results, making sure to use both the Relevant and Not relevant ratings.







 Confidence scores 

Discovery returns a confidence score for natural language queries of trained collections. This confidence score is not interchangeable with confidence scores that are returned by untrained collections.

The confidence score can range from 0.0 to 1.0. The higher the number, the more relevant the result.

The confidence score can be found in the query results, under the result_metadata for each document. This number is calculated based on how relevant the result is estimated to be, compared to the trained model.

{
"matching_results": 4,
"retrieval_details": {
: [Resolved](https://cloud.ibm.com/docs/discovery?topic=discovery-release-notesdiscovery-30june2017)

Improved tooling error log : The Tooling error log is no longer limited to a maximum of eight (8) pages of results. The error log still displays the document ID if the document name is not available.

Update to configuration names : Configuration names are limited to 50 characters and must consist of the characters [a-zA-Z0-9-_].

Improved availability of 'passages' parameter : The passages parameter previously available only through the API is now available through the Tooling as well as the API.





 25 April 2017 

New training data functionality : Use training data to improve the accuracy of your query results. When you provide a Discovery instance with training data, the service uses advanced Watson algorithms to determine the most relevant results. As you add more training data, the service instance becomes more accurate and sophisticated in the results it returns. See [Improving the relevance of your query results](https://cloud.ibm.com/docs/discovery?topic=discovery-improving-result-relevance-with-the-api) and the [API Reference](https://cloud.ibm.com/apidocs/discoverylist-training-data) for information.

New beta support for 'natural_language_query' parameter : The API now supports the natural_language_query parameter as a beta release. This parameter enables you to specify a query in natural language instead of in the Discovery service's query language. See the [Query your collection](https://cloud.ibm.com/apidocs/discoveryquery-your-collection) method in the API reference for information.





 14 April 2017 

New enhancements to query API : Enhancements are now available for the query API (GET /v1/environments/{environment_id}/collections/{collection_id}/query). See the [Query your collection](https://cloud.ibm.com/apidocs/discoveryquery-your-collection) method in the API reference for information.

New support for 'passages' parameter in the query API : The query API now supports the passages parameter.
If you have more queries than the minimum and are still receiving this error message, check your notices for other errors.





 Error: Training data quality standards not met: No documents found with non-zero relevance labels. 

Training data needs enough labeled data that specifies what documents are high value. Therefore, you need to rate some documents with nonzero values. You need to rate some documents as Relevant and some as Not relevant. At least one document must be rated Relevant.





 Error: Training data quality standards not met: Training examples have no relevance label variety for X queries. 

One of the requirements for training is to have sufficient label diversity. At least 25% of the training queries must include both Relevant and Not relevant labels. If you use the API, at least 25% of the queries must include two different numeric labels.
Relevancy training tips 

Answers to common questions about training a collection and explanations of common error and warning messages. For more information about improving the relevancy of natural language queries, see [Improving result relevance with the tooling](https://cloud.ibm.com/docs/discovery?topic=discovery-improving-result-relevance-with-the-tooling) and [Improving result relevance with the API](https://cloud.ibm.com/docs/discovery?topic=discovery-improving-result-relevance-with-the-api).



 Understanding training 

Answers to common questions about training a collection.



 How do I know if my system is trained? 

Use the [List collection details](https://cloud.ibm.com/apidocs/discoveryget-collection-details) API method to verify that your system is trained.

curl -u "apikey":"{apikey_value}" {url}/v1/environments/{environment_id}/collections/{collection_id}?version=2019-04-30"

Example response:

{
"training_status": {
"data_updated": "2017-02-10T14:18:22.786Z",
"total_examples": 54,
"sufficient_label_diversity": false,
"processing": false,
"minimum_examples_added": true,
"successfully_trained": "2017-02-08T14:18:22.786Z",
"available": true,
"notices": 13,
"minimum_queries_added": true
}
}

To satisfy the requirements for training, the following must all be true:



* minimum_queries_added
* minimum_examples_added
* sufficient_label_diversity



In the response:



* successfully_trained is the last time training was successfully completed. 
* available: true indicates that training occurred and a model is available.
* processing: true indicates that training is in progress.
passages.fields ["text", "title"] ["text", "title"] 
 passages.find_answers false false 
 passages.max_answers_per_passage 1 1 
 passages.max_per_document 1 1 
 passages.per_document true true 
 return [] [] 
 spelling_suggestions false true 
 sort "" "" 
 table_results.count 10 10 
 table_results.enabled false true 
 table_results.per_document 0 0 







 Default query settings continued 



Default query settings continued

 Query default Conversational Search Content Mining Custom 

 aggregation [ ] [ ] [ ] 
 count 10 10 10 
 highlight false false false 
 passages.characters 200 200 200 
 passages.count 10 10 10 
 passages.enabled true false true 
 passages.fields ["text", "title"] ["text", "title"] ["text", "title"] 
 passages.find_answers false false false 
 passages.max_answers_per_passage 1 1 1 
 passages.max_per_document 1 1 1 
 passages.per_document true true true 
 return [] [] [] 
 spelling_suggestions false true true 
 sort "" "" "" 
 table_results.count 10 10 10 
 table_results.enabled false false false 
 table_results.per_document 0 0 0 







 Project component settings 



Project component settings

 Default Document Retrieval Document Retrieval for Contracts 

 Aggregations See [table](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-defaultsaggregations-dr) See [table](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-defaultsaggregations-dr-contracts) 
 autocomplete true true 
 fields_shown.body.field "" "" 
 fields_shown.body.use_passage true true 
 fields_shown.title.field "title" "title" 
 results_per_page 5 5 
 structured_search false false 







 Project component settings continued 

The Custom project type has no project component default settings.



Project component settings continued
* Be sure to test your dialog as you build it. For more information, see [Testing the dialog](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-tasks).
* For more information about ways to address common use cases, see [Dialog building tips](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-tips).
* For more information about the expression language that you can use to improve your dialog, such as methods that reformat dates or text, see [Expression language methods](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-methods).



Previous topic:[Planning the dialog](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-plan)

Next topic:[Personalizing the dialog with context](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-dialog-runtime-context)
You can filter messages by Search user statements, Intents, Entities, and Last n days.

Search user statements - Type a word in the search bar. This searches the users' inputs, but not your assistant's replies.

Intents - Select the drop-down menu and type an intent in the input field, or choose from the populated list. You can select more than one intent, which filters the results using any of the selected intents, including Irrelevant.

![Intents drop-down menu](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/intents_filter.png)

Entities - Select the drop-down menu and type an entity name in the input field, or choose from the populated list. You can select more than one entity, which filters the results by any of the selected entities. If you filter by intent and entity, your results will include the messages that have both values. You can also filter for results with No entities found.

![Entities drop-down menu](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/entities_filter.png)

Messages might take some time to update. Allow at least 30 minutes after a user's interaction with your assistant before attempting to filter for that content.





 Viewing individual messages 

For any user input entry, click Open conversation to see the user input and the response made to it by the assistant within the context of the full conversation.

The time that is shown for each conversation is localized to reflect the time zone of your browser. This time might differ from the timestamp shown if you review the same conversation log via an API call; API log calls are always shown in UTC.

!