CodeChamp95 commited on
Commit
5f49e3b
Β·
verified Β·
1 Parent(s): b221afb

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +7 -7
tools.py CHANGED
@@ -109,7 +109,7 @@ def _get_llm() -> ChatMistralAI:
109
  # Tool 1 β€” load_scopus_csv
110
  # ──────────────────────────────────────────────────────────────────────────────
111
 
112
- @tool(handle_tool_error=True)
113
  def load_scopus_csv(csv_path: str, run_mode: str = "abstract") -> str:
114
  """
115
  Load a Scopus-exported CSV, count papers and sentences, and apply a
@@ -155,7 +155,7 @@ def load_scopus_csv(csv_path: str, run_mode: str = "abstract") -> str:
155
  # Tool 2 β€” run_bertopic_discovery
156
  # ──────────────────────────────────────────────────────────────────────────────
157
 
158
- @tool(handle_tool_error=True)
159
  def run_bertopic_discovery(loaded_data_path: str) -> str:
160
  """
161
  Embed sentences with all-MiniLM-L6-v2, cluster with AgglomerativeClustering
@@ -297,7 +297,7 @@ Each element must have: topic_id (int), label (str), description (str).
297
  )
298
 
299
 
300
- @tool(handle_tool_error=True)
301
  def label_topics_with_llm(summaries_path: str, top_n: int = 100) -> str:
302
  """
303
  Send the top-N (default 100) topics to Mistral via PromptTemplate +
@@ -327,7 +327,7 @@ def label_topics_with_llm(summaries_path: str, top_n: int = 100) -> str:
327
  # Tool 4 β€” consolidate_into_themes
328
  # ──────────────────────────────────────────────────────────────────────────────
329
 
330
- @tool(handle_tool_error=True)
331
  def consolidate_into_themes(
332
  labels_path: str,
333
  summaries_path: str,
@@ -409,7 +409,7 @@ Each element: theme_id (int), theme_label (str), pajais_category (str), confiden
409
  )
410
 
411
 
412
- @tool(handle_tool_error=True)
413
  def compare_with_taxonomy(themes_path: str) -> str:
414
  """
415
  Map consolidated themes to the PAJAIS 25-category taxonomy via Mistral.
@@ -438,7 +438,7 @@ def compare_with_taxonomy(themes_path: str) -> str:
438
  # Tool 6 β€” generate_comparison_csv
439
  # ──────────────────────────────────────────────────────────────────────────────
440
 
441
- @tool(handle_tool_error=True)
442
  def generate_comparison_csv(csv_path: str, taxonomy_path: str) -> str:
443
  """
444
  Generate a side-by-side comparison CSV of abstract vs title analysis results.
@@ -498,7 +498,7 @@ Cite themes by their label. Maintain formal academic register throughout.
498
  )
499
 
500
 
501
- @tool(handle_tool_error=True)
502
  def export_narrative(taxonomy_path: str) -> str:
503
  """
504
  Generate a ~500-word Section 7 narrative via Mistral and save it as a text file.
 
109
  # Tool 1 β€” load_scopus_csv
110
  # ──────────────────────────────────────────────────────────────────────────────
111
 
112
+ @tool
113
  def load_scopus_csv(csv_path: str, run_mode: str = "abstract") -> str:
114
  """
115
  Load a Scopus-exported CSV, count papers and sentences, and apply a
 
155
  # Tool 2 β€” run_bertopic_discovery
156
  # ──────────────────────────────────────────────────────────────────────────────
157
 
158
+ @tool
159
  def run_bertopic_discovery(loaded_data_path: str) -> str:
160
  """
161
  Embed sentences with all-MiniLM-L6-v2, cluster with AgglomerativeClustering
 
297
  )
298
 
299
 
300
+ @tool
301
  def label_topics_with_llm(summaries_path: str, top_n: int = 100) -> str:
302
  """
303
  Send the top-N (default 100) topics to Mistral via PromptTemplate +
 
327
  # Tool 4 β€” consolidate_into_themes
328
  # ──────────────────────────────────────────────────────────────────────────────
329
 
330
+ @tool
331
  def consolidate_into_themes(
332
  labels_path: str,
333
  summaries_path: str,
 
409
  )
410
 
411
 
412
+ @tool
413
  def compare_with_taxonomy(themes_path: str) -> str:
414
  """
415
  Map consolidated themes to the PAJAIS 25-category taxonomy via Mistral.
 
438
  # Tool 6 β€” generate_comparison_csv
439
  # ──────────────────────────────────────────────────────────────────────────────
440
 
441
+ @tool
442
  def generate_comparison_csv(csv_path: str, taxonomy_path: str) -> str:
443
  """
444
  Generate a side-by-side comparison CSV of abstract vs title analysis results.
 
498
  )
499
 
500
 
501
+ @tool
502
  def export_narrative(taxonomy_path: str) -> str:
503
  """
504
  Generate a ~500-word Section 7 narrative via Mistral and save it as a text file.