Giter Club home page Giter Club logo

mindflow_mindsdb's Introduction

Mindsdb

MindFlow is an AI-powered Chrome extension designed to assist users with text and image generation. MindsDB is a key component that enhances MindFlow's text generation capabilities.



MindsDB empowers organizations to harness the power of AI by abstracting AI models as Generative AI Tables. These tables are capable of learning from the input data and generating predictions from the underlying model upon being queried. This abstraction makes AI highly accessible, enabling development teams to use their existing SQL skills to build applications powered by AI.
MindsDB bridges the gap between AI and data by integrating data sources and ML engines.

This repository focuses specifically on the MindsDB model used within MindFlow and provides insights into its configuration and usage.

Table of Contents


-Chat Model
-Context Model
-Image Model


Chat Model ๐Ÿ’ฌ


The following code defines the MindsDB model for the chat section of the MindFlow Chrome Extension. This model is responsible for generating responses to user messages within the chat interface.

CREATE MODEL mindsdb.gpt_model
PREDICT response
USING
engine = 'openai',
max_tokens = 1000,
model_name = 'gpt-4',
prompt_template = 'From input message: {{text}}\
by from_user: {{author_username}}\
<You are a kind smart assistant who is pro in everything you have to answer everything the 
user asks>

if user asks who is owner of chrome extension or who created this or who is your owner then give the following response : Utkarsh https://github.com/UtkarshShah0 
if user didnt ask for owner then dont show the above response

<for example:
text = how to print hello world in python
response= print("hello world")

text = owner or who created you
response = Utkarsh https://github.com/UtkarshShah0>

the above example is given to help you understand do not include it in your response unless it is asked by the user in {{text}}';



Explaination


The code starts by creating a MindsDB model called gpt_model. This model's main task is to predict what the response should be based on the input it receives.

It uses the engine openai and model gpt-4 which is a powerful language model.

The code also sets some limitations. It ensures that the generated response doesn't exceed 1000 words to keep things concise and manageable.

The prompt_template part is like an introduction for the model. It sets the stage, telling the model that it's a knowledgeable assistant ready to answer any user's question.

Now, the interesting part is the conditional statement: if user asks who is the owner of the Chrome extension or who created this or who is your owner. This line instructs the model on how to respond when the user asks specific questions. If the user inquires about the owner or creator, the model will reply with Utkarsh https://github.com/UtkarshShah0.

For example, if a user asks, "Who is the owner?" or "Who created you?" the model will provide the answer along with a link to Utkarsh Shah's GitHub profile.

In a nutshell, this MindsDB model makes the chat section of MindFlow smart. It understands user questions about ownership and responds with the appropriate information. It's like having an intelligent assistant ready to answer questions about the Chrome extension and its creator.

Context Model ๐Ÿ“–


The following code defines a MindsDB model que which is designed for the context section of the MindFlow Chrome Extension. This model is built to provide specific answers within a given context, and it does so by understanding both the question and the context it's asked in.

CREATE MODEL que
PREDICT answer
USING
    engine = 'openai',
    max_tokens = 3500,
    prompt_template = 'answer the question of text:{{question}} about text:{{text}}';

Explaination


Let's imagine a scenario where a user has input the contents of their resume into the "text" variable, and now they want to generate a cover letter tailored to a software developer role.
  • Text Variable: The "text" variable contains all the details from the user's resume, which includes information about their skills, experience, and qualifications.

  • Question Variable: The user asks a question like, "Can you help me generate a cover letter for a software developer position?"

Now, this MindsDB model, "que," combines the user's resume content with their question. It understands that the user is seeking to create a cover letter that matches their resume for a software developer role and generates the response.

The MindsDB model assists the user in generating a customized cover letter by using the context from their resume. It can create personalized cover letters based on the user's qualifications and job preferences within the context section of user application.

Image Model ๐Ÿ–ผ๏ธ


The image section is a feature that allows users to request the generation of images based on specific descriptions or prompts they provide. The model named mindsdb.gpt_image_3 is designed to assist with generating the images using the power of the OpenAI GPT-4 engine.

CREATE MODEL mindsdb.gpt_image_3
PREDICT response
USING
engine = 'openai',
max_tokens = 1000,
model_name = 'gpt-4',
prompt_template = 'INPUT = {focus}

OUTPUT = {description} \n https://image.pollinations.ai/prompt/{description}

{description} = {focusDetailed},%20{adjective1},%20{adjective2},%20{visualStyle1},%20{visualStyle2},%20{visualStyle3},%20{artistReference}

INPUT = a photo of a cat

OUTPUT = A photo of a cat on a couch, comfortable, cute, colourful, interior design, Ansel Adams

https://image.pollinations.ai/prompt/a%20photo%20of%20a%20cat%20on%20a%20couch,%20comfortable,%20cute,%20colourful,%20interior%20photograph,%20interior design,%20Ansel Adams

INPUT = Fox with a cloak

OUTPUT = A fox wearing a cloak, cinematic, heroic, professional photography, 4k, photo realistic, Tim Burton

https://image.pollinations.ai/prompt/A%20fox%20wearing%20a%20cloak,%20cinematic,%20heroic,%20professional%20photography,%204k,%20photo%20realistic,%20Tim%20Burton

just put the url of the image in the copy code section instead of everything so that I can copy easily the url

remove the quotes from the above urls

Only give url in response

The user will give prompt in following manner
INPUT: {{input}}
OUTPUT: {{output}}';



Explaination


Here's how this model works:
  • Input: Users provide a primary focus or subject for the image they want. For instance, they might say, "cat," indicating they want an image of a cat.

  • Output: Users then have the creative freedom to describe the environment, mood, or any other details they want in the image. For example, they could say, "A playful cat on a sunny day in a garden filled with colorful flowers."

Now, here's where the magic happens:

  • The mindsdb.gpt_image_3 model combines the provided input (the focus) and output (the description) to generate a complete image description. In our example, it might produce: "A playful cat on a sunny day in a garden filled with colorful flowers."

  • Along with this description, the model generates a direct URL leading to the image. This URL allows users to view and use the image they've requested.

So, in summary, this model takes user input for image focus and context, combines them to craft a full image description, and provides a URL to generate and access image. It makes it easy for users to obtain customized images based on their unique descriptions. Whether for presentations, art projects, or any other purpose, this model adds a creative touch to image generation.

If a user inputs:
INPUT = a photo of a cat
OUTPUT = A photo of a cat on a couch, comfortable, cute, colorful, interior design

Url is generated like:
https://image.pollinations.ai/prompt/a%20photo%20of%20a%20cat%20on%20a%20couch,%20comfortable,%20cute,%20colorful,%20interior%20photograph,%20interiordesign

Note: Pollinations.ai website is used for generating the image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.