DAGWorks-Inc / burr

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
https://burr.dagworks.io
BSD 3-Clause Clear License
1.15k stars 62 forks source link

CRAG Example #253

Closed HamzaFarhan closed 2 months ago

HamzaFarhan commented 3 months ago

Is your feature request related to a problem? Please describe. Thoughts on adding Corrective Retrieval Augmented Generation (CRAG) as an example?

Describe the solution you'd like Using Burr, LanceDB, Instructor, and Exa(for web search). No frameworks, the SDKs directly.

Describe alternatives you've considered There is a LangGraph tutorial with Tavily and Chroma but it skips some steps and could be better overall.

Additional context Here's the overview image from the paper

crag
skrawcz commented 3 months ago

@HamzaFarhan sounds good! Happy to provide input / feedback wherever you need it.

HamzaFarhan commented 3 months ago

Feedback Request

The possible routes that are guaranteed using Instructor:

  1. names of all available LanceDB tables.
  2. web_search
  3. assistant
  4. terminate (if the query is in ["exit", "quit", "q"])

So the transitions check for routes 2-4 and we assume that it must be one of the tables otherwise. ask_assistant will combine all lancedb_results and exa_search_results for context if they exist in the state, and then reset them to [] We stop after ask_assistant to get the next query for router. This is a combination of Adaptive-RAG and CRAG.

Adaptive-CRAG :test_tube:

statemachine

skrawcz commented 3 months ago

@HamzaFarhan at a high level this makes sense. Not sure I have feedback without actually playing with it. Did you have some alternate designs / thoughts?

elijahbenizzy commented 2 months ago

This example has been merged, thank you!