LangChain JS

Usage

The following code snippet

import { ChatOpenAI } from "langchain/chat_models/openai";
import { HumanMessage } from "langchain/schema";

async function main() {
  const chat = new ChatOpenAI({
    modelName: "gpt-3.5-turbo",
    openAIApiKey: "My OPENAI Key",
  });

  await chat.call([new HumanMessage("Say this is a test")]);
}

main();

becomes

import { ChatOpenAI } from "langchain/chat_models/openai";
import { HumanMessage } from "langchain/schema";

async function main() {
  const chat = new ChatOpenAI({
    modelName: "router",
    configuration: {
      baseURL: "https://withmartian.com/api/openai/v1",
    },
    openAIApiKey: "My MARTIAN Key",
  });

  await chat.call([new HumanMessage("Say this is a test")]);
}

main();

Last updated