<?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: Nguyễn Thanh Tùng</title>
    <description>The latest articles on DEV Community by Nguyễn Thanh Tùng (@tungnt1203).</description>
    <link>https://dev.to/tungnt1203</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F967300%2F5972ca54-95f0-41af-b652-ce270e5f24f9.png</url>
      <title>DEV Community: Nguyễn Thanh Tùng</title>
      <link>https://dev.to/tungnt1203</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tungnt1203"/>
    <language>en</language>
    <item>
      <title>Rails + Rspack: esbuild speed, webpack features, one command</title>
      <dc:creator>Nguyễn Thanh Tùng</dc:creator>
      <pubDate>Thu, 19 Nov 2026 04:23:53 +0000</pubDate>
      <link>https://dev.to/tungnt1203/rails-rspack-esbuild-speed-webpack-features-one-command-4652</link>
      <guid>https://dev.to/tungnt1203/rails-rspack-esbuild-speed-webpack-features-one-command-4652</guid>
      <description>&lt;h2&gt;
  
  
  Why I went looking
&lt;/h2&gt;

&lt;p&gt;I wanted one thing from my Rails frontend setup: change a file and see it on the page, without losing where I was.&lt;/p&gt;

&lt;p&gt;esbuild through jsbundling-rails gets close. Builds are fast and the config is one line. But every change is a full page reload. The modal I opened, the form I half filled, the Stimulus controller's state: gone, every time. Over a day of UI work that adds up to hundreds of small resets.&lt;/p&gt;

&lt;p&gt;Webpacker and Shakapacker give you hot module replacement, but I remember what came with it. A config you are scared to touch, cold builds measured in tens of seconds, and upgrades that meant diffing generated files by hand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://rspack.rs" rel="noopener noreferrer"&gt;Rspack&lt;/a&gt; promised both: webpack's features, including HMR, with a Rust core that builds at esbuild speed. So I tried it on a Rails app, and then I wrapped what I learned into a gem, &lt;a href="https://github.com/tungnt1203/rspack_rails" rel="noopener noreferrer"&gt;rspack_rails&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first ten minutes
&lt;/h2&gt;

&lt;p&gt;A new app is three commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails new myapp -m https://raw.githubusercontent.com/tungnt1203/rspack_rails/main/template.rb
&lt;span class="nb"&gt;cd&lt;/span&gt; myapp
bin/dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The template asks which extras you want: Stimulus, TypeScript, React, Tailwind CSS, Sass. &lt;code&gt;bin/dev&lt;/code&gt; starts Rails and &lt;code&gt;rspack serve&lt;/code&gt; side by side.&lt;/p&gt;

&lt;p&gt;Then the part that sold me. I edited a Stimulus controller, and the page did not reload. The controller was swapped in place, and the element I was poking at kept its state. Same with CSS, and with React components through Fast Refresh. When I edited an ERB view, the page reloaded on its own, which is what you want for server-rendered HTML.&lt;/p&gt;

&lt;p&gt;The layout needs only two helpers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;rspack_javascript_tag&lt;/span&gt; &lt;span class="s2"&gt;"application"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"data-turbo-track"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"reload"&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;rspack_stylesheet_tag&lt;/span&gt; &lt;span class="s2"&gt;"application"&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An existing app is &lt;code&gt;bundle add rspack_rails&lt;/code&gt; and &lt;code&gt;bin/rails rspack:install&lt;/code&gt;. An app on importmap-rails or jsbundling-rails can run &lt;code&gt;bin/rails rspack:migrate&lt;/code&gt; from a clean git tree and review the diff.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;Rspack is not the fastest at everything, and I think that is the honest headline. esbuild still wins a cold build, by a few hundred milliseconds. Rspack wins the number you feel all day: the rebuild after you save a file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx7cvs4ed3dbjrboekzws.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx7cvs4ed3dbjrboekzws.png" alt="Bar charts: rebuild after editing one component and production build times for Rspack, esbuild and webpack at 1,000 and 5,000 components" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Measured on an Apple M1, Node 26. Medians of 5 cold builds and 10 watch rebuilds, November 2026.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A rebuild after editing one component took 83 ms with Rspack and 279 ms with esbuild, on 1,000 components. Cold development builds were a tie between the two (0.55 s and 0.54 s), with webpack at 1.46 s. Against webpack, Rspack's production build is 6 to 9 times faster.&lt;/p&gt;

&lt;p&gt;And the rebuild number undersells it. esbuild has no HMR, so after its rebuild the browser still reloads the whole page. Rspack sends only the changed module.&lt;/p&gt;

&lt;p&gt;How I measured: the same generated React 19 + TypeScript app (lodash-es, date-fns), built to ES2022 with source maps. esbuild runs with the flags jsbundling-rails uses, plus &lt;code&gt;--minify&lt;/code&gt;. webpack 5 uses swc-loader, as Shakapacker can. Times include about 0.2 s of &lt;code&gt;npx&lt;/code&gt; and Node startup. Gzipped output was 100 KB for Rspack and webpack, 120 KB for esbuild.&lt;/p&gt;

