ESRE examples
editESRE examples
editThe following examples demonstrate how to implement ML- and AI-powered applications using ESRE.
The code for these applications is hosted on Elasticsearch Labs.
Knowledge base search with GPT question answering
editThis Python Flask + React application demonstrates how to implement an internal knowledge base with a natural language interface allowing members of your organization to ask questions.
Details
When a question is submitted, the UI immediately returns semantic search results powered by the Elastic Sparse Encoder model and BM25 text search. Results are rescored using RRF to improve relevance.
Simultaneously, the UI streams an answer to the user’s question. The answer is generated by OpenAI GPT using excerpts from the search results as context for the chat completion.
View the source code on Elastic Labs →
Vector search using OpenAI embeddings
editThis example demonstrates how to create and search vector embeddings using Elastic and OpenAI. The solution is available in Python and JavaScript.
Details
The Python and JavaScript examples each provide a script for indexing data, and a search application with a dev server.
The indexing script passes JSON documents to OpenAI to create embeddings, which are persisted to Elasticsearch as additional fields in the original documents.
The search application passes each user query to OpenAI to create embeddings, which Elasticsearch uses to perform kNN search.
View the Python source code on Elastic Labs →
View the JavaScript source code on Elastic Labs →
Documentation GPT chat UI
editThis Python application implements a chat UI, enabling users to ask questions about a set of documentation (in this case, the Elastic docs).
Details
For each user question, the application retrieves relevant documents from Elasticsearch, providing them to Open AI GPT to generate an answer. The solution uses hybrid search (text + vector) to improve relevance.
The UI returns the generated answer and a link to the original document from which the answer was derived.
View the source code on Elastic Labs →
ChatGPT plugin using private Elastic data
editThis ChatGPT plugin enables ChatGPT to use private data stored in Elastic to answer user questions.
Details
ChatGPT has limited access to data for chat completion. This example builds a plugin that enables an additional data source for ChatGPT: your Elastic cluster.
Use this option to access your Elastic data through the ChatGPT interface, rather than building a separate chat application.