/** * This file was auto-generated by Fern from our API Definition. */ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vectara from "../../../index"; export declare namespace Corpora { interface Options { environment?: core.Supplier; token?: core.Supplier; /** Override the x-api-key header */ apiKey?: core.Supplier; fetcher?: core.FetchFunction; } interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Override the x-api-key header */ apiKey?: string | undefined; /** Additional headers to include in the request. */ headers?: Record; } } /** * Create, manage, and update corpora and their associated settings */ export declare class Corpora { protected readonly _options: Corpora.Options; constructor(_options?: Corpora.Options); /** * List corpora in the account. The returned corpus objects contain less * detail compared to those retrieved the direct corpus retrieval operation. * * @param {Vectara.CorporaListRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * * @example * await client.corpora.list() */ list(request?: Vectara.CorporaListRequest, requestOptions?: Corpora.RequestOptions): Promise>; /** * Create a corpus, which is a container to store documents and associated metadata. Here, you * define the unique `corpus_key` that identifies the corpus. The `corpus_key` can be custom-defined * following your preferred naming convention, allowing you to easily manage the corpus's data and * reference it in queries. For more information, see * [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * @param {Vectara.CreateCorpusRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.BadRequestError} * @throws {@link Vectara.ForbiddenError} * * @example * await client.corpora.create({ * key: "my-corpus" * }) */ create(request: Vectara.CreateCorpusRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Get metadata about a corpus. This operation does not search the corpus contents. * Specify the `corpus_key` to identify the corpus whose metadata you want to * retrieve. The `corpus_key` is created when the corpus is set up, either through * the Vectara Console UI or the Create Corpus API. For more information, * see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus to retrieve. * @param {Vectara.CorporaGetRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.get("my-corpus") */ get(corpusKey: Vectara.CorpusKey, request?: Vectara.CorporaGetRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Permanently delete a corpus and all its associated data. The `corpus_key` uniquely identifies * the corpus. For more information, see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus to delete. * @param {Vectara.CorporaDeleteRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.delete("my-corpus") */ delete(corpusKey: Vectara.CorpusKey, request?: Vectara.CorporaDeleteRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Enable, disable, or update the name and description of a corpus. This lets you * manage data availability without deleting the corpus, which is useful for * maintenance and security purposes. The `corpus_key` uniquely identifies the corpus. * For more information, see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * Consider updating the name and description of a corpus dynamically to help keep your data * aligned with changing business needs. * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus to update. * @param {Vectara.UpdateCorpusRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.update("my-corpus") */ update(corpusKey: Vectara.CorpusKey, request?: Vectara.UpdateCorpusRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Resets a corpus, which removes all documents and data from the specified corpus, * while keeping the corpus itself. The `corpus_key` uniquely identifies the corpus. * For more information, see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus to reset. * @param {Vectara.CorporaResetRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.reset("my-corpus") */ reset(corpusKey: Vectara.CorpusKey, request?: Vectara.CorporaResetRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Replace the filter attributes of a corpus. This does not happen immediately, as * this operation creates a job that completes asynchronously. These new filter * attributes will not work until the job completes. * * You can monitor the status of the filter change using the returned job ID. The * `corpus_key` uniquely identifies the corpus. For more information, see * [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus having its filters replaced. * @param {Vectara.ReplaceFilterAttributesRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.replaceFilterAttributes("my-corpus", { * filterAttributes: [{ * name: "Title", * level: "document", * type: "integer" * }] * }) */ replaceFilterAttributes(corpusKey: Vectara.CorpusKey, request: Vectara.ReplaceFilterAttributesRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Search a single corpus with a straightforward query request, specifying the corpus key and query parameters. * * Specify the unique `corpus_key` identifying the corpus to query. The `corpus_key` is * [created in the Vectara Console UI](https://docs.vectara.com/docs/console-ui/creating-a-corpus) or the [Create Corpus API definition](https://docs.vectara.com/docs/api-reference/admin-apis/create-corpus). When creating a new corpus, you have the option to assign a custom `corpus_key` following your preferred naming convention. This key serves as a unique identifier for the corpus, allowing it to be referenced in search requests. For more information, see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * Enter the search `query` string for the corpus, which is the question you want to ask. * * Set the maximum number of results (`limit`) to return. **Default**: 10, **minimum**: 1 * * Define the `offset` position from which to start in the result set. * * For more detailed information, see this [Query API guide](https://docs.vectara.com/docs/api-reference/search-apis/search). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus to query. * @param {Vectara.CorporaSearchRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.BadRequestError} * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.search("my-corpus", { * query: "query" * }) */ search(corpusKey: Vectara.CorpusKey, request: Vectara.CorporaSearchRequest, requestOptions?: Corpora.RequestOptions): Promise; /** * Perform an advanced query on a specific corpus to find relevant results, highlight relevant snippets, and use Retrieval Augmented Generation: * * * Specify the unique `corpus_key` identifying the corpus to query. The `corpus_key` is [created in the Vectara Console UI](https://docs.vectara.com/docs/console-ui/creating-a-corpus) or the [Create Corpus API definition](https://docs.vectara.com/docs/api-reference/admin-apis/create-corpus). When creating a new corpus, you have the option to assign a custom `corpus_key` following your preferred naming convention. This key serves as a unique identifier for the corpus, allowing it to be referenced in search requests. For more information, see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * Customize your search by specifying the query text (`query`), pagination details (`offset` and `limit`), and metadata filters (`metadata_filter`) to tailor your search results. [Learn more](https://docs.vectara.com/docs/api-reference/search-apis/search#query-definition) * * Leverage advanced search capabilities like reranking (`reranker`) and Retrieval Augmented Generation (RAG) (`generation`) for enhanced query performance. Generation is opt in by setting the `generation` property. By excluding the property or by setting it to null, the response * will not include generation. [Learn more](https://docs.vectara.com/docs/learn/grounded-generation/configure-query-summarization). * * Use hybrid search to achieve optimal results by setting different values for `lexical_interpolation` (e.g., `0.025`). [Learn more](https://docs.vectara.com/docs/learn/hybrid-search) * * Specify Vectara's RAG-focused LLM (Mockingbird) for the `generation_preset_name`. [Learn more](https://docs.vectara.com/docs/learn/mockingbird-llm) * * Use advanced summarization options that utilize detailed summarization parameters such as `max_response_characters`, `temperature`, and `frequency_penalty` for generating precise and relevant summaries. [Learn more](https://docs.vectara.com/docs/api-reference/search-apis/search#advanced-summarization-options) * * For more detailed information, see [Query API guide](https://docs.vectara.com/docs/api-reference/search-apis/search). */ queryStream(corpusKey: Vectara.CorpusKey, request: Vectara.CorporaQueryStreamRequest, requestOptions?: Corpora.RequestOptions): Promise>; /** * Perform an advanced query on a specific corpus to find relevant results, highlight relevant snippets, and use Retrieval Augmented Generation: * * * Specify the unique `corpus_key` identifying the corpus to query. The `corpus_key` is [created in the Vectara Console UI](https://docs.vectara.com/docs/console-ui/creating-a-corpus) or the [Create Corpus API definition](https://docs.vectara.com/docs/api-reference/admin-apis/create-corpus). When creating a new corpus, you have the option to assign a custom `corpus_key` following your preferred naming convention. This key serves as a unique identifier for the corpus, allowing it to be referenced in search requests. For more information, see [Corpus Key Definition](https://docs.vectara.com/docs/api-reference/search-apis/search#corpus-key-definition). * * Customize your search by specifying the query text (`query`), pagination details (`offset` and `limit`), and metadata filters (`metadata_filter`) to tailor your search results. [Learn more](https://docs.vectara.com/docs/api-reference/search-apis/search#query-definition) * * Leverage advanced search capabilities like reranking (`reranker`) and Retrieval Augmented Generation (RAG) (`generation`) for enhanced query performance. Generation is opt in by setting the `generation` property. By excluding the property or by setting it to null, the response * will not include generation. [Learn more](https://docs.vectara.com/docs/learn/grounded-generation/configure-query-summarization). * * Use hybrid search to achieve optimal results by setting different values for `lexical_interpolation` (e.g., `0.025`). [Learn more](https://docs.vectara.com/docs/learn/hybrid-search) * * Specify Vectara's RAG-focused LLM (Mockingbird) for the `generation_preset_name`. [Learn more](https://docs.vectara.com/docs/learn/mockingbird-llm) * * Use advanced summarization options that utilize detailed summarization parameters such as `max_response_characters`, `temperature`, and `frequency_penalty` for generating precise and relevant summaries. [Learn more](https://docs.vectara.com/docs/api-reference/search-apis/search#advanced-summarization-options) * * For more detailed information, see [Query API guide](https://docs.vectara.com/docs/api-reference/search-apis/search). * * @param {Vectara.CorpusKey} corpusKey - The unique key identifying the corpus to query. * @param {Vectara.CorporaQueryRequest} request * @param {Corpora.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Vectara.BadRequestError} * @throws {@link Vectara.ForbiddenError} * @throws {@link Vectara.NotFoundError} * * @example * await client.corpora.query("my-corpus", { * query: "query" * }) */ query(corpusKey: Vectara.CorpusKey, request: Vectara.CorporaQueryRequest, requestOptions?: Corpora.RequestOptions): Promise; protected _getAuthorizationHeader(): Promise; }