-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from ls1intum/feature/improve-programming-module
General improvements for `module_programming_llm`
- Loading branch information
Showing
27 changed files
with
2,258 additions
and
605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,38 @@ | ||
from typing import List | ||
|
||
import tiktoken | ||
|
||
from athena import app, submission_selector, submissions_consumer, feedback_consumer, feedback_provider | ||
from athena.storage import store_exercise | ||
from athena.programming import Exercise, Submission, Feedback | ||
from athena.logger import logger | ||
from module_programming_llm.config import Configuration | ||
|
||
from module_programming_llm.basic.basic_feedback_provider import suggest_feedback as suggest_feedback_basic | ||
from module_programming_llm.basic.file_instructions import generate_file_grading_instructions, generate_file_problem_statements | ||
from module_programming_llm.generate_suggestions_by_file import generate_suggestions_by_file | ||
|
||
|
||
@submissions_consumer | ||
def receive_submissions(exercise: Exercise, submissions: List[Submission]): | ||
logger.info("receive_submissions: Received %d submissions for exercise %d", len(submissions), exercise.id) | ||
|
||
# Split problem statements and grading instructions | ||
exercise.meta['file_grading_instructions'] = generate_file_grading_instructions(exercise) | ||
exercise.meta['file_problem_statements'] = generate_file_problem_statements(exercise) | ||
|
||
store_exercise(exercise) | ||
|
||
|
||
@submission_selector | ||
def select_submission(exercise: Exercise, submissions: List[Submission]) -> Submission: | ||
logger.info("select_submission: Received %d, submissions for exercise %d", len(submissions), exercise.id) | ||
# Always return the first submission | ||
return submissions[0] | ||
|
||
|
||
@feedback_consumer | ||
def process_incoming_feedback(exercise: Exercise, submission: Submission, feedbacks: List[Feedback]): | ||
logger.info("process_feedback: Received feedbacks for submission %d of exercise %d.", submission.id, exercise.id) | ||
logger.info("process_feedback: Feedbacks: %s", feedbacks) | ||
# Do something with the feedback | ||
logger.info("process_feedback: Received %d feedbacks for submission %d of exercise %d.", len(feedbacks), submission.id, exercise.id) | ||
|
||
|
||
@feedback_provider | ||
async def suggest_feedback(exercise: Exercise, submission: Submission) -> List[Feedback]: | ||
async def suggest_feedback(exercise: Exercise, submission: Submission, module_config: Configuration) -> List[Feedback]: | ||
logger.info("suggest_feedback: Suggestions for submission %d of exercise %d were requested", submission.id, exercise.id) | ||
# Do something with the submission and return a list of feedback | ||
|
||
# Check if file based grading instructions and problem statements are available | ||
if 'file_grading_instructions' in exercise.meta and 'file_problem_statements' in exercise.meta: | ||
return await suggest_feedback_basic(exercise, submission) | ||
logger.info("suggest_feedback: No file based grading instructions and problem statements available. Skipping feedback generation.") | ||
return [] | ||
return await generate_suggestions_by_file(exercise, submission, module_config.approach, module_config.debug) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Preload for token estimation later | ||
tiktoken.get_encoding("cl100k_base") | ||
app.start() |
110 changes: 0 additions & 110 deletions
110
module_programming_llm/module_programming_llm/basic/basic_feedback_provider.py
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
module_programming_llm/module_programming_llm/basic/file_instructions.py
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
module_programming_llm/module_programming_llm/basic/prompts/basic_feedback_provider.py
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...rogramming_llm/module_programming_llm/basic/prompts/generate_file_grading_instructions.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.