@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.
Files changed (105) hide show
  1. package/.env +10 -0
  2. package/.env.example +17 -0
  3. package/.github/workflows/publish.yml +20 -0
  4. package/README.md +5 -1
  5. package/package.json +1 -5
  6. package/dist/__test__/dsl-descriptor.test.d.ts +0 -1
  7. package/dist/__test__/dsl-descriptor.test.js +0 -27
  8. package/dist/__test__/dsl-descriptor.test.js.map +0 -1
  9. package/dist/__test__/example_descriptor.d.ts +0 -125
  10. package/dist/__test__/example_descriptor.js +0 -607
  11. package/dist/__test__/example_descriptor.js.map +0 -1
  12. package/dist/__test__/food_descriptor.state.json +0 -1
  13. package/dist/__test__/food_descriptor.test.d.ts +0 -74
  14. package/dist/__test__/food_descriptor.test.js +0 -205
  15. package/dist/__test__/food_descriptor.test.js.map +0 -1
  16. package/dist/__test__/nl-interpreter-provider-selection.test.d.ts +0 -1
  17. package/dist/__test__/nl-interpreter-provider-selection.test.js +0 -73
  18. package/dist/__test__/nl-interpreter-provider-selection.test.js.map +0 -1
  19. package/dist/__test__/nl-interpreter.test.d.ts +0 -1
  20. package/dist/__test__/nl-interpreter.test.js +0 -86
  21. package/dist/__test__/nl-interpreter.test.js.map +0 -1
  22. package/dist/decorators/__test__/decorators.test.d.ts +0 -1
  23. package/dist/decorators/__test__/decorators.test.js +0 -182
  24. package/dist/decorators/__test__/decorators.test.js.map +0 -1
  25. package/dist/decorators/__test__/inheritance-descriptor.test.d.ts +0 -1
  26. package/dist/decorators/__test__/inheritance-descriptor.test.js +0 -107
  27. package/dist/decorators/__test__/inheritance-descriptor.test.js.map +0 -1
  28. package/dist/dsl/__test__/dsl-interpreter.test.d.ts +0 -1
  29. package/dist/dsl/__test__/dsl-interpreter.test.js +0 -334
  30. package/dist/dsl/__test__/dsl-interpreter.test.js.map +0 -1
  31. package/dist/dsl/__test__/parser.gen.test.d.ts +0 -1
  32. package/dist/dsl/__test__/parser.gen.test.js +0 -283
  33. package/dist/dsl/__test__/parser.gen.test.js.map +0 -1
  34. package/dist/nl/__test__/context-aware-prompt.test.d.ts +0 -1
  35. package/dist/nl/__test__/context-aware-prompt.test.js +0 -247
  36. package/dist/nl/__test__/context-aware-prompt.test.js.map +0 -1
  37. package/dist/nl/__test__/context-selector.test.d.ts +0 -1
  38. package/dist/nl/__test__/context-selector.test.js +0 -20
  39. package/dist/nl/__test__/context-selector.test.js.map +0 -1
  40. package/dist/nl/__test__/nl-parser-groq-transport.test.d.ts +0 -1
  41. package/dist/nl/__test__/nl-parser-groq-transport.test.js +0 -87
  42. package/dist/nl/__test__/nl-parser-groq-transport.test.js.map +0 -1
  43. package/dist/nl/__test__/nl-parser-openai-parity.test.d.ts +0 -1
  44. package/dist/nl/__test__/nl-parser-openai-parity.test.js +0 -206
  45. package/dist/nl/__test__/nl-parser-openai-parity.test.js.map +0 -1
  46. package/dist/nl/__test__/nl-parser-openai-sampling.test.d.ts +0 -1
  47. package/dist/nl/__test__/nl-parser-openai-sampling.test.js +0 -44
  48. package/dist/nl/__test__/nl-parser-openai-sampling.test.js.map +0 -1
  49. package/dist/nl/__test__/nl-parser-openai-transport.test.d.ts +0 -1
  50. package/dist/nl/__test__/nl-parser-openai-transport.test.js +0 -55
  51. package/dist/nl/__test__/nl-parser-openai-transport.test.js.map +0 -1
  52. package/dist/nl/__test__/nl-parser-utils.test.d.ts +0 -1
  53. package/dist/nl/__test__/nl-parser-utils.test.js +0 -70
  54. package/dist/nl/__test__/nl-parser-utils.test.js.map +0 -1
  55. package/dist/nl/__test__/nl-parser.test.d.ts +0 -1
  56. package/dist/nl/__test__/nl-parser.test.js +0 -64
  57. package/dist/nl/__test__/nl-parser.test.js.map +0 -1
  58. package/dist/nl/__test__/parameter-tuning.test.d.ts +0 -1
  59. package/dist/nl/__test__/parameter-tuning.test.js +0 -95
  60. package/dist/nl/__test__/parameter-tuning.test.js.map +0 -1
  61. package/dist/nl/__test__/semantic-parsing-experiment.test.d.ts +0 -1
  62. package/dist/nl/__test__/semantic-parsing-experiment.test.js +0 -178
  63. package/dist/nl/__test__/semantic-parsing-experiment.test.js.map +0 -1
  64. package/dist/nl/llm-monitoring.test.d.ts +0 -5
  65. package/dist/nl/llm-monitoring.test.js +0 -101
  66. package/dist/nl/llm-monitoring.test.js.map +0 -1
  67. package/lib/__test__/dsl-descriptor.test.ts +0 -27
  68. package/lib/__test__/example_descriptor.ts +0 -762
  69. package/lib/__test__/food_descriptor.state.json +0 -1
  70. package/lib/__test__/food_descriptor.test.ts +0 -331
  71. package/lib/__test__/nl-interpreter-provider-selection.test.ts +0 -126
  72. package/lib/__test__/nl-interpreter.test.ts +0 -129
  73. package/lib/decorators/__test__/decorators.test.ts +0 -177
  74. package/lib/decorators/__test__/inheritance-descriptor.test.ts +0 -92
  75. package/lib/decorators/decorators.ts +0 -754
  76. package/lib/decorators/index.ts +0 -2
  77. package/lib/decorators/store.ts +0 -47
  78. package/lib/dsl/__test__/dsl-interpreter.test.ts +0 -453
  79. package/lib/dsl/__test__/parser.gen.test.ts +0 -296
  80. package/lib/dsl/dsl-interpreter.ts +0 -974
  81. package/lib/dsl/index.ts +0 -1
  82. package/lib/dsl/parser.gen.js +0 -1479
  83. package/lib/dsl/parser.pegjs +0 -130
  84. package/lib/dsl-descriptor.ts +0 -241
  85. package/lib/index.ts +0 -5
  86. package/lib/nl/__test__/context-aware-prompt.test.ts +0 -372
  87. package/lib/nl/__test__/context-selector.test.ts +0 -27
  88. package/lib/nl/__test__/nl-parser-groq-transport.test.ts +0 -139
  89. package/lib/nl/__test__/nl-parser-openai-parity.test.ts +0 -381
  90. package/lib/nl/__test__/nl-parser-openai-sampling.test.ts +0 -73
  91. package/lib/nl/__test__/nl-parser-openai-transport.test.ts +0 -79
  92. package/lib/nl/__test__/nl-parser-utils.test.ts +0 -98
  93. package/lib/nl/__test__/nl-parser.test.ts +0 -119
  94. package/lib/nl/__test__/parameter-tuning.test.ts +0 -137
  95. package/lib/nl/__test__/semantic-parsing-experiment.test.ts +0 -260
  96. package/lib/nl/context-selector.ts +0 -123
  97. package/lib/nl/index.ts +0 -19
  98. package/lib/nl/llm-monitoring.test.ts +0 -136
  99. package/lib/nl/llm-monitoring.ts +0 -339
  100. package/lib/nl/nl-parser-groq.ts +0 -510
  101. package/lib/nl/nl-parser-utils.ts +0 -310
  102. package/lib/nl/nl-parser.ts +0 -616
  103. package/lib/nl/prompt-gen.ts +0 -607
  104. package/lib/nl/prompt-res.ts +0 -207
  105. 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 ReactGenie project, see [StanfordHCI/ReactGenie](https://github.com/StanfordHCI/ReactGenieDSL).
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.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[];