Skip to content

Commit

Permalink
fix(llm): prisma request with too many items was failing due to length
Browse files Browse the repository at this point in the history
  • Loading branch information
sneko committed Mar 20, 2024
1 parent 9b2d169 commit a646e90
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/features/llm-langchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,12 @@ export class LangchainWithLocalVectorStoreLlmManager implements LlmManager {
throw new Error('it seems no initiative has been computed, which is required to export them to the llm system');
}

// Note: the deletion should be handled by the `onCascade` constraint but leaving it for record
// Also, for tools with used `notId` but it was not working with too many items (https://github.com/prisma/prisma/issues/12499#issuecomment-2009179865)
await tx.initiativeLlmDocument.deleteMany({
where: {
initiativeId: {
notIn: initiatives.map((initiative) => initiative.id),
initiative: {
is: null,
},
},
});
Expand Down

0 comments on commit a646e90

Please sign in to comment.