본문 바로가기

Studying AI

RAG from scratch (3)

자료 : https://www.youtube.com/playlist?list=PLfaIDFEXuae2LXbO1_PKyVJiQ23ZztA0x

 

Routing (Logical Routing + Semantic Routing)

routing the question (possibily decomposed in th previous step) to the relevant DBs or prompts.

 

1. Logical Routing

(DBs could be Graph DB, Relational DB, Vectorstore)

feed the LLM with the knowledge of available DBs → make the LLM to reason and choose which DB to retrieve from

classification + function calling to produce structured output

 

출처 : https://github.com/langchain-ai/rag-from-scratch/blob/main/rag_from_scratch_10_and_11.ipynb

 

llm.with_structured_output()

 

출처 : https://github.com/langchain-ai/rag-from-scratch/blob/main/rag_from_scratch_10_and_11.ipynb

 

structured output → function schema   bind to LLM

 

2. Semantic Routing

embed questions & embed prompts → choose a prompt relevant to the query based on similarity

출처 : https://github.com/langchain-ai/rag-from-scratch/blob/main/rag_from_scratch_10_and_11.ipynb

 

Query Construction

 

(다시 듣기!)

 

Unstructured NL query  + structured function schema (structured schema of the chosen DB) → structured query

 

 

 

 

 

 

 

'Studying AI' 카테고리의 다른 글

RAG from scratch (4)  (0) 2024.06.04
RAG from scratch (2)  (0) 2024.06.02
RAG from scratch (1)  (0) 2024.05.31