&lt;p&gt;The proxy rspack_rails puts in front of the dev server costs about 1.8 ms per page navigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned building the gem
&lt;/h2&gt;

&lt;p&gt;Getting Rspack to run in Rails takes an afternoon. Getting it to stay out of your way took the rest. Four decisions mattered most.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Production stays boring.&lt;/strong&gt; Rspack writes to &lt;code&gt;app/assets/builds&lt;/code&gt;, and Propshaft or Sprockets fingerprints and serves the files, the same way jsbundling-rails works. Production never needs Node at runtime, and there is no second manifest system to debug at 2 a.m.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The dev server hides behind Rails.&lt;/strong&gt; Pages load scripts from &lt;code&gt;/rspack/...&lt;/code&gt; on the app's own origin, and Rails proxies them to &lt;code&gt;rspack serve&lt;/code&gt;. I learned why the hard way: browsers refuse to start a Web Worker from another origin, so loading straight from &lt;code&gt;localhost:3036&lt;/code&gt; breaks workers. Only the HMR websocket talks to the dev server directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The config is owned, not generated once.&lt;/strong&gt; Webpacker's pain was a config generated on install and never upgraded again. Here the base config, &lt;code&gt;config/rspack/rails.mjs&lt;/code&gt;, belongs to the gem and is rewritten on every upgrade. Your changes live in a callback in &lt;code&gt;rspack.config.mjs&lt;/code&gt;. If someone edits the gem's file by hand, a checksum notices and the edit is backed up before anything is replaced.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A doctor that tells you what to type.&lt;/strong&gt; &lt;code&gt;bin/rails rspack:doctor&lt;/code&gt; checks Node.js, packages, config, layouts, &lt;code&gt;Procfile.dev&lt;/code&gt;, the Dockerfile and the dev server. Every warning ends with the command that fixes it. It is the first thing I run when something looks off.&lt;/p&gt;

&lt;p&gt;The bugs that taught me the most came from real apps, not tests. Migrating an app with two layouts showed that the admin layout silently lost its JavaScript. That fix shipped in 1.0.0.rc2.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you should not use it
&lt;/h2&gt;

&lt;p&gt;If your app has a few Stimulus controllers and no npm packages that need bundling, stay on importmap-rails. It is the Rails default for good reasons: no Node, no build step, nothing to learn.&lt;/p&gt;

&lt;p&gt;If you bundle but never miss HMR, esbuild through jsbundling-rails is a fine choice. It is simple, very fast on cold builds, and has fewer moving parts than any webpack-style tool.&lt;/p&gt;

&lt;p&gt;rspack_rails is for the point where you want more than that: React or TypeScript with Fast Refresh, code splitting, CSS modules, loaders, or the webpack plugin you already know. That is where I kept wishing for webpack's features without webpack's wait.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;rspack_rails 1.0 is on RubyGems. It supports Rails 7.2 and 8.x, Propshaft and Sprockets, and npm, Yarn, pnpm and bun.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails new myapp -m https://raw.githubusercontent.com/tungnt1203/rspack_rails/main/template.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Code and docs: &lt;a href="https://github.com/tungnt1203/rspack_rails" rel="noopener noreferrer"&gt;github.com/tungnt1203/rspack_rails&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Demo app: &lt;a href="https://github.com/tungnt1203/rspack_rails-demo" rel="noopener noreferrer"&gt;rspack_rails-demo&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try it on a real app, I would love to hear what broke. The best fixes so far came from exactly that. Open an issue, or tell me in the comments.&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
      <category>javascript</category>
      <category>webpack</category>
    </item>
    <item>
      <title>minds on rails parametric search and semantic search</title>
      <dc:creator>Nguyễn Thanh Tùng</dc:creator>
      <pubDate>Sat, 19 Oct 2024 13:07:19 +0000</pubDate>
      <link>https://dev.to/tungnt1203/minds-on-rails-parametric-search-and-semantic-search-4f86</link>
      <guid>https://dev.to/tungnt1203/minds-on-rails-parametric-search-and-semantic-search-4f86</guid>
      <description>&lt;p&gt;What is a Minds ?&lt;/p&gt;

&lt;p&gt;Minds work similarly to large language models (LLMs) but go beyond by answering any question from any data. This is accomplished by selecting the most relevant data for an answer using parametric search, understanding the meaning and providing responses within the correct context through semantic search, and finally, delivering precise answers by analyzing data and using machine learning (ML) models.&lt;/p&gt;

