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.

foodAnalysis

FoodAnalysis

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"'

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

mutation{
  processAiFood(
    input:{
      foodDescription:"3 eggs, two pieces of whole grain bread, half avocado with lime and a pinch of salt and two beef sausages"
    }
  ){
    success
    message
    foodAnalysis{
      id
      status
      errorMessage
      serviceResponse
      foodDescription
    }
  }
}

Last updated

Was this helpful?