-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding rap challenge example * adding readme
1 parent
092be44
commit ee42816
Showing
8 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
local promptTemplate = ||| | ||
go to https://rpachallenge.com/ and click on the start button we have fiels in this pattern First Name Last Name Company Name Role in Company Address Email Phone Number and then fill this fields John Smith IT Solutions Analyst 98 North Road [email protected] 40716543298 in the given inputs and click the input with value Submit and then fill this fields Jane Dorsey MediCare Medical Engineer 11 Crown Street [email protected] 40791345621 in the given inputs and click the input with value Submit and then fill this fields Albert Kipling Waterfront Accountant 22 Guild Street [email protected] 40735416854 in the given inputs and click the input with value Submit and then fill this fields Michael Robertson MediCare IT Specialist 17 Farburn Terrace [email protected] 40733652145 in the given inputs and click the input with value Submit and then fill this fields Doug Derrick Timepath Inc. Analyst 99 Shire Oak Road [email protected] 40799885412 in the given inputs and click the input with value Submit and then fill this fields Jessie Marlowe Aperture Inc. Scientist 27 Cheshire Street [email protected] in the given inputs and click the input with value Submit and then fill this fields Stan Hamm Sugarwell Advisor 10 Dam Road [email protected] 40712462257 in the given inputs and click the input with value Submit and then fill this fields Michelle Norton Aperture Inc. Scientist 13 White Rabbit Street [email protected] 40731254562 in the given inputs and click the input with value Submit and then fill this fields Stacy Shelby TechDev HR Manager 19 Pineapple Boulevard [email protected] 40741785214 in the given inputs and click the input with value Submit and then fill this fields Lara Palmer Timepath Inc. Programmer 87 Orange Street [email protected] 40731653845 in the given inputs and click the input with value Submit | ||
|||; | ||
local key = std.extVar('openai_api_key'); | ||
local content = arakoo.native("call")({task:promptTemplate, openai:key}); | ||
content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
local OPENAI_API_KEY = "sk-***"; | ||
|
||
{ | ||
"openai_api_key":OPENAI_API_KEY, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "summarizer-app", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type": "module", | ||
"keywords": [], | ||
"author": "", | ||
"scripts": { | ||
"start": "tsc && node --experimental-wasm-modules ./dist/index.js" | ||
}, | ||
"license": "ISC", | ||
"dependencies": { | ||
"@arakoodev/edgechains.js": "file:../../arakoodev", | ||
"@arakoodev/jsonnet": "^0.25.0", | ||
"file-uri-to-path": "^2.0.0", | ||
"path": "^0.12.7", | ||
"sync-rpc": "^1.3.6", | ||
"zod": "^3.23.8" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.14.1", | ||
"@types/request": "^2.48.12" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## Video | ||
|
||
``` | ||
https://youtu.be/iqph8HA4nas | ||
``` | ||
|
||
## Installation | ||
|
||
1. Install the required dependencies: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
## Configuration | ||
|
||
1 Add OpenAiApi key in secrets.jsonnet | ||
`bash | ||
local OPENAI_API_KEY = "sk-****"; | ||
` | ||
|
||
## Usage | ||
|
||
1. Start the server: | ||
|
||
```bash | ||
npm run start | ||
``` | ||
|
||
2. Hit the `GET` endpoint. | ||
|
||
```bash | ||
http://localhost:3000/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ArakooServer } from "@arakoodev/edgechains.js/arakooserver"; | ||
import Jsonnet from "@arakoodev/jsonnet"; | ||
//@ts-ignore | ||
import createClient from "@arakoodev/edgechains.js/sync-rpc"; | ||
import fileURLToPath from "file-uri-to-path"; | ||
import path from "path"; | ||
const server = new ArakooServer(); | ||
|
||
const app = server.createApp(); | ||
|
||
const jsonnet = new Jsonnet(); | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const call = createClient(path.join(__dirname, "./lib/playwright.cjs")); | ||
app.get("/", async (c: any) => { | ||
const key = JSON.parse( | ||
jsonnet.evaluateFile(path.join(__dirname, "../jsonnet/secrets.jsonnet")) | ||
).openai_api_key; | ||
|
||
jsonnet.extString("openai_api_key", key); | ||
jsonnet.javascriptCallback("call", call); | ||
let response = jsonnet.evaluateFile(path.join(__dirname, "../jsonnet/main.jsonnet")); | ||
return c.text(response); | ||
}); | ||
|
||
server.listen(3000); |
12 changes: 12 additions & 0 deletions
12
JS/edgechains/examples/rpa-challenge/src/lib/playwright.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Playwright } from "@arakoodev/edgechains.js/scraper"; | ||
|
||
async function call({ task, openai }: { task: string, openai: string }) { | ||
const scraper = new Playwright({ apiKey: openai }); | ||
try { | ||
return await scraper.call({ task, headless: false }); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
} | ||
|
||
module.exports = call; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"moduleResolution": "NodeNext", | ||
"module": "NodeNext", | ||
"rootDir": "./src", | ||
"outDir": "./dist", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "hono/jsx" | ||
}, | ||
"exclude": ["./**/*.test.ts", "vitest.config.ts"] | ||
} |