Im following the documentation from Azure on the ingestion job API here: https://learn.microsoft.com/en-us/rest/api/azureopenai/ingestion-jobs/create?view=rest-azureopenai-2024-07-01-preview&tabs=HTTP
No matter the body of my request or the api-key in the request headers, I get { error: { code: ‘404’, message: ‘Resource not found’ } } from the server. The endpoint im using is the one found in the Azure portal under Azure OpenAI resource -> Resource Management -> Keys and Endpoints -> Endpoint. The Azure OpenAI resource is deployed in Sweden Central.
Here is my request code:
const jobId = 'testing2793619'; // The ID of the job to be created
const url = `${openaiEndpoint}/openai/ingestion/jobs/${jobId}?api-version=2024-07-01-preview`;
const requestBody = {
kind: "SystemCompute",
searchServiceConnection: {
kind: "EndpointWithKey",
endpoint: searchEndpoint, // Replace with your Azure AI Search service endpoint,
key: searchAdminApiKey // Replace with your Azure AI Search admin API key
},
datasource: {
kind: "Storage",
connection: {
kind: "ConnectionString",
connectionString: blobStorageConnectionString
},
containerName: "testcontainer",
chunking: {
maxChunkSizeInTokens: 2048 // Customize as needed
}
},
dataRefreshIntervalInHours: 24, // Customize as needed
completionAction: "cleanUpTempAssets" // or "cleanUpTempAssets" depending on your needs
};
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);
}