Here's a structured and detailed documentation for the **Smart Search Bar API**, covering all endpoints with specifications, cURL examples, and response formats.
- Start Date: 2025-03-20
- Created by : Kajal Vasar
---
# π **Smart Search Bar API Documentation**
## π **Base URL**
```
https://api.my-buddy.ai
```
---
## π₯ **Endpoints Overview**
| Endpoint | Method | Description |
|-------------------------|---------|--------------------------------|
| `/api/passport` | `GET` | Generate the access token for authorization. |
| `/console/api/smart-guru/searchstart` | `POST` | Fetche the conversation id based on a query. |
| `/console/api/smart-guru/searchstart` | `PUT` | Fetche the conversation name based on query. |
| `/console/api/smart-guru/searchadvisory`| `POST` | Fetche search advisory based on a query. |
| `/console/api/smart-guru/searchproducts` | `POST` | Retrive the Product list. |
| `/console/api/smart-guru/getsorry` | `POST` | Featch Sorry message while product list not getting. |
| `/console/api/smart-guru/${datasetId}/upload-file` | `POST` | Uploads image and video files. |
| `/api/audio-to-text` | `POST` | Uploads audio files for transcription. |
---
## π **1. Generate Access Token**
### π₯ **Endpoint**
```
/api/passport
```
### π₯ **Description**:
Generates an access token required for authorization in further API calls.
### β
**Method**
`GET`
### π **Headers**
| Header | Type | Required | Description |
|----------------|--------|----------|--------------------------------|
| `x-app-code` | String | β
| Unique app identification code |
### π₯ **cURL Example**
```bash
curl --location 'https://api.my-buddy.ai/api/passport' \
--header 'x-app-code: bE0kMG5c5lFO8GUa' \
--header 'Cookie: session=eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlfQ.Z9AjMA.E7bq9wse90gmgPIECV-Tfcw6JVY' \
--data ''
```
### π₯ **Response**
```json
{"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2MGU4Njg4OS01MDVlLTQ3MjAtYjRjZS0zODRhMGI2OWUzZWQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiNjBlODY4ODktNTA1ZS00NzIwLWI0Y2UtMzg0YTBiNjllM2VkIiwiYXBwX2NvZGUiOiJ6NFhIV1lkZmFEWUdpckE2IiwiZW5kX3VzZXJfaWQiOiIzNzI2YWY2Yy0xYjBmLTRlOGItOTViNS1mMWUzYTVmYzI0N2YifQ.oXrpPluwKxv8d7rmyCJF5YtNBjTwepobyQns7leiRMs"}
```
---
## π **2. Fetch Conversation ID**
### π₯ **Endpoint**
```
/console/api/smart-guru/searchstart
```
### π₯ **Description**:
Fetches a conversation ID based on a query.
### β
**Method**
`POST`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Bearer token |
| `Content-Type` | application/json|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `agentid` | String | β
| Agent Id |
| `filters` | String | β
| Filters data defult pass ""|
| `numofrecords` | Integer | β
| Number of records (default: 10)|
| `user_input` | String | β
| Search query |
| `user` | String | β
| Default pass "" |
### π₯ **cURL Example**
```bash
curl --location 'https://api.my-buddy.ai/console/api/smart-guru/searchstart' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2MGU4Njg4OS01MDVlLTQ3MjAtYjRjZS0zODRhMGI2OWUzZWQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiNjBlODY4ODktNTA1ZS00NzIwLWI0Y2UtMzg0YTBiNjllM2VkIiwiYXBwX2NvZGUiOiJ6NFhIV1lkZmFEWUdpckE2IiwiZW5kX3VzZXJfaWQiOiIzNzI2YWY2Yy0xYjBmLTRlOGItOTViNS1mMWUzYTVmYzI0N2YifQ.oXrpPluwKxv8d7rmyCJF5YtNBjTwepobyQns7leiRMs' \
--header 'Cookie: session=eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlfQ.Z9q9Cw.l-nY4ZNx3i_B2lO8IRioNtro5FA' \
--data '{
"agentid":"public",
"user_input": "laptop",
"filters": "",
"numofrecords": 10,
"user":""
}
'
```
### π₯ **Response**
```json
{
"guid": "7a4ffa4a-62be-4063-892d-fd47d6bfcb94"
}
```
---
## π **3. Fetch Conversation Name**
### π₯ **Endpoint**
```
/console/api/smart-guru/searchstart
```
### π₯ **Description:**
Fetches the conversation name based on a query.
### β
**Method**
`PUT`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Bearer token |
| `Content-Type` | application/json|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `agentid` | String | β
| Agent Id |
| `filters` | String | β
| Filters data defult pass ""|
| `numofrecords` | Integer | β
| Number of records (default: 10)|
| `user_input` | String | β
| Search query |
| `user` | String | β
| Default pass "" |
### π₯ **cURL Example**
```bash
curl --location --request PUT 'https://api.my-buddy.ai/console/api/smart-guru/searchstart' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2MGU4Njg4OS01MDVlLTQ3MjAtYjRjZS0zODRhMGI2OWUzZWQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiNjBlODY4ODktNTA1ZS00NzIwLWI0Y2UtMzg0YTBiNjllM2VkIiwiYXBwX2NvZGUiOiJ6NFhIV1lkZmFEWUdpckE2IiwiZW5kX3VzZXJfaWQiOiIzNzI2YWY2Yy0xYjBmLTRlOGItOTViNS1mMWUzYTVmYzI0N2YifQ.oXrpPluwKxv8d7rmyCJF5YtNBjTwepobyQns7leiRMs' \
--header 'Cookie: session=eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlfQ.Z9q9RA.Ve1NlwXgwI_lY19AQl6syBD0xZk' \
--data '{
"agentid":"public",
"user_input": "laptop",
"filters": "",
"numofrecords": 10,
"user":""
}
'
```
### π₯ **Response**
```json
{
"conversation_name": "Chat About Laptops and More"
}
```
---
## π **4. Fetch Search Advisory**
### π₯ **Endpoint**
```
/console/api/smart-guru/searchadvisory
```
### π₯ **Description:**
Fetches advisory results based on a query
### β
**Method**
`POST`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Bearer token |
| `Content-Type` | application/json|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `agentid` | String | β
| Agent Id |
| `conversationid` | String | β
| Conversation Id |
| `last_advisory` | String | β
| Previous advisory response |
| `filters` | String | β
| Filters data defult pass ""|
| `numofrecords` | Integer | β
| Number of records (default: 10)|
| `user_input` | String | β
| Search query |
| `files` | Array | β
| Default pass [] |
### π₯ **cURL Example**
```bash
curl --location 'https://api.my-buddy.ai/console/api/smart-guru/searchadvisory' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2MGU4Njg4OS01MDVlLTQ3MjAtYjRjZS0zODRhMGI2OWUzZWQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiNjBlODY4ODktNTA1ZS00NzIwLWI0Y2UtMzg0YTBiNjllM2VkIiwiYXBwX2NvZGUiOiJ6NFhIV1lkZmFEWUdpckE2IiwiZW5kX3VzZXJfaWQiOiIzNzI2YWY2Yy0xYjBmLTRlOGItOTViNS1mMWUzYTVmYzI0N2YifQ.oXrpPluwKxv8d7rmyCJF5YtNBjTwepobyQns7leiRMs' \
--header 'Cookie: session=eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlfQ.Z9q-wA.Qg7-bSs6rqeUle9vXc0XwJYLvg4' \
--data '{
"agentid":"public",
"conversationid":"b656119a-32fd-41a0-a957-527f4de93e72",
"user_input": "laptop",
"filters": "",
"numofrecords": 10,
"files": [],
"last_advisory": ""
}
'
```
### π₯ **Response**
```json
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":"Could"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" you"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" please"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" specify"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" what"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" type"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" of"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnFADpvFLL9lNqMxs4SKpFgZmjFA","object":"chat.completion.chunk","created":1742388928,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" laptop"},"logprobs":null,"finish_reason":null}]}
```
---
## π **5. Retrieve Product List**
### π₯ **Endpoint**
```
/console/api/smart-guru/searchproducts
```
### π₯ **Description:**
Retrieves a list of products.
### β
**Method**
`POST`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Bearer token |
| `Content-Type` | application/json|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `agentid` | String | β
| Agent Id |
| `conversationid` | String | β
| Conversation Id |
| `last_advisory` | String | β
| Previous advisory response |
| `filters` | String | β
| Filters data defult pass ""|
| `numofrecords` | Integer | β
| Number of records (default: 10)|
| `page` | Integer | β
| Page Number (default: 1)|
| `user_input` | String | β
| Search query |
| `isrethink` | Boolean | β
| Default pass `false`
### π₯ **cURL Example**
```bash
curl --location 'https://api.my-buddy.ai/console/api/smart-guru/searchproducts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2MGU4Njg4OS01MDVlLTQ3MjAtYjRjZS0zODRhMGI2OWUzZWQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiNjBlODY4ODktNTA1ZS00NzIwLWI0Y2UtMzg0YTBiNjllM2VkIiwiYXBwX2NvZGUiOiJ6NFhIV1lkZmFEWUdpckE2IiwiZW5kX3VzZXJfaWQiOiJiYzU5NzA3Zi00OThiLTQyMTgtYjY4YS02MzhiMDA1MTY4YTgifQ.Kq27y_qWgKRccBjKxypobAPisSGLMoVCG0kz5MNePXg' \
--header 'Cookie: session=eyJfZnJlc2giOmZhbHNlLCJfcGVybWFuZW50Ijp0cnVlfQ.Z9rBuA.Nxln6cqLACb5yQ0NNV7gJoSN5yI' \
--data '{
"agentid":"public",
"conversationid":"b656119a-32fd-41a0-a957-527f4de93e72",
"user_input": "laptop",
"filters": "",
"numofrecords": 10,
"isrethink": false,
"last_advisory": "",
"page":1
}
'
```
### π₯ **Response**
```json
{"products": [{"id": "1954933", "title": "Asus Vivobook Go 15 E510KA-BR136WS 15.6'' HD Anti-Glare (Celeron N4500/4GB/128GB eMMC/HD Graphics/Win11HomeS) Laptop", "description": "Processor Brand Intel, Release Year 2023, Experts Rating Economy, Processor Cores 2, Processor Architecture Jasper Lake, USB 2.0 1x USB 2.0, Dimensions (LxWxH) 36.02 x 23.64 x 1.81 cm, Weight 1.57 kg, Touchscreen No, Processor Model N4500, Wi-Fi Wi-Fi 5 (802.11ac), HDMI 1x HDMI 1.4, Graphics Memory Shared, Bluetooth 5.1, Disk Type eMMC, Disk Capacity 128 GB eMMC, Warranty 24 months, Camera 720p HD, Anti-Glare Display Technology, Model Vivobook Go 15 E510KA-BR136WS, Recommended Use Mainstream, RAM 4 GB, Battery 42WHrs, 3-cell Li-ion, Operating System Windows 11 Home S Ideal for everyday tasks such as browsing, streaming, and document editing. Suitable for students and professionals seeking an economical laptop for mainstream use.", "image_link": "https://external.webstorage.gr/mmimages/image/56/10/96/47/1954933-ASUS-hero-800x800.jpg", "price": 279.0, "format_price": "\u20ac279.00", "link": "/product/computers-and-software/laptops/asus-vivobook-go-15-e510ka-br136ws-156-hd-anti-glare-celeron-n45004gb128gb-emmchd-graphicswin11homes-laptop/1954933", "score": 0.43574825, "goldlist": true, "sku": "1954933", "record_id": 3437, "rerank_score": 0.28451186}, {"id": "1907253", "title": "Asus X1504ZA-BQ638W 15.6'' FHD IPS (Core i3-1215U/8GB/512GB SSD/UHD Graphics/Win11Home) Laptop", "description": "Processor Brand Intel, Release Year 2022, Experts Rating Economy, Processor Cores 6, Processor Architecture Alder Lake, USB 2.0 1x USB 2.0, Dimensions (WxDxH) 35.97 x 23.25 x 1.79 cm, Weight 1.70 kg, Touch Screen No, Processor Model 1215U, Wi-Fi Wi-Fi 6E (802.11ax), HDMI 1x HDMI 1.4, Memory Slots 2, Model X1504ZA-BQ638W, Screen Resolution 1920 x 1080. Ideal for everyday tasks such as browsing, streaming, and office applications, this laptop is perfect for students and professionals seeking a reliable and efficient computing experience.", "image_link": "https://external.webstorage.gr/mmimages/image/71/94/6/33/1907253-ASUS-hero-800x800.jpg", "price": 429.0, "format_price": "\u20ac429.00", "link": "/product/computers-and-software/laptops/asus-x1504za-bq638w-156-fhd-ips-core-i3-1215u8gb512gb-ssduhd-graphicswin11home-laptop/1907253", "score": 0.4351793, "goldlist": true, "sku": "1907253", "record_id": 2351, "rerank_score": 0.31875068}]}
```
## π **6. Fetch Sorry Message**
### π₯ **Endpoint**
```
/console/api/smart-guru/getsorry
```
### π₯ **Description:**
Returns a sorry message if no products are found.
### β
**Method**
`POST`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Bearer token |
| `Content-Type` | application/json|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `agentid` | String | β
| Agent Id |
| `conversationid` | String | β
| Conversation Id |
| `filters` | String | β
| Filters data defult pass ""|
| `numofrecords` | Integer | β
| Number of records (default: 10)|
| `user_input` | String | β
| Search query |
| `files` | Array | β
| Default pass [] |
### π₯ **cURL Example**
```bash
curl --location 'https://api.my-buddy.ai/console/api/smart-guru/getsorry' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI2MGU4Njg4OS01MDVlLTQ3MjAtYjRjZS0zODRhMGI2OWUzZWQiLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiNjBlODY4ODktNTA1ZS00NzIwLWI0Y2UtMzg0YTBiNjllM2VkIiwiYXBwX2NvZGUiOiJ6NFhIV1lkZmFEWUdpckE2IiwiZW5kX3VzZXJfaWQiOiJiYzU5NzA3Zi00OThiLTQyMTgtYjY4YS02MzhiMDA1MTY4YTgifQ.Kq27y_qWgKRccBjKxypobAPisSGLMoVCG0kz5MNePXg' \
--data '{
"agentid":"public",
"conversationid":"7e6b5887-30b0-40af-ad26-2fe8c8fe149a",
"user_input": "laptop below 50000",
"filters": "",
"numofrecords": 10,
"files": [],
}
'
```
### π₯ **Response**
``` json
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":"We"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" are"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" sorry"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":","},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" but"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" we"},"logprobs":null,"finish_reason":null}]}
data: {"id":"chatcmpl-BCnv5ppUjnlZ6vIknHjiroLNcbEr7","object":"chat.completion.chunk","created":1742391527,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_b8bc95a0ac","choices":[{"index":0,"delta":{"content":" could"},"logprobs":null,"finish_reason":null}]}
```
## π **7. Upload Image/Video File**
### π₯ **Endpoint**
```
/console/api/smart-guru/${datasetId}/upload-file
```
### π₯ **Description:**
Uploads image and video files.take My-Buddy Knowledge ID as `${datasetId}`
### β
**Method**
`POST`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Dataset API Key |
| `Content-Type` | multipart/form-data|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `image` | Binary | β
| Binary data of file |
### π₯ **cURL Example**
```bash
curl --location 'https://api.my-buddy.ai/console/api/smart-guru/20270094-25ee-4a85-afe7-58fb6bf0aaa2/upload-file' \
--header 'authorization: Bearer dataset-Df1ndopL53F6p6mUY1NIZ9qK' \
--form 'image=@"/C:/Users/theonetech161/Downloads/mbaBg.png"'
```
### π₯ **Resposne**
```json
{
"status": true,
"message": "",
"result": "https://devstorage5f80bd89.blob.core.windows.net/files/recommendation/20270094-25ee-4a85-afe7-58fb6bf0aaa2/bc6b495191d343718690dd62e296fafb.png"
}
```
## π **8. Upload Audio for Transcription**
### π₯ **Endpoint**
```
/api/audio-to-text
```
### π₯ **Description:**
Uploads audio files for transcription.
### β
**Method**
`POST`
### π **Headers**
| Header | Type | Required | Description |
|---------------- |--------|----------|--------------------------------|
| `Authorization` | String | β
| Bearer token |
| `Content-Type` | multipart/form-data|
### π **Query Parameters**
| Parameter | Type | Required | Description |
|-------------- |---------|---------- |---------------------------|
| `file` | Binary | β
| Binary data of file |
### π₯ **cURL Example**
```bash
curl 'https://api.my-buddy.ai/api/audio-to-text' \
-H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxNTE2ZDEwZS1iZjU0LTQ2ZDEtOTYwOC1mZjQ4OGM0MWVlNzciLCJzdWIiOiJXZWIgQVBJIFBhc3Nwb3J0IiwiYXBwX2lkIjoiMTUxNmQxMGUtYmY1NC00NmQxLTk2MDgtZmY0ODhjNDFlZTc3IiwiYXBwX2NvZGUiOiJiRTBrTUc1YzVsRk84R1VhIiwiZW5kX3VzZXJfaWQiOiJlZDZhZDFmYS1iZDVkLTQ3NTQtOGIyMC03NDAzZjJhMjZjM2YifQ._FeE98zuQRehVt3GHUjFQoSKtjdHpW8F1e3PVOhyJSM' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryyoFkJVHdYyPMoNZq' \
-b '_ga=GA1.1.1383008936.1742359312; ARRAffinity=4d142f67c5e53faf3e36b608423229c53d942da3db8451e91a3902c20322417b;ARRAffinitySameSite=4d142f67c5e53faf3e36b608423229c53d942da3db8451e91a3902c20322417b; _ga_8DWJ912ZCB=GS1.1.1742446646.5.0.1742446646.60.0.569491654; session=.eJx9kWtLwzAUhv9LQD9tXZp0bVYYXhmKlzkZOv1STpO0i65dzaUo6n83nTIHgpAPJ-e8PHnIeUdZoaVZorSAlZE9lDVSV1DL2qLUauc7zkiN0ncETqAUjR4WL1e31xNGqsk0bqvZLGTykZn7s6PZ-XFpUc8H7TKzqpIoDZMopDSmCe0hWYFaeYKnr5-CFlYAh9VbP3dCvAWg0E8ia6VWhZJiqyRfmx9SQmgS95ACu4PuGsZ48NLaxqSDwRYqXdC54ICvq4Hn19A5_SNQK_78N-QHjeLWabnziAlKDS1Y0Bv6dzkgESUipnnEaQgRLciwKGSYjEa84CKR7MCMI4b39bgp98V4w9qjR3tk4g8X9a-uv38jja8qCJq69BpGdSu4zCbzcHFzOl20F86uSnp-chzO56aP2_XdCY-7oMt9cEP7iBMOUNBIsFHMgeW5gBwPo9zHXCPASpF1_4kIJsM-pn2czDFLKUmHNMCYPaLPzy-BkayP.Z9uyTg.adfVUzZ5xHokOZodbCXChSA_dGY' \
--data-raw $'------WebKitFormBoundaryyoFkJVHdYyPMoNZq\r\nContent-Disposition: form-data; name="file"; filename="temp.mp3"\r\nContent-Type: audio/mp3\r\n\r\nΓΏΓ³ΓΓ\u0000\u0000\u0000\u0003H\u0000\u0000\u0000\u0000\r\n------WebKitFormBoundaryyoFkJVHdYyPMoNZq--\r\n'
```
### π₯ **Resposne**
```json
{
"text": "It's lovely. It's good."
}
```
---
## π **Flow Overview**
#### 1. **Initiate the Search: Fetch Conversation ID**
- **API:** `/console/api/smart-guru/searchstart` (POST)
- **Purpose:**
- This is the first step in the flow. It creates a **conversation session** and generates a `conversationId`.
- This ID is required for all subsequent API calls to **track and link** the current conversation.
- **Next Step:**
- Upon successful retrieval of the `conversationId`, the flow continues with **parallel API calls**.
---
#### 2. **Parallel Execution: Fetch Name & Product List**
Once the `conversationId` is obtained, two APIs are called in **parallel**:
- **A) Fetch Conversation Name**
- **API:** `/console/api/smart-guru/searchstart` (PUT)
- **Purpose:**
- Retrieves the **name** of the conversation based on the `conversationId`.
- **Usage:**
- The conversation name can be used for **display or logging** purposes.
- **B) Fetch Product List**
- **API:** `/console/api/smart-guru/searchproducts` (POST)
- **Purpose:**
- Retrieves a **list of products** based on the current search query.
- **Response:**
- If products are found, the flow proceeds to the **advisory retrieval step**.
- If no products are returned, the flow handles this by retrying with `isRethink=true`.
---
#### 3. **Product List Handling**
After calling the product list API:
- **Scenario 1: Products Found**
- If the product list is **not empty**, the flow proceeds to **fetch advisories**.
- **Scenario 2: Products Empty**
- If no products are returned:
- The flow **retries the product API** with the parameter `isRethink=true`.
- This retry attempts to fetch alternative products.
---
#### 4. **Retry Logic and Fallback**
- If the retry API call returns:
- **Products found:** Proceed to **fetch advisory**.
- **Products still empty:**
- The flow checks whether the **advisory has already been shown**.
- If the advisory was shown:
- The **"Sorry" API** is called to display a message indicating that no products are available.
- If the advisory hasn't been shown:
- The flow proceeds to the **advisory retrieval step**.
---
#### 5. **Fetch Advisory**
- **API:** `/console/api/smart-guru/searchadvisory` (POST)
- **Purpose:**
- Fetches **advisory suggestions** based on the query.
- Advisories are displayed as **helpful tips or recommendations**.
- **Usage:**
- Shown only if products are returned successfully or if products are empty and advisories haven't been displayed yet.
---
#### 6. **Fallback: Display Sorry Message**
If no products are found even after:
- **Retrying the product API** with `isRethink=true`, and
- Displaying the advisory message,
The system calls the **Sorry API**:
- **API:** `/console/api/smart-guru/getsorry` (POST)
- **Purpose:**
- Displays a **"Sorry" message** informing the user that no products are available.
- **Usage:**
- Ensures the user receives a graceful message even if no products are found.
---
### π€ **File Upload Process**
- **API:** `/console/api/smart-guru/${datasetId}/upload-file` (POST)
- **Purpose:**
- Uploads **image or video files** related to the search context.
- **Supported File Types:**
- `image/jpeg`
- `image/png`
- `image/gif`
- `video/mp4`
- `video/webm`
- `video/ogg`
- **Max File Size:** `15 MB`
- **Usage:**
- Uploaded files are linked to the current `conversationId` for further processing. its retrun the blob url to use further.
---
### ποΈ **Voice-to-Text Flow**
- **API:** `/api/audio-to-text` (POST)
- **Purpose:**
- Converts **audio files** into text for use in the product and advisory flow.
- **Process:**
1. Upload an audio file to the API.
2. The API returns the **transcribed text**.
3. Use the transcribed text to call:
- **Product List API**
- **Advisory API**
4. Continue with the regular flow for product retrieval, advisories, and fallback.
---
### π **Flow Execution Logic**
```plaintext
[START]
β
Fetch Conversation ID
β
[Parallel Execution]
βββ> Fetch Conversation Name
βββ> Fetch Product List
β
Is Product List Empty?
β
βββββββββββββββββ¬ββββββββββββββββ
β No β Yes β
β β β
Fetch Advisory Retry Product with isRethink=true
β β
β β
β Is Product Still Empty?
β β
β β
β ββββββββββββ¬βββββββββββ
β β No β Yes β
β β β β
β Show Advisory Call Sorry API
β β
β β
β [END - Display Sorry Message]
β
β
β
β
[END - Show Advisory ]
```
---
### π₯ **Key Points:**
- **Sequential Execution:**
- The flow starts with the conversation ID retrieval and proceeds to parallel API calls.
- **Parallel Execution:**
- Simultaneous calls for fetching conversation name and product list.
- **Retry Logic:**
- If no products are found, the API retries with `isRethink=true`.
- **Fallback:**
- If no products are available after retrying, the Sorry API is called.
- **File Upload:**
- Supports images and videos up to `15 MB`.
- **Voice-to-Text:**
- Converts audio to text and uses the transcribed text in the product search flow.
---