🚀 ¡Nuevo! builderbot cloud para No-code ¡Pruébalo gratis!

Chatbot with Context

The gemini model is a generous and valuable resource to use if it comes to creating a product with AI that has both vision and text generation and without spending a penny is what we want.

To start remember to install the gemini plugin and have your Google Api key


Install Gemini

We started the installation of a package that will help you to implement the Gemin power in builderbot.

pnpm install @builderbot-plugins/gemini-layer

Context Example

Sometimes we don't want to place so many keywords or answers in validations of our flows, we want some freedom when it comes to responding, that's why we have the gemini plugin to respond based on a context

the context indicates between key value, the different scenarios in which the user may be when interacting with the assistant

context: It is the object that will contain all the necessary properties you need.

import { geminiLayer } from "@builderbot-plugins/gemini-layer"

export default async (...bot: any) => await geminiLayer({
    context: {
        name: 'your name',
        email: 'your email',
        summary: 'your summary'
        // and more properties
    }
}, bot)

Vision Example

FieldDescription
visiontrue
visionPromptWhat you want the model to see
image_pathThe route where the image will be downloaded to be analyzed later
cbA callback that receives the same interface as addAction and which returns an answer in the state
import { geminiLayer } from "@builderbot-plugins/gemini-layer"

const visionPrompt = 'Give me a brief summary of what you see in the picture'

export default async (...bot: any) => await geminiLayer({
    vision: true,
    visionPrompt,
    image_path: './',
    cb: async (_, { state, gotoFlow }) => {
        const { answer } = state.getMyState()
        console.log('answer about image', answer)

        if (answer === 'anything else you want to validate') {
            return gotoFlow('any flow you want to go')
        }
    }
}, bot)

Guides

My first chatbot

Learn how build your first chatbot in few minutes

Read more

Concepts

Understand the essential concepts for building bots

Read more

Add Functions

The key to learning how to write flows is add-functions.

Read more

Plugins

Unlimitate and start implementing the community plugins.

Read more

Resources

Modularize

Learn how to modularise flows so that you can have a more maintainable bot.

Send Message

How to send a message via HTTP to start conversations, you can send multimedia as well.

Dockerizer

A good practice is to dockerise your bots to make them more maintainable and effective.

Events

Learning about events will make us more fluent when creating chatbots.