@lowdefy/docs-content 0.0.0-experimental-20260928120643 → 6.1.0

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 (226) hide show
  1. package/README.md +0 -1
  2. package/content/actions/link.md +0 -17
  3. package/content/actions/login.md +5 -23
  4. package/content/actions/logout.md +5 -5
  5. package/content/actions/pdfmake.md +2 -2
  6. package/content/actions/setdarkmode.md +2 -2
  7. package/content/agents/agent-properties.md +2 -4
  8. package/content/agents/agentchat.md +6 -21
  9. package/content/agents/agentconversations.md +2 -2
  10. package/content/concepts/ai-agent-docs.md +101 -313
  11. package/content/concepts/cli.md +3 -34
  12. package/content/concepts/connections-and-requests.md +0 -402
  13. package/content/concepts/custom-html.md +0 -40
  14. package/content/concepts/custom-styling.md +5 -50
  15. package/content/concepts/events-and-actions.md +2 -64
  16. package/content/concepts/i18n.md +2 -7
  17. package/content/concepts/keyboard-shortcuts.md +2 -2
  18. package/content/concepts/layout-overview.md +1 -1
  19. package/content/concepts/logger.md +0 -81
  20. package/content/concepts/lowdefy-schema.md +1 -4
  21. package/content/concepts/menus.md +7 -7
  22. package/content/concepts/module-authoring.md +2 -2
  23. package/content/connections/anthropic.md +2 -162
  24. package/content/connections/awss3.md +0 -54
  25. package/content/connections/google.md +2 -162
  26. package/content/connections/mongodb.md +3 -121
  27. package/content/connections/openai-connection.md +2 -162
  28. package/content/container-blocks/affix.md +7 -47
  29. package/content/container-blocks/alert.md +24 -76
  30. package/content/container-blocks/badge.md +24 -100
  31. package/content/container-blocks/box.md +9 -9
  32. package/content/container-blocks/card.md +25 -80
  33. package/content/container-blocks/carousel.md +7 -60
  34. package/content/container-blocks/collapse.md +9 -87
  35. package/content/container-blocks/configprovider.md +13 -35
  36. package/content/container-blocks/confirmmodal.md +23 -69
  37. package/content/container-blocks/content.md +98 -62
  38. package/content/container-blocks/descriptions.md +4 -45
  39. package/content/container-blocks/drawer.md +28 -92
  40. package/content/container-blocks/dropdownmenu.md +31 -119
  41. package/content/container-blocks/flex.md +62 -40
  42. package/content/container-blocks/footer.md +11 -15
  43. package/content/container-blocks/googlemapsheatmap.md +1 -1
  44. package/content/container-blocks/googlemapsscript.md +2 -2
  45. package/content/container-blocks/header.md +36 -71
  46. package/content/container-blocks/label.md +7 -34
  47. package/content/container-blocks/layout.md +34 -52
  48. package/content/container-blocks/masonry.md +71 -17
  49. package/content/container-blocks/mobilemenu.md +88 -131
  50. package/content/container-blocks/modal.md +26 -114
  51. package/content/container-blocks/pageheadermenu.md +31 -81
  52. package/content/container-blocks/pagesidebarlayout.md +26 -169
  53. package/content/container-blocks/pagesidermenu.md +42 -95
  54. package/content/container-blocks/popover.md +31 -34
  55. package/content/container-blocks/result.md +21 -32
  56. package/content/container-blocks/sider.md +122 -85
  57. package/content/container-blocks/span.md +7 -7
  58. package/content/container-blocks/spinner.md +3 -3
  59. package/content/container-blocks/splitter.md +68 -150
  60. package/content/container-blocks/tabs.md +12 -64
  61. package/content/container-blocks/tooltip.md +46 -22
  62. package/content/container-blocks/watermark.md +4 -22
  63. package/content/controls/reject.md +2 -4
  64. package/content/controls/throw.md +0 -1
  65. package/content/controls/try.md +2 -3
  66. package/content/deployment/deployment-environments.md +6 -8
  67. package/content/deployment/docker.md +7 -22
  68. package/content/deployment/node-server.md +0 -4
  69. package/content/deployment/vercel.md +6 -13
  70. package/content/display-blocks/aggrid.md +11 -26
  71. package/content/display-blocks/anchor.md +15 -15
  72. package/content/display-blocks/avatar.md +37 -57
  73. package/content/display-blocks/breadcrumb.md +21 -70
  74. package/content/display-blocks/button.md +18 -92
  75. package/content/display-blocks/calendar.md +0 -12
  76. package/content/display-blocks/dangeroushtml.md +1 -1
  77. package/content/display-blocks/difflist.md +1 -1
  78. package/content/display-blocks/difftimeline.md +1 -1
  79. package/content/display-blocks/divider.md +3 -64
  80. package/content/display-blocks/dropdownbutton.md +28 -79
  81. package/content/display-blocks/echart.md +1 -35
  82. package/content/display-blocks/floatbutton.md +42 -129
  83. package/content/display-blocks/html.md +1 -61
  84. package/content/display-blocks/icon.md +67 -250
  85. package/content/display-blocks/menu.md +73 -145
  86. package/content/display-blocks/message.md +124 -38
  87. package/content/display-blocks/notification.md +222 -94
  88. package/content/display-blocks/paragraph.md +9 -59
  89. package/content/display-blocks/progress.md +17 -96
  90. package/content/display-blocks/qrcode.md +4 -19
  91. package/content/display-blocks/s3download.md +1 -1
  92. package/content/display-blocks/search.md +7 -17
  93. package/content/display-blocks/skeletonbutton.md +0 -1
  94. package/content/display-blocks/skeletoninput.md +0 -1
  95. package/content/display-blocks/statistic.md +17 -75
  96. package/content/display-blocks/steps.md +25 -58
  97. package/content/display-blocks/tag.md +17 -102
  98. package/content/display-blocks/title.md +11 -50
  99. package/content/display-blocks/tour.md +23 -33
  100. package/content/input-blocks/autocomplete.md +9 -81
  101. package/content/input-blocks/buttonselector.md +8 -45
  102. package/content/input-blocks/checkboxselector.md +7 -97
  103. package/content/input-blocks/checkboxswitch.md +3 -33
  104. package/content/input-blocks/colorselector.md +14 -63
  105. package/content/input-blocks/daterangeselector.md +45 -165
  106. package/content/input-blocks/dateselector.md +41 -139
  107. package/content/input-blocks/datetimeselector.md +49 -158
  108. package/content/input-blocks/inputgallery.md +3 -3
  109. package/content/input-blocks/monthselector.md +52 -120
  110. package/content/input-blocks/multipleselector.md +39 -150
  111. package/content/input-blocks/numberinput.md +12 -98
  112. package/content/input-blocks/pagination.md +14 -70
  113. package/content/input-blocks/paragraphinput.md +37 -51
  114. package/content/input-blocks/passwordinput.md +6 -60
  115. package/content/input-blocks/phonenumberinput.md +26 -59
  116. package/content/input-blocks/radioselector.md +7 -83
  117. package/content/input-blocks/ratingslider.md +26 -57
  118. package/content/input-blocks/s3uploadbutton.md +24 -24
  119. package/content/input-blocks/s3uploaddragger.md +3 -3
  120. package/content/input-blocks/s3uploadphoto.md +5 -5
  121. package/content/input-blocks/segmentedselector.md +32 -72
  122. package/content/input-blocks/selector.md +21 -109
  123. package/content/input-blocks/switch.md +17 -65
  124. package/content/input-blocks/textarea.md +3 -32
  125. package/content/input-blocks/textinput.md +28 -69
  126. package/content/input-blocks/tiptapmentioninput.md +1 -1
  127. package/content/input-blocks/titleinput.md +12 -39
  128. package/content/input-blocks/treeinput.md +25 -49
  129. package/content/input-blocks/treemultipleselector.md +10 -127
  130. package/content/input-blocks/treeselector.md +9 -97
  131. package/content/input-blocks/upload.md +15 -64
  132. package/content/input-blocks/uploaddragger.md +1 -17
  133. package/content/input-blocks/uploadphoto.md +1 -18
  134. package/content/input-blocks/weekselector.md +55 -120
  135. package/content/list-blocks/controlledlist.md +15 -24
  136. package/content/list-blocks/list.md +11 -11
  137. package/content/list-blocks/masonrylist.md +34 -7
  138. package/content/migration/upgrade-guide.md +0 -1
  139. package/content/operators/_app.md +1 -2
  140. package/content/operators/_error.md +1 -23
  141. package/content/operators/_get.md +6 -6
  142. package/content/operators/_operator.md +3 -17
  143. package/content/operators/_ref.md +0 -258
  144. package/content/operators/_type.md +3 -14
  145. package/content/operators/_user.md +3 -3
  146. package/content/other/introduction.md +1 -1
  147. package/content/plugins/plugins-dev.md +0 -66
  148. package/content/plugins/plugins-introduction.md +1 -27
  149. package/content/testing/e2e-configuration.md +1 -8
  150. package/content/testing/e2e-getting-started.md +1 -1
  151. package/content/testing/e2e-introduction.md +1 -1
  152. package/content/tutorial/tutorial-actions-operators.md +2 -2
  153. package/content/tutorial/tutorial-add-blocks.md +2 -2
  154. package/content/tutorial/tutorial-create-page.md +2 -48
  155. package/content/tutorial/tutorial-display-data-page.md +3 -3
  156. package/content/tutorial/tutorial-requests-sql.md +0 -153
  157. package/content/tutorial/tutorial-start.md +1 -66
  158. package/content/user-authentication/login-and-logout.md +8 -158
  159. package/content/user-authentication/users-introduction.md +0 -8
  160. package/index.json +2 -6065
  161. package/package.json +1 -7
  162. package/scripts/extractAgentDocs.js +4 -36
  163. package/content/actions/emailotpsend.md +0 -58
  164. package/content/actions/emailotpverify.md +0 -77
  165. package/content/actions/getlocalstorage.md +0 -41
  166. package/content/actions/magiclinkverify.md +0 -113
  167. package/content/actions/posthogalias.md +0 -29
  168. package/content/actions/posthogcapture.md +0 -49
  169. package/content/actions/posthogcapturepageleave.md +0 -38
  170. package/content/actions/posthogfeatureflag.md +0 -50
  171. package/content/actions/posthoggroup.md +0 -37
  172. package/content/actions/posthogidentify.md +0 -54
  173. package/content/actions/posthoginit.md +0 -66
  174. package/content/actions/posthogoptin.md +0 -29
  175. package/content/actions/posthogoptout.md +0 -29
  176. package/content/actions/posthogpageview.md +0 -37
  177. package/content/actions/posthogreloadfeatureflags.md +0 -47
  178. package/content/actions/posthogreset.md +0 -28
  179. package/content/actions/posthogsetpersonproperties.md +0 -36
  180. package/content/actions/removelocalstorage.md +0 -26
  181. package/content/actions/setlocalstorage.md +0 -32
  182. package/content/adapter-reference/mongodbauthadapter.md +0 -46
  183. package/content/agents/agents-introduction.md +0 -107
  184. package/content/callback-reference/auth0logoutcallback.md +0 -54
  185. package/content/concepts/blocks.md +0 -150
  186. package/content/concepts/dynamic-page-content.md +0 -304
  187. package/content/concepts/html-attributes.md +0 -285
  188. package/content/concepts/lowdefy-api.md +0 -1110
  189. package/content/concepts/notifications.md +0 -155
  190. package/content/concepts/page-and-app-state.md +0 -244
  191. package/content/concepts/theming.md +0 -582
  192. package/content/connections/aigateway.md +0 -368
  193. package/content/connections/axioshttp.md +0 -181
  194. package/content/controls/while.md +0 -46
  195. package/content/display-blocks/clickablehtml.md +0 -239
  196. package/content/display-blocks/eventlog.md +0 -363
  197. package/content/display-blocks/pollingtimer.md +0 -263
  198. package/content/input-blocks/captcha.md +0 -40
  199. package/content/input-blocks/placesautocomplete.md +0 -319
  200. package/content/input-blocks/tagmultipleselector.md +0 -114
  201. package/content/input-blocks/tagselector.md +0 -114
  202. package/content/migration/auth-upgrade.md +0 -327
  203. package/content/migration/v3-to-v4.md +0 -417
  204. package/content/migration/v6-to-v7.md +0 -222
  205. package/content/operators/_cron.md +0 -292
  206. package/content/other/mongodbadapter.md +0 -3
  207. package/content/plugins/plugins-icon-sets.md +0 -267
  208. package/content/plugins/posthog.md +0 -275
  209. package/content/provider-reference/auth-js-providers.md +0 -107
  210. package/content/provider-reference/openidconnectprovider.md +0 -44
  211. package/content/testing/config-tests.md +0 -278
  212. package/content/tutorial/tutorial-requests-api.md +0 -155
  213. package/content/user-authentication/auth-configuration.md +0 -266
  214. package/content/user-authentication/auth-steps.md +0 -138
  215. package/content/user-authentication/mcp-oauth.md +0 -292
  216. package/content/user-authentication/organizations.md +0 -221
  217. package/content/user-authentication/protected-pages-apis.md +0 -97
  218. package/content/user-authentication/roles.md +0 -49
  219. package/content/user-authentication/two-factor.md +0 -229
  220. package/content/user-authentication/user-object.md +0 -58
  221. package/content/websockets/websocket-publish.md +0 -108
  222. package/content/websockets/websocket-subscriptions.md +0 -100
  223. package/content/websockets/websockets-introduction.md +0 -97
  224. package/hazards.json +0 -44
  225. package/scripts/hashDocSources.js +0 -38
  226. package/scripts/recordSourceHashes.js +0 -88
