Skip to content

Latest commit

 

History

History
5864 lines (4058 loc) · 94.3 KB

reference.md

File metadata and controls

5864 lines (4058 loc) · 94.3 KB

Reference

client.query_stream(...)

📝 Description

Perform a multipurpose query across to retrieve relevant information from one or more corpora and generate a response using Retrieval Augmented Generation (RAG).

  • Specify the unique corpus_key identifying the corpus to query. The corpus_key is created in the Vectara Console UI or the Create Corpus API definition. 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.
  • 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
  • Leverage advanced search capabilities like reranking (reranker) and opt-in 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
  • Specify Vectara's RAG-focused LLM (Mockingbird) for the generation_preset_name. Learn more
  • 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
  • Customize citation formats in summaries using the citations object to include numeric, HTML, or Markdown links. Learn more

For more detailed information, see this Query API guide.

🔌 Usage

from vectara import (
    CitationParameters,
    ContextConfiguration,
    GenerationParameters,
    KeyedSearchCorpus,
    SearchCorporaParameters,
    Vectara,
)

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.query_stream(
    query="hello, world?",
    search=SearchCorporaParameters(
        corpora=[
            KeyedSearchCorpus(
                lexical_interpolation=0.005,
            )
        ],
        offset=0,
        limit=10,
        context_configuration=ContextConfiguration(
            sentences_before=2,
            sentences_after=2,
            start_tag="<em>",
            end_tag="</em>",
        ),
    ),
    generation=GenerationParameters(
        max_used_search_results=5,
        citations=CitationParameters(
            style="none",
        ),
        response_language="auto",
    ),
)
for chunk in response:
    yield chunk

⚙️ Parameters

query: str — The search query string, which is the question the user is asking.

search: SearchCorporaParameters

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

generation: typing.Optional[GenerationParameters]

save_history: typing.Optional[bool] — Indicates whether to save the query in the query history.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.query(...)

📝 Description

Perform a multipurpose query across to retrieve relevant information from one or more corpora and generate a response using Retrieval Augmented Generation (RAG).

  • Specify the unique corpus_key identifying the corpus to query. The corpus_key is created in the Vectara Console UI or the Create Corpus API definition. 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.
  • 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
  • Leverage advanced search capabilities like reranking (reranker) and opt-in 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
  • Specify Vectara's RAG-focused LLM (Mockingbird) for the generation_preset_name. Learn more
  • 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
  • Customize citation formats in summaries using the citations object to include numeric, HTML, or Markdown links. Learn more

For more detailed information, see this Query API guide.

🔌 Usage

from vectara import SearchCorporaParameters, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.query(
    query="Am I allowed to bring pets to work?",
    search=SearchCorporaParameters(),
)

⚙️ Parameters

query: str — The search query string, which is the question the user is asking.

search: SearchCorporaParameters

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

generation: typing.Optional[GenerationParameters]

save_history: typing.Optional[bool] — Indicates whether to save the query in the query history.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chat_stream(...)

📝 Description

Create a chat while specifying the default retrieval parameters used by the prompt.

🔌 Usage

from vectara import SearchCorporaParameters, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.chat_stream(
    query="How can I use the Vectara platform?",
    search=SearchCorporaParameters(),
)
for chunk in response:
    yield chunk

⚙️ Parameters

query: str — The chat message or question.

search: SearchCorporaParameters

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

generation: typing.Optional[GenerationParameters]

chat: typing.Optional[ChatParameters]

save_history: typing.Optional[bool] — Indicates whether to save the chat in both the chat and query history. This overrides chat.store.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chat(...)

📝 Description

Create a chat while specifying the default retrieval parameters used by the prompt.

🔌 Usage

from vectara import SearchCorporaParameters, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chat(
    query="How can I use the Vectara platform?",
    search=SearchCorporaParameters(),
)

⚙️ Parameters

query: str — The chat message or question.

search: SearchCorporaParameters

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

generation: typing.Optional[GenerationParameters]

chat: typing.Optional[ChatParameters]

save_history: typing.Optional[bool] — Indicates whether to save the chat in both the chat and query history. This overrides chat.store.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Corpora

client.corpora.list(...)

📝 Description

List corpora in the account. The returned corpus objects contain less detail compared to those retrieved the direct corpus retrieval operation.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.corpora.list(
    limit=1,
)
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

