ColinEberhardt/langchain-mini
์๊ฐ
๐ฆ๏ธ๐ This is a very simple re-implementation of LangChain, in ~100 lines of code
๊ฐ๋ฐ ๋๊ตฌ์ธก์ ๋ ์คํ ์ฆ๊ฐ
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- ๊ธฐ๋ก ์์ง ์ค
- in 1 month
- ๊ธฐ๋ก ์์ง ์ค
์๋ก ๊ฒน์น๋ ๊ธฐ๊ฐ์ ์์ฆ๊ฐ๋์ด๋ฉฐ ์ผ๋ณ ํฉ๊ณ๊ฐ ์๋๋๋ค. ์ธก์ ๊ฐ์ด ์์ผ๋ฉด ๋น์ ๋ก๋๋ค. ์คํ๋ ๊ด์ฌ๋๋ฅผ ๋ํ๋ด๋ฉฐ ํ์ง์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
README.md
Original๐ฆ๏ธ๐ LangChain-mini
This is a very simple re-implementation of LangChain, in ~100 lines of code. In essence, it is an LLM (GPT-3.5) powered chat application that is able to use tools (Google search and a calculator) in order to hold conversations and answer questions.
Here's an example:
Q: What is the world record for solving a rubiks cube?
The world record for solving a Rubik's Cube is 4.69 seconds, held by Yiheng Wang (China).
Q: Can a robot solve it faster?
The fastest time a robot has solved a Rubik's Cube is 0.637 seconds.
Q: Who made this robot?
Infineon created the robot that solved a Rubik's Cube in 0.637 seconds.
Q: What time would an average human expect for solving?
It takes the average person about three hours to solve a Rubik's cube for the first time.
This is not intended to be a replacement for LangChain, instead it was built for fun and educational purposes. If you're interested in how LangChain, and similar tools work, this is a good starting point.
For more information about this project, read the accompanying blogpost - Re-implementing LangChain in 100 lines of code
Running / developing
Install dependencies, and run (with node >= v18):
% npm install
You'll need to have both an OpenAI and SerpApi keys. These can be supplied to the application via a .env file:
OPENAI_API_KEY="..."
SERPAPI_API_KEY="..."
You can now run the chain:
% node index.mjs
How can I help? what was the name of the first man on the moon?
Neil Armstrong
๊ด๋ จ ํ๋ก์ ํธ ์ดํด๋ณด๊ธฐ
๋ถ๋ฌ์ค๋ ์คโฆ