Skip to content

Commit 851a9b4

Browse files
committed
refactor get_the_question()
testability
1 parent 0d4ce3d commit 851a9b4

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

ai_tutor.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,26 @@ def gemini_qna(
107107
logging.info(f"Student files: {student_files}")
108108
logging.info(f"Readme file: {readme_file}")
109109

110-
answers = None
110+
consolidated_question = get_the_question(
111+
report_paths,
112+
student_files,
113+
readme_file,
114+
human_language
115+
)
116+
117+
answers = ask_gemini(consolidated_question, api_key)
118+
119+
return answers
120+
111121

122+
def get_the_question(
123+
report_paths:Tuple[pathlib.Path],
124+
student_files:Tuple[pathlib.Path],
125+
readme_file:pathlib.Path,
126+
human_language:str,
127+
) -> str:
112128
questions = []
129+
113130
# Process each report file
114131
for report_path in report_paths:
115132
logging.info(f"Processing report file: {report_path}")
@@ -126,11 +143,10 @@ def gemini_qna(
126143
questions.insert(0, f'In {human_language}, please comment on the student code given the assignment instruction.')
127144

128145
questions.append(get_code_instruction(student_files, readme_file, human_language))
129-
consolidated_question = "\n\n".join(questions)
130146

131-
answers = ask_gemini(consolidated_question, api_key)
147+
consolidated_question = "\n\n".join(questions)
132148

133-
return answers
149+
return consolidated_question
134150

135151

136152
@functools.lru_cache

0 commit comments

Comments
 (0)