quarkiverse / quarkus-langchain4j

Quarkus Langchain4j extension
https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html
Apache License 2.0
148 stars 89 forks source link

Adaptive RAG #869

Open lordofthejars opened 2 months ago

lordofthejars commented 2 months ago

Hi, when you try to implement adaptive RAG (https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_adaptive_rag/) you might need to reuse the retrieved documents from the RAG system and use it in several AI services.

For example, one needs to grade the response, another needs to find hallucinations, etc.

What would be the best option to implement it in quarkus-langchain4j?

geoand commented 2 months ago

cc @jmartisk

lordofthejars commented 2 months ago

There are some ways of doing it like https://github.com/bsorrentino/langgraph4j/blob/main/adaptive-rag/src/main/java/dev/langchain4j/adaptiverag/ChromaStore.java, so basically you call everything manually, and inject them manually too: https://github.com/bsorrentino/langgraph4j/blob/main/adaptive-rag/src/main/java/dev/langchain4j/adaptiverag/RetrievalGrader.java#L61

So there is a way to do it, but maybe we could somehow automate this by creating some kind of bean with requestscoped.