Skip to content

Commit

Permalink
refactor: comment out cat in rag
Browse files Browse the repository at this point in the history
  • Loading branch information
JBR90 committed Jan 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b04da2b commit bf9c98c
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions packages/core/src/rag/index.ts
Original file line number Diff line number Diff line change
@@ -579,21 +579,20 @@ Thank you and happy classifying!`;
},
cacheStrategy: { ttl: 60 * 5, swr: 60 * 2 },
});
if (!foundKeyStage) {
const categorisation = await this.categoriseKeyStageAndSubject(
keyStage,
this._chatMeta,
);

if (categorisation.keyStage) {
foundKeyStage = await this.prisma.keyStage.findFirst({
where: {
slug: categorisation.keyStage,
},
cacheStrategy: { ttl: 60 * 5, swr: 60 * 2 },
});
}
}
// if (!foundKeyStage) {
// const categorisation = await this.categoriseKeyStageAndSubject(
// keyStage,
// this._chatMeta,
// );
// if (categorisation.keyStage) {
// foundKeyStage = await this.prisma.keyStage.findFirst({
// where: {
// slug: categorisation.keyStage,
// },
// cacheStrategy: { ttl: 60 * 5, swr: 60 * 2 },
// });
// }
// }
if (foundKeyStage) {
await kv.set<KeyStage>(`keyStage:${keyStage}`, foundKeyStage, {
ex: 60 * 60,
@@ -638,23 +637,23 @@ Thank you and happy classifying!`;
});

// If none of that works, fall back to categorising the subject based on free text
if (!foundSubject) {
log.info(
"No subject found. Categorise the input to try to work out what it is using categoriseKeyStageAndSubject",
);
const categorisation = await this.categoriseKeyStageAndSubject(
subject,
this._chatMeta,
);
if (categorisation.subject) {
foundSubject = await this.prisma.subject.findFirst({
where: {
slug: categorisation.subject,
},
cacheStrategy: { ttl: 60 * 5, swr: 60 * 2 },
});
}
}
// if (!foundSubject) {
// // log.info(
// // "No subject found. Categorise the input to try to work out what it is using categoriseKeyStageAndSubject",
// // );
// const categorisation = await this.categoriseKeyStageAndSubject(
// subject,
// this._chatMeta,
// );
// if (categorisation.subject) {
// foundSubject = await this.prisma.subject.findFirst({
// where: {
// slug: categorisation.subject,
// },
// cacheStrategy: { ttl: 60 * 5, swr: 60 * 2 },
// });
// }
// }
if (foundSubject) {
await kv.set<Subject>(`subject:${subject}`, foundSubject, {
ex: 60 * 60,

0 comments on commit bf9c98c

Please sign in to comment.