Install compatible version

!pip -q install "smolagents==1.21.3" duckduckgo-search

Import libraries

from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool

Replace with your NEW Hugging Face token

HF_TOKEN = "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"

Load model

model = InferenceClientModel(
model_id="Qwen/Qwen2.5-72B-Instruct",
token=HF_TOKEN,
)

Create search tool

search = DuckDuckGoSearchTool()

Create agent

agent = CodeAgent(
tools=[search],
model=model,
max_steps=6,
)

Ask questions

while True:
question = input("You: ")

if question.lower() == "exit":
    break

prompt = f"""

You are StructuralGPT, an expert structural engineering assistant.

Answer using Indian Standards (IS 456, IS 875, IS 1893, IS 800) whenever applicable.

Question:
{question}
"""

answer = agent.run(prompt)

print("\nStructuralGPT:")
print(answer)
print("-" * 60)
Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment