Update app.py
Hugging Face's smolagents is evolving so quickly that between their early beta versions and their recent stable release, they completely renamed the model connection class.
The class HfApiModel was recently renamed to InferenceClientModel.
A lot of changes have to be done Hi everyone! ๐
I cloned this Space to experiment with it in Google Colab, but I ran into a series of crash errors. It looks like recent updates to smolagents, langchain, and gradio have introduced some breaking changes.
To help get this repository up to date, here are the exact changes the authors need to make to app.py, retriever.py, and the environment so the Space runs successfully:
- app.py
Model Class: HfApiModel is deprecated in the latest smolagents. It needs to be updated to use InferenceClientModel.
Initialization: The model should explicitly include the model ID: model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
- retriever.py
LangChain Imports: from langchain.docstore.document import Document is deprecated and throws a ModuleNotFoundError. It must be changed to from langchain_core.documents import Document.
Retrieval Method: get_relevant_documents() is retired in LangChain. The forward function should use self.retriever.invoke(query) instead.
Tool Init: The custom GuestInfoRetrieverTool is missing super().init() at the start of its def init(self, docs): method, which causes modern smolagents to fail.
- Environment / Requirements
Gradio 6.0 Crash: The newest version of Gradio removed the type="messages" argument from Chatbot, which breaks the internal smolagents UI generator. Gradio needs to be pinned: gradio<6.0.
Missing Search Package: The ddgs package needs to be explicitly added to requirements.txt for the DuckDuckGo tool to work.
Hopefully, this saves the maintainers some debugging time so we can get the Space updated for everyone! ๐