mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-16 12:16:41 +00:00
4.3 KiB
4.3 KiB
In [ ]:
!pip3 install petalsIn [4]:
import os
from langchain.llms import Petals
from langchain import PromptTemplate, LLMChainIn [2]:
from getpass import getpass
HUGGINGFACE_API_KEY = getpass()········
In [5]:
os.environ["HUGGINGFACE_API_KEY"] = HUGGINGFACE_API_KEYIn [ ]:
# this can take several minutes to download big files!
llm = Petals(model_name="bigscience/bloom-petals")Downloading: 1%|▏ | 40.8M/7.19G [00:24<15:44, 7.57MB/s]
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)