Question-Answer Matching System
Some users have frequently asked question (FAQ) databases or other forms of question databases where the use case demands that your users are trying to find the nearest question to their own, so you can provide them with the authoritative answer from the "answer" side of the question-answer database.
This approach may not offer the dynamic nature of Retrieval Augmented Generation (RAG), but it allows you to establish tight controls over the types of questions that users can ask and receive authorizative answers. These question-answer systems can be great for building RFP-answering systems for employees and FAQ lookups for customers.
Format data for indexing
When you send data to Vectara for this use case, we
recommend that you index the question in the title
field and the answer to
that question in the text
content. For example:
{
"customerId": 123456,
"corpusId": 1,
"document": {
"documentId": "who-is-the-king-of-england",
"title": "Who is the King of England?",
"section": [
{
"text": "Charles III"
}
]
}
}
Query for similar questions
Suppose you wanted to find the answer to a question related to this example.
You can put Vectara into a document-matching mode by
setting semantics
to RESPONSE
. For example:
{
"query": [
{
"query": "Who's the English monarch?",
"start": 0,
"numResults": 10,
"corpusKey": [
{
"customerId": 12345678,
"corpusId": 1,
"semantics": "RESPONSE"
}
]
}
]
}
This RESPONSE
setting disables Vectara's "question-answering" mode and
instead tells it to find similar questions.
You can also add a filter expression
of part.is_title = true
to only match the questions.
Combine question matching and answering
Expanding on the previous example, we can help users find question or answer matches together by using batched queries combined with filter expressions. For example:
{
"query": [
{
"query": "Who's the English monarch?",
"start": 0,
"numResults": 10,
"corpusKey": [
{
"customerId": 12345678,
"corpusId": 1,
"semantics": "RESPONSE",
"metadataFilter": "part.is_title = true"
}
]
},
{
"query": "Who's the English monarch?",
"start": 0,
"numResults": 10,
"corpusKey": [
{
"customerId": 12345678,
"corpusId": 1,
"metadataFilter": "part.is_title IS NULL"
}
]
}
]
}