Bailoo Installation
Empowering DeFi Applications with Intelligent Conversational Interfaces
Welcome to the Bailoo! This guide will help you quickly integrate and configure an AI powered chat widget in your application to enable natural language-driven actions and seamless with LLMs
Overview
The AI Agent Widget is a customizable tool that allows developers to integrate AI capabilities into their applications. It enables users to perform tasks, retrieve information, and interact with applications through natural language.
Key Features
Customizable Tools: Define tools that the agent can use, including their functionality, input parameters, and associated UI components.
Dynamic Suggestions: Provide users with interactive suggestions to improve engagement.
Tailored Appearance: Customize the widget's look and feel to match your app's branding.
Human-In-The-Loop Support: Specify actions that require user confirmation before execution.
Installation
Install the Widget Library
Import and Use the Widget in Your App Import
ChatWidget
and configure it in your React application as described below.
Quick Start Example
Step 1: Define the Functions
We will start by defining two simple functions listTokens
and sendToken
. These are placeholders and their actual implementation will depend on your application logic.
Step 2: Create the Components
Now, we'll create two React components, ListTokens
and SendToken
.
ListTokens
Component: Displays a simple message like "Retrieving tokens".SendToken
Component: Provides a confirmation box where the user can see the transaction details and either cancel or accept.
Step 3: Configure and Pass Tools to the Agent
In this step, we define the tools and pass them to the ChatWidget
.
Why use humanInTheLoop
?
For tools like
SendToken
, the user needs to confirm the transaction details before proceeding, sohumanInTheLoop
is set totrue
and a UI component (SendToken
) is provided.For tools like
ListTokens
, no user confirmation is needed. The tool automatically fetches and returns the result, sohumanInTheLoop
is set tofalse
and a callback (listTokens
) is provided.
Widget Configuration Options
The widget provides several configuration options to customize its behavior and appearance. Below are the key properties available:
ChatWidgetProps
avatarUrl
string
URL for the assistant's avatar image.
title
string
Title displayed in the chat header.
description
string
Description shown under the title.
themeColor
string
Primary color for the chat widget.
suggestions
Suggestion[]
Initial message suggestions for user engagement.
darkMode
boolean
Enable/disable dark mode. Defaults to true
.
openByDefault
boolean
Open the chat widget by default. Defaults to false
.
onMessageSent
function
Callback triggered when a message is sent.
assistantName
string
Name of the assistant. Defaults to "bailoo-widget"
.
parameters
AssistantTools
Tools and their configurations available for the assistant.
metadata
object
Metadata passed to the assistant for additional context.
graphId
string
Identifier for the assistant, used for connecting with LangGraph.
AssistantTools
Define the tools the agent can use, their behavior, and input requirements.
name
string
Unique identifier for the tool.
description
string
A clear explanation of the tool’s purpose for the agent to understand when to use it.
parameters
ToolParameters
JSON schema defining the tool’s input properties and their descriptions.
humanInTheLoop
boolean
Indicates if user confirmation is required before executing the tool.
callback
function
Function to execute if no user confirmation is required.
component
React.Component
Custom component rendered when the tool is invoked by the agent.
Adding Tools to the Agent
Define the tools and their parameters using the
AssistantTools
interface.Specify a
callback
for automatic execution or acomponent
for manual confirmation whenhumanInTheLoop
is enabled.Pass the defined tools to the
parameters
property of theChatWidget
component.
Next Steps
Integrate the Widget: Follow the example above to embed the widget in your application.
Test Your Tools: Ensure your tools work as expected by interacting with the agent in your app.
Last updated