Skip to content

Commit

Permalink
catch assertion errors
Browse files Browse the repository at this point in the history
  • Loading branch information
parkervg committed Sep 1, 2024
1 parent b1f6051 commit 6cf30a6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions blendsql/blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,17 +822,25 @@ def _blend(
column in x for x in [llm_out_df.columns, base_table.columns]
):
# Fill nan in llm_out_df with those values in base_table
pd.testing.assert_index_equal(
base_table.index, llm_out_df.index
)
try:
pd.testing.assert_index_equal(
base_table.index, llm_out_df.index
)
except AssertionError:
logger.debug(
Fore.RED + "pd.testing.assert_index_equal error"
)
llm_out_df[column] = llm_out_df[column].fillna(
base_table[column]
)
base_table = base_table.drop(columns=column)
llm_out_df = llm_out_df[
llm_out_df.columns.difference(base_table.columns)
]
pd.testing.assert_index_equal(base_table.index, llm_out_df.index)
try:
pd.testing.assert_index_equal(base_table.index, llm_out_df.index)
except AssertionError:
logger.debug(Fore.RED + "pd.testing.assert_index_equal error")
merged = base_table.merge(
llm_out_df, how="left", right_index=True, left_index=True
)
Expand Down

0 comments on commit 6cf30a6

Please sign in to comment.