Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize the retrieval agent with a knowledge base.
Agentic AI
agent = RetrievalAgent(knowledge_base=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'query' instead of the knowledge base variable.
Passing the agent itself as the knowledge base.
✗ Incorrect
The retrieval agent needs the knowledge base object, usually named 'kb', to access stored information.
2fill in blank
mediumComplete the code to perform a retrieval before reasoning.
Agentic AI
retrieved_docs = agent.retrieve([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the agent object instead of the query string.
Using the knowledge base variable instead of the query.
✗ Incorrect
The agent retrieves documents based on the input query text.
3fill in blank
hardFix the error in the reasoning step by filling the correct method to process retrieved documents.
Agentic AI
answer = agent.[1](retrieved_docs) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'query' which is for searching, not reasoning.
Using 'process' or 'think' which are not valid method names.
✗ Incorrect
The agent uses the 'reason' method to analyze retrieved documents and generate an answer.
4fill in blank
hardFill both blanks to combine retrieval and reasoning in one step.
Agentic AI
final_answer = agent.[1](agent.[2](query_text))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of 'reason' and 'retrieve'.
Using 'query' or 'answer' which are not correct method names here.
✗ Incorrect
First, the agent retrieves documents with 'retrieve', then reasons over them with 'reason'.
5fill in blank
hardFill all three blanks to create a function that takes a query, retrieves documents, reasons, and returns the answer.
Agentic AI
def answer_query([1]): docs = agent.[2]([3]) return agent.reason(docs)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for the function input and retrieval argument.
Using 'response' instead of 'query_text' as input.
✗ Incorrect
The function takes 'query_text' as input, uses 'retrieve' to get docs, then reasons to return the answer.