This is an node that assists in defining an OpenAI function. It helps format the function request in the exact format that the OpenAI API requires.

Node Inputs

The node accepts a few user-defined inputs to help govern its operation. These include the name of the OpenAI function, a description of the function and a list of parameters for the function.

Node Parameters

The parameters set for this node are as follows:

  1. Name (required): User-named text that presents the name of the function that you’re defining. For example: get user details.

  2. Description (required): Text that provides a concise explanation of what your function does. It helps the model understand the purpose of the function.

  3. Parameters (required): A list of objects that provides more details about the function parameters. Each object within the list consists of the following properties:

  • Name: User-named text to present the name of the parameter. For example: ‘location’.
  • Type: Represents the data type of the parameter. For example: ‘text’.
  • Description: A concise explanation of the parameter. For example: ‘The city and state, e.g. San Francisco, CA’.

Node Output

The node generates a single output called ‘function json’ in text format. This output is a JSON formatted string of the OpenAI function definition taking into account the inputs and parameters received from the user.

Node Functionality

The node receives inputs and parameters, validates them and uses them to build a properly formatted OpenAI function in JSON. This function is ready to be used in OpenAI API requests. If there are any errors with the inputs or parameters, the node returns nothing and logs an error message.

When To Use

The Define OpenAI Function node is useful when you are working towards integrating your applications with OpenAI’s infrastructure but are unfamiliar with how to correctly format a function for their API. It allows you to create functions quickly and efficiently. With this node, you do not need to worry about the technical details of OpenAI’s function formatting, making it easier for non-technical users as well.