-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(new) Add query observability feature to docs (#362)
* Initial doc set up of query history topics * Update release notes * Change lambda to lexical interpolation * Update Query Observability docs Several updates for this new feature including capabilities, console UI, release notes, and other misc updates. * Update API reference * Some updates based on feedback * Updates from feedback * Update release notes * Minor updates --------- Signed-off-by: Paul Wozniczka <25128922+pwoznic@users.noreply.github.com>
- Loading branch information
Showing
45 changed files
with
911 additions
and
514 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
www/docs/api-reference/query-history-apis/get-query-histories.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
id: get-query-histories | ||
title: List Query Histories API Definition | ||
sidebar_title: List Query Histories API Definition | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import CodeBlock from '@theme/CodeBlock'; | ||
import {vars} from '@site/static/variables.json'; | ||
import {Config} from '@site/docs/definitions.md'; | ||
|
||
The List Query Histories API allows you to retrieve, update, and manage query | ||
history for a specific corpus. This API is particularly useful for tracking | ||
query performance, debugging individual queries, and retrieving detailed | ||
information such as the call stack of a query execution. | ||
|
||
## List Query Histories Request and Response | ||
|
||
To get a history of a specific query, send a GET request to | ||
`/v2/queries`. You can specify the `corpus_key`, `chat_id`, and the | ||
`limit` which is the maximum number of historical queries to list. The | ||
response includes an array of previous query histories. | ||
|
||
## REST 2.0 URL | ||
|
||
### List Query Histories Endpoint Address | ||
|
||
<Config v="names.product"/> exposes an HTTP endpoint at the following URL | ||
to list the history of previous queries: | ||
<code>https://<Config v="domains.rest.indexing"/>/v2/queries/:query_id</code> | ||
|
||
The API Reference shows the full [List Query Histories](/docs/rest-api/get-query-histories) REST definition. |
38 changes: 38 additions & 0 deletions
38
www/docs/api-reference/query-history-apis/get-query-history.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
id: get-query-history | ||
title: Get Query History API Definition | ||
sidebar_title: Get Query History API Definition | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import CodeBlock from '@theme/CodeBlock'; | ||
import {vars} from '@site/static/variables.json'; | ||
import {Config} from '@site/docs/definitions.md'; | ||
|
||
The Get Query History API allows you to retrieve detailed history about a | ||
specific query that was made against a corpus. The response includes detailed | ||
information about the query, such as latency, the time it was executed, and | ||
the various stages in the query pipeline. | ||
|
||
## Get Query History Request and Response | ||
|
||
To get a history of a specific query, send a GET request to | ||
`/v2/queries/{query_id}`. You specify the `query_id` and the response includes | ||
the `id` of the query, the `query` object, the `chat_id`, the time taken to | ||
complete the query (`latency_ms`) the time that the query `started_at`, along | ||
with the `spans` object. | ||
|
||
The `spans` object provides information about the ordered parts of the query | ||
pipeline and you get information about what happens during each stage of the | ||
pipeline. | ||
|
||
## REST 2.0 URL | ||
|
||
### Get Query History Endpoint Address | ||
|
||
<Config v="names.product"/> exposes an HTTP endpoint at the following URL | ||
to get a history of a specific query: | ||
<code>https://<Config v="domains.rest.indexing"/>/v2/queries/:query_id</code> | ||
|
||
The API Reference shows the full [Get Query History](/docs/rest-api/get-query-history) REST definition. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
--- | ||
id: configure-queries | ||
title: Configure Queries | ||
sidebar_label: Configure Queries | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import {Config} from '@site/docs/definitions.md'; | ||
import {vars} from '@site/static/variables.json'; | ||
|
||
When you add data to a corpus, the Query tab lets you experiment with | ||
different semantic search, summarization, and chat options. Whether you want | ||
to retrieve relevant information, generate summaries grounded in facts with | ||
Retrieval-Augmented Generation (RAG), or engage in conversational | ||
interactions, explore these options and configurations to find the optimal | ||
settings for your applications. | ||
|
||
## Search Your Data | ||
|
||
The Query tab provides the following application types for search and | ||
retrieval: | ||
|
||
1. **Semantic search**: Perform semantic searches based | ||
on natural language queries. Vectara's advanced algorithms understand the meaning | ||
and context of your queries, enabling accurate and relevant search results. | ||
2. **Summary**: Extending the Semantic Search functionality, this | ||
option uses Retrieval-Augmented Generation (RAG) to provide concise summaries in | ||
response to your queries. This can be particularly useful when you need an | ||
overview of the relevant information within your data. | ||
3. **Chat**: Engage in conversational interactions | ||
with your data. This can be particularly useful when you need to ask | ||
follow-up questions, clarify information, or explore your data in a more | ||
interactive manner. | ||
:::tip | ||
Chat leverages the same underlying search and summarization capabilities as | ||
the other options, but presents the results in a conversational format, making | ||
it easier to maintain context and engage in multi-turn interactions. | ||
::: | ||
|
||
## Customize the Query Experience | ||
|
||
These search options provide different configuration settings to tailor the | ||
query experience to your specific needs: | ||
|
||
### Save query to history | ||
|
||
When experimenting with configurations and running queries against a corpus, | ||
Vectara lets you log your queries into a query history. This is important for | ||
troubleshooting issues, inspecting past queries, and optimizing configurations. | ||
By surfacing data like query latency, search results, reranking, and | ||
generative response times, users can better understand how to fine-tune | ||
Vectara to meet their business goals. | ||
|
||
### View the history of query | ||
|
||
1. Ask questions of your data with **Send query**. | ||
2. Select **View query history** to review a table of past queries executed | ||
against your corpus. | ||
3. Select a query from the table to view its detailed configuration, execution | ||
flow, and results. | ||
4. Use this information to optimize your configuration and submit a new query. | ||
|
||
|
||
![Query histories](/img/query-histories.png) | ||
|
||
### Configure retrieval | ||
|
||
The Retrieval configuration lets you enable hybrid search by adjusting the | ||
`lexical_interpolation` value, also known as lambda, which is a balance | ||
between neural search and keyword search. | ||
|
||
![Configure hybrid search](/img/configure_hybrid_search.png) | ||
|
||
The reranking option lets you rerank orders of search results also use the | ||
Maximum Marginal Relevance (MMR) Reranker with a diversity factor to | ||
reduce bias. | ||
|
||
![Configure reranking](/img/configure_reranking.png) | ||
|
||
The result context option lets you configure the number of sentences or | ||
characters before and after the matched text. If you use the number of | ||
characters, Vectara captures the entire sentence that contains the captured | ||
characters. | ||
|
||
![Configure result context](/img/configure_result_context.png) | ||
|
||
### Configure generation | ||
|
||
The Generation section shows the LLM and prompt template used and lets you | ||
configure the Language and Summarization options for the query: | ||
|
||
![Configure generation options](/img/configure_generation.png) | ||
|
||
### Configure evaluation | ||
|
||
The Factual Consistency Score automatically evaluates and detects | ||
hallucinations in generated output. This calibrated score can range from `0.0` | ||
to `1.0`. A higher score indicates a greater probability of being factually | ||
accurate, while a lower score indicates a greater probability of | ||
hallucinations. | ||
|
||
![Configure evaluation](/img/configure_evaluation.png) | ||
|
||
|
||
### Configure search filters | ||
|
||
Select the Filters tab to enter a filter expression or select filter attributes | ||
to further refine your search results. We provide some syntax examples in the | ||
drawer. | ||
|
||
![Configure filters](/img/configure_filters.png) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
id: evaluate-queries | ||
title: Evaluate Queries | ||
sidebar_label: Evaluate Queries | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import {Config} from '@site/docs/definitions.md'; | ||
import {vars} from '@site/static/variables.json'; | ||
|
||
Developers often struggle to understand why certain queries fall short of | ||
expectations. Without detailed insights, diagnosing issues becomes guesswork, | ||
making it harder to identify problems and improve query performance. Our | ||
platform lets you experiment with different search options and configurations. | ||
|
||
After you send a query, select the query inspector icon next to the **Send query** | ||
button: | ||
|
||
![Inspect query](/img/inspect_query.png) | ||
|
||
This lets you see the underlying API request, response, and explanation of the | ||
query: | ||
|
||
![Inspect query options](/img/inspect_query_options.png) | ||
|
||
### View query analysis | ||
|
||
The **Explanation** tab provides a **View query analysis** option that provides a | ||
detailed breakdown of the execution timeline for a specific query, enabling | ||
you to understand how the system processed the query at each stage: | ||
|
||
![Query analysis](/img/query_analysis.png) | ||
|
||
This information is valuable for diagnosing query issues, refining | ||
configurations, and optimizing overall performance. The left panel shows the | ||
configuration and filters used for the query. The main panel shows each | ||
stage with the timestamp and latency: | ||
|
||
* **Query ID:** Specifies the unique identifier for the query `ddc20b2844a0ce2a7dc15d366c4f259d`. | ||
* **Query:** Provides the exact time the query was submitted (`2024-12-02 12:58:58.474 UTC`), | ||
indicating when the search started. | ||
* **Search:** Shows the initial retrieval of relevant data from the corpus. | ||
* **Reranking:** Refines the order of retrieved results for improved relevance. | ||
* **Generation:** Produces the final output, including citations and a summary from the LLM. | ||
* **Factual consistency scoring:** Evaluates the factual accuracy of the generated output against | ||
retrieved data. | ||
|
||
Click **Expand all** to reveal detailed information for each execution stage, | ||
including specific parameters. | ||
|
||
Select **Load into Query tab** to load this configuration into your query tab | ||
so that you can make changes to your settings. |
Oops, something went wrong.