-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): new blog post announcing Q&A and semantic search
- Loading branch information
Showing
12 changed files
with
93 additions
and
22 deletions.
There are no files selected for viewing
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
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,82 @@ | ||
--- | ||
slug: adding-ai-semantic-search-and-qa-to-mere | ||
title: Adding AI Semantic Search and Q&A to Mere | ||
description: Implementing RAG and Semantic Search using OpenAI Embeddings and GPT-4-Turbo | ||
authors: [cfu288] | ||
toc_min_heading_level: 2 | ||
toc_max_heading_level: 5 | ||
hide_table_of_contents: false | ||
--- | ||
|
||
## Why Semantic Search? | ||
|
||
A year ago, during a feedback session, an early Mere user reported a "broken" search bar. She had entered "diabetes" and "high blood sugar" into the Mere search bar but received no results. While Mere's search _was_ functioning correctly, performing basic text queries, it failed to meet her expectations of recognizing the relationship between her search terms and related medical records like A1c and blood glucose levels. This incident highlighted the need for a more sophisticated, semantic search capability. | ||
|
||
<!--truncate--> | ||
|
||
### What is Semantic Search? | ||
|
||
Semantic search is a search technique that uses semantics, or the science of meaning in language, to understand the intent of a user's search query. It goes beyond the traditional keyword-based approach to consider the context and meaning of the query. This allows the search engine to return more relevant results, even if the search terms are not an exact match to the content. | ||
|
||
An example of semantic search is when a user searches for "high blood sugar," the search engine understands that the user is also interested in records containing "diabetes" and "A1c" and returns these records as well. | ||
|
||
### Bringing Semantic Search to Mere using OpenAI Embeddings | ||
|
||
As of today, users now have the option to activate semantic search within the experimental settings of Mere. This feature employs OpenAI's `text-embedding-3-large` model to create embeddings for user records. During a search, Mere leverages these embeddings to identify and retrieve the most relevant records based on the search query. | ||
|
||
Below is a quick demo of the difference between the existing simple text search and the new semantic search in Mere. | ||
|
||
<div className="flex-col sm:flex-row flex w-full gap-1"> | ||
<div className=""> | ||
<p>With the Old Text Search:</p> | ||
<video width="100%" height="auto" controls> | ||
<source src="/vid/ExactSearch.mp4" type="video/mp4" alt="Exact search demo"/> | ||
Your browser does not support the video tag. | ||
</video> | ||
</div> | ||
<div> | ||
<p>With the New Semantic Search:</p> | ||
<video width="100%" height="auto" controls> | ||
<source src="/vid/SemanticSearch.mp4" type="video/mp4" alt="Semantic search demo"/> | ||
Your browser does not support the video tag. | ||
</video> | ||
</div> | ||
</div> | ||
<br/> | ||
|
||
As you can see, the semantic search is able to return relevant results to the user that the previous simple text search could not. | ||
<br/> | ||
|
||
# Building Q&A into Mere using Semantic Search and RAG (Retrieval-Augmented Generation) | ||
|
||
Mere aims to do more than just display your data; it's here to help you understand it. Now, if you're puzzled by a lab result, simply ask your question through the new Q&A feature by clicking on the Mere AI Assistant tab. | ||
|
||
Here's a video of the Q&A feature in action: | ||
|
||
<div className="flex w-full p-2"> | ||
<video width="100%" height="auto" controls> | ||
<source src="/vid/DoIHaveAnemiaDemo.mp4" type="video/mp4" alt="Q&A demo"/> | ||
Your browser does not support the video tag. | ||
</video> | ||
</div> | ||
<br/> | ||
|
||
The Mere AI Assistant utilizes OpenAI's `gpt-4-turbo` for generating answers to user inquiries. Upon receiving a question, Mere employs semantic search to locate the most pertinent records related to the query, forwards this data along with the question, and uses `gpt-4-turbo` to produce a response. | ||
|
||
<br/> | ||
|
||
## Want to try it out? | ||
|
||
:::warning | ||
|
||
Activating these features means your records **will be transmitted to OpenAI** for processing. If this raises privacy concerns for you, it is advisable not to enable these features. | ||
|
||
::: | ||
|
||
The semantic search and Q&A functionalities are situated within the experimental segment of the settings tab. By default, experimental features are not visible; to view them, select _Show experimental features_. | ||
|
||
To activate semantic search and Q&A, navigate to the settings tab, proceed to the experimental segment, and toggle on the desired features. Please be aware that activation requires you to acquire and enter [your own OpenAI API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-api-key). | ||
|
||
[![Enable Semantic Search and Q&A](/img/openai_experimental_setting.png)](/img/openai_experimental_setting.png) | ||
|
||
Once enabled, embedding of your medical records will start. This process may take a minute to complete, depending on the number of records you have. Semantic search and Q&A will be available once the embedding process is complete. |
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,5 @@ | ||
cfu288: | ||
name: Christopher Fu | ||
title: Developer of Mere Medical | ||
url: https://cfu288.com | ||
image_url: https://files.meremedical.co/profile.jpg |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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