素材库

检索

请求、对象与响应。

expression 接受表达式;semantic 与 search 接受自然语言。语义检索只返回就绪素材。

表达式语法

指南 →

基础地址与鉴权

表达式检索

POST /media/v1/libraries/{library_id}/search/expression

参数位置类型说明
library_idpathstring库 ID

请求体

字段类型必填说明
expressionstring否结构化查询表达式;空表达式返回全部素材
sort_byobject[]否排序字段与方向
max_resultsinteger否最多 500;检索默认 100,Admin 默认 10
next_cursorstring否下一页游标;没有时为 null 或省略
with_fieldtags / context[]否额外返回 tags 或 context
aggregateAggregateField[]否统计字段

返回: ExpressionSearchResult.

响应

HTTP 200

Successful response.

application/json

名称类型说明
total_countnumberNumber of matching assets across pages; a lower bound when total_count_exact is false.
timenumberElapsed search time in whole milliseconds.
next_cursorstringContinuation token for the next page; omitted when no further page is available.
resourcesarray<object>Assets in this page, ordered by sort_by; tags and context follow with_field.
resources[].asset_idstringGenerated asset identifier: 32 lowercase hexadecimal characters, preserved across overwrites.
resources[].public_idstringDelivery identifier unique within this library, used in asset URLs.
resources[].display_namestringHuman-readable asset name, independent of its delivery identifier.
resources[].asset_folderstringOrganizational folder path; the empty string denotes the root folder.
resources[].resource_typestringStored media category: image for images, video for video or audio, and raw for other files. Upload also accepts auto for detection.
resources[].typestringPublic asset delivery mode; upload is the only supported value.
resources[].formatstringDetected file format used as the delivery URL extension.
resources[].versionnumberMonotonically increasing asset version used in delivery URLs; based on upload time in Unix seconds and advanced on overwrite.
resources[].version_idstringIdentifier for this asset version, regenerated on overwrite.
resources[].bytesnumberSize of the original source content, in bytes.
resources[].etagstringMD5 digest of the source bytes, as 32 lowercase hexadecimal characters.
resources[].widthnumberSource image or video width in pixels, when known.
resources[].heightnumberSource image or video height in pixels, when known.
resources[].durationnumberSource audio or video duration in seconds, when known.
resources[].pagesnumber
resources[].is_audiobooleanTrue for audio-only media, which uses resource_type video.
resources[].original_filenamestringOriginal or overridden source filename with its final extension removed.
resources[].tagsarray<string>Labels attached to the asset.
resources[].contextobjectCustom string metadata; omitted when empty or excluded by the search projection.
resources[].created_atstringTime this asset identity was created, in UTC.
resources[].urlstringURL for retrieving this version of the asset’s original content.
resources[].secure_urlstringHTTPS delivery URL for this asset version; equal to url.
resources[].placeholderbooleanFalse because this response represents stored source content.
resources[].existingboolean
resources[].processingobjectProgress of understanding and embedding tasks for the asset.
resources[].library_idstringIdentifier of the library containing this asset.
resources[].sha256stringSHA-256 digest of the source bytes, as 64 lowercase hexadecimal characters.
resources[].statusstringResource status; active identifies an asset that has not been deleted.
resources[].semanticstringSearch-vector status: pending awaits vector generation or reprocessing; ready has searchable vectors; unavailable indicates disabled, unsupported or failed embedding. Existing vectors may still serve searches while reprocessing is pending.
resources[].previewobjectGenerated video previews, present once preview generation succeeds.
aggregationsobjectRequested facet counts, keyed by facet name and then by field value.
total_count_exactbooleanWhether total_count covers all matches; false indicates a bounded partial count.
aggregations_exactbooleanWhether the returned facet counts cover all matching assets.
curl -X POST "https://api.deepraxis.ai/media/v1/libraries/${LIBRARY_ID}/search/expression" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"expression":"tags:docs"}'

HTTP 200

