Code Generation Prompt for Custom Functions

Instructions: Replace the information inside the [brackets] to be what you want the AI agent to do.

I want to create a custom function for my AI agent that retrieves information based on user input.

This new custom function will [describe what you want the AI to do] using data from [how the AI is accessing the data/app/database/website etc.]

The function should be able to accept a [input_type] and return the corresponding [output_type] using the [API_name].

Example Input: [your example input from a user talking with the ai]

Example Output: [example output of what data you’re expecting the AI to get]

Provide the complete code for the Flask app and the JSON parameters for the AI custom function.

Here are the details:

  1. The function name should be formatted like: functionName.

  2. Based on the requirements above it will fetch the Output.

  3. The Flask app should have an endpoint /get_{output_type} that accepts a POST request with a JSON body containing the {input_type}.

  4. The API response should be parsed to extract the relevant {output_type} information.

  5. If there are any errors (HTTP errors, network errors, or invalid input), they should be handled gracefully and return appropriate error messages.

Please provide the complete code for the Flask app, and also the JSON parameters for the custom function interface.

Provide the complete code for the Flask app. Provide the JSON parameters for the custom function interface. Provide the name of the function. Provide the short description of the function. Provide the info to test in reqbin. The API keys should be stored as a variables.

Last updated