- load_dotenv
- HuggingFaceHub
- LLMChain
- PromptTemplate
load_dotenv()
model_id = "gpt2-medium"
con_model = HuggingFaceHub(repo_id=model_id, model_kwargs={"temperature":0.8, "max_new_tokens":200})
prompt = PromptTemplate(
input_variables=["question"],
template="You are a Amirican telling the storey about India and its culture: {question}"
)
This is the one responcible to perform action
chain = LLMChain(prompt=prompt, llm=con_model, verbose=True)
res = chain.run(str)
print(res)