Build a 'Chat with website' using Groq Llama 3
Learn how to use Firecrawl, Groq Llama 3, and Langchain to build a ‘Chat with your website’ bot.
Note: this example is using v0 version of the Firecrawl API. You can install the 0.0.20 version for the Python SDK or the 0.0.36 for the Node SDK.
Setup
Install our python dependencies, including langchain, groq, faiss, ollama, and firecrawl-py.
We will be using Ollama for the embeddings, you can download Ollama here. But feel free to use any other embeddings you prefer.
Load website with Firecrawl
To be able to get all the data from a website and make sure it is in the cleanest format, we will use Firecrawl. Firecrawl integrates very easily with Langchain as a document loader.
Here is how you can load a website with Firecrawl:
Setup the Vectorstore
Next, we will setup the vectorstore. The vectorstore is a data structure that allows us to store and query embeddings. We will use the Ollama embeddings and the FAISS vectorstore. We split the documents into chunks of 1000 characters each, with a 200 character overlap. This is to ensure that the chunks are not too small and not too big - and that it can fit into the LLM model when we query it.
Retrieval and Generation
Now that our documents are loaded and the vectorstore is setup, we can, based on user’s question, do a similarity search to retrieve the most relevant documents. That way we can use these documents to be fed to the LLM model.
Generation
Last but not least, you can use the Groq to generate a response to a question based on the documents we have loaded.
And Voila!
You have now built a ‘Chat with your website’ bot using Llama 3, Groq Llama 3, Langchain, and Firecrawl. You can now use this bot to answer questions based on the documentation of your website.
If you have any questions or need help, feel free to reach out to us at Firecrawl.