From ff6072f447b266b01870e5600b7fcafb898ebe3e Mon Sep 17 00:00:00 2001 From: Gareth Lomax <6199423+gclomax@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:14:00 +0000 Subject: [PATCH] intermediate commit while bugfixing --- .../aila/src/core/quiz/BaseFullQuizService.ts | 3 ++- .../src/core/quiz/SimpleFullQuizService.test.ts | 16 +++++++++++++++- packages/aila/src/core/quiz/interfaces.ts | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/aila/src/core/quiz/BaseFullQuizService.ts b/packages/aila/src/core/quiz/BaseFullQuizService.ts index 8829ba247..5556b935a 100644 --- a/packages/aila/src/core/quiz/BaseFullQuizService.ts +++ b/packages/aila/src/core/quiz/BaseFullQuizService.ts @@ -6,6 +6,7 @@ import type { import type { AilaQuizGeneratorService } from "../AilaServices"; import type { BaseSchema, BaseType } from "./ChoiceModels"; import { MLQuizGenerator } from "./MLQuizGenerator"; +import { testRatingSchema } from "./RerankerStructuredOutputSchema"; import { TestSchemaReranker } from "./SchemaReranker"; import { SimpleQuizSelector } from "./SimpleQuizSelector"; import type { @@ -60,6 +61,6 @@ export class SimpleFullQuizService extends BaseFullQuizService { new SimpleQuizSelector(); public quizReranker: AilaQuizReranker = - new TestSchemaReranker(); + new TestSchemaReranker(testRatingSchema, "/starterQuiz"); public quizGenerators: AilaQuizGeneratorService[] = [new MLQuizGenerator()]; } diff --git a/packages/aila/src/core/quiz/SimpleFullQuizService.test.ts b/packages/aila/src/core/quiz/SimpleFullQuizService.test.ts index eacb8b4cd..c089e326a 100644 --- a/packages/aila/src/core/quiz/SimpleFullQuizService.test.ts +++ b/packages/aila/src/core/quiz/SimpleFullQuizService.test.ts @@ -1,9 +1,23 @@ import type { QuizPath } from "../../protocol/schema"; import { AilaQuiz } from "./AilaQuiz"; +import { SimpleFullQuizService } from "./BaseFullQuizService"; import { selectHighestRated } from "./ChoiceModels"; import { CircleTheoremLesson } from "./CircleTheoremsExampleOutput"; import { TestRating, testRatingSchema } from "./RerankerStructuredOutputSchema"; +import { FullQuizServiceFactory } from "./SimpleBodgeFactory"; describe("Tests SimpleFullQuizService", () => { jest.setTimeout(30000); - it("should create a quiz", async () => { \ No newline at end of file + it("should create a quiz", async () => { + const quizFactory = new FullQuizServiceFactory(); + const quizService = quizFactory.create("simple"); + + const quiz = await quizService.createBestQuiz( + "/starterQuiz", + CircleTheoremLesson, + ); + console.log(JSON.stringify(quiz)); + const ans = true; + expect(ans).toBe(true); + }); +}); diff --git a/packages/aila/src/core/quiz/interfaces.ts b/packages/aila/src/core/quiz/interfaces.ts index 256216e85..fab82bb30 100644 --- a/packages/aila/src/core/quiz/interfaces.ts +++ b/packages/aila/src/core/quiz/interfaces.ts @@ -80,6 +80,10 @@ export interface FullQuizService { quizSelector: QuizSelector; quizReranker: AilaQuizReranker; quizGenerators: AilaQuizGeneratorService[]; + createBestQuiz( + quizType: quizPatchType, + lessonPlan: LooseLessonPlan, + ): Promise; } // Separating these out to allow for different types of selectors for different types of rerankers. Abstracting away allows for the LLM to potentially change the answer depending on input.