@garrix82/reactgenie-dsl 1.0.1 → 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 (104) hide show
  1. package/.env +10 -0
  2. package/.env.example +17 -0
  3. package/.github/workflows/publish.yml +20 -0
  4. package/package.json +1 -5
  5. package/dist/__test__/dsl-descriptor.test.d.ts +0 -1
  6. package/dist/__test__/dsl-descriptor.test.js +0 -27
  7. package/dist/__test__/dsl-descriptor.test.js.map +0 -1
  8. package/dist/__test__/example_descriptor.d.ts +0 -125
  9. package/dist/__test__/example_descriptor.js +0 -607
  10. package/dist/__test__/example_descriptor.js.map +0 -1
  11. package/dist/__test__/food_descriptor.state.json +0 -1
  12. package/dist/__test__/food_descriptor.test.d.ts +0 -74
  13. package/dist/__test__/food_descriptor.test.js +0 -205
  14. package/dist/__test__/food_descriptor.test.js.map +0 -1
  15. package/dist/__test__/nl-interpreter-provider-selection.test.d.ts +0 -1
  16. package/dist/__test__/nl-interpreter-provider-selection.test.js +0 -73
  17. package/dist/__test__/nl-interpreter-provider-selection.test.js.map +0 -1
  18. package/dist/__test__/nl-interpreter.test.d.ts +0 -1
  19. package/dist/__test__/nl-interpreter.test.js +0 -86
  20. package/dist/__test__/nl-interpreter.test.js.map +0 -1
  21. package/dist/decorators/__test__/decorators.test.d.ts +0 -1
  22. package/dist/decorators/__test__/decorators.test.js +0 -182
  23. package/dist/decorators/__test__/decorators.test.js.map +0 -1
  24. package/dist/decorators/__test__/inheritance-descriptor.test.d.ts +0 -1
  25. package/dist/decorators/__test__/inheritance-descriptor.test.js +0 -107
  26. package/dist/decorators/__test__/inheritance-descriptor.test.js.map +0 -1
  27. package/dist/dsl/__test__/dsl-interpreter.test.d.ts +0 -1
  28. package/dist/dsl/__test__/dsl-interpreter.test.js +0 -334
  29. package/dist/dsl/__test__/dsl-interpreter.test.js.map +0 -1
  30. package/dist/dsl/__test__/parser.gen.test.d.ts +0 -1
  31. package/dist/dsl/__test__/parser.gen.test.js +0 -283
  32. package/dist/dsl/__test__/parser.gen.test.js.map +0 -1
  33. package/dist/nl/__test__/context-aware-prompt.test.d.ts +0 -1
  34. package/dist/nl/__test__/context-aware-prompt.test.js +0 -247
  35. package/dist/nl/__test__/context-aware-prompt.test.js.map +0 -1
  36. package/dist/nl/__test__/context-selector.test.d.ts +0 -1
  37. package/dist/nl/__test__/context-selector.test.js +0 -20
  38. package/dist/nl/__test__/context-selector.test.js.map +0 -1
  39. package/dist/nl/__test__/nl-parser-groq-transport.test.d.ts +0 -1
  40. package/dist/nl/__test__/nl-parser-groq-transport.test.js +0 -87
  41. package/dist/nl/__test__/nl-parser-groq-transport.test.js.map +0 -1
  42. package/dist/nl/__test__/nl-parser-openai-parity.test.d.ts +0 -1
  43. package/dist/nl/__test__/nl-parser-openai-parity.test.js +0 -206
  44. package/dist/nl/__test__/nl-parser-openai-parity.test.js.map +0 -1
  45. package/dist/nl/__test__/nl-parser-openai-sampling.test.d.ts +0 -1
  46. package/dist/nl/__test__/nl-parser-openai-sampling.test.js +0 -44
  47. package/dist/nl/__test__/nl-parser-openai-sampling.test.js.map +0 -1
  48. package/dist/nl/__test__/nl-parser-openai-transport.test.d.ts +0 -1
  49. package/dist/nl/__test__/nl-parser-openai-transport.test.js +0 -55
  50. package/dist/nl/__test__/nl-parser-openai-transport.test.js.map +0 -1
  51. package/dist/nl/__test__/nl-parser-utils.test.d.ts +0 -1
  52. package/dist/nl/__test__/nl-parser-utils.test.js +0 -70
  53. package/dist/nl/__test__/nl-parser-utils.test.js.map +0 -1
  54. package/dist/nl/__test__/nl-parser.test.d.ts +0 -1
  55. package/dist/nl/__test__/nl-parser.test.js +0 -64
  56. package/dist/nl/__test__/nl-parser.test.js.map +0 -1
  57. package/dist/nl/__test__/parameter-tuning.test.d.ts +0 -1
  58. package/dist/nl/__test__/parameter-tuning.test.js +0 -95
  59. package/dist/nl/__test__/parameter-tuning.test.js.map +0 -1
  60. package/dist/nl/__test__/semantic-parsing-experiment.test.d.ts +0 -1
  61. package/dist/nl/__test__/semantic-parsing-experiment.test.js +0 -178
  62. package/dist/nl/__test__/semantic-parsing-experiment.test.js.map +0 -1
  63. package/dist/nl/llm-monitoring.test.d.ts +0 -5
  64. package/dist/nl/llm-monitoring.test.js +0 -101
  65. package/dist/nl/llm-monitoring.test.js.map +0 -1
  66. package/lib/__test__/dsl-descriptor.test.ts +0 -27
  67. package/lib/__test__/example_descriptor.ts +0 -762
  68. package/lib/__test__/food_descriptor.state.json +0 -1
  69. package/lib/__test__/food_descriptor.test.ts +0 -331
  70. package/lib/__test__/nl-interpreter-provider-selection.test.ts +0 -126
  71. package/lib/__test__/nl-interpreter.test.ts +0 -129
  72. package/lib/decorators/__test__/decorators.test.ts +0 -177
  73. package/lib/decorators/__test__/inheritance-descriptor.test.ts +0 -92
  74. package/lib/decorators/decorators.ts +0 -754
  75. package/lib/decorators/index.ts +0 -2
  76. package/lib/decorators/store.ts +0 -47
  77. package/lib/dsl/__test__/dsl-interpreter.test.ts +0 -453
  78. package/lib/dsl/__test__/parser.gen.test.ts +0 -296
  79. package/lib/dsl/dsl-interpreter.ts +0 -974
  80. package/lib/dsl/index.ts +0 -1
  81. package/lib/dsl/parser.gen.js +0 -1479
  82. package/lib/dsl/parser.pegjs +0 -130
  83. package/lib/dsl-descriptor.ts +0 -241
  84. package/lib/index.ts +0 -5
  85. package/lib/nl/__test__/context-aware-prompt.test.ts +0 -372
  86. package/lib/nl/__test__/context-selector.test.ts +0 -27
  87. package/lib/nl/__test__/nl-parser-groq-transport.test.ts +0 -139
  88. package/lib/nl/__test__/nl-parser-openai-parity.test.ts +0 -381
  89. package/lib/nl/__test__/nl-parser-openai-sampling.test.ts +0 -73
  90. package/lib/nl/__test__/nl-parser-openai-transport.test.ts +0 -79
  91. package/lib/nl/__test__/nl-parser-utils.test.ts +0 -98
  92. package/lib/nl/__test__/nl-parser.test.ts +0 -119
  93. package/lib/nl/__test__/parameter-tuning.test.ts +0 -137
  94. package/lib/nl/__test__/semantic-parsing-experiment.test.ts +0 -260
  95. package/lib/nl/context-selector.ts +0 -123
  96. package/lib/nl/index.ts +0 -19
  97. package/lib/nl/llm-monitoring.test.ts +0 -136
  98. package/lib/nl/llm-monitoring.ts +0 -339
  99. package/lib/nl/nl-parser-groq.ts +0 -510
  100. package/lib/nl/nl-parser-utils.ts +0 -310
  101. package/lib/nl/nl-parser.ts +0 -616
  102. package/lib/nl/prompt-gen.ts +0 -607
  103. package/lib/nl/prompt-res.ts +0 -207
  104. package/lib/nl-interpreter.ts +0 -262
