Engage App
Initialize a conversation on a designed topic
Initialize a new conversation on a specific topic
POST http://dev-api.med2lab.com/external/v1/engage/topic/init/
Request Body
Name
Type
Description
topic_id*
id
The topic id
Example Output
```json
{
"engage_id": 854,
"topic_id": 16,
"topic_name": "Sale Consultant",
"dialog": [
{
"role": "assistant",
"content": "Hello! Are you looking for recommendations or assistance with choosing a product? I'm here to help you find the perfect solution to meet your needs! (for example: a dress for a birthday party, a new computer for work etc.)"
}
],
"data": null,
"is_end": null
}
```curl --location 'http://dev-api.med2lab.com/external/v1/engage/topic/init/' \
--header 'Authorization: Bearer PHApOPl7xtqc2ZEqg6c6AcL34DYOQk' \
--header 'Content-Type: application/json' \
--data '{
"topic_id": 26
}'import requests
import json
url = "http://dev-api.med2lab.com/external/v1/engage/topic/init/"
payload = json.dumps({
"topic_id": 26
})
headers = {
'Authorization': 'Bearer PHApOPl7xtqc2ZEqg6c6AcL34DYOQk',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://dev-api.med2lab.com/external/v1/engage/topic/init/");
request.Headers.Add("Authorization", "Bearer PHApOPl7xtqc2ZEqg6c6AcL34DYOQk");
var content = new StringContent("{\r\n \"topic_id\": 26\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"topic_id": 26
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://dev-api.med2lab.com/external/v1/engage/topic/init/");
xhr.setRequestHeader("Authorization", "Bearer PHApOPl7xtqc2ZEqg6c6AcL34DYOQk");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);Chat
Chat on a conversation
POST http://dev-api.med2lab.com/external/v1/engage/topic/conversation/
Request Body
Name
Type
Description
engage_id*
id
The engage id
data_chat*
string
Your input
```json
{
"engage_id": 854,
"topic_id": 16,
"topic_name": "Sale Consultant",
"dialog": [
{
"role": "assistant",
"content": "Hello! Are you looking for recommendations or assistance with choosing a product? I'm here to help you find the perfect solution to meet your needs! (for example: a dress for a birthday party, a new computer for work etc.)"
},
{
"role": "user",
"content": "I'm looking for a cool laptop"
},
{
"role": "assistant",
"content": "Great! I can definitely assist you in finding a cool laptop. Could you please provide me with some more information about your requirements? For example, what is your budget for the laptop?",
"is_response": true,
"send_time": "2023-08-29 19:31:44.623622",
"response_time": "2023-08-29 19:31:46.542263",
"latency": "1",
"chatgpt_version": "gpt-3.5-turbo-0613",
"log_id": 14561
}
],
"data": null,
"is_end": null,
"response": "Great! I can definitely assist you in finding a cool laptop. Could you please provide me with some more information about your requirements? For example, what is your budget for the laptop?"
}
```curl --location 'http://dev-api.med2lab.com/external/v1/engage/topic/conversation/' \
--header 'Authorization: Bearer PHApOPl7xtqc2ZEqg6c6AcL34DYOQk' \
--header 'Content-Type: application/json' \
--data '{
"engage_id": 854,
"data_chat": "I'\''m looking for a cool laptop"
}'Last updated