jskinner215 commited on
Commit
bda63f0
·
1 Parent(s): cc27c6f

Update weaviate_utils.py

Browse files
Files changed (1) hide show
  1. weaviate_utils.py +8 -3
weaviate_utils.py CHANGED
@@ -146,7 +146,12 @@ def get_class_schema(client, class_name):
146
 
147
  def retrieve_relevant_table(client, selected_class, question_embedding):
148
  # Query Weaviate to get the most relevant table
149
- results = client.query.get(selected_class, ["embeddedTable"]).with_near_text(question_embedding).do()
150
- # Extract the table from the results
151
- table = results.get('data', {}).get('Get', {}).get('Things', [])[0].get('embeddedTable')
 
 
 
 
 
152
  return table
 
146
 
147
  def retrieve_relevant_table(client, selected_class, question_embedding):
148
  # Query Weaviate to get the most relevant table
149
+ results = client.query.get(selected_class, ["content"]).with_near_text(question_embedding).do()
150
+
151
+ # Extract the table content from the results
152
+ table_content = results.get('data', {}).get('Get', {}).get('Things', [])[0].get('content')
153
+
154
+ # Convert the table content to a DataFrame
155
+ table = pd.read_csv(StringIO(table_content))
156
+
157
  return table