Getting Started: LLMs
info
LangChain provides a standard interface for using a variety of LLMs.
To get started, simply use the call
method of an LLM
implementation, passing in a string
input. In this example, we are using the OpenAI
implementation:
import { OpenAI } from "langchain/llms/openai";
export const run = async () => {
const model = new OpenAI();
// `call` is a simple string-in, string-out method for interacting with the model.
const resA = await model.call(
"What would be a good company name a company that makes colorful socks?"
);
console.log({ resA });
// { resA: '\n\nSocktastic Colors' }
};
Dig deeper
📄️ Integrations
LangChain offers a number of LLM implementations that integrate with various model providers. These are:
📄️ Additional Functionality
We offer a number of additional features for LLMs. In most of the examples below, we'll be using the OpenAI LLM. However, all of these features are available for all LLMs.