@garrix82/reactgenie-dsl 1.0.3 → 1.0.5

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 (41) hide show
  1. package/README.md +12 -6
  2. package/dist/cli/dsl-interpreter.d.ts +92 -0
  3. package/dist/cli/dsl-interpreter.js +977 -0
  4. package/dist/cli/dsl-interpreter.js.map +1 -0
  5. package/dist/decorators/decorators.js +12 -10
  6. package/dist/decorators/decorators.js.map +1 -1
  7. package/dist/dsl/dsl-interpreter.d.ts +3 -0
  8. package/dist/dsl/dsl-interpreter.js +31 -14
  9. package/dist/dsl/dsl-interpreter.js.map +1 -1
  10. package/dist/dsl-descriptor.d.ts +3 -2
  11. package/dist/dsl-descriptor.js +4 -0
  12. package/dist/dsl-descriptor.js.map +1 -1
  13. package/dist/nl/context-selector.d.ts +3 -0
  14. package/dist/nl/context-selector.js +41 -1
  15. package/dist/nl/context-selector.js.map +1 -1
  16. package/dist/nl/index.d.ts +1 -1
  17. package/dist/nl/index.js +3 -1
  18. package/dist/nl/index.js.map +1 -1
  19. package/dist/nl/llm-monitoring.d.ts +5 -1
  20. package/dist/nl/llm-monitoring.js +13 -8
  21. package/dist/nl/llm-monitoring.js.map +1 -1
  22. package/dist/nl/nl-parser-groq.d.ts +1 -0
  23. package/dist/nl/nl-parser-groq.js +21 -2
  24. package/dist/nl/nl-parser-groq.js.map +1 -1
  25. package/dist/nl/nl-parser-utils.d.ts +27 -0
  26. package/dist/nl/nl-parser-utils.js +10 -1
  27. package/dist/nl/nl-parser-utils.js.map +1 -1
  28. package/dist/nl/nl-parser.d.ts +2 -0
  29. package/dist/nl/nl-parser.js +55 -2
  30. package/dist/nl/nl-parser.js.map +1 -1
  31. package/dist/nl/prompt-gen.d.ts +129 -15
  32. package/dist/nl/prompt-gen.js +534 -97
  33. package/dist/nl/prompt-gen.js.map +1 -1
  34. package/dist/nl/prompt-res.d.ts +7 -3
  35. package/dist/nl/prompt-res.js +34 -30
  36. package/dist/nl/prompt-res.js.map +1 -1
  37. package/dist/nl-interpreter.d.ts +3 -2
  38. package/dist/nl-interpreter.js +1 -1
  39. package/dist/nl-interpreter.js.map +1 -1
  40. package/package.json +11 -11
  41. package/scripts/generate-embedded-example-index.js +239 -0
