Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programming LLM: Generate grading criterion, double check feedback and filter out solutions #342

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
02211a2
add grading instructions to the prompt, get points
dmytropolityka Sep 17, 2024
d1c30d5
Merge branch 'develop' into feature/revised-programming-feedback
dmytropolityka Sep 30, 2024
0885e94
fix bug
dmytropolityka Oct 1, 2024
d9841bc
add split grading instructions prompt
dmytropolityka Oct 1, 2024
0b53bb2
remove deprecated field
dmytropolityka Oct 1, 2024
2f3b8d1
improve summary prompt
dmytropolityka Oct 1, 2024
701ddeb
Merge remote-tracking branch 'origin/feature/revised-programming-feed…
dmytropolityka Oct 2, 2024
12a8ce6
upgrade langchain to 0.3.x
dmytropolityka Oct 4, 2024
5594539
change api version
dmytropolityka Oct 4, 2024
070c488
revert
dmytropolityka Oct 4, 2024
b059c10
restructure the module
dmytropolityka Oct 6, 2024
cfa2188
restructure the module
dmytropolityka Oct 6, 2024
6cff9ed
fix some linting issues
dmytropolityka Oct 6, 2024
08cc708
filter out solutions
dmytropolityka Oct 7, 2024
6a62e21
resolve linting errors
dmytropolityka Oct 7, 2024
42396b7
add validate suggestions step
dmytropolityka Oct 7, 2024
4576229
fix linting errors
dmytropolityka Oct 7, 2024
9bb8a90
add generate grading criterion step
dmytropolityka Oct 7, 2024
c6938de
fine tune the prompt
dmytropolityka Oct 7, 2024
f3f38f3
fix minor issues
dmytropolityka Oct 7, 2024
8b76436
prepare live demo
dmytropolityka Oct 16, 2024
132214c
adjust grading criterion prompt
dmytropolityka Oct 16, 2024
139cc19
Merge branch 'develop' into feature/revised-programming-feedback
dmytropolityka Oct 29, 2024
968c6a7
rebase onto develop
dmytropolityka Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions assessment_module_manager/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assessment_module_manager/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT"

[tool.poetry.dependencies]
python = "3.11.*"
athena = {path = "../athena", develop = true}
athena = { git = "https://github.com/ls1intum/Athena.git", rev = "9773c41", subdirectory = "athena"}
fastapi = "^0.109.1"
uvicorn = "^0.23.0"
httpx = "^0.24.1"
Expand Down
2 changes: 1 addition & 1 deletion athena/athena/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class SubmissionSelectorRequest(BaseModel):
class Config:
# Allow camelCase field names in the API (converted to snake_case)
alias_generator = to_camel
allow_population_by_field_name = True
populate_by_name = True

@app.post("/select_submission", responses=module_responses)
@authenticated
Expand Down
6 changes: 3 additions & 3 deletions athena/athena/helpers/programming/code_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_repository_zip(url: str, authorization_secret: Optional[str] = None) ->
the cache or by downloading it, and return a ZipFile object.
Optional: Authorization secret for the API. If omitted, it will be auto-determined given the request session.
"""
url_hash = hashlib.md5(url.encode("utf-8")).hexdigest()
url_hash = hashlib.md5(str(url).encode("utf-8")).hexdigest()
file_name = url_hash + ".zip"
cache_file_path = cache_dir / file_name

Expand All @@ -27,7 +27,7 @@ def get_repository_zip(url: str, authorization_secret: Optional[str] = None) ->
if contextvars.repository_authorization_secret_context_var_empty():
raise ValueError("Authorization secret for the repository API is not set. Pass authorization_secret to this function or add the X-Repository-Authorization-Secret header to the request from the assessment module manager.")
authorization_secret = contextvars.get_repository_authorization_secret_context_var()
with httpx.stream("GET", url, headers={ "Authorization": cast(str, authorization_secret) }) as response:
with httpx.stream("GET", str(url), headers={ "Authorization": cast(str, authorization_secret) }) as response:
response.raise_for_status()
with open(cache_file_path, "wb") as f:
for chunk in response.iter_bytes():
Expand All @@ -42,7 +42,7 @@ def get_repository(url: str, authorization_secret: Optional[str] = None) -> Repo
downloading it, and return a Repo object.
"""

url_hash = hashlib.md5(url.encode("utf-8")).hexdigest()
url_hash = hashlib.md5(str(url).encode("utf-8")).hexdigest()
dir_name = url_hash + ".git"
cache_dir_path = cache_dir / dir_name

Expand Down
2 changes: 1 addition & 1 deletion athena/athena/schemas/exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class Exercise(Schema, ABC):
meta: dict = Field({}, example={"internal_id": "5"})

class Config:
orm_mode = True
from_attributes = True
2 changes: 1 addition & 1 deletion athena/athena/schemas/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def to_model(self, is_suggestion: bool = False, lms_id: Optional[int] = None, lm
return type(self).get_model_class()(**self.dict(), is_suggestion=is_suggestion, lms_id=lms_id, lms_url=lms_url)

class Config:
orm_mode = True
from_attributes = True
2 changes: 1 addition & 1 deletion athena/athena/schemas/modeling_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
class ModelingExercise(Exercise):
"""A modeling exercise that can be solved by students, enhanced with metadata."""

type: ExerciseType = Field(ExerciseType.modeling, const=True)
type: ExerciseType = Field(ExerciseType.modeling, Literal=True)

example_solution: Optional[str] = Field(None, description="An example solution to the exercise.")
11 changes: 9 additions & 2 deletions athena/athena/schemas/programming_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class ProgrammingExercise(Exercise):
"""A programming exercise that can be solved by students, enhanced with metadata."""

type: ExerciseType = Field(ExerciseType.programming, const=True)
type: ExerciseType = Field(ExerciseType.programming, Literal=True)

programming_language: str = Field(description="The programming language that is used for this exercise.", example="java")
solution_repository_uri: AnyUrl = Field(description="URL to the solution git repository, which contains the "
Expand Down Expand Up @@ -51,4 +51,11 @@ def get_tests_zip(self) -> ZipFile:

def get_tests_repository(self) -> Repo:
"""Return the tests repository as a Repo object."""
return get_repository(self.tests_repository_uri)
return get_repository(self.tests_repository_uri)

def to_model(self):
model = super().to_model()
model.solution_repository_uri = str(self.solution_repository_uri)
model.template_repository_uri = str(self.template_repository_uri)
model.tests_repository_uri = str(self.tests_repository_uri)
return model
2 changes: 1 addition & 1 deletion athena/athena/schemas/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ def to_model(self):
class Config:
# Allow camelCase field names in the API (converted to snake_case)
alias_generator = to_camel
allow_population_by_field_name = True
populate_by_name = True
2 changes: 1 addition & 1 deletion athena/athena/schemas/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class Submission(Schema, ABC):
meta: dict = Field({}, example={})

class Config:
orm_mode = True
from_attributes = True
2 changes: 1 addition & 1 deletion athena/athena/schemas/text_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
class TextExercise(Exercise):
"""A text exercise that can be solved by students, enhanced with metadata."""

type: ExerciseType = Field(ExerciseType.text, const=True)
type: ExerciseType = Field(ExerciseType.text, Literal=True)

example_solution: Optional[str] = Field(None, description="An example solution to the exercise.")
Loading
Loading