{
  "total_count": 2,
  "total_count_exact": true,
  "time": 0,
  "resources": [
    {
      "asset_id": "9dfa312ef9bc4b00816339b598b1152c",
      "public_id": "walk-lib-r1-MDP-1791733789929-tagged",
      "display_name": "walk-lib-r1-MDP-1791733789929-tagged",
      "asset_folder": "",
      "resource_type": "image",
      "type": "upload",
      "format": "png",
      "version": 1791733815,
      "version_id": "26cb8171caa5431b8373ad417fd71e32",
      "bytes": 70,
      "etag": "b357a19c87624c7c4d131aeeb4ae677f",
      "width": 1,
      "height": 1,
      "original_filename": "file",
      "processing": {
        "state": "processing",
        "kinds": {
          "embedding": "pending",
          "visual": "running",
          "tagging": "running"
        },
        "updated_at": "2026-10-11T15:50:17.571Z"
      },
      "created_at": "2026-10-11T15:50:15.996Z",
      "url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
      "secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733815/walk-lib-r1-MDP-1791733789929-tagged.png",
      "placeholder": false,
      "library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
      "sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
      "status": "active",
      "semantic": "pending"
    },
    {
      "asset_id": "85b7ef616a8b4719a41777a036ebc1d2",
      "public_id": "walk-lib-r1-MDP-1791733789929-plain",
      "display_name": "walk-lib-r1-MDP-1791733789929-plain",
      "asset_folder": "",
      "resource_type": "image",
      "type": "upload",
      "format": "png",
      "version": 1791733810,
      "version_id": "fdf3c8cd40c2424d86e8397425a69857",
      "bytes": 70,
      "etag": "b357a19c87624c7c4d131aeeb4ae677f",
      "width": 1,
      "height": 1,
      "original_filename": "file",
      "created_at": "2026-10-11T15:50:10.842Z",
      "url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
      "secure_url": "https://media-develop.praxisusercontent.com/lib_d3881a2f54a34cd79121b9d659e8378c/image/upload/v1791733810/walk-lib-r1-MDP-1791733789929-plain.png",
      "placeholder": false,
      "library_id": "lib_d3881a2f54a34cd79121b9d659e8378c",
      "sha256": "497790947d4666760ce38f3c00e852c71fdb66cae849bae8e9ede352719e1581",
      "status": "active",
      "processing": {
        "state": "processing",
        "kinds": {
          "embedding": "pending",
          "visual": "running"
        },
        "updated_at": "2026-10-11T15:50:17.571Z"
      },
      "semantic": "pending"
    }
  ]
}

以图搜图

POST /media/v1/libraries/{library_id}/search/visual

参数位置类型说明
library_idpathstring库 ID

请求体

字段类型必填说明
asset_idAssetId否素材 ID
imageobject否查询图片对象,data 为 base64,mime 为图片类型
top_kinteger否命中数,1–50
filterstring否表达式筛选条件

返回: SemanticSearchResult.

库的 search.image 为 true 时可用;不支持的库返回 LIBRARY_INVALID_STATE。图片仅接受 JPEG、PNG、WebP、GIF,解码后最大 10 MiB。每个素材返回最高分命中,视频定位到最佳帧。qwen3-vl-embedding 的图片相似度门槛为 0.35。标定来自 2026-10-10 的测试:同图变体 0.82–0.96,同类场景 0.38–0.66,无关图片最高 0.34。

asset_id 与 image: { data, mime } 必须且只能给一个。asset_id 复用已有图片理解并排除素材自身;视频使用第一帧,未完成理解返回 LIBRARY_INVALID_STATE。上传图片的 data 为 base64。top_k 默认 20,范围 1–50;filter 使用与 semantic 相同的表达式。仅检索图片相似内容,返回与 semantic 相同的 hits、embedding_producer、not_ready_excluded;matches.kind 为 image,snippet 为最新描述或素材名称。删除、旧版本及已替换的理解不会出现在结果中。

响应

HTTP 200

Successful response.

application/json

名称类型说明
hitsarray<object>Ranked assets up to top_k; an empty array means no eligible matches were found.
hits[].assetobjectAsset matched by the query.
hits[].scorenumberRanking score: cosine similarity for semantic or visual search; normalized rank-fusion score for hybrid search. Higher values rank first.
hits[].semantic_scorenumber | nullCosine similarity for hybrid hits with a semantic match; null for keyword-only hybrid hits. Omitted outside hybrid mode.
hits[].matchesarray<object>Supporting content or metadata matches contributing to this asset’s hit.
embedding_producerstringEmbedding model identifier used for the query, or for the source asset embedding in an asset-based visual query.
not_ready_excludednumberNumber of distinct candidate asset identifiers, or unresolved vector identifiers, excluded because their vectors or assets were missing, deleted or stale; not a count of all pending assets in the library.

语义检索

POST /media/v1/libraries/{library_id}/search/semantic

参数位置类型说明
library_idpathstring库 ID

请求体

字段类型必填说明
querystring是用自然语言描述要找的内容
filterstring否表达式筛选条件
top_kinteger否命中数,1–50
modehybrid / semantic否hybrid 结合关键词与语义;semantic 仅语义

返回: SemanticSearchResult.

使用 bge-m3 时,向量候选在与关键词结果融合前按余弦相似度 ≥ 0.55 筛选,新完成的内容也使用相同门槛。门槛依据 2026-10-09 的 7 个演示素材标定:相关结果最低约 0.58(0.581–0.729),不相关结果最高 0.523;完全无关的查询最高 0.478。qwen3-vl-embedding 的文字查询对文字内容(描述、转写)门槛为 0.40,对图片内容门槛为 0.25;其他模型尚未标定,暂不过滤。关键词命中不受此门槛影响。查询与库内容都不相关时返回空列表;mode=semantic 只返回达到向量门槛的结果。

