ibm-watson
Version:
Client library to use the IBM Watson Services
771 lines • 219 kB
TypeScript
/**
* (C) Copyright IBM Corp. 2019, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="node" />
/// <reference types="node" />
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
import { BaseService, UserOptions } from 'ibm-cloud-sdk-core';
/**
* IBM Watson® Discovery is a cognitive search and content analytics engine that you can add to applications to
* identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and
* unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual
* filtering of results.
*
* API Version: 2.0
* See: https://cloud.ibm.com/docs/discovery-data
*/
declare class DiscoveryV2 extends BaseService {
static DEFAULT_SERVICE_URL: string;
static DEFAULT_SERVICE_NAME: string;
/** Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current
* version is `2023-03-31`.
*/
version: string;
/**
* Construct a DiscoveryV2 object.
*
* @param {Object} options - Options for the service.
* @param {string} options.version - Release date of the version of the API you want to use. Specify dates in
* YYYY-MM-DD format. The current version is `2023-03-31`.
* @param {string} [options.serviceUrl] - The base URL for the service
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
* @param {string} [options.serviceName] - The name of the service to configure
* @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service. Defaults to environment if not set
* @constructor
* @returns {DiscoveryV2}
*/
constructor(options: UserOptions);
/*************************
* projects
************************/
/**
* List projects.
*
* Lists existing projects for this instance.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListProjectsResponse>>}
*/
listProjects(params?: DiscoveryV2.ListProjectsParams): Promise<DiscoveryV2.Response<DiscoveryV2.ListProjectsResponse>>;
/**
* Create a project.
*
* Create a new project for this instance.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.name - The human readable name of this project.
* @param {string} params.type - The type of project.
*
* The `content_intelligence` type is a *Document Retrieval for Contracts* project and the `other` type is a *Custom*
* project.
*
* The `content_mining` and `content_intelligence` types are available with Premium plan managed deployments and
* installed deployments only.
*
* The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed instances only.
* @param {DefaultQueryParams} [params.defaultQueryParameters] - Default query parameters for this project.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>}
*/
createProject(params: DiscoveryV2.CreateProjectParams): Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>;
/**
* Get project.
*
* Get details on the specified project.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>}
*/
getProject(params: DiscoveryV2.GetProjectParams): Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>;
/**
* Update a project.
*
* Update the specified project's name.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} [params.name] - The new name to give this project.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>}
*/
updateProject(params: DiscoveryV2.UpdateProjectParams): Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>;
/**
* Delete a project.
*
* Deletes the specified project.
*
* **Important:** Deleting a project deletes everything that is part of the specified project, including all
* collections.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
*/
deleteProject(params: DiscoveryV2.DeleteProjectParams): Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>;
/**
* List fields.
*
* Gets a list of the unique fields (and their types) stored in the specified collections.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string[]} [params.collectionIds] - Comma separated list of the collection IDs. If this parameter is not
* specified, all collections in the project are used.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListFieldsResponse>>}
*/
listFields(params: DiscoveryV2.ListFieldsParams): Promise<DiscoveryV2.Response<DiscoveryV2.ListFieldsResponse>>;
/*************************
* collections
************************/
/**
* List collections.
*
* Lists existing collections for the specified project.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListCollectionsResponse>>}
*/
listCollections(params: DiscoveryV2.ListCollectionsParams): Promise<DiscoveryV2.Response<DiscoveryV2.ListCollectionsResponse>>;
/**
* Create a collection.
*
* Create a new collection in the specified project.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.name - The name of the collection.
* @param {string} [params.description] - A description of the collection.
* @param {string} [params.language] - The language of the collection. For a list of supported languages, see the
* [product documentation](/docs/discovery-data?topic=discovery-data-language-support).
* @param {boolean} [params.ocrEnabled] - If set to `true`, optical character recognition (OCR) is enabled. For more
* information, see [Optical character recognition](/docs/discovery-data?topic=discovery-data-collections#ocr).
* @param {CollectionEnrichment[]} [params.enrichments] - An array of enrichments that are applied to this collection.
* To get a list of enrichments that are available for a project, use the [List enrichments](#listenrichments) method.
*
* If no enrichments are specified when the collection is created, the default enrichments for the project type are
* applied. For more information about project default settings, see the [product
* documentation](/docs/discovery-data?topic=discovery-data-project-defaults).
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>}
*/
createCollection(params: DiscoveryV2.CreateCollectionParams): Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>;
/**
* Get collection details.
*
* Get details about the specified collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>}
*/
getCollection(params: DiscoveryV2.GetCollectionParams): Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>;
/**
* Update a collection.
*
* Updates the specified collection's name, description, enrichments, and configuration.
*
* If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the
* collection. To do so, from the *Manage fields* page in the product user interface, temporarily change the data type
* of a field to enable the reprocess button. Change the data type of the field back to its original value, and then
* click **Apply changes and reprocess**.
*
* To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion,
* specify an empty `json_normalizations` object (`[]`) in the request.
*
* To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an
* empty `normalizations` object (`[]`) in the request.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {string} [params.name] - The new name of the collection.
* @param {string} [params.description] - The new description of the collection.
* @param {boolean} [params.ocrEnabled] - If set to `true`, optical character recognition (OCR) is enabled. For more
* information, see [Optical character recognition](/docs/discovery-data?topic=discovery-data-collections#ocr).
* @param {CollectionEnrichment[]} [params.enrichments] - An array of enrichments that are applied to this collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>}
*/
updateCollection(params: DiscoveryV2.UpdateCollectionParams): Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>;
/**
* Delete a collection.
*
* Deletes the specified collection from the project. All documents stored in the specified collection and not shared
* is also deleted.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
*/
deleteCollection(params: DiscoveryV2.DeleteCollectionParams): Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>;
/*************************
* documents
************************/
/**
* List documents.
*
* Lists the documents in the specified collection. The list includes only the document ID of each document and
* returns information for up to 10,000 documents.
*
* **Note**: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances, and
* from IBM Cloud-managed instances.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {number} [params.count] - The maximum number of documents to return. Up to 1,000 documents are returned by
* default. The maximum number allowed is 10,000.
* @param {string} [params.status] - Filters the documents to include only documents with the specified ingestion
* status. The options include:
*
* * `available`: Ingestion is finished and the document is indexed.
*
* * `failed`: Ingestion is finished, but the document is not indexed because of an error.
*
* * `pending`: The document is uploaded, but the ingestion process is not started.
*
* * `processing`: Ingestion is in progress.
*
* You can specify one status value or add a comma-separated list of more than one status value. For example,
* `available,failed`.
* @param {boolean} [params.hasNotices] - If set to `true`, only documents that have notices, meaning documents for
* which warnings or errors were generated during the ingestion, are returned. If set to `false`, only documents that
* don't have notices are returned. If unspecified, no filter based on notices is applied.
*
* Notice details are not available in the result, but you can use the [Query collection
* notices](#querycollectionnotices) method to find details by adding the parameter
* `query=notices.document_id:{document-id}`.
* @param {boolean} [params.isParent] - If set to `true`, only parent documents, meaning documents that were split
* during the ingestion process and resulted in two or more child documents, are returned. If set to `false`, only
* child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.
*
* CSV files, for example, are split into separate documents per line and JSON files are split into separate documents
* per object.
* @param {string} [params.parentDocumentId] - Filters the documents to include only child documents that were
* generated when the specified parent document was processed.
* @param {string} [params.sha256] - Filters the documents to include only documents with the specified SHA-256 hash.
* Format the hash as a hexadecimal string.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListDocumentsResponse>>}
*/
listDocuments(params: DiscoveryV2.ListDocumentsParams): Promise<DiscoveryV2.Response<DiscoveryV2.ListDocumentsResponse>>;
/**
* Add a document.
*
* Add a document to a collection with optional metadata.
*
* Returns immediately after the system has accepted the document for processing.
*
* Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.
*
* * For a list of supported file types, see the [product
* documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
*
* * You must provide document content, metadata, or both. If the request is missing both document content and
* metadata, it is rejected.
*
* * You can set the **Content-Type** parameter on the **file** part to indicate the media type of the document. If
* the **Content-Type** parameter is missing or is one of the generic media types (for example,
* `application/octet-stream`), then the service attempts to automatically detect the document's media type.
*
* * If the document is uploaded to a collection that shares its data with another collection, the
* **X-Watson-Discovery-Force** header must be set to `true`.
*
* * In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint
* (`/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}`). If a document already exists
* with the specified ID, it is replaced.
*
* For more information about how certain file types and field names are handled when a file is added to a collection,
* see the [product documentation](/docs/discovery-data?topic=discovery-data-index-overview#field-name-limits).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {NodeJS.ReadableStream | Buffer} [params.file] - **Add a document**: The content of the document to ingest.
* For the supported file types and maximum supported file size limits when adding a document, see [the
* documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
*
* **Analyze a document**: The content of the document to analyze but not ingest. Only the `application/json` content
* type is supported by the Analyze API. For maximum supported file size limits, see [the product
* documentation](/docs/discovery-data?topic=discovery-data-analyzeapi#analyzeapi-limits).
* @param {string} [params.filename] - The filename for file.
* @param {string} [params.fileContentType] - The content type of file.
* @param {string} [params.metadata] - Add information about the file that you want to include in the response.
*
* The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
*
* Example:
*
* ```
* {
* "filename": "favorites2.json",
* "file_type": "json"
* }.
* @param {boolean} [params.xWatsonDiscoveryForce] - When `true`, the uploaded document is added to the collection
* even if the data for that collection is shared with other collections.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentAccepted>>}
*/
addDocument(params: DiscoveryV2.AddDocumentParams): Promise<DiscoveryV2.Response<DiscoveryV2.DocumentAccepted>>;
/**
* Get document details.
*
* Get details about a specific document, whether the document is added by uploading a file or by crawling an external
* data source.
*
* **Note**: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances, and
* from IBM Cloud-managed instances.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {string} params.documentId - The ID of the document.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentDetails>>}
*/
getDocument(params: DiscoveryV2.GetDocumentParams): Promise<DiscoveryV2.Response<DiscoveryV2.DocumentDetails>>;
/**
* Update a document.
*
* Replace an existing document or add a document with a specified document ID. Starts ingesting a document with
* optional metadata.
*
* Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.
*
* If the document is uploaded to a collection that shares its data with another collection, the
* **X-Watson-Discovery-Force** header must be set to `true`.
*
* **Notes:**
*
* * Uploading a new document with this method automatically replaces any existing document stored with the same
* document ID.
*
* * If an uploaded document is split into child documents during ingestion, all existing child documents are
* overwritten, even if the updated version of the document has fewer child documents.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {string} params.documentId - The ID of the document.
* @param {NodeJS.ReadableStream | Buffer} [params.file] - **Add a document**: The content of the document to ingest.
* For the supported file types and maximum supported file size limits when adding a document, see [the
* documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
*
* **Analyze a document**: The content of the document to analyze but not ingest. Only the `application/json` content
* type is supported by the Analyze API. For maximum supported file size limits, see [the product
* documentation](/docs/discovery-data?topic=discovery-data-analyzeapi#analyzeapi-limits).
* @param {string} [params.filename] - The filename for file.
* @param {string} [params.fileContentType] - The content type of file.
* @param {string} [params.metadata] - Add information about the file that you want to include in the response.
*
* The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
*
* Example:
*
* ```
* {
* "filename": "favorites2.json",
* "file_type": "json"
* }.
* @param {boolean} [params.xWatsonDiscoveryForce] - When `true`, the uploaded document is added to the collection
* even if the data for that collection is shared with other collections.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentAccepted>>}
*/
updateDocument(params: DiscoveryV2.UpdateDocumentParams): Promise<DiscoveryV2.Response<DiscoveryV2.DocumentAccepted>>;
/**
* Delete a document.
*
* Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the
* collection permanently. If you delete a document that was added by crawling an external data source, the document
* will be added again with the next scheduled crawl of the data source. The delete function removes the document from
* the collection, not from the external data source.
*
* **Note:** Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete
* a subdocument, and then repeat the action that created it, the deleted document is added back in to your
* collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead.
* You can get the document ID of the original document from the `parent_document_id` of the subdocument result.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {string} params.documentId - The ID of the document.
* @param {boolean} [params.xWatsonDiscoveryForce] - When `true`, the uploaded document is added to the collection
* even if the data for that collection is shared with other collections.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DeleteDocumentResponse>>}
*/
deleteDocument(params: DiscoveryV2.DeleteDocumentParams): Promise<DiscoveryV2.Response<DiscoveryV2.DeleteDocumentResponse>>;
/*************************
* queries
************************/
/**
* Query a project.
*
* Search your data by submitting queries that are written in natural language or formatted in the Discovery Query
* Language. For more information, see the [Discovery
* documentation](/docs/discovery-data?topic=discovery-data-query-concepts). The default query parameters differ by
* project type. For more information about the project default settings, see the [Discovery
* documentation](/docs/discovery-data?topic=discovery-data-query-defaults). See [the Projects API
* documentation](#create-project) for details about how to set custom default query settings.
*
* The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000
* characters in English.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string[]} [params.collectionIds] - A comma-separated list of collection IDs to be queried against.
* @param {string} [params.filter] - Searches for documents that match the Discovery Query Language criteria that is
* specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by
* relevance. When used with the **aggregation**, **query**, or **natural_language_query** parameters, the **filter**
* parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.
* @param {string} [params.query] - A query search that is written in the Discovery Query Language and returns all
* matching documents in your data set with full enrichments and full text, and with the most relevant documents
* listed first. Use a query search when you want to find the most relevant search results. You can use this parameter
* or the **natural_language_query** parameter to specify the query input, but not both.
* @param {string} [params.naturalLanguageQuery] - A natural language query that returns relevant documents by using
* training data and natural language understanding. You can use this parameter or the **query** parameter to specify
* the query input, but not both. To filter the results based on criteria you specify, include the **filter**
* parameter in the request.
* @param {string} [params.aggregation] - An aggregation search that returns an exact answer by combining query search
* with filters. Useful for applications to build lists, tables, and time series. For more information about the
* supported types of aggregations, see the [Discovery
* documentation](/docs/discovery-data?topic=discovery-data-query-aggregations).
* @param {number} [params.count] - Number of results to return.
* @param {string[]} [params._return] - A list of the fields in the document hierarchy to return. You can specify both
* root-level (`text`) and nested (`extracted_metadata.filename`) fields. If this parameter is an empty list, then all
* fields are returned.
* @param {number} [params.offset] - The number of query results to skip at the beginning. Consider that the `count`
* is set to 10 (the default value) and the total number of results that are returned is 100. In this case, the
* following examples show the returned results for different `offset` values:
*
* * If `offset` is set to 95, it returns the last 5 results.
*
* * If `offset` is set to 10, it returns the second batch of 10 results.
*
* * If `offset` is set to 100 or more, it returns empty results.
* @param {string} [params.sort] - A comma-separated list of fields in the document to sort on. You can optionally
* specify a sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the
* default sort direction if no prefix is specified.
* @param {boolean} [params.highlight] - When `true`, a highlight field is returned for each result that contains
* fields that match the query. The matching query terms are emphasized with surrounding `<em></em>` tags. This
* parameter is ignored if **passages.enabled** and **passages.per_document** are `true`, in which case passages are
* returned for each document instead of highlights.
* @param {boolean} [params.spellingSuggestions] - When `true` and the **natural_language_query** parameter is used,
* the **natural_language_query** parameter is spell checked. The most likely correction is returned in the
* **suggested_query** field of the response (if one exists).
* @param {QueryLargeTableResults} [params.tableResults] - Configuration for table retrieval.
* @param {QueryLargeSuggestedRefinements} [params.suggestedRefinements] - Configuration for suggested refinements.
*
* **Note**: The **suggested_refinements** parameter that identified dynamic facets from the data is deprecated.
* @param {QueryLargePassages} [params.passages] - Configuration for passage retrieval.
* @param {QueryLargeSimilar} [params.similar] - Finds results from documents that are similar to documents of
* interest. Use this parameter to add a *More like these* function to your search. You can include this parameter
* with or without a **query**, **filter** or **natural_language_query** parameter.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.QueryResponse>>}
*/
query(params: DiscoveryV2.QueryParams): Promise<DiscoveryV2.Response<DiscoveryV2.QueryResponse>>;
/**
* Get Autocomplete Suggestions.
*
* Returns completion query suggestions for the specified prefix.
*
* Suggested words are based on terms from the project documents. Suggestions are not based on terms from the
* project's search history, and the project does not learn from previous user choices.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.prefix - The prefix to use for autocompletion. For example, the prefix `Ho` could
* autocomplete to `hot`, `housing`, or `how`.
* @param {string[]} [params.collectionIds] - Comma separated list of the collection IDs. If this parameter is not
* specified, all collections in the project are used.
* @param {string} [params.field] - The field in the result documents that autocompletion suggestions are identified
* from.
* @param {number} [params.count] - The number of autocompletion suggestions to return.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Completions>>}
*/
getAutocompletion(params: DiscoveryV2.GetAutocompletionParams): Promise<DiscoveryV2.Response<DiscoveryV2.Completions>>;
/**
* Query collection notices.
*
* Finds collection-level notices (errors and warnings) that are generated when documents are ingested.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {string} [params.filter] - Searches for documents that match the Discovery Query Language criteria that is
* specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by
* relevance. When used with the `aggregation`, `query`, or `natural_language_query` parameters, the `filter`
* parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.
* @param {string} [params.query] - A query search that is written in the Discovery Query Language and returns all
* matching documents in your data set with full enrichments and full text, and with the most relevant documents
* listed first. You can use this parameter or the **natural_language_query** parameter to specify the query input,
* but not both.
* @param {string} [params.naturalLanguageQuery] - A natural language query that returns relevant documents by using
* natural language understanding. You can use this parameter or the **query** parameter to specify the query input,
* but not both. To filter the results based on criteria you specify, include the **filter** parameter in the request.
* @param {number} [params.count] - Number of results to return. The maximum for the **count** and **offset** values
* together in any one query is **10,000**.
* @param {number} [params.offset] - The number of query results to skip at the beginning. For example, if the total
* number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the
* **count** and **offset** values together in any one query is **10000**.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.QueryNoticesResponse>>}
*/
queryCollectionNotices(params: DiscoveryV2.QueryCollectionNoticesParams): Promise<DiscoveryV2.Response<DiscoveryV2.QueryNoticesResponse>>;
/**
* Query project notices.
*
* Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy
* training.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} [params.filter] - Searches for documents that match the Discovery Query Language criteria that is
* specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by
* relevance. When used with the `aggregation`, `query`, or `natural_language_query` parameters, the `filter`
* parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.
* @param {string} [params.query] - A query search that is written in the Discovery Query Language and returns all
* matching documents in your data set with full enrichments and full text, and with the most relevant documents
* listed first. You can use this parameter or the **natural_language_query** parameter to specify the query input,
* but not both.
* @param {string} [params.naturalLanguageQuery] - A natural language query that returns relevant documents by using
* natural language understanding. You can use this parameter or the **query** parameter to specify the query input,
* but not both. To filter the results based on criteria you specify, include the **filter** parameter in the request.
* @param {number} [params.count] - Number of results to return. The maximum for the **count** and **offset** values
* together in any one query is **10,000**.
* @param {number} [params.offset] - The number of query results to skip at the beginning. For example, if the total
* number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the
* **count** and **offset** values together in any one query is **10000**.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.QueryNoticesResponse>>}
*/
queryNotices(params: DiscoveryV2.QueryNoticesParams): Promise<DiscoveryV2.Response<DiscoveryV2.QueryNoticesResponse>>;
/*************************
* queryModifications
************************/
/**
* Get a custom stop words list.
*
* Returns the custom stop words list that is used by the collection. For information about the default stop words
* lists that are applied to queries, see [the product
* documentation](/docs/discovery-data?topic=discovery-data-stopwords).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.StopWordList>>}
*/
getStopwordList(params: DiscoveryV2.GetStopwordListParams): Promise<DiscoveryV2.Response<DiscoveryV2.StopWordList>>;
/**
* Create a custom stop words list.
*
* Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a
* query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot
* contain more than 1 million characters.
*
* A default stop words list is used by all collections. The default list is applied both at indexing time and at
* query time. A custom stop words list that you add is used at query time only.
*
* The custom stop words list augments the default stop words list; you cannot remove stop words. For information
* about the default stop words lists per language, see [the product
* documentation](/docs/discovery-data?topic=discovery-data-stopwords).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {string[]} [params.stopwords] - List of stop words.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.StopWordList>>}
*/
createStopwordList(params: DiscoveryV2.CreateStopwordListParams): Promise<DiscoveryV2.Response<DiscoveryV2.StopWordList>>;
/**
* Delete a custom stop words list.
*
* Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list
* is deleted, the default stop words list is used.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
*/
deleteStopwordList(params: DiscoveryV2.DeleteStopwordListParams): Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>;
/**
* Get the expansion list.
*
* Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty
* expansions array is returned.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Expansions>>}
*/
listExpansions(params: DiscoveryV2.ListExpansionsParams): Promise<DiscoveryV2.Response<DiscoveryV2.Expansions>>;
/**
* Create or update an expansion list.
*
* Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for
* key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the
* scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {Expansion[]} params.expansions - An array of query expansion definitions.
*
* Each object in the **expansions** array represents a term or set of terms that will be expanded into other terms.
* Each expansion object can be configured as `bidirectional` or `unidirectional`.
*
* * **Bidirectional**: Each entry in the `expanded_terms` list expands to include all expanded terms. For example, a
* query for `ibm` expands to `ibm OR international business machines OR big blue`.
*
* * **Unidirectional**: The terms in `input_terms` in the query are replaced by the terms in `expanded_terms`. For
* example, a query for the often misused term `on premise` is converted to `on premises OR on-premises` and does not
* contain the original term. If you want an input term to be included in the query, then repeat the input term in the
* expanded terms list.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Expansions>>}
*/
createExpansions(params: DiscoveryV2.CreateExpansionsParams): Promise<DiscoveryV2.Response<DiscoveryV2.Expansions>>;
/**
* Delete the expansion list.
*
* Removes the expansion information for this collection. To disable query expansion for a collection, delete the
* expansion list.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
*/
deleteExpansions(params: DiscoveryV2.DeleteExpansionsParams): Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>;
/*************************
* componentSettings
************************/
/**
* List component settings.
*
* Returns default configuration settings for components.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ComponentSettingsResponse>>}
*/
getComponentSettings(params: DiscoveryV2.GetComponentSettingsParams): Promise<DiscoveryV2.Response<DiscoveryV2.ComponentSettingsResponse>>;
/*************************
* trainingData
************************/
/**
* List training queries.
*
* List the training queries for the specified project.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuerySet>>}
*/
listTrainingQueries(params: DiscoveryV2.ListTrainingQueriesParams): Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuerySet>>;
/**
* Delete training queries.
*
* Removes all training queries for the specified project.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
*/
deleteTrainingQueries(params: DiscoveryV2.DeleteTrainingQueriesParams): Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>;
/**
* Create a training query.
*
* Add a query to the training data for this project. The query can contain a filter and natural language query.
*
* **Note**: You cannot apply relevancy training to a `content_mining` project type.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.naturalLanguageQuery - The natural text query that is used as the training query.
* @param {TrainingExample[]} params.examples - Array of training examples.
* @param {string} [params.filter] - The filter used on the collection before the **natural_language_query** is
* applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top
* 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries
* that are submitted at runtime for optimal ranking results.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuery>>}
*/
createTrainingQuery(params: DiscoveryV2.CreateTrainingQueryParams): Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuery>>;
/**
* Get a training data query.
*
* Get details for a specific training data query, including the query string and all examples.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
* found from the *Integrate and Deploy* page in Discovery.
* @param {string} params.queryId - The ID of the query used for training.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuery>>}
*/
getTrainingQuery(params: DiscoveryV