SylphAI-Inc / AdalFlow

AdalFlow: The library to build & auto-optimize LLM applications.
http://adalflow.sylph.ai/
MIT License
2.21k stars 200 forks source link

[Multi-hop RAG opt + improvement] [V0.3.0 Cycle Graph] #223

Open liyin2015 opened 2 months ago

liyin2015 commented 2 months ago

Design choice: (1) support cycle, we treat it as a component where its prompt has to be adapted to multiple sets of inputs and outputs, in practical this make sense (2) user not creating a cycle, they treating each repeating as a new copy node and has its own parameter.

For (2) its easy, everything works out of box, users just need to know that they are doing this intentional for (1) we have to carefully design how the gradient works, and how the demo works (demo should aggregate both parts)

Multi-hop retriever

no_cycle_multi_hop_retriever

Multi-hop RAG (works by simplify replace the retriever if we simplify follow the retriever api)

no_cycle_design_trace_graph_Generator_output_id_f5377eef-9f12-4e6e-b0e0-6546b20012fd

liyin2015 commented 1 month ago

We can diagnose and trace all generator calls end to end as follows:

Screenshot 2024-10-26 at 8 54 21 PM

It can track two generators used in the retriever which is saved in ComponentList but as each file trace each call separately, we might want a single file that will have better visualization, especially fit it back to a graph.

liyin2015 commented 1 month ago

Show data id (from the dataset) in the graph, and show the score for each traces in the demo paramter.

Screenshot 2024-10-27 at 6 59 43 PM Screenshot 2024-10-27 at 6 59 31 PM