diff --git a/defog/__init__.py b/defog/__init__.py index 21c59c5..3348e02 100644 --- a/defog/__init__.py +++ b/defog/__init__.py @@ -210,4 +210,4 @@ def from_base64_creds(self, base64_creds: str): attr = getattr(admin_methods, name) if callable(attr): # Add the method to Defog - setattr(Defog, name, attr) \ No newline at end of file + setattr(Defog, name, attr) diff --git a/defog/admin_methods.py b/defog/admin_methods.py index 1cea3e2..d65f99e 100644 --- a/defog/admin_methods.py +++ b/defog/admin_methods.py @@ -1,6 +1,7 @@ import requests import pandas as pd + def update_db_schema(self, path_to_csv): """ Update the DB schema via a CSV, rather than by via a Google Sheet @@ -23,6 +24,7 @@ def update_db_schema(self, path_to_csv): resp = r.json() return resp + def update_glossary(self, glossary: str = "", customized_glossary: dict = None): """ Updates the glossary on the defog servers. @@ -39,6 +41,7 @@ def update_glossary(self, glossary: str = "", customized_glossary: dict = None): resp = r.json() return resp + def get_glossary(self, mode="general"): """ Gets the glossary on the defog servers. @@ -53,6 +56,7 @@ def get_glossary(self, mode="general"): elif mode == "customized": return resp["customized_glossary"] + def get_metadata(self, format="markdown", export_path=None): """ Gets the metadata on the defog servers. @@ -80,6 +84,7 @@ def get_metadata(self, format="markdown", export_path=None): print(f"Metadata exported to {export_path}") return True + def get_feedback(self, n_rows: int = 50, start_from: int = 0): """ Gets the feedback on the defog servers. @@ -96,6 +101,7 @@ def get_feedback(self, n_rows: int = 50, start_from: int = 0): df[col] = df[col].apply(lambda x: x.replace("\n", "\\n")) return df.iloc[start_from:].head(n_rows).to_markdown(index=False) + def get_quota(self) -> str: headers = { "Authorization": f"Bearer {self.api_key}", diff --git a/defog/query_methods.py b/defog/query_methods.py index 8a181f6..491fc17 100644 --- a/defog/query_methods.py +++ b/defog/query_methods.py @@ -1,7 +1,7 @@ - import requests from defog.query import execute_query + def get_query( self, question: str, @@ -56,6 +56,7 @@ def get_query( "error_message": "Sorry :( Our server is at capacity right now and we are unable to process your query. Please try again in a few minutes?", } + def run_query( self, question: str, @@ -111,4 +112,4 @@ def run_query( "query_generated": query["query_generated"], } else: - return {"ran_successfully": False, "error_message": query["error_message"]} \ No newline at end of file + return {"ran_successfully": False, "error_message": query["error_message"]}