@@ -1 +0,0 @@
1
- { "basket": { "items": [] }, "restaurant": { "restaurants": [{ "_createdAt": "2022-07-12T07:19:50Z", "_id": "226bc203-dc27-40b7-9de7-dfb595bdde32", "_rev": "IGjXs14mpjIFkE02pjcdDF", "_type": "restaurant", "_updatedAt": "2022-07-13T06:22:21Z", "address": "29, BN Road, Lalbagh, Lucknow, Uttar Pradesh 226001", "dishes": [{ "Price": 5, "_createdAt": "2022-07-12T08:15:00Z", "_id": "43557ef7-7a85-4d47-827e-f6c825e034b0", "_rev": "IGjXs14mpjIFkE02pgXcRt", "_type": "dish", "_updatedAt": "2022-07-12T08:15:00Z", "image": { "_type": "image", "asset": { "_ref": "image-6a385562109ed1dc78de5824b119a920583f4ec5-1200x1796-jpg", "_type": "reference" } }, "name": "Butter Naan", "short_description": "Good to have with butter chicken" }, { "Price": 5, "_createdAt": "2022-07-12T08:14:23Z", "_id": "bca591a5-764f-4c7c-8707-a618a2238587", "_rev": "IGjXs14mpjIFkE02pgXYUD", "_type": "dish", "_updatedAt": "2022-07-12T08:14:23Z", "image": { "_type": "image", "asset": { "_ref": "image-6a385562109ed1dc78de5824b119a920583f4ec5-1200x1796-jpg", "_type": "reference" } }, "name": "Butter Chicken", "short_description": "Tandi tod logon k liye tangdi package." }, { "Price": 10, "_createdAt": "2022-07-12T07:59:00Z", "_id": "e70cb672-8e6c-4826-8ec2-edd1cc76637a", "_rev": "Gng42kcwkgwKuUtBk5jrMs", "_type": "dish", "_updatedAt": "2022-07-12T07:59:00Z", "image": { "_type": "image", "asset": { "_ref": "image-405c021b0e081a04947de553902cb83592d46265-550x550-jpg", "_type": "reference" } }, "name": "Roasted chicken", "short_description": "Chicken which in roasted format." }], "image": { "_type": "image", "asset": { "_ref": "image-d08eb7820a11d852830286dced82a813d78e2d03-300x300-webp", "_type": "reference" } }, "lat": 26.8440682, "long": 80.9362307, "name": "Dastarkhwan", "rating": 4, "short_description": "Daawat E Azaam Mughali Paratha With Chicken Masala", "type": { "_ref": "b15e4c17-e9c4-4e4d-8826-ffbf8f9b3d96", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:16:38Z", "_id": "522e6022-3051-4bc2-824e-05a4b1a7a89c", "_rev": "6dNgvzjgwH6OT4iz0F5AHK", "_type": "restaurant", "_updatedAt": "2022-07-13T06:22:35Z", "address": "168/6, Old Nazirabad Rd, Mohan Market, Khayali Ganj, Aminabad, Lucknow, Uttar Pradesh 226018", "dishes": [{ "Price": 5, "_createdAt": "2022-07-12T08:14:23Z", "_id": "bca591a5-764f-4c7c-8707-a618a2238587", "_rev": "IGjXs14mpjIFkE02pgXYUD", "_type": "dish", "_updatedAt": "2022-07-12T08:14:23Z", "image": { "_type": "image", "asset": { "_ref": "image-6a385562109ed1dc78de5824b119a920583f4ec5-1200x1796-jpg", "_type": "reference" } }, "name": "Butter Chicken", "short_description": "Tandi tod logon k liye tangdi package." }, { "Price": 10, "_createdAt": "2022-07-12T07:59:00Z", "_id": "e70cb672-8e6c-4826-8ec2-edd1cc76637a", "_rev": "Gng42kcwkgwKuUtBk5jrMs", "_type": "dish", "_updatedAt": "2022-07-12T07:59:00Z", "image": { "_type": "image", "asset": { "_ref": "image-405c021b0e081a04947de553902cb83592d46265-550x550-jpg", "_type": "reference" } }, "name": "Roasted chicken", "short_description": "Chicken which in roasted format." }, { "Price": 5, "_createdAt": "2022-07-12T08:15:00Z", "_id": "43557ef7-7a85-4d47-827e-f6c825e034b0", "_rev": "IGjXs14mpjIFkE02pgXcRt", "_type": "dish", "_updatedAt": "2022-07-12T08:15:00Z", "image": { "_type": "image", "asset": { "_ref": "image-6a385562109ed1dc78de5824b119a920583f4ec5-1200x1796-jpg", "_type": "reference" } }, "name": "Butter Naan", "short_description": "Good to have with butter chicken" }, { "Price": 5, "_createdAt": "2022-07-12T07:50:44Z", "_id": "45aec978-6454-468f-9180-acaa0efafdcd", "_rev": "Gng42kcwkgwKuUtBk5h5m2", "_type": "dish", "_updatedAt": "2022-07-12T07:50:44Z", "image": { "_type": "image", "asset": { "_ref": "image-4c46688e4f7c42ce757e5c1941d8cd2f087f21e7-225x225-jpg", "_type": "reference" } }, "name": "Fried rice", "short_description": "Nothing but plain sweet old rice" }], "image": { "_type": "image", "asset": { "_ref": "image-92b504d95e4c1e38df615ef4ea315871465709a5-225x225-jpg", "_type": "reference" } }, "lat": 26.8482916, "long": 80.922808, "name": "Tunday Kababi", "rating": 4, "short_description": "Simple, unfussy restaurant & banqueting hall cooking up familiar dishes from across India.", "type": { "_ref": "b15e4c17-e9c4-4e4d-8826-ffbf8f9b3d96", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:14:04Z", "_id": "a90c4a71-ece2-4188-9ef4-5e13d4263504", "_rev": "IGjXs14mpjIFkE02pjcfoH", "_type": "restaurant", "_updatedAt": "2022-07-13T06:22:47Z", "address": "RV2W+J6M, Kanpur - Lucknow Rd, Sector B, Bara Birwa, Alambagh, Lucknow, Uttar Pradesh 226005", "dishes": [{ "Price": 7, "_createdAt": "2022-07-12T08:13:41Z", "_id": "f2cc275c-b430-49d9-be99-95c3a612dba6", "_rev": "Gng42kcwkgwKuUtBk5oviQ", "_type": "dish", "_updatedAt": "2022-07-12T08:13:41Z", "image": { "_type": "image", "asset": { "_ref": "image-c05029cff570e70142b1f0a2b20d59c70cd29077-800x800-jpg", "_type": "reference" } }, "name": "Aloo Paratha", "short_description": "A food which can be served in breakfast as well as lunch as well as dinner. Kya baat hai bhai..gazab!" }, { "Price": 5, "_createdAt": "2022-07-12T08:07:41Z", "_id": "e6fc495e-c075-430f-bbc8-6d48c0ad5425", "_rev": "Gng42kcwkgwKuUtBk5mgt4", "_type": "dish", "_updatedAt": "2022-07-12T08:07:41Z", "image": { "_type": "image", "asset": { "_ref": "image-2b241157ac58af7c7c0048b304d037528f893f68-259x194-jpg", "_type": "reference" } }, "name": "Tava Roti", "short_description": "Roti garam garam kar de maze" }, { "Price": 5, "_createdAt": "2022-07-12T08:12:48Z", "_id": "06db3d0c-c4ea-4895-9e80-e7a1c4494a9d", "_rev": "IGjXs14mpjIFkE02pgXG8f", "_type": "dish", "_updatedAt": "2022-07-12T08:12:48Z", "image": { "_type": "image", "asset": { "_ref": "image-95bda8260b845c92d9f5a1ce25646ba46652bb2a-1200x1200-jpg", "_type": "reference" } }, "name": "Pulao", "short_description": "A kind of rice dish made with healthy oils." }], "image": { "_type": "image", "asset": { "_ref": "image-c7d9d3e6d6cbfc8cd01d7ce2d0bd07a1efa0a5ce-400x300-webp", "_type": "reference" } }, "lat": 26.77555318, "long": 80.8480829, "name": "Punjab Restaurant", "rating": 5, "short_description": "Enjoy Bhangda food ", "type": { "_ref": "b15e4c17-e9c4-4e4d-8826-ffbf8f9b3d96", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:09:46Z", "_id": "d80e7c66-e23b-4173-8533-4f61d6a9b219", "_rev": "6dNgvzjgwH6OT4iz0Dspxy", "_type": "restaurant", "_updatedAt": "2022-07-12T07:11:21Z", "address": "Barbeque Nation - 3rd Floor Phoenix United Mall - Lucknow", "dishes": [{ "Price": 4, "_createdAt": "2022-07-11T16:25:27Z", "_id": "4a0cbbbe-a54e-47d0-94ac-5eb5bfa91569", "_rev": "6dNgvzjgwH6OT4iz0DJdFi", "_type": "dish", "_updatedAt": "2022-07-11T16:25:27Z", "image": { "_type": "image", "asset": { "_ref": "image-08598a24db7eadc77a0340ea86317c5b99ef5abd-136x132-png", "_type": "reference" } }, "name": "Bacon & Cheese Quarter Pounder", "short_description": "A Burger with Bacon. Unbelievable." }, { "Price": 5, "_createdAt": "2022-07-11T16:21:45Z", "_id": "7748db28-bede-4b0b-9e0c-8adffc88cb67", "_rev": "IGjXs14mpjIFkE02perMkT", "_type": "dish", "_updatedAt": "2022-07-11T16:21:45Z", "image": { "_type": "image", "asset": { "_ref": "image-175baf76363d122e2ea7332229c6ed2d531c6f83-275x183-jpg", "_type": "reference" } }, "name": "Sub", "short_description": "Cheesy greasy sub that is light on pocket." }, { "Price": 5, "_createdAt": "2022-07-11T16:23:08Z", "_id": "eec3dbf5-677b-4984-9867-dfd302d89e63", "_rev": "IGjXs14mpjIFkE02percCP", "_type": "dish", "_updatedAt": "2022-07-11T16:23:23Z", "image": { "_type": "image", "asset": { "_ref": "image-be34217381f308f80a450b70b6be9c5f7dfe79a8-106x107-png", "_type": "reference" } }, "name": "Grilled Onion Cheddar Burger", "short_description": "A burger with rich cheese. Exactly." }], "image": { "_type": "image", "asset": { "_ref": "image-e11c31742bb0a9d8b16a4539021846449f76e7d5-400x400-jpg", "_type": "reference" } }, "lat": 26.775281, "long": 80.8484264, "name": "Barbeque Nation", "rating": 4, "short_description": "Yo come to nation", "type": { "_ref": "aecd4102-37c3-4c00-ad3c-20263990c578", "_type": "reference" } }, { "_createdAt": "2022-07-11T15:11:52Z", "_id": "55d74fc0-f7ff-4115-89eb-e090795d64c8", "_rev": "6dNgvzjgwH6OT4iz0F577S", "_type": "restaurant", "_updatedAt": "2022-07-13T06:20:59Z", "address": "QWX3+525, Sector B, Bargawan, LDA Colony, Lucknow, Uttar Pradesh 226012", "dishes": [{ "Price": 5, "_createdAt": "2022-07-11T16:21:45Z", "_id": "7748db28-bede-4b0b-9e0c-8adffc88cb67", "_rev": "IGjXs14mpjIFkE02perMkT", "_type": "dish", "_updatedAt": "2022-07-11T16:21:45Z", "image": { "_type": "image", "asset": { "_ref": "image-175baf76363d122e2ea7332229c6ed2d531c6f83-275x183-jpg", "_type": "reference" } }, "name": "Sub", "short_description": "Cheesy greasy sub that is light on pocket." }], "image": { "_type": "image", "asset": { "_ref": "image-cc26a852266db35096c5e1f8dc32f323be7e22a9-474x274-jpg", "_type": "reference" } }, "lat": 26.8665071, "long": 80.662767, "name": "Subway", "rating": 4, "short_description": "Subway is an American multi-national fast food restaurant franchise that primarily sells submarine sandwiches, wraps, salads and beverages. ", "type": { "_ref": "f2073023-d011-43de-9067-8fa9e4e16981", "_type": "reference" } }, { "_createdAt": "2022-07-11T13:26:38Z", "_id": "cf9410fa-0bfb-4478-a249-37aa40e2d6b6", "_rev": "Gng42kcwkgwKuUtBkDbwGk", "_type": "restaurant", "_updatedAt": "2022-07-13T06:20:48Z", "address": "123 Main Street", "dishes": [{ "Price": 5, "_createdAt": "2022-07-12T08:00:57Z", "_id": "492851b3-70e0-4746-80a4-04d2e44f8934", "_rev": "Gng42kcwkgwKuUtBk5kYNC", "_type": "dish", "_updatedAt": "2022-07-12T08:00:57Z", "image": { "_type": "image", "asset": { "_ref": "image-9e1493f62484001c051fd164d0634d934a3077b9-800x450-jpg", "_type": "reference" } }, "name": "Steaks", "short_description": "Ariba yaba yaba yaba" }, { "Price": 8, "_createdAt": "2022-07-12T07:48:56Z", "_id": "72c0e071-4f33-4e4e-9c9a-ae4c9d6e7f87", "_rev": "6dNgvzjgwH6OT4iz0DvKks", "_type": "dish", "_updatedAt": "2022-07-12T07:48:56Z", "image": { "_type": "image", "asset": { "_ref": "image-1e3c27e138740876f88cf9c73bb412d44b15392e-275x183-jpg", "_type": "reference" } }, "name": "Dim sums", "short_description": "Dim dama sums" }, { "Price": 5, "_createdAt": "2022-07-12T08:17:23Z", "_id": "c0c5041b-6ba2-470d-ab88-e5c75c1c4465", "_rev": "IGjXs14mpjIFkE02pgXxnF", "_type": "dish", "_updatedAt": "2022-07-12T08:17:23Z", "image": { "_type": "image", "asset": { "_ref": "image-dc81176e8f46af95909c8c7959818593a2d67be3-800x800-webp", "_type": "reference" } }, "name": "Sandwiches", "short_description": "Typical Breakfast for the elites." }], "image": { "_type": "image", "asset": { "_ref": "image-4fb2dea92d48a3155cc863a2f3591d4b541865c4-183x275-jpg", "_type": "reference" } }, "lat": 20.5, "long": 0.2, "name": "Nandos", "rating": 4.5, "short_description": "Awesome Chicken", "type": { "_ref": "aecd4102-37c3-4c00-ad3c-20263990c578", "_type": "reference" } }, { "_createdAt": "2022-07-11T16:32:08Z", "_id": "83d6a3e8-ae6b-4322-ba6a-33057e25a1e4", "_rev": "6dNgvzjgwH6OT4iz0F57dC", "_type": "restaurant", "_updatedAt": "2022-07-13T06:21:19Z", "address": "G-20 Plot No. CP-08 Kanpur Road Sector B Phoenix United Mall, Lucknow, Uttar Pradesh 226010", "dishes": [{ "Price": 5, "_createdAt": "2022-07-12T08:18:37Z", "_id": "384453ee-01d4-4764-a293-811d1242eec1", "_rev": "Gng42kcwkgwKuUtBk5qZLC", "_type": "dish", "_updatedAt": "2022-07-12T08:18:37Z", "image": { "_type": "image", "asset": { "_ref": "image-c4dc111e839f0df791eadc8f49e03671bf080c85-2000x1334-webp", "_type": "reference" } }, "name": "Burger Breakfast ", "short_description": "Normalized burger with i18n enables." }, { "Price": 4, "_createdAt": "2022-07-11T16:25:27Z", "_id": "4a0cbbbe-a54e-47d0-94ac-5eb5bfa91569", "_rev": "6dNgvzjgwH6OT4iz0DJdFi", "_type": "dish", "_updatedAt": "2022-07-11T16:25:27Z", "image": { "_type": "image", "asset": { "_ref": "image-08598a24db7eadc77a0340ea86317c5b99ef5abd-136x132-png", "_type": "reference" } }, "name": "Bacon & Cheese Quarter Pounder", "short_description": "A Burger with Bacon. Unbelievable." }, { "Price": 3, "_createdAt": "2022-07-11T16:26:25Z", "_id": "9596a58f-69f0-4e74-9f6c-18ffef2c98d5", "_rev": "IGjXs14mpjIFkE02pes1NB", "_type": "dish", "_updatedAt": "2022-07-11T16:26:25Z", "image": { "_type": "image", "asset": { "_ref": "image-f17e8f306934b8ad29c82743270532f8a1ce9be4-120x147-png", "_type": "reference" } }, "name": "Cheese burger", "short_description": "A buger with lots and lots of cheese." }, { "Price": 5, "_createdAt": "2022-07-11T16:23:08Z", "_id": "eec3dbf5-677b-4984-9867-dfd302d89e63", "_rev": "IGjXs14mpjIFkE02percCP", "_type": "dish", "_updatedAt": "2022-07-11T16:23:23Z", "image": { "_type": "image", "asset": { "_ref": "image-be34217381f308f80a450b70b6be9c5f7dfe79a8-106x107-png", "_type": "reference" } }, "name": "Grilled Onion Cheddar Burger", "short_description": "A burger with rich cheese. Exactly." }], "image": { "_type": "image", "asset": { "_ref": "image-f7f386b1bb83876e5e2c71a076a59afacddcf3d7-474x474-jpg", "_type": "reference" } }, "lat": 26.7756996, "long": 80.7783828, "name": "McDonalds", "rating": 5, "short_description": "Friendly neighborhood McDonalds", "type": { "_ref": "f2073023-d011-43de-9067-8fa9e4e16981", "_type": "reference" } }, { "_createdAt": "2022-07-11T16:30:13Z", "_id": "9083d901-bda2-4190-8285-bdcb82313942", "_rev": "Gng42kcwkgwKuUtBkDc0xi", "_type": "restaurant", "_updatedAt": "2022-07-13T06:21:09Z", "address": "No CP 4/2, Crystal City Centre, Quila Rd, Ruchi Khand 1, Sharda Nagar, Lucknow, Uttar Pradesh 226012", "dishes": [{ "Price": 10, "_createdAt": "2022-07-12T07:59:00Z", "_id": "e70cb672-8e6c-4826-8ec2-edd1cc76637a", "_rev": "Gng42kcwkgwKuUtBk5jrMs", "_type": "dish", "_updatedAt": "2022-07-12T07:59:00Z", "image": { "_type": "image", "asset": { "_ref": "image-405c021b0e081a04947de553902cb83592d46265-550x550-jpg", "_type": "reference" } }, "name": "Roasted chicken", "short_description": "Chicken which in roasted format." }], "image": { "_type": "image", "asset": { "_ref": "image-8af4dc8812b70021a3cad2f665ac51fb0a6b942d-474x268-jpg", "_type": "reference" } }, "lat": 26.7753897, "long": 80.8834473, "name": "KFC", "rating": 3, "short_description": "Kentucky Fried Chicken", "type": { "_ref": "f2073023-d011-43de-9067-8fa9e4e16981", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:27:01Z", "_id": "251555d2-71c7-4bbf-856b-d1e6448b30f2", "_rev": "6dNgvzjgwH6OT4iz0F59Gc", "_type": "restaurant", "_updatedAt": "2022-07-13T06:22:01Z", "address": "RXXQ+666, Vishal Khand 3, Vishal Khand - 3, Vishal Khand, Gomti Nagar, Lucknow, Uttar Pradesh 226010", "dishes": [{ "Price": 10, "_createdAt": "2022-07-12T07:59:00Z", "_id": "e70cb672-8e6c-4826-8ec2-edd1cc76637a", "_rev": "Gng42kcwkgwKuUtBk5jrMs", "_type": "dish", "_updatedAt": "2022-07-12T07:59:00Z", "image": { "_type": "image", "asset": { "_ref": "image-405c021b0e081a04947de553902cb83592d46265-550x550-jpg", "_type": "reference" } }, "name": "Roasted chicken", "short_description": "Chicken which in roasted format." }, { "Price": 5, "_createdAt": "2022-07-12T08:14:23Z", "_id": "bca591a5-764f-4c7c-8707-a618a2238587", "_rev": "IGjXs14mpjIFkE02pgXYUD", "_type": "dish", "_updatedAt": "2022-07-12T08:14:23Z", "image": { "_type": "image", "asset": { "_ref": "image-6a385562109ed1dc78de5824b119a920583f4ec5-1200x1796-jpg", "_type": "reference" } }, "name": "Butter Chicken", "short_description": "Tandi tod logon k liye tangdi package." }], "image": { "_type": "image", "asset": { "_ref": "image-61b3de3beeb3d83c97fe0aa4467809ef56746718-223x226-jpg", "_type": "reference" } }, "lat": 26.8442898, "long": 80.9031369, "name": "Zaika", "rating": 5, "short_description": "Khana khaiye ghar jaisa.", "type": { "_ref": "96172656-ccc8-47d9-ba55-ea9f06d37325", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:25:24Z", "_id": "33e9cd2a-78da-4892-a57d-e8487179a892", "_rev": "IGjXs14mpjIFkE02pjccFN", "_type": "restaurant", "_updatedAt": "2022-07-13T06:22:11Z", "address": "Barista Creation Square Hazratganj 1st, Rana Pratap Marg, opposite National PG College, Lucknow, Uttar Pradesh 226001", "dishes": [{ "Price": 5, "_createdAt": "2022-07-12T08:19:24Z", "_id": "cce99a5e-229b-485d-9445-08988664dd22", "_rev": "6dNgvzjgwH6OT4iz0DwoOg", "_type": "dish", "_updatedAt": "2022-07-12T08:19:24Z", "image": { "_type": "image", "asset": { "_ref": "image-5bf58f9529467f0ea3e0bc63fbc9c8c5bbffcfe3-1200x900-jpg", "_type": "reference" } }, "name": "Orange Juice", "short_description": "For a shot of energy with great taste" }, { "Price": 7, "_createdAt": "2022-07-12T07:49:36Z", "_id": "a07a1b1f-8772-4d9c-aa3c-6efc1c1fc021", "_rev": "6dNgvzjgwH6OT4iz0DvMJe", "_type": "dish", "_updatedAt": "2022-07-12T07:49:36Z", "image": { "_type": "image", "asset": { "_ref": "image-d3c78fd83550ff9e6c210a9865d334b8d9cb7d7b-225x225-jpg", "_type": "reference" } }, "name": "Noodles", "short_description": "Shooosh veg noodles" }, { "Price": 6, "_createdAt": "2022-07-12T07:52:19Z", "_id": "04fa6e3e-baef-4677-87b8-79b9c33facee", "_rev": "Gng42kcwkgwKuUtBk5hc1m", "_type": "dish", "_updatedAt": "2022-07-12T07:52:19Z", "image": { "_type": "image", "asset": { "_ref": "image-3cc85b11c18c6fb7b9961b5ec0d6103306d04d6f-1200x1800-jpg", "_type": "reference" } }, "name": "Hakka Noodles", "short_description": "uggest this if you love lots of fresh veggies in your noodles." }, { "Price": 5, "_createdAt": "2022-07-12T08:16:41Z", "_id": "67fd4817-d17d-4879-bc82-652c5887cf48", "_rev": "6dNgvzjgwH6OT4iz0Dwi2c", "_type": "dish", "_updatedAt": "2022-07-12T08:16:41Z", "image": { "_type": "image", "asset": { "_ref": "image-b664f2ab6a646d1f73bbc8362f5d78d0d218401c-1280x720-jpg", "_type": "reference" } }, "name": "Burritos", "short_description": "Yeh swag walon ka naashta hai" }], "image": { "_type": "image", "asset": { "_ref": "image-f5894386edbc6fec28cd5213d7a0527ad18577f9-316x316-jpg", "_type": "reference" } }, "lat": 26.8441452, "long": 80.9033086, "name": "Barista", "rating": 5, "short_description": "Laporte Emuia Foodista", "type": { "_ref": "96172656-ccc8-47d9-ba55-ea9f06d37325", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:28:16Z", "_id": "7fd5d04f-c96e-48ca-b25a-c1febd8ccd82", "_rev": "IGjXs14mpjIFkE02pjca5B", "_type": "restaurant", "_updatedAt": "2022-07-13T06:21:51Z", "address": "Club Momentz, Gomti Nagar Rd, Near Eldeco Elegance, Vibhuti Khand, Gomti Nagar, Lucknow, Uttar Pradesh 226010", "dishes": [{ "Price": 4, "_createdAt": "2022-07-12T07:51:27Z", "_id": "11af0a72-89b8-4f48-8bab-a42185ba1606", "_rev": "6dNgvzjgwH6OT4iz0DvSBW", "_type": "dish", "_updatedAt": "2022-07-12T07:51:27Z", "image": { "_type": "image", "asset": { "_ref": "image-1d3d8e4d2629b03bcbd7d0d243cc85eeb9b2000b-1200x879-webp", "_type": "reference" } }, "name": "Vegetable Soup", "short_description": "Soup with lots of fresh vegetable to warm up your mood." }, { "Price": 5, "_createdAt": "2022-07-12T07:56:44Z", "_id": "3e1d1d02-f6df-4bcc-bf54-75781965e170", "_rev": "Gng42kcwkgwKuUtBk5jKW6", "_type": "dish", "_updatedAt": "2022-07-12T07:57:23Z", "image": { "_type": "image", "asset": { "_ref": "image-b4b4926443c0aa16c922dfcfe74d2394965659d1-3060x2033-jpg", "_type": "reference" } }, "name": "Hot dog", "short_description": "American vada paav" }, { "Price": 4, "_createdAt": "2022-07-12T07:50:15Z", "_id": "2033196d-10e3-40a3-9dfe-4d809683c4ec", "_rev": "IGjXs14mpjIFkE02pgUS1J", "_type": "dish", "_updatedAt": "2022-07-12T07:50:15Z", "image": { "_type": "image", "asset": { "_ref": "image-c7c6d907c353236350c7f0199278e822cbeec362-1200x1200-jpg", "_type": "reference" } }, "name": "Spring rolls", "short_description": "Roll like a spring roll" }, { "Price": 5, "_createdAt": "2022-07-12T08:19:24Z", "_id": "cce99a5e-229b-485d-9445-08988664dd22", "_rev": "6dNgvzjgwH6OT4iz0DwoOg", "_type": "dish", "_updatedAt": "2022-07-12T08:19:24Z", "image": { "_type": "image", "asset": { "_ref": "image-5bf58f9529467f0ea3e0bc63fbc9c8c5bbffcfe3-1200x900-jpg", "_type": "reference" } }, "name": "Orange Juice", "short_description": "For a shot of energy with great taste" }], "image": { "_type": "image", "asset": { "_ref": "image-2a75c76c8e05921558131b42da6ccdcdf1a78fe9-1200x1215-png", "_type": "reference" } }, "lat": 26.8444343, "long": 80.9029652, "name": "Starbucks", "rating": 3, "short_description": "Best place for coffee.", "type": { "_ref": "96172656-ccc8-47d9-ba55-ea9f06d37325", "_type": "reference" } }, { "_createdAt": "2022-07-12T07:28:29Z", "_id": "a006d6e5-068a-4ca4-bb1e-b395973a99ec", "_rev": "6dNgvzjgwH6OT4iz0F58J0", "_type": "restaurant", "_updatedAt": "2022-07-13T06:21:37Z", "address": "1, 25Vastu Khand Rd, Vastu Khand, Gomti Nagar, Lucknow, Uttar Pradesh 226010", "dishes": [{ "Price": 5, "_createdAt": "2022-07-12T08:12:48Z", "_id": "06db3d0c-c4ea-4895-9e80-e7a1c4494a9d", "_rev": "IGjXs14mpjIFkE02pgXG8f", "_type": "dish", "_updatedAt": "2022-07-12T08:12:48Z", "image": { "_type": "image", "asset": { "_ref": "image-95bda8260b845c92d9f5a1ce25646ba46652bb2a-1200x1200-jpg", "_type": "reference" } }, "name": "Pulao", "short_description": "A kind of rice dish made with healthy oils." }, { "Price": 4, "_createdAt": "2022-07-12T07:51:27Z", "_id": "11af0a72-89b8-4f48-8bab-a42185ba1606", "_rev": "6dNgvzjgwH6OT4iz0DvSBW", "_type": "dish", "_updatedAt": "2022-07-12T07:51:27Z", "image": { "_type": "image", "asset": { "_ref": "image-1d3d8e4d2629b03bcbd7d0d243cc85eeb9b2000b-1200x879-webp", "_type": "reference" } }, "name": "Vegetable Soup", "short_description": "Soup with lots of fresh vegetable to warm up your mood." }, { "Price": 6, "_createdAt": "2022-07-12T08:06:15Z", "_id": "34b8969e-901a-447f-a623-b344b9aee5b5", "_rev": "IGjXs14mpjIFkE02pgWIQz", "_type": "dish", "_updatedAt": "2022-07-12T08:06:15Z", "image": { "_type": "image", "asset": { "_ref": "image-df6d74525ccca2cdc2e1b06e5252d7a1b2b1df1e-1200x900-jpg", "_type": "reference" } }, "name": "Matar Panner", "short_description": "Desi indian sabzi to eat with tava roti" }, { "Price": 5, "_createdAt": "2022-07-12T08:11:18Z", "_id": "33f0d5ce-2f7b-4ded-9aca-436da84c7605", "_rev": "IGjXs14mpjIFkE02pgX1UH", "_type": "dish", "_updatedAt": "2022-07-12T08:11:18Z", "image": { "_type": "image", "asset": { "_ref": "image-9815bdf0ae4806716332d660a92b7311597daa6e-1200x1800-jpg", "_type": "reference" } }, "name": "Rajma", "short_description": "Rajma ke saath chwal khaiye. Maza aa jayega." }, { "Price": 5, "_createdAt": "2022-07-12T08:15:00Z", "_id": "43557ef7-7a85-4d47-827e-f6c825e034b0", "_rev": "IGjXs14mpjIFkE02pgXcRt", "_type": "dish", "_updatedAt": "2022-07-12T08:15:00Z", "image": { "_type": "image", "asset": { "_ref": "image-6a385562109ed1dc78de5824b119a920583f4ec5-1200x1796-jpg", "_type": "reference" } }, "name": "Butter Naan", "short_description": "Good to have with butter chicken" }, { "Price": 5, "_createdAt": "2022-07-12T08:09:39Z", "_id": "7a91a59d-5863-457e-973e-d6c8abdc089c", "_rev": "Gng42kcwkgwKuUtBk5nTRG", "_type": "dish", "_updatedAt": "2022-07-12T08:09:39Z", "image": { "_type": "image", "asset": { "_ref": "image-cf4651696e61722bab6876f1e87ab32efd795f55-1200x1634-jpg", "_type": "reference" } }, "name": "Kofta", "short_description": "Kofte ki sabji. .. Yeh woh meethi wali nahi hai." }, { "Price": 5, "_createdAt": "2022-07-12T08:07:41Z", "_id": "e6fc495e-c075-430f-bbc8-6d48c0ad5425", "_rev": "Gng42kcwkgwKuUtBk5mgt4", "_type": "dish", "_updatedAt": "2022-07-12T08:07:41Z", "image": { "_type": "image", "asset": { "_ref": "image-2b241157ac58af7c7c0048b304d037528f893f68-259x194-jpg", "_type": "reference" } }, "name": "Tava Roti", "short_description": "Roti garam garam kar de maze" }], "image": { "_type": "image", "asset": { "_ref": "image-011bed4e237d79668f80a53c17cb5ad9b767f3ba-223x226-png", "_type": "reference" } }, "lat": 26.8445789, "long": 80.9027935, "name": "Champaran", "rating": 5, "short_description": "Champa ki haveli pe khaan ka swaad lijiye", "type": { "_ref": "b15e4c17-e9c4-4e4d-8826-ffbf8f9b3d96", "_type": "reference" } }], "featuredRows": [{ "_createdAt": "2022-07-12T07:05:47Z", "_id": "78a3d967-cbcb-4b30-a50c-c22eba0f4316", "_rev": "6dNgvzjgwH6OT4iz0Dt7IY", "_type": "featured", "_updatedAt": "2022-07-12T07:21:09Z", "name": "Offers near you", "restaurants": [0, 1, 2, 3], "short_description": "Check out these local stores for that desi taste." }, { "_createdAt": "2022-07-11T16:27:13Z", "_id": "982ecd26-34f2-4e57-adf3-cad353f1ce62", "_rev": "IGjXs14mpjIFkE02pgMpsX", "_type": "featured", "_updatedAt": "2022-07-12T07:03:54Z", "name": "Featured", "restaurants": [4, 5, 6, 7], "short_description": "A list of freshly curated dishes" }, { "_createdAt": "2022-07-12T07:05:15Z", "_id": "cb447e26-439e-45b0-a293-aead6e430133", "_rev": "Gng42kcwkgwKuUtBk5Tsy6", "_type": "featured", "_updatedAt": "2022-07-12T07:31:27Z", "name": "Tasty Discounts", "restaurants": [8, 9, 10, 11], "short_description": "Try out these cheap but tasty alternatives" }], "activeRestaurantIdx": 0 } }
@@ -1,74 +0,0 @@
1
- import { ClassDescriptor, DataClass } from "../dsl-descriptor";
2
- import { DateTime } from "./example_descriptor";
3
- export interface SanityDish {
4
- Price: number;
5
- _createdAt: string;
6
- _id: string;
7
- _rev: string;
8
- _type: string;
9
- _updatedAt: string;
10
- name: string;
11
- short_description: string;
12
- }
13
- export interface SanityRestaurant {
14
- _createdAt: string;
15
- _id: string;
16
- _rev: string;
17
- _type: string;
18
- _updatedAt: string;
19
- address: string;
20
- lat: number;
21
- long: number;
22
- rating: number;
23
- short_description: string;
24
- dishes: SanityDish[];
25
- name: string;
26
- }
27
- export interface SanityFeaturedRow {
28
- _createdAt: string;
29
- _id: string;
30
- _rev: string;
31
- _type: string;
32
- _updatedAt: string;
33
- name: string;
34
- short_description: string;
35
- restaurants: number[];
36
- }
37
- export interface State {
38
- basket: {
39
- items: SanityDish[];
40
- };
41
- restaurant: {
42
- restaurants: SanityRestaurant[];
43
- featuredRows: SanityFeaturedRow[];
44
- activeRestaurantIdx: number;
45
- };
46
- }
47
- declare class GenieDish extends DataClass {
48
- price: number;
49
- created: DateTime;
50
- name: string;
51
- short_description: string;
52
- id: string;
53
- description(): {};
54
- static all(): GenieDish[];
55
- static fromSanityDish(dish: SanityDish): GenieDish;
56
- static ClassDescriptor: ClassDescriptor<GenieDish>;
57
- }
58
- declare class GenieOrder extends DataClass {
59
- static addFoods({ dishes }: {
60
- dishes: GenieDish[];
61
- }): void;
62
- static removeFoods({ dishes }: {
63
- dishes: GenieDish[];
64
- }): void;
65
- static orderedFoods(): GenieDish[];
66
- static ClassDescriptor: ClassDescriptor<GenieOrder>;
67
- description(): {};
68
- }
69
- export declare const GenieClassDescriptors: ClassDescriptor<GenieOrder>[];
70
- export declare const GenieClassesExamples: {
71
- user_utterance: string;
72
- example_parsed: string;
73
- }[];
74
- export {};
@@ -1,205 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GenieClassesExamples = exports.GenieClassDescriptors = void 0;
7
- const dsl_descriptor_1 = require("../dsl-descriptor");
8
- const example_descriptor_1 = require("./example_descriptor");
9
- const nl_interpreter_1 = require("../nl-interpreter");
10
- const food_descriptor_state_json_1 = __importDefault(require("./food_descriptor.state.json"));
11
- const decorators_1 = require("../decorators");
12
- (0, decorators_1.initGenie)();
13
- const initialState = JSON.parse(JSON.stringify(food_descriptor_state_json_1.default));
14
- let state = JSON.parse(JSON.stringify(food_descriptor_state_json_1.default));
15
- function resetState() {
16
- state = JSON.parse(JSON.stringify(initialState));
17
- }
18
- function findAllDishes() {
19
- return state.restaurant.restaurants.reduce((acc, restaurant) => {
20
- return acc.concat(restaurant.dishes);
21
- }, new Array());
22
- }
23
- class GenieDish extends dsl_descriptor_1.DataClass {
24
- constructor() {
25
- super(...arguments);
26
- this.price = 0;
27
- this.created = example_descriptor_1.DateTime.today();
28
- this.name = "";
29
- this.short_description = "";
30
- this.id = "";
31
- }
32
- description() {
33
- return {
34
- name: this.name,
35
- price: this.price,
36
- short_description: this.short_description,
37
- };
38
- }
39
- static all() {
40
- return findAllDishes().map((dish) => GenieDish.fromSanityDish(dish));
41
- }
42
- static fromSanityDish(dish) {
43
- const ld = new GenieDish({ name: dish.name });
44
- ld.name = dish.name;
45
- ld.price = dish.Price;
46
- ld.short_description = dish.short_description;
47
- ld.created = example_descriptor_1.DateTime.fromDate(new Date(dish._createdAt));
48
- ld.id = dish._id;
49
- return ld;
50
- }
51
- static { this.ClassDescriptor = new dsl_descriptor_1.ClassDescriptor("Dish", [new dsl_descriptor_1.FuncDescriptor("all", [], "Dish[]", true)], [
52
- new dsl_descriptor_1.FieldDescriptor("price", "int", false),
53
- new dsl_descriptor_1.FieldDescriptor("created", "DateTime", false),
54
- new dsl_descriptor_1.FieldDescriptor("name", "string", false),
55
- new dsl_descriptor_1.FieldDescriptor("short_description", "string", false),
56
- ], GenieDish); }
57
- }
58
- class GenieRestaurant extends dsl_descriptor_1.DataClass {
59
- constructor() {
60
- super(...arguments);
61
- this.name = "";
62
- this.created = example_descriptor_1.DateTime.today();
63
- this.updated = example_descriptor_1.DateTime.today();
64
- this.address = "";
65
- this.dishes = [];
66
- this.rating = 0;
67
- this.short_description = "";
68
- this.id = "";
69
- }
70
- static all() {
71
- return state.restaurant.restaurants.map((r) => GenieRestaurant.fromSanityRestaurant(r));
72
- }
73
- static current() {
74
- return GenieRestaurant.fromSanityRestaurant(state.restaurant.restaurants[state.restaurant.activeRestaurantIdx]);
75
- }
76
- description() {
77
- return {
78
- name: this.name,
79
- address: this.address,
80
- rating: this.rating,
81
- short_description: this.short_description,
82
- };
83
- }
84
- static select(restaurant) {
85
- const idx = state.restaurant.restaurants.findIndex((r) => r._id === restaurant.id);
86
- if (idx !== -1) {
87
- state.restaurant.activeRestaurantIdx = idx;
88
- }
89
- }
90
- static fromSanityRestaurant(restaurant) {
91
- const lr = new GenieRestaurant({ name: restaurant.name });
92
- lr.name = restaurant.name;
93
- lr.address = restaurant.address;
94
- lr.rating = restaurant.rating;
95
- lr.short_description = restaurant.short_description;
96
- lr.created = example_descriptor_1.DateTime.fromDate(new Date(restaurant._createdAt));
97
- lr.updated = example_descriptor_1.DateTime.fromDate(new Date(restaurant._updatedAt));
98
- lr.dishes = restaurant.dishes.map((dish) => GenieDish.fromSanityDish(dish));
99
- lr.id = restaurant._id;
100
- return lr;
101
- }
102
- static { this.ClassDescriptor = new dsl_descriptor_1.ClassDescriptor("Restaurant", [
103
- new dsl_descriptor_1.FuncDescriptor("all", [], "Restaurant[]", true),
104
- new dsl_descriptor_1.FuncDescriptor("current", [], "Restaurant", true),
105
- new dsl_descriptor_1.FuncDescriptor("select", [new dsl_descriptor_1.ParamDescriptor("restaurant", "Restaurant", true)], "void", true),
106
- ], [
107
- new dsl_descriptor_1.FieldDescriptor("name", "string", false),
108
- new dsl_descriptor_1.FieldDescriptor("created", "DateTime", false),
109
- new dsl_descriptor_1.FieldDescriptor("updated", "DateTime", false),
110
- new dsl_descriptor_1.FieldDescriptor("address", "string", false),
111
- new dsl_descriptor_1.FieldDescriptor("dishes", "Dish[]", true),
112
- new dsl_descriptor_1.FieldDescriptor("rating", "int", false),
113
- new dsl_descriptor_1.FieldDescriptor("short_description", "string", false),
114
- ], GenieRestaurant); }
115
- }
116
- class GenieOrder extends dsl_descriptor_1.DataClass {
117
- static addFoods({ dishes }) {
118
- const idsToAdd = dishes.map((dish) => dish.id);
119
- state.basket.items = [
120
- ...state.basket.items,
121
- ...findAllDishes().filter((dish) => idsToAdd.includes(dish._id)),
122
- ];
123
- }
124
- static removeFoods({ dishes }) {
125
- const idsToRemove = dishes.map((dish) => dish.id);
126
- state.basket.items = state.basket.items.filter((item) => !idsToRemove.includes(item._id));
127
- }
128
- static orderedFoods() {
129
- return state.basket.items.map((item) => GenieDish.fromSanityDish(item));
130
- }
131
- static { this.ClassDescriptor = new dsl_descriptor_1.ClassDescriptor("Order", [
132
- new dsl_descriptor_1.FuncDescriptor("addFoods", [new dsl_descriptor_1.ParamDescriptor("dishes", "Dish[]", true)], "void", true),
133
- new dsl_descriptor_1.FuncDescriptor("removeFoods", [new dsl_descriptor_1.ParamDescriptor("dishes", "Dish[]", true)], "void", true),
134
- new dsl_descriptor_1.FuncDescriptor("orderedFoods", [], "Dish[]", true),
135
- ], [], GenieOrder); }
136
- description() {
137
- return {};
138
- }
139
- }
140
- exports.GenieClassDescriptors = [
141
- GenieRestaurant.ClassDescriptor,
142
- GenieDish.ClassDescriptor,
143
- GenieOrder.ClassDescriptor,
144
- example_descriptor_1.DateTime._ClassDescriptor,
145
- ];
146
- exports.GenieClassesExamples = [
147
- {
148
- user_utterance: "select subway",
149
- example_parsed: 'Restaurant.select(restaurant: Restaurant.all().matching(field: .name, value: "subway")[0])',
150
- },
151
- {
152
- user_utterance: "order steak",
153
- example_parsed: 'Order.addFoods(dishes: [Dish.all().matching(field: .name, value: "steak")])',
154
- },
155
- {
156
- user_utterance: "order fries from current restaurant",
157
- example_parsed: 'Order.addFoods(dishes: [Restaurant.current().dishes.matching(field: .name, value: "fries")])\n',
158
- },
159
- {
160
- user_utterance: "add two hamburgers",
161
- example_parsed: 'Order.addFoods(dishes: [Dish.all().matching(field: .name, value: "hamburger")[0], Dish.all().matching(field: .name, value: "hamburger")[0]])',
162
- },
163
- ];
164
- jest.setTimeout(30000);
165
- describe("Food descriptor interpreter regression", () => {
166
- const originalFetch = global.fetch;
167
- beforeEach(() => {
168
- resetState();
169
- });
170
- afterEach(() => {
171
- global.fetch = originalFetch;
172
- jest.restoreAllMocks();
173
- });
174
- test("Simple function", async () => {
175
- global.fetch = jest.fn().mockResolvedValue(new Response(JSON.stringify({
176
- choices: [
177
- {
178
- message: {
179
- content: JSON.stringify({
180
- command: 'Order.addFoods(dishes: [Dish.all().matching(field: .name, value: "Sub")[0]])',
181
- }),
182
- },
183
- },
184
- ],
185
- usage: {},
186
- }), { status: 200, headers: { "content-type": "application/json" } }));
187
- const interpreter = new nl_interpreter_1.NlInterpreter(exports.GenieClassDescriptors, "test-key", undefined, exports.GenieClassesExamples, undefined, {
188
- parser: {
189
- provider: "groq",
190
- groq: {
191
- baseUrl: "https://proxy.example.com/openai/v1",
192
- model: "llama-3.3-70b-versatile",
193
- },
194
- },
195
- });
196
- const funcCallResult = await interpreter.interpret("add a sub to basket");
197
- expect(funcCallResult).toEqual({
198
- objectType: "void",
199
- type: "object",
200
- });
201
- expect(state.basket.items).toHaveLength(2);
202
- expect(state.basket.items.every((item) => item.name === "Sub")).toBe(true);
203
- });
204
- });
205
- //# sourceMappingURL=food_descriptor.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"food_descriptor.test.js","sourceRoot":"","sources":["../../lib/__test__/food_descriptor.test.ts"],"names":[],"mappings":";;;;;;AAAA,sDAM2B;AAC3B,6DAAgD;AAChD,sDAAkD;AAClD,8FAAqD;AACrD,8CAA0C;AAE1C,IAAA,sBAAS,GAAE,CAAC;AAkDZ,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,oCAAS,CAAC,CAAU,CAAC;AACpE,IAAI,KAAK,GAAU,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,oCAAS,CAAC,CAAU,CAAC;AAElE,SAAS,UAAU;IACjB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAU,CAAC;AAC5D,CAA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BACJ,OAAO,EAAE,qCAAqC;oBAC9C,KAAK,EAAE,yBAAyB;iBACjC;aACF;SACF,CACF,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAE1E,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC;YAC7B,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const nl_interpreter_1 = require("../nl-interpreter");
4
- const example_descriptor_1 = require("./example_descriptor");
5
- const nl_parser_1 = require("../nl/nl-parser");
6
- const nl_parser_groq_1 = require("../nl/nl-parser-groq");
7
- const decorators_1 = require("../decorators");
8
- (0, decorators_1.initGenie)();
9
- describe("NlInterpreter provider selection", () => {
10
- const originalParserProvider = process.env.GENIE_PARSER_PROVIDER;
11
- afterEach(() => {
12
- if (originalParserProvider === undefined) {
13
- delete process.env.GENIE_PARSER_PROVIDER;
14
- return;
15
- }
16
- process.env.GENIE_PARSER_PROVIDER = originalParserProvider;
17
- });
18
- test("uses NlParser when parser.provider is openai", () => {
19
- const interpreter = new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, "token", undefined, example_descriptor_1.examples, undefined, {
20
- parser: {
21
- provider: "openai",
22
- openai: {
23
- baseUrl: "https://proxy.example.com",
24
- model: "gpt-4o-mini",
25
- },
26
- },
27
- });
28
- expect(interpreter.nlParser).toBeInstanceOf(nl_parser_1.NlParser);
29
- expect(interpreter.nlParser.chatCompletionsEndpoint).toBe("https://proxy.example.com/openai/v1/chat/completions");
30
- });
31
- test("uses NlParserGroq when parser.provider is groq", () => {
32
- const interpreter = new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, "token", undefined, example_descriptor_1.examples, undefined, {
33
- parser: {
34
- provider: "groq",
35
- groq: {
36
- baseUrl: "https://proxy.example.com",
37
- model: "llama-3.3-70b-versatile",
38
- },
39
- },
40
- });
41
- expect(interpreter.nlParser).toBeInstanceOf(nl_parser_groq_1.NlParserGroq);
42
- expect(interpreter.nlParser.chatCompletionsEndpoint).toBe("https://proxy.example.com/openai/v1/chat/completions");
43
- });
44
- test("defaults to NlParserGroq when provider is not configured", () => {
45
- delete process.env.GENIE_PARSER_PROVIDER;
46
- const interpreter = new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, "token", undefined, example_descriptor_1.examples);
47
- expect(interpreter.nlParser).toBeInstanceOf(nl_parser_groq_1.NlParserGroq);
48
- expect(interpreter.nlParser.chatCompletionsEndpoint).toBe("https://api.groq.com/openai/v1/chat/completions");
49
- });
50
- test("uses env provider when parser.provider is not provided", () => {
51
- process.env.GENIE_PARSER_PROVIDER = "openai";
52
- const interpreter = new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, "token", undefined, example_descriptor_1.examples, undefined, {
53
- parser: {
54
- openai: {
55
- baseUrl: "https://proxy.example.com",
56
- model: "gpt-4o-mini",
57
- },
58
- },
59
- });
60
- expect(interpreter.nlParser).toBeInstanceOf(nl_parser_1.NlParser);
61
- });
62
- test("throws when OpenAI parser model is missing", () => {
63
- expect(() => new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, "token", undefined, example_descriptor_1.examples, undefined, {
64
- parser: {
65
- provider: "openai",
66
- openai: {
67
- baseUrl: "https://proxy.example.com",
68
- },
69
- },
70
- })).toThrow(/semanticModel|SEMANTIC_MODEL/i);
71
- });
72
- });
73
- //# sourceMappingURL=nl-interpreter-provider-selection.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nl-interpreter-provider-selection.test.js","sourceRoot":"","sources":["../../lib/__test__/nl-interpreter-provider-selection.test.ts"],"names":[],"mappings":";;AAAA,sDAAkD;AAClD,6DAAgE;AAChE,+CAA2C;AAC3C,yDAAoD;AACpD,8CAA0C;AAE1C,IAAA,sBAAS,GAAE,CAAC;AAEZ,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,MAAM,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;YACzC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;YACzC,OAAO;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,sBAAsB,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACxD,MAAM,WAAW,GAAG,IAAI,8BAAa,CACnC,mCAAc,EACd,OAAO,EACP,SAAS,EACT,6BAAQ,EACR,SAAS,EACT;YACE,MAAM,EAAE;gBACN,QAAQ,EAAE,QAAQ;gBAClB,MAAM,EAAE;oBACN,OAAO,EAAE,2BAA2B;oBACpC,KAAK,EAAE,aAAa;iBACrB;aACF;SACF,CACF,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,oBAAQ,CAAC,CAAC;QACtD,MAAM,CAAE,WAAW,CAAC,QAAgB,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAChE,sDAAsD,CACvD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;QAC1D,MAAM,WAAW,GAAG,IAAI,8BAAa,CACnC,mCAAc,EACd,OAAO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,EAAE,GAAG,EAAE;QACtD,MAAM,CACJ,GAAG,EAAE,CACH,IAAI,8BAAa,CACf,mCAAc,EACd,OAAO,EACP,SAAS,EACT,6BAAQ,EACR,SAAS,EACT;YACE,MAAM,EAAE;gBACN,QAAQ,EAAE,QAAQ;gBAClB,MAAM,EAAE;oBACN,OAAO,EAAE,2BAA2B;iBACrC;aACF;SACF,CACF,CACJ,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const nl_interpreter_1 = require("../nl-interpreter");
4
- const example_descriptor_1 = require("./example_descriptor");
5
- const decorators_1 = require("../decorators");
6
- (0, decorators_1.initGenie)();
7
- jest.setTimeout(30000);
8
- describe('NlInterpreter offline', () => {
9
- const originalFetch = global.fetch;
10
- afterEach(() => {
11
- global.fetch = originalFetch;
12
- jest.restoreAllMocks();
13
- });
14
- test('interpret succeeds offline with the OpenAI parser path', async () => {
15
- global.fetch = jest.fn().mockResolvedValue(new Response(JSON.stringify({
16
- choices: [{
17
- message: { content: JSON.stringify({ command: 'Restaurant.current().name' }) },
18
- }],
19
- usage: {},
20
- }), { status: 200, headers: { 'content-type': 'application/json' } }));
21
- const interpreter = new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, 'test-key', undefined, example_descriptor_1.examples, undefined, {
22
- parser: {
23
- provider: 'openai',
24
- openai: {
25
- baseUrl: 'https://api.openai.com/v1',
26
- model: 'gpt-4o-mini',
27
- },
28
- },
29
- });
30
- const funcCallResult = await interpreter.interpret('what is the name of the hamburger?');
31
- expect(funcCallResult).toEqual({
32
- objectType: 'string',
33
- type: 'object',
34
- value: "McDonald's",
35
- });
36
- });
37
- test('respond succeeds offline with structured agent responses', async () => {
38
- global.fetch = jest
39
- .fn()
40
- .mockResolvedValueOnce(new Response(JSON.stringify({
41
- choices: [{
42
- message: {
43
- content: JSON.stringify({
44
- command: 'Restaurant.all().matching(field: .address, value: "palo alto").sort(field: .priceGrade, ascending: true)[0]',
45
- }),
46
- },
47
- }],
48
- usage: {},
49
- }), { status: 200, headers: { 'content-type': 'application/json' } }))
50
- .mockResolvedValueOnce(new Response(JSON.stringify({
51
- choices: [{
52
- message: {
53
- content: JSON.stringify({
54
- minimalText: 'Found restaurant',
55
- fullText: 'I found the cheapest restaurant in Palo Alto.',
56
- type: 'success',
57
- shouldSpeak: true,
58
- }),
59
- },
60
- }],
61
- usage: {},
62
- }), { status: 200, headers: { 'content-type': 'application/json' } }));
63
- const interpreter = new nl_interpreter_1.NlInterpreter(example_descriptor_1.allDescriptors, 'test-key', undefined, example_descriptor_1.examples, undefined, {
64
- parser: {
65
- provider: 'openai',
66
- openai: {
67
- baseUrl: 'https://api.openai.com/v1',
68
- model: 'gpt-4o-mini',
69
- },
70
- },
71
- });
72
- const userUtterance = 'get me the cheapest restaurant in palo alto';
73
- const parsed = await interpreter.nlParser.parse(userUtterance);
74
- expect(parsed).toBe('Restaurant.all().matching(field: .address, value: "palo alto").sort(field: .priceGrade, ascending: true)[0]');
75
- const funcCallResult = await interpreter.dslInterpreter.interpret(parsed);
76
- const resultString = JSON.stringify(funcCallResult.value.description());
77
- const response = await interpreter.nlParser.respond(userUtterance, parsed, resultString);
78
- expect(response).toEqual({
79
- minimalText: 'Found restaurant',
80
- fullText: 'I found the cheapest restaurant in Palo Alto.',
81
- type: 'success',
82
- shouldSpeak: true,
83
- });
84
- });
85
- });
86
- //# sourceMappingURL=nl-interpreter.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nl-interpreter.test.js","sourceRoot":"","sources":["../../lib/__test__/nl-interpreter.test.ts"],"names":[],"mappings":";;AAAA,sDAAkD;AAClD,6DAAgE;AAChE,8CAA0C;AAE1C,IAAA,sBAAS,GAAE,CAAC;AAEZ,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC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