Partager via


ConversationAuthoringClient.GetTrainingJobs(String, RequestContext) Méthode

Définition

[Méthode de protocole] Répertorie les travaux de formation non expirés créés pour un projet.

  • Cette méthode de protocole permet la création explicite de la demande et le traitement de la réponse pour les scénarios avancés.
public virtual Azure.Pageable<BinaryData> GetTrainingJobs (string projectName, Azure.RequestContext context = default);
abstract member GetTrainingJobs : string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetTrainingJobs : string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetTrainingJobs (projectName As String, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)

Paramètres

projectName
String

Nom du projet à utiliser.

context
RequestContext

Contexte de la demande, qui peut remplacer les comportements par défaut du pipeline client par appel.

Retours

du Pageable<T> service contenant une liste d’objets BinaryData . Les détails du schéma de corps pour chaque élément de la collection sont décrits dans la section Remarques ci-dessous.

Exceptions

projectName a la valeur null.

projectName est une chaîne vide et devait être non vide.

Le service a retourné un code de status non réussi.

Exemples

Cet exemple montre comment appeler GetTrainingJobs avec les paramètres requis et analyser le résultat.

var credential = new AzureKeyCredential("<key>");
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConversationAuthoringClient(endpoint, credential);

foreach (var item in client.GetTrainingJobs("<projectName>"))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString());
    Console.WriteLine(result.GetProperty("jobId").ToString());
    Console.WriteLine(result.GetProperty("createdDateTime").ToString());
    Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString());
    Console.WriteLine(result.GetProperty("expirationDateTime").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("<test>").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("<test>").ToString());
    Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString());
}

Remarques

Vous trouverez des informations supplémentaires dans la documentation de l’API REST de service : https://learn.microsoft.com/rest/api/language/2023-04-01/conversational-analysis-authoring/list-training-jobs

S’applique à