This repository contains examples of integrating duohub's graph memory with Supabase Edge Functions.
These examples demonstrate how to use duohub's memory retrieval API in the Supabase Edge Functions (TypeScript/Deno) serverless environment.
─ supabase/
├── chat_handler.ts
├── create_user.ts
├── get_memory_response.ts
└── list_user_messages.ts
- Supabase account and project
- Deno (installed with Supabase CLI)
- duohub API key
-
Start Supabase locally:
supabase start
-
Set up environment variables:
cp ./supabase/.env.local.example ./supabase/.env.local # Edit .env.local with your duohub API key
-
Serve functions locally:
supabase functions serve --env-file ./supabase/.env.local --no-verify-jwt
-
Login to Supabase CLI:
supabase login
-
Link your project:
supabase link --project-ref your-project-ref
-
Set environment variables:
supabase secrets set --env-file ./supabase/.env.local
-
Deploy functions:
supabase functions deploy
Supabase Edge Functions:
{
"query": string, // Required: The query to search for
"memoryID": string // Required: Specific memory ID to search within
}
All environments support the following functions:
chat_handler
: Handles chat interactionscreate_user
: Creates new usersget_memory_response
: Retrieves memory-specific responseslist_user_messages
: Lists messages for a specific user
This repository includes GitHub Actions workflows for automated deployments:
name: Deploy Functions
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: supabase/setup-cli@v1
with:
version: latest
- run: supabase functions deploy --project-ref ${{ secrets.PROJECT_ID }}
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
Set up the following secrets in your GitHub repository:
SUPABASE_ACCESS_TOKEN
PROJECT_ID