Giter Site home page Giter Site logo

emmanuel-umeh / langchain-js-quickstart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from starmorph/langchain-js-quickstart

0.0 0.0 0.0 20 KB

A node.js single file app with a basic langchain script that uses OpenAI to generate a react component code snippet.

TypeScript 100.00%

langchain-js-quickstart's Introduction

Get Started with Langchain JS

a basic node.js template to run langchain.js

How to use this template

All you need to do is

  1. add your OpenAI API key to the .env file OPENAI_API_KEY=YOUR-KEY and

  2. run the app with the following command

npm install && npm run dev 

After that, you can edit the app.ts file to change the prompt.

app.ts uses langchain with OpenAI to generate a code snippet, format the response, and save the output (a complete react component) to a file.

How this template was built

  1. install dependencies
npm init es6 -y && npm install langchain openai dotenv @types/node
  1. setup node project
typescript ts-node 
npx tsc --init --rootDir src --outDir ./dist --esModuleInterop --lib ES2020 --target ES2020 --module nodenext --noImplicitAny true
  1. Update Package.json
  "scripts": { 
      "build": "tsc", 
      "start": "node ./dist/app.js", 
      "dev": "ts-node --esm ./src/app.ts"
  },
  1. Create app.ts in the src folder.
mkdir src 
echo "console.log('Welcome to the LangChain.js tutorial by LangChainers.')" > src/app.ts
  1. boot up
npm run build
npm run start

I followed this Blog post tutorial to setup the initial node environment.

langchain-js-quickstart's People

Contributors

starmorph avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.