diff --git a/samples/js-schoolAgent/src/attendanceAgent.ts b/samples/js-schoolAgent/src/attendanceAgent.ts index d27d22a68..044aefd7c 100644 --- a/samples/js-schoolAgent/src/attendanceAgent.ts +++ b/samples/js-schoolAgent/src/attendanceAgent.ts @@ -16,7 +16,7 @@ import { ai } from './genkit.js'; import { reportAbsence, reportTardy } from './tools.js'; -import { agentDescription, agentPrompt } from './util.js'; +import { agentDescription } from './util.js'; const tools = [reportAbsence, reportTardy, 'routingAgent']; const specialization = 'attendance'; @@ -36,7 +36,10 @@ export const attendanceAgent = ai.definePrompt( tools, }, ` {{ role "system"}} -${agentPrompt(specialization)} + +You are Bell, a helpful attendance assistance agent for Sparkyville High School. +A parent has been referred to you to handle a ${specialization}-related concern. +Use the tools available to you to assist the parent. - Parents may only report absences for their own students. - If you are unclear about any of the fields required to report an absence or tardy, request clarification before using the tool. diff --git a/samples/js-schoolAgent/src/gradesAgent.ts b/samples/js-schoolAgent/src/gradesAgent.ts index 3d4e911a2..58871fc52 100644 --- a/samples/js-schoolAgent/src/gradesAgent.ts +++ b/samples/js-schoolAgent/src/gradesAgent.ts @@ -16,7 +16,7 @@ import { ai } from './genkit.js'; import { getRecentGrades } from './tools.js'; -import { agentDescription, agentPrompt } from './util.js'; +import { agentDescription } from './util.js'; const tools = [getRecentGrades, 'routingAgent']; const specialization = 'grades'; @@ -36,7 +36,10 @@ export const gradesAgent = ai.definePrompt( tools, }, ` {{ role "system"}} -${agentPrompt(specialization)} + +You are Bell, a helpful attendance assistance agent for Sparkyville High School. +A parent has been referred to you to handle a ${specialization}-related concern. +Use the tools available to you to assist the parent. Guidelines: - Parents may only view grades for their own students diff --git a/samples/js-schoolAgent/src/routingAgent.ts b/samples/js-schoolAgent/src/routingAgent.ts index 83b584e3a..3986baa4f 100644 --- a/samples/js-schoolAgent/src/routingAgent.ts +++ b/samples/js-schoolAgent/src/routingAgent.ts @@ -25,14 +25,26 @@ export const routingAgent = ai.definePrompt( description: `This agent helps with answering inquiries and requests.`, tools: [searchEvents, attendanceAgent, gradesAgent, upcomingHolidays], }, - `You are Bell, a helpful assistant that provides information to parents of Sparkyville High School students. + `You are Bell, the friendly AI office receptionist at Sparkyville High School. + + Your job is to help answer inquiries from parents. Parents may ask you school-related questions, request grades or test scores, + or call in to let you know their child will be late or absent. + + You have some specialized agents in different departments that you can transfer to. + + 1. Grades Agent - This agent can provide informtion about previous scores for assignments and tests. + 2. Attendance Agent - This agent can help with attendance requests, such as marking a student as late/tardy or absent. + Use the information below and any tools made available to you to respond to the parent's requests. -=== Frequently Asked Questions + If the parent has an inquiry that you do not know the answer to, do NOT make the answer up. Simply let them know that you cannot help them, + and direct them to call the office directly where a human will be able to help them. + + === Frequently Asked Questions -- Classes begin at 8am, students are dismissed at 3:30pm -- Parking permits are issued on a first-come first-serve basis beginning Aug 1 + - Classes begin at 8am, students are dismissed at 3:30pm + - Parking permits are issued on a first-come first-serve basis beginning Aug 1 -{{userContext @state }} + {{userContext @state }} ` ); diff --git a/samples/js-schoolAgent/src/terminal.ts b/samples/js-schoolAgent/src/terminal.ts index 67926f1dd..9b3717449 100644 --- a/samples/js-schoolAgent/src/terminal.ts +++ b/samples/js-schoolAgent/src/terminal.ts @@ -79,7 +79,8 @@ async function handleChatResponse( m.content .filter((p) => !!p.toolRequest) .map( - (p) => `${p.toolRequest.name}(${JSON.stringify(p.toolRequest.input)})` + (p) => + `${p.toolRequest?.name}(${JSON.stringify(p.toolRequest?.input)})` ) ) .flat() diff --git a/samples/js-schoolAgent/src/util.ts b/samples/js-schoolAgent/src/util.ts index 497aad283..e66f628fe 100644 --- a/samples/js-schoolAgent/src/util.ts +++ b/samples/js-schoolAgent/src/util.ts @@ -18,8 +18,3 @@ export const agentDescription = (specialization: string, tools: string[]) => ` Transfer to this agent when the user asks about ${specialization}. This agent can perform the following functions: ${tools.map((t) => t).join(', ')}. Do not mention that you are transferring, just do it.`; - -export const agentPrompt = (specialization: string) => ` -You are Bell, a helpful attendance assistance agent for Sparkyville High School. -A parent has been referred to you to handle a ${specialization}-related concern. -Use the tools available to you to assist the parent.`;