A bot that answers questions about data

Start with this template
484
import logging
import os

from flask import Flask, render_template, session, request, jsonify
from flask_session import Session
from gunicorn.app.base import BaseApplication
import carparts_db
from carparts_db import create_connection, create_table

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

app = Flask(__name__)
# Configuring server-side session
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

from abilities import llm_prompt

@app.route("/")
def root_route():
    return render_template("template.html", model_name="gpt-4-1106-preview")
Get full code

A bot that answers questions about data

Created: | Last Updated:

Introduction to the Chatbot Service Template

Welcome to the Chatbot Service Template on Lazy! This template allows you to create a chatbot that can answer questions about data stored in a SQLite database. The chatbot is designed to generate SQL queries based on user input and return the results in a user-friendly chat interface. This template is perfect for builders who want to create a customer support bot or an interactive data query tool without worrying about the complexities of database management and frontend development.

Getting Started

To begin using this template, simply click on "Start with this Template" on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy or paste any code manually.

Initial Setup

There are no environment variables required for this template, so you can skip straight to testing the application.

Test: Deploying the App

Once you have the template loaded, press the "Test" button to begin the deployment of your chatbot application. The Lazy CLI will handle the deployment process, and you won't need to install any libraries or set up your environment manually.

Entering Input

After pressing the "Test" button, if the application requires any user input, the Lazy App's CLI interface will prompt you to provide it. Follow the instructions in the CLI to enter the necessary information.

Using the Chatbot Interface

After deployment, you will be provided with a dedicated server link to interact with your chatbot. The chatbot interface is a simple and intuitive web page where users can type their questions and receive responses. The chat history is displayed on the page, allowing for a seamless conversation experience.

Integrating the Chatbot into External Services

If you wish to integrate the chatbot with external services or tools, you may need to use the server link provided by Lazy. For example, if you want to embed the chatbot into an existing website, you can use an iframe or a web component to include the chatbot interface on your site. Ensure that you adjust the CORS settings on your server if necessary to allow for such integrations.

Here's a sample code snippet to embed the chatbot into an external webpage:

<iframe src="YOUR_SERVER_LINK" width="350" height="500"></iframe> Replace "YOUR_SERVER_LINK" with the actual link provided by Lazy after deployment.

And that's it! You now have a fully functional chatbot that can answer questions about your car parts database. Enjoy interacting with your chatbot and exploring the capabilities of the Lazy platform.

Technologies

Airtable Airtable
CSS CSS
Django Django
Flask Flask
HTML HTML
Python Python