limit: typing.Optional[int] — The maximum number of corpora to return at one time.

filter: typing.Optional[str] — A regular expression to filter the corpora by their name or summary.

page_key: typing.Optional[str] — Used to retrieve the next page of corpora after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.create(...)

📝 Description

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.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.create(
    key="my-corpus",
)

⚙️ Parameters

key: CorpusKey

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

name: typing.Optional[str] — The name for the corpus. This value defaults to the key.

description: typing.Optional[str] — Description of the corpus.

queries_are_answers: typing.Optional[bool] — Queries made to this corpus are considered answers, and not questions.

documents_are_questions: typing.Optional[bool] — Documents inside this corpus are considered questions, and not answers.

encoder_id: typing.Optional[str]Deprecated: Use encoder_name instead.

encoder_name: typing.Optional[str] — The encoder used by the corpus.

filter_attributes: typing.Optional[typing.Sequence[FilterAttribute]]

The new filter attributes of the corpus. If unset then the corpus will not have filter attributes.

custom_dimensions: typing.Optional[typing.Sequence[CorpusCustomDimension]]

A custom dimension is an additional numerical field attached to a document part. You can then multiply this numerical field with a query time custom dimension of the same name. This allows boosting (or burying) document parts for arbitrary reasons. This feature is only enabled for Pro and Enterprise customers.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.get(...)

