Testing the Nutriguide API


Introduction
An API uses nutritional data from various products and a user's health status to create a chatbot powered by LLM. Users can interact with this chatbot to make and plan their choices.
The GitHub Documentation and DockerHub documentation provide guides for downloading the container and using it locally. You can also deploy it by following a few simple steps. For more details on using the API, refer to the API documentation in the GitHub documentation.
Testing
Install Docker Desktop.
Install Postman.
Follow the user guide in the DockerHub documentation.
Create 3 instances of
POST
requests for these endpoints:/health
/products
/query
Send the health status through the
/health
endpoint. For this example, let’s use:{ "health_status": "I am hypertensive patient with a slight high BP of 130/92. I have diabetis around 135. I am 5 feet 8 inches tall with 78 kg of weight. I want protien." }
Send the nutritional information of the products through the
/products
endpoint. For this example, let’s use:{ "products": [ { "data": { "Nutritional Content": { "Added Sugars": "40.5 g", "Carbohydrates": "56.5 g", "Cholesterol": "13.7 mg", "Energy": "559 kcal", "Protein": "6.1 g", "Saturated Fat": "21.15 g", "Sodium": "212 mg", "Total Fat": "34.85 g", "Total Sugars": "48.6 g", "Trans Fat": "0.15 g" } }, "heading": "Nutritional Content of Cadbury Dairy Milk Silk Oreo per 100g" }, { "data": { "Nutritional Content": { "Added Sugars": "0 g", "Carbohydrates": "53 g", "Cholesterol": "0 mg", "Energy": "536 kcal", "Protein": "7 g", "Saturated Fat": "3.3 g", "Sodium": "525 mg", "Total Fat": "34 g", "Total Sugars": "1 g", "Trans Fat": "0.1 g" } }, "heading": "Nutritional Content of Lays Classic Salted Chips per 100g" }, { "data": { "Nutritional Content": { "Added Sugars": "10.6 g", "Carbohydrates": "10.6 g", "Cholesterol": "0 mg", "Energy": "42 kcal", "Protein": "0 g", "Saturated Fat": "0 g", "Sodium": "11 mg", "Total Fat": "0 g", "Total Sugars": "10.6 g", "Trans Fat": "0 g" } }, "heading": "Nutritional Content of Coca-Cola per 100ml" }, { "data": { "Nutritional Content": { "Added Sugars": "2.1 g", "Carbohydrates": "60 g", "Cholesterol": "0 mg", "Energy": "445 kcal", "Protein": "9 g", "Saturated Fat": "8.1 g", "Sodium": "880 mg", "Total Fat": "17 g", "Total Sugars": "3 g", "Trans Fat": "0.1 g" } }, "heading": "Nutritional Content of Maggi 2-Minute Noodles per 100g" }, { "data": { "Nutritional Content": { "Added Sugars": "0 g", "Carbohydrates": "0 g", "Cholesterol": "215 mg", "Energy": "717 kcal", "Protein": "0.9 g", "Saturated Fat": "51 g", "Sodium": "714 mg", "Total Fat": "81 g", "Total Sugars": "0 g", "Trans Fat": "3 g" } }, "heading": "Nutritional Content of Amul Butter per 100g" } ] }
Now, we can ask questions using the
/query
endpoint as shown below, with all chat history stored and tracked for context awareness:{ "query": "What should I take for protien?" }
A conversation session example
Q1— What should I take for protien?
Here are the protein contents of the given foods:
Cadbury Dairy Milk Silk Oreo - 6.1 g
Lays Classic Salted Chips - 7 g
Coca-Cola - 0 g
Maggi 2-Minute Noodles - 9 g
Amul Butter - 0.9 g
To meet your protein needs, consider options like Maggi 2-Minute Noodles, Lays Classic Salted Chips, or Cadbury Dairy Milk Silk Oreo. However, please keep in mind your hypertension and diabetes; I will provide more tailored suggestions if needed.
Q2— Is it okay to have it in terms of fat content?
Considering your hypertension and diabetes, let's evaluate the fat content of the high-protein options:
Maggi2-Minute Noodles - 17 g (Total Fat), 8.1 g (Saturated Fat)
Lays Classic Salted Chips - 34 g (Total Fat), 3.3 g (Saturated Fat)
Cadbury Dairy Milk Silk Oreo - 34.85 g (Total Fat), 21.15 g (Saturated Fat)
To manage your condition, it's essential to balance your fat intake. Lays Classic Salted Chips and Cadbury Dairy Milk Silk Oreo have high fat content. Maggi2-Minute Noodles seem to be a relatively better option, but its sodium content (880 mg) is a concern for hypertension.
Considering both protein and fat content, Maggi2-Minute Noodles might be a compromise, but please be mindful of its sodium and overall carbohydrate content (60 g) that may impact your diabetes.
Q3— How much should I consume your recommendation and coke?
I can't recommend consuming Coca-Cola due to its high sugar content (10.6 g per 100ml), which can worsen your diabetes.
For Maggi2-Minute Noodles, considering your hypertension, diabetes, and protein needs, I suggest a moderate serving size. A 100g serving of Maggi2-Minute Noodles provides 9g of protein, 17g of fat, 60g of carbohydrates, and 880mg of sodium.
To balance your nutrient intake, limit your serving size to 50-70g (approximately half to two-thirds of a standard packet), and consider adding vegetables or protein sources with lower sodium and fat content to make it a more balanced meal.
Please consult a healthcare professional or registered dietitian for personalized dietary advice.
Q4— BTW which one is the least harmful?
Considering your hypertension and diabetes, I would suggest Lays Classic Salted Chips as the least harmful option among the ones listed.
It provides 7g of protein and has relatively lower sodium (525mg) compared to Maggi2-Minute Noodles. However, please be mindful of its high fat content (34g) and limit your serving size.
Keep in mind that it's essential to balance your diet with a variety of nutrient-dense foods and consult a healthcare professional for personalized advice.
Future Prospects
Subscribe to my newsletter
Read articles from Tuhin Kumar Dutta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Tuhin Kumar Dutta
Tuhin Kumar Dutta
I decode data, craft AI solutions, and write about everything from algorithms to analytics. Here to share what I learn and learn from what I share. 🚀 Data Scientist | AI Enthusiast | Building intelligent systems & simplifying complexity through code and curiosity. Sharing insights, projects, and deep dives in ML, data, and innovation.