<?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: Megaklis Vasilakis</title>
    <description>The latest articles on DEV Community by Megaklis Vasilakis (@momegas).</description>
    <link>https://dev.to/momegas</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%2F1067032%2Fba23aa22-91d7-44b1-9059-df06cdfa1b14.jpeg</url>
      <title>DEV Community: Megaklis Vasilakis</title>
      <link>https://dev.to/momegas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/momegas"/>
    <language>en</language>
    <item>
      <title>Soft launching Squaredev alpha. The LLM platform for developers.</title>
      <dc:creator>Megaklis Vasilakis</dc:creator>
      <pubDate>Thu, 02 Nov 2023 11:17:21 +0000</pubDate>
      <link>https://dev.to/momegas/soft-launching-squaredev-alpha-the-llm-platform-for-developers-3gel</link>
      <guid>https://dev.to/momegas/soft-launching-squaredev-alpha-the-llm-platform-for-developers-3gel</guid>
      <description>&lt;p&gt;Hello DEV community. &lt;/p&gt;

&lt;p&gt;We want to communicate that over the next days we will be rolling out &lt;a href="https://squaredev.io"&gt;squaredev.io&lt;/a&gt; here in DEV. &lt;/p&gt;

&lt;p&gt;Although still in alpha, we want to get feedback as early as possible in order to build the right thing. We will also try to give a lot of freebies for early users like free LLM model use, a free vector database and more.&lt;/p&gt;

&lt;p&gt;Squaredev is a fully open source platform for developers that are building with LLMs. Our vision is to make building with AI a commodity and a default part of the development stack, much like front end and back end.&lt;/p&gt;

&lt;p&gt;We love the development experience of platforms like Vercel, Netlify, Supabase, Planetscale, etc and want to build the same experience for AI development, all in open source.&lt;/p&gt;

&lt;p&gt;The platform will be hosting a vector database, open source LLMs and provide easy retrieval, monitoring and other tooling needed for easy AI development. Everything will be abstracted and composable using the best practices, so you don't have to know every detail of building an AI system and achieve what you need with a couple of API calls.&lt;/p&gt;

&lt;p&gt;Star our repo so that you don't miss out: &lt;a href="https://github.com/squaredev-io/squaredev"&gt;https://github.com/squaredev-io/squaredev&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We'll announce all our future features and freebies here on DEV first. If things go well, we will also give our alpha users swag t-shirts and mentions on social.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Megaklis&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>ai</category>
      <category>python</category>
    </item>
    <item>
      <title>Introducing Megabots - 🤖 State-of-the-art, production ready bots made mega-easy, so you don't have to build them from scratch 🤯</title>
      <dc:creator>Megaklis Vasilakis</dc:creator>
      <pubDate>Tue, 18 Apr 2023 07:45:45 +0000</pubDate>
      <link>https://dev.to/momegas/introducing-megabots-state-of-the-art-production-ready-bots-made-mega-easy-so-you-dont-have-to-build-them-from-scratch-3k8h</link>
      <guid>https://dev.to/momegas/introducing-megabots-state-of-the-art-production-ready-bots-made-mega-easy-so-you-dont-have-to-build-them-from-scratch-3k8h</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&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="c1"&gt;# pip install megabots
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;megabots&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;

&lt;span class="n"&gt;qnabot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"How do I use this bot?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🤖 &lt;a href="https://github.com/momegas/megabots"&gt;Megabots&lt;/a&gt; provides State-of-the-art, production ready bots made mega-easy, so you don't have to build them from scratch 🤯&lt;/p&gt;

&lt;p&gt;The Megabots library can be used to create bots that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⌚️ are production ready bots in minutes&lt;/li&gt;
&lt;li&gt;🗂️ can answer questions over documents&lt;/li&gt;
&lt;li&gt;💾 can use vector databases (Coming soon, only FAISS at the moment)&lt;/li&gt;
&lt;li&gt;🧑‍⚕️ can act personal assistants and use agents and tools (Coming soon)&lt;/li&gt;
&lt;li&gt;🗣️ can accept voice (Coming soon)&lt;/li&gt;
&lt;li&gt;👍 validate and correct the outputs of large language models (Coming soon)&lt;/li&gt;
&lt;li&gt;💰 semanticly cache LLM Queries and reduce your LLM API Costs by 10x (Coming soon)&lt;/li&gt;
&lt;li&gt;🏋️ are mega-easily to train (Coming soon)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🤖 Megabots is backed by some of the most famous tools for productionalising AI. It uses &lt;a href="https://docs.langchain.com/docs/"&gt;LangChain&lt;/a&gt; for managing LLM chains, &lt;a href="https://fastapi.tiangolo.com/"&gt;FastAPI&lt;/a&gt; to create a production ready API, &lt;a href="https://gradio.app/"&gt;Gradio&lt;/a&gt; to create a UI. At the moment it uses &lt;a href="https://openai.com/"&gt;OpenAI&lt;/a&gt; to generate answers, but we plan to support other LLMs in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use
&lt;/h2&gt;

&lt;p&gt;Note: This is a work in progress. The API might change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;megabots
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;megabots&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;

