Don Chambers
Don Chambers

Reputation: 4289

How do Azure Cognitive Service jobs work?

I am doing an import to the languge service using the import rest api. A repsonse header returns an operation-location, which is a URL for checking the status of the import.

It looks like this:

lang001.cognitiveservices.azure.com:443/language/query-knowledgebases/projects/myProject/import/jobs/d9ac9c56-962f-4a4f-8254-f94feed95a55?api-version=2023-04-01

How can I find infomraiton on this job?

Is it possible to see it in the UI, or to see log informaiton on the job?

Is the job running in the language resource, or the coresponding search resource, or somewhere else?

Upvotes: 0

Views: 72

Answers (1)

Sampath
Sampath

Reputation: 3614

You can get the status, such as succeeded etc , using the jobId Using this link

Below code is to get request to check the deployment status.


const endpoint = "https://<region>.api.cognitiveservices.azure.com"; 
const projectName = "proj1"; //if dont have deployentname keep it as null.
const deploymentName = "Your_deployment_name"; 
const jobId = "your_job_ID"; 
const apiVersion = "2021-10-01";
const subscriptionKey = "your_subscription_key"; 

async function getDeploymentStatus() {
    const url = `${endpoint}/language/query-knowledgebases/projects/${projectName}/deployments/${deploymentName}/jobs/${jobId}?api-version=${apiVersion}`;

    try {
        const response = await fetch(url, {
            method: 'GET',
            headers: {
                'Ocp-Apim-Subscription-Key': subscriptionKey,
                'Content-Type': 'application/json' 
            }
        });

        if (!response.ok) {
            throw new Error(`Error: ${response.status} ${response.statusText}`);
        }

        const data = await response.json();
        console.log('Deployment Status:', data);
    } catch (error) {
        console.error('Failed to fetch deployment status:', error);
    }
}


getDeploymentStatus();

Output:

enter image description here

According to this documentation, in the context of using Azure OpenAI with your data, the job ID for an ingestion job is typically generated when you initiate the ingestion process through Azure OpenAI .

enter image description here

For the image above, go to Language >> Features and select Enable custom question answering. Then, choose the Azure Search resource to link to and enable Custom Text Classification / Custom Named Entity Recognition in storage.

Upvotes: 0

Related Questions