OpenAI Service Skeleton
Use this repo to create a service that talks to OpenAI.
Running the project locally
Prerequisites
- Docker installed on your machine
To run the project, follow these steps:
- Open a terminal window.
- Navigate to the root directory of this project.
- Run the following command to build the Docker image:
docker build -t open-ai-service .
This command will build a Docker image with the name specified after -t
- Once the image has been built, you can run the Docker container using the following command:
docker run -p 8080:8080 open-ai-service
You can now make requests to your local dockerfile using localhost:8080/open-ai-service
. In the request body, be sure to include the following:
{
"prompt": <user_prompt>
}
Deploying to Cloud Run
To deploy a new version, do the following:
- Authenticate to GCloud
- Run
gcloud run deploy
- The source code location should line up with the root directory of this repository
- Service name should be
open-ai-service
. You can change the name - Region should be
us-central1
- For now, we are allowing unauthenticated invocations
For more information on deploying to Google Cloud, read their docs here.