/wanna_chat

A simple Dart LLM app demo, using LangChain.dart and Flutter

Primary LanguageDart

Wanna Chat - A Flutter / Dart chat app, using LangChain

Wanna chat

This is a small demo project that implements LLM-based chat functionality, augmented with real data (also known as RAG), to give more factually correct answers. The defalut implementation uses data about Domain Driven Design, in the form of text, video transcripts and various articles on the web.

This projects consists of two parts: a Dart based chat backend and a frontend app written in Flutter & Dart.

Backend (Dart "LLM app")

A simple LLM app that implements RAG functionality, using the framework LangChain.dart.

The backend provides a simple REST api, exposing three endpoints:

  • GET /chat/{sessionId} - Gets the chat history
  • POST /chat/{sessionId} - Ask a questions
  • DELETE //chat/{sessionId} - Clears the conversation

To keep the backend as simple and lightweight as possible it was build using Dart Frog. More complex real-world applications might consider using something like ServerPod.

Running the backend server

  • Set the OPENAI_API_KEY environment variable.
  • Run the server locally using dart_frog dev

See backend/README.md for more details.

Frontend (Flutter app)

A simple Flutter app implementing a basic chat interface, with history. The ResultNotifier package is used for state management and more.

Data

A set of default documents, on the subject of Domain-Driven Design, are included and uses as data for the RAG chain in the backend: