A newer version of the Gradio SDK is available:
6.5.1
metadata
title: Template Final Assignment
emoji: π΅π»ββοΈ
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
π Quick Start
- Clone the repository:
git clone https://huggingface.co/spaces/Lucas-C-R/Agents
cd Agents
- Create and activate a virtual environment:
- Linux:
python3 -m venv .venv
source .venv/bin/activate
- Windows:
python -m venv .venv
.venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables:
# API Keys
export OPENAI_API_KEY="sk-proj-..." # Your OpenAI API key
export TAVILY_API_KEY="tvly-dev-..." # Your Tavily API key
export GROQ_API_KEY="gsk_..." # Your Groq API key
export HF_TOKEN="hf_..." # Your Hugging Face token
# Space Configuration
export SPACE_ID="<your user>/<space name>" # Your Hugging Face space ID
# Supabase Configuration
export SUPABASE_URL="your_supabase_url" # Your Supabase project URL
export SUPABASE_KEY="your_supabase_key" # Your Supabase API key
- Run the application:
python app.py
π§ Detailed Configuration
1. Supabase Setup
- Create an organization on Supabase
- Create a new project
- Set up a password and select the nearest region
- In the "Project Overview" tab, locate the "Project API" section
- Copy the Project URL to the
SUPABASE_URLenvironment variable - Copy the API Key to the
SUPABASE_KEYenvironment variable
2. Database Configuration
Execute the following SQL in the Supabase SQL editor:
create extension if not exists vector;
create table if not exists documents (
id uuid primary key default gen_random_uuid(),
content text,
metadata jsonb,
embedding vector(768)
);
DROP FUNCTION IF EXISTS match_documents_langchain(vector, integer);
create or replace function match_documents_langchain(
query_embedding vector(768),
match_count int default 5
)
returns table (
id uuid,
content text,
metadata jsonb,
similarity float
)
as $$
begin
return query
select
documents.id,
documents.content,
documents.metadata,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
order by documents.embedding <=> query_embedding
limit match_count;
end;
$$ language plpgsql;
3. Data Import
- Access the "Table Editor" tab in Supabase
- Select the "documents" table
- Click on "Import data from CSV"
- Select the
supabase_docs.csvfile from the project directory - Click "Import data" and wait for completion
π License
This project is under the MIT License. See the LICENSE file for more details.