Answers.Body: <p>Well I gotta double check and see if everything is up to date with my assumptions. (I usually answer questions on reddit so I'm still getting used to this).</p>
  <p>Assumption 1: There is a database of json data.
  Ie.
  {
  name: &quot;john&quot;,
  fav_num: 2,
  }</p>
  <p>Assumption 2: You want to ask a question, and then get an AI that is able to go through the database and find &quot;relevant&quot; answer for you. So even if you say, &quot;Give me a recipe for a juicy meal&quot; it'll offer something like a steak versus a fruit juice meal.
  If these two assumptions are true then you're going to be looking at semantic-text-embedding!</p>
  <p><a href="https://js.langchain.com/docs/get_started/quickstart" rel="nofollow noreferrer">https://js.langchain.com/docs/get_started/quickstart</a> here is a pretty good source that talks and shows code examples. It's probably the most complete source on how to do this stuff.</p>
  <p>I'll walk you through the high-level logic behind how it works.</p>
  <ol>
  <li>It takes in text</li>
  <li>It transforms it into a vector based on meaning
  2a. So basically if you put in the word, &quot;big&quot; it'll have a very similar meaning as &quot;huge&quot; so it'll recognize it as the same thing. This is important because it gives you the same meaning from different words. So we can search based on meaning.</li>
  <li>We then search based on the vector using something like cosine similarity or euclidean distance.</li>
  <li>We return the text from the database which has the closest similarity to the semantic text-embedding of the prompt.</li>
  </ol>
  <p>Ie. What semantic-text-embedding does is storing all these different words into the same meaning.</p>
  <p><a href="https://openai.com/blog/introducing-text-and-code-embeddings" rel="nofollow noreferrer">https://openai.com/blog/introducing-text-and-code-embeddings</a></p>
  <p><a href="https://i.sstatic.net/kEyprktb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kEyprktb.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.sstatic.net/n53O2QPN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/n53O2QPN.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.sstatic.net/jtJfT4fF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jtJfT4fF.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-23T12:49:30.033Z
Answers.Text: +1 for the samples.  This is exactly my case, both assumptions are true.  I am doing #1, and #2.  #3 is where I am getting hung up.  I will dig more into the link you provided. Thanks!
Answers.UserDisplayName: Gratzy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-23T13:07:56.083Z
Answers.Text: Good information there.  One question, I'm looking at on device AI and populating it with my data.  It looks like this piece is left out on the link?
Answers.UserDisplayName: Gratzy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-23T07:41:00.230Z
Answers.LastActivityDate: 2024-04-23T07:41:00.230Z
Answers.UserDisplayName: Joseph
Body: <p>I'm a long-time programmer just starting to look at AI so I'm not even sure what I need to ask or search on.  All examples I'm finding out there on Onnx seem to be dealing with images.</p>
  <p>What I'd like to do is read in a dataset, in simplistic concept, a book.  In more complex terms, multiple tables in a DB all containing relative data but in different formats.</p>
  <p>Take for example, a dataset that contains information on cooking:</p>
  <ol>
  <li>A table that contains ingredients</li>
  <li>A table that contains cooking utensils</li>
  <li>a table that contains recipes</li>
  <li>a table that contains cooking processes</li>
  </ol>
  <p>Then I'd like to issue a request like:
  &quot;What do I need to cook chicken parmesan?&quot;</p>
  <p>Or
  &quot;What do I need to make a steak?&quot;</p>
  <p>I assume this is definitely possible.</p>
  <p>I've done some work with flattening queries from users and have that working.  It's helped a lot, but I'm finding writing all ways that a user could ask a question is exhausting.</p>
  <p>Can someone point me to an example that does something similar to this?  Or explain what I need to focus my attention on in learning this process?  I don't have a lot of time to spend learning the details of AI, but I would like to start working with it in a small way.</p>
  
Tags: <ai-design>
Title: Using AI to search for references in a dataset
UserDisplayName: Gratzy
ThreadText: # Using AI to search for references in a dataset
  
  (Asked by: username_0 on 2024-04-23)
  
  I'm a long-time programmer just starting to look at AI so I'm not even sure what I need to ask or search on. All examples I'm finding out there on Onnx seem to be dealing with images.
  
  What I'd like to do is read in a dataset, in simplistic concept, a book. In more complex terms, multiple tables in a DB all containing relative data but in different formats.
  
  Take for example, a dataset that contains information on cooking:
  
  1. A table that contains ingredients
  2. A table that contains cooking utensils
  3. a table that contains recipes
  4. a table that contains cooking processes
  
  Then I'd like to issue a request like:
  "What do I need to cook chicken parmesan?"
  
  Or
  "What do I need to make a steak?"
  
  I assume this is definitely possible.
  
  I've done some work with flattening queries from users and have that working. It's helped a lot, but I'm finding writing all ways that a user could ask a question is exhausting.
  
  Can someone point me to an example that does something similar to this? Or explain what I need to focus my attention on in learning this process? I don't have a lot of time to spend learning the details of AI, but I would like to start working with it in a small way.
  
  **Tags:** ai-design
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-04-23. Score: 1 | Accepted answer
  
  Well I gotta double check and see if everything is up to date with my assumptions. (I usually answer questions on reddit so I'm still getting used to this).
  
  Assumption 1: There is a database of json data.
  Ie.
  {
  name: "john",
  fav\_num: 2,
  }
  
  Assumption 2: You want to ask a question, and then get an AI that is able to go through the database and find "relevant" answer for you. So even if you say, "Give me a recipe for a juicy meal" it'll offer something like a steak versus a fruit juice meal.
  If these two assumptions are true then you're going to be looking at semantic-text-embedding!
  
  <https://js.langchain.com/docs/get_started/quickstart> here is a pretty good source that talks and shows code examples. It's probably the most complete source on how to do this stuff.
  
  I'll walk you through the high-level logic behind how it works.
  
  1. It takes in text
  2. It transforms it into a vector based on meaning
     2a. So basically if you put in the word, "big" it'll have a very similar meaning as "huge" so it'll recognize it as the same thing. This is important because it gives you the same meaning from different words. So we can search based on meaning.
  3. We then search based on the vector using something like cosine similarity or euclidean distance.
  4. We return the text from the database which has the closest similarity to the semantic text-embedding of the prompt.
  
  Ie. What semantic-text-embedding does is storing all these different words into the same meaning.
  
  <https://openai.com/blog/introducing-text-and-code-embeddings>
  
  [![enter image description here](https://i.sstatic.net/kEyprktb.png)](https://i.sstatic.net/kEyprktb.png)
  
  [![enter image description here](https://i.sstatic.net/n53O2QPN.png)](https://i.sstatic.net/n53O2QPN.png)
  
  [![enter image description here](https://i.sstatic.net/jtJfT4fF.png)](https://i.sstatic.net/jtJfT4fF.png)
  
  > **Comments:**
  > **username_0**: +1 for the samples.  This is exactly my case, both assumptions are true.  I am doing #1, and #2.  #3 is where I am getting hung up.  I will dig more into the link you provided. Thanks!  
  > **username_0**: Good information there.  One question, I'm looking at on device AI and populating it with my data.  It looks like this piece is left out on the link?  
  
  ---
  
  