Add Replicate API with Llama-2-13b-chat LLM and add document context bot using langchain. #131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Replicate API with Llama-2-13b-chat LLM and Add document context bot using langchain and OpenAIEmbeddings and OpenAI ChatGpt.
This PR implements two major implementations:
1. Implementing a chatbot which takes any document as an input context which then specializes the bot in the regards to that document.
This on-the-fly training is crucial to a chatbot, since most of the times we want it to be specialized in an area. Think help-bots in commercial websites, support bots in e-commerce websites. These entities deal with a large amount of data and training a model on such large dataset would be exponentially costly. This feature of producing context on the go, will help them deal with model trainings in a macro level. Since this also supports multiple documents as input, we can thus have multiple sources as input thus increasing the scope of the chatbot with ease.
This model uses OpenAI ChatGPT - gpt-3.5-turbo and OpenAI Embeddings - text-embedding-ada-002. And it is inspired from the work at https://github.com/PromtEngineer/localGPT/.
This also adds the langchain library which provides us easy to understand and simple to use helper functions to ease our work.
Supported file formats: .txt, .md, .py, .pdf, .csv, .xls, .xlsx, .docx, .doc
How To:
#TODO: Implement workflow to add document directly from the client side.
2. Implementing a Llama-2-13b-chat chatbot using Replicate, which provides us APIs to open-source LLMs.
Replicate provides us a free access for a limited period of time. And furthur allows us to access open-source LLMs on the cloud with a pay-as-you go model. While, I have implemented only the Llama-2-13b-chat LLM, replicate hosts many more models which can be explored over here.
Screenshots
Below, is my resume which was uploaded to the bot.
And here is the chatbot providing contextually accurate answers.
Code improvements
Developer checklist