Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.36k stars 4.75k forks source link

[BUG] Async method is still limited to 5,120 characters #37773

Open AlenDK opened 1 year ago

AlenDK commented 1 year ago

Library name and version

Azure.Ai.TextAnalytics 5.3.0

Describe the bug

From the Data limitation page it states ( https://learn.microsoft.com/en-us/azure/ai-services/language-service/concepts/data-limits):

Feature | Value -- | -- Text Analytics for health | 125,000 characters as measured by StringInfo.LengthInTextElements. All other preconfigured features (synchronous) | 5,120 as measured by StringInfo.LengthInTextElements. If you need to submit larger documents, consider using the feature asynchronously. All other preconfigured features (asynchronous) | 125,000 characters across all submitted documents, as measured by StringInfo.LengthInTextElements (maximum of 25 documents).

Using the async method(such as RecognizeEntitiesAsync) seems to also be limited to 5,120 characters.

Expected behavior

Able to process a text that is over 5120 characters and less than 12500

Actual behavior

Error message:

System.Private.CoreLib: Exception while executing function: XXX. Azure.AI.TextAnalytics: A document within the request was too large to be processed. Limit document size to: 5120 text elements. For additional details on the data limitations see https://aka.ms/text-analytics-data-limits

Content: {"kind":"EntityRecognitionResults","results":{"documents":[],"errors":[{"id":"0","error":{"code":"InvalidArgument","message":"Invalid Document in request.","innererror":{"code":"InvalidDocument","message":"A document within the request was too large to be processed. Limit document size to: 5120 text elements. For additional details on the data limitations see https://aka.ms/text-analytics-data-limits"}}}],"modelVersion":"2021-06-01"}}

Reproduction Steps

Create a text that is over 5120 characters long:

string pattern = "test "; int repeatTimes = 7000 / pattern.Length; string longString = string.Concat(Enumerable.Repeat(pattern, repeatTimes));

var test = await client.RecognizeEntitiesAsync(longString);

Environment

No response

github-actions[bot] commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @assafi.

FabryB commented 4 months ago

seems like the bug is still present

FabryB commented 4 months ago

but is probably server side, since I can reproduce it also in python

bwgraves commented 2 months ago

We're also having the same issue with the AnalyzeSentimentAsync and AnalyzeSentimentBatchAsync methods on the latest SDK (same version as op).