@@ -1,368 +0,0 @@
1
- # AI Gateway
2
-
3
- The AIGateway connection connects to the [Vercel AI Gateway](https://vercel.com/docs/ai-gateway), one API for models from many providers. It provides the `AIGatewayAgent` agent type for use with [Lowdefy agents](/agents-introduction), the one-shot `GenerateText` and `GenerateObject` requests, and `Decide` on evaluation models such as TypeSafe's Jev.
4
-
5
- > The AIGateway connection is provided by the `@lowdefy/connection-ai-gateway` package, which is included by default.
6
-
7
- ## Connections
8
-
9
- ### AIGateway
10
-
11
- #### Properties
12
- - `apiKey: string`: AI Gateway API key. Use [`_secret`](/_secret) to reference this securely. Optional — falls back to the `AI_GATEWAY_API_KEY` environment variable, or Vercel OIDC when deployed on Vercel.
13
- - `baseURL: string`: Optional base URL for the AI Gateway API.
14
- - `headers: object`: Optional custom headers to include in gateway requests.
15
- - `maxOutputTokens: number`: Default maximum number of tokens a model call generates, for the requests and agents on this connection that do not set their own.
16
- - `timeout: number`: Default milliseconds a model call may take, retries included, before it is cancelled, for the requests and agents on this connection that do not set their own. See _Limits and cancellation_ below.
17
-
18
- Model ids name the creator and the model, e.g. `anthropic/claude-sonnet-5`, `google/gemini-3.8-flash` or `typesafe-ai/jev`.
19
-
20
- ###### Connection example:
21
- ```yaml
22
- connections:
23
- - id: gateway
24
- type: AIGateway
25
- properties:
26
- apiKey:
27
- _secret: AI_GATEWAY_API_KEY
28
- ```
29
-
30
- ## Agent Types
31
-
32
- ### AIGatewayAgent
33
-
34
- The `AIGatewayAgent` supports all [common agent properties](/agents-introduction) plus the gateway's routing options:
35
-
36
- | Property | Type | Description |
37
- | --- | --- | --- |
38
- | `order` | string[] | Provider slugs to try in order (e.g. `["vertex", "anthropic"]`). The gateway tries each until one succeeds. |
39
- | `only` | string[] | Restrict routing to these provider slugs. |
40
- | `fallbackModels` | string[] | Model ids tried in order when the primary model fails. |
41
- | `user` | string | End-user identifier for spend attribution in gateway analytics. |
42
- | `tags` | string[] | Tags to categorize and filter usage in gateway reports. |
43
-
44
- ###### Agent with a fallback model:
45
- ```yaml
46
- agents:
47
- - id: support_agent
48
- type: AIGatewayAgent
49
- connectionId: gateway
50
- properties:
51
- model: anthropic/claude-sonnet-5
52
- fallbackModels:
53
- - google/gemini-3.8-flash
54
- instructions: |
55
- You are a customer support agent. Search the knowledge
56
- base before answering questions.
57
- maxSteps: 5
58
- tools:
59
- - search-knowledge-base
60
- ```
61
-
62
- ## Evaluation models
63
-
64
- Evaluation models return typed decisions — choices, yes/no probabilities and scores — instead of text, answer every question in one pass, and bill input tokens only. On the AI Gateway, `Decide` asks an evaluation model by default (`backend: evaluation`); set `backend: structured-output` to ask a language model on the gateway instead. See [`Decide`](#decide) below.
65
-
66
- ## Requests
67
-
68
- Request types:
69
-
70
- - GenerateText
71
- - GenerateObject
72
- - Decide
73
-
74
- All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText`, `GenerateObject` and `Decide` request types — the `connectionId` selects the provider. These make a single, one-shot model call and return the result. They can be used as page requests, or as steps in [API endpoint routines](/api) — useful for classify, extract, summarize, or decide steps where the surrounding logic stays in your routine. For a closed-vocabulary decision — pick one of these options, yes or no, rate on this scale — use `Decide`.
75
-
76
- For multi-step tool use, see [agents](/agents-introduction) instead.
77
-
78
- ### Limits and cancellation
79
-
80
- Two limits bound every AI request. Set them on the request, or on the connection as the default for every request and agent that uses it:
81
-
82
- - `maxOutputTokens` caps the tokens one call generates. Without it, the provider's default applies.
83
- - `timeout` cancels a call, retries included, that runs longer than this many milliseconds. The request fails with a `ServiceError`.
84
-
85
- A call is also cancelled when the request that started it closes, so a provider call that nobody is waiting for stops instead of running, and billing, to its end:
86
-
87
- - A page request, or an API endpoint called over HTTP, is cancelled when the server's request timeout (`config.requestTimeout`, default 30 seconds) answers first, which fails it with a `ServiceError`. On the Node server it is also cancelled when the client disconnects; that is logged as a warning, not an error.
88
- - On [Vercel](/vercel), only the request timeout cancels a call: a client disconnect does not, and the call runs until it finishes, times out, or the function reaches `config.vercel.maxDuration`. Keep `config.requestTimeout` below `maxDuration`, or Vercel stops the function before the timeout can cancel anything (the build warns when it is not).
89
- - Endpoints with `async: true`, `detached: true` calls, and scheduled runs answer at once and then run to their end: the closing request does not cancel them.
90
- - An agent chat turn runs to its end after the client disconnects, so its `onFinish` hooks still save the conversation. Bound it with the agent's `timeout` and `maxSteps`. A `CallAgent` step is cancelled with the routine that runs it.
91
-
92
- When a provider rate-limits a call (HTTP 429), the model client retries it (`maxRetries`), waiting as long as the provider's `Retry-After` asks, up to a minute. If the retries run out, the request fails with a `ServiceError`, as a 429 does on every connection, and the server log records the `Retry-After` value.
93
-
94
- ### GenerateText
95
-
96
- Generates text from a prompt.
97
-
98
- #### Properties
99
-
100
- - `model: string`: **Required** - Model id to generate with.
101
- - `prompt: string`: Text prompt. Use either `prompt` or `messages`, not both.
102
- - `messages: object[]`: Model messages (`{ role, content }`). Use either `prompt` or `messages`, not both.
103
- - `system: string`: System prompt.
104
- - `allowSystemInMessages: boolean`: Default: `false` - Allow `system` role messages in `messages`. A system message instructs the model as the app itself, so without this a request whose `messages` include one fails. Only set it when the messages come from the app, never from a user (for example a message list built from `_payload`). Use `system` for the system prompt.
105
- - `maxOutputTokens: number`: Maximum number of tokens to generate. Defaults to the connection's `maxOutputTokens`.
106
- - `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
107
- - `temperature: number`: Sampling temperature (0 to 2).
108
- - `topP: number`: Nucleus sampling.
109
- - `topK: number`: Only sample from the top K options for each subsequent token.
110
- - `frequencyPenalty: number`: Penalize repeated tokens by frequency.
111
- - `presencePenalty: number`: Penalize tokens that have already appeared.
112
- - `seed: number`: Seed for deterministic sampling, if supported by the model.
113
- - `stopSequences: string[]`: Sequences that stop generation.
114
- - `maxRetries: number`: Maximum number of retries. Defaults to 2.
115
- - `providerOptions: object`: Provider-specific options, keyed by provider (e.g. `anthropic`, `openai`, `google`).
116
-
117
- #### Response
118
-
119
- ```yaml
120
- text: string # The generated text.
121
- reasoningText: string # Reasoning text, when the model produced any.
122
- finishReason: string # 'stop', 'length', 'content-filter', ...
123
- usage: object # Token usage ({ inputTokens, outputTokens, totalTokens, ... }).
124
- providerMetadata: object # Provider-specific metadata, when returned.
125
- warnings: array # Call warnings from the provider, when returned.
126
- ```
127
-
128
- #### Examples
129
-
130
- ###### Summarize text in an API endpoint routine:
131
-
132
- ```yaml
133
- api:
134
- - id: summarize-text
135
- type: Api
136
- routine:
137
- - id: summarize
138
- type: GenerateText
139
- connectionId: claude
140
- properties:
141
- model: claude-haiku-4-5
142
- system: You are a concise summarizer.
143
- prompt:
144
- _payload: text
145
- - ':return':
146
- summary:
147
- _step: summarize.text
148
- ```
149
-
150
- ###### Text generation as a page request:
151
-
152
- ```yaml
153
- requests:
154
- - id: generate_reply
155
- type: GenerateText
156
- connectionId: claude
157
- payload:
158
- message:
159
- _state: customer_message
160
- properties:
161
- model: claude-haiku-4-5
162
- system: Draft a friendly reply to the customer message.
163
- prompt:
164
- _payload: message
165
- ```
166
-
167
- ### GenerateObject
168
-
169
- Generates a structured object matching a JSON Schema. Ideal for classification, extraction, and routing decisions — the result lands in `_step` (or `_request`) as plain data your config can act on.
170
-
171
- #### Properties
172
-
173
- Takes the same properties as `GenerateText`, except `stopSequences`, plus:
174
-
175
- - `schema: object`: **Required** - JSON Schema describing the object the model must generate.
176
- - `schemaName: string`: Optional name for the output schema, passed to the model.
177
- - `schemaDescription: string`: Optional description of the output schema, passed to the model.
178
-
179
- #### Response
180
-
181
- ```yaml
182
- object: object # The generated object, matching the schema.
183
- reasoningText: string # Reasoning text, when the model produced any.
184
- finishReason: string # 'stop', 'length', 'content-filter', ...
185
- usage: object # Token usage ({ inputTokens, outputTokens, totalTokens, ... }).
186
- providerMetadata: object # Provider-specific metadata, when returned.
187
- warnings: array # Call warnings from the provider, when returned.
188
- ```
189
-
190
- #### Examples
191
-
192
- ###### Classify then route in an API endpoint routine:
193
-
194
- ```yaml
195
- api:
196
- - id: triage-ticket
197
- type: Api
198
- routine:
199
- - id: classify
200
- type: GenerateObject
201
- connectionId: claude
202
- properties:
203
- model: claude-haiku-4-5
204
- prompt:
205
- _payload: ticket_text
206
- schema:
207
- type: object
208
- properties:
209
- category:
210
- type: string
211
- enum:
212
- - billing
213
- - technical
214
- - other
215
- urgent:
216
- type: boolean
217
- - ':if':
218
- _eq:
219
- - _step: classify.object.urgent
220
- - true
221
- ':then':
222
- - id: escalate
223
- type: CallApi
224
- properties:
225
- endpointId: escalate-ticket
226
- payload:
227
- category:
228
- _step: classify.object.category
229
- ```
230
-
231
- ### Decide
232
-
233
- Makes typed decisions about a piece of state: pick one of a set of options, judge a statement true or false, or place something on an ordered scale. Every answer comes back in the shape you declared, with a confidence, so a routine can branch on it — and send a low-confidence answer to a person instead.
234
-
235
- The build knows every option, so a routine branch that compares an answer with a name that is not one of its options — `_eq: [{ _step: triage.team.choice }, bil-ling]` — fails the build rather than silently never matching. A `_step` reference to a question the step does not ask, or to a field its answer does not have, fails the build the same way.
236
-
237
- `Decide` has two backends behind the same interface:
238
-
239
- - `evaluation` — an evaluation model, such as TypeSafe's Jev (`typesafe-ai/jev`) on the [AI Gateway](/AIGateway). It returns a probability for every option in one pass, in under a second, and bills input tokens only. The default, and only available, on the `AIGateway` connection.
240
- - `structured-output` — any language model, asked for the answers as structured output that follows a schema of the questions. Providers do not all enforce the schema, so Lowdefy checks each answer against its question (see `null` answers below). Available on every AI connection, and the default on `Anthropic`, `OpenAI` and `Google`. Its confidence is the model's own estimate, not a calibrated probability.
241
-
242
- Keep the state to what the questions need: an evaluation model reads the state literally, and accuracy drops as it grows. A `Decide` is never a security boundary — text in the state can argue for its own answer.
243
-
244
- #### Properties
245
-
246
- - `model: string`: **Required** - Model id to decide with, e.g. `typesafe-ai/jev`. Pin a version wherever a confidence threshold is tuned — a `latest` alias changes answers on release.
247
- - `state: string | object | array`: **Required** - What the questions are about.
248
- - `questions: object`: **Required** - Named questions, answered together against the state. Each question id becomes a key of the response (`usage` is reserved). A question is one of:
249
- - `{ choice: string, options: object }` - Pick exactly one option. `options` maps option names (2 to 255) to what each one means (`null` for no description).
250
- - `{ yesno: string, criteria?: { yes: string, no: string } }` - Judge a statement true or false. `criteria` optionally says what counts as yes and as no.
251
- - `{ score: string, levels: string[] }` - Place the state on 2 to 10 ordered levels, lowest first.
252
- - `backend: enum`: `evaluation` or `structured-output`. Defaults to `evaluation` on `AIGateway` and `structured-output` elsewhere.
253
- - `maxOutputTokens: number`: Maximum number of tokens to generate, on the `structured-output` backend (an evaluation model generates no text). Defaults to the connection's `maxOutputTokens`.
254
- - `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
255
- - `maxRetries: number`: Maximum number of retries. Defaults to 2.
256
- - `providerOptions: object`: Provider-specific options, keyed by provider (e.g. `gateway: { zeroDataRetention: true }`).
257
-
258
- #### Response
259
-
260
- One key per question, plus `usage`:
261
-
262
- ```yaml
263
- <choice question>:
264
- choice: string # The chosen option.
265
- confidence: number # 0 to 1.
266
- probabilities: object # Probability per option (evaluation backend), else null.
267
- <yesno question>:
268
- answer: boolean # true when the statement holds.
269
- probability: number # Probability that it holds.
270
- confidence: number # Probability of the given answer.
271
- <score question>:
272
- level: string # The most likely level.
273
- index: number # Its position, from 0.
274
- score: number # Fractional position on the scale (evaluation backend).
275
- confidence: number # 0 to 1.
276
- probabilities: object # Probability per level (evaluation backend), else null.
277
- usage: object # Token usage ({ inputTokens, outputTokens, totalTokens }).
278
- ```
279
-
280
- An answer outside its question's terms (an option or level the question does not have, a yes/no that is not true or false, or no answer at all) comes back with every field `null`, its confidence included. `_lt` compares `null` below any number, so a confidence gate such as `_lt: [{ _step: triage.team.confidence }, 0.7]` holds it back like a low-confidence answer, and a branch on the choice matches none of the options.
281
-
282
- #### Examples
283
-
284
- ###### Route a support ticket, and queue uncertain ones for a person:
285
-
286
- ```yaml
287
- api:
288
- - id: triage-ticket
289
- type: Api
290
- routine:
291
- - id: triage
292
- type: Decide
293
- connectionId: gateway
294
- properties:
295
- model: typesafe-ai/jev
296
- state:
297
- subject:
298
- _payload: subject
299
- body:
300
- _payload: body
301
- questions:
302
- team:
303
- choice: Which team handles this ticket
304
- options:
305
- billing: Invoices, charges and refunds
306
- tech: Outages and bugs
307
- sales: Plans and quotes
308
- down:
309
- yesno: The customer says the service is down
310
- providerOptions:
311
- gateway:
312
- zeroDataRetention: true
313
- - ':if':
314
- _lt:
315
- - _step: triage.team.confidence
316
- - 0.7
317
- ':then':
318
- - id: queue_review
319
- type: MongoDBInsertOne
320
- connectionId: review_queue
321
- properties:
322
- doc:
323
- subject:
324
- _payload: subject
325
- suggested_team:
326
- _step: triage.team.choice
327
- - ':return':
328
- status: review
329
- - ':if':
330
- _eq:
331
- - _step: triage.team.choice
332
- - billing
333
- ':then':
334
- - id: open_billing_case
335
- type: CallApi
336
- properties:
337
- endpointId: open-billing-case
338
- - ':return':
339
- team:
340
- _step: triage.team.choice
341
- urgent:
342
- _step: triage.down.answer
343
- ```
344
-
345
- ###### The same decision with any language model:
346
-
347
- ```yaml
348
- requests:
349
- - id: rate_review
350
- type: Decide
351
- connectionId: claude
352
- payload:
353
- review:
354
- _state: review_text
355
- properties:
356
- model: claude-haiku-4-5
357
- state:
358
- _payload: review
359
- questions:
360
- sentiment:
361
- score: How positive is this review
362
- levels:
363
- - Very negative
364
- - Negative
365
- - Neutral
366
- - Positive
367
- - Very positive
368
- ```
@@ -1,181 +0,0 @@
1
- # AxiosHttp
2
-
3
- The `AxiosHttp` connection is used to connect to APIs and web servers using HTTP or HTTPS.
4
-
5
- It uses the [axios](https://github.com/axios/axios) library.
6
-
7
- The same properties can be set on both connections and requests. The properties will be merged, with the request properties overwriting connection properties. This allows properties like authentication headers and the baseURL to be set on the connection, with request specific properties like the request.
8
-
9
- >Secrets like authentication headers and API keys should be stored using the [`_secret`](_secret) operator.
10
-
11
- ## Connections
12
-
13
- Connection types:
14
- - AxiosHttp
15
-
16
- ## Requests
17
-
18
- Request types:
19
- - AxiosHttp
20
-
21
- ### AxiosHttp
22
-
23
- #### Properties
24
-
25
- - `url: string`: The server URL that will be used for the request.
26
- - `method: enum`: Default: `'get'` - The request method to be used when making the request. Options are:
27
- - `'get'`
28
- - `'delete'`
29
- - `'head'`
30
- - `'options'`
31
- - `'post'`
32
- - `'put'`
33
- - `'patch'`
34
- - `baseURL: string`: `baseURL` will be prepended to `url` unless `url` is absolute. It can be convenient to set `baseURL` for an axios connection to pass relative URLs to requests or mutations using that connection.
35
- - `headers: object`: An object with custom headers to be sent sent with the request. The object keys should be header names, and the values should be the string header values.
36
- - `params: object`: An object with URL parameters to be sent with the request.
37
- - `data: string | object | array`: The data to be sent as the request body. Only applicable for request methods `'put'`, `'post'`, and `'patch'`. Can be an object, array or a string in the format `'Country=Brasil&City=Belo Horizonte'`.
38
- - `auth: object`: Indicates that HTTP Basic authorization should be used, and supplies credentials. This will set an `Authorization` header, overwriting any existing `Authorization` custom headers you have set using `headers`. Only HTTP Basic auth is configurable through this parameter, for Bearer tokens and such, use `Authorization` custom headers instead. The `auth` object should have the following fields:
39
- - `username: string`
40
- - `password: string`
41
- - `httpAgentOptions: object`: Options to pass to the Node.js [`http.Agent`](https://nodejs.org/api/http.html#http_class_http_agent) class.
42
- - `httpsAgentOptions: object`: Options to pass to the Node.js [`https.Agent`](https://nodejs.org/api/http.html#http_class_http_agent) class.
43
- - `maxContentLength: number`: Defines the max size of the http response content allowed in bytes.
44
- - `maxRedirects: number`: Defines the maximum number of redirects to follow. If set to 0, no redirects will be followed.
45
- - `proxy: object`: Defines the hostname and port of the proxy server. The `proxy` object should have the following fields:
46
- - `host: string`: Host IP address (eg. `'127.0.0.1'`).
47
- - `port: number`: Port number.
48
- - `auth: object`: Object with username and password.
49
- - `responseType: enum`: Default: `'json'` - The type of data that the server will respond with. Options are:
50
- - `'document'`
51
- - `'json'`
52
- - `'text'`
53
- - `responseEncoding: string`: Default: `'utf8'` - Indicates encoding to use for decoding responses.
54
- - `timeout: number`: Default: `0` (no timeout) - The number of milliseconds before the request times out. If the request takes longer than `timeout`, the request will be aborted. Set to `0` for no timeout.
55
- - `transformRequest: function`: A function to transform the request data before it is sent. Receives `data` and `headers` as arguments and should return the data to be sent.
56
- - `transformResponse: function`: A function to transform the received data. Receives `data` as an argument and should return the transformed data.
57
- - `validateStatus: function`: A function to validate whether the response should complete successfully given a status code. Receives `status` as an argument and should `true` if the status code is valid.
58
-
59
-
60
- #### Examples
61
-
62
- Properties for a AxiosHttp can be set on either the connection, the request, or both. However, both a connection and request need to be defined.
63
-
64
- ###### A basic full example requesting data from https://jsonplaceholder.typicode.com
65
-
66
- ```yaml
67
- lowdefy: 6.0.0
68
- name: Lowdefy starter
69
- connections:
70
- - id: my_api
71
- type: AxiosHttp
72
- properties:
73
- baseURL: https://jsonplaceholder.typicode.com
74
- pages:
75
- - id: welcome
76
- type: PageHeaderMenu
77
- requests:
78
- - id: get_posts
79
- type: AxiosHttp
80
- connectionId: my_api
81
- properties:
82
- url: /posts
83
- events:
84
- onInit:
85
- - id: fetch_get_posts
86
- type: Request
87
- params: get_posts
88
- blocks:
89
- - id: rest_data
90
- type: Markdown
91
- properties:
92
- content:
93
- _string.concat:
94
- - |
95
- ```yaml
96
- - _custom_yaml_stringify:
97
- - _request: get_posts
98
- - |
99
- ```
100
- ```
101
-
102
- ###### Using the connection to set baseURL and authorization, and handle specific requests as requests.
103
- ```yaml
104
- connections:
105
- - id: app_api
106
- type: AxiosHttp
107
- properties:
108
- baseURL: app.com/api
109
- auth:
110
- username: api_user
111
- password:
112
- _secret: API_PASSWORD
113
- # ...
114
- requests:
115
- - id: get_orders
116
- type: AxiosHttp
117
- connectionId: app_api
118
- properties:
119
- url: /orders
120
- - id: update_order
121
- type: AxiosHttp
122
- connectionId: app_api
123
- payload:
124
- order_id:
125
- _state: order_id
126
- data:
127
- _state: true
128
- properties:
129
- url:
130
- _nunjucks:
131
- template: /orders/{{ order_id }}
132
- on:
133
- order_id:
134
- _payload: order_id
135
- method: post
136
- data:
137
- _payload: data
138
- ```
139
-
140
-
141
- ###### Setting properties on only the connection:
142
- ```yaml
143
- connections:
144
- - id: get_count
145
- type: AxiosHttp
146
- properties:
147
- url: myapp.com/api/count
148
- headers:
149
- X-Api-Key:
150
- _secret: API_KEY
151
- # ...
152
- requests:
153
- - id: get_count
154
- type: AxiosHttp
155
- connectionId: get_count
156
- ```
157
-
158
- ###### Setting properties on only the request, and using a generic connection:
159
- ```yaml
160
- connections:
161
- - id: axios
162
- type: AxiosHttp
163
- # ...
164
- requests:
165
- - id: get_api_1
166
- type: AxiosHttp
167
- connectionId: axios
168
- properties:
169
- url: app1.com/api/things
170
- - id: post_to_api_2
171
- type: AxiosHttp
172
- connectionId: axios
173
- payload:
174
- data:
175
- _state: true
176
- properties:
177
- url: api.otherapp.org/other/thing
178
- method: post
179
- data:
180
- _payload: data
181
- ```
@@ -1,46 +0,0 @@
1
- # :while
2
-
3
- ```
4
- ({:while: boolean, :do: routine}): void
5
- ```
6
-
7
- The `:while` control implements a while loop within a routine. The routine defined in the `:do` key will be repeated as long as the test defined using the `:while` key is true.
8
-
9
- #### Keys
10
-
11
- - `:while: boolean`: __Required__ - The test that will determine whether or not the defined routine should execute again.
12
- - `:do: routine`: __Required__ - The routine to run while the test condition holds.
13
-
14
- The `:while` condition is evaluated fresh before every iteration, against the routine's current `state` and `steps`. This is how the loop terminates - the routine in `:do` changes the state or step results that the condition reads.
15
-
16
- Unlike `:for`, a `:while` loop does not index the step results of its body. A `:while` has no item to index by, so each iteration overwrites the previous iteration's step results, and `_step: my_step` inside or after the loop reads the value from the latest iteration.
17
-
18
- There is no iteration cap and no timeout. A condition that the routine in `:do` never falsifies loops forever, exactly as it would in JavaScript.
19
-
20
- #### Examples
21
-
22
- ###### Simple Example
23
- ```
24
- - :set_state:
25
- count: 0
26
- - :while:
27
- _lt:
28
- - _state: count
29
- - 5
30
- :do:
31
- - :log:
32
- _state: count
33
- - :set_state:
34
- count:
35
- _sum:
36
- - _state: count
37
- - 1
38
- ```
39
- Logs:
40
- ```
41
- 0
42
- 1
43
- 2
44
- 3
45
- 4
46
- ```