This is a simple todo application that uses OpenAI's function calling feature to manage todos with natural language.
This project is a Node.js Express application that provides a web interface for managing a todo list. It has two ways of interacting with the todo list:
- A standard REST API: You can use a GUI Client or
cURL
to performCRUD
(Create, Read, Update, Delete) operations on the todos. - A "smart agent": You can send natural language commands to an endpoint, and it will use
OpenAI's
language model to understand your intent and perform the corresponding action.
To get a local copy up and running, follow these simple steps.
You need to have Node.js and npm installed on your machine.
- npm
npm install npm@latest -g
- Clone the repo
git clone https://github.com/your_username/ai-powered-todos.git
- Install NPM packages
npm install
- Create a
.env
file in the root of the project and add yourOpenAI API key
:OPENAI_API_KEY=your_openai_api_key
- Start the application:
Or for development with automatic restarting:
npm start
npm run dev
The application will be running at http://localhost:3000
.
You can interact with the application through its web interface, the REST API, or the smart agent.
The following REST API endpoints are available:
GET /api/todos
: Get all todo items.POST /api/todos
: Create a new todo item.- Body:
{ "title": "Your todo title" }
- Body:
DELETE /api/todos/:id
: Delete a todo item by its ID.
The smart agent allows you to manage your todos using natural language. Send a POST request to the /smart-agent
endpoint with a JSON body containing your command.
- Endpoint:
POST /smart-agent
- Body:
{ "message": "Your natural language command" }
Example Commands:
"Add a new todo to buy milk"
"What are my todos?"
"Delete the todo with id 1"
OPENAI_API_KEY
: Your API key for the OpenAI API.
This project is licensed under the MIT License - see the LICENSE file for details.