Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🀍

Task/improve performance of reading activities with AI (#8138)

Thomas Kaul9122858aa0ce
diff --git a/apps/api/src/app/endpoints/ai/ai.service.spec.ts b/apps/api/src/app/endpoints/ai/ai.service.spec.ts
index 25ca009416..549bdcef35 100644
--- a/apps/api/src/app/endpoints/ai/ai.service.spec.ts
+++ b/apps/api/src/app/endpoints/ai/ai.service.spec.ts
@@ -197,7 +197,7 @@ describe('AiService', () => {
);
});
- it('Restricts the routing to endpoints with zero data retention and passes a PDF file to the model itself', async () => {
+ it('Restricts the routing to endpoints with zero data retention, disables the reasoning and passes a PDF file to the model itself', async () => {
await aiService.getActivityRowsFromFile({
file: { buffer: Buffer.from('%PDF-1.7'), mediaType: 'application/pdf' },
locale: 'de-CH'
@@ -206,6 +206,7 @@ describe('AiService', () => {
expect(chat).toHaveBeenCalledWith('vision-model', {
plugins: [{ id: 'file-parser', pdf: { engine: 'native' } }],
provider: { require_parameters: true, zdr: true },
+ reasoning: { effort: 'none' },
usage: { include: true }
});
});
diff --git a/apps/api/src/app/endpoints/ai/ai.service.ts b/apps/api/src/app/endpoints/ai/ai.service.ts
index 6bd88fc344..006b47a358 100644
--- a/apps/api/src/app/endpoints/ai/ai.service.ts
+++ b/apps/api/src/app/endpoints/ai/ai.service.ts
@@ -289,11 +289,12 @@ export class AiService {
* OpenRouter is not covered by the zero data retention. The model gets no
* tools and copies the asset, the account and the broker as printed, hence
* the rows still have to be matched to asset profiles and accounts. The
- * name of the file is passed as well, as it can name the broker. A row above the
- * maximum number of activities is left out. An output which reaches the
- * maximum number of output tokens is cut, hence it gives an error for the
- * caller. A cut output without any text is not parsed at all, hence the
- * finish reason is checked as well.
+ * name of the file is passed as well, as it can name the broker. The
+ * reasoning is disabled, as it can add thousands of output tokens even for a
+ * single row. A row above the maximum number of activities is left out. An
+ * output which reaches the maximum number of output tokens is cut, hence it
+ * gives an error for the caller. A cut output without any text is not parsed
+ * at all, hence the finish reason is checked as well.
*/
public async getActivityRowsFromFile({
abortSignal,
@@ -341,6 +342,7 @@ export class AiService {
settings: {
plugins: [{ id: 'file-parser', pdf: { engine: 'native' } }],
provider: { require_parameters: true, zdr: true },
+ reasoning: { effort: 'none' },
usage: { include: true }
}
}),