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 ( any) => await geminiLayer({
    context: {
        name: 'your name',
        email: 'your email',
        summary: 'your summary'
        // and more properties
}, bot)

Vision Example

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 ( any) => await geminiLayer({
    vision: true,
    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)


My first chatbot

Learn how build your first chatbot in few minutes

Read more


Understand the essential concepts for building bots

Read more

Add Functions

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

Read more


Unlimitate and start implementing the community plugins.

Read more



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.


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


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