diff --git a/src/lib/agent/services/agentService.ts b/src/lib/agent/services/agentService.ts index 86adca6..9081466 100644 --- a/src/lib/agent/services/agentService.ts +++ b/src/lib/agent/services/agentService.ts @@ -1,10 +1,18 @@ import { DefaultAzureCredential } from '@azure/identity'; import { AIProjectsClient } from '@azure/ai-projects'; -import { rubricMatcherTool } from '../tools/rubricMatcherTool'; -import { essayAnalyzerTool } from '../tools/essayAnalyzerTool'; import { ToolUtility } from '@azure/ai-projects'; import { AI_FOUNDRY_PROJECT_CONNECTION_STRING, AI_MODEL } from '$env/static/private'; +import { + rubricMatcherTool, + essayAnalyzerTool, + conceptVerifierTool, + feedbackGeneratorTool, + metacognitiveReflectionPromptTool, + selfAssessmentTool, + spellingAndGrammarCheckerTool +} from '../tools/index'; + const connectionString = AI_FOUNDRY_PROJECT_CONNECTION_STRING; if (!connectionString) { throw new Error('AI_FOUNDRY_PROJECT_CONNECTION_STRING is not set in environment variables'); @@ -22,18 +30,32 @@ const client = AIProjectsClient.fromConnectionString( const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([]); -const tools = [codeInterpreterTool.definition, rubricMatcherTool.definition, essayAnalyzerTool.definition]; +const tools = [ + codeInterpreterTool.definition, + rubricMatcherTool.definition, + essayAnalyzerTool.definition, + conceptVerifierTool.definition, + feedbackGeneratorTool.definition, + metacognitiveReflectionPromptTool.definition, + selfAssessmentTool.definition, + spellingAndGrammarCheckerTool.definition +]; -const instructions = "You are a helpful agent that can assist with providing feedback on a student's work for a teacher."; +const instructions = "You are a helpful agent that can assist with providing feedback on a student's work for a teacher. You are familiar with all modern pedagogy around summative and formative assessment, and K12 education, and primary and secondary education."; const toolResources = { ...codeInterpreterTool.resources, matchRubric: {}, - analyzeEssay: {} + analyzeEssay: {}, + conceptVerifier: {}, + feedbackGenerator: {}, + metacognitiveReflectionPrompt: {}, + selfAssessment: {}, + spellingAndGrammarChecker: {} }; const agent = await client.agents.createAgent(aiModel, { - name: `agent-assessment-feedback`, + name: `assessment-feedback-agent`, instructions, temperature: 0.5, tools, diff --git a/src/lib/agent/tools/conceptVerifierTool.ts b/src/lib/agent/tools/conceptVerifierTool.ts new file mode 100644 index 0000000..2371d43 --- /dev/null +++ b/src/lib/agent/tools/conceptVerifierTool.ts @@ -0,0 +1,14 @@ +import { ToolUtility } from '@azure/ai-projects'; + +export const conceptVerifierTool = ToolUtility.createFunctionTool({ + name: 'verifyConceptCoverage', + description: 'Checks which rubric‑listed concepts appear (or are missing) in the submission.', + parameters: { + type: 'object', + properties: { + submission: { type: 'string' }, + rubric: { type: 'string' } + }, + required: ['submission', 'rubric'] + } + }); \ No newline at end of file diff --git a/src/lib/agent/tools/feedbackGeneratorTool.ts b/src/lib/agent/tools/feedbackGeneratorTool.ts new file mode 100644 index 0000000..3a2e4bf --- /dev/null +++ b/src/lib/agent/tools/feedbackGeneratorTool.ts @@ -0,0 +1,14 @@ +import { ToolUtility } from '@azure/ai-projects'; + +export const feedbackGeneratorTool = ToolUtility.createFunctionTool({ + name: 'generateFeedback', + description: 'Produces two praise points and two actionable “try next time” suggestions based on submission and rubric.', + parameters: { + type: 'object', + properties: { + submission: { type: 'string' }, + rubric: { type: 'string' } + }, + required: ['submission', 'rubric'] + } + }); \ No newline at end of file diff --git a/src/lib/agent/tools/index.ts b/src/lib/agent/tools/index.ts new file mode 100644 index 0000000..b19d8fd --- /dev/null +++ b/src/lib/agent/tools/index.ts @@ -0,0 +1,7 @@ +export { rubricMatcherTool } from './rubricMatcherTool'; +export { essayAnalyzerTool } from './essayAnalyzerTool'; +export { conceptVerifierTool } from './conceptVerifierTool'; +export { feedbackGeneratorTool } from './feedbackGeneratorTool'; +export { metacognitiveReflectionPromptTool } from './metacognitiveReflectionPromptTool'; +export { selfAssessmentTool } from './selfAssessmentTool'; +export { spellingAndGrammarCheckerTool } from './spellingAndGrammarCheckerTool'; diff --git a/src/lib/agent/tools/metacognitiveReflectionPromptTool.ts b/src/lib/agent/tools/metacognitiveReflectionPromptTool.ts new file mode 100644 index 0000000..f98340d --- /dev/null +++ b/src/lib/agent/tools/metacognitiveReflectionPromptTool.ts @@ -0,0 +1,14 @@ +import { ToolUtility } from '@azure/ai-projects'; + +export const metacognitiveReflectionPromptTool = ToolUtility.createFunctionTool({ + name: 'generateReflectionPrompts', + description: 'Based on rubric shortfalls, generates prompts like “How could you strengthen your evidence in paragraph 2?”', + parameters: { + type: 'object', + properties: { + submission: { type: 'string' }, + rubric: { type: 'string' } + }, + required: ['submission', 'rubric'] + } + }); \ No newline at end of file diff --git a/src/lib/agent/tools/selfAssessmentTool.ts b/src/lib/agent/tools/selfAssessmentTool.ts new file mode 100644 index 0000000..b61c95d --- /dev/null +++ b/src/lib/agent/tools/selfAssessmentTool.ts @@ -0,0 +1,14 @@ +import { ToolUtility } from '@azure/ai-projects'; + +export const selfAssessmentTool = ToolUtility.createFunctionTool({ + name: 'createSelfAssessment', + description: 'Generates 3 short questions that prompt the student to reflect on their own work based on rubric gaps.', + parameters: { + type: 'object', + properties: { + submission: { type: 'string' }, + rubric: { type: 'string' } + }, + required: ['submission', 'rubric'] + } + }); \ No newline at end of file diff --git a/src/lib/agent/tools/spellingAndGrammarCheckerTool.ts b/src/lib/agent/tools/spellingAndGrammarCheckerTool.ts new file mode 100644 index 0000000..49495cd --- /dev/null +++ b/src/lib/agent/tools/spellingAndGrammarCheckerTool.ts @@ -0,0 +1,14 @@ +import { ToolUtility } from '@azure/ai-projects'; + +export const spellingAndGrammarCheckerTool = ToolUtility.createFunctionTool({ + name: 'checkSpellingAndGrammar', + description: 'Identifies spelling, punctuation, and syntax issues in the submission and suggests corrections.', + parameters: { + type: 'object', + properties: { + submission: { type: 'string', description: 'The student submission text' }, + rubric: { type: 'string', description: 'The rubric or task description (for contextual tone adjustments)' } + }, + required: ['submission'] + } + }); \ No newline at end of file