0
0
Agentic AIml~10 mins

Why RAG gives agents knowledge in Agentic AI - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load documents for retrieval in RAG.

Agentic AI
from langchain.document_loaders import TextLoader
loader = TextLoader('[1]')
docs = loader.load()
Drag options to blanks, or click blank then click option'
Aagent.py
Bdata.txt
Cconfig.json
Dmodel.py
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a code or config file instead of a text file.
2fill in blank
medium

Complete the code to create a retriever from documents for RAG.

Agentic AI
from langchain.vectorstores import FAISS
retriever = FAISS.from_documents(docs, [1]).as_retriever()
Drag options to blanks, or click blank then click option'
Aloss_function
Btokenizer
Coptimizer
Dembedding_model
Attempts:
3 left
💡 Hint
Common Mistakes
Using tokenizer or optimizer which are unrelated to vector search.
3fill in blank
hard

Fix the error in the RAG agent creation by completing the missing argument.

Agentic AI
from langchain.chains import RetrievalQA
rag_agent = RetrievalQA.from_chain_type(llm=llm, retriever=[1], return_source_documents=True)
Drag options to blanks, or click blank then click option'
Aretriever
Bembedding_model
Ctokenizer
Doptimizer
Attempts:
3 left
💡 Hint
Common Mistakes
Passing tokenizer or embedding model instead of retriever.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters documents by length and stores their text.

Agentic AI
filtered_docs = {doc.metadata['title']: doc.page_content for doc in docs if len(doc.page_content) [1] 100 and doc.metadata['source'] [2] 'trusted_source'}
Drag options to blanks, or click blank then click option'
A<
B>
C==
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' for length or '!=' for source causes wrong filtering.
5fill in blank
hard

Fill all three blanks to build a RAG pipeline that embeds, retrieves, and answers questions.

Agentic AI
embedding = [1]()
retriever = FAISS.from_documents(docs, embedding).as_retriever()
rag_agent = RetrievalQA.from_chain_type(llm=[2](), retriever=retriever, return_source_documents=True)
answer = rag_agent.run([3])
Drag options to blanks, or click blank then click option'
AOpenAIEmbeddings
BOpenAI
C'What is RAG?'
DGPT2
Attempts:
3 left
💡 Hint
Common Mistakes
Using GPT2 as LLM or passing a non-string question.