July 14, 2023

MVP (large language Model + Vector database + Prompt engineering)

Update (10/7/2023): I revised another “ChatPDF” app using LangChain and Qdrant here.

I revised the sample chatbot kickstarter app developed by Colin Jarvis from OpenAI, which shows how you can create apps (Q&A and Chatbot) using ChatGPT and your own data.

Instead of using the well-known term RAG (Retrieval Augmented Generation), I created a new acronym for this common architecture:

MVP: M (large language Model) + V (Vector database) + P (Prompt engineering)

If a fine-tuned LLM is used, then it is FMVP (Fine-tuned MVP).

My revised code repo with setup instructions is here.


I used the rulebooks from NBA and IFAB for the demo.

If you want to use other data, just put the PDF files in data folder.

Key Steps

I list the basic steps of the development workflow below - many of the steps have nothing to do with ChatGPT:


Q&A (single-turn chat via Completion endpoint):

summary_prompt = '''Summarise this result in a bulleted list to answer the search query a customer has sent.

Chatbot (multi-turn chat via Chat Completion endpoint):

system_prompt = '''
You are a helpful sports knowledge base assistant. You need to capture a Question and Sport from each customer.
The Question is their query on sports rules, and the Sport should be either basketball or soccer.
Think about this step by step:
- The user will ask a Question
- You will ask them for the Sport if their question didn't include a Sport
- Once you have the Sport, say "searching for answers".


User: I'd like to know how many players are on each team

Assistant: Certainly, what sport would you like this for?

User: basketball please.

Assistant: Searching for answers.

The following figures are from the slides shared by the original author of the app.

How to use triage prompts and chat agents to build apps for various business scenarios:

How companies can build their own moats based on the MVP architecture:

PS. The featured image for this post is generated using Stable Diffusion, whose full parameters and the model links can be found at Replicable.Art.