Error While using langchain with huggingface models
from langchain_core.prompts import PromptTemplate from langchain_community.llms import HuggingFaceEndpoint import os
os.environ[“HUGGINGFACEHUB_API_TOKEN”] = “hf_your_new_token_here”
prompt = PromptTemplate( input_variables=[“product”], template=“What is a good name for a company that makes {product}?” )
llm = HuggingFaceEndpoint( repo_id=“mistralai/Mistral-7B-Instruct-v0.3”, temperature=0.7, timeout=300
)
chains = prompt | llm print(“LLM Initialized with Token!”)
try: response = chains.invoke({“product”: “camera”}) print(“AI Suggestion:”, response) except Exception as e: print(f"Error details: {e}")
when i run this i get Value error can anyone help me out? Its a basic prompt template and text gen code but still it doesnt work i used various models from Huggingface and its not working well with langchain while chaining the llm with prompt and invoking it.
Discussion in the ATmosphere