-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update Document * Update --------- Co-authored-by: ziyuhehe <[email protected]>
- Loading branch information
Showing
17 changed files
with
2,865 additions
and
3,420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...lytics/question-with-bot-routing-api/ask-question-to-bots-in-the-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
sidebar_label: Ask a question with bot routing | ||
title: Ask a question with bot routing | ||
description: This workflow sample demonstrates how to ask a question with bot routing. | ||
--- | ||
|
||
<Available since="MicroStrategy ONE (June 2024)" /> | ||
|
||
Use this API to identify the most suitable bot to answer your question based on the application, content group, and specific bots. | ||
|
||
:::info | ||
|
||
Obtain the authorization token needed to execute the request using [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin). | ||
|
||
::: | ||
|
||
## Ask a question with bot routing | ||
|
||
Endpoint: [POST /api/questions](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/AI%20Chatbot/createQuestion) | ||
|
||
Sample Request Headers: | ||
|
||
| Header | Required | Description | Sample Value | | ||
| ---------------- | -------- | ----------------------------------------------- | -------------------------- | | ||
| X-MSTR-AuthToken | Yes | Authorization Token | t40ltbk411923ipk85r8r0tace | | ||
| Prefer | Yes | The response mode, which must be respond-async. | respond-async | | ||
| Content-Type | Yes | Type of content being sent | application/json | | ||
|
||
Sample Request Query Strings: | ||
|
||
| Query String | Required | Description | Sample Value | | ||
| --------------- | -------- | ------------------------------------------------------ | ----------------------------------------------------------------- | | ||
| applicationId | No | Application ID. If not specified, the default is used. | CDC07694B5F844EC0DA0073EAD71928E | | ||
| botIds | No | Bot IDs, split by commas | FF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B | | ||
| contentGroupIds | No | Content Group IDs, split by commas | 820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B | | ||
| useHistory | No | Use history or start a new chat | false | | ||
|
||
Sample Request Body: | ||
|
||
| Field | Required | Description | Sample Value | | ||
| -------------- | -------- | --------------------------------------------------------------------------- | --------------------------------------- | | ||
| text | Yes | The question text | Which customer has the highest revenue? | | ||
| answers.images | No | Optional. If not specified, the image is not generated. Supports one image. | [\{"width": 200, "height": 300\}] | | ||
|
||
```json | ||
{ | ||
"text": "Which customer has the highest revenue?", | ||
"answers.images": [ | ||
{ | ||
"width": 720, | ||
"height": 405 | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Sample Curl: | ||
|
||
```bash | ||
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions' \ | ||
-X 'POST' \ | ||
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \ | ||
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \ | ||
--header 'Prefer: respond-async' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"text": "Which customer has the highest revenue?", | ||
"answers.images": [ | ||
{ | ||
"width": 720, | ||
"height": 405 | ||
} | ||
] | ||
}' | ||
``` | ||
|
||
Sample Response: | ||
|
||
| Response Code | Status | | ||
| ------------- | ---------------------------------- | | ||
| 202 | Successfully accepted the question | | ||
| 400 | Error in accepting the question | | ||
| 401 | Authorization failed | | ||
| 404 | No bot found | | ||
|
||
Sample Response Body on success: | ||
|
||
```json | ||
{ | ||
"id": "9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890" | ||
} | ||
``` |
106 changes: 106 additions & 0 deletions
106
...stion-with-bot-routing-api/ask-suggested-question-to-bots-in-the-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
sidebar_label: Ask suggested questions with bot routing | ||
title: Ask suggested questions with bot routing | ||
description: This workflow sample demonstrates how to ask suggested questions with bot routing. | ||
--- | ||
|
||
<Available since="MicroStrategy ONE (June 2024)" /> | ||
|
||
This workflow sample demonstrates how to ask suggested questions with bot routing. | ||
|
||
:::info | ||
|
||
Obtain the authorization token needed to execute the request using [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin). | ||
|
||
::: | ||
|
||
## Ask suggested questions with bot routing | ||
|
||
Endpoint: [POST /api/question/suggestions](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Question%20Suggestions/createSuggestions_1) | ||
|
||
Sample Request Header: | ||
|
||
| Header Name | Required | Description | | ||
| ---------------- | -------- | -------------------------------------------------------- | | ||
| X-MSTR-AuthToken | Yes | Authorization token obtained from `POST /api/auth/login` | | ||
| Content-Type | Yes | The body request type, which must be `application/json` | | ||
|
||
Sample Request Query String: | ||
|
||
| Query Parameter | Required | Description | | ||
| --------------- | -------- | ------------------------------------------------------ | | ||
| applicationId | No | Application ID. If not specified, the default is used. | | ||
| botIds | No | Bots IDs, split by commas (`,`) | | ||
| contentGroupIds | No | Content Group IDs, split by commas (`,`) | | ||
| useHistory | No | Use history or start a new chat | | ||
|
||
Sample Request Body: | ||
|
||
```json | ||
{ | ||
"count": 5 // Number of suggested questions to return (1 to 5) | ||
} | ||
``` | ||
|
||
Sample Curl: | ||
|
||
```bash | ||
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/question/suggestions' \ | ||
-X 'POST' \ | ||
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \ | ||
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"count": 5 | ||
}' \ | ||
--get \ | ||
--data-urlencode 'applicationId=CDC07694B5F844EC0DA0073EAD71928E' \ | ||
--data-urlencode 'botIds=FF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B' \ | ||
--data-urlencode 'contentGroupIds=820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B' \ | ||
--data-urlencode 'useHistory=false' | ||
``` | ||
|
||
Sample Response: | ||
|
||
| Response Code | Status | | ||
| ------------- | --------------------------------------------- | | ||
| 200 | Successfully returned the suggested questions | | ||
| 400 | Error in generating the suggested questions | | ||
| 401 | Authorization failed | | ||
| 404 | No bot or bot instance found | | ||
|
||
Sample Response Body on Success: | ||
|
||
```json | ||
{ | ||
"suggestions": [ | ||
{ | ||
"bot": { | ||
"id": "05C0E560558D4EBF83E60875EA2D2A15" | ||
}, | ||
"project": { | ||
"id": "F821C717E9E843728867BF79DE441DC3" | ||
}, | ||
"text": "Which income bracket contributes to most revenue?" | ||
}, | ||
{ | ||
"bot": { | ||
"id": "05C0E560558D4EBF83E60875EA2D2A15" | ||
}, | ||
"project": { | ||
"id": "F821C717E9E843728867BF79DE441DC3" | ||
}, | ||
"text": "Show me the elements of Customer Age." | ||
}, | ||
{ | ||
"bot": { | ||
"id": "05C0E560558D4EBF83E60875EA2D2A15" | ||
}, | ||
"project": { | ||
"id": "F821C717E9E843728867BF79DE441DC3" | ||
}, | ||
"text": "What is the total USS_Revenue for each month?" | ||
} | ||
] | ||
} | ||
``` |
41 changes: 41 additions & 0 deletions
41
...common-workflows/analytics/question-with-bot-routing-api/get-image-of-answer.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
sidebar_label: Get an image of an answer related to a question with bot routing | ||
title: Get an image of an answer related to a question with bot routing | ||
description: This workflow sample demonstrates how to get an image of an answer related to a question with bot routing. | ||
--- | ||
|
||
<Available since="MicroStrategy ONE (June 2024)" /> | ||
|
||
This workflow sample demonstrates how to get an image of an answer related to a question with bot routing. | ||
|
||
:::info | ||
|
||
Obtain the authorization token needed to execute the request using [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin). | ||
|
||
::: | ||
|
||
## Get an image of an answer related to a question with bot routing | ||
|
||
Endpoint: [GET /api/questions/\{questionsId}/answers/images/\{imageId}](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/AI%20Chatbot/getMessageImage) | ||
|
||
:::note | ||
Replace `{questionsId}` in `GET /api/questions/{questionsId}/answers/images/{imageId}` with the question ID from `POST /api/questions` and `{imageId}` with your image ID from `GET /api/questions/{questionId}`. | ||
::: | ||
|
||
Sample Curl: | ||
|
||
```bash | ||
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions/862D61DE2EDD4937B31139B7F574E8EE/answers/images/32A0F79BB4374D4792253B38C1177A6D' \ | ||
-H 'accept: image/png' \ | ||
-H 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \ | ||
``` | ||
|
||
Sample Response: | ||
|
||
| Response Code | Status | | ||
| ------------- | ------------------------------- | | ||
| 200 | Successfully returned the image | | ||
| 400 | Error in getting the image | | ||
| 401 | Authorization failed | | ||
| 403 | Forbidden | | ||
| 404 | Image not found | |
Oops, something went wrong.