Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dvcrn/gptclassifier
Tool to classify and find matching names for the given content
https://github.com/dvcrn/gptclassifier
Last synced: 6 days ago
JSON representation
Tool to classify and find matching names for the given content
- Host: GitHub
- URL: https://github.com/dvcrn/gptclassifier
- Owner: dvcrn
- Created: 2023-03-25T10:40:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-02T21:34:14.000Z (about 1 year ago)
- Last Synced: 2024-01-31T04:20:58.273Z (9 months ago)
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GPT File Classifier
Tool to
- Classify: Classify the given content into one of the given options
- Name: Find a matching file name for the given contentGPT Classifier is a classifier tool written in Golang that can be used as both a Command-Line Interface (CLI) and an HTTP server.
The server is also [pushed to docker hub](https://hub.docker.com/r/dvcrn/gptclassifier), ready to be used
Fun fact: This entire repository was generated by GPT4
## Using the CLI Tool
To use the CLI tool, pass it the content to be classified and the options for classification as command line arguments.
### Classify:
```
./gpt-classifier -organization "openai org" -apikey "openai api key" -action classify -content "this is regarding your credit card bill" -options "credit card,debit card"credit card
```### Name:
```
./gpt-classifier -organization "openai org" -apikey "openai api key" -action name -content "this is regarding your credit card bill" -file_type "pdf" -example_names "2023-01-bill.pdf,2023-06-electricity-bill.pdf" -num_names 52022-05-credit-card-bill.pdf,credit-card-bill-05-2022.pdf,cc-bill-may-2022.pdf,2022-05-credit-card-statement.pdf,may-2022-credit-card-invoice.pdf
```## Using the HTTP Server
With docker:
```
docker run -p 8080:8080 dvcrn/gptclassifier
```With go:
```
go run cmd/server/main.go
```You can also set `OPENAI_API_KEY` and `OPENAI_ORGANIZATION` and leave out passing it as args. Args will overwrite env variables.
### Classify:
To use the HTTP server, send a `POST` request to the `/classify` endpoint with a JSON payload containing the following fields:
- `content`: the content to be classified
- `options`: an array of options for classification
- `apikey`: the OpenAI API key
- `organization`: the OpenAI organization```
curl -X POST -H "Content-Type: application/json" -d '{"content":"This is my credit card statement","options":["credit card","debit card","utility bill","phone bill"],"apikey":"xxx","organization":"xxx"}' http://localhost:8080/classify{"success":true,"result":"credit card"}⏎
```### Name:
To use the HTTP server, send a `POST` request to the `/name` endpoint with a JSON payload containing the following fields:
- `content`: the content to be classified
- `fileType`: file type of the content (pdf, txt, etc)
- `exampleNames`: examples of how the file name should look like
- `numNames`: how many names to generate
- `apikey`: the OpenAI API key
- `organization`: the OpenAI organization```
curl -X POST -H "Content-Type: application/json" -d '{"content":"This is my credit card statement","fileType": "pdf","exampleNames":["2023-03-water-bill.pdf", "2023-06-electricity-bill.pdf"],"apikey":"xxx","organization":"xxx"}' http://localhost:8080/name | json_pp{
"names" : [
"credit-card-statement.pdf",
"finance-summary.pdf",
"monthly-finances.pdf",
"account-summary.pdf",
"billing-statement.pdf"
],
"success" : true
}
```## License
AGPL for non-commercial/personal use
If you'd like to integrate this code as is into a commercial project, reach out