<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abdallah Meddah</title>
    <description>The latest articles on DEV Community by Abdallah Meddah (@abdallah_meddah).</description>
    <link>https://dev.to/abdallah_meddah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1662296%2F2d0efa74-5a1f-45a5-9d26-4f438af76419.png</url>
      <title>DEV Community: Abdallah Meddah</title>
      <link>https://dev.to/abdallah_meddah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abdallah_meddah"/>
    <language>en</language>
    <item>
      <title>LLM operators, an approach that opens up new possibilities</title>
      <dc:creator>Abdallah Meddah</dc:creator>
      <pubDate>Fri, 21 Jun 2024 16:12:04 +0000</pubDate>
      <link>https://dev.to/abdallah_meddah/llm-operators-144h</link>
      <guid>https://dev.to/abdallah_meddah/llm-operators-144h</guid>
      <description>&lt;p&gt;I am sure that like many of us, we can't wait till the day AI finally replaces us so we can finish all our side projects. However, and that's my opinion, I don't think we are there yet. My intuition tells me that the LLMs have been able to model a function that takes in many words (tokens) and outputs one word, I am not sure they can do abstractions and build upon ideas like humans do. Anyhow, I also think that LLMs bring something new to the table, something that we have not been exploiting correctly so far, again, in my opinion.&lt;/p&gt;

&lt;p&gt;When processing data using LLMs the community has been very inventive over the last two years, coming up with a bunch of prompting techniques and RAG techniques to provide the necessary context to extract something valuable from these LLMs. However, from what I have seen from my workplace and after discussing with a few people, it turns out the results are never entirely satisfying, and all that LLMs are useful for today is acting like an enhanced search engine.&lt;/p&gt;

&lt;p&gt;I believe that we can use LLMs more than just as search engine, I believe we can write operators that leverage these LLMs to operate on data we don't know the exact structure of. For example, say you're scraping a web page for a certain date, the actual HTML might change a lot changing the selectors used, but the page always shows the date you're looking for in a way comprehensible by humans, if you write an algorithm that relies on the HTML structure or a specific wording, it won't necessarily always work. But what if you feed the content of the page to an LLM, it will be able to effectively get you the correct value each time. And that's why I wrote a library in JavaScript that contains a few operators that leverage LLMs to process data. This is an example of a text you might want to get from an HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Unsure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;div class=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;scrapable&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;&amp;gt;Target Content&amp;lt;div&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flatMapTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;contain of the div with the class scrapable&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// this will yield "target content"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, we can process data that is not well-polished and doesn't necessarily have a consistent structure.&lt;/p&gt;

&lt;p&gt;We can also evaluate data that we don't know entirely, say you want to get better feedback on your app than just a 5-star rating, and you want your user to leave a comment, and according to comments you prioritize the bug backlog ( I know you have one, just like the rest of us ). You can do something like that&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Unsure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userComment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;categorize&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bug ticket 139&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bug ticket 639&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bug ticket 420&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
             &lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// this will yield "bug ticket 639" for example if the user comments about a bug that's described by ticket 639&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'll give one last example and then I'll give you a link to the library where there are other examples.&lt;/p&gt;

&lt;p&gt;Suppose you have to filter a list of documents by keeping only the ones that talk about a legal subject that's between two certain entities in a certain year, you can simply do something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nc"&gt;Unsure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;A legal document between entity1 and 2 that happened in 2024&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;wantedDocuments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And far more cases where we can leverage LLMs to process data that we couldn't have processed correctly before. Here is the link to the library in javascript &lt;a href="https://www.npmjs.com/package/unsure-js"&gt;Unsure&lt;/a&gt; and here's the python &lt;a href="https://pypi.org/project/unsurepy/"&gt;package&lt;/a&gt;. It's in javascript and python so far, I am currently re-writing it in Rust and Go.&lt;/p&gt;

&lt;p&gt;Thank you for reading! &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ai</category>
      <category>discuss</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
