AI Search Engine API
Overview
The CleverSee AI Search and Question Answering Platform provides a search API that enables precise searches across images, documents, and audio/video content within your datasets. After building a search application on the platform, you can use the application's API to query your data. The API supports multimodal inputs, including natural language text, images, or a combination of both. This allows for quick adaptation to large-scale data search scenarios and helps you efficiently locate target content.
API
You can use this API with two types of search applications created on the CleverSee AI Search and Question Answering Platform: image search applications for text-to-image, image-to-image, and mixed text-and-image searches; and audio and video search applications for text-to-audio/video, image-to-video, and mixed text-and-image-to-video searches.
Data sources
This API supports audio and video data, which you can upload and update through the CleverSee AI Search and Question Answering Platform user interface or by using the Add/Update dataset data API.
Authentication method
Use the Alibaba Cloud SDK to call the CleverSee - AI Search Engine service. For detailed instructions, see AI Search Engine API.
Request parameters
Parameters
Parameter | Type | Required | Description | Example | |
appId | String | Yes | The unique ID of the application. |
| |
query | Object | Yes | The query object. | (See sub-parameters) | |
├─ | texts | Array[String] | No | An array of text queries. |
|
├─ | imageUrl | Array[String] | No | An array of image URLs for queries. • Currently, only one image URL is supported. The maximum image size is 10 MB. Supported formats: JPG, PNG, WEBP, and JPEG. |
|
├─ | pageSize | Integer | Yes | The number of results to return per page. |
|
├─ | pageNo | Integer | No | The page number, starting from 1. • Default value: |
|
└─ | excludeIds | Array[String] | No | A list of primary key IDs to exclude from the results. • Use this to filter out items that have already been viewed. |
|
user | Object | No | User information object for user-centric analytics. | (See sub-parameters) | |
└─ | userId | String | No | The unique ID of the end user. |
|
Request example
Example of a standard request
JSON format
curl -X POST 'https://aisearchengine.aliyuncs.com/api/v1/platform/app/search' \
-H 'Content-Type: application/json' \
-H "Date: $(LC_ALL=C date -u +'%a, %d %b %Y %H:%M:%S GMT')" \
-H 'x-acs-apikey: ALS*****' \
-d '{
"appId": "your app id",
"query": {
"texts": ["little girl"],
"imageUrls": ["https://your-image-url.com/image.jpg"],
"pageSize": 10,
"pageNo": 1
}
}'Response parameters
3.1 Top-level structure
Parameter | Type | Description | Example | |
code | Integer | The status code. A value of |
| |
message | String | The response message. |
| |
requestId | String | The request ID for troubleshooting. |
| |
data | Object | The business data object. | (See sub-parameters) | |
├─ | size | Integer | The number of results per page, matching the |
|
├─ | page | Integer | The current page number. |
|
├─ | total | Integer | The number of results returned on the current page. |
|
├─ | traceInfo | Null | Trace information. |
|
└─ | extra | Object | Additional metadata. Note The exclude_ids field specifies the list of excluded IDs, and its format is
| {exclude_ids: ["id_1", "id_2"]} |
items | Array[Object] | A list of search result items. The detailed structure is described below. | (See section 3.2) | |
status | String | The business status code as a string. |
| |
errorMessage | Null | The error message. This is |
|
3.2 items structure
Each object in the items array represents a search result. The specific attributes within the content field vary depending on the media type (image, video, or audio). The following is the general structure and the fields specific to video/audio:
Image search items
Parameter | Type | Description | Example | |
score | Float | The relevance score. |
| |
content | Object | The content details object. | (See sub-parameters) | |
├─ | image_url | String | The URL of the image. • The URL includes a signature and is valid for 24 hours after it is generated. |
|
├─ | s_name | String | The original file name. |
|
├─ | pk_id | String | The primary key ID of the original resource. |
|
└─ | s_dataset_id | String | The ID of the resource's dataset. |
|
Audio and video search items
Parameter | Type | Description | Example | |
score | Float | The relevance score. |
| |
content | Object | The content details object. | (See sub-parameters) | |
├─ | s_raw_cover_pic | String | The URL of the cover image for the full video. • The URL includes a signature and is valid for 24 hours after it is generated. • The audio/plain text result is |
|
├─ | s_segment_cover_pic | String | The URL of the cover image for the video segment. • The URL includes a signature and is valid for 24 hours after it is generated. • The audio or plain text result is |
|
├─ | s_raw_file_path | String | The URL of the media file. • The URL includes a signature and is valid for 24 hours after it is generated. • Supported formats include MP4, MP3, and JPG. |
|
├─ | s_name | String | The original file name. |
|
├─ | pk_id | String | The primary key ID of the original resource. |
|
├─ | s_dataset_id | String | The ID of the resource's dataset. |
|
├─ | s_segment_start_millisecond | Integer | The start time of the segment in milliseconds. • This value can be |
|
├─ | s_segment_end_millisecond | Integer | The end time of the segment in milliseconds. • This value can be |
|
├─ | s_raw_length | Integer | The duration of the file in milliseconds. |
|
├─ | s_video_type | String | Video type tag. • An AI-derived category tag for the video. The value is one of the following:
|
|
├─ | s_video_topic | String | Video topic tag. • An AI-derived tag for the video's core topic. The value is not from a predefined list. |
|
├─ | s_global_summary | String | Global summary tag. • An AI-derived, video-level summary of the core content. The value is not from a predefined list. |
|
└─ | s_global_keywords | String | Global keywords tag. • Two to four keywords that summarize the video content. These are AI-derived tags, and the values are not from a predefined list. |
|
Response examples
Successful image search response
JSON format
{
"code": 200,
"message": "success",
"data": {
"size": 1,
"page": 1,
"total": 1,
"traceInfo": null,
"extra": {
"exclude_ids": ["3f95b343xxxxxxxxxxxx"]
},
"items": [
{
"id": "3f95b343xxxxxxxxxxxx",
"score": 0.8029279573006508,
"content": {
"s_name": "sample_image.png",
"image_url": "https://.../image.png?Expires=...",
"pk_id": "3f95b343xxxxxxxxxxxx",
"s_dataset_id": "594"
},
"algorithm": {},
"traceInfo": null
}
],
"status": "200",
"errorMessage": null
},
"requestId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}Successful video search response
JSON format
{
"code": 200,
"data": {
"total": 1,
"size": 1,
"traceInfo": null,
"extra": {
"exclude_ids": ["01XXXXXXXXXXXXXXX"]
},
"errorMessage": null,
"page": 1,
"items": [{
"score": 0.577594,
"traceInfo": null,
"id": "01XXXXXXXXXXXXXXX",
"content": {
"s_raw_file_path": "https://.../video.mp4?Expires=...",
"s_raw_length": 1036122,
"pk_id": "01XXXXXXXXXXXXXXX",
"s_global_summary": "The first half of the video focuses on the conflicts and collaborations between characters, showing complex relationships and emotional changes through multiple plot points, including chases, dialogues, and investigations. The second half shifts to a stage performance, showcasing a singer's live performance and audience interaction at a large event. The overall content combines narrative storytelling with musical performance elements.",
"s_raw_cover_pic": "https://.../frame_1.jpg?Expires=...",
"s_name": "demo_video.mp4",
"s_dataset_id": "833",
"s_global_keywords": "Plot interaction, Character relationships, Investigation and chase, Musical performance, Stage singing",
"s_video_topic": "Plot content and musical performance",
"s_video_type": "Film/Variety Show"
},
"algorithm": {}
}],
"status": "200"
},
"requestId": "xxxxxxxxxxxxxxxxxxxxxxxx",
"message": "success"
}Error codes
HTTP status code | Error code | Error message | Description |
500 |
|
| An internal system error occurred. |
403 |
|
| You do not have permission to access this application. |
400 |
|
| One or more parameters are invalid. |
404 |
|
| The specified application was not found. |
407 |
|
| The request was denied due to a potential privilege escalation. |
405 |
|
| The input text exceeds the maximum allowed length. |
406 |
|
| The number of images exceeds the maximum limit. |
Multimedia resources in search results
To get the URLs for media resources in a dataset, see Get presigned URLs for multimedia resources (images, videos) in search results API.