OpenAI Function Generator

Overview

You can use this Snap to generate tool definitions. It informs the model about the tools that user can call, including their names, descriptions, and required input parameters. This simplifies the process of defining custom tools compared to manual JSON construction.


OpenAI Function Generator Snap

Prerequisites

None.

Limitations and known issues

None.

Breaking change

With the main29029 GA release, ARRAY and OBJECT options have been removed from the Type dropdown list. If your existing pipelines use these options, the following errors are displayed:
  • Invalid property value found (ARRAY), must be one of: INTEGER, NUMBER, STRING, BOOLEAN
  • Invalid property value found (OBJECT), must be one of: INTEGER, NUMBER, STRING, BOOLEAN
Workaround: Replace ARRAY and OBJECT options with supported types (INTEGER, NUMBER, STRING, or BOOLEAN).

Snap views

View 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 the OpenAI Tool Calling snap as one element in the tool payload.
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Note:
  • Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
  • Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
  • Add icon (Plus Icon): Indicates that you can add fields in the field set.
  • Remove icon (Minus Icon): Indicates that you can remove fields from the field set.
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: OpenAI Function Generator

Example: Generate financial analysis

Name String/Expression Required.

Specify the name of the tool you have, and the model will specify which one to call by name.

Default value: N/A

Example: generateSummary

Description String/Expression

Specify the description for the function, explaining the function’s purpose and what it analyzes.

Default value: N/A

Example: Summarize text content
Strict Mode Checkbox

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,
Parameters

Use this field to define the input parameters required for the OpenAI function. You can specify the property name, description, type, and whether the parameter is required.

Property name String/Expression Required.

Specify the name of the parameter required for the function. This name will be used within the function.

Default value: N/A

Example: expenses
Property Description String/Expression

Specify a description for the parameter to explain its purpose in the function.

Default value: N/A

Example: The output of the expense generator

Type Dropdown list Choose the type of input expected for the parameter. The options available include:
  • STRING
  • NUMBER
  • BOOLEAN
  • INTEGER
CAUTION: With the main29029 GA release, ARRAY and OBJECT options have been removed from the Type dropdown list. If your existing pipelines use these options, the following errors are displayed:
  • Invalid property value found (ARRAY), must be one of: INTEGER, NUMBER, STRING, BOOLEAN
  • Invalid property value found (OBJECT), must be one of: INTEGER, NUMBER, STRING, BOOLEAN

Workaround: Replace ARRAY and OBJECT options with supported types (INTEGER, NUMBER, STRING, or BOOLEAN).

Default value: STRING

Example: NUMBER

Enum String/Expression Specify a value from the user-defined list and serves to restrict the possible values of this attribute.

Default value: N/A

Example: STRING

Required Checkbox

Select this checkbox if this parameter is mandatory for the function's execution.

Default status: Deselected

Snap execution Dropdown list
Select 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

Examples