Cerebrium is an AWS Sagemaker alternative. It also provides API access to several LLM models.
This notebook goes over how to use LangChain with CerebriumAI.
Install cerebrium
Thecerebrium package is required to use the CerebriumAI API. Install cerebrium using pip3 install cerebrium.
Imports
Set the Environment API Key
Make sure to get your API key from CerebriumAI. See here. You are given a 1 hour free of serverless GPU compute to test different models.Create the CerebriumAI instance
You can specify different parameters such as the model endpoint url, max length, temperature, etc. You must provide an endpoint url.Create a Prompt Template
We will create a prompt template for Question and Answer.Initiate the LLMChain
Run the LLMChain
Provide a question and run the LLMChain.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.