Skip to content

Commit

Permalink
remove gpt-4 hard code in call to ai
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Mar 22, 2024
1 parent 4632a35 commit 38b4b16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a fork of the core essay question type which can use the ChatGPT Large language model to give automatic feedback and marking for submitted responses.


It requires either a paid for ChatGPT api account which will give access to ChatGPT4 or Ollama hosted Large Language Model. Accounts are available from https://platform.openai.com, Ollama is available from https://github.com/ollama/ollama. It depends on the Moodle aiconnect tool which is available from
It requires either a paid for ChatGPT api account which will give access to ChatGPT4 or Ollama hosted Large Language Model. Accounts are available from https://platform.openai.com, Ollama is available from https://github.com/ollama/ollama. It depends on the Moodle aiconnect tool which is available from

https://github.com/marcusgreen/moodle-tool_aiconnect

Expand All @@ -22,6 +22,8 @@ images in the question display may not work. It will only work with the immediat
## Roadmap
~~Support other LLM systems. Supporting a self hosted LLM will ensure data sovereignty~~ done

Moderation: Do not show ai feedback until previewed and approved by a teache

Cron based evaluation. Allow for slow LLM systems by marking on a cron timer

Allow it to work with other question behaviour types such as Interactive with multiple tries.
4 changes: 2 additions & 2 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function apply_attempt_state(question_attempt_step $step) {
* @return void
*/
public function grade_response(array $response) : array {
$ai = new ai\ai('gpt-4');
$ai = new ai\ai();
if (is_array($response)) {
$prompt = 'in [[' . strip_tags($response['answer']) . ']]';
$prompt .= ' analyse the part between [[ and ]] as follows: ';
Expand All @@ -156,7 +156,7 @@ public function grade_response(array $response) : array {
$contentobject->feedback = preg_replace(array('/\[\[/', '/\]\]/'), '"', $contentobject->feedback);

$contentobject->feedback .= ' '.$this->llm_translate(get_config('qtype_aitext', 'disclaimer'));

xdebug_break();
// If there are no marks, write the feedback and set to needs grading .
if (is_null($contentobject->marks)) {
$grade = [0 => 0, question_state::$needsgrading];
Expand Down

0 comments on commit 38b4b16

Please sign in to comment.