This project provides a simple Gradio interface for using the Llama Index, a versatile library for semantic search. This interface allows you to interact with the Llama Index through a chat-like interface using the Gradio library.
- Make sure you have Python installed (version 3.6 or above).
-
Clone the repository:
git clone https://github.com/Saideep-23/HAL56.git cd HAL56
pip install -r requirements.txt mkdir sample_data
python your_script_name.py
The provided code sets up a Gradio interface for interacting with the Llama Index. Here's a brief explanation of the key components:
- The code initializes the Llama Index using the
VectorStoreIndex
,SimpleDirectoryReader
, andServiceContext
classes. - It loads sample data from the
sample_data
directory.
- Configures the LlamaCPP model with various parameters such as temperature, max_new_tokens, and more.
- Creates a
ServiceContext
with default settings, specifying the chunk size, LlamaCPP model, and embedding model.
- Initializes a
SentenceTransformerRerank
model for reranking search results.
- Configures the query engine with similarity settings and node postprocessors, including the previously defined rerank model.
- Defines a prediction function that queries the Llama Index and returns the response.
- Uses Gradio to launch a chat interface for the prediction function.