Evan Lesmez commited on
Commit
191b7f5
1 Parent(s): 63ae673

Make the edamam tool handle failures well

Browse files

Informs the user when recipe search fails to find any and recommends
retrying with the last word chopped off. This can be picked up by the
agent to automatically retry. Queries with too many characters are
caught and handled too.
Also added |eval: false to several cells that should not be executing on
nbdev_test.

Files changed (1) hide show
  1. nbs/02_vegan_recipe_tools.ipynb +96 -94
nbs/02_vegan_recipe_tools.ipynb CHANGED
@@ -86,6 +86,7 @@
86
  }
87
  ],
88
  "source": [
 
89
  "load_dotenv()"
90
  ]
91
  },
@@ -95,6 +96,7 @@
95
  "metadata": {},
96
  "outputs": [],
97
  "source": [
 
98
  "llm = ChatOpenAI(temperature=0)"
99
  ]
100
  },
@@ -104,6 +106,7 @@
104
  "metadata": {},
105
  "outputs": [],
106
  "source": [
 
107
  "tools = load_tools([\"llm-math\"], llm=llm)\n",
108
  "agent = initialize_agent(\n",
109
  " tools,\n",
@@ -217,7 +220,7 @@
217
  "Action Input: 3% * (300 * 30)\u001b[0m\n",
218
  "Observation: \u001b[36;1m\u001b[1;3mAnswer: 270.0\u001b[0m\n",
219
  "Thought:\u001b[32;1m\u001b[1;3mI now know the final answer\n",
220
- "Final Answer: The 3% of 300 * 30 is 270.0.\u001b[0m\n",
221
  "\n",
222
  "\u001b[1m> Finished chain.\u001b[0m\n"
223
  ]
@@ -225,8 +228,7 @@
225
  {
226
  "data": {
227
  "text/plain": [
228
- "{'input': 'What is the 3% of of 300 * 30?',\n",
229
- " 'output': 'The 3% of 300 * 30 is 270.0.'}"
230
  ]
231
  },
232
  "execution_count": null,
@@ -302,6 +304,7 @@
302
  "metadata": {},
303
  "outputs": [],
304
  "source": [
 
305
  "agent = OpenAIFunctionsAgent(llm=llm, tools=tools, prompt=prompt)"
306
  ]
307
  },
@@ -311,6 +314,7 @@
311
  "metadata": {},
312
  "outputs": [],
313
  "source": [
 
314
  "agent_executor = AgentExecutor(agent=agent, tools=tools, memory=memory, verbose=True)"
315
  ]
316
  },
@@ -884,6 +888,7 @@
884
  "metadata": {},
885
  "outputs": [],
