@silexpert/core 1.3.21 → 1.3.22

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.
@@ -1,7 +1,5 @@
1
1
  export declare enum AIPromptKey {
2
2
  BANK_STATEMENT = "bank_statement",
3
- INVOICE = "invoice",
4
- INVOICE_CSV = "invoice_csv",
5
3
  ASK_COLLABORATOR = "ask_collaborator"
6
4
  }
7
5
  interface AIPromptInfo {
@@ -1 +1 @@
1
- {"version":3,"file":"AIPrompt.d.ts","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,cAAc,mBAAmB;IACjC,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;CACtC;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CAqC7C,CAAC"}
1
+ {"version":3,"file":"AIPrompt.d.ts","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;CACtC;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CA4C7C,CAAC"}
@@ -4,22 +4,27 @@ exports.AIPrompt = exports.AIPromptKey = void 0;
4
4
  var AIPromptKey;
5
5
  (function (AIPromptKey) {
6
6
  AIPromptKey["BANK_STATEMENT"] = "bank_statement";
7
- AIPromptKey["INVOICE"] = "invoice";
8
- AIPromptKey["INVOICE_CSV"] = "invoice_csv";
9
7
  AIPromptKey["ASK_COLLABORATOR"] = "ask_collaborator";
10
8
  })(AIPromptKey || (exports.AIPromptKey = AIPromptKey = {}));
11
9
  exports.AIPrompt = {
12
10
  [AIPromptKey.BANK_STATEMENT]: {
13
- userPrompt: 'Here are some lines from a bank statement (this might be a french one "relevé de comptes"), I need you to extract all the transactions from it.',
14
- systemPrompt: 'Extract transactions from this bank statement in a json format like this: [{"dateValue": string (format like this YYYY-MM-DD), "label": string | null, "debit": number, "credit": number}, ...]',
15
- },
16
- [AIPromptKey.INVOICE]: {
17
- userPrompt: 'Can you give me the info of this document in json format? (all the articles with their prices)',
18
- systemPrompt: 'Convert this into a sensible structured json response. The output should be strictly be json with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice',
19
- },
20
- [AIPromptKey.INVOICE_CSV]: {
21
- userPrompt: 'Can you give me the info of this document in csv format? (all the articles with their prices)',
22
- systemPrompt: 'Convert this into a sensible structured csv response (date, label, débit, crédit). The output should be strictly be csv with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice'
11
+ userPrompt: 'Voici des lignes issues d’un relevé de compte bancaire (cela peut être un relevé français). Pouvez-vous extraire toutes les transactions présentes dans ce document ?',
12
+ systemPrompt: `
13
+ Analysez ce relevé de compte bancaire et extrayez toutes les transactions sous forme d'un objet JSON structuré.
14
+ Le relevé peut contenir des informations telles que la date de la transaction, le libellé, le montant débité et le montant crédité (ou alors un montant en positif pour le crédit et un montant en négatif pour le débit).
15
+ Garder exactement le même ordre de transaction que dans le relevé.
16
+ Le format attendu est le suivant :
17
+ [
18
+ {
19
+ "dateValue": string (format : YYYY-MM-DD correspondant à la date de la transaction),
20
+ "label": string | null (correspond à la description de la transaction, à conserver intacte sans modification, traduction ou altération),
21
+ "debit": number,
22
+ "credit": number
23
+ },
24
+ ...
25
+ ]
26
+ Assurez-vous que le JSON soit strictement conforme à ce format, sans aucun commentaire ou texte supplémentaire.
27
+ `,
23
28
  },
24
29
  [AIPromptKey.ASK_COLLABORATOR]: {
25
30
  userPrompt: '', // this is not used
@@ -1 +1 @@
1
- {"version":3,"file":"AIPrompt.js","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,gDAAiC,CAAA;IACjC,kCAAmB,CAAA;IACnB,0CAA2B,CAAA;IAC3B,oDAAqC,CAAA;AACvC,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAOY,QAAA,QAAQ,GAAsC;IACzD,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;QAC5B,UAAU,EAAE,iJAAiJ;QAC7J,YAAY,EAAE,iMAAiM;KAChN;IACD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACrB,UAAU,EAAE,gGAAgG;QAC5G,YAAY,EAAE,4NAA4N;KAC3O;IACD,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE;QACzB,UAAU,EAAE,+FAA+F;QAC3G,YAAY,EAAE,uPAAuP;KACtQ;IACD,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE;QAC9B,UAAU,EAAE,EAAE,EAAE,mBAAmB;QACnC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;KAoBb;KACF;CACO,CAAC","sourcesContent":["export enum AIPromptKey {\n BANK_STATEMENT = 'bank_statement',\n INVOICE = 'invoice',\n INVOICE_CSV = 'invoice_csv',\n ASK_COLLABORATOR = 'ask_collaborator',\n}\n\ninterface AIPromptInfo {\n userPrompt: string;\n systemPrompt: string;\n}\n\nexport const AIPrompt: Record<AIPromptKey, AIPromptInfo> = {\n [AIPromptKey.BANK_STATEMENT]: {\n userPrompt: 'Here are some lines from a bank statement (this might be a french one \"relevé de comptes\"), I need you to extract all the transactions from it.',\n systemPrompt: 'Extract transactions from this bank statement in a json format like this: [{\"dateValue\": string (format like this YYYY-MM-DD), \"label\": string | null, \"debit\": number, \"credit\": number}, ...]',\n },\n [AIPromptKey.INVOICE]: {\n userPrompt: 'Can you give me the info of this document in json format? (all the articles with their prices)',\n systemPrompt: 'Convert this into a sensible structured json response. The output should be strictly be json with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice',\n },\n [AIPromptKey.INVOICE_CSV]: {\n userPrompt: 'Can you give me the info of this document in csv format? (all the articles with their prices)',\n systemPrompt: 'Convert this into a sensible structured csv response (date, label, débit, crédit). The output should be strictly be csv with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice'\n },\n [AIPromptKey.ASK_COLLABORATOR]: {\n userPrompt: '', // this is not used\n systemPrompt: `\n Vous êtes un spécialiste reconnu en comptabilité française, droit fiscal, droit des entreprises et droit social.\n Vous êtes parfaitement à jour des dernières lois, réglementations et jurisprudences en vigueur.\n Votre mission est de fournir des réponses précises et professionnelles basées sur le contexte fourni,\n dans un français irréprochable et un style concis.\n Si le contexte ne contient pas les informations pertinentes pour répondre à la question, veuillez l'indiquer clairement plutôt que d'inventer des informations.\n Si la question est en dehors de votre domaine d'expertise, indiquez-le clairement et indiquez que la catégorie et sous-catégorie sont \"hors sujet\".\n Vous devez toujours répondre en français et vous devez retourner votre réponse en un texte brut au format JSON brut:\n - 'category': la catégorie principale de la question (comptabilité, fiscalité, législation, sociale, ou autre si nécessaire)\n - 'sub_category': la sous-catégorie spécifique de la question\n - 'response': votre réponse détaillée à la question selon les critères mentionnés ci-dessus en texte brut pas de html, markdown ou autre pas de retour à la ligne\n - 'references': les références utilisées si demandée uniquement des liens url ';' comme séparateur\n Ce texte doit être au format JSON brut, sans balises HTML, sans code, sans markdown et sans commentaires.\n Par exemple:\n {\n \"category\": \"comptabilité\",\n \"sub_category\": \"société\",\n \"response\": \"La société doit respecter les obligations comptables en matière de tenue de livres et de conservation des documents.\",\n \"references\": \"https://www.legifrance.gouv.fr;https://www.service-public.fr\"\n }\n `,\n },\n} as const;"]}
1
+ {"version":3,"file":"AIPrompt.js","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,gDAAiC,CAAA;IACjC,oDAAqC,CAAA;AACvC,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAOY,QAAA,QAAQ,GAAsC;IACzD,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;QAC5B,UAAU,EAAE,uKAAuK;QACnL,YAAY,EAAE;;;;;;;;;;;;;;;KAeb;KACF;IACD,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE;QAC9B,UAAU,EAAE,EAAE,EAAE,mBAAmB;QACnC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;KAoBb;KACF;CACO,CAAC","sourcesContent":["export enum AIPromptKey {\n BANK_STATEMENT = 'bank_statement',\n ASK_COLLABORATOR = 'ask_collaborator',\n}\n\ninterface AIPromptInfo {\n userPrompt: string;\n systemPrompt: string;\n}\n\nexport const AIPrompt: Record<AIPromptKey, AIPromptInfo> = {\n [AIPromptKey.BANK_STATEMENT]: {\n userPrompt: 'Voici des lignes issues d’un relevé de compte bancaire (cela peut être un relevé français). Pouvez-vous extraire toutes les transactions présentes dans ce document ?',\n systemPrompt: `\n Analysez ce relevé de compte bancaire et extrayez toutes les transactions sous forme d'un objet JSON structuré.\n Le relevé peut contenir des informations telles que la date de la transaction, le libellé, le montant débité et le montant crédité (ou alors un montant en positif pour le crédit et un montant en négatif pour le débit).\n Garder exactement le même ordre de transaction que dans le relevé.\n Le format attendu est le suivant :\n [\n {\n \"dateValue\": string (format : YYYY-MM-DD correspondant à la date de la transaction),\n \"label\": string | null (correspond à la description de la transaction, à conserver intacte sans modification, traduction ou altération),\n \"debit\": number,\n \"credit\": number\n },\n ...\n ]\n Assurez-vous que le JSON soit strictement conforme à ce format, sans aucun commentaire ou texte supplémentaire.\n `,\n },\n [AIPromptKey.ASK_COLLABORATOR]: {\n userPrompt: '', // this is not used\n systemPrompt: `\n Vous êtes un spécialiste reconnu en comptabilité française, droit fiscal, droit des entreprises et droit social.\n Vous êtes parfaitement à jour des dernières lois, réglementations et jurisprudences en vigueur.\n Votre mission est de fournir des réponses précises et professionnelles basées sur le contexte fourni,\n dans un français irréprochable et un style concis.\n Si le contexte ne contient pas les informations pertinentes pour répondre à la question, veuillez l'indiquer clairement plutôt que d'inventer des informations.\n Si la question est en dehors de votre domaine d'expertise, indiquez-le clairement et indiquez que la catégorie et sous-catégorie sont \"hors sujet\".\n Vous devez toujours répondre en français et vous devez retourner votre réponse en un texte brut au format JSON brut:\n - 'category': la catégorie principale de la question (comptabilité, fiscalité, législation, sociale, ou autre si nécessaire)\n - 'sub_category': la sous-catégorie spécifique de la question\n - 'response': votre réponse détaillée à la question selon les critères mentionnés ci-dessus en texte brut pas de html, markdown ou autre pas de retour à la ligne\n - 'references': les références utilisées si demandée uniquement des liens url ';' comme séparateur\n Ce texte doit être au format JSON brut, sans balises HTML, sans code, sans markdown et sans commentaires.\n Par exemple:\n {\n \"category\": \"comptabilité\",\n \"sub_category\": \"société\",\n \"response\": \"La société doit respecter les obligations comptables en matière de tenue de livres et de conservation des documents.\",\n \"references\": \"https://www.legifrance.gouv.fr;https://www.service-public.fr\"\n }\n `,\n },\n} as const;"]}
@@ -7,5 +7,6 @@ export declare class OcrTransactions {
7
7
  transactions: OcrTransactionDetails[];
8
8
  idBankAccount: number;
9
9
  isPdf: boolean;
10
+ error?: string;
10
11
  }
11
12
  //# sourceMappingURL=OcrTransactions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OcrTransactions.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,eAAe;IAE1B,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAGtC,aAAa,EAAE,MAAM,CAAC;IAKtB,KAAK,EAAE,OAAO,CAAC;CAChB"}
1
+ {"version":3,"file":"OcrTransactions.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,eAAe;IAE1B,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAGtC,aAAa,EAAE,MAAM,CAAC;IAKtB,KAAK,EAAE,OAAO,CAAC;IAKf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -34,4 +34,10 @@ __decorate([
34
34
  (0, __1.ApiProperty)(),
35
35
  __metadata("design:type", Boolean)
36
36
  ], OcrTransactions.prototype, "isPdf", void 0);
37
+ __decorate([
38
+ (0, __1.ApiPropertyOptional)(),
39
+ (0, class_validator_1.IsOptional)(),
40
+ (0, class_validator_1.IsString)(),
41
+ __metadata("design:type", String)
42
+ ], OcrTransactions.prototype, "error", void 0);
37
43
  //# sourceMappingURL=OcrTransactions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OcrTransactions.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4C;AAC5C,mCAA+D;AAC/D,sFAA2E;AAG3E,MAAa,eAAe;CAiB3B;AAjBD,0CAiBC;AAfC;IADC,IAAA,uBAAmB,GAAE;;6CAIpB;AAGF;IADC,IAAA,eAAW,GAAE;;qDACwB;AAGtC;IADC,IAAA,uBAAmB,GAAE;;sDACA;AAKtB;IAHC,IAAA,6BAAS,GAAE;IACX,IAAA,2BAAS,GAAE;IACX,IAAA,eAAW,GAAE;;8CACC","sourcesContent":["import { IsBoolean } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { OcrTransactionDetails } from './OcrTypeTransactions';\n\nexport class OcrTransactions {\n @ApiPropertyOptional()\n file?: {\n id: number;\n token: string;\n };\n\n @ApiProperty()\n transactions: OcrTransactionDetails[];\n\n @ApiPropertyOptional()\n idBankAccount: number;\n\n @ToBoolean()\n @IsBoolean()\n @ApiProperty()\n isPdf: boolean;\n}\n"]}
1
+ {"version":3,"file":"OcrTransactions.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkE;AAClE,mCAA+D;AAC/D,sFAA2E;AAG3E,MAAa,eAAe;CAsB3B;AAtBD,0CAsBC;AApBC;IADC,IAAA,uBAAmB,GAAE;;6CAIpB;AAGF;IADC,IAAA,eAAW,GAAE;;qDACwB;AAGtC;IADC,IAAA,uBAAmB,GAAE;;sDACA;AAKtB;IAHC,IAAA,6BAAS,GAAE;IACX,IAAA,2BAAS,GAAE;IACX,IAAA,eAAW,GAAE;;8CACC;AAKf;IAHC,IAAA,uBAAmB,GAAE;IACrB,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8CACI","sourcesContent":["import { IsBoolean, IsOptional, IsString } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { OcrTransactionDetails } from './OcrTypeTransactions';\n\nexport class OcrTransactions {\n @ApiPropertyOptional()\n file?: {\n id: number;\n token: string;\n };\n\n @ApiProperty()\n transactions: OcrTransactionDetails[];\n\n @ApiPropertyOptional()\n idBankAccount: number;\n\n @ToBoolean()\n @IsBoolean()\n @ApiProperty()\n isPdf: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n error?: string;\n}\n"]}
@@ -1,7 +1,5 @@
1
1
  export declare enum AIPromptKey {
2
2
  BANK_STATEMENT = "bank_statement",
3
- INVOICE = "invoice",
4
- INVOICE_CSV = "invoice_csv",
5
3
  ASK_COLLABORATOR = "ask_collaborator"
6
4
  }
7
5
  interface AIPromptInfo {
@@ -1 +1 @@
1
- {"version":3,"file":"AIPrompt.d.ts","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,cAAc,mBAAmB;IACjC,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;CACtC;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CAqC7C,CAAC"}
1
+ {"version":3,"file":"AIPrompt.d.ts","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;CACtC;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CA4C7C,CAAC"}
@@ -1,22 +1,27 @@
1
1
  export var AIPromptKey;
2
2
  (function (AIPromptKey) {
3
3
  AIPromptKey["BANK_STATEMENT"] = "bank_statement";
4
- AIPromptKey["INVOICE"] = "invoice";
5
- AIPromptKey["INVOICE_CSV"] = "invoice_csv";
6
4
  AIPromptKey["ASK_COLLABORATOR"] = "ask_collaborator";
7
5
  })(AIPromptKey || (AIPromptKey = {}));
8
6
  export const AIPrompt = {
9
7
  [AIPromptKey.BANK_STATEMENT]: {
10
- userPrompt: 'Here are some lines from a bank statement (this might be a french one "relevé de comptes"), I need you to extract all the transactions from it.',
11
- systemPrompt: 'Extract transactions from this bank statement in a json format like this: [{"dateValue": string (format like this YYYY-MM-DD), "label": string | null, "debit": number, "credit": number}, ...]',
12
- },
13
- [AIPromptKey.INVOICE]: {
14
- userPrompt: 'Can you give me the info of this document in json format? (all the articles with their prices)',
15
- systemPrompt: 'Convert this into a sensible structured json response. The output should be strictly be json with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice',
16
- },
17
- [AIPromptKey.INVOICE_CSV]: {
18
- userPrompt: 'Can you give me the info of this document in csv format? (all the articles with their prices)',
19
- systemPrompt: 'Convert this into a sensible structured csv response (date, label, débit, crédit). The output should be strictly be csv with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice'
8
+ userPrompt: 'Voici des lignes issues d’un relevé de compte bancaire (cela peut être un relevé français). Pouvez-vous extraire toutes les transactions présentes dans ce document ?',
9
+ systemPrompt: `
10
+ Analysez ce relevé de compte bancaire et extrayez toutes les transactions sous forme d'un objet JSON structuré.
11
+ Le relevé peut contenir des informations telles que la date de la transaction, le libellé, le montant débité et le montant crédité (ou alors un montant en positif pour le crédit et un montant en négatif pour le débit).
12
+ Garder exactement le même ordre de transaction que dans le relevé.
13
+ Le format attendu est le suivant :
14
+ [
15
+ {
16
+ "dateValue": string (format : YYYY-MM-DD correspondant à la date de la transaction),
17
+ "label": string | null (correspond à la description de la transaction, à conserver intacte sans modification, traduction ou altération),
18
+ "debit": number,
19
+ "credit": number
20
+ },
21
+ ...
22
+ ]
23
+ Assurez-vous que le JSON soit strictement conforme à ce format, sans aucun commentaire ou texte supplémentaire.
24
+ `,
20
25
  },
21
26
  [AIPromptKey.ASK_COLLABORATOR]: {
22
27
  userPrompt: '', // this is not used
@@ -1 +1 @@
1
- {"version":3,"file":"AIPrompt.js","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,gDAAiC,CAAA;IACjC,kCAAmB,CAAA;IACnB,0CAA2B,CAAA;IAC3B,oDAAqC,CAAA;AACvC,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAOD,MAAM,CAAC,MAAM,QAAQ,GAAsC;IACzD,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;QAC5B,UAAU,EAAE,iJAAiJ;QAC7J,YAAY,EAAE,iMAAiM;KAChN;IACD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACrB,UAAU,EAAE,gGAAgG;QAC5G,YAAY,EAAE,4NAA4N;KAC3O;IACD,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE;QACzB,UAAU,EAAE,+FAA+F;QAC3G,YAAY,EAAE,uPAAuP;KACtQ;IACD,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE;QAC9B,UAAU,EAAE,EAAE,EAAE,mBAAmB;QACnC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;KAoBb;KACF;CACO,CAAC","sourcesContent":["export enum AIPromptKey {\n BANK_STATEMENT = 'bank_statement',\n INVOICE = 'invoice',\n INVOICE_CSV = 'invoice_csv',\n ASK_COLLABORATOR = 'ask_collaborator',\n}\n\ninterface AIPromptInfo {\n userPrompt: string;\n systemPrompt: string;\n}\n\nexport const AIPrompt: Record<AIPromptKey, AIPromptInfo> = {\n [AIPromptKey.BANK_STATEMENT]: {\n userPrompt: 'Here are some lines from a bank statement (this might be a french one \"relevé de comptes\"), I need you to extract all the transactions from it.',\n systemPrompt: 'Extract transactions from this bank statement in a json format like this: [{\"dateValue\": string (format like this YYYY-MM-DD), \"label\": string | null, \"debit\": number, \"credit\": number}, ...]',\n },\n [AIPromptKey.INVOICE]: {\n userPrompt: 'Can you give me the info of this document in json format? (all the articles with their prices)',\n systemPrompt: 'Convert this into a sensible structured json response. The output should be strictly be json with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice',\n },\n [AIPromptKey.INVOICE_CSV]: {\n userPrompt: 'Can you give me the info of this document in csv format? (all the articles with their prices)',\n systemPrompt: 'Convert this into a sensible structured csv response (date, label, débit, crédit). The output should be strictly be csv with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice'\n },\n [AIPromptKey.ASK_COLLABORATOR]: {\n userPrompt: '', // this is not used\n systemPrompt: `\n Vous êtes un spécialiste reconnu en comptabilité française, droit fiscal, droit des entreprises et droit social.\n Vous êtes parfaitement à jour des dernières lois, réglementations et jurisprudences en vigueur.\n Votre mission est de fournir des réponses précises et professionnelles basées sur le contexte fourni,\n dans un français irréprochable et un style concis.\n Si le contexte ne contient pas les informations pertinentes pour répondre à la question, veuillez l'indiquer clairement plutôt que d'inventer des informations.\n Si la question est en dehors de votre domaine d'expertise, indiquez-le clairement et indiquez que la catégorie et sous-catégorie sont \"hors sujet\".\n Vous devez toujours répondre en français et vous devez retourner votre réponse en un texte brut au format JSON brut:\n - 'category': la catégorie principale de la question (comptabilité, fiscalité, législation, sociale, ou autre si nécessaire)\n - 'sub_category': la sous-catégorie spécifique de la question\n - 'response': votre réponse détaillée à la question selon les critères mentionnés ci-dessus en texte brut pas de html, markdown ou autre pas de retour à la ligne\n - 'references': les références utilisées si demandée uniquement des liens url ';' comme séparateur\n Ce texte doit être au format JSON brut, sans balises HTML, sans code, sans markdown et sans commentaires.\n Par exemple:\n {\n \"category\": \"comptabilité\",\n \"sub_category\": \"société\",\n \"response\": \"La société doit respecter les obligations comptables en matière de tenue de livres et de conservation des documents.\",\n \"references\": \"https://www.legifrance.gouv.fr;https://www.service-public.fr\"\n }\n `,\n },\n} as const;"]}
1
+ {"version":3,"file":"AIPrompt.js","sourceRoot":"","sources":["../../../../ts/types/Enum/AIPrompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,gDAAiC,CAAA;IACjC,oDAAqC,CAAA;AACvC,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAOD,MAAM,CAAC,MAAM,QAAQ,GAAsC;IACzD,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;QAC5B,UAAU,EAAE,uKAAuK;QACnL,YAAY,EAAE;;;;;;;;;;;;;;;KAeb;KACF;IACD,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE;QAC9B,UAAU,EAAE,EAAE,EAAE,mBAAmB;QACnC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;KAoBb;KACF;CACO,CAAC","sourcesContent":["export enum AIPromptKey {\n BANK_STATEMENT = 'bank_statement',\n ASK_COLLABORATOR = 'ask_collaborator',\n}\n\ninterface AIPromptInfo {\n userPrompt: string;\n systemPrompt: string;\n}\n\nexport const AIPrompt: Record<AIPromptKey, AIPromptInfo> = {\n [AIPromptKey.BANK_STATEMENT]: {\n userPrompt: 'Voici des lignes issues d’un relevé de compte bancaire (cela peut être un relevé français). Pouvez-vous extraire toutes les transactions présentes dans ce document ?',\n systemPrompt: `\n Analysez ce relevé de compte bancaire et extrayez toutes les transactions sous forme d'un objet JSON structuré.\n Le relevé peut contenir des informations telles que la date de la transaction, le libellé, le montant débité et le montant crédité (ou alors un montant en positif pour le crédit et un montant en négatif pour le débit).\n Garder exactement le même ordre de transaction que dans le relevé.\n Le format attendu est le suivant :\n [\n {\n \"dateValue\": string (format : YYYY-MM-DD correspondant à la date de la transaction),\n \"label\": string | null (correspond à la description de la transaction, à conserver intacte sans modification, traduction ou altération),\n \"debit\": number,\n \"credit\": number\n },\n ...\n ]\n Assurez-vous que le JSON soit strictement conforme à ce format, sans aucun commentaire ou texte supplémentaire.\n `,\n },\n [AIPromptKey.ASK_COLLABORATOR]: {\n userPrompt: '', // this is not used\n systemPrompt: `\n Vous êtes un spécialiste reconnu en comptabilité française, droit fiscal, droit des entreprises et droit social.\n Vous êtes parfaitement à jour des dernières lois, réglementations et jurisprudences en vigueur.\n Votre mission est de fournir des réponses précises et professionnelles basées sur le contexte fourni,\n dans un français irréprochable et un style concis.\n Si le contexte ne contient pas les informations pertinentes pour répondre à la question, veuillez l'indiquer clairement plutôt que d'inventer des informations.\n Si la question est en dehors de votre domaine d'expertise, indiquez-le clairement et indiquez que la catégorie et sous-catégorie sont \"hors sujet\".\n Vous devez toujours répondre en français et vous devez retourner votre réponse en un texte brut au format JSON brut:\n - 'category': la catégorie principale de la question (comptabilité, fiscalité, législation, sociale, ou autre si nécessaire)\n - 'sub_category': la sous-catégorie spécifique de la question\n - 'response': votre réponse détaillée à la question selon les critères mentionnés ci-dessus en texte brut pas de html, markdown ou autre pas de retour à la ligne\n - 'references': les références utilisées si demandée uniquement des liens url ';' comme séparateur\n Ce texte doit être au format JSON brut, sans balises HTML, sans code, sans markdown et sans commentaires.\n Par exemple:\n {\n \"category\": \"comptabilité\",\n \"sub_category\": \"société\",\n \"response\": \"La société doit respecter les obligations comptables en matière de tenue de livres et de conservation des documents.\",\n \"references\": \"https://www.legifrance.gouv.fr;https://www.service-public.fr\"\n }\n `,\n },\n} as const;"]}
@@ -7,5 +7,6 @@ export declare class OcrTransactions {
7
7
  transactions: OcrTransactionDetails[];
8
8
  idBankAccount: number;
9
9
  isPdf: boolean;
10
+ error?: string;
10
11
  }
11
12
  //# sourceMappingURL=OcrTransactions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OcrTransactions.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,eAAe;IAE1B,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAGtC,aAAa,EAAE,MAAM,CAAC;IAKtB,KAAK,EAAE,OAAO,CAAC;CAChB"}
1
+ {"version":3,"file":"OcrTransactions.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,eAAe;IAE1B,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,YAAY,EAAE,qBAAqB,EAAE,CAAC;IAGtC,aAAa,EAAE,MAAM,CAAC;IAKtB,KAAK,EAAE,OAAO,CAAC;IAKf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { IsBoolean } from 'class-validator';
10
+ import { IsBoolean, IsOptional, IsString } from 'class-validator';
11
11
  import { ApiProperty, ApiPropertyOptional } from '../../../..';
12
12
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
13
13
  export class OcrTransactions {
@@ -15,6 +15,7 @@ export class OcrTransactions {
15
15
  transactions;
16
16
  idBankAccount;
17
17
  isPdf;
18
+ error;
18
19
  }
19
20
  __decorate([
20
21
  ApiPropertyOptional(),
@@ -34,4 +35,10 @@ __decorate([
34
35
  ApiProperty(),
35
36
  __metadata("design:type", Boolean)
36
37
  ], OcrTransactions.prototype, "isPdf", void 0);
38
+ __decorate([
39
+ ApiPropertyOptional(),
40
+ IsOptional(),
41
+ IsString(),
42
+ __metadata("design:type", String)
43
+ ], OcrTransactions.prototype, "error", void 0);
37
44
  //# sourceMappingURL=OcrTransactions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OcrTransactions.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAG3E,MAAM,OAAO,eAAe;IAE1B,IAAI,CAGF;IAGF,YAAY,CAA0B;IAGtC,aAAa,CAAS;IAKtB,KAAK,CAAU;CAChB;AAfC;IADC,mBAAmB,EAAE;;6CAIpB;AAGF;IADC,WAAW,EAAE;;qDACwB;AAGtC;IADC,mBAAmB,EAAE;;sDACA;AAKtB;IAHC,SAAS,EAAE;IACX,SAAS,EAAE;IACX,WAAW,EAAE;;8CACC","sourcesContent":["import { IsBoolean } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { OcrTransactionDetails } from './OcrTypeTransactions';\n\nexport class OcrTransactions {\n @ApiPropertyOptional()\n file?: {\n id: number;\n token: string;\n };\n\n @ApiProperty()\n transactions: OcrTransactionDetails[];\n\n @ApiPropertyOptional()\n idBankAccount: number;\n\n @ToBoolean()\n @IsBoolean()\n @ApiProperty()\n isPdf: boolean;\n}\n"]}
1
+ {"version":3,"file":"OcrTransactions.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/ocr/OcrTransactions.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAG3E,MAAM,OAAO,eAAe;IAE1B,IAAI,CAGF;IAGF,YAAY,CAA0B;IAGtC,aAAa,CAAS;IAKtB,KAAK,CAAU;IAKf,KAAK,CAAU;CAChB;AApBC;IADC,mBAAmB,EAAE;;6CAIpB;AAGF;IADC,WAAW,EAAE;;qDACwB;AAGtC;IADC,mBAAmB,EAAE;;sDACA;AAKtB;IAHC,SAAS,EAAE;IACX,SAAS,EAAE;IACX,WAAW,EAAE;;8CACC;AAKf;IAHC,mBAAmB,EAAE;IACrB,UAAU,EAAE;IACZ,QAAQ,EAAE;;8CACI","sourcesContent":["import { IsBoolean, IsOptional, IsString } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\nimport { ToBoolean } from '../../../../utils/transforms/boolean.transform';\nimport { OcrTransactionDetails } from './OcrTypeTransactions';\n\nexport class OcrTransactions {\n @ApiPropertyOptional()\n file?: {\n id: number;\n token: string;\n };\n\n @ApiProperty()\n transactions: OcrTransactionDetails[];\n\n @ApiPropertyOptional()\n idBankAccount: number;\n\n @ToBoolean()\n @IsBoolean()\n @ApiProperty()\n isPdf: boolean;\n\n @ApiPropertyOptional()\n @IsOptional()\n @IsString()\n error?: string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.3.21",
3
+ "version": "1.3.22",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "dist/cjs/index.js",
@@ -1,7 +1,5 @@
1
1
  export enum AIPromptKey {
2
2
  BANK_STATEMENT = 'bank_statement',
3
- INVOICE = 'invoice',
4
- INVOICE_CSV = 'invoice_csv',
5
3
  ASK_COLLABORATOR = 'ask_collaborator',
6
4
  }
7
5
 
@@ -12,16 +10,23 @@ interface AIPromptInfo {
12
10
 
13
11
  export const AIPrompt: Record<AIPromptKey, AIPromptInfo> = {
14
12
  [AIPromptKey.BANK_STATEMENT]: {
15
- userPrompt: 'Here are some lines from a bank statement (this might be a french one "relevé de comptes"), I need you to extract all the transactions from it.',
16
- systemPrompt: 'Extract transactions from this bank statement in a json format like this: [{"dateValue": string (format like this YYYY-MM-DD), "label": string | null, "debit": number, "credit": number}, ...]',
17
- },
18
- [AIPromptKey.INVOICE]: {
19
- userPrompt: 'Can you give me the info of this document in json format? (all the articles with their prices)',
20
- systemPrompt: 'Convert this into a sensible structured json response. The output should be strictly be json with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice',
21
- },
22
- [AIPromptKey.INVOICE_CSV]: {
23
- userPrompt: 'Can you give me the info of this document in csv format? (all the articles with their prices)',
24
- systemPrompt: 'Convert this into a sensible structured csv response (date, label, débit, crédit). The output should be strictly be csv with no extra commentary if you find a image in the document this is an invoice and you should return the info of the invoice'
13
+ userPrompt: 'Voici des lignes issues d’un relevé de compte bancaire (cela peut être un relevé français). Pouvez-vous extraire toutes les transactions présentes dans ce document ?',
14
+ systemPrompt: `
15
+ Analysez ce relevé de compte bancaire et extrayez toutes les transactions sous forme d'un objet JSON structuré.
16
+ Le relevé peut contenir des informations telles que la date de la transaction, le libellé, le montant débité et le montant crédité (ou alors un montant en positif pour le crédit et un montant en négatif pour le débit).
17
+ Garder exactement le même ordre de transaction que dans le relevé.
18
+ Le format attendu est le suivant :
19
+ [
20
+ {
21
+ "dateValue": string (format : YYYY-MM-DD correspondant à la date de la transaction),
22
+ "label": string | null (correspond à la description de la transaction, à conserver intacte sans modification, traduction ou altération),
23
+ "debit": number,
24
+ "credit": number
25
+ },
26
+ ...
27
+ ]
28
+ Assurez-vous que le JSON soit strictement conforme à ce format, sans aucun commentaire ou texte supplémentaire.
29
+ `,
25
30
  },
26
31
  [AIPromptKey.ASK_COLLABORATOR]: {
27
32
  userPrompt: '', // this is not used
@@ -1,4 +1,4 @@
1
- import { IsBoolean } from 'class-validator';
1
+ import { IsBoolean, IsOptional, IsString } from 'class-validator';
2
2
  import { ApiProperty, ApiPropertyOptional } from '../../../..';
3
3
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
4
  import { OcrTransactionDetails } from './OcrTypeTransactions';
@@ -20,4 +20,9 @@ export class OcrTransactions {
20
20
  @IsBoolean()
21
21
  @ApiProperty()
22
22
  isPdf: boolean;
23
+
24
+ @ApiPropertyOptional()
25
+ @IsOptional()
26
+ @IsString()
27
+ error?: string;
23
28
  }