bem-ai-sdk 0.24.0 → 0.26.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/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/resources/functions/functions.d.mts +433 -109
- package/resources/functions/functions.d.mts.map +1 -1
- package/resources/functions/functions.d.ts +433 -109
- package/resources/functions/functions.d.ts.map +1 -1
- package/resources/functions/functions.js.map +1 -1
- package/resources/functions/functions.mjs.map +1 -1
- package/resources/functions/versions.d.mts +45 -13
- package/resources/functions/versions.d.mts.map +1 -1
- package/resources/functions/versions.d.ts +45 -13
- package/resources/functions/versions.d.ts.map +1 -1
- package/src/resources/functions/functions.ts +460 -111
- package/src/resources/functions/versions.ts +47 -13
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -462,31 +462,38 @@ export declare namespace CreateFunction {
|
|
|
462
462
|
functionName: string;
|
|
463
463
|
type: 'enrich';
|
|
464
464
|
/**
|
|
465
|
-
* Configuration for enrich function
|
|
465
|
+
* Configuration for an enrich function.
|
|
466
466
|
*
|
|
467
467
|
* **How Enrich Functions Work:**
|
|
468
468
|
*
|
|
469
|
-
* Enrich functions
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
469
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
470
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
471
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
472
|
+
*
|
|
473
|
+
* **Data Sources:**
|
|
474
|
+
*
|
|
475
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
476
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
477
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
478
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
479
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
480
|
+
* endpoint.
|
|
473
481
|
*
|
|
474
482
|
* **Input Requirements:**
|
|
475
483
|
*
|
|
476
|
-
* - Must receive JSON input (typically
|
|
477
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
484
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
478
485
|
*
|
|
479
486
|
* **Example Use Cases:**
|
|
480
487
|
*
|
|
481
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
482
|
-
* - Enrich customer data with account
|
|
483
|
-
* -
|
|
488
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
489
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
490
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
491
|
+
* products
|
|
484
492
|
*
|
|
485
493
|
* **Configuration:**
|
|
486
494
|
*
|
|
487
|
-
* - Define
|
|
488
|
-
* -
|
|
489
|
-
* - Steps are executed sequentially
|
|
495
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
496
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
490
497
|
*/
|
|
491
498
|
config?: FunctionsAPI.EnrichConfig;
|
|
492
499
|
/**
|
|
@@ -508,6 +515,12 @@ export declare namespace CreateFunction {
|
|
|
508
515
|
* Display name of function. Human-readable name to help you identify the function.
|
|
509
516
|
*/
|
|
510
517
|
displayName?: string;
|
|
518
|
+
/**
|
|
519
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
520
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
521
|
+
* stays distinct from operator-level execution flags.
|
|
522
|
+
*/
|
|
523
|
+
extraConfig?: ParseFunction.ExtraConfig;
|
|
511
524
|
/**
|
|
512
525
|
* Per-version configuration for a Parse function.
|
|
513
526
|
*
|
|
@@ -521,44 +534,208 @@ export declare namespace CreateFunction {
|
|
|
521
534
|
*/
|
|
522
535
|
tags?: Array<string>;
|
|
523
536
|
}
|
|
537
|
+
namespace ParseFunction {
|
|
538
|
+
/**
|
|
539
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
540
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
541
|
+
* stays distinct from operator-level execution flags.
|
|
542
|
+
*/
|
|
543
|
+
interface ExtraConfig {
|
|
544
|
+
/**
|
|
545
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
546
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
547
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
548
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
549
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
550
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
551
|
+
* (no native bbox support). Defaults to false.
|
|
552
|
+
*/
|
|
553
|
+
enableBoundingBoxes?: boolean;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
524
556
|
}
|
|
525
557
|
/**
|
|
526
|
-
* Configuration for enrich function
|
|
558
|
+
* Configuration for an enrich function.
|
|
527
559
|
*
|
|
528
560
|
* **How Enrich Functions Work:**
|
|
529
561
|
*
|
|
530
|
-
* Enrich functions
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
562
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
563
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
564
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
565
|
+
*
|
|
566
|
+
* **Data Sources:**
|
|
567
|
+
*
|
|
568
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
569
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
570
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
571
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
572
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
573
|
+
* endpoint.
|
|
534
574
|
*
|
|
535
575
|
* **Input Requirements:**
|
|
536
576
|
*
|
|
537
|
-
* - Must receive JSON input (typically
|
|
538
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
577
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
539
578
|
*
|
|
540
579
|
* **Example Use Cases:**
|
|
541
580
|
*
|
|
542
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
543
|
-
* - Enrich customer data with account
|
|
544
|
-
* -
|
|
581
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
582
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
583
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
584
|
+
* products
|
|
545
585
|
*
|
|
546
586
|
* **Configuration:**
|
|
547
587
|
*
|
|
548
|
-
* - Define
|
|
549
|
-
* -
|
|
550
|
-
* - Steps are executed sequentially
|
|
588
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
589
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
551
590
|
*/
|
|
552
591
|
export interface EnrichConfig {
|
|
553
592
|
/**
|
|
554
|
-
* Array of enrichment steps to execute sequentially
|
|
593
|
+
* Array of enrichment steps to execute sequentially.
|
|
555
594
|
*/
|
|
556
595
|
steps: Array<EnrichStep>;
|
|
596
|
+
/**
|
|
597
|
+
* Named HTTP endpoints available to endpoint-source steps. Each endpoint must have
|
|
598
|
+
* a unique `name` referenced by the step's `endpointName`. Required when any step
|
|
599
|
+
* uses `source: "endpoint"`.
|
|
600
|
+
*/
|
|
601
|
+
endpoints?: Array<EnrichConfig.Endpoint>;
|
|
602
|
+
}
|
|
603
|
+
export declare namespace EnrichConfig {
|
|
604
|
+
/**
|
|
605
|
+
* A named HTTP endpoint that an enrich step can call to fetch enrichment data.
|
|
606
|
+
*
|
|
607
|
+
* The platform makes one request per extracted source value, substituting the
|
|
608
|
+
* value as a query parameter or body template placeholder. The raw response (or
|
|
609
|
+
* the sub-value selected by `responsePath`) is injected into the output, or passed
|
|
610
|
+
* to LLM agent reasoning when `matchInstructions` is set.
|
|
611
|
+
*
|
|
612
|
+
* **Request formats:**
|
|
613
|
+
*
|
|
614
|
+
* - `GET`: Appends `?{queryParam}={value}` to the URL.
|
|
615
|
+
* - `POST`: Sends `bodyTemplate` as the request body, replacing `{value}` with the
|
|
616
|
+
* extracted value.
|
|
617
|
+
*/
|
|
618
|
+
interface Endpoint {
|
|
619
|
+
/**
|
|
620
|
+
* HTTP method to use.
|
|
621
|
+
*/
|
|
622
|
+
method: 'GET' | 'POST';
|
|
623
|
+
/**
|
|
624
|
+
* Unique name for this endpoint, referenced by enrichStep.endpointName.
|
|
625
|
+
*/
|
|
626
|
+
name: string;
|
|
627
|
+
/**
|
|
628
|
+
* Full URL of the endpoint (must be http:// or https://).
|
|
629
|
+
*/
|
|
630
|
+
url: string;
|
|
631
|
+
/**
|
|
632
|
+
* JSON body template for POST requests. **Required for POST endpoints.** Must
|
|
633
|
+
* contain the `{value}` placeholder, which is replaced with the extracted source
|
|
634
|
+
* value at runtime.
|
|
635
|
+
*
|
|
636
|
+
* Example: `bodyTemplate: "{\"query\": \"{value}\", \"limit\": 10}"`
|
|
637
|
+
*/
|
|
638
|
+
bodyTemplate?: string;
|
|
639
|
+
/**
|
|
640
|
+
* Additional HTTP headers to include in every request (e.g.
|
|
641
|
+
* `Authorization: Bearer <token>`).
|
|
642
|
+
*/
|
|
643
|
+
headers?: unknown;
|
|
644
|
+
/**
|
|
645
|
+
* Natural-language instructions for LLM agent reasoning.
|
|
646
|
+
*
|
|
647
|
+
* When set, the candidates fetched from the endpoint are passed to an LLM with
|
|
648
|
+
* these instructions, which selects the best match(es) and returns them with
|
|
649
|
+
* confidence scores. Each injected result has the shape
|
|
650
|
+
* `{ data, confidence, reasoning? }`.
|
|
651
|
+
*
|
|
652
|
+
* When omitted, the raw fetched value is injected without any LLM involvement.
|
|
653
|
+
*/
|
|
654
|
+
matchInstructions?: string;
|
|
655
|
+
/**
|
|
656
|
+
* Maximum number of ranked matches to return per source value when
|
|
657
|
+
* `matchInstructions` is set (default: 1). Ignored when `matchInstructions` is
|
|
658
|
+
* empty.
|
|
659
|
+
*/
|
|
660
|
+
matchTopK?: number;
|
|
661
|
+
/**
|
|
662
|
+
* LLM batch size during agent reasoning (default: 50). All candidates — across all
|
|
663
|
+
* fetched pages — are scored in batches of this size. Smaller values reduce
|
|
664
|
+
* per-call token usage; larger values mean fewer LLM calls. Ignored when
|
|
665
|
+
* `matchInstructions` is empty.
|
|
666
|
+
*/
|
|
667
|
+
maxCandidates?: number;
|
|
668
|
+
/**
|
|
669
|
+
* Maximum number of pages to fetch (default: 10). Acts as a safety cap against
|
|
670
|
+
* infinite pagination loops when the server never returns an empty cursor.
|
|
671
|
+
*/
|
|
672
|
+
maxPages?: number;
|
|
673
|
+
/**
|
|
674
|
+
* Query parameter name used to pass the cursor on subsequent GET requests, or the
|
|
675
|
+
* `{placeholder}` name used in the POST `bodyTemplate` (e.g. `"cursor"`,
|
|
676
|
+
* `"pageToken"`, `"offset"`).
|
|
677
|
+
*
|
|
678
|
+
* Must be set together with `nextPagePath`.
|
|
679
|
+
*/
|
|
680
|
+
nextPageParam?: string;
|
|
681
|
+
/**
|
|
682
|
+
* JMESPath expression applied to each raw response to extract the cursor or token
|
|
683
|
+
* for the next page (e.g. `"nextCursor"`, `"pagination.nextToken"`). An absent,
|
|
684
|
+
* null, or empty-string result stops pagination. Both string and numeric values
|
|
685
|
+
* are supported — numbers are converted to their decimal string representation
|
|
686
|
+
* before being forwarded as a query parameter.
|
|
687
|
+
*
|
|
688
|
+
* Must be set together with `nextPageParam`.
|
|
689
|
+
*
|
|
690
|
+
* **Supported pagination styles:**
|
|
691
|
+
*
|
|
692
|
+
* - **Cursor/token-based** — server returns an opaque token in the response body
|
|
693
|
+
* (e.g. `{"nextCursor": "abc123"}`). Set `nextPagePath: "nextCursor"` and the
|
|
694
|
+
* platform forwards it verbatim on the next request.
|
|
695
|
+
* - **Server-computed offset/page** — server echoes back the next offset or page
|
|
696
|
+
* number in the response body (e.g. `{"nextOffset": 50}` or `{"nextPage": 2}`).
|
|
697
|
+
* Set `nextPagePath: "nextOffset"` and the platform forwards the value as-is.
|
|
698
|
+
*
|
|
699
|
+
* **Not supported:**
|
|
700
|
+
*
|
|
701
|
+
* - **Client-computed offset** — APIs where the client must compute
|
|
702
|
+
* `offset += limit` itself (e.g. `?offset=0&limit=50` with no next-offset in the
|
|
703
|
+
* response). Workaround: ask the API provider to return the next offset in the
|
|
704
|
+
* response body, or bake a fixed page size into the URL and use a server-side
|
|
705
|
+
* cursor instead.
|
|
706
|
+
* - **Client-computed page number** — APIs where the client increments `?page=N`
|
|
707
|
+
* itself with no next-page value in the response. Same workaround applies.
|
|
708
|
+
* - **Link header** — `Link: <url>; rel="next"` in HTTP response headers. The
|
|
709
|
+
* platform only inspects the response body.
|
|
710
|
+
*/
|
|
711
|
+
nextPagePath?: string;
|
|
712
|
+
/**
|
|
713
|
+
* Query parameter name used to pass the extracted source value. **Required for GET
|
|
714
|
+
* endpoints.** The value is URL-encoded and appended as
|
|
715
|
+
* `?{queryParam}={sourceValue}`.
|
|
716
|
+
*
|
|
717
|
+
* Example: `queryParam: "q"` → `GET /products?q=blue+widget`
|
|
718
|
+
*/
|
|
719
|
+
queryParam?: string;
|
|
720
|
+
/**
|
|
721
|
+
* JMESPath expression applied to the response body to extract the enrichment
|
|
722
|
+
* value. Omit to use the entire response body as the result.
|
|
723
|
+
*
|
|
724
|
+
* **For agent reasoning:** use a wildcard projection (e.g. `items[*]` or
|
|
725
|
+
* `results[*].data`) so the endpoint's list of candidates is flattened into an
|
|
726
|
+
* array before being passed to the LLM. A non-wildcard path (e.g. `data.product`)
|
|
727
|
+
* extracts a single value treated as one candidate.
|
|
728
|
+
*
|
|
729
|
+
* **Response size:** the platform reads at most 50 MB of the response body before
|
|
730
|
+
* decoding, regardless of the Content-Length header.
|
|
731
|
+
*/
|
|
732
|
+
responsePath?: string;
|
|
733
|
+
}
|
|
557
734
|
}
|
|
558
735
|
/**
|
|
559
736
|
* Single enrichment step configuration.
|
|
560
737
|
*
|
|
561
|
-
* **Process Flow:**
|
|
738
|
+
* **Process Flow (collection source):**
|
|
562
739
|
*
|
|
563
740
|
* 1. Extract values from `sourceField` using JMESPath
|
|
564
741
|
* 2. Perform search against the specified collection (semantic, exact, or hybrid
|
|
@@ -566,32 +743,41 @@ export interface EnrichConfig {
|
|
|
566
743
|
* 3. Return top K matches sorted by relevance (best match first)
|
|
567
744
|
* 4. Inject results into `targetField`
|
|
568
745
|
*
|
|
569
|
-
* **
|
|
746
|
+
* **Process Flow (endpoint source):**
|
|
747
|
+
*
|
|
748
|
+
* 1. Extract values from `sourceField` using JMESPath
|
|
749
|
+
* 2. Call the named endpoint once per extracted value, following pagination if
|
|
750
|
+
* `nextPagePath`/`nextPageParam` are configured on the endpoint
|
|
751
|
+
* 3. Optionally apply LLM agent reasoning to rank candidates
|
|
752
|
+
* (`matchInstructions`), batching across all fetched pages in groups of
|
|
753
|
+
* `maxCandidates`
|
|
754
|
+
* 4. Inject results into `targetField`
|
|
755
|
+
*
|
|
756
|
+
* **Collection Search Modes** (`source: "collection"` only):
|
|
570
757
|
*
|
|
571
|
-
* - `semantic` (default): Vector similarity search
|
|
758
|
+
* - `semantic` (default): Vector similarity search — best for natural language and
|
|
572
759
|
* conceptual matching
|
|
573
|
-
* - `exact`: Exact keyword matching
|
|
574
|
-
* - `hybrid`: Combined semantic + keyword search
|
|
760
|
+
* - `exact`: Exact keyword matching — best for SKU numbers, IDs, routing numbers
|
|
761
|
+
* - `hybrid`: Combined semantic + keyword search — best for tags and categories
|
|
762
|
+
*
|
|
763
|
+
* **Result Format (collection source):**
|
|
575
764
|
*
|
|
576
|
-
*
|
|
765
|
+
* - Always an array sorted by relevance (best match first)
|
|
766
|
+
* - Each element: `{ data, cosineDistance? }` or `{ data, hybridScore? }`
|
|
577
767
|
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* -
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
*
|
|
584
|
-
* -
|
|
768
|
+
* **Result Format (endpoint source, no matchInstructions):**
|
|
769
|
+
*
|
|
770
|
+
* - Always an array; the raw fetched value is the single element
|
|
771
|
+
*
|
|
772
|
+
* **Result Format (endpoint source, with matchInstructions):**
|
|
773
|
+
*
|
|
774
|
+
* - Array of LLM-ranked matches: `[{ data, confidence, reasoning? }, ...]`
|
|
775
|
+
* - Length capped by `enrichEndpoint.matchTopK` (default 1)
|
|
585
776
|
*/
|
|
586
777
|
export interface EnrichStep {
|
|
587
778
|
/**
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*/
|
|
591
|
-
collectionName: string;
|
|
592
|
-
/**
|
|
593
|
-
* JMESPath expression to extract source data for semantic search. Can extract
|
|
594
|
-
* single values or arrays. All extracted values will be used for search.
|
|
779
|
+
* JMESPath expression to extract source data. Can extract a single value or an
|
|
780
|
+
* array. Each extracted value is looked up independently.
|
|
595
781
|
*/
|
|
596
782
|
sourceField: string;
|
|
597
783
|
/**
|
|
@@ -600,6 +786,17 @@ export interface EnrichStep {
|
|
|
600
786
|
* regardless of topK value.
|
|
601
787
|
*/
|
|
602
788
|
targetField: string;
|
|
789
|
+
/**
|
|
790
|
+
* Name of the collection to search against. Required when `source` is
|
|
791
|
+
* `"collection"`. The collection must exist and contain items. Supports
|
|
792
|
+
* hierarchical paths when used with `includeSubcollections`.
|
|
793
|
+
*/
|
|
794
|
+
collectionName?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Name of an endpoint defined in `enrichConfig.endpoints`. Required when `source`
|
|
797
|
+
* is `"endpoint"`.
|
|
798
|
+
*/
|
|
799
|
+
endpointName?: string;
|
|
603
800
|
/**
|
|
604
801
|
* Whether to include cosine distance scores in results. Cosine distance ranges
|
|
605
802
|
* from 0.0 (perfect match) to 2.0 (completely dissimilar). Lower scores indicate
|
|
@@ -654,6 +851,15 @@ export interface EnrichStep {
|
|
|
654
851
|
* - Example: Balances semantic meaning with exact keyword matching
|
|
655
852
|
*/
|
|
656
853
|
searchMode?: 'semantic' | 'exact' | 'hybrid';
|
|
854
|
+
/**
|
|
855
|
+
* Where to fetch enrichment data from (default: `"collection"`).
|
|
856
|
+
*
|
|
857
|
+
* - `"collection"`: Vector/keyword search against a BEM collection. Requires
|
|
858
|
+
* `collectionName`.
|
|
859
|
+
* - `"endpoint"`: HTTP call to a named endpoint defined in
|
|
860
|
+
* `enrichConfig.endpoints`. Requires `endpointName`.
|
|
861
|
+
*/
|
|
862
|
+
source?: 'collection' | 'endpoint';
|
|
657
863
|
/**
|
|
658
864
|
* Number of top matching results to return per query (default: 1). Results are
|
|
659
865
|
* always returned as an array (list) and automatically sorted by cosine distance
|
|
@@ -1084,31 +1290,38 @@ export declare namespace Function {
|
|
|
1084
1290
|
}
|
|
1085
1291
|
interface EnrichFunction {
|
|
1086
1292
|
/**
|
|
1087
|
-
* Configuration for enrich function
|
|
1293
|
+
* Configuration for an enrich function.
|
|
1088
1294
|
*
|
|
1089
1295
|
* **How Enrich Functions Work:**
|
|
1090
1296
|
*
|
|
1091
|
-
* Enrich functions
|
|
1092
|
-
*
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1297
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
1298
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
1299
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
1300
|
+
*
|
|
1301
|
+
* **Data Sources:**
|
|
1302
|
+
*
|
|
1303
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
1304
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
1305
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
1306
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
1307
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
1308
|
+
* endpoint.
|
|
1095
1309
|
*
|
|
1096
1310
|
* **Input Requirements:**
|
|
1097
1311
|
*
|
|
1098
|
-
* - Must receive JSON input (typically
|
|
1099
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
1312
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
1100
1313
|
*
|
|
1101
1314
|
* **Example Use Cases:**
|
|
1102
1315
|
*
|
|
1103
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
1104
|
-
* - Enrich customer data with account
|
|
1105
|
-
* -
|
|
1316
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
1317
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
1318
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
1319
|
+
* products
|
|
1106
1320
|
*
|
|
1107
1321
|
* **Configuration:**
|
|
1108
1322
|
*
|
|
1109
|
-
* - Define
|
|
1110
|
-
* -
|
|
1111
|
-
* - Steps are executed sequentially
|
|
1323
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
1324
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
1112
1325
|
*/
|
|
1113
1326
|
config: FunctionsAPI.EnrichConfig;
|
|
1114
1327
|
/**
|
|
@@ -1163,6 +1376,12 @@ export declare namespace Function {
|
|
|
1163
1376
|
* Display name of function. Human-readable name to help you identify the function.
|
|
1164
1377
|
*/
|
|
1165
1378
|
displayName?: string;
|
|
1379
|
+
/**
|
|
1380
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
1381
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
1382
|
+
* stays distinct from operator-level execution flags.
|
|
1383
|
+
*/
|
|
1384
|
+
extraConfig?: ParseFunction.ExtraConfig;
|
|
1166
1385
|
/**
|
|
1167
1386
|
* Per-version configuration for a Parse function.
|
|
1168
1387
|
*
|
|
@@ -1180,6 +1399,25 @@ export declare namespace Function {
|
|
|
1180
1399
|
*/
|
|
1181
1400
|
usedInWorkflows?: Array<FunctionsAPI.WorkflowUsageInfo>;
|
|
1182
1401
|
}
|
|
1402
|
+
namespace ParseFunction {
|
|
1403
|
+
/**
|
|
1404
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
1405
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
1406
|
+
* stays distinct from operator-level execution flags.
|
|
1407
|
+
*/
|
|
1408
|
+
interface ExtraConfig {
|
|
1409
|
+
/**
|
|
1410
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
1411
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
1412
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
1413
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
1414
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
1415
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
1416
|
+
* (no native bbox support). Defaults to false.
|
|
1417
|
+
*/
|
|
1418
|
+
enableBoundingBoxes?: boolean;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1183
1421
|
}
|
|
1184
1422
|
export interface FunctionAudit {
|
|
1185
1423
|
/**
|
|
@@ -1227,16 +1465,6 @@ export interface ListFunctionsResponse {
|
|
|
1227
1465
|
* output concern) and cross-document memory linking (an environment-wide concern).
|
|
1228
1466
|
*/
|
|
1229
1467
|
export interface ParseConfig {
|
|
1230
|
-
/**
|
|
1231
|
-
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
1232
|
-
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
1233
|
-
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
1234
|
-
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
1235
|
-
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
1236
|
-
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
1237
|
-
* (no native bbox support). Defaults to false.
|
|
1238
|
-
*/
|
|
1239
|
-
enableBoundingBoxes?: boolean;
|
|
1240
1468
|
/**
|
|
1241
1469
|
* When true, extract named entities (people, organizations, products, studies,
|
|
1242
1470
|
* identifiers, etc.) and the relationships between them, and dedupe by canonical
|
|
@@ -1508,31 +1736,38 @@ export declare namespace UpdateFunction {
|
|
|
1508
1736
|
interface UpsertEnrichFunction {
|
|
1509
1737
|
type: 'enrich';
|
|
1510
1738
|
/**
|
|
1511
|
-
* Configuration for enrich function
|
|
1739
|
+
* Configuration for an enrich function.
|
|
1512
1740
|
*
|
|
1513
1741
|
* **How Enrich Functions Work:**
|
|
1514
1742
|
*
|
|
1515
|
-
* Enrich functions
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1518
|
-
*
|
|
1743
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
1744
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
1745
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
1746
|
+
*
|
|
1747
|
+
* **Data Sources:**
|
|
1748
|
+
*
|
|
1749
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
1750
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
1751
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
1752
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
1753
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
1754
|
+
* endpoint.
|
|
1519
1755
|
*
|
|
1520
1756
|
* **Input Requirements:**
|
|
1521
1757
|
*
|
|
1522
|
-
* - Must receive JSON input (typically
|
|
1523
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
1758
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
1524
1759
|
*
|
|
1525
1760
|
* **Example Use Cases:**
|
|
1526
1761
|
*
|
|
1527
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
1528
|
-
* - Enrich customer data with account
|
|
1529
|
-
* -
|
|
1762
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
1763
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
1764
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
1765
|
+
* products
|
|
1530
1766
|
*
|
|
1531
1767
|
* **Configuration:**
|
|
1532
1768
|
*
|
|
1533
|
-
* - Define
|
|
1534
|
-
* -
|
|
1535
|
-
* - Steps are executed sequentially
|
|
1769
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
1770
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
1536
1771
|
*/
|
|
1537
1772
|
config?: FunctionsAPI.EnrichConfig;
|
|
1538
1773
|
}
|
|
@@ -1542,6 +1777,12 @@ export declare namespace UpdateFunction {
|
|
|
1542
1777
|
* Display name of function. Human-readable name to help you identify the function.
|
|
1543
1778
|
*/
|
|
1544
1779
|
displayName?: string;
|
|
1780
|
+
/**
|
|
1781
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
1782
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
1783
|
+
* stays distinct from operator-level execution flags.
|
|
1784
|
+
*/
|
|
1785
|
+
extraConfig?: ParseFunction.ExtraConfig;
|
|
1545
1786
|
/**
|
|
1546
1787
|
* Name of function. Must be UNIQUE on a per-environment basis.
|
|
1547
1788
|
*/
|
|
@@ -1559,6 +1800,25 @@ export declare namespace UpdateFunction {
|
|
|
1559
1800
|
*/
|
|
1560
1801
|
tags?: Array<string>;
|
|
1561
1802
|
}
|
|
1803
|
+
namespace ParseFunction {
|
|
1804
|
+
/**
|
|
1805
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
1806
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
1807
|
+
* stays distinct from operator-level execution flags.
|
|
1808
|
+
*/
|
|
1809
|
+
interface ExtraConfig {
|
|
1810
|
+
/**
|
|
1811
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
1812
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
1813
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
1814
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
1815
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
1816
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
1817
|
+
* (no native bbox support). Defaults to false.
|
|
1818
|
+
*/
|
|
1819
|
+
enableBoundingBoxes?: boolean;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1562
1822
|
}
|
|
1563
1823
|
export interface UserActionSummary {
|
|
1564
1824
|
/**
|
|
@@ -2845,31 +3105,38 @@ export declare namespace FunctionCreateParams {
|
|
|
2845
3105
|
functionName: string;
|
|
2846
3106
|
type: 'enrich';
|
|
2847
3107
|
/**
|
|
2848
|
-
* Configuration for enrich function
|
|
3108
|
+
* Configuration for an enrich function.
|
|
2849
3109
|
*
|
|
2850
3110
|
* **How Enrich Functions Work:**
|
|
2851
3111
|
*
|
|
2852
|
-
* Enrich functions
|
|
2853
|
-
*
|
|
2854
|
-
*
|
|
2855
|
-
*
|
|
3112
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
3113
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
3114
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
3115
|
+
*
|
|
3116
|
+
* **Data Sources:**
|
|
3117
|
+
*
|
|
3118
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
3119
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
3120
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
3121
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
3122
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
3123
|
+
* endpoint.
|
|
2856
3124
|
*
|
|
2857
3125
|
* **Input Requirements:**
|
|
2858
3126
|
*
|
|
2859
|
-
* - Must receive JSON input (typically
|
|
2860
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
3127
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
2861
3128
|
*
|
|
2862
3129
|
* **Example Use Cases:**
|
|
2863
3130
|
*
|
|
2864
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
2865
|
-
* - Enrich customer data with account
|
|
2866
|
-
* -
|
|
3131
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
3132
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
3133
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
3134
|
+
* products
|
|
2867
3135
|
*
|
|
2868
3136
|
* **Configuration:**
|
|
2869
3137
|
*
|
|
2870
|
-
* - Define
|
|
2871
|
-
* -
|
|
2872
|
-
* - Steps are executed sequentially
|
|
3138
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
3139
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
2873
3140
|
*/
|
|
2874
3141
|
config?: EnrichConfig;
|
|
2875
3142
|
/**
|
|
@@ -2891,6 +3158,12 @@ export declare namespace FunctionCreateParams {
|
|
|
2891
3158
|
* Display name of function. Human-readable name to help you identify the function.
|
|
2892
3159
|
*/
|
|
2893
3160
|
displayName?: string;
|
|
3161
|
+
/**
|
|
3162
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
3163
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
3164
|
+
* stays distinct from operator-level execution flags.
|
|
3165
|
+
*/
|
|
3166
|
+
extraConfig?: CreateParseFunction.ExtraConfig;
|
|
2894
3167
|
/**
|
|
2895
3168
|
* Per-version configuration for a Parse function.
|
|
2896
3169
|
*
|
|
@@ -2904,6 +3177,25 @@ export declare namespace FunctionCreateParams {
|
|
|
2904
3177
|
*/
|
|
2905
3178
|
tags?: Array<string>;
|
|
2906
3179
|
}
|
|
3180
|
+
namespace CreateParseFunction {
|
|
3181
|
+
/**
|
|
3182
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
3183
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
3184
|
+
* stays distinct from operator-level execution flags.
|
|
3185
|
+
*/
|
|
3186
|
+
interface ExtraConfig {
|
|
3187
|
+
/**
|
|
3188
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
3189
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
3190
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
3191
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
3192
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
3193
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
3194
|
+
* (no native bbox support). Defaults to false.
|
|
3195
|
+
*/
|
|
3196
|
+
enableBoundingBoxes?: boolean;
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
2907
3199
|
}
|
|
2908
3200
|
export type FunctionUpdateParams = FunctionUpdateParams.UpsertExtractFunction | FunctionUpdateParams.UpsertClassifyFunction | FunctionUpdateParams.UpsertSendFunction | FunctionUpdateParams.UpsertSplitFunction | FunctionUpdateParams.UpsertJoinFunction | FunctionUpdateParams.UpsertPayloadShapingFunction | FunctionUpdateParams.UpsertEnrichFunction | FunctionUpdateParams.UpsertParseFunction;
|
|
2909
3201
|
export declare namespace FunctionUpdateParams {
|
|
@@ -3099,31 +3391,38 @@ export declare namespace FunctionUpdateParams {
|
|
|
3099
3391
|
interface UpsertEnrichFunction {
|
|
3100
3392
|
type: 'enrich';
|
|
3101
3393
|
/**
|
|
3102
|
-
* Configuration for enrich function
|
|
3394
|
+
* Configuration for an enrich function.
|
|
3103
3395
|
*
|
|
3104
3396
|
* **How Enrich Functions Work:**
|
|
3105
3397
|
*
|
|
3106
|
-
* Enrich functions
|
|
3107
|
-
*
|
|
3108
|
-
*
|
|
3109
|
-
*
|
|
3398
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
3399
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
3400
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
3401
|
+
*
|
|
3402
|
+
* **Data Sources:**
|
|
3403
|
+
*
|
|
3404
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
3405
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
3406
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
3407
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
3408
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
3409
|
+
* endpoint.
|
|
3110
3410
|
*
|
|
3111
3411
|
* **Input Requirements:**
|
|
3112
3412
|
*
|
|
3113
|
-
* - Must receive JSON input (typically
|
|
3114
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
3413
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
3115
3414
|
*
|
|
3116
3415
|
* **Example Use Cases:**
|
|
3117
3416
|
*
|
|
3118
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
3119
|
-
* - Enrich customer data with account
|
|
3120
|
-
* -
|
|
3417
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
3418
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
3419
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
3420
|
+
* products
|
|
3121
3421
|
*
|
|
3122
3422
|
* **Configuration:**
|
|
3123
3423
|
*
|
|
3124
|
-
* - Define
|
|
3125
|
-
* -
|
|
3126
|
-
* - Steps are executed sequentially
|
|
3424
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
3425
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
3127
3426
|
*/
|
|
3128
3427
|
config?: EnrichConfig;
|
|
3129
3428
|
}
|
|
@@ -3133,6 +3432,12 @@ export declare namespace FunctionUpdateParams {
|
|
|
3133
3432
|
* Display name of function. Human-readable name to help you identify the function.
|
|
3134
3433
|
*/
|
|
3135
3434
|
displayName?: string;
|
|
3435
|
+
/**
|
|
3436
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
3437
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
3438
|
+
* stays distinct from operator-level execution flags.
|
|
3439
|
+
*/
|
|
3440
|
+
extraConfig?: UpsertParseFunction.ExtraConfig;
|
|
3136
3441
|
/**
|
|
3137
3442
|
* Name of function. Must be UNIQUE on a per-environment basis.
|
|
3138
3443
|
*/
|
|
@@ -3150,6 +3455,25 @@ export declare namespace FunctionUpdateParams {
|
|
|
3150
3455
|
*/
|
|
3151
3456
|
tags?: Array<string>;
|
|
3152
3457
|
}
|
|
3458
|
+
namespace UpsertParseFunction {
|
|
3459
|
+
/**
|
|
3460
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
3461
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
3462
|
+
* stays distinct from operator-level execution flags.
|
|
3463
|
+
*/
|
|
3464
|
+
interface ExtraConfig {
|
|
3465
|
+
/**
|
|
3466
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
3467
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
3468
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
3469
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
3470
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
3471
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
3472
|
+
* (no native bbox support). Defaults to false.
|
|
3473
|
+
*/
|
|
3474
|
+
enableBoundingBoxes?: boolean;
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3153
3477
|
}
|
|
3154
3478
|
export interface FunctionListParams extends FunctionsPageParams {
|
|
3155
3479
|
displayName?: string;
|