Skip to content

Commit 1febde8

Browse files
committed
Merge branch 'feature/international'
2 parents ffed0ef + 5881ff3 commit 1febde8

File tree

9 files changed

+422
-68
lines changed

9 files changed

+422
-68
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
student-files: tests/sample_code.py
4242
api-key: ${{ secrets.GOOGLE_API_KEY }}
4343
readme-path: tests/sample_readme.md
44+
explanation-in: Korean
4445
timeout-minutes: 5
4546

4647
- name: Output the outputs of the integration test of the action

CHANGELOG.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,35 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8-
+## [Unreleased] - YYYY-MM-DD
8+
## [Unreleased] - YYYY-MM-DD
99

1010
### Added
11-
* API key as a required input.
11+
1212

1313
### Changed
14-
* append integration step feedback output to the GITHUB_OUTPUT file of verification step.
14+
1515

1616
### Deprecated
1717

1818

19+
### Removed
20+
21+
22+
### Fixed
23+
24+
25+
26+
## [v0.1.2] - 2024-10-03
27+
28+
### Added
29+
* API key as a required input.
30+
* Future plans & more in README.md.
31+
* International support
32+
33+
34+
### Changed
35+
* append integration step feedback output to the GITHUB_OUTPUT file of verification step.
36+
1937
### Removed
2038
* environment variable 'GOOGLE_API_KEY'.
2139

README.md

Lines changed: 114 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,26 @@
33

44
# AI Python Code Tutor (Gemini)
55

6-
Provide AI-powered feedback on Python code assignments using Google's Gemini language model.
6+
This action analyzes test results and code to provide personalized feedback on student assignments, including identifying errors, suggesting improvements, and explaining concepts.
7+
8+
The AI tutor can identify logic errors, suggest more efficient algorithms, explain complex concepts in simpler terms, and even provide links to relevant documentation.
9+
10+
It would save instructors' time, provide more consistent feedback, and help students learn more effectively regardless of time & location.
11+
12+
## Prerequisites
13+
14+
Before using this action, ensure you have the following:
15+
16+
* **pytest-json-report plugin:** This plugin is required to generate the JSON test reports that the action uses for analysis.
17+
* You can install it using pip:
18+
```bash
19+
pip install pytest-json-report
20+
```
21+
* To generate the JSON report, run the following command:
22+
```bash
23+
python -m pytest --json-report --json-report-file=report.json tests/test_my_test_file.py
24+
```
25+
* For more information on the plugin, see the [pytest-json-report documentation](https://pypi.org/project/pytest-json-report/).
726

827
## Key Features
928

@@ -13,18 +32,99 @@ Provide AI-powered feedback on Python code assignments using Google's Gemini lan
1332

1433
# Usage
1534
* Please set `GOOGLE_API_KEY` in the repository's secrets.
35+
36+
* To use the action, create a workflow file (e.g., `.github/workflows/classroom.yml`) in your repository and add the following configuration:
37+
38+
``` yaml
39+
on: [push]
40+
41+
jobs:
42+
grade:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Install dependencies
47+
run: pip install pytest pytest-json-report
48+
- name: Run tests
49+
run: |
50+
python -m pytest --json-report --json-report-file=report.json tests/test_my_test_file.py
51+
- name: AI Python Tutor
52+
uses: kangwonlee/[email protected]
53+
if: always()
54+
with:
55+
report-files: report.json
56+
api-key: ${{ secrets.GOOGLE_API_KEY }}
57+
student-files: exercise.py
58+
readme-path: README.md
59+
explanation-in: English
60+
timeout-minutes: 5
61+
62+
```
63+
* This action analyzes the JSON output generated by the `pytest-json-report` plugin to understand the test results of your Python code and provide AI-powered feedback.
64+
65+
## Inputs
66+
* `report-files`: Comma-separated list of JSON report files generated by pytest-json-report. (Required)
67+
* `api-key`: Your Google API key. (Required)
68+
* `student-files`: Comma-separated list of Python files containing the student's code for review. (Required)
69+
* `readme-path`: Path to the assignment instructions (README.md). (Optional)
70+
* `explanation-in`: Language for explanations (e.g., English, Korean). (Optional, default: English)
71+
72+
### Example with multiple JSON files and student files
1673
``` yaml
17-
- name: AI Python Tutor
18-
uses: kangwonlee/[email protected]
19-
if: always()
20-
with:
21-
# JSON files by pytest-json-report plugin
22-
report-files: report0.json, report1.json
23-
# API key for AI
24-
api-key: ${{ secrets.GOOGLE_API_KEY }}
25-
# python file including the student's code
26-
student-files: exercies.py
27-
# assignment instruction file
28-
readme-path: README.md
29-
timeout-minutes: 5
74+
with:
75+
report-files: 'report1.json, report2.json, reports/*.json'
76+
api-key: ${{ secrets.GOOGLE_API_KEY }}
77+
student-files: 'exercise1.py, exercise2.py'
78+
readme-path: README.md
79+
explanation-in: English
3080
```
81+
82+
## Limitations
83+
* The action currently supports Korean only.
84+
* The action currently supports only Python code assignments.
85+
* The action requires the `pytest-json-report` plugin to generate JSON test reports.
86+
87+
## Future Work
88+
* Support multiple human languages.
89+
* Add language argument
90+
* Add language detection
91+
92+
* Add AI model choice argument to select different AI models.
93+
* Gemini advance
94+
* Gemini basic
95+
96+
* Support more programming languages.
97+
* Possibly in a different repository
98+
99+
* Feedback on code passing all tests.
100+
* Possible further analysis on the code.
101+
* Provide suggestions for further improvements.
102+
103+
* Add `verbose` argument to provide more detailed feedback.
104+
* More internal details
105+
106+
## Troubleshooting
107+
108+
* If you encounter any issues, please check the action logs for more information.
109+
* To view the logs, go to the Actions tab of your repository, click on the workflow run, and then select the "AI Python Tutor" job. You'll find the logs for each step in the job.
110+
111+
### Common Errors:
112+
113+
* **API Key Errors:**
114+
* "Invalid API key": Double-check your API key in the repository secrets and the workflow file.
115+
* "API key not found": Make sure you have set the `GOOGLE_API_KEY` in your repository secrets.
116+
* **Report File Errors:**
117+
* "Report file not found": Ensure the JSON report is generated using `pytest-json-report` and placed in the correct location (e.g., `report.json` in the root of your repository).
118+
* "Invalid report format": Use the `pytest-json-report` plugin with the recommended options to generate a valid report.
119+
* **Student File Errors:**
120+
* "Student file not found": Make sure the student's code file is in the correct location and has a `.py` extension.
121+
* **Timeout Errors:**
122+
* "Action timed out": Increase the `timeout-minutes` value in your workflow file or optimize your code.
123+
124+
### Debugging Suggestions:
125+
126+
* **Check Action Logs:** View the action logs in the GitHub Actions interface for detailed error messages.
127+
* **Test Locally:** Use `act` to run the action locally and debug your workflow.
128+
129+
## Contact
130+
* If you have any questions or feedback, please contact the author : https://github.com/kangwonlee.

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ inputs:
2525
required: false
2626
default: 'README.md'
2727
type: string
28+
explanation-in:
29+
description: 'Generate explanations in the specified language'
30+
required: false
31+
default: 'English'
32+
type: string
2833
outputs:
2934
feedback:
3035
description: 'Feedback from the tutor'

0 commit comments

Comments
 (0)