diff --git a/notebook/agentchat_huggingface_langchain.ipynb b/notebook/agentchat_huggingface_langchain.ipynb index 000bcbdbcfd..248ad18f19c 100644 --- a/notebook/agentchat_huggingface_langchain.ipynb +++ b/notebook/agentchat_huggingface_langchain.ipynb @@ -9,7 +9,7 @@ } }, "source": [ - "# Using AutoGen AgentChat with LangChain and Hugging Face\"" + "# Using AutoGen AgentChat with LangChain-based Custom Client and Hugging Face Models" ] }, { @@ -162,6 +162,7 @@ "source": [ "# custom client with custom model loader\n", "\n", + "\n", "class CustomModelClient:\n", " \"\"\"Custom model client implementation for LangChain integration with AutoGen.\"\"\"\n", "\n", @@ -169,11 +170,14 @@ " \"\"\"Initialize the CustomModelClient.\"\"\"\n", " print(f\"CustomModelClient config: {config}\")\n", " self.device = config.get(\"device\", \"cpu\")\n", - " \n", + "\n", " gen_config_params = config.get(\"params\", {})\n", " self.model_name = config[\"model\"]\n", " pipeline = HuggingFacePipeline.from_model_id(\n", - " model_id=self.model_name, task=\"text-generation\", pipeline_kwargs=gen_config_params,device=self.device,\n", + " model_id=self.model_name,\n", + " task=\"text-generation\",\n", + " pipeline_kwargs=gen_config_params,\n", + " device=self.device,\n", " )\n", " self.model = ChatHuggingFace(llm=pipeline)\n", " print(f\"Loaded model {config['model']} to {self.device}\")\n", @@ -318,10 +322,11 @@ "outputs": [], "source": [ "import getpass\n", + "\n", "from huggingface_hub import login\n", "\n", "# The Mistral-7B-Instruct-v0.2 is a gated model which requires API token to access\n", - "login(token = getpass.getpass(\"Enter your HuggingFace API Token\"))" + "login(token=getpass.getpass(\"Enter your HuggingFace API Token\"))" ] }, {