Spaces:
Runtime error
Runtime error
Download app/lib/supabase_client.py from beautiful-code/ai_workflows: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/beautiful-code/ai_workflows/resolve/main/app/lib/supabase_client.py
- Command line
-
hf download hf://spaces/beautiful-code/ai_workflows/app/lib/supabase_client.py
-
curl -L -o supabase_client.py https://huggingface.co/spaces/beautiful-code/ai_workflows/resolve/main/app/lib/supabase_client.py
1.04 kB
| from pydantic import UUID4 | |
| from supabase import create_client | |
| import os | |
| FEEDBACK_TABLE_NAME = "llm_feedback" | |
| class SupabaseClient: | |
| def __init__(self): | |
| url = os.environ.get("SUPABASE_URL") | |
| key = os.environ.get("SUPABASE_KEY") | |
| self.client = create_client(url, key) | |
| def post_feedback(self, run_id: UUID4, metric_type: str, metric_score: float, | |
| sub_workflow: str, original_content: dict, modified_content: dict): | |
| try: | |
| response = self.client.table(FEEDBACK_TABLE_NAME).insert({ | |
| "run_id": str(run_id), | |
| "sub_workflow": sub_workflow, | |
| "metric_type": metric_type, | |
| "metric_score": metric_score, | |
| "original_content": original_content, | |
| "modified_content": modified_content | |
| }).execute() | |
| print("Response: ", response) | |
| return response | |
| except Exception as exception: | |
| print("Exception: ", exception) | |
| return exception | |