@garrix82/reactgenie-dsl 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +10 -0
- package/.env.example +17 -0
- package/.github/workflows/publish.yml +20 -0
- package/README.md +5 -1
- package/package.json +1 -5
- package/dist/__test__/dsl-descriptor.test.d.ts +0 -1
- package/dist/__test__/dsl-descriptor.test.js +0 -27
- package/dist/__test__/dsl-descriptor.test.js.map +0 -1
- package/dist/__test__/example_descriptor.d.ts +0 -125
- package/dist/__test__/example_descriptor.js +0 -607
- package/dist/__test__/example_descriptor.js.map +0 -1
- package/dist/__test__/food_descriptor.state.json +0 -1
- package/dist/__test__/food_descriptor.test.d.ts +0 -74
- package/dist/__test__/food_descriptor.test.js +0 -205
- package/dist/__test__/food_descriptor.test.js.map +0 -1
- package/dist/__test__/nl-interpreter-provider-selection.test.d.ts +0 -1
- package/dist/__test__/nl-interpreter-provider-selection.test.js +0 -73
- package/dist/__test__/nl-interpreter-provider-selection.test.js.map +0 -1
- package/dist/__test__/nl-interpreter.test.d.ts +0 -1
- package/dist/__test__/nl-interpreter.test.js +0 -86
- package/dist/__test__/nl-interpreter.test.js.map +0 -1
- package/dist/decorators/__test__/decorators.test.d.ts +0 -1
- package/dist/decorators/__test__/decorators.test.js +0 -182
- package/dist/decorators/__test__/decorators.test.js.map +0 -1
- package/dist/decorators/__test__/inheritance-descriptor.test.d.ts +0 -1
- package/dist/decorators/__test__/inheritance-descriptor.test.js +0 -107
- package/dist/decorators/__test__/inheritance-descriptor.test.js.map +0 -1
- package/dist/dsl/__test__/dsl-interpreter.test.d.ts +0 -1
- package/dist/dsl/__test__/dsl-interpreter.test.js +0 -334
- package/dist/dsl/__test__/dsl-interpreter.test.js.map +0 -1
- package/dist/dsl/__test__/parser.gen.test.d.ts +0 -1
- package/dist/dsl/__test__/parser.gen.test.js +0 -283
- package/dist/dsl/__test__/parser.gen.test.js.map +0 -1
- package/dist/nl/__test__/context-aware-prompt.test.d.ts +0 -1
- package/dist/nl/__test__/context-aware-prompt.test.js +0 -247
- package/dist/nl/__test__/context-aware-prompt.test.js.map +0 -1
- package/dist/nl/__test__/context-selector.test.d.ts +0 -1
- package/dist/nl/__test__/context-selector.test.js +0 -20
- package/dist/nl/__test__/context-selector.test.js.map +0 -1
- package/dist/nl/__test__/nl-parser-groq-transport.test.d.ts +0 -1
- package/dist/nl/__test__/nl-parser-groq-transport.test.js +0 -87
- package/dist/nl/__test__/nl-parser-groq-transport.test.js.map +0 -1
- package/dist/nl/__test__/nl-parser-openai-parity.test.d.ts +0 -1
- package/dist/nl/__test__/nl-parser-openai-parity.test.js +0 -206
- package/dist/nl/__test__/nl-parser-openai-parity.test.js.map +0 -1
- package/dist/nl/__test__/nl-parser-openai-sampling.test.d.ts +0 -1
- package/dist/nl/__test__/nl-parser-openai-sampling.test.js +0 -44
- package/dist/nl/__test__/nl-parser-openai-sampling.test.js.map +0 -1
- package/dist/nl/__test__/nl-parser-openai-transport.test.d.ts +0 -1
- package/dist/nl/__test__/nl-parser-openai-transport.test.js +0 -55
- package/dist/nl/__test__/nl-parser-openai-transport.test.js.map +0 -1
- package/dist/nl/__test__/nl-parser-utils.test.d.ts +0 -1
- package/dist/nl/__test__/nl-parser-utils.test.js +0 -70
- package/dist/nl/__test__/nl-parser-utils.test.js.map +0 -1
- package/dist/nl/__test__/nl-parser.test.d.ts +0 -1
- package/dist/nl/__test__/nl-parser.test.js +0 -64
- package/dist/nl/__test__/nl-parser.test.js.map +0 -1
- package/dist/nl/__test__/parameter-tuning.test.d.ts +0 -1
- package/dist/nl/__test__/parameter-tuning.test.js +0 -95
- package/dist/nl/__test__/parameter-tuning.test.js.map +0 -1
- package/dist/nl/__test__/semantic-parsing-experiment.test.d.ts +0 -1
- package/dist/nl/__test__/semantic-parsing-experiment.test.js +0 -178
- package/dist/nl/__test__/semantic-parsing-experiment.test.js.map +0 -1
- package/dist/nl/llm-monitoring.test.d.ts +0 -5
- package/dist/nl/llm-monitoring.test.js +0 -101
- package/dist/nl/llm-monitoring.test.js.map +0 -1
- package/lib/__test__/dsl-descriptor.test.ts +0 -27
- package/lib/__test__/example_descriptor.ts +0 -762
- package/lib/__test__/food_descriptor.state.json +0 -1
- package/lib/__test__/food_descriptor.test.ts +0 -331
- package/lib/__test__/nl-interpreter-provider-selection.test.ts +0 -126
- package/lib/__test__/nl-interpreter.test.ts +0 -129
- package/lib/decorators/__test__/decorators.test.ts +0 -177
- package/lib/decorators/__test__/inheritance-descriptor.test.ts +0 -92
- package/lib/decorators/decorators.ts +0 -754
- package/lib/decorators/index.ts +0 -2
- package/lib/decorators/store.ts +0 -47
- package/lib/dsl/__test__/dsl-interpreter.test.ts +0 -453
- package/lib/dsl/__test__/parser.gen.test.ts +0 -296
- package/lib/dsl/dsl-interpreter.ts +0 -974
- package/lib/dsl/index.ts +0 -1
- package/lib/dsl/parser.gen.js +0 -1479
- package/lib/dsl/parser.pegjs +0 -130
- package/lib/dsl-descriptor.ts +0 -241
- package/lib/index.ts +0 -5
- package/lib/nl/__test__/context-aware-prompt.test.ts +0 -372
- package/lib/nl/__test__/context-selector.test.ts +0 -27
- package/lib/nl/__test__/nl-parser-groq-transport.test.ts +0 -139
- package/lib/nl/__test__/nl-parser-openai-parity.test.ts +0 -381
- package/lib/nl/__test__/nl-parser-openai-sampling.test.ts +0 -73
- package/lib/nl/__test__/nl-parser-openai-transport.test.ts +0 -79
- package/lib/nl/__test__/nl-parser-utils.test.ts +0 -98
- package/lib/nl/__test__/nl-parser.test.ts +0 -119
- package/lib/nl/__test__/parameter-tuning.test.ts +0 -137
- package/lib/nl/__test__/semantic-parsing-experiment.test.ts +0 -260
- package/lib/nl/context-selector.ts +0 -123
- package/lib/nl/index.ts +0 -19
- package/lib/nl/llm-monitoring.test.ts +0 -136
- package/lib/nl/llm-monitoring.ts +0 -339
- package/lib/nl/nl-parser-groq.ts +0 -510
- package/lib/nl/nl-parser-utils.ts +0 -310
- package/lib/nl/nl-parser.ts +0 -616
- package/lib/nl/prompt-gen.ts +0 -607
- package/lib/nl/prompt-res.ts +0 -207
- package/lib/nl-interpreter.ts +0 -262
package/.env
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
GROQ_API_BASE_URL=https://api.groq.com/openai/v1
|
|
2
|
+
GROQ_API_KEY=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
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# LangSmith Cloud Monitoring
|
|
6
|
+
LANGSMITH_API_KEY=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
|
|
7
|
+
LANGSMITH_PROJECT=ReactGenieDSL
|
|
8
|
+
|
|
9
|
+
#models
|
|
10
|
+
SEMANTIC_MODEL=llama-3.3-70b-versatile
|
package/.env.example
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# copy this file to .env and fill in the values
|
|
2
|
+
|
|
3
|
+
# OpenAI API Configuration (if using OpenAI parser)
|
|
4
|
+
OPENAI_API_KEY=sk-xxx # your openai api key
|
|
5
|
+
OPENAI_API_BASE_URL=https://api.openai.com/v1
|
|
6
|
+
|
|
7
|
+
# Groq API Configuration
|
|
8
|
+
GROQ_API_KEY=your_groq_api_key_here
|
|
9
|
+
GROQ_API_BASE_URL=https://api.groq.com/openai/v1
|
|
10
|
+
|
|
11
|
+
# LangSmith Cloud Monitoring
|
|
12
|
+
# Get your API key from: https://smith.langchain.com/
|
|
13
|
+
LANGSMITH_API_KEY=your_langsmith_api_key_here
|
|
14
|
+
LANGSMITH_PROJECT=your_project_name
|
|
15
|
+
|
|
16
|
+
# Semantic Model Configuration
|
|
17
|
+
SEMANTIC_MODEL=your_semantic_model_name_here
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Publish to NPM if new version
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- uses: actions/setup-node@v3
|
|
13
|
+
with:
|
|
14
|
+
node-version: "20.9.0"
|
|
15
|
+
- run: npm ci
|
|
16
|
+
# - run: npm test
|
|
17
|
+
- uses: JS-DevTools/npm-publish@v2
|
|
18
|
+
with:
|
|
19
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
20
|
+
tag: latest
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Decorators, DSL execution, and LLM-backed semantic parsing for ReactGenie-style applications
|
|
4
4
|
|
|
5
|
-
> Fork notice: this package snapshot is maintained as a thesis-project fork by [Omkar Mirgal](https://github.com/OmkarMirgal). For the original
|
|
5
|
+
> Fork notice: this package snapshot is maintained as a thesis-project fork by [Omkar Mirgal](https://github.com/OmkarMirgal). For the original ReactGenieDSL project, see [StanfordHCI/ReactGenieDSL](https://github.com/StanfordHCI/ReactGenieDSL).
|
|
6
6
|
|
|
7
7
|
## Introduction
|
|
8
8
|
|
|
@@ -434,3 +434,7 @@ Monitoring supports:
|
|
|
434
434
|
## License
|
|
435
435
|
|
|
436
436
|
Apache-2.0
|
|
437
|
+
|
|
438
|
+
This package is a thesis-project fork maintained by [Omkar Mirgal](https://github.com/OmkarMirgal).
|
|
439
|
+
For the original ReactGenieDSL project, see [StanfordHCI/ReactGenieDSL](https://github.com/StanfordHCI/ReactGenieDSL).
|
|
440
|
+
See the LICENSE file for the full license text.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@garrix82/reactgenie-dsl",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A natural language parser based on a large language model",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "pnpm peggy lib/dsl/parser.pegjs -o lib/dsl/parser.gen.js && pnpm tsc",
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
"typescript": "~5.3.3"
|
|
38
38
|
},
|
|
39
39
|
"main": "dist/index.js",
|
|
40
|
-
"files": [
|
|
41
|
-
"lib/**",
|
|
42
|
-
"dist/**"
|
|
43
|
-
],
|
|
44
40
|
"directories": {
|
|
45
41
|
"doc": "docs",
|
|
46
42
|
"lib": "lib",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const example_descriptor_1 = require("./example_descriptor");
|
|
4
|
-
test("Restaurant Description", async () => {
|
|
5
|
-
const description = example_descriptor_1.Restaurant._ClassDescriptor.description();
|
|
6
|
-
expect(description).toEqual("// A restaurant\n" +
|
|
7
|
-
"class Restaurant {\n" +
|
|
8
|
-
"\tstring name;\n" +
|
|
9
|
-
"\tFood[] menu;\n" +
|
|
10
|
-
"\tint rating;\n" +
|
|
11
|
-
"\tfloat priceGrade;\n" +
|
|
12
|
-
"\tstring cuisine;\n" +
|
|
13
|
-
"\tstring address;\n" +
|
|
14
|
-
"\tOrder[] orders;\n" +
|
|
15
|
-
"\t// All active restaurants\n" +
|
|
16
|
-
"\tstatic Restaurant[] all();\n" +
|
|
17
|
-
"\t// All active restaurants\n" +
|
|
18
|
-
"\tstatic Restaurant[] All();\n" +
|
|
19
|
-
"\t// The current restaurant\n" +
|
|
20
|
-
"\tstatic Restaurant current();\n" +
|
|
21
|
-
"\t// Book a table for a given date time\n" +
|
|
22
|
-
"\tvoid book(dateTime: DateTime? = `DateTime.today()`);\n" +
|
|
23
|
-
"\t// Book numbers tables for a given date time\n" +
|
|
24
|
-
"\tvoid bookTable(dateTime: DateTime?, number: int?);\n" +
|
|
25
|
-
"}");
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=dsl-descriptor.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dsl-descriptor.test.js","sourceRoot":"","sources":["../../lib/__test__/dsl-descriptor.test.ts"],"names":[],"mappings":";;AAAA,6DAAkD;AAElD,IAAI,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;IACxC,MAAM,WAAW,GAAG,+BAAU,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC;IAC9D,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CACzB,mBAAmB;QACnB,sBAAsB;QACpB,kBAAkB;QAClB,kBAAkB;QAClB,iBAAiB;QACjB,uBAAuB;QACvB,qBAAqB;QACrB,qBAAqB;QACrB,qBAAqB;QACrB,+BAA+B;QAC/B,gCAAgC;QAChC,+BAA+B;QAC/B,gCAAgC;QAChC,+BAA+B;QAC/B,kCAAkC;QAClC,2CAA2C;QAC3C,0DAA0D;QAC1D,kDAAkD;QAClD,wDAAwD;QACxD,GAAG,CACN,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { ClassDescriptor, DataClass, HelperClass } from "../dsl-descriptor";
|
|
2
|
-
import { ExampleParse } from "../nl";
|
|
3
|
-
import { float, int, LazyType } from "../decorators";
|
|
4
|
-
export declare let recentBooking: any;
|
|
5
|
-
export declare class DateTime extends HelperClass {
|
|
6
|
-
private _date;
|
|
7
|
-
year: number;
|
|
8
|
-
month: number;
|
|
9
|
-
day: number;
|
|
10
|
-
dayOfWeek: string;
|
|
11
|
-
hour: number;
|
|
12
|
-
minute: number;
|
|
13
|
-
private updateDate;
|
|
14
|
-
static today(): DateTime;
|
|
15
|
-
static sunday: number;
|
|
16
|
-
static monday: number;
|
|
17
|
-
static tuesday: number;
|
|
18
|
-
static wednesday: number;
|
|
19
|
-
static thursday: number;
|
|
20
|
-
static friday: number;
|
|
21
|
-
static saturday: number;
|
|
22
|
-
static fromDate(date: Date): DateTime;
|
|
23
|
-
description(): {};
|
|
24
|
-
static compare(a: DateTime, b: DateTime): number;
|
|
25
|
-
constructor({ year, month, day, hour, minute, }: {
|
|
26
|
-
year?: number;
|
|
27
|
-
month?: number;
|
|
28
|
-
day?: number;
|
|
29
|
-
hour?: number;
|
|
30
|
-
minute?: number;
|
|
31
|
-
});
|
|
32
|
-
_getConstructorParams(): any;
|
|
33
|
-
addDateOffset({ year, month, day, hour, minute, }: {
|
|
34
|
-
year: number;
|
|
35
|
-
month: number;
|
|
36
|
-
day: number;
|
|
37
|
-
hour: number;
|
|
38
|
-
minute: number;
|
|
39
|
-
}): this;
|
|
40
|
-
setDate({ year, month, day, hour, minute, day_of_the_week, }: {
|
|
41
|
-
year?: number;
|
|
42
|
-
month?: number;
|
|
43
|
-
day?: number;
|
|
44
|
-
hour?: number;
|
|
45
|
-
minute?: number;
|
|
46
|
-
day_of_the_week?: number;
|
|
47
|
-
}): this;
|
|
48
|
-
toString(): string;
|
|
49
|
-
static _ClassDescriptor: ClassDescriptor<DateTime>;
|
|
50
|
-
}
|
|
51
|
-
export declare class Food extends DataClass {
|
|
52
|
-
static _all: Food[];
|
|
53
|
-
static all(): Food[];
|
|
54
|
-
_price: float;
|
|
55
|
-
name: string;
|
|
56
|
-
price: float;
|
|
57
|
-
restaurant: LazyType<Restaurant>;
|
|
58
|
-
constructor({ name, price, restaurant, }: {
|
|
59
|
-
name: string;
|
|
60
|
-
price: float;
|
|
61
|
-
restaurant: LazyType<Restaurant>;
|
|
62
|
-
});
|
|
63
|
-
update(): Promise<void>;
|
|
64
|
-
description(): {};
|
|
65
|
-
static _ClassDescriptor: ClassDescriptor<Food>;
|
|
66
|
-
}
|
|
67
|
-
export declare class Order extends DataClass {
|
|
68
|
-
static _all: Order[];
|
|
69
|
-
static all(): Order[];
|
|
70
|
-
static _current: Order;
|
|
71
|
-
static current(): Promise<Order>;
|
|
72
|
-
orderId: string;
|
|
73
|
-
dateTime: DateTime;
|
|
74
|
-
foods: Food[];
|
|
75
|
-
restaurant: LazyType<Restaurant>;
|
|
76
|
-
constructor({ orderId, dateTime, foods, restaurant, }: {
|
|
77
|
-
orderId: string;
|
|
78
|
-
dateTime: DateTime;
|
|
79
|
-
foods: Food[];
|
|
80
|
-
restaurant: LazyType<Restaurant> | null;
|
|
81
|
-
});
|
|
82
|
-
addFoods({ foods }: {
|
|
83
|
-
foods: Food[];
|
|
84
|
-
}): void;
|
|
85
|
-
removeFoods({ foods }: {
|
|
86
|
-
foods: Food[];
|
|
87
|
-
}): void;
|
|
88
|
-
placeOrder(): void;
|
|
89
|
-
description(): {};
|
|
90
|
-
static _ClassDescriptor: ClassDescriptor<Order>;
|
|
91
|
-
}
|
|
92
|
-
export declare class Restaurant extends DataClass {
|
|
93
|
-
static _all: Restaurant[];
|
|
94
|
-
orders: Order[];
|
|
95
|
-
static all(): Restaurant[];
|
|
96
|
-
description(): {};
|
|
97
|
-
createFood(name: string, price: float): Food;
|
|
98
|
-
createOrder(orderId: string, dateTime: DateTime, foods: Food[]): Promise<Order>;
|
|
99
|
-
static current(): Promise<Restaurant>;
|
|
100
|
-
book({ dateTime }: {
|
|
101
|
-
dateTime?: DateTime;
|
|
102
|
-
}): void;
|
|
103
|
-
bookTable({ dateTime, number }: {
|
|
104
|
-
dateTime?: DateTime;
|
|
105
|
-
number?: int;
|
|
106
|
-
}): void;
|
|
107
|
-
name: string;
|
|
108
|
-
menu: Food[];
|
|
109
|
-
rating: int;
|
|
110
|
-
priceGrade: float;
|
|
111
|
-
cuisine: string;
|
|
112
|
-
address: string;
|
|
113
|
-
constructor({ name, menu, rating, priceGrade, cuisine, address, }: {
|
|
114
|
-
name: string;
|
|
115
|
-
menu: Food[];
|
|
116
|
-
rating: number;
|
|
117
|
-
priceGrade: number;
|
|
118
|
-
cuisine: string;
|
|
119
|
-
address: string;
|
|
120
|
-
});
|
|
121
|
-
static _ClassDescriptor: ClassDescriptor<Restaurant>;
|
|
122
|
-
}
|
|
123
|
-
export declare const allDescriptors: ClassDescriptor<import("../dsl-descriptor").GenieObject>[];
|
|
124
|
-
export declare const classDescriptions: string[];
|
|
125
|
-
export declare const examples: ExampleParse[];
|