You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否在Azure OpenAI Ingestion Job API中指定容器查询?

Azure OpenAI Ingestion Job API 指定虚拟文件夹处理方案

可以在Ingestion Job API中指定虚拟文件夹,只需在请求体的datasource对象里添加prefix字段,指定目标虚拟文件夹的路径即可。

修改你的代码,在containerName下方添加prefix参数:

const endpoint = openaiEndpoint; 
const jobId = indexName; 
const apiVersion = "2024-04-01-preview";

const url = `${endpoint}/openai/ingestion/jobs/${jobId}?api-version=${apiVersion}`;

const requestBody = {
    "kind": "SystemCompute",
    "searchServiceConnection": {
        "kind": "EndpointWithKey",
        "key": searchAdminApiKey, 
        "endpoint": searchEndpoint
    },
    "datasource": {
        "kind": "Storage",
        "storageAccountConnection": {
            "kind": "ConnectionString",
            "connectionString": blobStorageConnectionString
        },
        "containerName": "iverdokument",
        // 添加prefix指定目标虚拟文件夹
        "prefix": "your-target-folder/",
        "chunking": {
            "maxChunkSizeInTokens": 1024
        },
        "embeddings": [
            {
                "connection": {
                    "kind": "RelativeConnection"
                },
                "deploymentName": "Ada"
            }
        ]
    },
    "completionAction": "cleanUpTempAssets"
};

try {
    const response = await fetch(url, {
        method: 'PUT',
        headers: {
            'Content-Type': 'application/json',
            'api-key': openaiApiKey!
        },
        body: JSON.stringify(requestBody)
    });

    if (response.ok) {
        const data = await response.json();
        console.log('Request successful:', data);
        return data;
    } else {
        const errorData = await response.json();
        console.error('Request failed ingestion:', errorData);
    }
} catch (error) {
    console.error('Error:', error);
}

参数说明

  • prefix的值是Blob存储中的虚拟目录路径,格式要以斜杠/结尾(比如目标文件夹是annual-reports,就写annual-reports/)。
  • 指定后,Ingestion Job只会扫描并处理该前缀路径下的所有文件及子文件夹内容,容器内其他路径的文件会被忽略。

内容的提问来源于stack exchange,提问作者Max Claesson

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 02:36:06