Answer Generation API
This API allows you to fetch answers to a query from SearchAI corresponding to the input query and the meta filters sent in the request body. Additionally, this API also returns debug information about the qualified chunks used to generate answers.
Method
|
POST
|
Endpoint
|
https://{{host}}/api/public/stream/{{AppID}}/advancedSearch
|
Content Type
|
application/json
|
Authorization
|
auth: {{JWT}}
See How to generate the JWT Token.
|
API Scope
|
|
Query Parameters
PARAMETER
|
REQUIRED
|
DESCRIPTION
|
host
|
Required
|
The environment URL. For example, https://platform.kore.ai
|
App ID
|
Required
|
Unique Identifier of your application. To view your App ID, go to the Dev Tools under App Settings and open your JWT App.
|
Sample Request
curl --location 'https://platform.kore.ai/api/public/stream/st-3beea617-cfd5-5224-b70b-656c4eef768e/advancedSearch' \
--header 'auth: eyJhbGciOiJnR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiYXBwSWQiOiJjcy05Yzg5MGMwOS1kMzQ5LTUzZjctYmIwZC1jYWEwZGIwOGNmMTkifQ.K2DWFPthcsTlltPTcR1irzjlxr4LYUzknxeTRfANolo' \
--header 'Content-Type: application/json' \
--data '{
"query": "Conversational AI",
"metaFilters": [{
"condition": "AND",
"rules": [
{
"fieldName": "sourceType",
"fieldValue": [
"file"
],
"operator": "contains"
}
]
}]
}'
Body Parameters
PARAMETER
|
REQUIRED
|
DESCRIPTION
|
query
|
Yes
|
Query string for search
|
metaFilter
|
No
|
This parameter can be used to define rules to filter out the results from the Answer Index before using them for generating the answer. This parameter takes an array of rules with conditions. For instance, to use only web pages to answer a query, set the filters as shown below.
"metaFilters": [
{
"condition": "AND",
"rules": [
{
"fieldName": "sourceType",
"fieldValue": [
"web"
],
"operator": "contains"
}]
}]
|
answerSearch
|
No
|
This can be set to true or false. When set to ‘true’, the response will include answers. Conversely, when set to ‘false’, the response will omit the answer to the query. However, you can still use the includeChunksInResponse field to see the qualified chunks in the response. By default, it is set to true.
|
includeChunksInResponse |
No |
This can be set to true or false. When set to true, the response will also include a list of qualified chunks along with other parameters. The chunk information is stored in the response's chunk_result field. |