Di1 - AI Driven Insights With Cloudflare

Kaarthik Andavar - Apr 14 - - Dev Community

This is a submission for the Cloudflare AI Challenge.

What I Built

Di1 is an AI-powered T2SQL Chatbot for Cloudflare D1. It allows users to interact with the Y Combinator dataset using natural language queries, can be customized to any data that is stored in Cloudlfare D1. Users can ask questions about the dataset, and Di1 will generate the corresponding SQL queries and produce charts and graphs, to retrieve the relevant information from the Cloudflare D1 database. The chatbot provides an intuitive and user-friendly interface for exploring the dataset without requiring knowledge of SQL syntax.

Screenshot of the website Di1

Demo

Deployed app - https://di1-iyr.pages.dev/

Generated example chat - https://di1-iyr.pages.dev/chat/NQFtTkt

My Code

The source code for Di1 is available on GitHub: https://github.com/kaarthik108/di1

Journey

Just went all out on cloudflare product offerings.
The project is built with the following stack:

  • Cloudflare Workers AI - Embedding model
  • Cloudflare Vectorize - Store vectors for RAG
  • Cloudflare AI Gateway - Caching LLM query and ratelimiting
  • Cloudflare Pages - Hosting Nextjs
  • Cloudflare Python Workers - For importing CSV data to D1
  • Cloudflare D1 - For context query with RAG, and also to store chat responses.
  • OpenAI - GPT4-turbo for function calling

Building Di1 was a valuable learning experience within a short timeframe.
The design process was rewarding, and the integration of multiple Cloudflare products resulted in a comprehensive solution.

Achieving high accuracy with function calling using the Workers AI model @hf/nousresearch/hermes-2-pro-mistral-7b proved challenging compared to GPT-4. As the app relies heavily on function calling capabilities, this is an area for future exploration as Cloudflare expands its model offerings.

Multiple Models and/or Triple Task Types

The app currently uses two LLM's
Workers AI - Embedding model @cf/baai/bge-large-en-v1.5
OpenAI - Chat model for function calling GPT4-Turbo

Team Submissions: https://dev.to/kaarthik108

. . . .