mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-05 17:35:28 +03:00
3.3 KiB
3.3 KiB
In [ ]:
$ pip3 install petalsIn [ ]:
import os
from langchain.llms import Petals
from langchain import PromptTemplate, LLMChainIn [ ]:
os.environ["HUGGINGFACE_API_KEY"] = "YOUR_KEY_HERE"In [ ]:
llm = Petals(model_name="bigscience/bloom-petals")In [ ]:
template = """Question: {question}
Answer: Let's think step by step."""
prompt = PromptTemplate(template=template, input_variables=["question"])In [ ]:
llm_chain = LLMChain(prompt=prompt, llm=llm)In [ ]:
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"
llm_chain.run(question)