from langchain_huggingface import HuggingFaceEndpoint , ChatHuggingFace
from dotenv import load_dotenv
import os
load_dotenv()
hf_key=os.getenv(“HUGGINGFACEHUB_API_KEY”)
#print(hf_key)
llm = HuggingFaceEndpoint(
repo_id=“google/flan-t5-base”,
task=“text-generation”,
huggingfacehub_api_token=hf_key
)
model=ChatHuggingFace(llm=llm)
result = model.invoke(“What is the capital of India?”)
print(result)
I am trying on all models with all three types of keys but still have no luck getting result, it basically shows NoneType object is not iterable.
This code was working fine till yesterday but today its not working. Why? can someone suggest a fix i am fed up now of trying all different models and all, btw its working fine locally.