Inspiration
The motivation for this project was sparked by the necessity at work to deliver a consistent product.
What it does
This tool acts as an all-in-one template that generates a response based on relative examples provided by the user. First, the user loads a .csv file with examples of frequently encountered questions and answers. Then the examples are converted into embeddings using OpenAI's embedding model and stored in a Pinecone vector store. When submitting a question, Langchain is used to embed the query and do a semantic similarity search over the vector store, which returns the top 3 results as context. Finally, the tool injects the retrieved examples into Langchain's dynamic few-shot prompt template, and uses OpenAI's LLM to generate a relative response in the desired format.
How we built it
The tool was built using the Python language in Visual Studio Code, OpenAI's large language models, Pinecone vector store, Langchain framework, and Streamlit for front end UI. Specifically, Langchain's Example Selector within their suite of Prompt Template tools, was used to perform semantic similarity search, and inject the relavent examples into the prompt.
Challenges we ran into
One major challenge during development was to allow the tool to use the existing vector store data instead of creating new embeddings every time it runs. This is included in the list of future improvements for this tool.
Accomplishments that we're proud of
Being relatively new to the AI space, we're proud that we were able to quickly develop a functioning AI app that is useful in real world applications across multiple industries.
What we learned
We learned how powerful AI tools can be, and how simple it can be to implement and deploy using OpenAI, Langchain, Pincone, and Streamlit.
What's next for GPTeach-by-example
The following to-do items are future improvements for this project.
- 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
Built With
- langchain
- openai
- pinecone
- python
- streamlit
- visual-studio-code
Log in or sign up for Devpost to join the conversation.