Spaces:
Build error
Build error
Commit ·
77a6da5
1
Parent(s): 89dd001
Update weaviate_utils.py
Browse files82 unmodified lines83848586878840 unmodified lines12913013113282 unmodified linesdata = csv_file.read().decode("utf-8")dataframe = pd.read_csv(StringIO(data))# Fetch the schema for the selected classclass_schema = get_class_schema(client, selected_class)40 unmodified linesreturn clsreturn Noneexcept weaviate.exceptions.SchemaValidationException:return None82 unmodified lines838485868788899091929340 unmodified lines13413513613713813914014114214314482 unmodified linesdata = csv_file.read().decode("utf-8")dataframe = pd.read_csv(StringIO(data))# After converting the CSV to a dataframeembedded_table = tapas_utils.embed_table(dataframe)# Store the embedded table in Weaviateclient.data_object.create({"embeddedTable": embedded_table.tolist()}, selected_class)# Fetch the schema for the selected classclass_schema = get_class_schema(client, selected_class)40 unmodified linesreturn clsreturn Noneexcept weaviate.exceptions.SchemaValidationException:return Nonedef retrieve_relevant_table(client, selected_class, question_embedding):# Query Weaviate to get the most relevant tableresults = client.query.get(selected_class, ["embeddedTable"]).with_near_text(question_embedding).do()# Extract the table from the resultstable = results.get('data', {}).get('Get', {}).get('Things', [])[0].get('embeddedTable')return table
weaviate_utils.py+13-1