https://github.com/pannh/ai-definer
A Go API used to generate definitions of terms & phrases using the OpenAI chat completion API.
https://github.com/pannh/ai-definer
api chat-completion chatgpt definer definition dictionary go golang language openai
Last synced: about 1 month ago
JSON representation
A Go API used to generate definitions of terms & phrases using the OpenAI chat completion API.
- Host: GitHub
- URL: https://github.com/pannh/ai-definer
- Owner: PannH
- Created: 2024-08-19T20:20:33.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-19T20:42:48.000Z (9 months ago)
- Last Synced: 2025-02-13T19:45:44.630Z (3 months ago)
- Topics: api, chat-completion, chatgpt, definer, definition, dictionary, go, golang, language, openai
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AI Definer
AI Definer is an API that allows you to get the definition of terms and phrases using the OpenAI chat completion API (model `gpt-3.5-turbo`).## Usage
To use AI Definer, firstly set your OpenAI API key in a `.env` file (see [`.env.example`](./.env.example)).Then, run the API using the following command :
```bash
go run .\main\main.go
```
*The API will be available at http://localhost:8080/.*To compile the API, use the following command :
```bash
go build -o ai-definer.exe .\main\main.go
```## Example
#### Request
```
GET /definition/en/cake
```
#### Response
```json
{
"definition": "A sweet baked food made from a mixture of flour, sugar, eggs, and other ingredients, usually with a sweetening agent such as honey or sugar.",
"lang": "en",
"pronunciation": "keɪk",
"term": "cake",
"type": "noun"
}
```