Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Observation related to Reponses

We have observed that there is a mismatch in request and response.

In Detect language, Unable to detect multiple language still its response type Location is of array

 "languages": [
        {
            "languageCode""hi",
            "confidence"0.576136
        }
    ]
 
Why languages is type of array? 
 
same thing observe in Translate Document request we can pass single content whereas in response we get byteStreamOutputs in array format
 
Why we are keep keeping O/P is in array format?

These were some observation we found.

0 2 151
2 REPLIES 2

The reason why the languages field in the Detect Language API response is an array is because it can detect multiple languages in a given text. The API returns an array of detected languages sorted by their confidence scores. Similarly, the reason why the byteStreamOutputs field in the Translate Document API response is an array is because it can translate multiple documents in a single request. The API returns an array of translated documents in the same order as the input documents.

Thanks for reply Joevanie,

Sorry but It Doesn't behave as you explain, At this moment detect language API can detect only one language.

Suppose, In Input we have pass two languages but in response it detect one language only as shown in below image

In same way, In translate document in Request we can pass only once Document.

Could you pls guide on same?

appConnect_0-1679898850042.png