Skip to content

An example of using LangChain in JavaScript with @langchain/core

Notifications You must be signed in to change notification settings

jeantessier/langchain-javascript-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LangChain JavaScript Example

A sample Node script that uses LangChain to talk to LLMs.

You’ll need an API key for each LLM. So just follow the instructions linked below to obtain your API keys.

Save the keys to the app/src/main/resources/.env file as the corresponding ..._API_KEY environment variable. You can use app/src/main/resources/.env.template as a guide to structure your .env file.

Install packages, if you haven't already.

pnpm install

To Run

The sample logic is in the file index.js.

To run against OpenAI's ChatGPT:

pnpm run main --model openai

To run against Anthropic's Claude:

pnpm run main --model anthropic

To run against Google's Gemini:

pnpm run main --model google

To run against DeekSeek's R1:

pnpm run main --model deepseek

If you don't specify --model, it will default to openai and use ChatGPT.

About

An example of using LangChain in JavaScript with @langchain/core

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published