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
|
@@ -593,31 +593,38 @@ export namespace CreateFunction {
|
|
|
593
593
|
type: 'enrich';
|
|
594
594
|
|
|
595
595
|
/**
|
|
596
|
-
* Configuration for enrich function
|
|
596
|
+
* Configuration for an enrich function.
|
|
597
597
|
*
|
|
598
598
|
* **How Enrich Functions Work:**
|
|
599
599
|
*
|
|
600
|
-
* Enrich functions
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
600
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
601
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
602
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
603
|
+
*
|
|
604
|
+
* **Data Sources:**
|
|
605
|
+
*
|
|
606
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
607
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
608
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
609
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
610
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
611
|
+
* endpoint.
|
|
604
612
|
*
|
|
605
613
|
* **Input Requirements:**
|
|
606
614
|
*
|
|
607
|
-
* - Must receive JSON input (typically
|
|
608
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
615
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
609
616
|
*
|
|
610
617
|
* **Example Use Cases:**
|
|
611
618
|
*
|
|
612
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
613
|
-
* - Enrich customer data with account
|
|
614
|
-
* -
|
|
619
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
620
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
621
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
622
|
+
* products
|
|
615
623
|
*
|
|
616
624
|
* **Configuration:**
|
|
617
625
|
*
|
|
618
|
-
* - Define
|
|
619
|
-
* -
|
|
620
|
-
* - Steps are executed sequentially
|
|
626
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
627
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
621
628
|
*/
|
|
622
629
|
config?: FunctionsAPI.EnrichConfig;
|
|
623
630
|
|
|
@@ -645,6 +652,13 @@ export namespace CreateFunction {
|
|
|
645
652
|
*/
|
|
646
653
|
displayName?: string;
|
|
647
654
|
|
|
655
|
+
/**
|
|
656
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
657
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
658
|
+
* stays distinct from operator-level execution flags.
|
|
659
|
+
*/
|
|
660
|
+
extraConfig?: ParseFunction.ExtraConfig;
|
|
661
|
+
|
|
648
662
|
/**
|
|
649
663
|
* Per-version configuration for a Parse function.
|
|
650
664
|
*
|
|
@@ -659,46 +673,225 @@ export namespace CreateFunction {
|
|
|
659
673
|
*/
|
|
660
674
|
tags?: Array<string>;
|
|
661
675
|
}
|
|
676
|
+
|
|
677
|
+
export namespace ParseFunction {
|
|
678
|
+
/**
|
|
679
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
680
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
681
|
+
* stays distinct from operator-level execution flags.
|
|
682
|
+
*/
|
|
683
|
+
export interface ExtraConfig {
|
|
684
|
+
/**
|
|
685
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
686
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
687
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
688
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
689
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
690
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
691
|
+
* (no native bbox support). Defaults to false.
|
|
692
|
+
*/
|
|
693
|
+
enableBoundingBoxes?: boolean;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
662
696
|
}
|
|
663
697
|
|
|
664
698
|
/**
|
|
665
|
-
* Configuration for enrich function
|
|
699
|
+
* Configuration for an enrich function.
|
|
666
700
|
*
|
|
667
701
|
* **How Enrich Functions Work:**
|
|
668
702
|
*
|
|
669
|
-
* Enrich functions
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
703
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
704
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
705
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
706
|
+
*
|
|
707
|
+
* **Data Sources:**
|
|
708
|
+
*
|
|
709
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
710
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
711
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
712
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
713
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
714
|
+
* endpoint.
|
|
673
715
|
*
|
|
674
716
|
* **Input Requirements:**
|
|
675
717
|
*
|
|
676
|
-
* - Must receive JSON input (typically
|
|
677
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
718
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
678
719
|
*
|
|
679
720
|
* **Example Use Cases:**
|
|
680
721
|
*
|
|
681
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
682
|
-
* - Enrich customer data with account
|
|
683
|
-
* -
|
|
722
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
723
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
724
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
725
|
+
* products
|
|
684
726
|
*
|
|
685
727
|
* **Configuration:**
|
|
686
728
|
*
|
|
687
|
-
* - Define
|
|
688
|
-
* -
|
|
689
|
-
* - Steps are executed sequentially
|
|
729
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
730
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
690
731
|
*/
|
|
691
732
|
export interface EnrichConfig {
|
|
692
733
|
/**
|
|
693
|
-
* Array of enrichment steps to execute sequentially
|
|
734
|
+
* Array of enrichment steps to execute sequentially.
|
|
694
735
|
*/
|
|
695
736
|
steps: Array<EnrichStep>;
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Named HTTP endpoints available to endpoint-source steps. Each endpoint must have
|
|
740
|
+
* a unique `name` referenced by the step's `endpointName`. Required when any step
|
|
741
|
+
* uses `source: "endpoint"`.
|
|
742
|
+
*/
|
|
743
|
+
endpoints?: Array<EnrichConfig.Endpoint>;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export namespace EnrichConfig {
|
|
747
|
+
/**
|
|
748
|
+
* A named HTTP endpoint that an enrich step can call to fetch enrichment data.
|
|
749
|
+
*
|
|
750
|
+
* The platform makes one request per extracted source value, substituting the
|
|
751
|
+
* value as a query parameter or body template placeholder. The raw response (or
|
|
752
|
+
* the sub-value selected by `responsePath`) is injected into the output, or passed
|
|
753
|
+
* to LLM agent reasoning when `matchInstructions` is set.
|
|
754
|
+
*
|
|
755
|
+
* **Request formats:**
|
|
756
|
+
*
|
|
757
|
+
* - `GET`: Appends `?{queryParam}={value}` to the URL.
|
|
758
|
+
* - `POST`: Sends `bodyTemplate` as the request body, replacing `{value}` with the
|
|
759
|
+
* extracted value.
|
|
760
|
+
*/
|
|
761
|
+
export interface Endpoint {
|
|
762
|
+
/**
|
|
763
|
+
* HTTP method to use.
|
|
764
|
+
*/
|
|
765
|
+
method: 'GET' | 'POST';
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Unique name for this endpoint, referenced by enrichStep.endpointName.
|
|
769
|
+
*/
|
|
770
|
+
name: string;
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Full URL of the endpoint (must be http:// or https://).
|
|
774
|
+
*/
|
|
775
|
+
url: string;
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* JSON body template for POST requests. **Required for POST endpoints.** Must
|
|
779
|
+
* contain the `{value}` placeholder, which is replaced with the extracted source
|
|
780
|
+
* value at runtime.
|
|
781
|
+
*
|
|
782
|
+
* Example: `bodyTemplate: "{\"query\": \"{value}\", \"limit\": 10}"`
|
|
783
|
+
*/
|
|
784
|
+
bodyTemplate?: string;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Additional HTTP headers to include in every request (e.g.
|
|
788
|
+
* `Authorization: Bearer <token>`).
|
|
789
|
+
*/
|
|
790
|
+
headers?: unknown;
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Natural-language instructions for LLM agent reasoning.
|
|
794
|
+
*
|
|
795
|
+
* When set, the candidates fetched from the endpoint are passed to an LLM with
|
|
796
|
+
* these instructions, which selects the best match(es) and returns them with
|
|
797
|
+
* confidence scores. Each injected result has the shape
|
|
798
|
+
* `{ data, confidence, reasoning? }`.
|
|
799
|
+
*
|
|
800
|
+
* When omitted, the raw fetched value is injected without any LLM involvement.
|
|
801
|
+
*/
|
|
802
|
+
matchInstructions?: string;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Maximum number of ranked matches to return per source value when
|
|
806
|
+
* `matchInstructions` is set (default: 1). Ignored when `matchInstructions` is
|
|
807
|
+
* empty.
|
|
808
|
+
*/
|
|
809
|
+
matchTopK?: number;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* LLM batch size during agent reasoning (default: 50). All candidates — across all
|
|
813
|
+
* fetched pages — are scored in batches of this size. Smaller values reduce
|
|
814
|
+
* per-call token usage; larger values mean fewer LLM calls. Ignored when
|
|
815
|
+
* `matchInstructions` is empty.
|
|
816
|
+
*/
|
|
817
|
+
maxCandidates?: number;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Maximum number of pages to fetch (default: 10). Acts as a safety cap against
|
|
821
|
+
* infinite pagination loops when the server never returns an empty cursor.
|
|
822
|
+
*/
|
|
823
|
+
maxPages?: number;
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Query parameter name used to pass the cursor on subsequent GET requests, or the
|
|
827
|
+
* `{placeholder}` name used in the POST `bodyTemplate` (e.g. `"cursor"`,
|
|
828
|
+
* `"pageToken"`, `"offset"`).
|
|
829
|
+
*
|
|
830
|
+
* Must be set together with `nextPagePath`.
|
|
831
|
+
*/
|
|
832
|
+
nextPageParam?: string;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* JMESPath expression applied to each raw response to extract the cursor or token
|
|
836
|
+
* for the next page (e.g. `"nextCursor"`, `"pagination.nextToken"`). An absent,
|
|
837
|
+
* null, or empty-string result stops pagination. Both string and numeric values
|
|
838
|
+
* are supported — numbers are converted to their decimal string representation
|
|
839
|
+
* before being forwarded as a query parameter.
|
|
840
|
+
*
|
|
841
|
+
* Must be set together with `nextPageParam`.
|
|
842
|
+
*
|
|
843
|
+
* **Supported pagination styles:**
|
|
844
|
+
*
|
|
845
|
+
* - **Cursor/token-based** — server returns an opaque token in the response body
|
|
846
|
+
* (e.g. `{"nextCursor": "abc123"}`). Set `nextPagePath: "nextCursor"` and the
|
|
847
|
+
* platform forwards it verbatim on the next request.
|
|
848
|
+
* - **Server-computed offset/page** — server echoes back the next offset or page
|
|
849
|
+
* number in the response body (e.g. `{"nextOffset": 50}` or `{"nextPage": 2}`).
|
|
850
|
+
* Set `nextPagePath: "nextOffset"` and the platform forwards the value as-is.
|
|
851
|
+
*
|
|
852
|
+
* **Not supported:**
|
|
853
|
+
*
|
|
854
|
+
* - **Client-computed offset** — APIs where the client must compute
|
|
855
|
+
* `offset += limit` itself (e.g. `?offset=0&limit=50` with no next-offset in the
|
|
856
|
+
* response). Workaround: ask the API provider to return the next offset in the
|
|
857
|
+
* response body, or bake a fixed page size into the URL and use a server-side
|
|
858
|
+
* cursor instead.
|
|
859
|
+
* - **Client-computed page number** — APIs where the client increments `?page=N`
|
|
860
|
+
* itself with no next-page value in the response. Same workaround applies.
|
|
861
|
+
* - **Link header** — `Link: <url>; rel="next"` in HTTP response headers. The
|
|
862
|
+
* platform only inspects the response body.
|
|
863
|
+
*/
|
|
864
|
+
nextPagePath?: string;
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Query parameter name used to pass the extracted source value. **Required for GET
|
|
868
|
+
* endpoints.** The value is URL-encoded and appended as
|
|
869
|
+
* `?{queryParam}={sourceValue}`.
|
|
870
|
+
*
|
|
871
|
+
* Example: `queryParam: "q"` → `GET /products?q=blue+widget`
|
|
872
|
+
*/
|
|
873
|
+
queryParam?: string;
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* JMESPath expression applied to the response body to extract the enrichment
|
|
877
|
+
* value. Omit to use the entire response body as the result.
|
|
878
|
+
*
|
|
879
|
+
* **For agent reasoning:** use a wildcard projection (e.g. `items[*]` or
|
|
880
|
+
* `results[*].data`) so the endpoint's list of candidates is flattened into an
|
|
881
|
+
* array before being passed to the LLM. A non-wildcard path (e.g. `data.product`)
|
|
882
|
+
* extracts a single value treated as one candidate.
|
|
883
|
+
*
|
|
884
|
+
* **Response size:** the platform reads at most 50 MB of the response body before
|
|
885
|
+
* decoding, regardless of the Content-Length header.
|
|
886
|
+
*/
|
|
887
|
+
responsePath?: string;
|
|
888
|
+
}
|
|
696
889
|
}
|
|
697
890
|
|
|
698
891
|
/**
|
|
699
892
|
* Single enrichment step configuration.
|
|
700
893
|
*
|
|
701
|
-
* **Process Flow:**
|
|
894
|
+
* **Process Flow (collection source):**
|
|
702
895
|
*
|
|
703
896
|
* 1. Extract values from `sourceField` using JMESPath
|
|
704
897
|
* 2. Perform search against the specified collection (semantic, exact, or hybrid
|
|
@@ -706,33 +899,41 @@ export interface EnrichConfig {
|
|
|
706
899
|
* 3. Return top K matches sorted by relevance (best match first)
|
|
707
900
|
* 4. Inject results into `targetField`
|
|
708
901
|
*
|
|
709
|
-
* **
|
|
902
|
+
* **Process Flow (endpoint source):**
|
|
710
903
|
*
|
|
711
|
-
*
|
|
904
|
+
* 1. Extract values from `sourceField` using JMESPath
|
|
905
|
+
* 2. Call the named endpoint once per extracted value, following pagination if
|
|
906
|
+
* `nextPagePath`/`nextPageParam` are configured on the endpoint
|
|
907
|
+
* 3. Optionally apply LLM agent reasoning to rank candidates
|
|
908
|
+
* (`matchInstructions`), batching across all fetched pages in groups of
|
|
909
|
+
* `maxCandidates`
|
|
910
|
+
* 4. Inject results into `targetField`
|
|
911
|
+
*
|
|
912
|
+
* **Collection Search Modes** (`source: "collection"` only):
|
|
913
|
+
*
|
|
914
|
+
* - `semantic` (default): Vector similarity search — best for natural language and
|
|
712
915
|
* conceptual matching
|
|
713
|
-
* - `exact`: Exact keyword matching
|
|
714
|
-
* - `hybrid`: Combined semantic + keyword search
|
|
916
|
+
* - `exact`: Exact keyword matching — best for SKU numbers, IDs, routing numbers
|
|
917
|
+
* - `hybrid`: Combined semantic + keyword search — best for tags and categories
|
|
918
|
+
*
|
|
919
|
+
* **Result Format (collection source):**
|
|
715
920
|
*
|
|
716
|
-
*
|
|
921
|
+
* - Always an array sorted by relevance (best match first)
|
|
922
|
+
* - Each element: `{ data, cosineDistance? }` or `{ data, hybridScore? }`
|
|
717
923
|
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
* -
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
* -
|
|
924
|
+
* **Result Format (endpoint source, no matchInstructions):**
|
|
925
|
+
*
|
|
926
|
+
* - Always an array; the raw fetched value is the single element
|
|
927
|
+
*
|
|
928
|
+
* **Result Format (endpoint source, with matchInstructions):**
|
|
929
|
+
*
|
|
930
|
+
* - Array of LLM-ranked matches: `[{ data, confidence, reasoning? }, ...]`
|
|
931
|
+
* - Length capped by `enrichEndpoint.matchTopK` (default 1)
|
|
725
932
|
*/
|
|
726
933
|
export interface EnrichStep {
|
|
727
934
|
/**
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
*/
|
|
731
|
-
collectionName: string;
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* JMESPath expression to extract source data for semantic search. Can extract
|
|
735
|
-
* single values or arrays. All extracted values will be used for search.
|
|
935
|
+
* JMESPath expression to extract source data. Can extract a single value or an
|
|
936
|
+
* array. Each extracted value is looked up independently.
|
|
736
937
|
*/
|
|
737
938
|
sourceField: string;
|
|
738
939
|
|
|
@@ -743,6 +944,19 @@ export interface EnrichStep {
|
|
|
743
944
|
*/
|
|
744
945
|
targetField: string;
|
|
745
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Name of the collection to search against. Required when `source` is
|
|
949
|
+
* `"collection"`. The collection must exist and contain items. Supports
|
|
950
|
+
* hierarchical paths when used with `includeSubcollections`.
|
|
951
|
+
*/
|
|
952
|
+
collectionName?: string;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Name of an endpoint defined in `enrichConfig.endpoints`. Required when `source`
|
|
956
|
+
* is `"endpoint"`.
|
|
957
|
+
*/
|
|
958
|
+
endpointName?: string;
|
|
959
|
+
|
|
746
960
|
/**
|
|
747
961
|
* Whether to include cosine distance scores in results. Cosine distance ranges
|
|
748
962
|
* from 0.0 (perfect match) to 2.0 (completely dissimilar). Lower scores indicate
|
|
@@ -801,6 +1015,16 @@ export interface EnrichStep {
|
|
|
801
1015
|
*/
|
|
802
1016
|
searchMode?: 'semantic' | 'exact' | 'hybrid';
|
|
803
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Where to fetch enrichment data from (default: `"collection"`).
|
|
1020
|
+
*
|
|
1021
|
+
* - `"collection"`: Vector/keyword search against a BEM collection. Requires
|
|
1022
|
+
* `collectionName`.
|
|
1023
|
+
* - `"endpoint"`: HTTP call to a named endpoint defined in
|
|
1024
|
+
* `enrichConfig.endpoints`. Requires `endpointName`.
|
|
1025
|
+
*/
|
|
1026
|
+
source?: 'collection' | 'endpoint';
|
|
1027
|
+
|
|
804
1028
|
/**
|
|
805
1029
|
* Number of top matching results to return per query (default: 1). Results are
|
|
806
1030
|
* always returned as an array (list) and automatically sorted by cosine distance
|
|
@@ -1338,31 +1562,38 @@ export namespace Function {
|
|
|
1338
1562
|
|
|
1339
1563
|
export interface EnrichFunction {
|
|
1340
1564
|
/**
|
|
1341
|
-
* Configuration for enrich function
|
|
1565
|
+
* Configuration for an enrich function.
|
|
1342
1566
|
*
|
|
1343
1567
|
* **How Enrich Functions Work:**
|
|
1344
1568
|
*
|
|
1345
|
-
* Enrich functions
|
|
1346
|
-
*
|
|
1347
|
-
*
|
|
1348
|
-
*
|
|
1569
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
1570
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
1571
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
1572
|
+
*
|
|
1573
|
+
* **Data Sources:**
|
|
1574
|
+
*
|
|
1575
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
1576
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
1577
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
1578
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
1579
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
1580
|
+
* endpoint.
|
|
1349
1581
|
*
|
|
1350
1582
|
* **Input Requirements:**
|
|
1351
1583
|
*
|
|
1352
|
-
* - Must receive JSON input (typically
|
|
1353
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
1584
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
1354
1585
|
*
|
|
1355
1586
|
* **Example Use Cases:**
|
|
1356
1587
|
*
|
|
1357
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
1358
|
-
* - Enrich customer data with account
|
|
1359
|
-
* -
|
|
1588
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
1589
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
1590
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
1591
|
+
* products
|
|
1360
1592
|
*
|
|
1361
1593
|
* **Configuration:**
|
|
1362
1594
|
*
|
|
1363
|
-
* - Define
|
|
1364
|
-
* -
|
|
1365
|
-
* - Steps are executed sequentially
|
|
1595
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
1596
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
1366
1597
|
*/
|
|
1367
1598
|
config: FunctionsAPI.EnrichConfig;
|
|
1368
1599
|
|
|
@@ -1432,6 +1663,13 @@ export namespace Function {
|
|
|
1432
1663
|
*/
|
|
1433
1664
|
displayName?: string;
|
|
1434
1665
|
|
|
1666
|
+
/**
|
|
1667
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
1668
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
1669
|
+
* stays distinct from operator-level execution flags.
|
|
1670
|
+
*/
|
|
1671
|
+
extraConfig?: ParseFunction.ExtraConfig;
|
|
1672
|
+
|
|
1435
1673
|
/**
|
|
1436
1674
|
* Per-version configuration for a Parse function.
|
|
1437
1675
|
*
|
|
@@ -1451,6 +1689,26 @@ export namespace Function {
|
|
|
1451
1689
|
*/
|
|
1452
1690
|
usedInWorkflows?: Array<FunctionsAPI.WorkflowUsageInfo>;
|
|
1453
1691
|
}
|
|
1692
|
+
|
|
1693
|
+
export namespace ParseFunction {
|
|
1694
|
+
/**
|
|
1695
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
1696
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
1697
|
+
* stays distinct from operator-level execution flags.
|
|
1698
|
+
*/
|
|
1699
|
+
export interface ExtraConfig {
|
|
1700
|
+
/**
|
|
1701
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
1702
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
1703
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
1704
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
1705
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
1706
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
1707
|
+
* (no native bbox support). Defaults to false.
|
|
1708
|
+
*/
|
|
1709
|
+
enableBoundingBoxes?: boolean;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1454
1712
|
}
|
|
1455
1713
|
|
|
1456
1714
|
export interface FunctionAudit {
|
|
@@ -1517,17 +1775,6 @@ export interface ListFunctionsResponse {
|
|
|
1517
1775
|
* output concern) and cross-document memory linking (an environment-wide concern).
|
|
1518
1776
|
*/
|
|
1519
1777
|
export interface ParseConfig {
|
|
1520
|
-
/**
|
|
1521
|
-
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
1522
|
-
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
1523
|
-
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
1524
|
-
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
1525
|
-
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
1526
|
-
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
1527
|
-
* (no native bbox support). Defaults to false.
|
|
1528
|
-
*/
|
|
1529
|
-
enableBoundingBoxes?: boolean;
|
|
1530
|
-
|
|
1531
1778
|
/**
|
|
1532
1779
|
* When true, extract named entities (people, organizations, products, studies,
|
|
1533
1780
|
* identifiers, etc.) and the relationships between them, and dedupe by canonical
|
|
@@ -1865,31 +2112,38 @@ export namespace UpdateFunction {
|
|
|
1865
2112
|
type: 'enrich';
|
|
1866
2113
|
|
|
1867
2114
|
/**
|
|
1868
|
-
* Configuration for enrich function
|
|
2115
|
+
* Configuration for an enrich function.
|
|
1869
2116
|
*
|
|
1870
2117
|
* **How Enrich Functions Work:**
|
|
1871
2118
|
*
|
|
1872
|
-
* Enrich functions
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
2119
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
2120
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
2121
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
2122
|
+
*
|
|
2123
|
+
* **Data Sources:**
|
|
2124
|
+
*
|
|
2125
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
2126
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
2127
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
2128
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
2129
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
2130
|
+
* endpoint.
|
|
1876
2131
|
*
|
|
1877
2132
|
* **Input Requirements:**
|
|
1878
2133
|
*
|
|
1879
|
-
* - Must receive JSON input (typically
|
|
1880
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
2134
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
1881
2135
|
*
|
|
1882
2136
|
* **Example Use Cases:**
|
|
1883
2137
|
*
|
|
1884
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
1885
|
-
* - Enrich customer data with account
|
|
1886
|
-
* -
|
|
2138
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
2139
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
2140
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
2141
|
+
* products
|
|
1887
2142
|
*
|
|
1888
2143
|
* **Configuration:**
|
|
1889
2144
|
*
|
|
1890
|
-
* - Define
|
|
1891
|
-
* -
|
|
1892
|
-
* - Steps are executed sequentially
|
|
2145
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
2146
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
1893
2147
|
*/
|
|
1894
2148
|
config?: FunctionsAPI.EnrichConfig;
|
|
1895
2149
|
}
|
|
@@ -1902,6 +2156,13 @@ export namespace UpdateFunction {
|
|
|
1902
2156
|
*/
|
|
1903
2157
|
displayName?: string;
|
|
1904
2158
|
|
|
2159
|
+
/**
|
|
2160
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
2161
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
2162
|
+
* stays distinct from operator-level execution flags.
|
|
2163
|
+
*/
|
|
2164
|
+
extraConfig?: ParseFunction.ExtraConfig;
|
|
2165
|
+
|
|
1905
2166
|
/**
|
|
1906
2167
|
* Name of function. Must be UNIQUE on a per-environment basis.
|
|
1907
2168
|
*/
|
|
@@ -1921,6 +2182,26 @@ export namespace UpdateFunction {
|
|
|
1921
2182
|
*/
|
|
1922
2183
|
tags?: Array<string>;
|
|
1923
2184
|
}
|
|
2185
|
+
|
|
2186
|
+
export namespace ParseFunction {
|
|
2187
|
+
/**
|
|
2188
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
2189
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
2190
|
+
* stays distinct from operator-level execution flags.
|
|
2191
|
+
*/
|
|
2192
|
+
export interface ExtraConfig {
|
|
2193
|
+
/**
|
|
2194
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
2195
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
2196
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
2197
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
2198
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
2199
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
2200
|
+
* (no native bbox support). Defaults to false.
|
|
2201
|
+
*/
|
|
2202
|
+
enableBoundingBoxes?: boolean;
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
1924
2205
|
}
|
|
1925
2206
|
|
|
1926
2207
|
export interface UserActionSummary {
|
|
@@ -3459,31 +3740,38 @@ export declare namespace FunctionCreateParams {
|
|
|
3459
3740
|
type: 'enrich';
|
|
3460
3741
|
|
|
3461
3742
|
/**
|
|
3462
|
-
* Configuration for enrich function
|
|
3743
|
+
* Configuration for an enrich function.
|
|
3463
3744
|
*
|
|
3464
3745
|
* **How Enrich Functions Work:**
|
|
3465
3746
|
*
|
|
3466
|
-
* Enrich functions
|
|
3467
|
-
*
|
|
3468
|
-
*
|
|
3469
|
-
*
|
|
3747
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
3748
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
3749
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
3750
|
+
*
|
|
3751
|
+
* **Data Sources:**
|
|
3752
|
+
*
|
|
3753
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
3754
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
3755
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
3756
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
3757
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
3758
|
+
* endpoint.
|
|
3470
3759
|
*
|
|
3471
3760
|
* **Input Requirements:**
|
|
3472
3761
|
*
|
|
3473
|
-
* - Must receive JSON input (typically
|
|
3474
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
3762
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
3475
3763
|
*
|
|
3476
3764
|
* **Example Use Cases:**
|
|
3477
3765
|
*
|
|
3478
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
3479
|
-
* - Enrich customer data with account
|
|
3480
|
-
* -
|
|
3766
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
3767
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
3768
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
3769
|
+
* products
|
|
3481
3770
|
*
|
|
3482
3771
|
* **Configuration:**
|
|
3483
3772
|
*
|
|
3484
|
-
* - Define
|
|
3485
|
-
* -
|
|
3486
|
-
* - Steps are executed sequentially
|
|
3773
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
3774
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
3487
3775
|
*/
|
|
3488
3776
|
config?: EnrichConfig;
|
|
3489
3777
|
|
|
@@ -3511,6 +3799,13 @@ export declare namespace FunctionCreateParams {
|
|
|
3511
3799
|
*/
|
|
3512
3800
|
displayName?: string;
|
|
3513
3801
|
|
|
3802
|
+
/**
|
|
3803
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
3804
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
3805
|
+
* stays distinct from operator-level execution flags.
|
|
3806
|
+
*/
|
|
3807
|
+
extraConfig?: CreateParseFunction.ExtraConfig;
|
|
3808
|
+
|
|
3514
3809
|
/**
|
|
3515
3810
|
* Per-version configuration for a Parse function.
|
|
3516
3811
|
*
|
|
@@ -3525,6 +3820,26 @@ export declare namespace FunctionCreateParams {
|
|
|
3525
3820
|
*/
|
|
3526
3821
|
tags?: Array<string>;
|
|
3527
3822
|
}
|
|
3823
|
+
|
|
3824
|
+
export namespace CreateParseFunction {
|
|
3825
|
+
/**
|
|
3826
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
3827
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
3828
|
+
* stays distinct from operator-level execution flags.
|
|
3829
|
+
*/
|
|
3830
|
+
export interface ExtraConfig {
|
|
3831
|
+
/**
|
|
3832
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
3833
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
3834
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
3835
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
3836
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
3837
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
3838
|
+
* (no native bbox support). Defaults to false.
|
|
3839
|
+
*/
|
|
3840
|
+
enableBoundingBoxes?: boolean;
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3528
3843
|
}
|
|
3529
3844
|
|
|
3530
3845
|
export type FunctionUpdateParams =
|
|
@@ -3779,31 +4094,38 @@ export declare namespace FunctionUpdateParams {
|
|
|
3779
4094
|
type: 'enrich';
|
|
3780
4095
|
|
|
3781
4096
|
/**
|
|
3782
|
-
* Configuration for enrich function
|
|
4097
|
+
* Configuration for an enrich function.
|
|
3783
4098
|
*
|
|
3784
4099
|
* **How Enrich Functions Work:**
|
|
3785
4100
|
*
|
|
3786
|
-
* Enrich functions
|
|
3787
|
-
*
|
|
3788
|
-
*
|
|
3789
|
-
*
|
|
4101
|
+
* Enrich functions augment JSON input with data from external sources. They take
|
|
4102
|
+
* JSON input (typically from a previous function), extract specified fields, fetch
|
|
4103
|
+
* or search for matching data, and inject the results back into the JSON.
|
|
4104
|
+
*
|
|
4105
|
+
* **Data Sources:**
|
|
4106
|
+
*
|
|
4107
|
+
* - **Collections** (`source: "collection"`): Vector/keyword search against a BEM
|
|
4108
|
+
* collection. Best for semantic matching against pre-indexed documents.
|
|
4109
|
+
* - **Endpoints** (`source: "endpoint"`): HTTP call to any user-provided REST API.
|
|
4110
|
+
* Best for looking up live data from CRMs, ERPs, or other external systems.
|
|
4111
|
+
* Optionally uses LLM agent reasoning to rank candidates returned by the
|
|
4112
|
+
* endpoint.
|
|
3790
4113
|
*
|
|
3791
4114
|
* **Input Requirements:**
|
|
3792
4115
|
*
|
|
3793
|
-
* - Must receive JSON input (typically
|
|
3794
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
4116
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
3795
4117
|
*
|
|
3796
4118
|
* **Example Use Cases:**
|
|
3797
4119
|
*
|
|
3798
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
3799
|
-
* - Enrich customer data with account
|
|
3800
|
-
* -
|
|
4120
|
+
* - Match product descriptions to SKU codes from a product catalog collection
|
|
4121
|
+
* - Enrich customer data with account details from a CRM endpoint
|
|
4122
|
+
* - Use LLM agent reasoning to fuzzy-match line item descriptions to catalog
|
|
4123
|
+
* products
|
|
3801
4124
|
*
|
|
3802
4125
|
* **Configuration:**
|
|
3803
4126
|
*
|
|
3804
|
-
* - Define
|
|
3805
|
-
* -
|
|
3806
|
-
* - Steps are executed sequentially
|
|
4127
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
4128
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
3807
4129
|
*/
|
|
3808
4130
|
config?: EnrichConfig;
|
|
3809
4131
|
}
|
|
@@ -3816,6 +4138,13 @@ export declare namespace FunctionUpdateParams {
|
|
|
3816
4138
|
*/
|
|
3817
4139
|
displayName?: string;
|
|
3818
4140
|
|
|
4141
|
+
/**
|
|
4142
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
4143
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
4144
|
+
* stays distinct from operator-level execution flags.
|
|
4145
|
+
*/
|
|
4146
|
+
extraConfig?: UpsertParseFunction.ExtraConfig;
|
|
4147
|
+
|
|
3819
4148
|
/**
|
|
3820
4149
|
* Name of function. Must be UNIQUE on a per-environment basis.
|
|
3821
4150
|
*/
|
|
@@ -3835,6 +4164,26 @@ export declare namespace FunctionUpdateParams {
|
|
|
3835
4164
|
*/
|
|
3836
4165
|
tags?: Array<string>;
|
|
3837
4166
|
}
|
|
4167
|
+
|
|
4168
|
+
export namespace UpsertParseFunction {
|
|
4169
|
+
/**
|
|
4170
|
+
* Cross-cutting toggles for Parse functions. Mirrors the `extraConfig` surface on
|
|
4171
|
+
* Extract / Join — separated from `parseConfig` so the per-call Parse output shape
|
|
4172
|
+
* stays distinct from operator-level execution flags.
|
|
4173
|
+
*/
|
|
4174
|
+
export interface ExtraConfig {
|
|
4175
|
+
/**
|
|
4176
|
+
* When true, return per-section and per-entity-mention coordinates in the parse
|
|
4177
|
+
* event's `fieldBoundingBoxes` map (same shape as Extract: JSON Pointer key →
|
|
4178
|
+
* array of `{page, left, top, width, height}` with coordinates normalized to [0,
|
|
4179
|
+
* 1]). Keys are `/sections/{N}` and `/entities/{N}/occurrences/{M}` into the parse
|
|
4180
|
+
* output. Only applies to the open-ended discovery path (no `schema`) and to
|
|
4181
|
+
* vision input types. Bedrock-backed parse functions silently return an empty map
|
|
4182
|
+
* (no native bbox support). Defaults to false.
|
|
4183
|
+
*/
|
|
4184
|
+
enableBoundingBoxes?: boolean;
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
3838
4187
|
}
|
|
3839
4188
|
|
|
3840
4189
|
export interface FunctionListParams extends FunctionsPageParams {
|