Skip to content

Commit ad278fa

Browse files
Merge pull request huggingface#208 from huggingface/adapt-agent-cookbooks-to-new-release
Adapt agent notebooks to new transformers release
2 parents 668cce2 + 630996d commit ad278fa

File tree

5 files changed

+587
-1075
lines changed

5 files changed

+587
-1075
lines changed

notebooks/en/agent_change_llm.ipynb

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
32-
"!pip install -q openai anthropic"
32+
"!pip install openai anthropic \"transformers[agents]\" --upgrade -q"
3333
]
3434
},
3535
{
@@ -104,12 +104,12 @@
104104
}
105105
],
106106
"source": [
107-
"from transformers.agents import HfEngine, ReactCodeAgent\n",
107+
"from transformers.agents import HfApiEngine, ReactCodeAgent\n",
108108
"\n",
109-
"repo_id = \"meta-llama/Meta-Llama-3-8B-Instruct\"\n",
109+
"repo_id = \"meta-llama/Meta-Llama-3.1-8B-Instruct\"\n",
110110
"endpoint_url = \"your_endpoint_url\"\n",
111111
"\n",
112-
"llm_engine = HfEngine(model=repo_id) # you could use model=endpoint_url here\n",
112+
"llm_engine = HfApiEngine(model=repo_id) # you could use model=endpoint_url here\n",
113113
"\n",
114114
"agent = ReactCodeAgent(tools=[], llm_engine=llm_engine)\n",
115115
"\n",
@@ -147,8 +147,8 @@
147147
"}\n",
148148
"\n",
149149
"\n",
150-
"class HfEngine:\n",
151-
" def __init__(self, model: str = \"meta-llama/Meta-Llama-3-8B-Instruct\"):\n",
150+
"class HfApiEngine:\n",
151+
" def __init__(self, model: str = \"meta-llama/Meta-Llama-3.1-8B-Instruct\"):\n",
152152
" self.model = model\n",
153153
" self.client = InferenceClient(model=self.model, timeout=120)\n",
154154
"\n",

0 commit comments

Comments
 (0)