The support chat now answers only when it has a source. That makes everything depend on the search: if it doesn’t find the right section, the chat declines a question that the help answers just fine. In T5.1, you already saw such cases, questions whose right section was below the threshold. Often they’re questions with an error message, an abbreviation or a name. This lesson teaches the search to take such words literally, without giving up what the vector search is good at. At the end, you measure whether it’s worth it.
The examples ran with the packages from T5.1, plus:
| Package | Version |
|---|---|
CommunityToolkit.VectorData.PgVector |
1.0.2 |
CommunityToolkit.VectorData.AzureAISearch (cloud part only, only built) |
1.0.1 |
Microsoft.Extensions.Configuration, Microsoft.Extensions.DependencyInjection (tests, from T2.1) |
10.0.14 |
The examples against PostgreSQL need the container from T4.4. What works without a database, the tests run with fakes.
Where meaning isn’t enough
A vector search compares meanings (T4.1). That’s its strength: “Can I back out of my booking?” finds the section “Canceling an appointment”, although hardly a word is the same. It’s also its weakness as soon as a particular word matters:
| Question | What the vector search sees | What is meant |
|---|---|---|
| “What does K-104 mean?” | a question about a message, any message | exactly the message K-104 |
| “Which columns does the CSV file need?” | a question about files and columns | the import of contacts |
| “What does the CPV code 72000000 stand for?” | a question about a code | exactly this number |
| “Does it work with Outlook?” | a question about some calendar | one particular program |
For an embedding model, “K-104” is a rare string of characters without much meaning. The question’s vector therefore lies close to all sections about signing in and messages, and the section about K-104 is one of many. A keyword search, on the other hand, finds exactly the sections in which “K-104” stands, and no others. It’s as old as search engines and has the opposite weakness: “call off” doesn’t find “cancel”.
A hybrid search asks both and combines the results. A section that both see near the top moves to the front; one that only one of the two finds stays in the race.