text: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsAI21Aleph AlphaAmazon API GatewayAnyscaleAzure OpenAIAzureML Online EndpointBananaBasetenBeamBedrockCerebriumAIChatGLMClarifaiCohereC TransformersDatabricksDeepInfraForefrontAIGoogle Cloud Platform Vertex AI PaLMGooseAIGPT4AllHugging Face HubHugging Face Local PipelinesHuggingface TextGen InferenceJSONFormerKoboldAI APILlama-cppCaching integrationsManifestModalMosaicMLNLP CloudoctoaiOpenAIOpenLLMOpenLMPetalsPipelineAIPredibasePrediction GuardPromptLayer OpenAIRELLMReplicateRunhouseSageMakerEndpointStochasticAITextGenTongyi QwenWriterMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerIntegrationsLLMsPetalsOn this pagePetalsPetals runs 100B+ language models at home, BitTorrent-style.This notebook goes over how to use Langchain with Petals.Install petalsâ€‹The petals package is required to use the Petals API. Install petals using pip3 install petals.pip3 install petalsImportsâ€‹import osfrom langchain.llms import Petalsfrom langchain import PromptTemplate, LLMChainSet the Environment API Keyâ€‹Make sure to get your API key from Huggingface.from getpass import getpassHUGGINGFACE_API_KEY = getpass()     Â·Â·Â·Â·Â·Â·Â·Â·os.environ["HUGGINGFACE_API_KEY"] = HUGGINGFACE_API_KEYCreate the Petals instanceâ€‹You can specify different parameters