agentcard.ts
Send the picture as data
Send a picture your app holds in memory as base64 data, with its type:agentcard.ts
image/jpeg, image/png, image/webp and image/gif, up to 3 MB once decoded. A full-resolution phone photo can be larger, so scale the picture down before you send it.
Send a picture with no words
A shopper who only shows a picture still gets a search.buy.turn needs the shopper’s words, so give it a short ask with the picture:
agentcard.ts
client.buy itself sends the picture with no ask at all, and Agentcard searches for the product the picture shows, as if the shopper had written “find” and its name:
agentcard.ts
Handle an unclear picture
Agentcard searches for a product only when it is sure what the picture shows. A picture of a crowded shelf, or of several products when the words do not say which, leaves the search on the shopper’s words alone, so “where can I get that jacket” searches for jackets. A picture with no words that Agentcard cannot read is refused, and the shopper’s next message with words searches as usual.Check what the turn sends
The picture goes with the turn’s first request for products, and with nothing else. A pick of a card, a yes to a total and every later message send no picture, so a shopper who taps a card never uploads the frame again. Agentcard reads the picture during the turn and never keeps it. An app that callsclient.buy itself sends the picture as the image field of the request. A request that sends image with confirm is refused.
Fix a refused picture
buy.turn checks the picture’s address, its type and the size of its data before any call, so a picture those checks refuse throws a TypeError naming the field. buy.turn('that', { image: { url: 'http://frames.yourapp.com/a.jpg' } }) throws:
https address instead:
agentcard.ts
POST /buy refuses a picture the SDK passes: the request takes 3,000,000 decoded bytes, where buy.turn takes 3,145,728, so a picture between the two throws nothing and the call answers with a 400. Handle the request’s refusal as well as the TypeError.
A request your app sends itself gets a 400 that names the field: