Spaces:
Sleeping
Sleeping
Create extract_insights.py
Browse files- extract_insights.py +25 -0
extract_insights.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from openai import Client
|
2 |
+
from supabase import create_client, Client
|
3 |
+
|
4 |
+
# Initialize Supabase client
|
5 |
+
url: str = os.getenv('SUPABASE_URL')
|
6 |
+
key: str = os.getenv('SUPABASE_KEY')
|
7 |
+
supabase: Client = create_client(url, key)
|
8 |
+
|
9 |
+
client = Client(api_key=os.getenv('OPENAI_API_KEY'),organization=os.getenv('ORG_ID'))
|
10 |
+
|
11 |
+
|
12 |
+
def prompt_for_categorization():
|
13 |
+
|
14 |
+
pass
|
15 |
+
|
16 |
+
async def extract_fashion_categories(user_id:str , email:str, message_id:str):
|
17 |
+
|
18 |
+
|
19 |
+
response = supabase.table("document_ai_entities").select("line_item / description , line_item / amount").eq("user_id",user_id).eq("email",email).eq("message_id",message_id).execute()
|
20 |
+
|
21 |
+
|
22 |
+
print(response.data)
|
23 |
+
|
24 |
+
|
25 |
+
|