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.
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_middleware_aws_function