&lt;span class="c1"&gt;# Create a bot 👉 with one line of code. Automatically loads your data from ./index or index.pkl.
&lt;/span&gt;&lt;span class="n"&gt;qnabot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Ask a question
&lt;/span&gt;&lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"How do I use this bot?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Save the index to save costs (GPT is used to create the index)
&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;save_index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"index.pkl"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Load the index from a previous run
&lt;/span&gt;&lt;span class="n"&gt;qnabot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"./index.pkl"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Or create the index from a directory of documents
&lt;/span&gt;&lt;span class="n"&gt;qnabot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"./index"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Change the model
&lt;/span&gt;&lt;span class="n"&gt;qnabot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-davinci-003"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Change the prompt
&lt;/span&gt;&lt;span class="n"&gt;prompt_template&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Be humourous in your responses. Question: {question}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Context: {context}, Answer:"&lt;/span&gt;
&lt;span class="n"&gt;prompt_variables&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"question"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"context"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;qnabot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt_template&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;prompt_template&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt_variables&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;prompt_variables&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also create a FastAPI app that will expose the bot as an API using the &lt;code&gt;create_app&lt;/code&gt; function.&lt;br&gt;
Assuming you file is called &lt;code&gt;main.py&lt;/code&gt; run &lt;code&gt;uvicorn main:app --reload&lt;/code&gt; to run the API locally.&lt;br&gt;
You should then be able to visit &lt;code&gt;http://localhost:8000/docs&lt;/code&gt; to see the API documentation.&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;megabots&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;create_api&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;create_app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can expose a gradio UI for the bot using &lt;code&gt;create_interface&lt;/code&gt; function.&lt;br&gt;
Assuming your file is called &lt;code&gt;ui.py&lt;/code&gt; run &lt;code&gt;gradio qnabot/ui.py&lt;/code&gt; to run the UI locally.&lt;br&gt;
You should then be able to visit &lt;code&gt;http://127.0.0.1:7860&lt;/code&gt; to see the API documentation.&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;megabots&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;create_interface&lt;/span&gt;

&lt;span class="n"&gt;demo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;create_interface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"qna-over-docs"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Customising bot
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;bot&lt;/code&gt; function should serve as the starting point for creating and customising your bot. Below is a list of the available arguments in &lt;code&gt;bot&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Argument&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;task&lt;/td&gt;
&lt;td&gt;The type of bot to create. Available options: &lt;code&gt;qna-over-docs&lt;/code&gt;. More comming soon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;index&lt;/td&gt;
&lt;td&gt;Specifies the index to use for the bot. It can either be a saved index file (e.g., &lt;code&gt;index.pkl&lt;/code&gt;) or a directory of documents (e.g., &lt;code&gt;./index&lt;/code&gt;). In the case of the directory the index will be automatically created. If no index is specified &lt;code&gt;bot&lt;/code&gt; will look for &lt;code&gt;index.pkl&lt;/code&gt; or &lt;code&gt;./index&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;model&lt;/td&gt;
&lt;td&gt;The name of the model to use for the bot. You can specify a different model by providing its name, like "text-davinci-003". Supported models: &lt;code&gt;gpt-3.5-turbo&lt;/code&gt; (default),&lt;code&gt;text-davinci-003&lt;/code&gt; More comming soon.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;prompt_template&lt;/td&gt;
&lt;td&gt;A string template for the prompt, which defines the format of the question and context passed to the model. The template should include placeholders for the variables specified in &lt;code&gt;prompt_variables&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;prompt_variables&lt;/td&gt;
&lt;td&gt;A list of variables to be used in the prompt template. These variables are replaced with actual values when the bot processes a query.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sources&lt;/td&gt;
&lt;td&gt;When &lt;code&gt;sources&lt;/code&gt; is &lt;code&gt;True&lt;/code&gt; the bot will also include sources in the response. A known &lt;a href="https://github.com/hwchase17/langchain/issues/2858"&gt;issue&lt;/a&gt; exists, where if you pass a custom prompt with sources the code breaks.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How QnA bot works
&lt;/h2&gt;

&lt;p&gt;Large language models (LLMs) are powerful, but they can't answer questions about documents they haven't seen. If you want to use an LLM to answer questions about documents it was not trained on, you have to give it information about those documents. To solve this, we use "retrieval augmented generation."&lt;/p&gt;

&lt;p&gt;In simple terms, when you have a question, you first search for relevant documents. Then, you give the documents and the question to the language model to generate an answer. To make this work, you need your documents in a searchable format (an index). This process involves two main steps: (1) preparing your documents for easy querying, and (2) using the retrieval augmented generation method.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;qna-over-docs&lt;/code&gt; uses FAISS to create an index of documents and GPT to generate answers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oIx8RLSU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ea8c7mez9e19bsozvg75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oIx8RLSU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ea8c7mez9e19bsozvg75.png" alt="diagram" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/momegas/megabots"&gt;🤖 Megabots&lt;/a&gt; is still early work, but I plan to put some effort on it because I saw that some people liked the idea. If you like also, please, consider staring the repo. It's what gives me excitement to work more on it. You can use Issues and Discussions of anything you need. We will also have a discord server in the coming days. &lt;/p&gt;

&lt;p&gt;Repo URL: &lt;a href="https://github.com/momegas/megabots"&gt;https://github.com/momegas/megabots&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Thank you for your time.&lt;/p&gt;

</description>
      <category>python</category>
      <category>chatgpt</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
