Function Generator

Overview

Use this Snap to generate a tool definition.


Function Generator Snap dialog

  • This is a Format-type Snap.

Snap views

Type Description Examples of upstream and downstream Snaps
Input This Snap has one document input view.
Output This Snap has one document output view. The output is a tool definition structured according to SnapLogic's internal schema. It can be seamlessly consumed in a Tool Calling Snap as one element in the tool payload.
Learn more about Error handling.

Snap settings

Legend:
  • Expression icon (): Allows using JavaScript syntax to access SnapLogic Expressions to set field values dynamically (if enabled). If disabled, you can provide a static value. Learn more.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field/Field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Function Generator

Example: toolCaller

Name String/Expression

Required. Specify the tool name, and the model calls that specific tool with the same name.

Important: Following are the supported characters for the function name: lowercase (a-z), uppercase (A-Z), numbers (0-9), underscores (_), and dashes (-).
Minimum value: 1 character

Maximum value: 64 characters

Default value: N/A

Example: weather_tool

Description String/Expression

A description of what the function does.

Default value: N/A

Example: weather_tool
Strict Mode Checkbox

For OpenAI LLMs only Select this checkbox to ensure that the Snap validates the input parameters strictly according to the defined schema or constraints. When enabled, the model will follow the exact schema defined in the Parameters field.

Default status: Deselected

Note: The Snap supports only a subset of JSON Schema when this checkbox is selected. A list of unsupported JSON schema can be found. here. If the checkbox is selected, all fields much be required. Otherwise, OpenAI will respond with an error,
Input Mode Dropdown list

The mode in which the function generator operates.

  • JSON Schema Mode
  • Express Mode

Default value: Express Mode

Example: Express Mode

Parameters String/Expression

Appears when Express Mode is selected.

The parameters the function accepts.

Default value: Example:
JSON Schema Button

Appears when JSON Schema Mode is selected.

The JSON Schema for the function definition. Click JSON Schema to open the JSON Editor

Default value: Default JSON Schema editor contents:


JSON Schema default contents

Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate & Execute

Example: Execute only

Custom metadata example

For all Function Generator Snaps, you can define metadata for your tool definitions. The following screenshot provides an example of how the Snap output displays the metadata.