Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
baitsguy committed Oct 8, 2024
1 parent 15a1b55 commit 42a676f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions apps/query-ui/queryui/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@


def get_sycamore_query_client(
s3_cache_path: Optional[str] = None, trace_dir: Optional[str] = None, cache_dir: Optional[str] = None, exec_mode: ExecMode = ExecMode.RAY
s3_cache_path: Optional[str] = None,
trace_dir: Optional[str] = None,
cache_dir: Optional[str] = None,
exec_mode: ExecMode = ExecMode.RAY,
) -> SycamoreQueryClient:
return SycamoreQueryClient(s3_cache_path=s3_cache_path, trace_dir=trace_dir, cache_dir=cache_dir, sycamore_exec_mode=exec_mode)
return SycamoreQueryClient(
s3_cache_path=s3_cache_path, trace_dir=trace_dir, cache_dir=cache_dir, sycamore_exec_mode=exec_mode
)
1 change: 0 additions & 1 deletion apps/query-ui/queryui/pages/Chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def main():
if "trace_dir" not in st.session_state:
st.session_state.trace_dir = os.path.join(os.getcwd(), "traces")


if not args.local_mode and args.external_ray:
sycamore_ray_init(address="auto")
st.title("Sycamore Query Chat")
Expand Down
9 changes: 5 additions & 4 deletions apps/query-ui/queryui/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ def readdata(self):
data[col].append(row.get(col))
self.df = pd.DataFrame(data)

def show(self, node_descriptions: dict[str, str]):
def show(self, node_descriptions: dict[str, str]):
"""Render the trace data."""
st.subheader(f"Node {self.node_id}")
st.markdown(f"*Description: {node_descriptions.get(self.node_id) or 'n/a'}*")
if self.df is None or not len(self.df):
st.write(f":red[0] documents")
st.write(":red[0] documents")
st.write("No data.")
return

Expand All @@ -258,6 +258,7 @@ def show(self, node_descriptions: dict[str, str]):
st.write(f"**{len(self.df)}** documents")
st.dataframe(self.df, column_order=column_order)


class QueryMetadataTrace:
"""Helper class to read and display metadata about a query."""

Expand All @@ -271,13 +272,13 @@ def readdata(self):
if os.path.isfile(f):
with open(f, "rb") as file:
self.query_plan = pickle.load(file)

def get_node_to_description(self) -> dict[str, str]:
if self.query_plan is None:
return {}
result = dict()
for node_id, node in self.query_plan.nodes.items():
result[str(node_id)] = node.description
result[str(node_id)] = node.description
return result

def show(self):
Expand Down

0 comments on commit 42a676f

Please sign in to comment.