Inspiration
LLMs are notoriously bad with hallucinations. This limits LLM use in healthcare, research, management consulting, investing, and other fields where accuracy and verifiability of data are essential. For example, when querying a large database, a management consultant cannot simply rely on the output to the question "What is the market share of firm [X]?" without additional tools to verify it manually or look at additional context.
What it does
We have built an open-source plugin/extension on top of LangChain to generate citations for any queries made through LangChain. The results can be returned in either inline text format, or in JSON that can be used for any frontend interface.
(Our solution can be extended to any use case involving information retrieval such as interview transcripts, websites, research papers, etc. However, to make things fun for this hackathon, we created an automated classroom experience that simulates a classroom with students asking questions and a professor responding with citations.)
How we built it
- Identify Solution: We initially explored a vector search approach to the problem before identifying the prompt-based approach that we currently use with ChatGPT.
- Build Solution: We built a LangChain extension.
- Build Example: We built the education simulation on top of our extension.
Challenges we ran into
This is our first time using LangChain, which turns out is extremely complex. Our extension won't be in a PR for some time. It also doesn't work for every LangChain use case yet.
Accomplishments that we're proud of
The solution is super high-impact once it gets working: it can benefit anyone using LLM Q&A and looking for improved verifiability.
What we learned
We initially approached the issue as a vector search problem but learned that prompt engineering can go a long way to solving complex problems.
What's next for Langchain Citation Extension
Get it working for all LangChain use cases (i.e. "chain_types" and Chains), and then get it added to LangChain as via a Pull Request.
Built With
- langchain
- openai
- python
Log in or sign up for Devpost to join the conversation.