This python function can be deployed on AWS using SAM. The function will require authentication from the User Pool that will be created from this SAM template. The function embbed psycog2 binaries that is not available by default in AWS function runtime.
This repository has code that should be informational only and used only as an inspiration for use-cases, not being used as is in production.
This code is meant to be used by this tutorial: https://cookbook.openai.com/examples/chatgpt/sharepoint_azure_function/gpt_action_redshift