LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

AI Agents with Hugging Face smolagents

Kurs anzeigen

Anleitung zur Übung

  • Instantiate the ApplianceSearchTool by passing in the vector_store.
  • Add your appliance_tool tool to the tools list when initializing the CodeAgent.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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)
Code bearbeiten und ausführen