Connect the Tool, Unlock Agentic RAG
You now have a working custom tool that can search appliance manuals using semantic similarity. In this exercise, you'll connect that tool to an agent so it can answer questions based on manual content.
Behind the scenes, you already have access to:
- A variable called
vector_store
, which holds your searchable manual content - An
ApplianceSearchTool
to perform semantic search - A variable called
model
, which contains a preconfigured language model for the agent
Your goal is to wire everything together so the agent can use your tool to answer questions like a helpful appliance assistant.
This exercise is part of the course
AI Agents with Hugging Face smolagents
Exercise instructions
- Instantiate the
ApplianceSearchTool
by passing in thevector_store
. - Add your
appliance_tool
tool to the tools list when initializing theCodeAgent
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create appliance search tool
appliance_tool = ApplianceSearchTool(____)
# Create AI assistant for appliance help
assistant = CodeAgent(
tools=[____],
model=model,
instructions="Help with appliance questions using manual information. Search multiple times if needed for complete answers.",
verbosity_level=1,
max_steps=6
)
result = assistant.run("If the AC isn’t cooling and shows error E1, what should I check and what’s the next step?")
print(result)