Meshyboi commited on
Commit
63e5043
·
verified ·
1 Parent(s): 7ac0a38

Update core/pipeline_1/logic.py

Browse files
Files changed (1) hide show
  1. core/pipeline_1/logic.py +6 -5
core/pipeline_1/logic.py CHANGED
@@ -43,12 +43,10 @@ class PipelineLLMOnly:
43
  """Streaming version of Pipeline 1"""
44
  start_time = time.time()
45
 
46
- # 1. Filter
47
  relevant_metadata = self.filter.filter_papers(query, top_n=self.top_n)
48
- sources = [p['title'] for p in relevant_metadata]
49
- yield {"type": "sources", "data": sources}
50
 
51
- # 2. Fetch Context
52
  context_parts = []
53
  abstracts = []
54
  for i, paper in enumerate(relevant_metadata):
@@ -66,8 +64,9 @@ class PipelineLLMOnly:
66
  context_parts.append(f"--- PAPER {i+1} ---\n{content}\n")
67
 
68
  full_context = "\n".join(context_parts)
 
69
 
70
- # 3. Prompt
71
  system_prompt = (
72
  "You are an AI research assistant. Answer the user query based ONLY on the provided papers. "
73
  "If the answer isn't there, say so. Cite sources like [Paper 1].\n\n"
@@ -95,6 +94,7 @@ class PipelineLLMOnly:
95
  last_usage = chunk.usage_metadata
96
 
97
  # 5. Process Metrics (after stream finishes)
 
98
  stats = self.metrics.process_metrics(
99
  client=self.client,
100
  query=query,
@@ -107,6 +107,7 @@ class PipelineLLMOnly:
107
  model_name=self.model_name
108
  )
109
  yield {"type": "metrics", "data": stats}
 
110
 
111
  except Exception as e:
112
  logger.error(f"Stream error: {e}")
 
43
  """Streaming version of Pipeline 1"""
44
  start_time = time.time()
45
 
46
+ yield {"type": "status", "data": "APPLYING METADATA FILTERS..."}
47
  relevant_metadata = self.filter.filter_papers(query, top_n=self.top_n)
 
 
48
 
49
+ yield {"type": "status", "data": f"FOUND {len(relevant_metadata)} PAPERS. FETCHING CONTEXT..."}
50
  context_parts = []
51
  abstracts = []
52
  for i, paper in enumerate(relevant_metadata):
 
64
  context_parts.append(f"--- PAPER {i+1} ---\n{content}\n")
65
 
66
  full_context = "\n".join(context_parts)
67
+ yield {"type": "sources", "data": [p['title'] for p in relevant_metadata]}
68
 
69
+ yield {"type": "status", "data": "GENERATING BASELINE RESPONSE..."}
70
  system_prompt = (
71
  "You are an AI research assistant. Answer the user query based ONLY on the provided papers. "
72
  "If the answer isn't there, say so. Cite sources like [Paper 1].\n\n"
 
94
  last_usage = chunk.usage_metadata
95
 
96
  # 5. Process Metrics (after stream finishes)
97
+ yield {"type": "status", "data": "GENERATION COMPLETE. CALCULATING METRICS..."}
98
  stats = self.metrics.process_metrics(
99
  client=self.client,
100
  query=query,
 
107
  model_name=self.model_name
108
  )
109
  yield {"type": "metrics", "data": stats}
110
+ yield {"type": "status", "data": "BASELINE PIPELINE SUCCESSFUL."}
111
 
112
  except Exception as e:
113
  logger.error(f"Stream error: {e}")