
Vultr Serverless Inference allows you to run inference workloads for large language models such as Mixtral 8x7B, Mistral 7B, Meta Llama 2 70B, and more. Using Vultr Serverless Inference, you can run inference workloads without having to worry about the infrastructure, and you only pay for the input and output tokens.
This article demonstrates step-by-step process to start using Vultr Serverless Inference in Node.js with Langchain.
Before you begin, you must:
Create a new project directory and navigate to the project directory.
.Create a new Node.js project.
Install the required Node.js packages.
Langchain provides a Node.js SDK to run inference workloads for Vultr Serverless Inference. You can use the @langchain/openai package to make the API calls.
Create a new JavaScript file name inference-langchain.js.
Add the following code to inference-langchain.js.
Run the inference-langchain.js file.
Here, the inference-langchain.js file uses the @langchain/openai package to run inference workloads for Vultr Serverless Inference. Langchain uses Langchain Expression Language (LCEL) for defining different types of messages such as HumanMessage and SystemMessage. For more information, refer to the Langchain documentation.
In this article, you learned how to use Vultr Serverless Inference in Node.js with Langchain. You can now integrate Vultr Serverless Inference into your Node.js applications that uses Langchain to generate completions for large language models.
0 Comments
Be the first to comment and share your perspective with the community.