&lt;p&gt;demo: &lt;a href="https://www.youtube.com/watch?v=art6M8lLH6M" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=art6M8lLH6M&lt;/a&gt;&lt;br&gt;
repo: &lt;a href="https://github.com/tungnt1203/minds_ruby_sdk" rel="noopener noreferrer"&gt;https://github.com/tungnt1203/minds_ruby_sdk&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What is a Mind</title>
      <dc:creator>Nguyễn Thanh Tùng</dc:creator>
      <pubDate>Thu, 17 Oct 2024 17:27:04 +0000</pubDate>
      <link>https://dev.to/tungnt1203/what-is-a-mind-2b2p</link>
      <guid>https://dev.to/tungnt1203/what-is-a-mind-2b2p</guid>
      <description>&lt;p&gt;Minds work similarly to &lt;strong&gt;large language models(LLMs) but go beyond&lt;/strong&gt; by answering any question from any data. This is accomplished by selecting the most relevant data for an answer using parametric search, understanding the meaning and providing responses within the correct context through semantic search, and finally, delivering precise answers by analyzing data and using machine learning (ML) models.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Minds Ruby SDK?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/tungnt1203/minds_ruby_sdk" rel="noopener noreferrer"&gt;https://github.com/tungnt1203/minds_ruby_sdk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Minds Ruby SDK is a Ruby library that allows you to interact with MindsDB - a platform that helps integrate machine learning and AI into your database. This SDK provides simple methods to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manage data sources (Datasources)&lt;/li&gt;
&lt;li&gt;Create and manage "Minds" - trained AI models&lt;/li&gt;
&lt;li&gt;Perform AI queries on your data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Use Minds Ruby SDK
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Installation and Configuration
&lt;/h3&gt;

&lt;p&gt;First, you need to install the gem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem install minds_ruby_sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, configure the SDK with your API key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'minds'&lt;/span&gt;

&lt;span class="no"&gt;Minds&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;configure&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'your_api_key_here'&lt;/span&gt;
  &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;base_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'https://mdb.ai'&lt;/span&gt; &lt;span class="c1"&gt;# or URL of your private instance&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Minds&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Managing Datasources
&lt;/h3&gt;

&lt;p&gt;You can easily add, view, and delete data sources:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Create a new datasource&lt;/span&gt;
&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Minds&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Resources&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;DatabaseConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="ss"&gt;name: &lt;/span&gt;&lt;span class="s1"&gt;'my_postgres_db'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;engine: &lt;/span&gt;&lt;span class="s1"&gt;'postgres'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;description: &lt;/span&gt;&lt;span class="s1"&gt;'My PostgreSQL database'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;connection_data: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ss"&gt;host: &lt;/span&gt;&lt;span class="s1"&gt;'localhost'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;port: &lt;/span&gt;&lt;span class="mi"&gt;5432&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;user: &lt;/span&gt;&lt;span class="s1"&gt;'username'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;password: &lt;/span&gt;&lt;span class="s1"&gt;'password'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;database: &lt;/span&gt;&lt;span class="s1"&gt;'my_db'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datasources&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# List all datasources&lt;/span&gt;
&lt;span class="n"&gt;all_datasources&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datasources&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;

&lt;span class="c1"&gt;# Find a specific datasource&lt;/span&gt;
&lt;span class="n"&gt;my_datasource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datasources&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my_postgres_db'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Delete a datasource&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datasources&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my_postgres_db'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;see support &lt;a href="https://docs.mdb.ai/docs/data_sources" rel="noopener noreferrer"&gt;datasources &lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Working with Minds
&lt;/h3&gt;

&lt;p&gt;Minds are AI models trained on your data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Create a new mind&lt;/span&gt;
&lt;span class="n"&gt;new_mind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;minds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="ss"&gt;name: &lt;/span&gt;&lt;span class="s1"&gt;'my_smart_mind'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;model_name: &lt;/span&gt;&lt;span class="s1"&gt;'gpt-3.5-turbo'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;provider: &lt;/span&gt;&lt;span class="s1"&gt;'openai'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;datasources: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'my_postgres_db'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="ss"&gt;prompt_template: &lt;/span&gt;&lt;span class="s2"&gt;"Answer questions about the data in my_postgres_db: {{question}}"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Find a mind&lt;/span&gt;
&lt;span class="n"&gt;my_mind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;minds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my_smart_mind'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Update a mind&lt;/span&gt;
&lt;span class="n"&gt;my_mind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;prompt_template: &lt;/span&gt;&lt;span class="s2"&gt;"New instructions: {{question}}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Delete a mind&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;minds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'my_smart_mind'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Completion:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;my_mind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;completion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;message: &lt;/span&gt;&lt;span class="s2"&gt;"What is the total revenue for last month?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;

&lt;span class="c1"&gt;# Or use stream mode&lt;/span&gt;
&lt;span class="n"&gt;my_mind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;completion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;message: &lt;/span&gt;&lt;span class="s2"&gt;"Analyze sales trends"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;stream: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"choices"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"delta"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Minds Ruby SDK opens up a new world for Ruby developers, allowing them to easily integrate AI into their applications. From managing data sources to creating and using AI models, this SDK provides a simple yet powerful interface for interacting with Minds.&lt;/p&gt;

&lt;p&gt;With Minds Ruby SDK, building intelligent applications capable of answering complex questions based on your data becomes easier than ever. Experiment and explore the new possibilities this SDK brings to your projects!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>ruby</category>
      <category>machinelearning</category>
      <category>mindsdb</category>
    </item>
  </channel>
</rss>
