Refine README for chat history, feedback management and prompt registry microservice (#727)
* [chat_history]: Refine README documentation Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> * [feedback_management]: Refine README documentation Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> * [prompt_registry]: Refine README documentation Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> * Fix readme typo Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
26
comps/chathistory/README.md
Normal file
26
comps/chathistory/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# 📝 Chat History Microservice
|
||||
|
||||
The Chat History Microservice is a scalable solution for storing, retrieving and managing chat conversations using various type of databases. This microservice is designed to seamlessly integrate with OPEA chat applications, enabling data persistence and efficient management of chat histories.
|
||||
|
||||
It can be integrated into application by making HTTP requests to the provided API endpoints as shown in the flow diagram below.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Features
|
||||
|
||||
- **Store Chat Conversations**: Save chat messages user information, and metadata associated with each conversation.
|
||||
- **Retrieve Chat Histories**: Fetch chat histories for a specific user or retrieve a particular conversation by its unique identifier.
|
||||
- **Update Chat Conversations**: Modify existing chat conversations by adding new messages or updating existing ones.
|
||||
- **Delete Chat Conversations**: Remove chat conversations record from database.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Implementation
|
||||
|
||||
The Chat History microservice able to support various database backends for storing the chat conversations.
|
||||
|
||||
### Chat History with MongoDB
|
||||
|
||||
For more detail, please refer to this [README](./mongo/README.md)
|
||||
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
@@ -1,10 +1,8 @@
|
||||
# Chat History Microservice
|
||||
# 📝 Chat History Microservice with MongoDB
|
||||
|
||||
The Chat History Microservice allows you to store, retrieve and manage chat conversations with a MongoDB database. This microservice can be used for data persistence in OPEA chat applications, enabling you to save and access chat histories.
|
||||
This README provides setup guides and all the necessary information about the Chat History microservice with MongoDB database.
|
||||
|
||||
It can be integrated into any application by making HTTP requests to the provided API endpoints as shown in the flow diagram below.
|
||||
|
||||

|
||||
---
|
||||
|
||||
## Setup Environment Variables
|
||||
|
||||
@@ -17,6 +15,8 @@ export DB_NAME=${DB_NAME}
|
||||
export COLLECTION_NAME=${COLLECTION_NAME}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀Start Microservice with Docker
|
||||
|
||||
### Build Docker Image
|
||||
@@ -28,78 +28,82 @@ docker build -t opea/chathistory-mongo-server:latest --build-arg https_proxy=$ht
|
||||
|
||||
### Run Docker with CLI
|
||||
|
||||
- Run mongoDB image
|
||||
- Run MongoDB image container
|
||||
|
||||
```bash
|
||||
docker run -d -p 27017:27017 --name=mongo mongo:latest
|
||||
```
|
||||
```bash
|
||||
docker run -d -p 27017:27017 --name=mongo mongo:latest
|
||||
```
|
||||
|
||||
- Run the chathistory Service
|
||||
- Run the Chat History microservice
|
||||
|
||||
```bash
|
||||
docker run -d --name="chathistory-mongo-server" -p 6013:6013 -p 6012:6012 -p 6014:6014 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/chathistory-mongo-server:latest
|
||||
```
|
||||
```bash
|
||||
docker run -d --name="chathistory-mongo-server" -p 6013:6013 -p 6012:6012 -p 6014:6014 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=$ {COLLECTION_NAME} opea/chathistory-mongo-server:latest
|
||||
```
|
||||
|
||||
## Invoke Microservice
|
||||
---
|
||||
|
||||
Once chathistory service is up and running, users can update the database by using the below API endpoint. The API returns a unique UUID for the saved conversation.
|
||||
## ✅ Invoke Microservice
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"data": {
|
||||
"messages": "test Messages", "user": "test"
|
||||
}
|
||||
}'
|
||||
```
|
||||
The Chat History microservice exposes the following API endpoints:
|
||||
|
||||
- Create new chat conversation
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"data": {
|
||||
"messages": "test Messages", "user": "test"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
- Get all the Conversations for a user
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test"}'
|
||||
```
|
||||
|
||||
- Get specific conversation by specifying the id.
|
||||
- Get a specific conversation by id.
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "id":"668620173180b591e1e0cd74"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "id":"668620173180b591e1e0cd74"}'
|
||||
```
|
||||
|
||||
- Update the conversation by specifying the id.
|
||||
- Update the conversation by id.
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"data": {
|
||||
"messages": "test Messages Update", "user": "test"
|
||||
},
|
||||
"id":"668620173180b591e1e0cd74"
|
||||
}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"data": {
|
||||
"messages": "test Messages Update", "user": "test"
|
||||
},
|
||||
"id":"668620173180b591e1e0cd74"
|
||||
}'
|
||||
```
|
||||
|
||||
- Delete a stored conversation by specifying the id.
|
||||
- Delete a stored conversation.
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/delete \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "id":"668620173180b591e1e0cd74"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://${host_ip}:6012/v1/chathistory/delete \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "id":"668620173180b591e1e0cd74"}'
|
||||
```
|
||||
|
||||
22
comps/feedback_management/README.md
Normal file
22
comps/feedback_management/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# 🗨 Feedback Management Microservice
|
||||
|
||||
The Feedback Management microservice facilitates the storage and retrieval of users'feedback data by establishing a connection with the databases. This microservice is designed to seamlessly integrate with OPEA applications, enabling data persistence and efficient management of feedback data.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Features
|
||||
|
||||
- **Store Feedback**: Save feedback data from user into database.
|
||||
- **Retrieve Feedback**: Fetch feedback data from database based on user or id.
|
||||
- **Update Feedback**: Update feedback data info in the database based on id.
|
||||
- **Delete Feedback**: Remove feedback record from database.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Implementation
|
||||
|
||||
The Feedback Management microservice able to support various database backends for storing the feedback data.
|
||||
|
||||
### Feedback Management with MongoDB
|
||||
|
||||
For more detail, please refer to this [README](./mongo/README.md)
|
||||
@@ -1,6 +1,8 @@
|
||||
# Feedback Management Microservice
|
||||
# 🗨 Feedback Management Microservice with MongoDB
|
||||
|
||||
The Feedback Management microservice facilitates the storage and retrieval of users'feedback data by establishing a connection with the database.
|
||||
This README provides setup guides and all the necessary information about the Feedback Management microservice with MongoDB database.
|
||||
|
||||
---
|
||||
|
||||
## Setup Environment Variables
|
||||
|
||||
@@ -13,13 +15,7 @@ export DB_NAME=${DB_NAME}
|
||||
export COLLECTION_NAME=${COLLECTION_NAME}
|
||||
```
|
||||
|
||||
## Start Feedback Management microservice for MongoDB with Python script
|
||||
|
||||
Start document preparation microservice for Milvus with below command.
|
||||
|
||||
```bash
|
||||
python feedback.py
|
||||
```
|
||||
---
|
||||
|
||||
## 🚀Start Microservice with Docker
|
||||
|
||||
@@ -32,126 +28,130 @@ docker build -t opea/feedbackmanagement-mongo-server:latest --build-arg https_pr
|
||||
|
||||
### Run Docker with CLI
|
||||
|
||||
1. Run mongoDB image
|
||||
- Run MongoDB image container
|
||||
|
||||
```bash
|
||||
docker run -d -p 27017:27017 --name=mongo mongo:latest
|
||||
```
|
||||
```bash
|
||||
docker run -d -p 27017:27017 --name=mongo mongo:latest
|
||||
```
|
||||
|
||||
2. Run Feedback Management service
|
||||
- Run Feedback Management microservice
|
||||
|
||||
```bash
|
||||
docker run -d --name="feedbackmanagement-mongo-server" -p 6016:6016 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/feedbackmanagement-mongo-server:latest
|
||||
```
|
||||
```bash
|
||||
docker run -d --name="feedbackmanagement-mongo-server" -p 6016:6016 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/feedbackmanagement-mongo-server:latest
|
||||
```
|
||||
|
||||
### Invoke Microservice
|
||||
---
|
||||
|
||||
Once feedback management service is up and running, user can access the database by using API endpoint below. Each API serves different purpose and return appropriate response.
|
||||
### ✅ Invoke Microservice
|
||||
|
||||
- Save feedback data into database.
|
||||
The Feedback Management microservice exposes the following API endpoints:
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"chat_id": "66445d4f71c7eff23d44f78d",
|
||||
"chat_data": {
|
||||
"user": "test",
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are helpful assistant"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "hi",
|
||||
"time": "1724915247"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Hi, may I help you?",
|
||||
"time": "1724915249"
|
||||
}
|
||||
]
|
||||
},
|
||||
"feedback_data": {
|
||||
"comment": "Moderate",
|
||||
"rating": 3,
|
||||
"is_thumbs_up": true
|
||||
}}'
|
||||
- Save feedback data
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"chat_id": "66445d4f71c7eff23d44f78d",
|
||||
"chat_data": {
|
||||
"user": "test",
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are helpful assistant"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "hi",
|
||||
"time": "1724915247"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Hi, may I help you?",
|
||||
"time": "1724915249"
|
||||
}
|
||||
]
|
||||
},
|
||||
"feedback_data": {
|
||||
"comment": "Moderate",
|
||||
"rating": 3,
|
||||
"is_thumbs_up": true
|
||||
}}'
|
||||
|
||||
|
||||
# Take note that chat_id here would be the id get from chathistory_mongo service
|
||||
# If you do not wish to maintain chat history via chathistory_mongo service, you may generate some random uuid for it or just leave it empty.
|
||||
```
|
||||
# Take note that chat_id here would be the id get from chathistory_mongo service
|
||||
# If you do not wish to maintain chat history via chathistory_mongo service, you may generate some random uuid for it or just leave it empty.
|
||||
```
|
||||
|
||||
- Update the feedback data of specified feedback_id
|
||||
- Update feedback data by feedback_id
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"chat_id": "66445d4f71c7eff23d44f78d",
|
||||
"chat_data": {
|
||||
"user": "test",
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are helpful assistant"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "hi",
|
||||
"time": "1724915247"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Hi, may I help you?",
|
||||
"time": "1724915249"
|
||||
}
|
||||
]
|
||||
},
|
||||
"feedback_data": {
|
||||
"comment": "Fair and Moderate answer",
|
||||
"rating": 2,
|
||||
"is_thumbs_up": true
|
||||
},
|
||||
"feedback_id": "{feedback_id of the data that wanted to update}"}'
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"chat_id": "66445d4f71c7eff23d44f78d",
|
||||
"chat_data": {
|
||||
"user": "test",
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are helpful assistant"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "hi",
|
||||
"time": "1724915247"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Hi, may I help you?",
|
||||
"time": "1724915249"
|
||||
}
|
||||
]
|
||||
},
|
||||
"feedback_data": {
|
||||
"comment": "Fair and Moderate answer",
|
||||
"rating": 2,
|
||||
"is_thumbs_up": true
|
||||
},
|
||||
"feedback_id": "{feedback_id of the data that wanted to update}"}'
|
||||
|
||||
# Just include any feedback_data field value that you wanted to update.
|
||||
```
|
||||
# Just include any feedback_data field value that you wanted to update.
|
||||
```
|
||||
|
||||
- Retrieve feedback data from database based on user or feedback_id
|
||||
- Retrieve feedback data by user
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test"}'
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "feedback_id":"{feedback_id returned from save feedback route above}"}'
|
||||
```
|
||||
- Retrieve feedback data by feedback_id
|
||||
|
||||
- Delete feedback data from database based on feedback_id provided
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "feedback_id":"{feedback_id returned from save feedback route above}"}'
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/delete \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "feedback_id":"{feedback_id to be deleted}"}'
|
||||
```
|
||||
- Delete feedback data by feedback_id
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6016/v1/feedback/delete \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "feedback_id":"{feedback_id to be deleted}"}'
|
||||
```
|
||||
|
||||
21
comps/prompt_registry/README.md
Normal file
21
comps/prompt_registry/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# 🧾 Prompt Registry Microservice
|
||||
|
||||
The Prompt Registry microservice facilitates the storage and retrieval of users'preferred prompts by establishing a connection with the databases. This microservice is designed to seamlessly integrate with OPEA applications, enabling data persistence and efficient management of user's preferred prompts.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Features
|
||||
|
||||
- **Store Prompt**: Save user's preferred prompt into database.
|
||||
- **Retrieve Prompt**: Fetch prompt from database based on user, id or even a keyword search.
|
||||
- **Delete Prompt**: Remove prompt from database.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Implementation
|
||||
|
||||
The Prompt Registry microservice able to support various database backends for storing the prompts.
|
||||
|
||||
### Prompt Registry with MongoDB
|
||||
|
||||
For more detail, please refer to this [README](./mongo/README.md)
|
||||
@@ -1,6 +1,8 @@
|
||||
# Prompt Registry Microservice
|
||||
# 🧾 Prompt Registry Microservice with MongoDB
|
||||
|
||||
The Prompt Registry microservice facilitates the storage and retrieval of users'preferred prompts by establishing a connection with the database.
|
||||
This README provides setup guides and all the necessary information about the Prompt Registry microservice with MongoDB database.
|
||||
|
||||
---
|
||||
|
||||
## Setup Environment Variables
|
||||
|
||||
@@ -13,13 +15,7 @@ export DB_NAME=${DB_NAME}
|
||||
export COLLECTION_NAME=${COLLECTION_NAME}
|
||||
```
|
||||
|
||||
## Start Prompt Registry microservice for MongoDB with Python script
|
||||
|
||||
Start document preparation microservice for Milvus with below command.
|
||||
|
||||
```bash
|
||||
python prompt.py
|
||||
```
|
||||
---
|
||||
|
||||
## 🚀Start Microservice with Docker
|
||||
|
||||
@@ -32,72 +28,76 @@ docker build -t opea/promptregistry-mongo-server:latest --build-arg https_proxy=
|
||||
|
||||
### Run Docker with CLI
|
||||
|
||||
1. Run mongoDB image
|
||||
- Run MongoDB image container
|
||||
|
||||
```bash
|
||||
docker run -d -p 27017:27017 --name=mongo mongo:latest
|
||||
```
|
||||
```bash
|
||||
docker run -d -p 27017:27017 --name=mongo mongo:latest
|
||||
```
|
||||
|
||||
2. Run prompt_registry service
|
||||
- Run Prompt Registry microservice
|
||||
|
||||
```bash
|
||||
docker run -d --name="promptregistry-mongo-server" -p 6012:6012 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/promptregistry-mongo-server:latest
|
||||
```
|
||||
```bash
|
||||
docker run -d --name="promptregistry-mongo-server" -p 6012:6012 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/promptregistry-mongo-server:latest
|
||||
```
|
||||
|
||||
### Invoke Microservice
|
||||
---
|
||||
|
||||
Once prompt_registry service is up and running, users can access the database by using API endpoint below. Each API serves different purpose and return appropriate response.
|
||||
### ✅ Invoke Microservice
|
||||
|
||||
- Save prompt into database.
|
||||
The Prompt Registry microservice exposes the following API endpoints:
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"prompt_text": "test prompt", "user": "test"
|
||||
}'
|
||||
```
|
||||
- Save prompt
|
||||
|
||||
- Retrieve prompt from database based on user or prompt_id
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/create \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"prompt_text": "test prompt", "user": "test"
|
||||
}'
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test"}'
|
||||
```
|
||||
- Retrieve prompt from database by user
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "prompt_id":"{prompt_id returned from save prompt route above}"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test"}'
|
||||
```
|
||||
|
||||
- Retrieve relevant prompt based on provided keyword
|
||||
- Retrieve prompt from database by prompt_id
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "prompt_text": "{keyword to search}"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "prompt_id":"{prompt_id returned from save prompt route above}"}'
|
||||
```
|
||||
|
||||
- Delete prompt from database based on prompt_id provided
|
||||
- Retrieve relevant prompt by keyword
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/delete \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "prompt_id":"{prompt_id to be deleted}"}'
|
||||
```
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/get \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "prompt_text": "{keyword to search}"}'
|
||||
```
|
||||
|
||||
- Delete prompt by prompt_id
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
http://{host_ip}:6012/v1/prompt/delete \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"user": "test", "prompt_id":"{prompt_id to be deleted}"}'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user