athottam commited on
Commit
75d5ad5
·
verified ·
1 Parent(s): 6fe4d90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -7
app.py CHANGED
@@ -42,7 +42,6 @@ class LogAnalyzer:
42
 
43
 
44
  def process_log_to_csv(self):
45
- """Reads a log file, converts it to CSV, and saves it."""
46
  print("process_log_to_csv")
47
  with open(self.log_file_path, 'r') as f:
48
  log_content = f.read()
@@ -69,7 +68,6 @@ class LogAnalyzer:
69
 
70
  def create_log_embeddings(self):
71
  print("create_log_embeddings")
72
- """Reads CSV, creates combined text, generates embeddings, and stores in instance."""
73
  df = pd.read_csv(self.csv_file_path)
74
  df = df.drop_duplicates()
75
 
@@ -91,7 +89,6 @@ class LogAnalyzer:
91
 
92
  def initialize_qdrant(self):
93
  print("initialize_qdrant")
94
- """Initializes Qdrant client and creates collection if it doesn't exist."""
95
  #drive.mount('/content/drive')
96
  os.makedirs(self.qdrant_data_dir, exist_ok=True)
97
  self.client = QdrantClient(path=self.qdrant_data_dir)
@@ -112,7 +109,6 @@ class LogAnalyzer:
112
 
113
  def upload_embeddings_to_qdrant(self):
114
  print("upload_embeddings_to_qdrant")
115
- """Uploads embeddings from dataframe to Qdrant collection."""
116
  if self.client is not None and self.df_combined is not None:
117
  self.client.upload_points(
118
  collection_name="log_for_analysis",
@@ -135,7 +131,6 @@ class LogAnalyzer:
135
 
136
  def search_qdrant(self, query, n=15):
137
  print("search_qdrant")
138
- """Searches Qdrant for similar log entries based on query."""
139
  if self.client is not None and self.embedder is not None:
140
  query_embedding = self.embedder.encode(query).tolist()
141
 
@@ -160,7 +155,6 @@ class LogAnalyzer:
160
 
161
  def setup_openrouter_client(self):
162
  print("setup_openrouter_client")
163
- """Sets up and returns the OpenRouter client."""
164
  OPEN_ROUTER_API_KEY = os.getenv('OPEN_ROUTER_API_KEY_2')
165
  self.open_router_client = OpenAI(
166
  base_url="https://openrouter.ai/api/v1",
@@ -169,7 +163,6 @@ class LogAnalyzer:
169
 
170
  def generate_answer(self, query):
171
  print("generate_answer")
172
- """Generates an answer to the query using LLM based on Qdrant search results and stores the result."""
173
  if self.open_router_client is not None and self.client is not None and self.embedder is not None:
174
  context = f"""
175
  LOG ANALYSIS RESULTS:
 
42
 
43
 
44
  def process_log_to_csv(self):
 
45
  print("process_log_to_csv")
46
  with open(self.log_file_path, 'r') as f:
47
  log_content = f.read()
 
68
 
69
  def create_log_embeddings(self):
70
  print("create_log_embeddings")
 
71
  df = pd.read_csv(self.csv_file_path)
72
  df = df.drop_duplicates()
73
 
 
89
 
90
  def initialize_qdrant(self):
91
  print("initialize_qdrant")
 
92
  #drive.mount('/content/drive')
93
  os.makedirs(self.qdrant_data_dir, exist_ok=True)
94
  self.client = QdrantClient(path=self.qdrant_data_dir)
 
109
 
110
  def upload_embeddings_to_qdrant(self):
111
  print("upload_embeddings_to_qdrant")
 
112
  if self.client is not None and self.df_combined is not None:
113
  self.client.upload_points(
114
  collection_name="log_for_analysis",
 
131
 
132
  def search_qdrant(self, query, n=15):
133
  print("search_qdrant")
 
134
  if self.client is not None and self.embedder is not None:
135
  query_embedding = self.embedder.encode(query).tolist()
136
 
 
155
 
156
  def setup_openrouter_client(self):
157
  print("setup_openrouter_client")
 
158
  OPEN_ROUTER_API_KEY = os.getenv('OPEN_ROUTER_API_KEY_2')
159
  self.open_router_client = OpenAI(
160
  base_url="https://openrouter.ai/api/v1",
 
163
 
164
  def generate_answer(self, query):
165
  print("generate_answer")
 
166
  if self.open_router_client is not None and self.client is not None and self.embedder is not None:
167
  context = f"""
168
  LOG ANALYSIS RESULTS: