Skip to content

Commit

Permalink
ReAct chain example created (#298)
Browse files Browse the repository at this point in the history
* Added Java code into ts branch

* ReAct example added.

* Update react-chain.jsonnet
  • Loading branch information
Harsh4902 authored Dec 20, 2023
1 parent 291c748 commit 0da013c
Show file tree
Hide file tree
Showing 11 changed files with 8,522 additions and 0 deletions.
8 changes: 8 additions & 0 deletions JS/edgechains/examples/react-chain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# standard exclusions
node_modules

# build artifacts
dist

# environment files
.env
13 changes: 13 additions & 0 deletions JS/edgechains/examples/react-chain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## How to run ReActChain:-

- Use the following command in the root directory to run this example:

`npm i`

`npm run build`

`npm start`

- To use this example make a `POST` request call on `http://localhost:3000/react-chain`.
- Request body:
`{"prompt": "Your Search Topic"}`
45 changes: 45 additions & 0 deletions JS/edgechains/examples/react-chain/esbuild.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const esbuild = require("esbuild");
const path = require("path");
const fs = require("fs");
const { execSync } = require("child_process");

const outputDir = path.resolve(__dirname, "dist");

if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}

const distPath = path.join(process.cwd(), "dist");

fs.promises.mkdir(distPath, { recursive: true });

esbuild
.build({
entryPoints: ["./src/index.ts"],
bundle: true,
minify: true,
platform: "node",
outfile: "./dist/index.js",
tsconfig: "./tsconfig.json",
target: "node21.1.0",
external: [
"express",
"tsx",
"typescript",
"typeorm",
"react",
"react-dom",
"pg",
"jsdom",
"hono",
"@hanazuki/node-jsonnet",
"readline/promises",
],
format: "cjs",
loader: {
".html": "text",
".css": "css",
".jsonnet": "text",
},
})
.catch(() => process.exit(1));
11 changes: 11 additions & 0 deletions JS/edgechains/examples/react-chain/ormconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "postgres",
"host": "db.rmzqtepwnzoxgkkzjctt.supabase.co",
"port": 5432,
"username": "postgres",
"password": "xaX0MYcf1YiJlChK",
"database": "postgres",
"entities": ["dist/entities/**/*.js"],
"synchronize": false,
"logging": false
}
Loading

0 comments on commit 0da013c

Please sign in to comment.