Skip to main content

Adding AI Powered Q&A and Semantic Search to Mere

· 4 min read
Christopher Fu

In this post we will cover new experimental and optional AI capabilities in Mere to enhance the search experience and to answer user questions about their medical records. This article will discuss how we integrate semantic search and Q&A using OpenAI's text-embedding-3-large and gpt-4-turbo models.

Why Semantic Search Matters

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.

Semantic search is an advanced technique that interprets the meaning behind words in a search query. Unlike traditional searches that rely on specific keywords, semantic search examines the context and relationships between words. This nuanced approach allows the search engine to deliver more pertinent results, even when the search terms don't directly match the content.

For instance, if someone searches for "high blood sugar," a semantic search engine would also retrieve information related to "diabetes" and "A1c," understanding the intrinsic link between these terms.

Integrating Semantic Search into Mere with OpenAI Embeddings

As of today, users now have the option to activate semantic search as an experimental settings in 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.

With the Old Text Search

With the New Semantic Search

The difference is clear: semantic search can uncover relevant results that were previously inaccessible with basic text searches.

Enhancing Mere with Q&A: Leveraging Semantic Search and RAG

Mere aims to do more than just display your medical data; it's here to help you understand it. To that end, Mere now offers a Q&A feature that allows users to ask questions about their medical records. Now, if you're puzzled by a lab result, just click on the Mere Assistant tab and ask a question.

The Mere Assistant is powered by OpenAI's gpt-4-turbo, which generates responses to user inquiries. When a question is asked, Mere employs semantic search to find relevant records and then uses gpt-4-turbo to formulate an informed response. This method, known as Retrieval-Augmented Generation (RAG), merges the capabilities of semantic search with advanced language generation, offering precise and relevant answers.

Ready to Experience It?


Please note that enabling these features will transmit your records to OpenAI for processing. If you have privacy concerns, consider whether you wish to use these features.

To activate semantic search and Q&A, visit the experimental section in the settings tab. By default, these features are hidden; reveal them by selecting Show experimental features.

Enable Semantic Search and Q&A

To enable these features, you'll need to obtain and input your own OpenAI API key.

Once activated, Mere will begin embedding your medical records, preparing them for the enhanced search and Q&A functionalities. This can take a few minutes, but once complete, you'll have access to a more intelligent and responsive search experience.