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.