886
  "source": [
 
887
  "params = {\n",
888
  " \"location\": \"United States\",\n",
889
  " \"hl\": \"en\",\n",
@@ -927,6 +932,7 @@
927
  "metadata": {},
928
  "outputs": [],
929
  "source": [
 
930
  "agent = initialize_agent(\n",
931
  " [time],\n",
932
  " llm,\n",
@@ -1045,6 +1051,7 @@
1045
  "metadata": {},
1046
  "outputs": [],
1047
  "source": [
 
1048
  "agent = OpenAIFunctionsAgent(\n",
1049
  " llm=llm, tools=[vegan_recipe_serpapi_search], prompt=prompt\n",
1050
  ")"
@@ -1054,8 +1061,21 @@
1054
  "cell_type": "code",
1055
  "execution_count": null,
1056
  "metadata": {},
1057
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
1058
  "source": [
 
1059
  "agent_executor = AgentExecutor(\n",
1060
  " agent=agent, tools=[vegan_recipe_serpapi_search], memory=memory, verbose=True\n",
1061
  ")"
@@ -2225,17 +2245,11 @@
2225
  }
2226
  ],
2227
  "source": [
 
2228
  "response = get_vegan_recipes_edamam_api({\"q\": \"vegan chicken\"})\n",
2229
  "display(response.ok, response.json()[\"hits\"][0][\"recipe\"])"
2230
  ]
2231
  },
2232
- {
2233
- "cell_type": "markdown",
2234
- "metadata": {},
2235
- "source": [
2236
- "TODO Maybe skip agent/ tool and integrate into gradio demo?"
2237
- ]
2238
- },
2239
  {
2240
  "cell_type": "code",
2241
  "execution_count": null,
@@ -2243,13 +2257,18 @@
2243
  "outputs": [],
2244
  "source": [
2245
  "#| export\n",
2246
- "@tool\n",
2247
  "def vegan_recipe_edamam_search(query: str) -> str:\n",
2248
  " \"\"\"\n",
2249
  " Searches for vegan recipes based on a query.\n",
2250
  " If the query is not vegan friendly, adapt it to be.\n",
2251
- " If the request fails an explanation message will be returned instead of the recipe JSON.\n",
 
2252
  " \"\"\"\n",
 
 
 
 
2253
  " # Veganize the query more\n",
2254
  " if \"vegan\" not in query.lower():\n",
2255
  " query = \"vegan \" + query\n",
@@ -2264,7 +2283,14 @@
2264
  "\n",
2265
  " response = get_vegan_recipes_edamam_api(params)\n",
2266
  " if not response.ok:\n",
2267
- " return f\"Received an error from Edamam API: {response.status_code} {response.text }\"\n",
 
 
 
 
 
 
 
2268
  "\n",
2269
  " return str([r[\"recipe\"] for r in response.json()[\"hits\"][0:3]])"
2270
  ]
@@ -2329,30 +2355,7 @@
2329
  "cell_type": "code",
2330
  "execution_count": null,
2331
  "metadata": {},
2332
- "outputs": [
2333
- {
2334
- "name": "stdout",
2335
- "output_type": "stream",
2336
- "text": [
2337
- "\n",
2338
- "\n",
2339
- "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2340
- "\u001b[32;1m\u001b[1;3mHi there! How can I assist you today?\u001b[0m\n",
2341
- "\n",
2342
- "\u001b[1m> Finished chain.\u001b[0m\n"
2343
- ]
2344
- },
2345
- {
2346
- "data": {
2347
- "text/plain": [
2348
- "'Hi there! How can I assist you today?'"
2349
- ]
2350
- },
2351
- "execution_count": null,
2352
- "metadata": {},
2353
- "output_type": "execute_result"
2354
- }
2355
- ],
2356
  "source": [
2357
  "#| eval: false\n",
2358
  "agent_executor.run(\"Hello\")"
@@ -2362,30 +2365,7 @@
2362
  "cell_type": "code",
2363
  "execution_count": null,
2364
  "metadata": {},
2365
- "outputs": [
2366
- {
2367
- "name": "stdout",
2368
- "output_type": "stream",
2369
- "text": [
2370
- "\n",
2371
- "\n",
2372
- "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2373
- "\u001b[32;1m\u001b[1;3mOf course! I'm here to help. What do you need assistance with?\u001b[0m\n",
2374
- "\n",
2375
- "\u001b[1m> Finished chain.\u001b[0m\n"
2376
- ]
2377
- },
2378
- {
2379
- "data": {
2380
- "text/plain": [
2381
- "\"Of course! I'm here to help. What do you need assistance with?\""
2382
- ]
2383
- },
2384
- "execution_count": null,
2385
- "metadata": {},
2386
- "output_type": "execute_result"
2387
- }
2388
- ],
2389
  "source": [
2390
  "#| eval: false\n",
2391
  "agent_executor.run(\"Help\")"
@@ -2395,30 +2375,7 @@
2395
  "cell_type": "code",
2396
  "execution_count": null,
2397
  "metadata": {},
2398
- "outputs": [
2399
- {
2400
- "name": "stdout",
2401
- "output_type": "stream",
2402
- "text": [
2403
- "\n",
2404
- "\n",
2405
- "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2406
- "\u001b[32;1m\u001b[1;3mMy purpose is to assist and provide information on vegan recipes. I am here to help you find delicious and nutritious plant-based meal options. If you have any specific questions or need recipe recommendations, feel free to ask!\u001b[0m\n",
2407
- "\n",
2408
- "\u001b[1m> Finished chain.\u001b[0m\n"
2409
- ]
2410
- },
2411
- {
2412
- "data": {
2413
- "text/plain": [
2414
- "'My purpose is to assist and provide information on vegan recipes. I am here to help you find delicious and nutritious plant-based meal options. If you have any specific questions or need recipe recommendations, feel free to ask!'"
2415
- ]
2416
- },
2417
- "execution_count": null,
2418
- "metadata": {},
2419
- "output_type": "execute_result"
2420
- }
2421
- ],
2422
  "source": [
2423
  "#| eval: false\n",
2424
  "agent_executor.run(\"What is your purpose?\")"
@@ -2432,10 +2389,12 @@
2432
  {
2433
  "data": {
2434
  "text/plain": [
2435
- "[HumanMessage(content='Look up grilled cheese recipes please', additional_kwargs={}, example=False),\n",
2436
- " AIMessage(content='I found a couple of vegan recipes that you might enjoy:\\n\\n1. [Grilled Avocado Sandwich](https://food52.com/recipes/31404-grilled-avocado-sandwich)\\n - Ingredients: 2 slices of bread, 1/4 cup mashed avocado (or more), salt and pepper to taste, garlic powder (optional), Earth Balance vegan butter, room temp.\\n\\n2. [Shiny Happy Poppers](https://www.epicurious.com/recipes/food/views/shiny-happy-poppers-51100000)\\n - Ingredients: 12 jalapeños, 1 cup cooked white or brown rice, 1 cup canned black beans, drained and rinsed, 2 tablespoons smooth or grainy vegan Dijon mustard, 1 teaspoon garlic powder (or 1 medium-size clove garlic, peeled and pressed), 1 tablespoon chopped fresh thyme leaves (or 2 teaspoons dried), 1/2 cup extra-virgin olive oil (for drizzling), hot sauce of choice (for drizzling).\\n\\nPlease note that these recipes are vegan and do not contain any animal products. Enjoy your meal!', additional_kwargs={}, example=False),\n",
2437
- " HumanMessage(content='I have a few ingrediens I would like to cook with.', additional_kwargs={}, example=False),\n",
2438
- " AIMessage(content=\"Sure! Please let me know the ingredients you have, and I'll try to find a vegan recipe that includes them.\", additional_kwargs={}, example=False)]"
 
 
2439
  ]
2440
  },
2441
  "execution_count": null,
@@ -2460,7 +2419,7 @@
2460
  "\n",
2461
  "\n",
2462
  "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2463
- "\u001b[32;1m\u001b[1;3mThat's great! I can help you find vegan recipes using the ingredients you have. Please let me know what ingredients you have, and I'll provide you with some recipe suggestions.\u001b[0m\n",
2464
  "\n",
2465
  "\u001b[1m> Finished chain.\u001b[0m\n"
2466
  ]
@@ -2468,7 +2427,7 @@
2468
  {
2469
  "data": {
2470
  "text/plain": [
2471
- "\"That's great! I can help you find vegan recipes using the ingredients you have. Please let me know what ingredients you have, and I'll provide you with some recipe suggestions.\""
2472
  ]
2473
  },
2474
  "execution_count": null,
@@ -2493,7 +2452,49 @@
2493
  "\n",
2494
  "\n",
2495
  "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2496
- "\u001b[32;1m\u001b[1;3mGreat! You have a variety of ingredients to work with. Do you have any food allergies or dietary restrictions that I should consider when suggesting recipes?\u001b[0m\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2497
  "\n",
2498
  "\u001b[1m> Finished chain.\u001b[0m\n"
2499
  ]
@@ -2501,7 +2502,7 @@
2501
  {
2502
  "data": {
2503
  "text/plain": [
2504
- "'Great! You have a variety of ingredients to work with. Do you have any food allergies or dietary restrictions that I should consider when suggesting recipes?'"
2505
  ]
2506
  },
2507
  "execution_count": null,
@@ -2584,6 +2585,7 @@
2584
  }
2585
  ],
2586
  "source": [
 
2587
  "vegan_recipe_edamam_search(\"Tofu Stir-Fry\")"
2588
  ]
2589
  },
 
86
  }
87
  ],
88
  "source": [
89
+ "#| eval: false\n",
90
  "load_dotenv()"
91
  ]
92
  },
 
96
  "metadata": {},
97
  "outputs": [],
98
  "source": [
99
+ "#| eval: false\n",
100
  "llm = ChatOpenAI(temperature=0)"
101
  ]
102
  },
 
106
  "metadata": {},
107
  "outputs": [],
108
  "source": [
109
+ "#| eval: false\n",
110
  "tools = load_tools([\"llm-math\"], llm=llm)\n",
111
  "agent = initialize_agent(\n",
112
  " tools,\n",
 
220
  "Action Input: 3% * (300 * 30)\u001b[0m\n",
221
  "Observation: \u001b[36;1m\u001b[1;3mAnswer: 270.0\u001b[0m\n",
222
  "Thought:\u001b[32;1m\u001b[1;3mI now know the final answer\n",
223
+ "Final Answer: 270.0\u001b[0m\n",
224
  "\n",
225
  "\u001b[1m> Finished chain.\u001b[0m\n"
226
  ]
 
228
  {
229
  "data": {
230
  "text/plain": [
231
+ "{'input': 'What is the 3% of of 300 * 30?', 'output': '270.0'}"
 
232
  ]
233
  },
234
  "execution_count": null,
 
304
  "metadata": {},
305
  "outputs": [],
306
  "source": [
307
+ "#| eval: false\n",
308
  "agent = OpenAIFunctionsAgent(llm=llm, tools=tools, prompt=prompt)"
309
  ]
310
  },
 
