mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-06 09:55:21 +03:00
- Updated `langchain/docs/modules/models/llms/integrations/` notebooks: added links to the original sites, the install information, etc. - Added the `nlpcloud` notebook. - Removed "Example" from Titles of some notebooks, so all notebook titles are consistent.
4.0 KiB
4.0 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)