Quick Start

Create a function package, run and validate it locally, deploy it to Data 360, use it as the chunking strategy in a search index, and then verify chunked results in Data Explorer or with a retriever in Prompt Builder.

This quick start uses the default function in payload/entrypoint.py and validates it with payload/tests/test.json, which is a local input payload containing DocElements with text and metadata. The local run returns chunk output fields such as chunk_type, text, seq_no, and optional citations.

Estimated time: ~25 minutes.

Edition Table
Available in: Developer, Enterprise, Performance, and Unlimited Editions. See Data 360 edition availability.
Permission Sets Needed
To run the sample chunking function in Data 360:Permission set:
  • Data Cloud Architect

Step 1: Access a Data 360 Org 

Make sure that you have access to a Data 360 org with appropriate permission sets. If you do not have a sandbox, create one. See Create a Data 360 Sandbox.

Enable Code Extension in Data Cloud Setup by using Feature Manager. See Enable Data 360 Features in Feature Manager.

Step 2: Set Up Salesforce CLI for Custom Functions 

Install the Salesforce CLI and the code extension plugin, install the Data Cloud Custom Code Python SDK, authenticate to your org, and initialize a function package. See Set Up Salesforce CLI for Custom Functions.

Step 3: Build Your Function Package 

  1. Go to your function package directory.

    1cd <function-package-name>
  2. Run the function package locally with sample test input.

    1sf data-code-extension function run --entrypoint ./payload/entrypoint.py --test-with ./payload/tests/test.json
  3. Refresh package metadata from the package root.

    1sf data-code-extension function scan --entrypoint ./payload/entrypoint.py

Step 4: Deploy Your Custom Function to Data 360 

1sf data-code-extension function deploy --name <name> --package-version <version> --description "<description>" --package-dir ./payload --target-org <myorg>

Step 5: Use Your Function in a Search Index 

Create a search index with Advanced Setup and select your custom chunking function for the fields you want to chunk. See Use a Custom Chunking Function in a Search Index.

Step 6: Verify Chunking Results 

After the search index runs and reaches a Ready status, verify the chunked data in Data Explorer or by using a retriever in Prompt Builder. See Verify Custom Chunking Results.

See Also