This topic describes the API used to perform a text-based conversational search based on a knowledge base.
Prerequisites
An API key for identity authentication is obtained. When you call the API operations of OpenSearch LLM-Based Conversational Search Edition, you must be authenticated. For more information, see Manage API keys. LLM is short for large language model.
An endpoint is obtained. When you call the API operations of OpenSearch LLM-Based Conversational Search Edition, you must specify an endpoint. For more information, see Obtain endpoints.
Operation information
Request method | Request protocol | Request data format |
POST | HTTP | JSON |
Request URL
{host}/v3/openapi/apps/[app_group_identity]/actions/table-search{host}: the endpoint that is used to call the API operation. You can call the API operation over the Internet or a virtual private cloud (VPC). For more information about how to obtain an endpoint, see Obtain endpoints.{app_group_identity}: the name of the application that you want to access. You can log on to the OpenSearch LLM-Based Conversational Search Edition console and view the application name of the corresponding instance on the Instance Management page.
Request parameters
Header parameters
Parameter | Type | Required | Description | Example |
Content-Type | string | Yes | The data format of the request. Only the JSON format is supported. Set the value to application/json. | application/json |
Authorization | string | Yes | The API key used for request authentication. The value must start with Bearer. | Bearer OS-d1**2a |
Body parameters
Parameter | Type | Required | Description | Example |
question | string | Yes | The question that is asked by the user. | Test |
table_name | string | No | The name of the data table to be queried, which is consistent with the name of the table in the schema. | table1 |
model | string | No | The large language model (LLM) that is used to generate the answer. | |
order_columns | map<String, List<String>> | No | The fields based on which returned results are sorted. The key specifies the table name and the value specifies the field list. | |
fuzzy_columns | array | No | The fields that are used for fuzzy match. |
Sample request body
{
"order_columns": {
"table1": [
{
"column": "column1",
"is_asc": false // Specifies whether to return the results in ascending order. Valid values: true and false.
}
],
"table2": [
{
"column": "column2",
"is_asc": true
}
]
},
"question": "The test question.",
"table_name": "table1,table2",
"model": "The model name.",
"fuzzy_columns": [
"Field 1 that is used for fuzzy match",
"Field 2 that is used for fuzzy match"
]
}Response parameters
Parameter | Type | Description | |
request_id | string | The request ID. | |
status | string | The status of the request. | |
latency | float | The latency of the request. | |
answer | string | The returned result. | |
type | string | The format of the returned result. | |
sql | sql | The returned SQL statement. |
Sample response body
{
"request_id": "17030438251680205838****",
"status": "OK",
"latency": 2144.217381,
"result": {
"data": [
{
"answer": "The answer to the question.",
"type": "TEXT"
}
],
"sql": "The test SQL statement."
}
}