langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
91.43k stars 14.55k forks source link

JS/TS REPL #2130

Closed slavakurilyak closed 11 months ago

slavakurilyak commented 1 year ago

It would be great to see a JavaScript/TypeScript REPL as a LangChain tool.

Consider ts-node which is a TypeScript execution and REPL for Node.js, with source map and native ESM support. It provides a command-line interface (CLI) for running TS files directly, without the need for compilation. To use ts-node, you need to have Node.js and npm installed on your system. You can install ts-node globally using npm as follows:

npm install -g ts-node

Once installed, you can run a TypeScript file using ts-node as follows:

ts-node myfile.ts

slavakurilyak commented 1 year ago

Here's a quick hack - use prompt engineering to create a JS console.

I want you to act as a Javascript console. I will type commands and you will reply with what the Javascript console should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English, I will do so by putting text inside curly brackets {like this}. My first command is console.log("Hello World");

dosubot[bot] commented 1 year ago

Hi, @slavakurilyak! I'm Dosu, and I'm here to help the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you requested a JavaScript/TypeScript REPL as a LangChain tool, and you suggested using ts-node to run TypeScript files directly without compilation. In the comments, you provided a quick hack using prompt engineering to create a JS console and gave an example command console.log("Hello World"); to demonstrate the desired functionality.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution!