Thursday 28 September 2023

An LLM-based document and data Q&A App (with knowledge graph visualization)

This blog has moved to Medium.

I built this app because I'm writing some chapters for an upcoming book on Streamlit. This app helps me digest a large quantity of information from articles and documents I have on the subject of Software Architecture. I wanted to be able to ask questions about the documents and get answers, and also to visualize the answers in a knowledge graph. I also wanted to upload Excel files and ask questions about the data in the files.

The application is a typical LLM application, with the addition of a knowledge graph visualization. The app is built in Python using Streamlit. I was inspired by instagraph and re-implemented its graph plot as a Streamlit custom component. I use:

  • I use Weaviate Cloud (vector) Store (WCS) for document and data indexing.
  • OpenAI, LangChain, and LlamaIndex LLM programming frameworks play an important role too.
  • The application supports local filestore indexing in addition to WCS.
  • OpenAI embeddings are used and the OpenAI API is called, directly or via the other LLM frameworks, for question answering.
  • You will need an OpenAI API key to use the application.
  • Various LLM models are used for question answering, including the GPT-3.5 Turbo and GPT-4 models. Both their chat and completions variants are used.
  • Token usage is tracked and costs are estimated.

The application is deployed on Streamlit Cloud. When deployed in the cloud, the application uses WCS. When deployed locally, the application can be configured to use LlamaIndex to store its index in the local file system.


🚀 Try the app yourself.




No comments:

Post a Comment