Skip to content

johnnynines/openai-api-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI API Lambda Setup

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.

How to use

To use this you will need the following:

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.

To Do

  • Add instructions demonstrating how to set up the Lambda from nothing
  • Add details about CORS settings

About

My Lambda function and resources for using the OpenAI API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published