bem-ai-sdk 0.25.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 +8 -0
- package/package.json +1 -1
- package/resources/functions/functions.d.mts +308 -99
- package/resources/functions/functions.d.mts.map +1 -1
- package/resources/functions/functions.d.ts +308 -99
- 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 +20 -13
- package/resources/functions/versions.d.mts.map +1 -1
- package/resources/functions/versions.d.ts +20 -13
- package/resources/functions/versions.d.ts.map +1 -1
- package/src/resources/functions/functions.ts +325 -100
- package/src/resources/functions/versions.ts +20 -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
|
/**
|
|
@@ -548,42 +555,187 @@ export declare namespace CreateFunction {
|
|
|
548
555
|
}
|
|
549
556
|
}
|
|
550
557
|
/**
|
|
551
|
-
* Configuration for enrich function
|
|
558
|
+
* Configuration for an enrich function.
|
|
552
559
|
*
|
|
553
560
|
* **How Enrich Functions Work:**
|
|
554
561
|
*
|
|
555
|
-
* Enrich functions
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
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.
|
|
559
574
|
*
|
|
560
575
|
* **Input Requirements:**
|
|
561
576
|
*
|
|
562
|
-
* - Must receive JSON input (typically
|
|
563
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
577
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
564
578
|
*
|
|
565
579
|
* **Example Use Cases:**
|
|
566
580
|
*
|
|
567
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
568
|
-
* - Enrich customer data with account
|
|
569
|
-
* -
|
|
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
|
|
570
585
|
*
|
|
571
586
|
* **Configuration:**
|
|
572
587
|
*
|
|
573
|
-
* - Define
|
|
574
|
-
* -
|
|
575
|
-
* - Steps are executed sequentially
|
|
588
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
589
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
576
590
|
*/
|
|
577
591
|
export interface EnrichConfig {
|
|
578
592
|
/**
|
|
579
|
-
* Array of enrichment steps to execute sequentially
|
|
593
|
+
* Array of enrichment steps to execute sequentially.
|
|
580
594
|
*/
|
|
581
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
|
+
}
|
|
582
734
|
}
|
|
583
735
|
/**
|
|
584
736
|
* Single enrichment step configuration.
|
|
585
737
|
*
|
|
586
|
-
* **Process Flow:**
|
|
738
|
+
* **Process Flow (collection source):**
|
|
587
739
|
*
|
|
588
740
|
* 1. Extract values from `sourceField` using JMESPath
|
|
589
741
|
* 2. Perform search against the specified collection (semantic, exact, or hybrid
|
|
@@ -591,32 +743,41 @@ export interface EnrichConfig {
|
|
|
591
743
|
* 3. Return top K matches sorted by relevance (best match first)
|
|
592
744
|
* 4. Inject results into `targetField`
|
|
593
745
|
*
|
|
594
|
-
* **
|
|
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`
|
|
595
755
|
*
|
|
596
|
-
*
|
|
756
|
+
* **Collection Search Modes** (`source: "collection"` only):
|
|
757
|
+
*
|
|
758
|
+
* - `semantic` (default): Vector similarity search — best for natural language and
|
|
597
759
|
* conceptual matching
|
|
598
|
-
* - `exact`: Exact keyword matching
|
|
599
|
-
* - `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):**
|
|
764
|
+
*
|
|
765
|
+
* - Always an array sorted by relevance (best match first)
|
|
766
|
+
* - Each element: `{ data, cosineDistance? }` or `{ data, hybridScore? }`
|
|
767
|
+
*
|
|
768
|
+
* **Result Format (endpoint source, no matchInstructions):**
|
|
600
769
|
*
|
|
601
|
-
*
|
|
770
|
+
* - Always an array; the raw fetched value is the single element
|
|
602
771
|
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
* -
|
|
606
|
-
*
|
|
607
|
-
* - With `topK=1`: Returns array with single best match:
|
|
608
|
-
* `[{data: {...}, cosineDistance: 0.15}]`
|
|
609
|
-
* - With `topK>1`: Returns array with multiple matches sorted by relevance
|
|
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)
|
|
610
776
|
*/
|
|
611
777
|
export interface EnrichStep {
|
|
612
778
|
/**
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*/
|
|
616
|
-
collectionName: string;
|
|
617
|
-
/**
|
|
618
|
-
* JMESPath expression to extract source data for semantic search. Can extract
|
|
619
|
-
* 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.
|
|
620
781
|
*/
|
|
621
782
|
sourceField: string;
|
|
622
783
|
/**
|
|
@@ -625,6 +786,17 @@ export interface EnrichStep {
|
|
|
625
786
|
* regardless of topK value.
|
|
626
787
|
*/
|
|
627
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;
|
|
628
800
|
/**
|
|
629
801
|
* Whether to include cosine distance scores in results. Cosine distance ranges
|
|
630
802
|
* from 0.0 (perfect match) to 2.0 (completely dissimilar). Lower scores indicate
|
|
@@ -679,6 +851,15 @@ export interface EnrichStep {
|
|
|
679
851
|
* - Example: Balances semantic meaning with exact keyword matching
|
|
680
852
|
*/
|
|
681
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';
|
|
682
863
|
/**
|
|
683
864
|
* Number of top matching results to return per query (default: 1). Results are
|
|
684
865
|
* always returned as an array (list) and automatically sorted by cosine distance
|
|
@@ -1109,31 +1290,38 @@ export declare namespace Function {
|
|
|
1109
1290
|
}
|
|
1110
1291
|
interface EnrichFunction {
|
|
1111
1292
|
/**
|
|
1112
|
-
* Configuration for enrich function
|
|
1293
|
+
* Configuration for an enrich function.
|
|
1113
1294
|
*
|
|
1114
1295
|
* **How Enrich Functions Work:**
|
|
1115
1296
|
*
|
|
1116
|
-
* Enrich functions
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
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.
|
|
1120
1309
|
*
|
|
1121
1310
|
* **Input Requirements:**
|
|
1122
1311
|
*
|
|
1123
|
-
* - Must receive JSON input (typically
|
|
1124
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
1312
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
1125
1313
|
*
|
|
1126
1314
|
* **Example Use Cases:**
|
|
1127
1315
|
*
|
|
1128
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
1129
|
-
* - Enrich customer data with account
|
|
1130
|
-
* -
|
|
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
|
|
1131
1320
|
*
|
|
1132
1321
|
* **Configuration:**
|
|
1133
1322
|
*
|
|
1134
|
-
* - Define
|
|
1135
|
-
* -
|
|
1136
|
-
* - Steps are executed sequentially
|
|
1323
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
1324
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
1137
1325
|
*/
|
|
1138
1326
|
config: FunctionsAPI.EnrichConfig;
|
|
1139
1327
|
/**
|
|
@@ -1548,31 +1736,38 @@ export declare namespace UpdateFunction {
|
|
|
1548
1736
|
interface UpsertEnrichFunction {
|
|
1549
1737
|
type: 'enrich';
|
|
1550
1738
|
/**
|
|
1551
|
-
* Configuration for enrich function
|
|
1739
|
+
* Configuration for an enrich function.
|
|
1552
1740
|
*
|
|
1553
1741
|
* **How Enrich Functions Work:**
|
|
1554
1742
|
*
|
|
1555
|
-
* Enrich functions
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
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.
|
|
1559
1755
|
*
|
|
1560
1756
|
* **Input Requirements:**
|
|
1561
1757
|
*
|
|
1562
|
-
* - Must receive JSON input (typically
|
|
1563
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
1758
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
1564
1759
|
*
|
|
1565
1760
|
* **Example Use Cases:**
|
|
1566
1761
|
*
|
|
1567
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
1568
|
-
* - Enrich customer data with account
|
|
1569
|
-
* -
|
|
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
|
|
1570
1766
|
*
|
|
1571
1767
|
* **Configuration:**
|
|
1572
1768
|
*
|
|
1573
|
-
* - Define
|
|
1574
|
-
* -
|
|
1575
|
-
* - Steps are executed sequentially
|
|
1769
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
1770
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
1576
1771
|
*/
|
|
1577
1772
|
config?: FunctionsAPI.EnrichConfig;
|
|
1578
1773
|
}
|
|
@@ -2910,31 +3105,38 @@ export declare namespace FunctionCreateParams {
|
|
|
2910
3105
|
functionName: string;
|
|
2911
3106
|
type: 'enrich';
|
|
2912
3107
|
/**
|
|
2913
|
-
* Configuration for enrich function
|
|
3108
|
+
* Configuration for an enrich function.
|
|
2914
3109
|
*
|
|
2915
3110
|
* **How Enrich Functions Work:**
|
|
2916
3111
|
*
|
|
2917
|
-
* Enrich functions
|
|
2918
|
-
*
|
|
2919
|
-
*
|
|
2920
|
-
*
|
|
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.
|
|
2921
3124
|
*
|
|
2922
3125
|
* **Input Requirements:**
|
|
2923
3126
|
*
|
|
2924
|
-
* - Must receive JSON input (typically
|
|
2925
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
3127
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
2926
3128
|
*
|
|
2927
3129
|
* **Example Use Cases:**
|
|
2928
3130
|
*
|
|
2929
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
2930
|
-
* - Enrich customer data with account
|
|
2931
|
-
* -
|
|
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
|
|
2932
3135
|
*
|
|
2933
3136
|
* **Configuration:**
|
|
2934
3137
|
*
|
|
2935
|
-
* - Define
|
|
2936
|
-
* -
|
|
2937
|
-
* - Steps are executed sequentially
|
|
3138
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
3139
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
2938
3140
|
*/
|
|
2939
3141
|
config?: EnrichConfig;
|
|
2940
3142
|
/**
|
|
@@ -3189,31 +3391,38 @@ export declare namespace FunctionUpdateParams {
|
|
|
3189
3391
|
interface UpsertEnrichFunction {
|
|
3190
3392
|
type: 'enrich';
|
|
3191
3393
|
/**
|
|
3192
|
-
* Configuration for enrich function
|
|
3394
|
+
* Configuration for an enrich function.
|
|
3193
3395
|
*
|
|
3194
3396
|
* **How Enrich Functions Work:**
|
|
3195
3397
|
*
|
|
3196
|
-
* Enrich functions
|
|
3197
|
-
*
|
|
3198
|
-
*
|
|
3199
|
-
*
|
|
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.
|
|
3200
3410
|
*
|
|
3201
3411
|
* **Input Requirements:**
|
|
3202
3412
|
*
|
|
3203
|
-
* - Must receive JSON input (typically
|
|
3204
|
-
* - Can be chained after transform or other functions that produce JSON output
|
|
3413
|
+
* - Must receive JSON input (typically from a previous function's output)
|
|
3205
3414
|
*
|
|
3206
3415
|
* **Example Use Cases:**
|
|
3207
3416
|
*
|
|
3208
|
-
* - Match product descriptions to SKU codes from a product catalog
|
|
3209
|
-
* - Enrich customer data with account
|
|
3210
|
-
* -
|
|
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
|
|
3211
3421
|
*
|
|
3212
3422
|
* **Configuration:**
|
|
3213
3423
|
*
|
|
3214
|
-
* - Define
|
|
3215
|
-
* -
|
|
3216
|
-
* - Steps are executed sequentially
|
|
3424
|
+
* - Define named endpoints (for endpoint-source steps)
|
|
3425
|
+
* - Define one or more enrichment steps; steps are executed sequentially
|
|
3217
3426
|
*/
|
|
3218
3427
|
config?: EnrichConfig;
|
|
3219
3428
|
}
|