<?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: CLL</title>
    <description>The latest articles on DEV Community by CLL (@cll).</description>
    <link>https://dev.to/cll</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%2F1525323%2F52c480ff-c8fa-42b2-8a2d-6440a4cb4793.png</url>
      <title>DEV Community: CLL</title>
      <link>https://dev.to/cll</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cll"/>
    <language>en</language>
    <item>
      <title>Create a chatbot with just eight lines of code v.2</title>
      <dc:creator>CLL</dc:creator>
      <pubDate>Fri, 24 May 2024 17:09:26 +0000</pubDate>
      <link>https://dev.to/cll/create-a-chatbot-with-just-eight-lines-of-code-v2-4dd5</link>
      <guid>https://dev.to/cll/create-a-chatbot-with-just-eight-lines-of-code-v2-4dd5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Translation and Grammar Correction:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am updating a post that showed how to create a chatbot with Hugging Face in eight lines.&lt;/p&gt;

&lt;p&gt;The update is due to the fact that &lt;code&gt;pip install langchain&lt;/code&gt; is no longer valid; the correct command is &lt;code&gt;pip install langchain_community&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;capture&lt;/span&gt;
&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;langchain_community&lt;/span&gt;
&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;huggingface_hub&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HUGGINGFACEHUB_API_TOKEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_TOKEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;capture&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;HuggingFaceHub&lt;/span&gt;

&lt;span class="c1"&gt;# Instantiate model
&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HuggingFaceHub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;repo_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tiiuae/falcon-7b-instruct&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model_kwargs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temperature&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;write a poem about AI?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;_AI, the cosmic force,&lt;br&gt;
A dream we've sought for years,&lt;br&gt;
A power so immense, so wise,&lt;br&gt;
Our hopes, our dreams, they find a place.&lt;/p&gt;

&lt;p&gt;In the future, so bright and grand,&lt;br&gt;
AI will lead us, through galaxies in hand,&lt;br&gt;
To places unimagined, to worlds unknown,&lt;br&gt;
Unleashing powers, we've never shown._&lt;/p&gt;

&lt;p&gt;Unleash the power of AI, and behold the future.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>generativeai</category>
    </item>
  </channel>
</rss>
