Archive
The Daily Org

A Salesforce NewspaperCurated by Abhinav

Use custom Python chunking to improve Agentforce retrieval accuracy in Data 360

Default character or token splitters fracture complex enterprise documents like financial reports and call transcripts, causing Agentforce to retrieve contextless chunks. The article explains how Data 360 Code Extension functions allow developers to run custom Python scripts within the Salesforce trust boundary to implement tailored chunking logic.

For fragmented data tables, standard chunking strips column headers, leaving raw numbers meaningless to the model. A custom function detects table boundaries and repeats header rows across sub-chunks, enabling the agent to correctly map values to metrics like revenue and operating margins.

Multispeaker dialogues suffer when speaker turns merge into massive unstructured blocks. By applying a sliding window approach with defined turn counts and character limits, adjacent chunks overlap to preserve conversational context. The author validates these techniques by querying both native and custom vector indexes and comparing the resulting Agentforce answers against identical user prompts.

Deploy Python Code Extensions for complex Data 360 batch transformations

Northstar Outfitters faced inconsistent product data across commerce systems and needed a trusted catalog. Native visual transforms could not handle the required standardization, enrichment, and scoring logic, prompting the use of Data 360 Code Extension to run modular Python and PySpark scripts directly on Salesforce infrastructure.

The solution relies on isolated runtime environments where scripts read from and write to designated Data Lake Objects using explicit permissions defined in a configuration file. Developers validate logic locally against sampled data before packaging the script, dependencies, and tests into a deployable archive.

The guide details both Setup interface and Salesforce CLI workflows for uploading packages, selecting compute sizes, and linking the extension to a batch data transform. Execution, scheduling, and logging are handled by the platform, while operators can trigger runs and review history through REST API calls.