Logo

dev-resources.site

for different kinds of informations.

What is a Mind

Published at
10/17/2024
Categories
ai
ruby
machinelearning
mindsdb
Author
tungnt1203
Categories
4 categories in total
ai
open
ruby
open
machinelearning
open
mindsdb
open
Author
10 person written this
tungnt1203
open
What is a Mind

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.

What is Minds Ruby SDK?

https://github.com/tungnt1203/minds_ruby_sdk

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:

  • Manage data sources (Datasources)
  • Create and manage "Minds" - trained AI models
  • Perform AI queries on your data

How to Use Minds Ruby SDK

1. Installation and Configuration

First, you need to install the gem:

gem install minds_ruby_sdk
Enter fullscreen mode Exit fullscreen mode

Then, configure the SDK with your API key:

require 'minds'

Minds::Client.configure do |config|
  config.api_key = 'your_api_key_here'
  config.base_url = 'https://mdb.ai' # or URL of your private instance
end

client = Minds::Client.new
Enter fullscreen mode Exit fullscreen mode

2. Managing Datasources

You can easily add, view, and delete data sources:

# Create a new datasource
config = Minds::Resources::DatabaseConfig.new(
  name: 'my_postgres_db',
  engine: 'postgres',
  description: 'My PostgreSQL database',
  connection_data: {
    host: 'localhost',
    port: 5432,
    user: 'username',
    password: 'password',
    database: 'my_db'
  }
)
client.datasources.create(config)

# List all datasources
all_datasources = client.datasources.all

# Find a specific datasource
my_datasource = client.datasources.find('my_postgres_db')

# Delete a datasource
client.datasources.destroy('my_postgres_db')
Enter fullscreen mode Exit fullscreen mode

see support datasources

3. Working with Minds

Minds are AI models trained on your data:

# Create a new mind
new_mind = client.minds.create(
  name: 'my_smart_mind',
  model_name: 'gpt-3.5-turbo',
  provider: 'openai',
  datasources: ['my_postgres_db'],
  prompt_template: "Answer questions about the data in my_postgres_db: {{question}}"
)
# Find a mind
my_mind = client.minds.find('my_smart_mind')

# Update a mind
my_mind.update(prompt_template: "New instructions: {{question}}")

# Delete a mind
client.minds.destroy('my_smart_mind')
Enter fullscreen mode Exit fullscreen mode

4. Completion:

response = my_mind.completion(message: "What is the total revenue for last month?")
puts response

# Or use stream mode
my_mind.completion(message: "Analyze sales trends", stream: true) do |chunk|
  puts chunk.dig("choices", 0, "delta", "content")
end
Enter fullscreen mode Exit fullscreen mode

Conclusion

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.

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!

mindsdb Article's
30 articles in total
Favicon
What is a Mind
Favicon
Mind Your Manners: How Politeness Can Make AI Smarter
Favicon
AutoGenius: AI-Powered Car Valuation and Trading Assistant
Favicon
How to build your Developer Portfolio with MindsDB: The symbiotic relationship between developers and Opensource in 2024.
Favicon
Deploying a MindsDB-powered PostgreSQL database on Vercel
Favicon
AI-Powered Selection of Asset Management Companies using MindsDB and LlamaIndex
Favicon
Using Large Language Models inside your database with MindsDB
Favicon
Measure Customer Support Sentiment Analysis with GPT, Airbyte and MindsDB
Favicon
Harnessing the Dual LLM Pattern for Prompt Security with MindsDB
Favicon
Unveiling the Dark Side of AI: How Prompt Hacking Can Sabotage Your AI Systems
Favicon
How to add AI image generation to your application
Favicon
Introducing MindsDB Playground: Your all-in-one MindsDB Companion App
Favicon
How to Make a Gmail Bot with a persona using OpenAI GPT and MindsDB
Favicon
Tutorial to Predict the Type of Glass using MongoDB
Favicon
Tutorial to Predict the Rating of Cars using Mindsdb and MongoDB
Favicon
Tutorial to Predict Gold Prices using Mindsdb and MongoDB
Favicon
How Developers should take advantage of MindsDB's Integration with OpenAI Chat GPT-3
Favicon
Tutorial to Predict the Energy Usage using MindsDB and MongoDB
Favicon
Extract Insights from Text Data inside Databases using OpenAI GPT-3 and MindsDB Integration
Favicon
Classify and label text in your database with Hugging Face and MindsDB integration
Favicon
How to predict purchase intent using SQL
Favicon
Everything You Need to Know about Open-Source Predictive Analytics Platform MindsDB
Favicon
Predicting gold prices with MindsDB and MongoDB
Favicon
Using MindsDB for Time Series Forecasting - Honey Production in the USA
Favicon
Predict Diamond prices with SQL Alchemy and MindsDB
Favicon
Tutorial to Predict the Weather Using MindsDB and MongoDB
Favicon
Predicting Environment Impact of Food Production caused by C02 Emission
Favicon
Predicting & Visualizing Gas Prices with MindsDB and Tableau
Favicon
Predicting & Visualizing Petroleum Production with MindsDB and Tableau
Favicon
Tutorial to Predict the Genre of Books using MindsDB [Mongo API]

Featured ones: