https://github.com/fny/hh200605
https://github.com/fny/hh200605
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fny/hh200605
- Owner: fny
- Created: 2023-06-05T17:55:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-05T17:59:38.000Z (about 3 years ago)
- Last Synced: 2025-03-15T15:18:46.149Z (over 1 year ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Usage
Create a dotenv file with the following keys.
```
REPLICATE_API_TOKEN=
OPENAI_API_KEY=
COHERE_API_KEY=
```
Install packages with `npm i`. Start the server with `node index.js`
Make post requests to `localhost:3000/create_prompt` to create a prompt. The body of the request should include the complete payload.
```
POST /create_prompt
{
"name": "test_command",
"prompt_template": "I want you to act as a naming consultant for new companies.\n\nWhat is a good name for a company that makes ?",
"model": "command",
"hyperparameters": { ... }
}
# => { "success": true }
```
Note this will create an entry in `database.json` the dummy database used for this exercise.
Make post requests to `localhost:3000/create_completition` to return a completition. Again, the body of the request should contain the complete payload.
```
POST /create_completeion
{
"prompt_name": "test_command",
"variables": {
"product": "apples"
}
}
# => { "success": true, "response": ... }
```
Errors will be returned if any parameters are unknown or missing.
## ChatGPT
You can chat with an identifiable instance of ChatGPT by invoking the following:
```
POST /chat/1
{
"prompt": "My favorite color is yellow. What is your favorite color?",
"hyperparameters": ...
}
# => As an AI language model, I do not have personal preferences or emotions. I am designed to assist and answer questions to the best of my ability without bias.
POST /chat/1
{
"prompt": "What is my favorite color?"
"hyperparameters": ...
}
# => You previously mentioned that your favorite color is yellow.
```