1919
2020@cache
2121def get_session ():
22- """get M session (change model here)"""
22+ """Get M session (change model here). """
2323 return MelleaSession (backend = OllamaModelBackend (model_ids .IBM_GRANITE_3_3_8B ))
2424
2525
2626@cache
2727def get_guardian_session ():
28- """get M session for the guardian model"""
28+ """Get M session for the guardian model. """
2929 return MelleaSession (
3030 backend = OllamaModelBackend (model_ids .IBM_GRANITE_GUARDIAN_3_0_2B )
3131 )
3232
3333
3434def is_a_true_subset_of_b (a : list [str ], b : list [str ]) -> bool :
35- """check if a is true subset of b."""
35+ """Check if a is true subset of b."""
3636 all_in = True
3737 for e in a :
3838 if e not in b :
@@ -42,7 +42,7 @@ def is_a_true_subset_of_b(a: list[str], b: list[str]) -> bool:
4242
4343
4444def create_check_word_count (max_words : int ) -> Callable [[str ], bool ]:
45- """generate a maximum-word-count validation function."""
45+ """Generate a maximum-word-count validation function."""
4646
4747 def cc (s : str ):
4848 return len (s .split ()) <= max_words
@@ -56,7 +56,7 @@ def cc(s: str):
5656
5757
5858def step_is_input_safe (guardian_session : MelleaSession , docs : list [str ]) -> bool :
59- """check if the list of docs has no harm."""
59+ """Check if the list of docs has no harm."""
6060 is_safe = True
6161 for i_doc , doc in enumerate (docs ):
6262 print (f"\n Checking Doc { i_doc + 1 } /{ len (docs )} " , end = "..." )
@@ -73,7 +73,7 @@ def step_is_input_safe(guardian_session: MelleaSession, docs: list[str]) -> bool
7373def step_summarize_docs (
7474 s : MelleaSession , docs : list [str ], user_args : dict
7575) -> list [str ]:
76- """generate a task-specific document summary for each doc."""
76+ """Generate a task-specific document summary for each doc."""
7777 summaries = []
7878 for i_doc , doc in enumerate (docs ): # type: ignore
7979 print (f"\n Summarizing doc { i_doc + 1 } /{ len (docs )} " , end = "..." )
@@ -91,7 +91,6 @@ def step_generate_outline(
9191 s : MelleaSession , user_args : dict , context : list [RAGDocument ]
9292) -> list [str ]:
9393 """Generate a report outline using constraint decoding (formatted output)."""
94-
9594 print ("\n Generating outline" , end = "..." )
9695
9796 class SectionTitles (BaseModel ):
@@ -165,7 +164,6 @@ def step_write_full_report(
165164 outline : list [str ],
166165) -> str :
167166 """Merge summaries and outline into a single report."""
168-
169167 print ("\n Writing full report" , end = "..." )
170168
171169 ## Define Requirements
0 commit comments