Compare commits

...

24 Commits

Author SHA1 Message Date
sweep-ai[bot] babc6a0242 Merge main into sweep/add-evaluation-method 2023-11-14 17:16:34 +00:00
sweep-ai[bot] e97d4af275 Merge main into sweep/add-evaluation-method 2023-11-14 17:09:22 +00:00
sweep-ai[bot] 5ee9af361d Merge main into sweep/add-evaluation-method 2023-11-14 04:20:00 +00:00
sweep-ai[bot] 9a07e71243 Merge main into sweep/add-evaluation-method 2023-11-14 04:00:12 +00:00
sweep-ai[bot] a7ee7c9e35 Merge main into sweep/add-evaluation-method 2023-11-14 02:10:44 +00:00
sweep-ai[bot] 9ae305baa8 Merge main into sweep/add-evaluation-method 2023-11-14 02:02:16 +00:00
sweep-ai[bot] 83745aa579 Merge main into sweep/add-evaluation-method 2023-11-14 01:59:06 +00:00
sweep-ai[bot] 029eda4166 Merge main into sweep/add-evaluation-method 2023-11-10 03:12:29 +00:00
sweep-ai[bot] 8ddfcbfb93 Merge main into sweep/add-evaluation-method 2023-11-06 20:59:04 +00:00
sweep-ai[bot] 13b555ffc7 Merge main into sweep/add-evaluation-method 2023-11-06 20:58:31 +00:00
sweep-ai[bot] b50d254e50 Merge main into sweep/add-evaluation-method 2023-11-06 19:00:15 +00:00
sweep-ai[bot] 2c045643a8 Merge main into sweep/add-evaluation-method 2023-11-06 18:51:14 +00:00
sweep-ai[bot] d7dafc3ec4 Merge main into sweep/add-evaluation-method 2023-11-03 01:05:39 +00:00
sweep-ai[bot] e8d8e3df59 Merge main into sweep/add-evaluation-method 2023-10-30 20:59:23 +00:00
sweep-ai[bot] dbd4e1c892 Merge main into sweep/add-evaluation-method 2023-10-30 17:56:41 +00:00
sweep-ai[bot] 86e4242f04 feat: Updated packages/core/src/QueryResponseEvalu 2023-10-30 11:36:11 +00:00
sweep-ai[bot] 4f02b0ad98 feat: Updated packages/core/src/QueryResponseEvalu 2023-10-30 11:35:01 +00:00
sweep-ai[bot] 21024425cb feat: Updated CI/CD configuration file 2023-10-30 11:32:40 +00:00
sweep-ai[bot] cdc129aeaa feat: Updated CI/CD configuration file 2023-10-30 11:31:34 +00:00
sweep-ai[bot] c1c1910f11 feat: Updated CONTRIBUTING.md 2023-10-30 11:30:14 +00:00
sweep-ai[bot] 06a7a6bfdd feat: Add QueryResponseEvaluator class for evaluat 2023-10-30 11:29:08 +00:00
sweep-ai[bot] 6b831632fa feat: Update CI/CD pipeline to run eslint on .js a 2023-10-30 11:27:30 +00:00
sweep-ai[bot] 96a7ed14aa feat: Updated CONTRIBUTING.md 2023-10-30 11:26:25 +00:00
sweep-ai[bot] 60d0864043 feat: Add ResponseEvaluator class for response eva 2023-10-30 11:25:11 +00:00
4 changed files with 63 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.OS }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.OS }}-node-
- run: pnpm install
- run: pnpm eslint --fix "./**/*.ts" "./**/*.js"
- run: pnpm run test
+12 -2
View File
@@ -31,11 +31,21 @@ PNPM's has documentation on its [workspace feature](https://pnpm.io/workspaces)
### Running Typescript
When we publish to NPM we will have a tsc compiled version of the library in JS. For now, the easiest thing to do is use ts-node.
When we publish to NPM we will have a tsc compiled version of the library in JS. For now, the easiest thing to do is use ts-node. To run a TypeScript file, use the following command:
```
pnpx ts-node {file_path}
```
### Test cases
To run them, run
Before running the tests, compile the TypeScript files to JavaScript. This can be done by running the following command:
```
pnpm run build
```
After the build process is complete, you can run the tests with:
```
pnpm run test
@@ -0,0 +1,12 @@
import { Response } from './Response';
import { BaseQueryEngine } from './QueryEngine';
import { ResponseEvaluator } from './ResponseEvaluator';
export class QueryResponseEvaluator {
evaluate(query: string, response: Response, queryEngine: BaseQueryEngine): number {
const evaluator = new ResponseEvaluator(queryEngine);
const binaryEvaluation = evaluator.binaryEvaluation(query, response);
const nodeEvaluation = evaluator.nodeEvaluation(query, response);
return binaryEvaluation && nodeEvaluation ? 1 : 0;
}
}
+12
View File
@@ -0,0 +1,12 @@
import { Response } from './Response';
import { BaseNode } from './Node';
export class ResponseEvaluator {
binaryEvaluation(response: Response, context: string): boolean {
return response.toString() === context;
}
nodeEvaluation(query: string, node: BaseNode): boolean {
return node.toString().includes(query);
}
}