An AI tool that generates a response based on relative examples provided by the user. Useful for when consistency in the output and how it's formatted is important.
- Create a .csv file with two columns, first one named 'input' and second one named 'output'. Optionally use the existing examples.csv file in this repo.
- Enter in as many examples in the .csv file as you'd like.
- Upload the .csv file to the app.
- The examples are converted into embeddings using OpenAI's embedding model and stored in the Pinecone vector store.
- When submitting a question, langchain is used to embed the input and do a semantic similarity search over the vector store, which returns the top 3 results as context.
- Then uses OpenAI's text-davinci-003 model and Langchain's few-shot dynamic prompt template to generate a response.
You can get your own OpenAI API key by following the following instructions:
- Go to https://platform.openai.com/account/api-keys.
- Click on the
+ Create new secret keybutton. - Next, enter an identifier name (optional) and click on the
Create secret keybutton.
You can get your own OpenAI API key by following the following instructions:
- Go to https://app.pinecone.io/.
- Click on the
API Keysbutton on the left panel sidebar. - Click
+ Create API Keybutton in the top right. - Next, enter an identifier name and click on the
Create Keybutton. - Take note of the Environment listed next to your API key.
- git clone this repository
- change directory to repo folder
- run
pip install -r requirements.txtin terminal to install required packages - run
streamlit run main.pyin terminal to load app in your default web browser - Once the app is loaded, go ahead and upload your examples, enter your API keys, and type a question in the text box and wait for a generated response.
or go to deployed app at https://gpteach-by-example.streamlit.app/
- Add session state/chat history and conversation memory
- Running example selector on existing vector store data instead of creating new embeddings every time
- Option to add examples to existing vector store
- Option to delete existing vector store index
- Option to use OpenAI chat models
- Option for user to choose model, edit prompt, and change k value
- Add token usage/pricing information
Please feel free to contribute!

