@tstdl/base 0.92.104 → 0.92.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ai/ai.service.js CHANGED
@@ -11,6 +11,7 @@ import { GoogleGenerativeAI } from '@google/generative-ai';
11
11
  import { NotSupportedError } from '../errors/not-supported.error.js';
12
12
  import { Singleton } from '../injector/decorators.js';
13
13
  import { inject, injectArgument } from '../injector/inject.js';
14
+ import { Logger } from '../logger/logger.js';
14
15
  import { getShutdownSignal } from '../process-shutdown.js';
15
16
  import { DeferredPromise } from '../promise/deferred-promise.js';
16
17
  import { LazyPromise } from '../promise/lazy-promise.js';
@@ -28,7 +29,6 @@ import { resolveValueOrAsyncProvider } from '../utils/value-or-provider.js';
28
29
  import { AiFileService } from './ai-file.service.js';
29
30
  import { AiSession } from './ai-session.js';
30
31
  import { isSchemaFunctionDeclarationWithHandler } from './types.js';
31
- import { Logger } from '../logger/logger.js';
32
32
  export class AiServiceOptions {
33
33
  apiKey;
34
34
  keyFile;
@@ -252,7 +252,6 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
252
252
  let lastUsageMetadata;
253
253
  let candidate;
254
254
  for await (const generationResponse of generation.stream) {
255
- this.#logger.trace('Handling generation stream response');
256
255
  candidate = generationResponse.candidates.at(0);
257
256
  inputContent.push(candidate.content);
258
257
  const { promptTokenCount = 0, candidatesTokenCount = 0 } = generationResponse.usageMetadata ?? {};
@@ -554,6 +554,7 @@ let DocumentManagementService = DocumentManagementService_1 = class DocumentMana
554
554
  async enrichDocument(documentId) {
555
555
  const document = await this.documentService.load(documentId);
556
556
  const { properties, ...extractionResult } = await this.extractFileInformation(document.fileId, document.typeId);
557
+ this.logger.trace(`Applying extraction to document ${document.id}`);
557
558
  await this.documentService.transaction(async (documentService, transaction) => {
558
559
  await documentService.update(document.id, { ...extractionResult, validated: false });
559
560
  await this.setPropertyValues({ documentId, properties: properties }, transaction);
@@ -727,6 +728,7 @@ Ordne die Datei unter "file" der passenden Anforderungen unter "requests" zu. Gi
727
728
  .where(isString(assumeTypeId) ? eq(documentType.id, assumeTypeId) : undefined);
728
729
  const typeLabelEntries = types.map((type) => ({ id: type.typeId, label: `${type.categoryLabel} | ${type.typeGroup} | ${type.typeLabel}` }));
729
730
  const typeLabels = typeLabelEntries.map(({ label }) => label);
731
+ this.logger.trace(`Classifying document file ${fileId}`);
730
732
  const documentTypeGeneration = await this.#aiService.generate({
731
733
  ...defaultGenerationOptions,
732
734
  generationSchema: object({
@@ -766,6 +768,7 @@ Ordne die Datei unter "file" der passenden Anforderungen unter "requests" zu. Gi
766
768
  ? {}
767
769
  : { documentProperties: object(fromEntries(propertiesSchemaEntries)) })
768
770
  });
771
+ this.logger.trace(`Extracting document file ${fileId}`);
769
772
  const { json: extraction } = await this.#aiService.generate({
770
773
  model: 'gemini-2.0-flash',
771
774
  generationOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.104",
3
+ "version": "0.92.105",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"