Process Ai Food
Use the processAiFood mutation to generate a food analysis from text or image that can be registered on the food log.
Arguments
Argument
Type
Description
input
ProcessAIFoodInput
input.image
Upload
Food image to be processed.
input.foodDescription
String
Text description of the food to be processed.
Available Fields
success
Boolean
True if the food has been processed. Otherwise, it displays False.
message
String
Description of the result.
Example using Image Analysis
Because it is not possible to upload files in the GraphQL playground, the following example can be executed on tools like postman.
curl --location 'https://production.suggestic.com/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ8.eyJleHAiOjE3NTAzNzcxODQsInVpZCI5ImY1NDc2MjI2LThlNTQtNGUwNC1hY2IwLWExZjdiMmhMzBhMyIsInBpZCI6IjIyOWQ4OTc4LTRlYmItNGFmZi1hNTc0LTM4MDk3Y2UwM2YyZCIsImlzcyI6InNnOmFwcCIsImF1ZCI6InNnOnVzZXIiLCJpYXQiOjE3NDkxNjc1ODQsImNhdCI6IjIwMjUwNDI1MTkxNSIsImFwcCI6ImF0dGFuZS1oZWFsdGgiLCJ0eXBlIjoiYWNjZXNzIn0.ZINEA-A39crTB96rzBwc7ebahANNGVqe4Pn7PA4SbJw' \
--header 'X-APOLLO-OPERATION-NAME: processFoodImageAssistant' \
--form 'operations="{
\"operationName\": \"processAiFood\",
\"query\": \"mutation processAiFood(\$image: Upload, \$foodDescription: String) { processAiFood(input: { image: \$image, foodDescription: \$foodDescription }) { message success foodAnalysis { id status serviceResponse } } }\",
\"variables\": {
\"image\": null,
\"foodDescription\": \"\"
}
}"' \
--form 'map="{\"0\":[\"variables.image\"]}"' \
--form '0=@"/Users/user/Downloads/balanced-diet.jpg"'{
"data": {
"processAiFood": {
"message": "AI Food Log Processed",
"success": true,
"foodAnalysis": {
"id": "Rm9vZEFuYWx5c2lzOjY3ZWM0NWE3LTc3ZWQtNGY1My1iNjVkLTMyNzYwMGI2ZjgxNA==",
"status": "COMPLETED",
"serviceResponse": "{\"id\": \"67ec45a7-77ed-4f53-b65d-327600b6f814\", \"data\": {\"food_name\": \"Healthy Chicken & Chickpea Power Bowl\", \"nutritional_information\": {\"nutrients\": [{\"name\": \"calories\", \"value\": 572.0, \"unit\": \"kcal\"}, {\"name\": \"protein\", \"value\": 49.0, \"unit\": \"g\"}, {\"name\": \"fat\", \"value\": 19.0, \"unit\": \"g\"}, {\"name\": \"carbs\", \"value\": 55.0, \"unit\": \"g\"}]}, \"analysis_results\": {\"summary\": \"A vibrant and nutritious power bowl featuring lean cooked chicken breast, a variety of fresh and cooked vegetables, and protein-rich chickpeas. The bowl includes sliced avocado, halved cherry tomatoes, shredded carrots, mixed leafy greens (such as lettuce and arugula), steamed broccoli and cauliflower florets, and sliced red bell pepper. It is lightly seasoned with black sesame seeds.\", \"ingredients\": [{\"name\": \"chicken breast (cooked)\", \"quantity\": 110.0, \"unit\": \"g\"}, {\"name\": \"avocado\", \"quantity\": 75.0, \"unit\": \"g\"}, {\"name\": \"cherry tomatoes\", \"quantity\": 50.0, \"unit\": \"g\"}, {\"name\": \"mixed greens\", \"quantity\": 60.0, \"unit\": \"g\"}, {\"name\": \"carrots (shredded)\", \"quantity\": 60.0, \"unit\": \"g\"}, {\"name\": \"chickpeas (cooked)\", \"quantity\": 110.0, \"unit\": \"g\"}, {\"name\": \"broccoli (steamed)\", \"quantity\": 55.0, \"unit\": \"g\"}, {\"name\": \"cauliflower (steamed)\", \"quantity\": 55.0, \"unit\": \"g\"}, {\"name\": \"red bell pepper\", \"quantity\": 45.0, \"unit\": \"g\"}, {\"name\": \"black sesame seeds\", \"quantity\": 1.0, \"unit\": \"g\"}]}}}"
}
}
}
}Note:
This mutation requires an AI specific header (already included on the cURL):
X-APOLLO-OPERATION-NAME: processFoodImageAssistant
Example with Text Analysis
Executed in the GraphQL playground
Last updated
Was this helpful?