Condividi tramite


TextAnalysisClient.AnalyzeTextSubmitOperationAsync Method

Definition

Overloads

AnalyzeTextSubmitOperationAsync(WaitUntil, RequestContent, RequestContext)

[Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

AnalyzeTextSubmitOperationAsync(WaitUntil, MultiLanguageTextInput, IEnumerable<AnalyzeTextOperationAction>, String, String, CancellationToken)

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

AnalyzeTextSubmitOperationAsync(WaitUntil, RequestContent, RequestContext)

Source:
TextAnalysisClient.cs

[Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

public virtual System.Threading.Tasks.Task<Azure.Operation> AnalyzeTextSubmitOperationAsync (Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation>
override this.AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation>
Public Overridable Function AnalyzeTextSubmitOperationAsync (waitUntil As WaitUntil, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Operation)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Operation representing an asynchronous operation on the service.

Exceptions

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    displayName = "Document Abstractive Summarization Task Example",
    analysisInput = new
    {
        documents = new object[]
        {
            new
            {
                id = "1",
                language = "en",
                text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.",
            }
        },
    },
    tasks = new object[]
    {
        new
        {
            kind = "AbstractiveSummarization",
            taskName = "Document Abstractive Summarization Task 1",
            parameters = new
            {
                summaryLength = "medium",
                instruction = "XYZ-code",
            },
        }
    },
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    displayName = "Document Abstractive Summarization Task Example",
    analysisInput = new
    {
        documents = new object[]
        {
            new
            {
                id = "1",
                language = "en",
                text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.",
            }
        },
    },
    tasks = new object[]
    {
        new
        {
            kind = "AbstractiveSummarization",
            taskName = "Document Abstractive Summarization Task 1",
            parameters = new
            {
                sentenceCount = 1,
            },
        }
    },
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    displayName = "Extracting Location & US Region",
    analysisInput = new
    {
        documents = new object[]
        {
            new
            {
                id = "1",
                language = "en",
                text = "I had a wonderful trip to Seattle last week.",
            },
            new
            {
                id = "2",
                language = "en",
                text = "I'm flying to NYC tomorrow. See you there.",
            }
        },
    },
    tasks = new object[]
    {
        new
        {
            kind = "EntityRecognition",
            taskName = "Recognize Entities",
            parameters = new
            {
                modelVersion = "latest",
            },
        },
        new
        {
            kind = "CustomEntityRecognition",
            taskName = "Recognize US Regions",
            parameters = new
            {
                projectName = "MyProject",
                deploymentName = "MyDeployment",
            },
        }
    },
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    analysisInput = new
    {
        documents = new object[]
        {
            new
            {
                text = "Prescribed 100mg ibuprofen, taken twice daily.",
                id = "1",
                language = "en",
            }
        },
    },
    tasks = new object[]
    {
        new
        {
            kind = "Healthcare",
            parameters = new
            {
                modelVersion = "latest",
                fhirVersion = "4.0.1",
                documentType = "DischargeSummary",
            },
        }
    },
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    analysisInput = new
    {
        documents = new object[]
        {
            new
            {
                text = "Prescribed 100mg ibuprofen, taken twice daily.",
                id = "1",
                language = "en",
            }
        },
    },
    tasks = new object[]
    {
        new
        {
            kind = "Healthcare",
            parameters = new
            {
                modelVersion = "latest",
            },
        }
    },
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

Applies to

AnalyzeTextSubmitOperationAsync(WaitUntil, MultiLanguageTextInput, IEnumerable<AnalyzeTextOperationAction>, String, String, CancellationToken)

Source:
TextAnalysisClient.cs

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

public virtual System.Threading.Tasks.Task<Azure.Operation> AnalyzeTextSubmitOperationAsync (Azure.WaitUntil waitUntil, Azure.AI.Language.Text.MultiLanguageTextInput textInput, System.Collections.Generic.IEnumerable<Azure.AI.Language.Text.AnalyzeTextOperationAction> actions, string displayName = default, string defaultLanguage = default, System.Threading.CancellationToken cancellationToken = default);
abstract member AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.AI.Language.Text.MultiLanguageTextInput * seq<Azure.AI.Language.Text.AnalyzeTextOperationAction> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Operation>
override this.AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.AI.Language.Text.MultiLanguageTextInput * seq<Azure.AI.Language.Text.AnalyzeTextOperationAction> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Operation>
Public Overridable Function AnalyzeTextSubmitOperationAsync (waitUntil As WaitUntil, textInput As MultiLanguageTextInput, actions As IEnumerable(Of AnalyzeTextOperationAction), Optional displayName As String = Nothing, Optional defaultLanguage As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Operation)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

textInput
MultiLanguageTextInput

Contains the input to be analyzed.

actions
IEnumerable<AnalyzeTextOperationAction>

List of tasks to be performed as part of the LRO.

displayName
String

Name for the task.

defaultLanguage
String

Default language to use for records requesting automatic language detection.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

textInput or actions is null.

Examples

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput
{
    MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.")
    {
        Language = "en",
    }},
};
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new AbstractiveSummarizationOperationAction
    {
        ActionContent = new AbstractiveSummarizationActionContent
        {
            SummaryLength = SummaryLengthBucket.Medium,
            Instruction = "XYZ-code",
        },
        Name = "Document Abstractive Summarization Task 1",
    }
});

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput
{
    MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.")
    {
        Language = "en",
    }},
};
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new AbstractiveSummarizationOperationAction
    {
        ActionContent = new AbstractiveSummarizationActionContent
        {
            SentenceCount = 1,
        },
        Name = "Document Abstractive Summarization Task 1",
    }
});

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput
{
    MultiLanguageInputs = {new MultiLanguageInput("1", "I had a wonderful trip to Seattle last week.")
    {
        Language = "en",
    }, new MultiLanguageInput("2", "I'm flying to NYC tomorrow. See you there.")
    {
        Language = "en",
    }},
};
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new EntitiesOperationAction
    {
        ActionContent = new EntitiesActionContent
        {
            ModelVersion = "latest",
        },
        Name = "Recognize Entities",
    },
    new CustomEntitiesOperationAction
    {
        ActionContent = new CustomEntitiesActionContent("MyProject", "MyDeployment"),
        Name = "Recognize US Regions",
    }
});

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput
{
    MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.")
    {
        Language = "en",
    }},
};
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new HealthcareOperationAction
    {
        ActionContent = new HealthcareActionContent
        {
            ModelVersion = "latest",
            FhirVersion = FhirVersion._401,
            DocumentType = HealthcareDocumentType.DischargeSummary,
        },
    }
});

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput
{
    MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.")
    {
        Language = "en",
    }},
};
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new HealthcareOperationAction
    {
        ActionContent = new HealthcareActionContent
        {
            ModelVersion = "latest",
        },
    }
});

Applies to