Skip to content

Commit

Permalink
bugfix: Fix issue with toolset df description updating
Browse files Browse the repository at this point in the history
  • Loading branch information
mattprintz committed Jun 26, 2023
1 parent 4e13e95 commit b9d912c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion llmkernel/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def set_context(self, context, context_info):
dataset_id = context_info["id"]
print(f"Processing dataset w/id {dataset_id}")
self.toolset.set_dataset(dataset_id)
self.toolset.kernel = self.shell
self.context = self.agent.add_context(self.toolset.context())
# self.shell.ex("""import pandas as pd; import numpy as np;""")
self.shell.ex("""import pandas as pd; import numpy as np; import scipy;""")
self.shell.push({
"df": self.toolset.df
Expand Down
15 changes: 14 additions & 1 deletion toolsets/dataset_toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,27 @@ def dataset_info(self) -> str:
Returns:
str: a textual representation of the dataset
"""
# Need to actually track things. Maybe a good idea to split this in to finer tools so certain things can be queried?
# Update the local dataframe to match what's in the shell.
# This will be factored out when we switch around to allow using multiple runtimes.
if self.kernel:
try:
self.df = self.kernel.ev("df")
except:
pass

output = f"""
Dataframe head:
{self.df.head(15)}
Columns:
{self.df.columns}
dtypes:
{self.df.dtypes}
Statistics:
{self.df.describe()}
"""
Expand Down

0 comments on commit b9d912c

Please sign in to comment.