开始使用免费开始使用

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.

本练习是课程的一部分

AI Agents with Hugging Face smolagents

查看课程

练习说明

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

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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)
编辑并运行代码