runsdata commited on
Commit
5b6ed4a
·
1 Parent(s): c747fcf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -54,16 +54,18 @@ def truncate_history(history):
54
  return history
55
 
56
  def get_full_context(input):
57
- retrieved_documents = retriever.get_relevant_documents(input)
58
- context = "" # Initialize an empty string
59
 
60
- file_path = "./docs/Troubleshooting_Table.csv"
61
- data = pd.read_csv(file_path)
62
- for doc in retrieved_documents:
63
- index = doc.metadata['index']
64
- context += str(data.iloc[[index]])
65
 
66
- return context
 
 
 
 
 
67
 
68
 
69
  is_first_run = True # Flag to check if it's the first run
@@ -74,7 +76,6 @@ def predict(history, input):
74
  global is_first_run # Use the global flag
75
  if is_first_run:
76
  context = get_full_context(input)
77
- print(type(context))
78
  print(context) # For debugging
79
  is_first_run = False # Set the flag to False after the first run
80
  else:
 
54
  return history
55
 
56
  def get_full_context(input):
57
+ retrieved_documents = retriever.get_relevant_documents(input)
58
+ context = ""
59
 
60
+ file_path = "./docs/Troubleshooting_Table.csv"
61
+ data = pd.read_csv(file_path)
 
 
 
62
 
63
+ for doc in retrieved_documents:
64
+ index = doc.metadata['index']
65
+ row_string = data.iloc[[index]].to_string(index=False)
66
+ context += row_string + "\n\n"
67
+
68
+ return context
69
 
70
 
71
  is_first_run = True # Flag to check if it's the first run
 
76
  global is_first_run # Use the global flag
77
  if is_first_run:
78
  context = get_full_context(input)
 
79
  print(context) # For debugging
80
  is_first_run = False # Set the flag to False after the first run
81
  else: