DatabaseChat

DatabaseChat

Natural language database chat for Convex apps.

Alpha release

DatabaseChat is in alpha. Expect breaking changes as the API settles.

DatabaseChat lets users ask questions about your data in plain English. It streams responses, calls your Convex queries as tools, and stores conversations in your own tables.

What it provides

FeatureDescription
Conversation storageStores chat history in conversations and messages tables
Delta-based streamingEfficient O(n) streaming via delta accumulation
Abort supportStop generation mid-stream with cleanup
Tool callingLLM can call your Convex queries
React hooksuseDatabaseChat, useMessagesWithStreaming, and more
Client wrapperdefineDatabaseChat() for type-safe integration

What you implement

Your codeDescription
Tool definitionsDescribe what data the LLM can access
Query functionsConvex queries or actions that back each tool
Chat wrapperApp-side endpoints that call the component
System promptInstructions that shape responses
UIYour chat interface (or hook-based integration)

How it works

  1. User sends a message from your UI.
  2. Your app calls components.databaseChat.chat.send with tools, prompt, and API key.
  3. The component streams deltas and executes tool calls as needed.
  4. The UI subscribes to deltas and displays streaming content.

Next steps