314
  "metadata": {},
315
  "outputs": [],
316
  "source": [
317
+ "#| eval: false\n",
318
  "agent_executor = AgentExecutor(agent=agent, tools=tools, memory=memory, verbose=True)"
319
  ]
320
  },
 
888
  "metadata": {},
889
  "outputs": [],
890
  "source": [
891
+ "#| eval: false\n",
892
  "params = {\n",
893
  " \"location\": \"United States\",\n",
894
  " \"hl\": \"en\",\n",
 
932
  "metadata": {},
933
  "outputs": [],
934
  "source": [
935
+ "#| eval: false\n",
936
  "agent = initialize_agent(\n",
937
  " [time],\n",
938
  " llm,\n",
 
1051
  "metadata": {},
1052
  "outputs": [],
1053
  "source": [
1054
+ "#| eval: false\n",
1055
  "agent = OpenAIFunctionsAgent(\n",
1056
  " llm=llm, tools=[vegan_recipe_serpapi_search], prompt=prompt\n",
1057
  ")"
 
1061
  "cell_type": "code",
1062
  "execution_count": null,
1063
  "metadata": {},
1064
+ "outputs": [
1065
+ {
1066
+ "ename": "NameError",
1067
+ "evalue": "name 'vegan_recipe_serpapi_search' is not defined",
1068
+ "output_type": "error",
1069
+ "traceback": [
1070
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
1071
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
1072
+ "Cell \u001b[0;32mIn[45], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#| eval: false\u001b[39;00m\n\u001b[1;32m 2\u001b[0m agent_executor \u001b[38;5;241m=\u001b[39m AgentExecutor(\n\u001b[0;32m----> 3\u001b[0m agent\u001b[38;5;241m=\u001b[39magent, tools\u001b[38;5;241m=\u001b[39m[\u001b[43mvegan_recipe_serpapi_search\u001b[49m], memory\u001b[38;5;241m=\u001b[39mmemory, verbose\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 4\u001b[0m )\n",
1073
+ "\u001b[0;31mNameError\u001b[0m: name 'vegan_recipe_serpapi_search' is not defined"
1074
+ ]
1075
+ }
1076
+ ],
1077
  "source": [
1078
+ "#| eval: false\n",
1079
  "agent_executor = AgentExecutor(\n",
1080
  " agent=agent, tools=[vegan_recipe_serpapi_search], memory=memory, verbose=True\n",
1081
  ")"
 
2245
  }
2246
  ],
2247
  "source": [
2248
+ "#| eval: false\n",
2249
  "response = get_vegan_recipes_edamam_api({\"q\": \"vegan chicken\"})\n",
2250
  "display(response.ok, response.json()[\"hits\"][0][\"recipe\"])"
2251
  ]
2252
  },
 
 
 
 
 
 
 
2253
  {
2254
  "cell_type": "code",
2255
  "execution_count": null,
 
2257
  "outputs": [],
2258
  "source": [
2259
  "#| export\n",
2260
+ "@tool(return_direct=True)\n",
2261
  "def vegan_recipe_edamam_search(query: str) -> str:\n",
2262
  " \"\"\"\n",
2263
  " Searches for vegan recipes based on a query.\n",
2264
  " If the query is not vegan friendly, adapt it to be.\n",
2265
+ " If the request fails an explanation should be returned.\n",
2266
+ " If the cause of the failure was due to no recipes found, prompt the user to try again with a provided shorter query with one word removed.\n",
2267
  " \"\"\"\n",
2268
+ " max_chars = 45 # 5 chars per word * 9 max words\n",
2269
+ " if len(query) > max_chars:\n",
2270
+ " return f\"The query is too long, try again with a query that is under {max_chars} characters in length.\"\n",
2271
+ "\n",
2272
  " # Veganize the query more\n",
2273
  " if \"vegan\" not in query.lower():\n",
2274
  " query = \"vegan \" + query\n",
 
2283
  "\n",
2284
  " response = get_vegan_recipes_edamam_api(params)\n",
2285
  " if not response.ok:\n",
2286
+ " return (\n",
2287
+ " f\"Received an error from Edamam API: {response.status_code} {response.text}\"\n",
2288
+ " )\n",
2289
+ "\n",
2290
+ " if response.json()[\"count\"] <= 0:\n",
2291
+ " return f\"\"\"No recipes found for query {query}.\n",
2292
+ "This usually occurs when there are too many keywords or ingredients that are not commonly found together in recipes.\n",
2293
+ "I recommend trying again with `{' '.join(query.split(' ')[0:-1])}.`\"\"\"\n",
2294
  "\n",
2295
  " return str([r[\"recipe\"] for r in response.json()[\"hits\"][0:3]])"
2296
  ]
 
2355
  "cell_type": "code",
2356
  "execution_count": null,
2357
  "metadata": {},
2358
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2359
  "source": [
2360
  "#| eval: false\n",
2361
  "agent_executor.run(\"Hello\")"
 
2365
  "cell_type": "code",
2366
  "execution_count": null,
2367
  "metadata": {},
2368
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2369
  "source": [
2370
  "#| eval: false\n",
2371
  "agent_executor.run(\"Help\")"
 
2375
  "cell_type": "code",
2376
  "execution_count": null,
2377
  "metadata": {},
2378
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2379
  "source": [
2380
  "#| eval: false\n",
2381
  "agent_executor.run(\"What is your purpose?\")"
 
2389
  {
2390
  "data": {
2391
  "text/plain": [
2392
+ "[HumanMessage(content='Hello', additional_kwargs={}, example=False),\n",
2393
+ " AIMessage(content='Hi there! How can I assist you today?', additional_kwargs={}, example=False),\n",
2394
+ " HumanMessage(content='Help', additional_kwargs={}, example=False),\n",
2395
+ " AIMessage(content=\"Of course! I'm here to help. What do you need assistance with?\", additional_kwargs={}, example=False),\n",
2396
+ " HumanMessage(content='What is your purpose?', additional_kwargs={}, example=False),\n",
2397
+ " AIMessage(content='My purpose is to assist and provide information to users like you. I can help answer questions, provide recommendations, and assist with various tasks. Is there something specific you would like assistance with?', additional_kwargs={}, example=False)]"
2398
  ]
2399
  },
2400
  "execution_count": null,
 
2419
  "\n",
2420
  "\n",
2421
  "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2422
+ "\u001b[32;1m\u001b[1;3mThat's great! Please let me know the ingredients you have, and I'll help you find some vegan recipes to cook with them.\u001b[0m\n",
2423
  "\n",
2424
  "\u001b[1m> Finished chain.\u001b[0m\n"
2425
  ]
 
2427
  {
2428
  "data": {
2429
  "text/plain": [
2430
+ "\"That's great! Please let me know the ingredients you have, and I'll help you find some vegan recipes to cook with them.\""
2431
  ]
2432
  },
2433
  "execution_count": null,
 
2452
  "\n",
2453
  "\n",
2454
  "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
2455
+ "\u001b[32;1m\u001b[1;3m\n",
2456
+ "Invoking: `vegan_recipe_edamam_search` with `{'query': 'tofu peppers carrots apples bananas kale spinach just egg soy milk'}`\n",
2457
+ "\n",
2458
+ "\n",
2459
+ "\u001b[0m\u001b[36;1m\u001b[1;3mThe query is too long, try again with a query that is under 45 characters in length.\u001b[0m\u001b[32;1m\u001b[1;3m\n",
2460
+ "Invoking: `vegan_recipe_edamam_search` with `{'query': 'tofu peppers carrots apples bananas kale spinach just egg'}`\n",
2461
+ "\n",
2462
+ "\n",
2463
+ "\u001b[0m\u001b[36;1m\u001b[1;3mThe query is too long, try again with a query that is under 45 characters in length.\u001b[0m\u001b[32;1m\u001b[1;3m\n",
2464
+ "Invoking: `vegan_recipe_edamam_search` with `{'query': 'tofu peppers carrots apples bananas kale spinach'}`\n",
2465
+ "\n",
2466
+ "\n",
2467
+ "\u001b[0m\u001b[36;1m\u001b[1;3mThe query is too long, try again with a query that is under 45 characters in length.\u001b[0m\u001b[32;1m\u001b[1;3m\n",
2468
+ "Invoking: `vegan_recipe_edamam_search` with `{'query': 'tofu peppers carrots apples bananas kale'}`\n",
2469
+ "\n",
2470
+ "\n",
2471
+ "\u001b[0m\u001b[36;1m\u001b[1;3mNo recipes found for query vegan tofu peppers carrots apples bananas kale.\n",
2472
+ "This usually occurs when there are too many keywords or ingredients that are not commonly found together in recipes.\n",
2473
+ "I recommend trying again with `vegan tofu peppers carrots apples bananas.`\u001b[0m\u001b[32;1m\u001b[1;3m\n",
2474
+ "Invoking: `vegan_recipe_edamam_search` with `{'query': 'vegan tofu peppers carrots apples bananas'}`\n",
2475
+ "\n",
2476
+ "\n",
2477
+ "\u001b[0m\u001b[36;1m\u001b[1;3mNo recipes found for query vegan tofu peppers carrots apples bananas.\n",
2478
+ "This usually occurs when there are too many keywords or ingredients that are not commonly found together in recipes.\n",
2479
+ "I recommend trying again with `vegan tofu peppers carrots apples.`\u001b[0m\u001b[32;1m\u001b[1;3m\n",
2480
+ "Invoking: `vegan_recipe_edamam_search` with `{'query': 'vegan tofu peppers carrots apples'}`\n",
2481
+ "\n",
2482
+ "\n",
2483
+ "\u001b[0m\u001b[36;1m\u001b[1;3m[{'label': 'Peanut Tofu Stir Fry (Vegan + GF)', 'url': 'http://www.rhiansrecipes.com/2015/12/21/peanut-tofu-stir-fry-vegan-gf/', 'ingredientLines': ['* 2 tablespoon oil (coconut, vegetable or rapeseed), for frying', '* 400 g (14oz) hard, firm tofu', '* 1 red onion, finely sliced', '* 1 carrot, peeled and finely sliced', '* 200 g (7oz) french bean, trimmed and cut in 1/2', '* 1 sweet red pepper, finely sliced', 'for the marinade', '* 2 tablespoon peanut butter', '* 2 tablespoon sweet chilli sauce (you can substitute with chilli and', \"sugar if you don't have thi)\", '* 3 tablespoon soy sauce', '* 2 tablespoon vinegar (rice or apple cider)'], 'totalTime': 0.0}, {'label': 'Vegan Wasabi Slaw', 'url': 'http://kblog.lunchboxbunch.com/2011/07/vegan-wasabi-slaw.html', 'ingredientLines': ['2+ Tbsp wasabi powder', '2 Tbsp grape seed oil', '16 ounces silken tofu', '2-3 Tbsp apple cider vinegar', '1 1/2 Tbsp maple syrup', '2 Tbsp tamari', '1/4 tsp pepper', '2 tsp garlic powder', \"1 Tbsp dried parsley flaves (opt'l)\", \"sea salt (opt'l to taste)\", '1 bad (12 ounces) Brocco Slaw', '1-2 cups shredded carrots', \"1 green apple, shredded (opt'l)\", \"1/2 cup hemp or sunflower seeds (opt'l)\"], 'totalTime': 0.0}, {'label': 'Spicy Salad with Tahini Dressing', 'url': 'http://nimailarson.com/spicy-salad-with-tahini-dressing/', 'ingredientLines': ['2 handfuls of Arugula', '7 Oz Firm Tofu (half a block)', '1/2 Cucumber', '1/4 White Onion', '4 Radishes', '1/4 Cup Sunflower Seeds', '1/4 Cup Nutritional Yeast', '3 Tablespoons Soy Sauce', '1/4 Cup Water', '2 Tablespoons Tahini', '1 Tablespoon Olive Oil', '1 Tablespoon Apple Cider Vinegar', '1 Clove of Garlic', 'Salt, Black Pepper, Turmeric', 'Optional fun toppings: Daiya Vegan Cheese, Avocado, Sprouts, Shredded Carrot or Beetroot'], 'totalTime': 0.0}]\u001b[0m\u001b[32;1m\u001b[1;3mI found some vegan recipes for you based on the ingredients you have:\n",
2484
+ "\n",
2485
+ "1. [Peanut Tofu Stir Fry (Vegan + GF)](http://www.rhiansrecipes.com/2015/12/21/peanut-tofu-stir-fry-vegan-gf/)\n",
2486
+ " - Ingredients: oil, tofu, red onion, carrot, french bean, sweet red pepper, peanut butter, sweet chilli sauce, soy sauce, vinegar\n",
2487
+ " - Total Time: Not specified\n",
2488
+ "\n",
2489
+ "2. [Vegan Wasabi Slaw](http://kblog.lunchboxbunch.com/2011/07/vegan-wasabi-slaw.html)\n",
2490
+ " - Ingredients: wasabi powder, grape seed oil, silken tofu, apple cider vinegar, maple syrup, tamari, pepper, garlic powder, dried parsley flakes, sea salt, Brocco Slaw, shredded carrots, green apple, hemp or sunflower seeds\n",
2491
+ " - Total Time: Not specified\n",
2492
+ "\n",
2493
+ "3. [Spicy Salad with Tahini Dressing](http://nimailarson.com/spicy-salad-with-tahini-dressing/)\n",
2494
+ " - Ingredients: arugula, firm tofu, cucumber, white onion, radishes, sunflower seeds, nutritional yeast, soy sauce, water, tahini, olive oil, apple cider vinegar, garlic, salt, black pepper, turmeric\n",
2495
+ " - Total Time: Not specified\n",
2496
+ "\n",
2497
+ "Please let me know if you would like more information about any of these recipes or if you need help with anything else!\u001b[0m\n",
2498
  "\n",
2499
  "\u001b[1m> Finished chain.\u001b[0m\n"
2500
  ]
 
2502
  {
2503
  "data": {
2504
  "text/plain": [
2505
+ "'I found some vegan recipes for you based on the ingredients you have:\\n\\n1. [Peanut Tofu Stir Fry (Vegan + GF)](http://www.rhiansrecipes.com/2015/12/21/peanut-tofu-stir-fry-vegan-gf/)\\n - Ingredients: oil, tofu, red onion, carrot, french bean, sweet red pepper, peanut butter, sweet chilli sauce, soy sauce, vinegar\\n - Total Time: Not specified\\n\\n2. [Vegan Wasabi Slaw](http://kblog.lunchboxbunch.com/2011/07/vegan-wasabi-slaw.html)\\n - Ingredients: wasabi powder, grape seed oil, silken tofu, apple cider vinegar, maple syrup, tamari, pepper, garlic powder, dried parsley flakes, sea salt, Brocco Slaw, shredded carrots, green apple, hemp or sunflower seeds\\n - Total Time: Not specified\\n\\n3. [Spicy Salad with Tahini Dressing](http://nimailarson.com/spicy-salad-with-tahini-dressing/)\\n - Ingredients: arugula, firm tofu, cucumber, white onion, radishes, sunflower seeds, nutritional yeast, soy sauce, water, tahini, olive oil, apple cider vinegar, garlic, salt, black pepper, turmeric\\n - Total Time: Not specified\\n\\nPlease let me know if you would like more information about any of these recipes or if you need help with anything else!'"
2506
  ]
2507
  },
2508
  "execution_count": null,
 
2585
  }
2586
  ],
2587
  "source": [
2588
+ "#| eval: false\n",
2589
  "vegan_recipe_edamam_search(\"Tofu Stir-Fry\")"
2590
  ]
2591
  },