📝 Description

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.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.get(
    corpus_key="my-corpus",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to retrieve.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.delete(...)

📝 Description

Permanently delete a corpus and all its associated data. The corpus_key uniquely identifies the corpus. For more information, see Corpus Key Definition.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.delete(
    corpus_key="my-corpus",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to delete.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.update(...)

📝 Description

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. Consider updating the name and description of a corpus dynamically to help keep your data aligned with changing business needs.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.update(
    corpus_key="my-corpus",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to update.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

enabled: typing.Optional[bool] — Set whether or not the corpus is enabled. If unset then the corpus will remain in the same state.

name: typing.Optional[str] — The name for the corpus. If unset or null, then the corpus will remain in the same state.

description: typing.Optional[str] — Description of the corpus. If unset or null, then the corpus will remain in the same state.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.reset(...)

📝 Description

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.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.reset(
    corpus_key="my-corpus",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to reset.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.replace_filter_attributes(...)

📝 Description

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.

🔌 Usage

from vectara import FilterAttribute, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.replace_filter_attributes(
    corpus_key="my-corpus",
    filter_attributes=[
        FilterAttribute(
            name="Title",
            level="document",
            type="integer",
        )
    ],
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus having its filters replaced.

filter_attributes: typing.Sequence[FilterAttribute] — The new filter attributes.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.search(...)

📝 Description

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 or the Create Corpus API definition. 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.
  • 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.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.search(
    corpus_key="my-corpus",
    query="query",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to query.

query: str — The search query string for the corpus, which is the question the user is asking.

limit: typing.Optional[int] — The maximum number of results to return.

offset: typing.Optional[int] — The position from which to start in the result set.

save_history: typing.Optional[bool] — Indicates whether to save the query in the query history.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.query_stream(...)

📝 Description

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 or the Create Corpus API definition. 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.
  • 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
  • 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.
  • Use hybrid search to achieve optimal results by setting different values for lexical_interpolation (e.g., 0.025). Learn more
  • Specify Vectara's RAG-focused LLM (Mockingbird) for the generation_preset_name. Learn more
  • 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

For more detailed information, see Query API guide.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.corpora.query_stream(
    corpus_key="my-corpus",
    query="query",
)
for chunk in response:
    yield chunk

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to query.

query: str — The search query string, which is the question the user is asking.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

search: typing.Optional[SearchCorpusParameters] — The parameters to search one corpus.

generation: typing.Optional[GenerationParameters]

save_history: typing.Optional[bool] — Indicates whether to save the query in the query history.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.corpora.query(...)

📝 Description

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 or the Create Corpus API definition. 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.
  • 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
  • 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.
  • Use hybrid search to achieve optimal results by setting different values for lexical_interpolation (e.g., 0.025). Learn more
  • Specify Vectara's RAG-focused LLM (Mockingbird) for the generation_preset_name. Learn more
  • 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

For more detailed information, see Query API guide.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.corpora.query(
    corpus_key="my-corpus",
    query="query",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus to query.

query: str — The search query string, which is the question the user is asking.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

search: typing.Optional[SearchCorpusParameters] — The parameters to search one corpus.

generation: typing.Optional[GenerationParameters]

save_history: typing.Optional[bool] — Indicates whether to save the query in the query history.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Upload

client.upload.file(...)

📝 Description

Upload files such as PDFs and Word Documents for automatic text extraction and metadata parsing. The request expects a multipart/form-data format containing the following parts:

  • metadata - (Optional) Specifies a JSON object representing any additional metadata to be associated with the extracted document. For example, 'metadata={"key": "value"};type=application/json'
  • chunking_strategy - (Optional) Specifies the chunking strategy for the platform to use. If you do not set this option, the platform uses the default strategy, which creates one chunk per sentence. For example, 'chunking_strategy={"type":"max_chars_chunking_strategy","max_chars_per_chunk":200};type=application/json'
  • table_extraction_config - (Optional) Specifies whether to extract table data from the uploaded file. If you do not set this option, the platform does not extract tables from PDF files. Example config, 'table_extraction_config={"extract_tables":true};type=application/json'
  • file - Specifies the file that you want to upload.
  • filename - Specified as part of the file field with the file name that you want to associate with the uploaded file. For a curl example, use the following syntax: 'file=@/path/to/file/file.pdf;filename=desired_filename.pdf'

For more detailed information, see this File Upload API guide.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.upload.file(
    corpus_key="my-corpus",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus of which to upload the file.

file: `from future import annotations

core.File` — See core.File for more documentation

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] — Arbitrary object that will be attached as document metadata to the extracted document.

chunking_strategy: typing.Optional[ComponentsSchemasMaxCharsChunkingStrategy]

table_extraction_config: typing.Optional[TableExtractionConfig]

filename: typing.Optional[str] — Optional multipart section to override the filename.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Documents

client.documents.list(...)

📝 Description

Retrieve a list of documents stored in a specific corpus. This endpoint provides an overview of document metadata without returning the full content of each document.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.documents.list(
    corpus_key="my-corpus",
)
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the queried corpus.

limit: typing.Optional[int] — The maximum number of documents to return at one time.

metadata_filter: typing.Optional[str]

Filter documents by metadata. Uses the same expression as a query metadata filter, but only allows filtering on document metadata.

page_key: typing.Optional[str] — Used to retrieve the next page of documents after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.documents.create(...)

📝 Description

Add a document to a corpus. This endpoint supports two document formats, structured and core.

  • Structured documents have a more conventional structure that provide document sections and parts in a format created by Vectara's proprietary strategy automatically. You provide a logical document structure, and Vectara handles the partitioning.
  • Core documents differ in that they follow an advanced, granular structure that explicitly defines each document part in an array. Each part becomes a distinct, searchable item in query results. You have precise control over the document structure and content.

For more details, see Indexing.

🔌 Usage

from vectara import CoreDocument, CoreDocumentPart, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.documents.create(
    corpus_key="my-corpus",
    request=CoreDocument(
        id="my-doc-id",
        document_parts=[
            CoreDocumentPart(
                text="I'm a nice document part.",
            )
        ],
    ),
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the queried corpus.

request: CreateDocumentRequest

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.documents.get_corpus_document(...)

📝 Description

Retrieve the content and metadata of a specific document, identified by its unique document_id from a specific corpus.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.documents.get_corpus_document(
    corpus_key="my-corpus",
    document_id="document_id",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus containing the document to retrieve.

document_id: str

The document ID of the document to retrieve. This document_id must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.documents.delete(...)

📝 Description

Permanently delete a document identified by its unique document_id from a specific corpus. This operation cannot be undone, so use it with caution.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.documents.delete(
    corpus_key="my-corpus",
    document_id="document_id",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus with the document to delete.

document_id: str

The document ID of the document to delete. This document_id must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Index

client.index.update_corpus_document(...)

📝 Description

Updates document identified by its unique document_id from a specific corpus. The request body metadata is merged with the existing metadata, adding or modifying only the specified fields.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.index.update_corpus_document(
    corpus_key="my-corpus",
    document_id="document_id",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus with the document to update.

document_id: str

The document ID of the document to update. This document_id must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]

The metadata for a document as an arbitrary object. Properties of this object can be used by document level filter attributes.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.index.replace_corpus_document_metadata(...)

📝 Description

Replaces metadata of a document identified by its unique document_id from a specific corpus.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.index.replace_corpus_document_metadata(
    corpus_key="my-corpus",
    document_id="document_id",
)

⚙️ Parameters

corpus_key: CorpusKey — The unique key identifying the corpus with the document to update.

document_id: str

The document ID of the document to update. This document_id must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]

The metadata for a document as an arbitrary object. Properties of this object can be used by document level filter attributes.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Chats

client.chats.list(...)

📝 Description

Retrieve a list of previous chats in the Vectara account.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.chats.list()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

limit: typing.Optional[int] — The maximum number of results to return in the list.

page_key: typing.Optional[str] — Used to retrieve the next page of chats after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.get(...)

📝 Description

Get a chat summary to view what started the chat, but not subsequent turns.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.get(
    chat_id="chat_id",
)

⚙️ Parameters

chat_id: str — The ID of the chat.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.delete(...)

📝 Description

Delete a chat and any turns it contains permanently.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.delete(
    chat_id="chat_id",
)

⚙️ Parameters

chat_id: str — The ID of the chat.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.list_turns(...)

📝 Description

List all turns in a chat to see all message and response pairs that make up the dialog.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.list_turns(
    chat_id="chat_id",
)

⚙️ Parameters

chat_id: str — The ID of the chat.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.create_turns_stream(...)

📝 Description

Create a new turn in the chat. Each conversation has a series of turn objects, which are the sequence of message and response pairs that make up the dialog.

🔌 Usage

from vectara import SearchCorporaParameters, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.chats.create_turns_stream(
    chat_id="chat_id",
    query="How can I use the Vectara platform?",
    search=SearchCorporaParameters(),
)
for chunk in response:
    yield chunk

⚙️ Parameters

chat_id: str — The ID of the chat.

query: str — The chat message or question.

search: SearchCorporaParameters

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

generation: typing.Optional[GenerationParameters]

chat: typing.Optional[ChatParameters]

save_history: typing.Optional[bool] — Indicates whether to save the chat in both the chat and query history. This overrides chat.store.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.create_turns(...)

📝 Description

Create a new turn in the chat. Each conversation has a series of turn objects, which are the sequence of message and response pairs that make up the dialog.

🔌 Usage

from vectara import SearchCorporaParameters, Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.create_turns(
    chat_id="chat_id",
    query="How can I use the Vectara platform?",
    search=SearchCorporaParameters(),
)

⚙️ Parameters

chat_id: str — The ID of the chat.

query: str — The chat message or question.

search: SearchCorporaParameters

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

generation: typing.Optional[GenerationParameters]

chat: typing.Optional[ChatParameters]

save_history: typing.Optional[bool] — Indicates whether to save the chat in both the chat and query history. This overrides chat.store.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.get_turn(...)

📝 Description

Get a specific turn from a chat, which is a message and response pair from the conversation.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.get_turn(
    chat_id="chat_id",
    turn_id="turn_id",
)

⚙️ Parameters

chat_id: str — The ID of the chat.

turn_id: str — The ID of the turn.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.delete_turn(...)

📝 Description

Delete a turn from a chat. This will delete all subsequent turns in the chat.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.delete_turn(
    chat_id="chat_id",
    turn_id="turn_id",
)

⚙️ Parameters

chat_id: str — The ID of the chat.

turn_id: str — The ID of the turn.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.chats.update_turn(...)

📝 Description

Update a turn; used to disable or enable a chat.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.chats.update_turn(
    chat_id="chat_id",
    turn_id="turn_id",
)

⚙️ Parameters

chat_id: str — The ID of the chat.

turn_id: str — The ID of the turn.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

enabled: typing.Optional[bool]

Indicates whether to disable a turn. It will disable this turn and all subsequent turns. Enabling a turn is not implemented.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Llms

client.llms.list(...)

📝 Description

List LLMs that can be used with query and chat endpoints. The LLM is not directly specified in a query, but instead a generation_preset_name is used. The generation_preset_name property in generation parameters can be found as the name property on the Generations Presets retrieved from /v2/generation_presets.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.llms.list()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

filter: typing.Optional[str] — A regular expression to match names and descriptions of the LLMs.

limit: typing.Optional[int] — The maximum number of results to return in the list.

page_key: typing.Optional[str]

Used to retrieve the next page of LLMs after the limit has been reached. This parameter is not needed for the first page of results.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

GenerationPresets

client.generation_presets.list_generation_presets(...)

📝 Description

List generation presets used for query or chat requests. Generation presets are the build of properties used to configure generation for a request. This includes the template that renders the prompt, and various generation settings like temperature.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.generation_presets.list_generation_presets()

⚙️ Parameters

llm_name: typing.Optional[str] — Filter presets by the LLM name.

limit: typing.Optional[int] — The maximum number of results to return in the list.

page_key: typing.Optional[str]

Used to retrieve the next page of generation presets after the limit has been reached. This parameter is not needed for the first page of results.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Encoders

client.encoders.list(...)

📝 Description

Encoders are used to store and retrieve from a corpus.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.encoders.list(
    filter="vectara.*",
)
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

filter: typing.Optional[str] — A regular expression against encoder names and descriptions.

limit: typing.Optional[int] — The maximum number of results to return in the list.

page_key: typing.Optional[str] — Used to retrieve the next page of encoders after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Rerankers

client.rerankers.list(...)

📝 Description

Rerankers are used to improve the ranking (ordering) of search results.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.rerankers.list(
    filter="vectara.*",
)
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

filter: typing.Optional[str] — A regular expression against reranker names and descriptions.

limit: typing.Optional[int] — The maximum number of rerankers to return in the list.

page_key: typing.Optional[str] — Used to retrieve the next page of rerankers after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Jobs

client.jobs.list(...)

📝 Description

List jobs for the account. Jobs are background processes like replacing the filterable metadata attributes.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.jobs.list()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

corpus_key: typing.Optional[typing.Union[CorpusKey, typing.Sequence[CorpusKey]]] — The unique key identifying the corpus with the job.

after: typing.Optional[dt.datetime] — Filter by jobs created after a particular date-time.

state: typing.Optional[typing.Union[JobState, typing.Sequence[JobState]]] — Filter by jobs in particular states.

limit: typing.Optional[int] — The maximum number of jobs to return at one time.

page_key: typing.Optional[str] — Used to retrieve the next page of jobs after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.jobs.get(...)

📝 Description

Get a job by a specific ID. Jobs are background processes like replacing the filterable metadata attributes.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.jobs.get(
    job_id="job_id",
)

⚙️ Parameters

job_id: str — The ID of the job to get.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Users

client.users.list(...)

📝 Description

Lists all users in the account.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.users.list()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

limit: typing.Optional[int] — The maximum number of users to return at one time.

page_key: typing.Optional[str] — Used to retrieve the next page of users after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.users.create(...)

📝 Description

Create a user for the current customer account.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.users.create(
    email="email",
)

⚙️ Parameters

email: str — The email address for the user.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

username: typing.Optional[str] — The username for the user. The value defaults to the email.

description: typing.Optional[str] — The description of the user.

api_roles: typing.Optional[typing.Sequence[ApiRole]] — The role names assigned to the user.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.users.get(...)

📝 Description

Get a user and view details like the email, username, and associated roles.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.users.get(
    username="username",
)

⚙️ Parameters

username: str

Specifies the user ID that to retrieve. Note that the username must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.users.delete(...)

📝 Description

Delete a user from the account.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.users.delete(
    username="username",
)

⚙️ Parameters

username: str

Specifies the user ID to delete. Note that the username must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.users.update(...)

📝 Description

Update details about a user such as role names.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.users.update(
    username="username",
)

⚙️ Parameters

username: str

Specifies the user ID to update. Note that the username must be percent encoded.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

enabled: typing.Optional[bool] — Indicates whether to enable or disable the user.

api_roles: typing.Optional[typing.Sequence[ApiRole]] — The new role names of the user.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.users.reset_password(...)

📝 Description

Reset the password for a user.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.users.reset_password(
    username="username",
)

⚙️ Parameters

username: str

Specifies the user ID to update. Note that the username must be percent encoded and URI safe.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

API Keys

client.api_keys.list(...)

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.api_keys.list(
    corpus_key="my-corpus",
)
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

limit: typing.Optional[int] — Max number of API keys to return at one time.

page_key: typing.Optional[str] — Used to retrieve the next page of API keys after the limit has been reached.

corpus_key: typing.Optional[CorpusKey] — Filters the API keys to only those with permissions on the specified corpus key.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.api_keys.create(...)

📝 Description

An API key is to authenticate when calling Vectara APIs.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.api_keys.create(
    name="name",
    api_key_role="serving",
)

⚙️ Parameters

name: str — The human-readable name of the API key.

api_key_role: ApiKeyRole

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

corpus_keys: typing.Optional[typing.Sequence[CorpusKey]]

Corpora this API key has roles on if it is not a Personal API key. This property should be null or missing if this api_key_role is personal.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.api_keys.get(...)

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.api_keys.get(
    api_key_id="api_key_id",
)

⚙️ Parameters

api_key_id: str — The ID of the API key.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.api_keys.delete(...)

📝 Description

Delete API keys to help you manage the security and lifecycle of API keys in your application.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.api_keys.delete(
    api_key_id="api_key_id",
)

⚙️ Parameters

api_key_id: str — The ID of the API key.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.api_keys.update(...)

📝 Description

Update an API key such as the roles attached to the key.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.api_keys.update(
    api_key_id="api_key_id",
)

⚙️ Parameters

api_key_id: str — The ID of the API key.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

enabled: typing.Optional[bool] — Indicates whether to disable or enable an API key.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

AppClients

client.app_clients.list(...)

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
response = client.app_clients.list()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

limit: typing.Optional[int] — The maximum number of App Clients to return at one time.

filter: typing.Optional[str] — Regular expression to filter the names of the App Clients.

page_key: typing.Optional[str] — Used to retrieve the next page of App Clients after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.app_clients.create(...)

📝 Description

An App Client is used for OAuth 2.0 authentication when calling Vectara APIs.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.app_clients.create(
    name="name",
)

⚙️ Parameters

name: str — Name of the client credentials.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

description: typing.Optional[str] — Description of the client credentials.

api_roles: typing.Optional[typing.Sequence[ApiRole]] — API roles that the client credentials will have.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.app_clients.get(...)

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.app_clients.get(
    app_client_id="app_client_id",
)

⚙️ Parameters

app_client_id: str — The ID of the App Client.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.app_clients.delete(...)

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.app_clients.delete(
    app_client_id="app_client_id",
)

⚙️ Parameters

app_client_id: str — The ID of App Client.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.app_clients.update(...)

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.app_clients.update(
    app_client_id="app_client_id",
)

⚙️ Parameters

app_client_id: str — The name of App Client.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

description: typing.Optional[str] — The new App Client description.

api_roles: typing.Optional[typing.Sequence[ApiRole]] — The new roles attached to the App Client. These roles will replace the current roles.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

QueryHistory

client.query_history.get_query_history(...)

📝 Description

Retrieve a detailed history of previously executed query.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.query_history.get_query_history(
    query_id="query_id",
)

⚙️ Parameters

query_id: str — The ID of the query history

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.query_history.get_query_histories(...)

📝 Description

Retrieve query histories.

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.query_history.get_query_histories()

⚙️ Parameters

corpus_key: typing.Optional[str] — Specifies the corpus_key used in the query.

started_after: typing.Optional[dt.datetime] — Queries that started after a particular date-time.

started_before: typing.Optional[dt.datetime] — Queries that started before a particular date-time.

chat_id: typing.Optional[str] — Specifies the chat_id of the query, this will return all queries in the specified chat.

limit: typing.Optional[int] — Specifies the maximum number of query history listed.

page_key: typing.Optional[str] — Used to retrieve the next page of query histories after the limit has been reached.

request_timeout: typing.Optional[int] — The API will make a best effort to complete the request in the specified seconds or time out.

request_timeout_millis: typing.Optional[int] — The API will make a best effort to complete the request in the specified milliseconds or time out.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Auth

client.auth.get_token(...)

📝 Description

Obtain an OAuth2 access token using client credentials

🔌 Usage

from vectara import Vectara

client = Vectara(
    api_key="YOUR_API_KEY",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
client.auth.get_token(
    client_id="client_id",
    client_secret="client_secret",
)

⚙️ Parameters

client_id: str — The client ID of the application

client_secret: str — The client secret of the application

request_options: typing.Optional[RequestOptions] — Request-specific configuration.