git clone https://github.com/exoaihq/openai-functions-ts-example
cd openai-functions-ts-example
yarn install
Add you Open AI api key to the .env-example
file and then change the file name to .env
yarn run dev
The server should start running on port 8080.
The example in this repo gives the Open AI api the option to trigger two docker related functions: startAContainer
and runCommandInContainer
.
You'll need docker installed on your machine.
The example function asks the api to clone and run a repo. The example repo is https://github.com/kmgrassi/addressbook
You can hardcode a different repo by changing line 15 in the functions.controller.ts
file or by passing the url into the endpoint as a query parameter (in which case you can uncomment like 12-13)
To run the example, open up a browser window and nav to http://localhost:8080/functions
This will start the loop which will as the Open AI api to clone and run the repo in a docker container. You can add in some console.logs
to follow the loops if you'd like (I removed them).
Feel free to reach out to me with any questions or issues with the code. Happy coding!