rakesh-dvg commited on
Commit
9e52214
·
verified ·
1 Parent(s): ff92a2d

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +6 -20
agent.py CHANGED
@@ -16,29 +16,15 @@ from langchain_core.tools import tool
16
  from langchain.tools.retriever import create_retriever_tool
17
  from supabase.client import Client, create_client
18
 
19
- import os
20
- from dotenv import load_dotenv
21
- from supabase import create_client, Client
22
-
23
- # Load variables from .env into environment
24
- load_dotenv()
25
-
26
- # Get environment variables
27
- SUPABASE_URL = os.getenv("SUPABASE_URL", "").strip()
28
- SUPABASE_KEY = os.getenv("SUPABASE_KEY", "").strip()
29
 
30
- # Debug info (do NOT print full key in production)
31
- print("DEBUG: SUPABASE_URL =", SUPABASE_URL)
32
- print("DEBUG: SUPABASE_KEY is set:", bool(SUPABASE_KEY))
33
- print("DEBUG: SUPABASE_KEY repr:", repr(SUPABASE_KEY)) # optional
34
 
35
- # Check that keys are valid
36
- if not SUPABASE_URL or not SUPABASE_KEY:
37
- raise ValueError("Supabase credentials are missing or invalid.")
38
 
39
- # Initialize Supabase client
40
- supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
41
- print("✅ Supabase client initialized successfully.")
42
 
43
 
44
 
 
16
  from langchain.tools.retriever import create_retriever_tool
17
  from supabase.client import Client, create_client
18
 
19
+ from supabase import create_client
 
 
 
 
 
 
 
 
 
20
 
21
+ supabase = None
 
 
 
22
 
23
+ def init_supabase_client(url, key):
24
+ global supabase
25
+ supabase = create_client(url, key)
26
 
27
+ # Now you can use `supabase` in your agent code safely.
 
 
28
 
29
 
30