Spaces:
Runtime error
Runtime error
| 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 | |