This project is a command-line tool written in Go. It interacts with the OpenAI API to perform file and text operations based on user input.
The motivation behind this project is to leverage the power of OpenAI's GPT-3 model to assist with file and text operations, making these tasks more efficient and intuitive.
In this project, we use several OpenAI functions to perform common coding tasks. These functions are defined in functions.go
file. We have functions for getting the current time, listing files in a specified directory, reading files at given paths, and writing to a file at a given path. These functions are called based on the responses generated by the GPT-3 model in response to user input. This allows us to leverage the power of machine learning to automate and simplify file and text operations.
This application includes several key components:
-
functions.go
: This file defines several functions for getting the current time, listing files in a specified directory, reading files at given paths, and writing to a file at a given path. It also includes a function for handling errors. -
main.go
: This is the main entry point for the application. It loads environment variables from a.env
file, instantiates a client using the OpenAI API key, and then runs a REPL (Read-Eval-Print Loop). -
nesting.go
: This file defines functions for analyzing and modifying files in a project. It uses the OpenAI GPT-3 model to generate responses based on user input. -
repl.go
: This file contains the logic for the REPL. It takes user input, sends it to the GPT-3 model, and outputs the model's response. It also executes the relevant function based on the model's response. -
go.mod
andgo.sum
: These are standard Go files that manage the project's dependencies. Dependencies include thego-openai
,go-lsp
, andgodotenv
packages.
Run the application from the command line. Ensure that you have set the necessary environment variables in a .env
file.