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

Abierto Apto para principiantes
#86 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
75/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend

Línea de trabajo

Empieza con Directory.Packages.props y DocumentExtraction/src/AzureContentUnderstanding/ContentUnderstandingExtractionClient.cs, y luego revisa la corrección del SDK enlazada y la prueba de reproducción de AzureContentUnderstanding.UnitTests descrita en la incidencia. Cuando Azure.AI.ContentUnderstanding publique la corrección, actualiza la versión del paquete y añade una prueba en la que content de una figura de gráfico sea una cadena JSON; verifica que la extracción devuelva el documento.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C#
Estrellas
15
Forks
9
Merge medio
1 d 19 h
PR fusionados (30 d)
14

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de CommunityToolkit/AI

Todos los issues de CommunityToolkit/AI

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.