Recipe Recommender Agent

March 18, 2024

Overview

The Recipe Recommender Agent is designed to assist users with catering plans, built entirely within the TaskingAI platform.

Common Usages

  1. Provide food suggestions based on a user-uploaded image of available ingredients.
  2. Offer food suggestions based on a user's food preferences and target calorie intake.
  3. Calculate calories based on a textual description of food or an image of the food.
  4. Act as a nutrition advisor and interact with user messages.

Implementation

The Recipe Recommender is constructed completely on the TaskingAI platform without any coding required. In this section, we will go through how to build a Recipe Recommender and explain how we chose the models and plugins for it. First, here's an overview of the implementation:

Model

Claude-3-Haiku

For the language model, the Recipe Recommender does not require strong logic, as the tasks it faces are relatively simple in terms of reasoning. Thus, cost is a more important aspect when choosing models. Claude-3-Haiku is a cost-efficient model ($0.25 per million input tokens and $1.25 per million output tokens) that offers reasonable pricing and compatible performance. Claude-3-Haiku is also the fastest model in the Claude-3 family.

Memory

MessageWindowMemory

System prompt

"You are a recipe recommender, skilled in culinary arts, and knowledgeable about various dietary needs and preferences. Your task is to suggest recipes that match the user's stated food preferences, the ingredients they have on hand, and their specific nutritional requirements, including calorie intake. Offer personalized cooking suggestions, provide alternatives when necessary, and consider any dietary restrictions or goals the user mentions. Engage the user with questions to better understand their needs and preferences, and guide them towards making satisfying and healthy meal choices."

Plugins

  • Gemini-Pro-Vision: A plugin that enhances the agent's ability to understand images, essential for interpreting user-uploaded images of ingredients. While language generation remains the responsibility of the primary language model (Claude-3-Haiku), Gemini-Pro-Vision is activated only when the model needs to process an image.
  • Calorie Ninjas: An independent API provider that offers automatic calculation of food calories from textual descriptions and provides detailed recipe information. This plugin is crucial for delivering professional dietary advice.
  • DuckDuckGo and Web Reader: This combination enables the agent to search for unfamiliar information and access content online. DuckDuckGo, known for its minimal restrictions compared to Google, can be used for web searches. Users also have the option to substitute DuckDuckGo with Google Search, another available plugin on TaskingAI.

Integrate the Agent into Your Application

When you have a working agent with TaskingAI, it is simple to implement it in your application. You may choose to use TaskingAI's Python Client SDK or REST API. Here is a simple example of connecting your agent using the Python SDK:

1import taskingai
2
3taskingai.init("YOUR_API_KEY")
4
5recipe_recommender: Assistant = taskingai.assistant.get_assistant(
6    assistant_id="YOUR_ASSISTANT_ID" 
7)
8
9new_chat_session = taskingai.assistant.create_chat(
10    assistant_id=recipe_recommender.assistant_id,
11    name='New Chat'
12)
13
14user_message = taskingai.assistant.create_message(
15    assistant_id=recipe_recommender.assistant_id,
16    chat_id=new_chat_session.chat_id,
17    text="Please help me calculate the nutrition info of 150G Salmon."
18)
19
20assistant_response = taskingai.assistant.generate_message(
21    assistant_id=recipe_recommender.assistant_id,
22    chat_id=new_chat_session.chat_id
23)

For further guidance on more complex implementations and to explore additional functionalities of TaskingAI, please refer to our comprehensive, please refer to documentation.

On this page

©️ 2024 TaskingAI All Copyright Reserved