{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreibaneosn5wydt6hhhmp5dwi6fx45fjaqtowrflgjxn2yir32m5azu",
    "uri": "at://did:plc:pgryn3ephfd2xgft23qokfzt/app.bsky.feed.post/3miqirndbgnq2"
  },
  "path": "/t/error-while-using-langchain-with-huggingface-models/174977#post_1",
  "publishedAt": "2026-04-05T06:52:16.000Z",
  "site": "https://discuss.huggingface.co",
  "textContent": "from langchain_core.prompts import PromptTemplate\nfrom langchain_community.llms import HuggingFaceEndpoint\nimport os\n\nos.environ[“HUGGINGFACEHUB_API_TOKEN”] = “hf_your_new_token_here”\n\nprompt = PromptTemplate(\ninput_variables=[“product”],\ntemplate=“What is a good name for a company that makes {product}?”\n)\n\nllm = HuggingFaceEndpoint(\nrepo_id=“mistralai/Mistral-7B-Instruct-v0.3”,\ntemperature=0.7,\ntimeout=300\n\n)\n\nchains = prompt | llm\nprint(“LLM Initialized with Token!”)\n\ntry:\nresponse = chains.invoke({“product”: “camera”})\nprint(“AI Suggestion:”, response)\nexcept Exception as e:\nprint(f\"Error details: {e}\")\n\nwhen 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.",
  "title": "Error While using langchain with huggingface models"
}