Skip to main content

Getting Started: LLMs

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