package/README.md CHANGED
@@ -136,12 +136,18 @@ export class Counter extends DataClass {
136
136
 
137
137
  static Examples = [
138
138
  {
139
- user_utterance: "increment the apples counter",
140
- example_parsed: 'Counter.findByName(name: "apples").increment()',
139
+ userUtterance: {
140
+ en: "increment the apples counter",
141
+ de: "erhoehe den apples Zaehler",
142
+ },
143
+ exampleParsed: 'Counter.findByName(name: "apples").increment()',
141
144
  },
142
145
  {
143
- user_utterance: "what is the apples count",
144
- example_parsed: 'Counter.findByName(name: "apples").count',
146
+ userUtterance: {
147
+ en: "what is the apples count",
148
+ de: "wie ist der apples Zaehlerstand",
149
+ },
150
+ exampleParsed: 'Counter.findByName(name: "apples").count',
145
151
  },
146
152
  ];
147
153
 
@@ -224,11 +230,11 @@ const descriptors = Object.values(AllGenieObjects).map(
224
230
 
225
231
  const examples: ExampleParse[] = [
226
232
  new ExampleParse(
227
- "increment the apples counter",
233
+ { en: "increment the apples counter", de: "erhoehe den apples Zaehler" },
228
234
  'Counter.findByName(name: "apples").increment()'
229
235
  ),
230
236
  new ExampleParse(
231
- "what is the apples count",
237
+ { en: "what is the apples count", de: "wie ist der apples Zaehlerstand" },
232
238
  'Counter.findByName(name: "apples").count'
233
239
  ),
234
240
  ];
@@ -0,0 +1,92 @@
1
+ import { ClassDescriptor, GenieObject } from "../dsl-descriptor";
2
+ export declare class InterpreterError extends Error {
3
+ }
4
+ export declare class ClassMissingError extends InterpreterError {
5
+ class_name: string;
6
+ constructor(class_name: string);
7
+ }
8
+ export declare class FieldMissingError extends InterpreterError {
9
+ class_name: string;
10
+ field_name: string;
11
+ constructor(class_name: string, field_name: string);
12
+ }
13
+ export declare class FieldStaticError extends InterpreterError {
14
+ class_name: string;
15
+ field_name: string;
16
+ constructor(class_name: string, field_name: string);
17
+ }
18
+ export declare class FunctionMissingError extends InterpreterError {
19
+ class_name: string;
20
+ func_name: string;
21
+ constructor(class_name: string, func_name: string);
22
+ }
23
+ export declare class FunctionStaticError extends InterpreterError {
24
+ class_name: string;
25
+ func_name: string;
26
+ constructor(class_name: string, func_name: string);
27
+ }
28
+ export declare class InvalidParameterTypeError extends InterpreterError {
29
+ func_name: string;
30
+ parameter_name: string;
31
+ expected_type: string;
32
+ received_type: string;
33
+ constructor(func_name: string, parameter_name: string, expected_type: string, received_type: string);
34
+ }
35
+ export type DslTraceEntry = {
36
+ sequence: number;
37
+ primitive: string;
38
+ fieldAccessor?: string;
39
+ candidate?: any;
40
+ fieldValue?: any;
41
+ comparison?: any;
42
+ matched?: boolean;
43
+ reason: string;
44
+ };
45
+ export type DslInterpreterOptions = {
46
+ onTrace?: (entry: DslTraceEntry) => void;
47
+ };
48
+ export declare class DslInterpreter {
49
+ dry_run: boolean;
50
+ private options;
51
+ private traceSequence;
52
+ private matching;
53
+ private contains;
54
+ private equals;
55
+ private compareObjectsSafely;
56
+ private isDateOnlyString;
57
+ private isIsoDateTimeString;
58
+ private normalizeBetweenBound;
59
+ private arrayFunctionDescriptors;
60
+ private emitTrace;
61
+ private serializeAccessor;
62
+ private serializeCandidate;
63
+ private serializeValue;
64
+ private explainMatching;
65
+ private explainContains;
66
+ private explainEquals;
67
+ private explainBetween;
68
+ private arrayFunctionImplementations;
69
+ resolveSteps: any[];
70
+ resolveStepsEnabled: boolean;
71
+ classDescriptors: ClassDescriptor<GenieObject>[];
72
+ constructor(classDescriptors: ClassDescriptor<GenieObject>[], dry_run?: boolean, options?: DslInterpreterOptions);
73
+ interpret(input: string): Promise<any>;
74
+ interpretSteps(input: string): Promise<{
75
+ ast: any;
76
+ result: any;
77
+ steps: {
78
+ ast: any;
79
+ result: any;
80
+ }[];
81
+ }[]>;
82
+ describe(ast: any): Promise<any>;
83
+ describeSteps(list: any[]): Promise<any[]>;
84
+ strip(ast: any): any;
85
+ resolve(ast: any, env?: null | any): Promise<any>;
86
+ private describeResolvedParameterType;
87
+ private validateResolvedParameters;
88
+ private resolveAccess;
89
+ private resolveIndex;
90
+ private resolveArray;
91
+ private resolveFunctionCall;
92
+ }