Exception has occurred: StopIteration exception: no description File "/home/swaraj/sj_code/langchain_hf_demo/LLMs/hf_demo.py", line 14, in <module> result = model.invoke("What is the capital of India?") StopIteration:

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.

1 Like

This code was working fine till yesterday but today its not working.

Weird…

google/flan-t5-base

I don’t know what other models have been tried, but this model does not appear to be currently deployed. The embedding models currently deployed are these.