Error connecting with Higgingface models

Trying the following code, but keeps on getting error.

from langchain_community.llms import HuggingFaceHub
import os
from crewai import Agent, Task, Crew, LLM

HUGGINGFACE_API_KEY  = "hf_PVaGCQZ...."

llm = LLM(
    model="meta-llama/Llama-3.2-3B-Instruct",  # or another available model
    base_url="https://huggingface.co/models/",
    api_key=HUGGINGFACE_API_KEY
)
 
llm

topic = "Artificial Intelligence"
# Define Agents
planner = Agent(
    role="Content Planner",
    goal="Plan engaging and factually accurate content on {topic}",
    backstory="You're working on planning a blog article about the topic: {topic}. You collect information that helps the audience learn something and make informed decisions. Your work is the basis for the Content Writer to write an article on this topic.",
    llm=llm,
    allow_delegation=False,
    verbose=True
)

plan = Task(
    description=(
        "1. Prioritize the latest trends, key players, and noteworthy news on {topic}.\n"
        "2. Identify the target audience, considering their interests and pain points.\n"
        "3. Develop a detailed content outline including an introduction, key points, and a call to action.\n"
        "4. Include SEO keywords and relevant data or sources.\n"
        "5. The plan should be detailed and cover all aspects of the topic."
    ),
    expected_output="A comprehensive content plan document with an outline, audience analysis, SEO keywords, and resources.",
    agent=planner,
)

crew = Crew(
    agents=[planner],
    tasks=[plan],
    verbose=True
)

result = crew.kickoff(inputs={"topic": topic})
print(result)

#_____________________________
ERROR:root:Failed to get supported params: argument of type ‘NoneType’ is not iterable
WARNING:opentelemetry.trace:Overriding of current TracerProvider is not allowed
ERROR:root:Failed to get supported params: argument of type ‘NoneType’ is not iterable
ERROR:root:Failed to get supported params: argument of type ‘NoneType’ is not iterable
ERROR:root:Failed to get supported params: argument of type ‘NoneType’ is not iterable
ERROR:root:LiteLLM call failed: litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=meta-llama/Llama-3.2-3B-Instruct
Pass model as E.g. For ‘Huggingface’ inference endpoints pass in completion(model='huggingface/starcoder',..) Learn more:
ERROR:root:Failed to get supported params: argument of type ‘NoneType’ is not iterable
ERROR:root:LiteLLM call failed: litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=meta-llama/Llama-3.2-3B-Instruct
Pass model as E.g. For ‘Huggingface’ inference endpoints pass in completion(model='huggingface/starcoder',..) Learn more:
ERROR:root:Failed to get supported params: argument of type ‘NoneType’ is not iterable
ERROR:root:LiteLLM call failed: litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=meta-llama/Llama-3.2-3B-Instruct
Pass model as E.g. For ‘Huggingface’ inference endpoints pass in `completion(model=

In this thread I provided an example configuration for Hugging Face models. Hope it helps.