@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.
- package/README.md +0 -1
- package/content/actions/link.md +0 -17
- package/content/actions/login.md +5 -23
- package/content/actions/logout.md +5 -5
- package/content/actions/pdfmake.md +2 -2
- package/content/actions/setdarkmode.md +2 -2
- package/content/agents/agent-properties.md +2 -4
- package/content/agents/agentchat.md +6 -21
- package/content/agents/agentconversations.md +2 -2
- package/content/concepts/ai-agent-docs.md +101 -313
- package/content/concepts/cli.md +3 -34
- package/content/concepts/connections-and-requests.md +0 -402
- package/content/concepts/custom-html.md +0 -40
- package/content/concepts/custom-styling.md +5 -50
- package/content/concepts/events-and-actions.md +2 -64
- package/content/concepts/i18n.md +2 -7
- package/content/concepts/keyboard-shortcuts.md +2 -2
- package/content/concepts/layout-overview.md +1 -1
- package/content/concepts/logger.md +0 -81
- package/content/concepts/lowdefy-schema.md +1 -4
- package/content/concepts/menus.md +7 -7
- package/content/concepts/module-authoring.md +2 -2
- package/content/connections/anthropic.md +2 -162
- package/content/connections/awss3.md +0 -54
- package/content/connections/google.md +2 -162
- package/content/connections/mongodb.md +3 -121
- package/content/connections/openai-connection.md +2 -162
- package/content/container-blocks/affix.md +7 -47
- package/content/container-blocks/alert.md +24 -76
- package/content/container-blocks/badge.md +24 -100
- package/content/container-blocks/box.md +9 -9
- package/content/container-blocks/card.md +25 -80
- package/content/container-blocks/carousel.md +7 -60
- package/content/container-blocks/collapse.md +9 -87
- package/content/container-blocks/configprovider.md +13 -35
- package/content/container-blocks/confirmmodal.md +23 -69
- package/content/container-blocks/content.md +98 -62
- package/content/container-blocks/descriptions.md +4 -45
- package/content/container-blocks/drawer.md +28 -92
- package/content/container-blocks/dropdownmenu.md +31 -119
- package/content/container-blocks/flex.md +62 -40
- package/content/container-blocks/footer.md +11 -15
- package/content/container-blocks/googlemapsheatmap.md +1 -1
- package/content/container-blocks/googlemapsscript.md +2 -2
- package/content/container-blocks/header.md +36 -71
- package/content/container-blocks/label.md +7 -34
- package/content/container-blocks/layout.md +34 -52
- package/content/container-blocks/masonry.md +71 -17
- package/content/container-blocks/mobilemenu.md +88 -131
- package/content/container-blocks/modal.md +26 -114
- package/content/container-blocks/pageheadermenu.md +31 -81
- package/content/container-blocks/pagesidebarlayout.md +26 -169
- package/content/container-blocks/pagesidermenu.md +42 -95
- package/content/container-blocks/popover.md +31 -34
- package/content/container-blocks/result.md +21 -32
- package/content/container-blocks/sider.md +122 -85
- package/content/container-blocks/span.md +7 -7
- package/content/container-blocks/spinner.md +3 -3
- package/content/container-blocks/splitter.md +68 -150
- package/content/container-blocks/tabs.md +12 -64
- package/content/container-blocks/tooltip.md +46 -22
- package/content/container-blocks/watermark.md +4 -22
- package/content/controls/reject.md +2 -4
- package/content/controls/throw.md +0 -1
- package/content/controls/try.md +2 -3
- package/content/deployment/deployment-environments.md +6 -8
- package/content/deployment/docker.md +7 -22
- package/content/deployment/node-server.md +0 -4
- package/content/deployment/vercel.md +6 -13
- package/content/display-blocks/aggrid.md +11 -26
- package/content/display-blocks/anchor.md +15 -15
- package/content/display-blocks/avatar.md +37 -57
- package/content/display-blocks/breadcrumb.md +21 -70
- package/content/display-blocks/button.md +18 -92
- package/content/display-blocks/calendar.md +0 -12
- package/content/display-blocks/dangeroushtml.md +1 -1
- package/content/display-blocks/difflist.md +1 -1
- package/content/display-blocks/difftimeline.md +1 -1
- package/content/display-blocks/divider.md +3 -64
- package/content/display-blocks/dropdownbutton.md +28 -79
- package/content/display-blocks/echart.md +1 -35
- package/content/display-blocks/floatbutton.md +42 -129
- package/content/display-blocks/html.md +1 -61
- package/content/display-blocks/icon.md +67 -250
- package/content/display-blocks/menu.md +73 -145
- package/content/display-blocks/message.md +124 -38
- package/content/display-blocks/notification.md +222 -94
- package/content/display-blocks/paragraph.md +9 -59
- package/content/display-blocks/progress.md +17 -96
- package/content/display-blocks/qrcode.md +4 -19
- package/content/display-blocks/s3download.md +1 -1
- package/content/display-blocks/search.md +7 -17
- package/content/display-blocks/skeletonbutton.md +0 -1
- package/content/display-blocks/skeletoninput.md +0 -1
- package/content/display-blocks/statistic.md +17 -75
- package/content/display-blocks/steps.md +25 -58
- package/content/display-blocks/tag.md +17 -102
- package/content/display-blocks/title.md +11 -50
- package/content/display-blocks/tour.md +23 -33
- package/content/input-blocks/autocomplete.md +9 -81
- package/content/input-blocks/buttonselector.md +8 -45
- package/content/input-blocks/checkboxselector.md +7 -97
- package/content/input-blocks/checkboxswitch.md +3 -33
- package/content/input-blocks/colorselector.md +14 -63
- package/content/input-blocks/daterangeselector.md +45 -165
- package/content/input-blocks/dateselector.md +41 -139
- package/content/input-blocks/datetimeselector.md +49 -158
- package/content/input-blocks/inputgallery.md +3 -3
- package/content/input-blocks/monthselector.md +52 -120
- package/content/input-blocks/multipleselector.md +39 -150
- package/content/input-blocks/numberinput.md +12 -98
- package/content/input-blocks/pagination.md +14 -70
- package/content/input-blocks/paragraphinput.md +37 -51
- package/content/input-blocks/passwordinput.md +6 -60
- package/content/input-blocks/phonenumberinput.md +26 -59
- package/content/input-blocks/radioselector.md +7 -83
- package/content/input-blocks/ratingslider.md +26 -57
- package/content/input-blocks/s3uploadbutton.md +24 -24
- package/content/input-blocks/s3uploaddragger.md +3 -3
- package/content/input-blocks/s3uploadphoto.md +5 -5
- package/content/input-blocks/segmentedselector.md +32 -72
- package/content/input-blocks/selector.md +21 -109
- package/content/input-blocks/switch.md +17 -65
- package/content/input-blocks/textarea.md +3 -32
- package/content/input-blocks/textinput.md +28 -69
- package/content/input-blocks/tiptapmentioninput.md +1 -1
- package/content/input-blocks/titleinput.md +12 -39
- package/content/input-blocks/treeinput.md +25 -49
- package/content/input-blocks/treemultipleselector.md +10 -127
- package/content/input-blocks/treeselector.md +9 -97
- package/content/input-blocks/upload.md +15 -64
- package/content/input-blocks/uploaddragger.md +1 -17
- package/content/input-blocks/uploadphoto.md +1 -18
- package/content/input-blocks/weekselector.md +55 -120
- package/content/list-blocks/controlledlist.md +15 -24
- package/content/list-blocks/list.md +11 -11
- package/content/list-blocks/masonrylist.md +34 -7
- package/content/migration/upgrade-guide.md +0 -1
- package/content/operators/_app.md +1 -2
- package/content/operators/_error.md +1 -23
- package/content/operators/_get.md +6 -6
- package/content/operators/_operator.md +3 -17
- package/content/operators/_ref.md +0 -258
- package/content/operators/_type.md +3 -14
- package/content/operators/_user.md +3 -3
- package/content/other/introduction.md +1 -1
- package/content/plugins/plugins-dev.md +0 -66
- package/content/plugins/plugins-introduction.md +1 -27
- package/content/testing/e2e-configuration.md +1 -8
- package/content/testing/e2e-getting-started.md +1 -1
- package/content/testing/e2e-introduction.md +1 -1
- package/content/tutorial/tutorial-actions-operators.md +2 -2
- package/content/tutorial/tutorial-add-blocks.md +2 -2
- package/content/tutorial/tutorial-create-page.md +2 -48
- package/content/tutorial/tutorial-display-data-page.md +3 -3
- package/content/tutorial/tutorial-requests-sql.md +0 -153
- package/content/tutorial/tutorial-start.md +1 -66
- package/content/user-authentication/login-and-logout.md +8 -158
- package/content/user-authentication/users-introduction.md +0 -8
- package/index.json +2 -6065
- package/package.json +1 -7
- package/scripts/extractAgentDocs.js +4 -36
- package/content/actions/emailotpsend.md +0 -58
- package/content/actions/emailotpverify.md +0 -77
- package/content/actions/getlocalstorage.md +0 -41
- package/content/actions/magiclinkverify.md +0 -113
- package/content/actions/posthogalias.md +0 -29
- package/content/actions/posthogcapture.md +0 -49
- package/content/actions/posthogcapturepageleave.md +0 -38
- package/content/actions/posthogfeatureflag.md +0 -50
- package/content/actions/posthoggroup.md +0 -37
- package/content/actions/posthogidentify.md +0 -54
- package/content/actions/posthoginit.md +0 -66
- package/content/actions/posthogoptin.md +0 -29
- package/content/actions/posthogoptout.md +0 -29
- package/content/actions/posthogpageview.md +0 -37
- package/content/actions/posthogreloadfeatureflags.md +0 -47
- package/content/actions/posthogreset.md +0 -28
- package/content/actions/posthogsetpersonproperties.md +0 -36
- package/content/actions/removelocalstorage.md +0 -26
- package/content/actions/setlocalstorage.md +0 -32
- package/content/adapter-reference/mongodbauthadapter.md +0 -46
- package/content/agents/agents-introduction.md +0 -107
- package/content/callback-reference/auth0logoutcallback.md +0 -54
- package/content/concepts/blocks.md +0 -150
- package/content/concepts/dynamic-page-content.md +0 -304
- package/content/concepts/html-attributes.md +0 -285
- package/content/concepts/lowdefy-api.md +0 -1110
- package/content/concepts/notifications.md +0 -155
- package/content/concepts/page-and-app-state.md +0 -244
- package/content/concepts/theming.md +0 -582
- package/content/connections/aigateway.md +0 -368
- package/content/connections/axioshttp.md +0 -181
- package/content/controls/while.md +0 -46
- package/content/display-blocks/clickablehtml.md +0 -239
- package/content/display-blocks/eventlog.md +0 -363
- package/content/display-blocks/pollingtimer.md +0 -263
- package/content/input-blocks/captcha.md +0 -40
- package/content/input-blocks/placesautocomplete.md +0 -319
- package/content/input-blocks/tagmultipleselector.md +0 -114
- package/content/input-blocks/tagselector.md +0 -114
- package/content/migration/auth-upgrade.md +0 -327
- package/content/migration/v3-to-v4.md +0 -417
- package/content/migration/v6-to-v7.md +0 -222
- package/content/operators/_cron.md +0 -292
- package/content/other/mongodbadapter.md +0 -3
- package/content/plugins/plugins-icon-sets.md +0 -267
- package/content/plugins/posthog.md +0 -275
- package/content/provider-reference/auth-js-providers.md +0 -107
- package/content/provider-reference/openidconnectprovider.md +0 -44
- package/content/testing/config-tests.md +0 -278
- package/content/tutorial/tutorial-requests-api.md +0 -155
- package/content/user-authentication/auth-configuration.md +0 -266
- package/content/user-authentication/auth-steps.md +0 -138
- package/content/user-authentication/mcp-oauth.md +0 -292
- package/content/user-authentication/organizations.md +0 -221
- package/content/user-authentication/protected-pages-apis.md +0 -97
- package/content/user-authentication/roles.md +0 -49
- package/content/user-authentication/two-factor.md +0 -229
- package/content/user-authentication/user-object.md +0 -58
- package/content/websockets/websocket-publish.md +0 -108
- package/content/websockets/websocket-subscriptions.md +0 -100
- package/content/websockets/websockets-introduction.md +0 -97
- package/hazards.json +0 -44
- package/scripts/hashDocSources.js +0 -38
- package/scripts/recordSourceHashes.js +0 -88
|
@@ -11,8 +11,6 @@ The Google connection connects to the [Google Gemini API](https://ai.google.dev/
|
|
|
11
11
|
#### Properties
|
|
12
12
|
- `apiKey: string`: __Required__ - Google API key. Use [`_secret`](/_secret) to reference this securely.
|
|
13
13
|
- `baseURL: string`: Optional base URL for the Google API.
|
|
14
|
-
- `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.
|
|
15
|
-
- `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.
|
|
16
14
|
|
|
17
15
|
###### Connection example:
|
|
18
16
|
```yaml
|
|
@@ -89,28 +87,11 @@ Request types:
|
|
|
89
87
|
|
|
90
88
|
- GenerateText
|
|
91
89
|
- GenerateObject
|
|
92
|
-
- Decide
|
|
93
90
|
|
|
94
|
-
All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText
|
|
91
|
+
All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText` and `GenerateObject` 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.
|
|
95
92
|
|
|
96
93
|
For multi-step tool use, see [agents](/agents-introduction) instead.
|
|
97
94
|
|
|
98
|
-
### Limits and cancellation
|
|
99
|
-
|
|
100
|
-
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:
|
|
101
|
-
|
|
102
|
-
- `maxOutputTokens` caps the tokens one call generates. Without it, the provider's default applies.
|
|
103
|
-
- `timeout` cancels a call, retries included, that runs longer than this many milliseconds. The request fails with a `ServiceError`.
|
|
104
|
-
|
|
105
|
-
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:
|
|
106
|
-
|
|
107
|
-
- 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.
|
|
108
|
-
- 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).
|
|
109
|
-
- 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.
|
|
110
|
-
- 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.
|
|
111
|
-
|
|
112
|
-
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.
|
|
113
|
-
|
|
114
95
|
### GenerateText
|
|
115
96
|
|
|
116
97
|
Generates text from a prompt.
|
|
@@ -121,9 +102,7 @@ Generates text from a prompt.
|
|
|
121
102
|
- `prompt: string`: Text prompt. Use either `prompt` or `messages`, not both.
|
|
122
103
|
- `messages: object[]`: Model messages (`{ role, content }`). Use either `prompt` or `messages`, not both.
|
|
123
104
|
- `system: string`: System prompt.
|
|
124
|
-
- `
|
|
125
|
-
- `maxOutputTokens: number`: Maximum number of tokens to generate. Defaults to the connection's `maxOutputTokens`.
|
|
126
|
-
- `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
|
|
105
|
+
- `maxOutputTokens: number`: Maximum number of tokens to generate.
|
|
127
106
|
- `temperature: number`: Sampling temperature (0 to 2).
|
|
128
107
|
- `topP: number`: Nucleus sampling.
|
|
129
108
|
- `topK: number`: Only sample from the top K options for each subsequent token.
|
|
@@ -247,142 +226,3 @@ api:
|
|
|
247
226
|
category:
|
|
248
227
|
_step: classify.object.category
|
|
249
228
|
```
|
|
250
|
-
|
|
251
|
-
### Decide
|
|
252
|
-
|
|
253
|
-
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.
|
|
254
|
-
|
|
255
|
-
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.
|
|
256
|
-
|
|
257
|
-
`Decide` has two backends behind the same interface:
|
|
258
|
-
|
|
259
|
-
- `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.
|
|
260
|
-
- `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.
|
|
261
|
-
|
|
262
|
-
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.
|
|
263
|
-
|
|
264
|
-
#### Properties
|
|
265
|
-
|
|
266
|
-
- `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.
|
|
267
|
-
- `state: string | object | array`: **Required** - What the questions are about.
|
|
268
|
-
- `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:
|
|
269
|
-
- `{ choice: string, options: object }` - Pick exactly one option. `options` maps option names (2 to 255) to what each one means (`null` for no description).
|
|
270
|
-
- `{ yesno: string, criteria?: { yes: string, no: string } }` - Judge a statement true or false. `criteria` optionally says what counts as yes and as no.
|
|
271
|
-
- `{ score: string, levels: string[] }` - Place the state on 2 to 10 ordered levels, lowest first.
|
|
272
|
-
- `backend: enum`: `evaluation` or `structured-output`. Defaults to `evaluation` on `AIGateway` and `structured-output` elsewhere.
|
|
273
|
-
- `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`.
|
|
274
|
-
- `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
|
|
275
|
-
- `maxRetries: number`: Maximum number of retries. Defaults to 2.
|
|
276
|
-
- `providerOptions: object`: Provider-specific options, keyed by provider (e.g. `gateway: { zeroDataRetention: true }`).
|
|
277
|
-
|
|
278
|
-
#### Response
|
|
279
|
-
|
|
280
|
-
One key per question, plus `usage`:
|
|
281
|
-
|
|
282
|
-
```yaml
|
|
283
|
-
<choice question>:
|
|
284
|
-
choice: string # The chosen option.
|
|
285
|
-
confidence: number # 0 to 1.
|
|
286
|
-
probabilities: object # Probability per option (evaluation backend), else null.
|
|
287
|
-
<yesno question>:
|
|
288
|
-
answer: boolean # true when the statement holds.
|
|
289
|
-
probability: number # Probability that it holds.
|
|
290
|
-
confidence: number # Probability of the given answer.
|
|
291
|
-
<score question>:
|
|
292
|
-
level: string # The most likely level.
|
|
293
|
-
index: number # Its position, from 0.
|
|
294
|
-
score: number # Fractional position on the scale (evaluation backend).
|
|
295
|
-
confidence: number # 0 to 1.
|
|
296
|
-
probabilities: object # Probability per level (evaluation backend), else null.
|
|
297
|
-
usage: object # Token usage ({ inputTokens, outputTokens, totalTokens }).
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
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.
|
|
301
|
-
|
|
302
|
-
#### Examples
|
|
303
|
-
|
|
304
|
-
###### Route a support ticket, and queue uncertain ones for a person:
|
|
305
|
-
|
|
306
|
-
```yaml
|
|
307
|
-
api:
|
|
308
|
-
- id: triage-ticket
|
|
309
|
-
type: Api
|
|
310
|
-
routine:
|
|
311
|
-
- id: triage
|
|
312
|
-
type: Decide
|
|
313
|
-
connectionId: gateway
|
|
314
|
-
properties:
|
|
315
|
-
model: typesafe-ai/jev
|
|
316
|
-
state:
|
|
317
|
-
subject:
|
|
318
|
-
_payload: subject
|
|
319
|
-
body:
|
|
320
|
-
_payload: body
|
|
321
|
-
questions:
|
|
322
|
-
team:
|
|
323
|
-
choice: Which team handles this ticket
|
|
324
|
-
options:
|
|
325
|
-
billing: Invoices, charges and refunds
|
|
326
|
-
tech: Outages and bugs
|
|
327
|
-
sales: Plans and quotes
|
|
328
|
-
down:
|
|
329
|
-
yesno: The customer says the service is down
|
|
330
|
-
providerOptions:
|
|
331
|
-
gateway:
|
|
332
|
-
zeroDataRetention: true
|
|
333
|
-
- ':if':
|
|
334
|
-
_lt:
|
|
335
|
-
- _step: triage.team.confidence
|
|
336
|
-
- 0.7
|
|
337
|
-
':then':
|
|
338
|
-
- id: queue_review
|
|
339
|
-
type: MongoDBInsertOne
|
|
340
|
-
connectionId: review_queue
|
|
341
|
-
properties:
|
|
342
|
-
doc:
|
|
343
|
-
subject:
|
|
344
|
-
_payload: subject
|
|
345
|
-
suggested_team:
|
|
346
|
-
_step: triage.team.choice
|
|
347
|
-
- ':return':
|
|
348
|
-
status: review
|
|
349
|
-
- ':if':
|
|
350
|
-
_eq:
|
|
351
|
-
- _step: triage.team.choice
|
|
352
|
-
- billing
|
|
353
|
-
':then':
|
|
354
|
-
- id: open_billing_case
|
|
355
|
-
type: CallApi
|
|
356
|
-
properties:
|
|
357
|
-
endpointId: open-billing-case
|
|
358
|
-
- ':return':
|
|
359
|
-
team:
|
|
360
|
-
_step: triage.team.choice
|
|
361
|
-
urgent:
|
|
362
|
-
_step: triage.down.answer
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
###### The same decision with any language model:
|
|
366
|
-
|
|
367
|
-
```yaml
|
|
368
|
-
requests:
|
|
369
|
-
- id: rate_review
|
|
370
|
-
type: Decide
|
|
371
|
-
connectionId: claude
|
|
372
|
-
payload:
|
|
373
|
-
review:
|
|
374
|
-
_state: review_text
|
|
375
|
-
properties:
|
|
376
|
-
model: claude-haiku-4-5
|
|
377
|
-
state:
|
|
378
|
-
_payload: review
|
|
379
|
-
questions:
|
|
380
|
-
sentiment:
|
|
381
|
-
score: How positive is this review
|
|
382
|
-
levels:
|
|
383
|
-
- Very negative
|
|
384
|
-
- Negative
|
|
385
|
-
- Neutral
|
|
386
|
-
- Positive
|
|
387
|
-
- Very positive
|
|
388
|
-
```
|
|
@@ -34,15 +34,12 @@ The `MongoDBCollection` connection sets up a connection to a MongoDB deployment.
|
|
|
34
34
|
|
|
35
35
|
>Since the connection URI contains authentication secrets, it should be stored using the [`_secret`](operators/secret.md) operator.
|
|
36
36
|
|
|
37
|
-
When
|
|
37
|
+
When using MongoDBUpdateOne and MongoDBDeleteOne requests, take note that the responses differ if the connection has a log collection.
|
|
38
38
|
|
|
39
39
|
#### Properties
|
|
40
40
|
- `databaseUri: string`: __Required__ - Connection uri string for the MongoDb deployment. Should be stored using the [_secret](operators/secret.md) operator.
|
|
41
41
|
- `databaseName: string`: Default: Database specified in connection string - The name of the database in the MongoDB deployment.
|
|
42
42
|
- `collection: string`: __Required__ - The name of the MongoDB collection.
|
|
43
|
-
- `changeLog: object`: Log all changes made by write requests to a log collection.
|
|
44
|
-
- `collection: string`: __Required__ - The name of the collection change log records are written to.
|
|
45
|
-
- `meta: object`: Additional data to include in every change log record, for example the user making the change.
|
|
46
43
|
- `read: boolean`: Default: `true` - Allow read operations like find on the collection.
|
|
47
44
|
- `write: boolean`: Default: `false` - Allow write operations like update on the collection.
|
|
48
45
|
- `options: object`: See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/interfaces/mongoclientoptions.html) for more information.
|
|
@@ -108,13 +105,10 @@ Request types:
|
|
|
108
105
|
- MongoDBDeleteOne
|
|
109
106
|
- MongoDBFind
|
|
110
107
|
- MongoDBFindOne
|
|
111
|
-
- MongoDBInsertConsecutiveId
|
|
112
108
|
- MongoDBInsertMany
|
|
113
|
-
- MongoDBInsertManyConsecutiveIds
|
|
114
109
|
- MongoDBInsertOne
|
|
115
110
|
- MongoDBUpdateMany
|
|
116
111
|
- MongoDBUpdateOne
|
|
117
|
-
- MongoDBVersionedUpdateOne
|
|
118
112
|
|
|
119
113
|
|
|
120
114
|
### MongoDBAggregation
|
|
@@ -297,7 +291,7 @@ requests:
|
|
|
297
291
|
### MongoDBDeleteOne
|
|
298
292
|
|
|
299
293
|
The `MongoDBDeleteOne` request deletes a single document in the collection specified in the connectionId. It requires a filter, which is written in the query syntax, to select a document to delete. It will delete the first document that matches the filter.
|
|
300
|
-
>
|
|
294
|
+
> MongoDBDeleteOne response differs when the connection has a log collection. When a log collection is set on the connection, a findOneAndDelete operation is performed compared to the standard deleteOne operation.
|
|
301
295
|
|
|
302
296
|
#### Properties
|
|
303
297
|
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
@@ -471,34 +465,6 @@ requests:
|
|
|
471
465
|
_payload: _id
|
|
472
466
|
```
|
|
473
467
|
|
|
474
|
-
### MongoDBInsertConsecutiveId
|
|
475
|
-
|
|
476
|
-
The `MongoDBInsertConsecutiveId` request inserts a single document into the collection specified in the connectionId, assigning a sequential, human-readable `_id` like `INV0001`. The id is built from a prefix and the next consecutive number for that prefix, zero-padded to `length` digits. The id read and the insert run inside a transaction so concurrent requests cannot claim the same id.
|
|
477
|
-
|
|
478
|
-
> Transactions require MongoDB to run as a replica set. Standalone deployments are not supported by this request.
|
|
479
|
-
|
|
480
|
-
#### Properties
|
|
481
|
-
- `doc: object`: __Required__ - The document to be inserted. The `_id` is assigned by the request.
|
|
482
|
-
- `prefix: string`: __Required__ - Prefix to add to the id, for example `INV`.
|
|
483
|
-
- `length: number`: The numeric part of the id is zero-padded to this number of digits. If omitted, the number is not padded.
|
|
484
|
-
- `options: object`: Optional settings passed to the insert. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertone) for more information.
|
|
485
|
-
|
|
486
|
-
#### Examples
|
|
487
|
-
|
|
488
|
-
###### Insert an invoice with a sequential id (INV0001, INV0002, ...):
|
|
489
|
-
```yaml
|
|
490
|
-
requests:
|
|
491
|
-
- id: insert_invoice
|
|
492
|
-
type: MongoDBInsertConsecutiveId
|
|
493
|
-
connectionId: my_mongodb_collection_id
|
|
494
|
-
properties:
|
|
495
|
-
prefix: INV
|
|
496
|
-
length: 4
|
|
497
|
-
doc:
|
|
498
|
-
amount:
|
|
499
|
-
_state: amount
|
|
500
|
-
```
|
|
501
|
-
|
|
502
468
|
### MongoDBInsertMany
|
|
503
469
|
|
|
504
470
|
The `MongoDBInsertMany` request inserts an array of documents into the collection specified in the connectionId. If a `_id` field is not specified on a document, a MongoDB `ObjectID` will be generated.
|
|
@@ -546,33 +512,6 @@ requests:
|
|
|
546
512
|
|
|
547
513
|
```
|
|
548
514
|
|
|
549
|
-
### MongoDBInsertManyConsecutiveIds
|
|
550
|
-
|
|
551
|
-
The `MongoDBInsertManyConsecutiveIds` request inserts an array of documents into the collection specified in the connectionId, assigning each document a sequential, human-readable `_id` like `INV0001`. Ids continue from the highest existing id for the prefix. The id read and the insert run inside a transaction so concurrent requests cannot claim the same ids.
|
|
552
|
-
|
|
553
|
-
> Transactions require MongoDB to run as a replica set. Standalone deployments are not supported by this request.
|
|
554
|
-
|
|
555
|
-
#### Properties
|
|
556
|
-
- `docs: object[]`: __Required__ - The documents to be inserted. The `_id` values are assigned by the request.
|
|
557
|
-
- `prefix: string`: __Required__ - Prefix to add to the ids, for example `INV`.
|
|
558
|
-
- `length: number`: The numeric part of each id is zero-padded to this number of digits. If omitted, the numbers are not padded.
|
|
559
|
-
- `options: object`: Optional settings passed to the insert. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertmany) for more information.
|
|
560
|
-
|
|
561
|
-
#### Examples
|
|
562
|
-
|
|
563
|
-
###### Insert order lines with sequential ids:
|
|
564
|
-
```yaml
|
|
565
|
-
requests:
|
|
566
|
-
- id: insert_order_lines
|
|
567
|
-
type: MongoDBInsertManyConsecutiveIds
|
|
568
|
-
connectionId: my_mongodb_collection_id
|
|
569
|
-
properties:
|
|
570
|
-
prefix: LINE
|
|
571
|
-
length: 6
|
|
572
|
-
docs:
|
|
573
|
-
_state: order_lines
|
|
574
|
-
```
|
|
575
|
-
|
|
576
515
|
### MongoDBInsertOne
|
|
577
516
|
|
|
578
517
|
The `MongoDBInsertOne` request inserts a document into the collection specified in the connectionId. If a `_id` field is not specified, a MongoDB `ObjectID` will be generated.
|
|
@@ -680,15 +619,11 @@ requests:
|
|
|
680
619
|
### MongoDBUpdateOne
|
|
681
620
|
|
|
682
621
|
The `MongoDBUpdateOne` request updates a single document in the collection specified in the connectionId. It requires a filter, which is written in the query syntax, to select a document to update. It will update the first document that matches the filter. If the `upsert` option is set to true, it will insert a new document if no document is found to update.
|
|
683
|
-
|
|
684
|
-
If no document matches the filter, the request throws `No matching record to update.` — a silent no-op update usually indicates a bug. Set `disableNoMatchError: true` on the request to restore the pre-5.5.0 behavior of returning `matchedCount: 0`. Requests with the `upsert` option never throw this error. Running `lowdefy upgrade` adds `disableNoMatchError: true` to existing requests so upgraded apps keep their behavior.
|
|
685
|
-
|
|
686
|
-
> When the connection has a log collection, a findOneAndUpdate operation is performed instead of the standard updateOne operation so before and after document snapshots can be captured in the change log. The response shape is the same in both cases.
|
|
622
|
+
> MongoDBUpdateOne response differs when the connection has a log collection. When a log collection is set on the connection, a findOneAndUpdate operation is performed compared to the standard updateOne operation.
|
|
687
623
|
|
|
688
624
|
#### Properties
|
|
689
625
|
- `filter: object`: __Required__ - The filter used to select the document to update.
|
|
690
626
|
- `update: object | object[]`: __Required__ - The update operations to be applied to the document.
|
|
691
|
-
- `disableNoMatchError: boolean`: Default: `false` - Do not throw an error when no document matches the filter.
|
|
692
627
|
- `options: object`: Optional settings. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#updateone) for more information. Supported settings are:
|
|
693
628
|
- `arrayFilters: object[]`: _Array_ - Array filters for the [`$[<identifier>]`](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) array update operator.
|
|
694
629
|
- `authdb: string`: Specifies the authentication information to be used.
|
|
@@ -757,47 +692,6 @@ requests:
|
|
|
757
692
|
_date: now
|
|
758
693
|
```
|
|
759
694
|
|
|
760
|
-
### MongoDBVersionedUpdateOne
|
|
761
|
-
|
|
762
|
-
The `MongoDBVersionedUpdateOne` request updates a single document while preserving the previous version. The matched document is re-inserted under a new `_id`, and the update is applied to the new copy — so the collection keeps a full version history of the document.
|
|
763
|
-
|
|
764
|
-
If no document matches the filter, the request throws `No matching record to update.`. Set `disableNoMatchError: true` on the request to suppress the error. Requests with the `upsert` update option never throw this error.
|
|
765
|
-
|
|
766
|
-
> The version insert and the update are separate operations, not a transaction. If the update fails, the inserted version copy remains in the collection.
|
|
767
|
-
|
|
768
|
-
> When the connection has a log collection, a findOneAndUpdate operation is performed instead of the standard updateOne operation so before and after document snapshots can be captured in the change log. The response shape is the same in both cases.
|
|
769
|
-
|
|
770
|
-
#### Properties
|
|
771
|
-
- `filter: object`: __Required__ - The filter used to select the document to version and update.
|
|
772
|
-
- `update: object | object[]`: __Required__ - The update operations to be applied to the new copy of the document.
|
|
773
|
-
- `disableNoMatchError: boolean`: Default: `false` - Do not throw an error when no document matches the filter.
|
|
774
|
-
- `options: object`: Optional settings for each underlying operation:
|
|
775
|
-
- `find: object`: Options for the find one operation. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#findone).
|
|
776
|
-
- `insert: object`: Options for the insert one operation that creates the version copy. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#insertone).
|
|
777
|
-
- `update: object`: Options for the update operation. See the [driver documentation](https://mongodb.github.io/node-mongodb-native/4.0/classes/collection.html#updateone).
|
|
778
|
-
|
|
779
|
-
#### Examples
|
|
780
|
-
|
|
781
|
-
###### Update a document, keeping the previous version:
|
|
782
|
-
```yaml
|
|
783
|
-
requests:
|
|
784
|
-
- id: versioned_update
|
|
785
|
-
type: MongoDBVersionedUpdateOne
|
|
786
|
-
connectionId: my_mongodb_collection_id
|
|
787
|
-
payload:
|
|
788
|
-
doc_id:
|
|
789
|
-
_state: doc_id
|
|
790
|
-
properties:
|
|
791
|
-
filter:
|
|
792
|
-
doc_id:
|
|
793
|
-
_payload: doc_id
|
|
794
|
-
current: true
|
|
795
|
-
update:
|
|
796
|
-
$set:
|
|
797
|
-
status:
|
|
798
|
-
_state: status
|
|
799
|
-
```
|
|
800
|
-
|
|
801
695
|
## Websockets
|
|
802
696
|
|
|
803
697
|
Websocket types:
|
|
@@ -861,15 +755,3 @@ pages:
|
|
|
861
755
|
```
|
|
862
756
|
|
|
863
757
|
The change event payload is available on `_event: messages` in `onMessage` and via the [`_websocket`](/websocket-subscriptions) operator — each message is the MongoDB change event, including `operationType`, `documentKey` and `fullDocument`.
|
|
864
|
-
|
|
865
|
-
## Errors
|
|
866
|
-
|
|
867
|
-
When MongoDB rejects an operation, the request fails with a `ServiceError` that carries:
|
|
868
|
-
|
|
869
|
-
- `code` — the MongoDB error code, for example `11000` for a duplicate key.
|
|
870
|
-
- `message` — a plain sentence naming the collection and the request type, like `MongoDB: Duplicate key on collection "orders".`
|
|
871
|
-
- `hint` — a sentence saying what to do about it, for example to insert with `MongoDBUpdateOne` and `upsert: true`, to add an index covering the filter, or to grant the database user a role.
|
|
872
|
-
|
|
873
|
-
The driver's own message is never sent to the browser — it can quote values from the document that triggered the error. It is logged on the server instead, where the dev server terminal prints it under the located error line as `Caused by: MongoServerError: E11000 …`.
|
|
874
|
-
|
|
875
|
-
Network, DNS and TLS failures are also `ServiceError`s, classified by the connection layer rather than by an error code.
|
|
@@ -11,8 +11,6 @@ The OpenAI connection connects to the [OpenAI API](https://platform.openai.com/d
|
|
|
11
11
|
#### Properties
|
|
12
12
|
- `apiKey: string`: __Required__ - OpenAI API key. Use [`_secret`](/_secret) to reference this securely.
|
|
13
13
|
- `baseURL: string`: Optional base URL. Use this to connect to Azure OpenAI or any OpenAI-compatible endpoint.
|
|
14
|
-
- `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.
|
|
15
|
-
- `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.
|
|
16
14
|
|
|
17
15
|
###### Connection example:
|
|
18
16
|
```yaml
|
|
@@ -89,28 +87,11 @@ Request types:
|
|
|
89
87
|
|
|
90
88
|
- GenerateText
|
|
91
89
|
- GenerateObject
|
|
92
|
-
- Decide
|
|
93
90
|
|
|
94
|
-
All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText
|
|
91
|
+
All AI provider connections (`Anthropic`, `OpenAI`, `Google`, `AIGateway`) provide the same `GenerateText` and `GenerateObject` 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.
|
|
95
92
|
|
|
96
93
|
For multi-step tool use, see [agents](/agents-introduction) instead.
|
|
97
94
|
|
|
98
|
-
### Limits and cancellation
|
|
99
|
-
|
|
100
|
-
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:
|
|
101
|
-
|
|
102
|
-
- `maxOutputTokens` caps the tokens one call generates. Without it, the provider's default applies.
|
|
103
|
-
- `timeout` cancels a call, retries included, that runs longer than this many milliseconds. The request fails with a `ServiceError`.
|
|
104
|
-
|
|
105
|
-
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:
|
|
106
|
-
|
|
107
|
-
- 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.
|
|
108
|
-
- 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).
|
|
109
|
-
- 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.
|
|
110
|
-
- 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.
|
|
111
|
-
|
|
112
|
-
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.
|
|
113
|
-
|
|
114
95
|
### GenerateText
|
|
115
96
|
|
|
116
97
|
Generates text from a prompt.
|
|
@@ -121,9 +102,7 @@ Generates text from a prompt.
|
|
|
121
102
|
- `prompt: string`: Text prompt. Use either `prompt` or `messages`, not both.
|
|
122
103
|
- `messages: object[]`: Model messages (`{ role, content }`). Use either `prompt` or `messages`, not both.
|
|
123
104
|
- `system: string`: System prompt.
|
|
124
|
-
- `
|
|
125
|
-
- `maxOutputTokens: number`: Maximum number of tokens to generate. Defaults to the connection's `maxOutputTokens`.
|
|
126
|
-
- `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
|
|
105
|
+
- `maxOutputTokens: number`: Maximum number of tokens to generate.
|
|
127
106
|
- `temperature: number`: Sampling temperature (0 to 2).
|
|
128
107
|
- `topP: number`: Nucleus sampling.
|
|
129
108
|
- `topK: number`: Only sample from the top K options for each subsequent token.
|
|
@@ -247,142 +226,3 @@ api:
|
|
|
247
226
|
category:
|
|
248
227
|
_step: classify.object.category
|
|
249
228
|
```
|
|
250
|
-
|
|
251
|
-
### Decide
|
|
252
|
-
|
|
253
|
-
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.
|
|
254
|
-
|
|
255
|
-
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.
|
|
256
|
-
|
|
257
|
-
`Decide` has two backends behind the same interface:
|
|
258
|
-
|
|
259
|
-
- `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.
|
|
260
|
-
- `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.
|
|
261
|
-
|
|
262
|
-
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.
|
|
263
|
-
|
|
264
|
-
#### Properties
|
|
265
|
-
|
|
266
|
-
- `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.
|
|
267
|
-
- `state: string | object | array`: **Required** - What the questions are about.
|
|
268
|
-
- `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:
|
|
269
|
-
- `{ choice: string, options: object }` - Pick exactly one option. `options` maps option names (2 to 255) to what each one means (`null` for no description).
|
|
270
|
-
- `{ yesno: string, criteria?: { yes: string, no: string } }` - Judge a statement true or false. `criteria` optionally says what counts as yes and as no.
|
|
271
|
-
- `{ score: string, levels: string[] }` - Place the state on 2 to 10 ordered levels, lowest first.
|
|
272
|
-
- `backend: enum`: `evaluation` or `structured-output`. Defaults to `evaluation` on `AIGateway` and `structured-output` elsewhere.
|
|
273
|
-
- `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`.
|
|
274
|
-
- `timeout: number`: Milliseconds the model call may take, retries included, before it is cancelled. Defaults to the connection's `timeout`.
|
|
275
|
-
- `maxRetries: number`: Maximum number of retries. Defaults to 2.
|
|
276
|
-
- `providerOptions: object`: Provider-specific options, keyed by provider (e.g. `gateway: { zeroDataRetention: true }`).
|
|
277
|
-
|
|
278
|
-
#### Response
|
|
279
|
-
|
|
280
|
-
One key per question, plus `usage`:
|
|
281
|
-
|
|
282
|
-
```yaml
|
|
283
|
-
<choice question>:
|
|
284
|
-
choice: string # The chosen option.
|
|
285
|
-
confidence: number # 0 to 1.
|
|
286
|
-
probabilities: object # Probability per option (evaluation backend), else null.
|
|
287
|
-
<yesno question>:
|
|
288
|
-
answer: boolean # true when the statement holds.
|
|
289
|
-
probability: number # Probability that it holds.
|
|
290
|
-
confidence: number # Probability of the given answer.
|
|
291
|
-
<score question>:
|
|
292
|
-
level: string # The most likely level.
|
|
293
|
-
index: number # Its position, from 0.
|
|
294
|
-
score: number # Fractional position on the scale (evaluation backend).
|
|
295
|
-
confidence: number # 0 to 1.
|
|
296
|
-
probabilities: object # Probability per level (evaluation backend), else null.
|
|
297
|
-
usage: object # Token usage ({ inputTokens, outputTokens, totalTokens }).
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
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.
|
|
301
|
-
|
|
302
|
-
#### Examples
|
|
303
|
-
|
|
304
|
-
###### Route a support ticket, and queue uncertain ones for a person:
|
|
305
|
-
|
|
306
|
-
```yaml
|
|
307
|
-
api:
|
|
308
|
-
- id: triage-ticket
|
|
309
|
-
type: Api
|
|
310
|
-
routine:
|
|
311
|
-
- id: triage
|
|
312
|
-
type: Decide
|
|
313
|
-
connectionId: gateway
|
|
314
|
-
properties:
|
|
315
|
-
model: typesafe-ai/jev
|
|
316
|
-
state:
|
|
317
|
-
subject:
|
|
318
|
-
_payload: subject
|
|
319
|
-
body:
|
|
320
|
-
_payload: body
|
|
321
|
-
questions:
|
|
322
|
-
team:
|
|
323
|
-
choice: Which team handles this ticket
|
|
324
|
-
options:
|
|
325
|
-
billing: Invoices, charges and refunds
|
|
326
|
-
tech: Outages and bugs
|
|
327
|
-
sales: Plans and quotes
|
|
328
|
-
down:
|
|
329
|
-
yesno: The customer says the service is down
|
|
330
|
-
providerOptions:
|
|
331
|
-
gateway:
|
|
332
|
-
zeroDataRetention: true
|
|
333
|
-
- ':if':
|
|
334
|
-
_lt:
|
|
335
|
-
- _step: triage.team.confidence
|
|
336
|
-
- 0.7
|
|
337
|
-
':then':
|
|
338
|
-
- id: queue_review
|
|
339
|
-
type: MongoDBInsertOne
|
|
340
|
-
connectionId: review_queue
|
|
341
|
-
properties:
|
|
342
|
-
doc:
|
|
343
|
-
subject:
|
|
344
|
-
_payload: subject
|
|
345
|
-
suggested_team:
|
|
346
|
-
_step: triage.team.choice
|
|
347
|
-
- ':return':
|
|
348
|
-
status: review
|
|
349
|
-
- ':if':
|
|
350
|
-
_eq:
|
|
351
|
-
- _step: triage.team.choice
|
|
352
|
-
- billing
|
|
353
|
-
':then':
|
|
354
|
-
- id: open_billing_case
|
|
355
|
-
type: CallApi
|
|
356
|
-
properties:
|
|
357
|
-
endpointId: open-billing-case
|
|
358
|
-
- ':return':
|
|
359
|
-
team:
|
|
360
|
-
_step: triage.team.choice
|
|
361
|
-
urgent:
|
|
362
|
-
_step: triage.down.answer
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
###### The same decision with any language model:
|
|
366
|
-
|
|
367
|
-
```yaml
|
|
368
|
-
requests:
|
|
369
|
-
- id: rate_review
|
|
370
|
-
type: Decide
|
|
371
|
-
connectionId: claude
|
|
372
|
-
payload:
|
|
373
|
-
review:
|
|
374
|
-
_state: review_text
|
|
375
|
-
properties:
|
|
376
|
-
model: claude-haiku-4-5
|
|
377
|
-
state:
|
|
378
|
-
_payload: review
|
|
379
|
-
questions:
|
|
380
|
-
sentiment:
|
|
381
|
-
score: How positive is this review
|
|
382
|
-
levels:
|
|
383
|
-
- Very negative
|
|
384
|
-
- Negative
|
|
385
|
-
- Neutral
|
|
386
|
-
- Positive
|
|
387
|
-
- Very positive
|
|
388
|
-
```
|