响应

HTTP 200

Successful response.

application/json

名称类型说明
hitsarray<object>Ranked assets up to top_k; an empty array means no eligible matches were found.
hits[].assetobjectAsset matched by the query.
hits[].scorenumberRanking score: cosine similarity for semantic or visual search; normalized rank-fusion score for hybrid search. Higher values rank first.
hits[].semantic_scorenumber | nullCosine similarity for hybrid hits with a semantic match; null for keyword-only hybrid hits. Omitted outside hybrid mode.
hits[].matchesarray<object>Supporting content or metadata matches contributing to this asset’s hit.
embedding_producerstringEmbedding model identifier used for the query, or for the source asset embedding in an asset-based visual query.
not_ready_excludednumberNumber of distinct candidate asset identifiers, or unresolved vector identifiers, excluded because their vectors or assets were missing, deleted or stale; not a count of all pending assets in the library.

语义检索别名

POST /media/v1/libraries/{library_id}/search

参数位置类型说明
library_idpathstring库 ID

请求体

字段类型必填说明
querystring是用自然语言描述要找的内容
filterstring否表达式筛选条件
top_kinteger否命中数,1–50
modehybrid / semantic否hybrid 结合关键词与语义;semantic 仅语义

返回: SemanticSearchResult.

响应

HTTP 200

Successful response.

application/json

名称类型说明
hitsarray<object>Ranked assets up to top_k; an empty array means no eligible matches were found.
hits[].assetobjectAsset matched by the query.
hits[].scorenumberRanking score: cosine similarity for semantic or visual search; normalized rank-fusion score for hybrid search. Higher values rank first.
hits[].semantic_scorenumber | nullCosine similarity for hybrid hits with a semantic match; null for keyword-only hybrid hits. Omitted outside hybrid mode.
hits[].matchesarray<object>Supporting content or metadata matches contributing to this asset’s hit.
embedding_producerstringEmbedding model identifier used for the query, or for the source asset embedding in an asset-based visual query.
not_ready_excludednumberNumber of distinct candidate asset identifiers, or unresolved vector identifiers, excluded because their vectors or assets were missing, deleted or stale; not a count of all pending assets in the library.

ExpressionSearchResult

字段类型必填说明
total_countnumber是匹配总数
timenumber是检索耗时,整数毫秒,由服务端测得
next_cursorstring否下一页游标;没有时为 null 或省略
resourcesSearchAsset[]是本页素材
aggregationsobject否按请求字段统计
total_count_exactboolean否计数是否精确
aggregations_exactboolean否统计是否精确

SemanticSearchResult

字段类型必填说明
hitsSemanticHit[]是检索命中
embedding_producerstring是语义理解生成者
not_ready_excludednumber是因未就绪而排除的素材数

SearchAsset

字段类型必填说明
asset_idAssetId是素材 ID
public_idstring是交付地址中的素材名称,可带路径
display_namestring是显示名称
asset_folderstring是组织文件夹;不改变 public_id。按它列出时只匹配这一层、不含子文件夹;空字符串表示根
resource_typeResourceType是image、video(含音频)或 raw;auto 只用于上传,列表传 auto 或其他值返回 400
typeDeliveryType是资源或事件类型
formatstring是文件格式
versionnumber是交付版本号
version_idstring是版本标识
bytesnumber是文件字节数
etagstring是文件校验标识
widthnumber否宽度像素
heightnumber否高度像素
durationnumber否时长秒数
pagesnumber否文档页数
is_audioboolean否是否为音频
original_filenamestring否原文件名称
tagsstring[]否素材标签。上传可传逗号分隔字符串(每项去首尾空白、丢弃空项)、数组或重复的 tags 字段;PATCH 只接受数组并整体替换
contextobject否自定义文字键值;PATCH 整体替换,传 {} 清空
created_atIsoTimestamp是创建时间
urlstring是原文件地址
secure_urlstring是HTTPS 交付地址
placeholderfalse是固定为 false
existingboolean否未覆盖时是否返回已有素材
processingProcessing是整体与各项理解状态
library_idLibraryId是库 ID
sha256string是内容校验摘要
status"active"是资源状态
semantic"pending" / "ready" / "unavailable"是ready 时可语义检索
previewobject否预览海报和故事板

SemanticHit

字段类型必填说明
assetAsset是命中的素材
scorenumber是相关度分数
semantic_scorenumber / null否—
matchesSemanticMatch[]是匹配内容与片段时间

SemanticMatch

字段类型必填说明
kindUnderstandingKind / "metadata" / "image"是理解或处理种类;列出理解结果时按此筛选
understanding_idUnderstandingId / null是对应的理解记录;元数据命中为空
segmentSegment / null是起止毫秒;整份素材为 null
snippetstring是命中文字片段
导出

本页内容