# AI and Recipe ! (Or structured data with LLM)

**URL:** <https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458>\
**Category:** Community\
**Tags:** langchain, python, llm\
**Created:** [May 3, 2024, 4:11pm UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458 "2024-05-03T16:11:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cechgmyt](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/cechgmyt/32/285036_2.png) [@cechgmyt](https://community.openai.com/u/cechgmyt)\
**Post date:** [May 3, 2024, 4:11pm UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458/1 "2024-05-03T16:11:42Z")

</div>

Hello everyone !

I would like to share a cool project I’m working on. Of course it’s cool because I fell in love with the problem otherwise it might seem dull and painful.

My topic is automate diet with AI.

Contact me if you are interested to solve this problem.

---

<div class="post-metadata">

**Author:** ![Diet](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/diet/32/562749_2.png) [@Diet](https://community.openai.com/u/Diet)\
**Post date:** [May 3, 2024, 4:56pm UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458/2 "2024-05-03T16:56:03Z")

</div>

> [@cechgmyt](#):
>
> automate […] diet

👀

Looks interesting!

> [@cechgmyt](#):
>
> Ask llm which Categories is this aliment from the following list

Have you considered using embeddings? Might be considerably cheaper. You get a vector back, and you compare it to the vectors of your categories to see if you have a match. If you have enough RAM, you might even be able to run some top of the line models on your laptop 🙂

---

<div class="post-metadata">

**Author:** ![cechgmyt](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/cechgmyt/32/285036_2.png) [@cechgmyt](https://community.openai.com/u/cechgmyt)\
**Post date:** [May 3, 2024, 6:29pm UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458/3 "2024-05-03T18:29:41Z")

</div>

Hi Diet !

I like your nickname ! So if I understand correctly. I keep step 1) and for step 2) I use embedding + similarity search.

I can try that on hands example doing step 1) myself just to check if it works. I can use chrome db for example.

---

<div class="post-metadata">

**Author:** ![cechgmyt](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/cechgmyt/32/285036_2.png) [@cechgmyt](https://community.openai.com/u/cechgmyt)\
**Post date:** [May 3, 2024, 8:14pm UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458/4 "2024-05-03T20:14:58Z")

</div>

I tried with GloVe, I had the map between the recipe name and my database : {‘leftover white rice, preferably long-grain or Carolina Gold Cooked’: ‘Cooked white rice’, ‘Eggs Cooked’: ‘Cooked saithe’, ‘zucchini Cooked’: ‘Cooked zucchini’, 'mint ': ‘Pepper mint’, 'green onion ': ‘Red onion’, 'sharp white Cheddar ': ‘Cow White cheese 0%’, 'salt ': ‘Flower of salt’, 'black pepper ': ‘Black pepper’, 'butter ': ‘Peanut butter’}

I’m not a pro, it is promising which means should I push even push push in this direction ?

---

<div class="post-metadata">

**Author:** ![Diet](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/diet/32/562749_2.png) [@Diet](https://community.openai.com/u/Diet)\
**Post date:** [May 4, 2024, 4:06pm UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458/5 "2024-05-04T16:06:06Z")

</div>

> [@cechgmyt](#):
>
> I’m not a pro, it is promising which means should I push even push push in this direction ?

It’s an option 🙂

Glove is just a simple word embedding model if I recall correctly. You can leverage the vast knowedge of LLMs by using LLM derived embedding models, such as OpenAI’s text-emedding-3-large, for example. The mistral derived embedding models are even more powerful.

---

<div class="post-metadata">

**Author:** ![cechgmyt](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/cechgmyt/32/285036_2.png) [@cechgmyt](https://community.openai.com/u/cechgmyt)\
**Post date:** [May 8, 2024, 9:33am UTC](https://community.openai.com/t/ai-and-recipe-or-structured-data-with-llm/735458/6 "2024-05-08T09:33:36Z")

</div>

I push in this direction with

> EMBEDDING\_MODEL = “text-embedding-3-small”

And I return the top 10 nearest embedding. I think the solution will be in the list most of the time (let’s push in this direction at leat I belive in 🚗).  
And it’s fast because I use cached my embedding and I use pickle to retrieve them faster.  
The slow part is using llm to answer the question :  
`This is an ingredient {ing}, and this ingredient is in the following list (with another name) {l_ing}. Find it.`  
Then I retrieve from the answer the name of the ingredients (fast).
