AzureContentUnderstanding: ExtractAsync throws when a chart figure's content is a JSON string

Aperta Adatta ai principianti
#86 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend

Direzione di ricerca

Inizia con Directory.Packages.props e DocumentExtraction/src/AzureContentUnderstanding/ContentUnderstandingExtractionClient.cs, quindi esamina la correzione dell’SDK collegata e il test di riproduzione di AzureContentUnderstanding.UnitTests descritto nell’issue. Quando Azure.AI.ContentUnderstanding rilascia la correzione, aggiorna la versione del pacchetto e aggiungi un test in cui content di una figura del grafico è una stringa JSON; verifica che l’estrazione restituisca il documento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

The Content Understanding provider fails on documents with some charts. The cause is a defect in Azure.AI.ContentUnderstanding 1.1.0, the version in Directory.Packages.props: Azure/azure-sdk-for-net#57370. The fix is proposed in Azure/azure-sdk-for-net#64660.

What happens

For some charts the service returns the content of a chart figure, the Chart.js config, as an escaped JSON string instead of an object. The service team confirmed it in Azure/azure-sdk-for-net#57370. The SDK cannot deserialize the result, so operation.Value in ContentUnderstandingExtractionClient.ExtractAsync throws, and no part of the document is returned:

System.InvalidOperationException: The requested operation requires an element of type 'Object', but the target element has type 'String'.
   at System.Text.Json.JsonElement.EnumerateObject()
   at Azure.AI.ContentUnderstanding.DocumentChartFigure.DeserializeDocumentChartFigure(JsonElement element, ModelReaderWriterOptions options)
   ...
   at Azure.Core.ProtocolOperationHelpers.ConvertOperation`2.get_Value()
   at CommunityToolkit.DocumentExtraction.AzureContentUnderstanding.ContentUnderstandingExtractionClient.ExtractAsync(Stream document, String identifier, String mediaType, DocumentExtractionOptions options, CancellationToken cancellationToken)

Only analyzers that return chart figures can hit it, such as prebuilt-documentSearch: in our run, its chart came back as an object. The default, prebuilt-document, returns no figures.

How it was checked

A test in AzureContentUnderstanding.UnitTests replays a real prebuilt-layout result whose figure is changed into a chart figure, as prebuilt-documentSearch returns it. The provider sources are the ones on main, on .NET 10.

  • With 1.1.0 and the chart content as an object, ExtractAsync returns the document.
  • With 1.1.0 and the chart content as a string, ExtractAsync throws the exception above.
  • With a build of the SDK that has the fix, both cases pass, and so do the other 136 tests of the project.

In the toolkit

When a release of Azure.AI.ContentUnderstanding includes the fix, the version in Directory.Packages.props can move to it, with a test on a chart figure whose content is a string.

Lingua principale
C#
Stelle
15
Fork
9
Merge medio
1g 19h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommunityToolkit/AI

Tutte le issue di CommunityToolkit/AI

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.