Skip to content

Commit 67a5d72

Browse files
committed
Current things I tried to fix AI issues
1 parent c2097c6 commit 67a5d72

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

course-matrix/backend/src/constants/availableFunctions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const availableFunctions: AvailableFunctions = {
4040
try {
4141
// Retrieve user_id
4242
const user_id = (req as any).user.id;
43-
43+
console.log("NO");
4444
// Retrieve user timetable item based on user_id
4545
let timeTableQuery = supabase
4646
.schema("timetable")
@@ -62,7 +62,7 @@ export const availableFunctions: AvailableFunctions = {
6262
};
6363
}
6464

65-
return { status: 200, data: timetableData };
65+
return { status: 200, timetableCount: timetableData.length, data: timetableData };
6666
} catch (error) {
6767
console.log(error);
6868
return { status: 400, error: error };
@@ -199,7 +199,7 @@ export const availableFunctions: AvailableFunctions = {
199199
const { name, semester, courses, restrictions } = args;
200200
// Get user id from session authentication to insert in the user_id col
201201
const user_id = (req as any).user.id;
202-
202+
203203
if (name.length > 50) {
204204
return {
205205
status: 400,

course-matrix/backend/src/controllers/aiController.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,12 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
245245
- Providing personalized recommendations based on degree requirements and course availability
246246
- Creating, reading, updating, and deleting user timetables based on natural language
247247
248-
##!IMPORTANT!: For create timetable requests, even if the timetable limit of 25 has been exceeded, run the tool regardless to get a more up to date data.
249-
250248
## Your Capabilities
251249
- Create new timetables based on provided courses and restrictions
252250
- Update timetable names and semesters
253251
- Delete a user's timetables
254-
- Retrieve timetables that the user owns
252+
- Retrieve timetables that the user owns, THIS INFORMATION MUST BE REFRESHED OFTEN!!!
253+
- Retrieve the number of timetables that the user owns. THIS SHOULD NOT EXCEED 25!
255254
256255
## Response Guidelines
257256
- Be concise and direct when answering course-related questions
@@ -262,12 +261,13 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
262261
- Format long lists of timetables as a table
263262
264263
## Tool call guidelines
264+
- call getTimetables no matter what, to obtain the most of to date # of timetables for the user.
265265
- Include the timetable ID in all getTimetables tool call responses
266266
- Link: For every tool call, for each timetable that it gets/deletes/modifies/creates, include a link with it displayed as "View Timetable" to ${
267267
process.env.CLIENT_APP_URL
268268
}/dashboard/timetable?edit=[[TIMETABLE_ID]] , where TIMETABLE_ID is the id of the respective timetable.
269269
- If the user provides a course code of length 6 like CSCA08, then assume they mean CSCA08H3 (H3 appended)
270-
- If the user wants to create a timetable, first call getCourses to get course information on the requested courses, then call generateTimetable.
270+
- If the user wants to create a timetable, first call getTimetables, then getCourses to get course information on the requested courses, then call generateTimetable.
271271
- Do not make up fake courses or offerings.
272272
- You can only edit title of the timetable, nothing else. If a user tries to edit something else, acknowledge this limitation.
273273
- For delete timetable requests, if the user asks to delete an ambiguous timetable name (i.e many with similar name exist) then ask them to clarify which one
@@ -281,7 +281,7 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
281281
tools: {
282282
getTimetables: tool({
283283
description:
284-
"Get all the timetables of the currently logged in user.",
284+
"Get all the timetables of the currently logged in user AND the number of timetables of the currently logged in user",
285285
parameters: z.object({}),
286286
execute: async (args) => {
287287
return await availableFunctions.getTimetables(args, req);

0 commit comments

Comments
 (0)