-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LLM functions for intelligent query (#402)
- Loading branch information
1 parent
61e7925
commit d303541
Showing
2 changed files
with
1,179 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...ntent/unifying-elastic-vector-database-and-llms-for-intelligent-query/README.md
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,38 @@ | ||
|
||
# Unifying Elastic Vector Database and LLMs for Intelligent Retrieval | ||
|
||
## Overview | ||
This notebook demonstrates how to integrate Elasticsearch as a vector database (VectorDB) with search templates and LLM functions to build an intelligent query layer. By leveraging vector search, dynamic query templates, and natural language processing, this approach enhances search precision, adaptability, and efficiency. | ||
|
||
## Features | ||
- **Elasticsearch as a VectorDB**: Efficiently stores and retrieves dense vector embeddings for advanced search capabilities. | ||
- **Search Templates**: Dynamically structure queries by mapping user inputs to the appropriate index parameters. | ||
- **LLM Functions**: Extract key search parameters from natural language queries and inject them into search templates. | ||
- **Hybrid Search**: Combines structured filtering with semantic search to improve search accuracy and relevance. | ||
|
||
## Components | ||
- **Geocode Location Function**: Converts location names into latitude and longitude for geospatial queries. | ||
- **Handle Extract Hotel Search Parameters Function**: Processes extracted search parameters, ensuring essential values like distance are correctly assigned. | ||
- **Call Elasticsearch Function**: Executes structured search queries using dynamically populated search templates. | ||
- **Format and Print Messages Functions**: Enhances query debugging by formatting and displaying responses in a structured format. | ||
- **Run Conversation Function**: Orchestrates interactions between user queries, LLM functions, and Elasticsearch search execution. | ||
- **Search Template Management Functions**: Defines, creates, and deletes search templates to optimize query processing. | ||
|
||
|
||
## Usage | ||
1. Set up an Elasticsearch cluster and ensure vector search capabilities are enabled. | ||
2. Define search templates to map query parameters to the index schema. | ||
3. Use LLM functions to extract and refine search parameters from user queries. | ||
4. Run queries using the intelligent query layer to retrieve more relevant and accurate results. | ||
|
||
|
||
### Prerequisites | ||
- Elastic Cloud instance | ||
- With ML nodes | ||
- Azure OpenAI | ||
- Completions endpoint such as GPT-4o | ||
- For more information on getting started with Azure OpenAI, check out the official [Azure OpenAI ChatGPT Quickstart](https://learn.microsoft.com/en-us/azure/ai-services/openai/chatgpt-quickstart?tabs=command-line%2Ctypescript%2Cpython-new&pivots=programming-language-studio). | ||
- Azure OpenAI Key | ||
- Google Maps API Key | ||
- https://developers.google.com/maps/documentation/embed/get-api-key | ||
|
1,141 changes: 1,141 additions & 0 deletions
1,141
...r-intelligent-query/Unifying_Elastic_Vector_Database_and_LLMs_for_Intelligent_Query.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.