This Streamlit app is set up for simple Haystack and OPEA applications. The template is ready to perform Retrieval Augmented Generation with three different retrieval methods on example files.
See the 'How to use this template' instructions below to create a simple UI for your own Haystack search pipelines.
To run the bare application:
- Install requirements:
pip install -r requirements.txt
- Make sure that your OPEA microservices are running
- Run the streamlit app:
streamlit run app.py
This will start the app on localhost:8501
, where you will find a simple search bar.
- Create a new repository from this template or simply open it in a codespace to start playing around 💙
- Make sure your
requirements.txt
file includes the Haystack (haystack-ai
) and Streamlit versions you would like to use. - Change the code in
utils/haystack.py
if you would like a different pipeline. - Create a
.env
file with all of your configuration settings. - Make any UI edits if you'd like to.
- Run the app as show in installation and running
./utils
: This is where we have 2 files:haystack.py
: Here you will find some functions already set up for you to start creating your Haystack search pipeline. It includes 2 main functions calledstart_haystack_pipeline()
which is what we use to create a pipeline and cache it, andquery()
which is the function called byapp.py
once a user query is received.ui.py
: Use this file for any UI and initial value setups.
app.py
: This is the main Streamlit application file that we will run. In its current state it has a sidebar, a simple search bar, a 'Run' button, and a response../files
: You can use this folder to store files to be indexed.
There are default pipelines both in start_document_store()
and start_haystack_pipeline()
. Change the pipelines to use different document stores, embedding and generative models or update the pipelines as you need. Check out 📚 Useful Resources section for details.