@runnerpro/backend 1.13.32 → 1.13.33

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.
@@ -20,7 +20,7 @@ function sendPrompt(prompt, options = {}) {
20
20
  location: 'europe-west8', // Reemplaza con tu región
21
21
  });
22
22
  // Selecciona el modelo de Gemini más rápido
23
- const model = 'gemini-2.5-flash'; // Flash es más rápido que Pro
23
+ const model = 'gemini-2.5-flash-lite-preview-06-17'; // Flash es más rápido que Pro
24
24
  // Configura el modelo generativo con parámetros optimizados para velocidad
25
25
  const generativeModel = vertex_ai.preview.getGenerativeModel({
26
26
  model: model,
@@ -30,31 +30,20 @@ function sendPrompt(prompt, options = {}) {
30
30
  topK: options.topK || 20,
31
31
  },
32
32
  });
33
- console.log('prompt', prompt);
34
- console.log('generativeModel', generativeModel);
35
33
  try {
36
34
  const resp = yield generativeModel.generateContent(prompt);
37
- console.log('finishReason:', (_a = resp.response.candidates[0]) === null || _a === void 0 ? void 0 : _a.finishReason);
38
- console.log('thoughtsTokenCount:', (_b = resp.response.usageMetadata) === null || _b === void 0 ? void 0 : _b.thoughtsTokenCount);
39
- console.log('totalTokenCount:', (_c = resp.response.usageMetadata) === null || _c === void 0 ? void 0 : _c.totalTokenCount);
40
- if (resp.response.candidates && resp.response.candidates[0]) {
41
- const content = resp.response.candidates[0].content;
42
- if (content.parts && content.parts.length > 0 && content.parts[0].text) {
43
- console.log('✅ Texto generado exitosamente');
44
- return content.parts[0].text;
45
- }
46
- else {
47
- console.log('❌ Error: No hay texto en content.parts');
48
- console.log('content.parts:', content.parts);
49
- }
50
- }
51
- else {
52
- console.log('❌ Error: No hay candidates en la respuesta');
53
- }
54
- return '';
35
+ // Early return si no hay candidates
36
+ const candidate = (_a = resp.response.candidates) === null || _a === void 0 ? void 0 : _a[0];
37
+ if (!candidate)
38
+ return '';
39
+ // Early return si no hay parts
40
+ const parts = (_b = candidate.content) === null || _b === void 0 ? void 0 : _b.parts;
41
+ if (!parts || parts.length === 0)
42
+ return '';
43
+ // Return del texto si existe
44
+ return ((_c = parts[0]) === null || _c === void 0 ? void 0 : _c.text) || '';
55
45
  }
56
46
  catch (error) {
57
- console.error('Error al enviar el prompt:', error);
58
47
  throw error;
59
48
  }
60
49
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAe,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,gBAiDxE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prompt/index.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAe,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,gBAoCxE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.13.32",
3
+ "version": "1.13.33",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"