Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rishsriv committed Jan 19, 2024
1 parent ed3889f commit 29440f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion defog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
setattr(Defog, name, attr)
6 changes: 6 additions & 0 deletions defog/admin_methods.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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}",
Expand Down
5 changes: 3 additions & 2 deletions defog/query_methods.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import requests
from defog.query import execute_query


def get_query(
self,
question: str,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -111,4 +112,4 @@ def run_query(
"query_generated": query["query_generated"],
}
else:
return {"ran_successfully": False, "error_message": query["error_message"]}
return {"ran_successfully": False, "error_message": query["error_message"]}

0 comments on commit 29440f1

Please sign in to comment.