Here's a step-by-step tutorial for setting up and deploying an AI Agent with Ollama, local LLM and Langchain, including installing necessary tools, deploying the app, and running it locally.
This example consists of the following pieces:
- ollama (models)
- Langchain
- Next.js (user inteface)
- sqlite3 (database)
- sendGrid for sending email
- Zod for data validation
This guide will walk you through installing the dependencies, initializing and deploying a project, and running the application locally. I will use sqlite3 to run a local database. Qwen2.5-coder:7b as the LLM.
Clone this repository and open the right directory:
git clone https://github.com/kiransilwal1/email-sql-agentTo run the application you need to install the necessary dependencies:
npm iThis command installs all required packages, including Langchain and any dependencies specified in the project.
I am using SendGrid API to send emails. Create an environment file and add your Send Grid email API key as below.
SENDGRID_API_KEY=SG._xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxFinally, start the application by running:
npm run devThis command initiates your application, allowing you to asking questions like:
- How many customers are there?
- Please find the customer with the highest number of orders.
- Please find the customer with the highest number of order and send an email stating that he is now eligible for a free order.
Have a look at the database schema in /src/app/database.ts to learn more about the data structure.
- Integrating Firebase notifications to mobile apps after storing FCM tokens in the database.
- Sending SMS to the user (The phone number shall be saved in the database).
- Implementing calendar, GPS, CRM etc to track and automate e-commerce workflows.