This is a cloned artifact from my development of EasyUserPersonas.com. It has been modified so that it can be used and expanded upon by others, in their own respective OpenAI projects.
The purpose of this Lambda function is to provide a secure space to invoke an OpenAI API request and handle the resoponse. The Lambda can be triggered several ways, but this was developed with the intention of using the AWS API Gateway to trigger the Lambda function from a web application.
To use this you will need the following:
- OpenAI API Key
- Node v20 or higher
- An AWS Lamda
Pull the repo to your local environment and run npm install.
Once the packages have been installed, you have to zip up the entire root directory, including the node_modules directory, and upload it to your Lambda.
In your Lambda Configuration settings select Environment Variables and add your API Key with OPENAI_API_KEY as the key and your API key as the Value.
It is suggested that you enable AWS Cloudwatch logs for your API Gateway and Lambda for debugging.
- Add instructions demonstrating how to set up the Lambda from nothing
- Add details about CORS settings