goblin-agents 0.1.11 → 1.0.0

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.
Files changed (2) hide show
  1. package/lib/llm/utils.js +14 -1
  2. package/package.json +1 -2
package/lib/llm/utils.js CHANGED
@@ -2,6 +2,19 @@ const HtmlEntities = require('html-entities');
2
2
  const sanitizeHtml = require('sanitize-html');
3
3
  const {RecursiveCharacterTextSplitter} = require('@langchain/textsplitters');
4
4
 
5
+ function loadPdfToPngConverter() {
6
+ try {
7
+ return require('pdf-to-png-converter');
8
+ } catch (ex) {
9
+ if (ex.code === 'MODULE_NOT_FOUND') {
10
+ throw new Error(
11
+ 'You must add explicitly "pdf-to-png-converter" as dependency to your project'
12
+ );
13
+ }
14
+ throw ex;
15
+ }
16
+ }
17
+
5
18
  const MAX_SEGMENT_LENGTH = 500;
6
19
 
7
20
  const OCR_SYSTEM_PROMPT = `Effectue une reconnaissance optique de caractères (OCR) sur cette image et extraits-en le texte lisible.
@@ -12,7 +25,7 @@ Corrige les erreurs évidentes et restitue un texte propre et fidèle à l'origi
12
25
  Ta réponse contient uniquement le texte lisible.`;
13
26
 
14
27
  const getPDFImages = async (pdfPath) => {
15
- const {pdfToPng} = require('pdf-to-png-converter');
28
+ const {pdfToPng} = loadPdfToPngConverter();
16
29
  // The function accepts PDF file path or a Buffer
17
30
  const pages = await pdfToPng(pdfPath, {
18
31
  disableFontFace: true, // When `false`, fonts will be rendered using a built-in font renderer that constructs the glyphs with primitive path commands. Default value is true.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goblin-agents",
3
- "version": "0.1.11",
3
+ "version": "1.0.0",
4
4
  "description": "AI Agents framework",
5
5
  "author": "Samuel Loup",
6
6
  "license": "MIT",
@@ -18,7 +18,6 @@
18
18
  "fs-extra": "^9.1.0",
19
19
  "html-entities": "^2.4.0",
20
20
  "ollama": "^0.5.10",
21
- "pdf-to-png-converter": "^3.6.5",
22
21
  "sanitize-html": "^2.12.1",
23
22
  "xcraft-core-goblin": "^5.8.0",
24
23
  "xcraft-core-utils": "^4.14.0"