[Python] How to configure HuggingFaceEndpoint in Langchain

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use this model

    from langchain_huggingface import HuggingFaceEndpoint
    repo_id="google/flan-t5-large"
    huggingface_llm = HuggingFaceEndpoint(
    huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
    repo_id=repo_id,
    temperature=0,
    max_new_tokens=200)

    from langchain.prompts import PromptTemplate
    def flan_process(tema, pregunta):
    template = "Eres un experto asistente en {tema}. Responde a la siguiente pregunta: {pregunta}"
    prompt=PromptTemplate(template=template,input_variables=["tema","pregunta"])

    flan_chain = prompt | huggingface_llm

    respuesta=flan_chain.invoke({"tema":tema, "pregunta":pregunta})

    return respuesta

    tema=input("Ingrese el tema: ")
    pregunta=input("Ingrese la pregunta: ")

    flan_reply=flan_process(tema, pregunta)
    print(f"Respuesta Flan: {flan_reply}")


    But I always get this error The following model_kwargs are not used by the model: ['return_full_text', 'watermark', 'stop_sequences', 'stop'] (note: typos in the generate arguments will also show up in this list)

    Any idea please?

    Thanks

    Continue reading...

Compartilhe esta Página