How to provide data to AI Connector in Frends

AI Connector will only receive the data you provide.

When working with the AI Connector in Frends, you'll often need to pass dynamic data into your prompts, whether that's customer information from a database, content from previous tasks in your process, or files that need to be analyzed. Understanding how to effectively provide this data to the AI Connector opens up a world of possibilities for creating intelligent, context-aware integrations.

At its core, the AI Connector needs two things to generate useful responses: clear instructions about what you want it to do, and the actual data it should work with. While the instructions come from your carefully crafted prompts, the data can arrive through several different channels depending on your use case.

Prerequisites

Before diving into data provisioning techniques, you'll need the Editor role in Frends to create and edit Processes. You'll also need some Frends Credits available to use the AI Connector. The examples in this guide work with Frends 6.1.1 and later versions, which include enhanced support for dynamic data passing.

Passing data to AI Connector

AI Connector doesn't automatically receive all your Process data as context, but needs you to explicitly tell it what data to use. This might seem like extra work at first, but it actually gives you precise control over what information the AI sees, which can help reduce token usage and keep your prompts focused, not to forget full control over what data is passed to the AI service.

There are two main methods for providing your data to AI to handle: Using the Handlebar syntax as part of the prompts for the AI, and as file attachments.

Passing Data with Handlebar Syntax

The most common and flexible way to provide data to the AI Connector is through handlebar syntax in your User Prompt field. Handlebars use double curly braces to reference dynamic values from your Frends Process, and they work seamlessly within otherwise static text.

Customer data provided to AI Connector using Handlebars.

You can provide data in most formats through the Handlebar syntax, be it base64-encoded binary data, JSON, CSV, or even a prose-form order composed in Latin. As long as it has a clear string presentation available, it can be provided to the AI using Handlebars.

Providing Data Through File Attachments

Beyond embedding data directly in your prompts, the AI Connector can work with file attachments that are available to your Process. This is incredibly useful when you're dealing with images, audio files, or large text documents that would be cumbersome to include inline in a prompt.

File path can be provided as plain text or using Handlebars.

Configuring File Attachments

To attach a file to your AI request, you'll use the File Attachment parameter in the AI Connector's configuration. This field accepts several different types of file paths, giving you flexibility in how you store and reference your files.

You can provide an absolute local file path if your file is stored on the Frends agent's file system—something like /frends-shared-data/reports/monthly-summary.txt. If your file is accessible via the web, you can pass an HTTP or HTTPS URL directly. And for scenarios where you've already loaded a file into memory and encoded it, you can use resource URLs or data URLs with Base64-encoded contents.

The real power comes when you combine file attachments with Handlebar syntax. Just like with prompts, you can use dynamic expressions in the File Attachment field. For example, if your Process generates or retrieves files with variable names, you might use {{#var.ReportFilePath}} to reference whichever file your earlier logic determined was needed.

Supported File Types

The AI Connector handles three broad categories of files: images, text-based files, and audio files. When you configure your file attachment, you'll need to select the appropriate file type so the AI knows how to process it.

One current limitation to be aware of is that PDF files aren't directly supported by the AI Connector. If you need to work with PDFs, you'll need to extract the text or images first using another Frends Task, then pass that extracted content to the AI either through the prompt or as a converted file format.

Tips for Effective Data Provisioning

As you build Processes that use the AI Connector, keep in mind that being explicit and structured in how you provide data will consistently give better results than being vague. If you're passing large amounts of data, consider preprocessing it to remove irrelevant information—not only does this save on token costs, but it helps the AI focus on what actually matters for your use case.

However, when you do provide large datasets, extensive documents, or high-resolution images to the AI, think strategically about maximizing the value you extract from that single interaction. Processing large amounts of data consumes significant tokens, so asking the AI to perform just one simple task on a large document or complex image isn't cost-effective. Instead, craft your prompts to accomplish multiple related objectives at once.

For example, if you're analyzing a lengthy customer contract, don't just ask the AI to extract the contract value—have it also identify key dates, flag unusual terms, summarize obligations, and note potential risks all in one pass. Similarly, when processing images like invoices or forms, request extraction of all relevant fields, validation checks, and data quality assessments together rather than making separate calls for each piece of information. This approach not only reduces costs but also improves efficiency since the AI has already "read" and understood the entire context in a single operation.

Last updated

Was this helpful?