# Introducing Elasticsearch Relevance Engine™ — Advanced Search for the AI Revolution ![rw-book-cover](https://www.elastic.co/search-labs/assets/images/blog-720x420_(1).png?576f05fcd18644c0101deae4e31397e4) ## Metadata - Author: [[Matt Riley]] - Full Title: Introducing Elasticsearch Relevance Engine™ — Advanced Search for the AI Revolution - Category: #articles - Date: 2023-10-09 - URL: https://www.elastic.co/search-labs/may-2023-launch-announcement - [ ] #toFile ➕ 2023-10-09 - [ ] #toProcess ➕ 2023-10-09 ## Highlights added 2023-10-09 - Introducing Elasticsearch Relevance Engine™ — Advanced search for the AI revolution ([View Highlight](https://read.readwise.io/read/01hcb4h7jp6ny2zyec2k2d67r1)) - Note: Article Summary: The article discusses the integration of Elasticsearch's search relevance capability with OpenAI's ChatGPT's question-answering capabilities to enhance domain-specific knowledge bases. It provides a detailed guide on how to connect ChatGPT to proprietary data stores using Elasticsearch and build question/answer capabilities for your data. Key Points: 1. ChatGPT is an AI model developed by OpenAI based on the GPT architecture. It is designed to understand and generate human-like responses to text inputs. 2. Despite its potential, ChatGPT has limitations such as a knowledge cutoff date, occasional hallucination in responses, and lack of knowledge about domain-specific content. 3. Elasticsearch is a highly effective search engine designed to deliver relevant document retrieval. It boasts features like support for traditional keyword and text-based search and an AI-ready vector search. 4. The combination of Elasticsearch's retrieval prowess and ChatGPT's natural language understanding capabilities offers an unparalleled user experience. 5. The article provides a step-by-step guide on how to use ChatGPT with Elasticsearch, including setting up an Elasticsearch cluster, using the Eland Python library, setting up the Elasticsearch web crawler, connecting with the OpenAI API, and setting up the Python backend. 6. The article also provides examples of chat responses and discusses the risks of allowing ChatGPT to answer questions based purely on data it has been trained on. 7. The individual components of the integration can be tailored to suit specific requirements and adjusted to provide the best results. Important Takeaways for Developers: 1. Understanding the strengths and limitations of ChatGPT and Elasticsearch can help in effectively leveraging their capabilities. 2. The integration of Elasticsearch and ChatGPT can be customized to suit specific requirements and provide the best results. 3. Developers should be aware of the risks of allowing ChatGPT to answer questions based purely on data it has been trained on. 4. Developers should familiarize themselves with the privacy practices and terms of use of any generative AI tools prior to use. 5. The Eland Python library can be used as a bridge to load the model into Elasticsearch from the Hugging Face model hub. 6. Developers can experiment with alternative embedding models, especially those fine-tuned for domain-specific data. TLDR Summary: The article provides a comprehensive guide on integrating Elasticsearch's search relevance capability with OpenAI's ChatGPT's question-answering capabilities to enhance domain-specific knowledge bases. It discusses the strengths and limitations of both tools and provides a step-by-step guide on how to use them together, including setting up an Elasticsearch cluster, using the Eland Python library, setting up the Elasticsearch web crawler, connecting with the OpenAI API, and setting up the Python backend. The article emphasizes that the integration can be customized to suit specific requirements and provide the best results. Do you want to continue in chat? [y/n] Enter a value (Default is y): Give an overview of the project built and how it works, what role the eland library plays,y Failed to validate input string: please enter 'y' or 'n' Enter a value (Default is y): y [user]: Give a technical overview of the system being built, how it operates, the technologies used, what role the eland library plays, and its architecture (components, interactions, etc...) [assistant]: Technical Overview: The system being built integrates Elasticsearch's search relevance capability with OpenAI's ChatGPT's question-answering capabilities. It is designed to enhance domain-specific knowledge bases by providing accurate and contextually relevant responses to user queries. Technologies Used: 1. ChatGPT: An AI model developed by OpenAI based on the GPT architecture. It is designed to understand and generate human-like responses to text inputs. 2. Elasticsearch: A highly effective search engine designed to deliver relevant document retrieval. It supports traditional keyword and text-based search (BM25) and an AI-ready vector search with exact match and approximate kNN (k-Nearest Neighbor) search capabilities. 3. Eland Python Library: A Python library created by Elastic that provides a wide range of data science functions. In this system, it is used as a bridge to load the model into Elasticsearch from the Hugging Face model hub. 4. OpenAI API: Used to send documents and questions to ChatGPT. System Architecture and Operation: The system operates through a series of steps: 1. A Python interface accepts user questions and generates a hybrid search request for Elasticsearch, combining BM25 and kNN search approaches to find the most relevant document. 2. The search request is sent to Elasticsearch. 3. The documentation body and original URL are returned to Python. 4. An API call is made to OpenAI's ChatCompletion with a prompt instructing it to answer the user's question using only the information from the selected document. This ensures the ChatGPT model only uses information from the official documentation, reducing the chance of hallucinations. 5. The generated response is returned to Python. 6. Python adds the original documentation source URL to the generated response and prints it to the screen for the user. Role of Eland Library: The Eland Python library plays a crucial role in the system. It is used as a bridge to load the model into Elasticsearch from the Hugging Face model hub. This allows the model to be deployed on machine learning nodes for inference use, enabling the system to generate vectors for user's search questions and document titles. ~ via C v12.3.0-gcc took 3m41s ❯ lynx -dump -nolist https://www.elastic.co/search-labs/may-2023-launch-announcement | pinocchio general summarize --article - --additional "After the summary, answer: What are important takeaways, important points to remember as a developer who wants to build an embeddings or retrieval augmented / vector search / NLP search?" Article Outline: 1. Introduction to Elasticsearch Relevance Engine (ESRE) 2. Configurable capabilities of ESRE 3. Importance of highly relevant search results 4. Need for a scalable developer toolkit in the AI era 5. Availability of ESRE on Elastic Cloud 6. Overcoming the limitations of generative AI models with ESRE 7. ESRE's vector database for building rich, semantic search applications 8. Delivering superior relevance out-of-the-box for all developers 9. How to try out ESRE Key Points: 1. Elasticsearch Relevance Engine (ESRE) is a new tool for creating highly relevant AI search applications, building on Elastic’s leadership in search and over two years of machine learning research and development. 2. ESRE provides developers with a suite of sophisticated retrieval algorithms and the ability to integrate with large language models (LLMs), accessible via a simple, unified API. 3. ESRE's capabilities include advanced relevance ranking features, creating, storing, and searching dense embeddings, processing text using a wide range of natural language processing (NLP) tasks and models, and integrating with third-party transformer models. 4. ESRE can be used to improve relevance, increase user engagement, and address new challenges posed by emerging technologies and changing user behaviors. 5. ESRE is available on Elastic Cloud and can also be downloaded for a self-managed experience. 6. ESRE helps overcome the limitations of generative AI models by being enterprise data/context aware, providing superior relevance, ensuring privacy and security, managing size and cost, and avoiding outdated information and hallucinations. 7. ESRE includes a resilient, production-grade vector database that allows developers to build rich, semantic search applications. 8. With ESRE, developers can implement semantic search and benefit from AI-powered search relevance without the need for specialized machine learning or data science teams. TLDR Summary: The Elasticsearch Relevance Engine