Inspiration

One of the best way for learning something is reading a wonderful blog. We would like to help anyone to learn anything by generating the blog for any specific topic by using search engine (Brave) paired with LLM (Mistral).

What it does

The user gives an interested topic, we generate a nice blog with texts and images for the user to help him/her learn the topic.

How we built it

  1. We use Brave as the search engine, and use Mistral Large to generate the content.
  2. A hierarchical RAG system is built. In the first level, we first use the topic name as the query to retrieve the relevant web snippets using Brave Web search, and then generate an outline consists of several section headlines. In the second level, we use the generated headline as the sub-query to retrieval again and generate the content for each section. In the meanwhile, we apply Brave image search to find the relevant images for each section and show the image in the generated blog.

Challenges we ran into

  1. Vanilla RAG could not generate a high-quality blog due to the limited retrieved documents based on the single topic query.

  2. We need call Mistral for generating each section, involving a lot of LLM calls. It will be slow if we conduct LLM calls in serial. To improve the efficiency, we implement an async framework to call LLM in parallel, significantly improving the inference latency.

Accomplishments that we're proud of

  1. A novel hierarchical RAG system. We propose to use RAG to decompose the query. Different from the sub-query engine in LlamaIndex using only LLM to decompose query, ours utilizing LLM + Search engine to generate a more reasonable decomposition.

  2. And end-to-end solution with good latency.

What we learned

The Largest model is a little bit slow, we might need to balance the answer quality and latency by finding some smaller model.

What's next for Brave is all Mistral need for Blog Generation

Publish it at Apple Store.

Built With

  • brave
  • mistral
  • streamlit
Share this project:

Updates