npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

simple-review-ia

v1.0.1

Published

A lightweight package to generate friendly summaries from reviews using AI models

Readme

Simple Review IA

Un paquete npm liviano para generar resúmenes amistosos de reseñas usando modelos de IA como Gemini y OpenAI.

🚀 Características

  • Liviano: Solo un archivo principal
  • Multi-modelo: Soporte para Gemini y OpenAI
  • Configurable: Opciones personalizables para tono y longitud
  • TypeScript: Tipado completo incluido
  • Fácil de usar: API simple y directa
  • Prompt optimizado: Genera solo resúmenes sin saludos ni comentarios adicionales
  • Validación robusta: Tests comprehensivos para verificar funcionamiento

📦 Instalación

npm install simple-review-ia

�� Configuración

Variables de Entorno

Para usar el ejemplo incluido, crea un archivo .env en la raíz del proyecto:

# Copia el archivo de ejemplo
cp env.example .env

# Edita el archivo .env con tus API keys

Contenido del archivo .env:

# Google Gemini API Key
GEMINI_API_KEY=tu-api-key-de-gemini

# OpenAI API Key
OPENAI_API_KEY=tu-api-key-de-openai

Para Gemini (Google AI)

  1. Obtén tu API key de Google AI Studio
  2. Configura el proveedor:
import { createReviewSummarizer, AIProvider } from "simple-review-ia";

const provider: AIProvider = {
  name: "gemini",
  apiKey: "tu-api-key-de-gemini",
  options: {
    maxCharacters: 250,
    tone: "friendly",
    geminiModel: "gemini-1.5-flash",
  },
};

Para OpenAI

  1. Obtén tu API key de OpenAI Platform
  2. Configura el proveedor:
const provider: AIProvider = {
  name: "openai",
  apiKey: "tu-api-key-de-openai",
  options: {
    maxCharacters: 250,
    tone: "friendly",
    openaiModel: "gpt-3.5-turbo",
  },
};

💡 Uso

Uso Básico

import { summarizeReviews } from "simple-review-ia";

const reviews = [
  "Excelente servicio, el auto estaba impecable y el proceso fue muy fácil.",
  "Muy buena experiencia, lo recomiendo totalmente.",
  "El personal fue muy amable y profesional.",
];

const summary = await summarizeReviews(reviews, provider);
console.log(summary);
// Output: "Los clientes destacan el excelente servicio con autos impecables,
// proceso fácil y personal amable y profesional. Experiencia muy recomendable."

Uso Avanzado

import { createReviewSummarizer } from "simple-review-ia";

const summarizer = createReviewSummarizer({
  name: "gemini",
  apiKey: "tu-api-key",
  options: {
    maxCharacters: 200,
    tone: "professional",
    temperature: 0.8,
  },
});

const summary = await summarizer.generateSummary(reviews);

## ⚙️ Opciones

| Opción          | Tipo                                       | Default              | Descripción                                                     |
| --------------- | ------------------------------------------ | -------------------- | --------------------------------------------------------------- |
| `maxCharacters` | `number`                                   | `250`                | Límite de caracteres enviado al modelo (controla costos)        |
| `tone`          | `'friendly' \| 'professional' \| 'casual'` | `'friendly'`         | Tono del resumen                                                |
| `language`      | `string`                                   | `'es'`               | Idioma del resumen                                              |
| `geminiModel`   | `string`                                   | `'gemini-1.5-flash'` | Modelo de Gemini a usar                                         |
| `openaiModel`   | `string`                                   | `'gpt-3.5-turbo'`    | Modelo de OpenAI a usar                                         |
| `temperature`   | `number`                                   | `0.7`                | Controla la creatividad (0.1=muy consistente, 0.9=muy creativo) |

## 🎯 Ejemplos de Uso

### Control de Temperature

El parámetro `temperature` controla qué tan creativas o consistentes son las respuestas:

```typescript
// Temperature bajo - respuestas más consistentes
const consistentProvider = {
  name: "gemini",
  apiKey: "tu-api-key",
  options: {
    temperature: 0.2, // Muy consistente
    tone: "professional",
  },
};

// Temperature medio - balance entre creatividad y consistencia
const balancedProvider = {
  name: "gemini",
  apiKey: "tu-api-key",
  options: {
    temperature: 0.7, // Nuestro default
    tone: "friendly",
  },
};

// Temperature alto - respuestas más creativas
const creativeProvider = {
  name: "gemini",
  apiKey: "tu-api-key",
  options: {
    temperature: 0.9, // Muy creativo
    tone: "casual",
  },
};
```

### Resumen Profesional

```typescript
const professionalProvider: AIProvider = {
  name: "gemini",
  apiKey: "tu-api-key",
  options: {
    tone: "professional",
    maxCharacters: 300,
  },
};
```

### Resumen Casual

```typescript
const casualProvider: AIProvider = {
  name: "openai",
  apiKey: "tu-api-key",
  options: {
    tone: "casual",
    maxCharacters: 150,
  },
};
```

## 🔒 Seguridad y Control de Costos

### Seguridad

- Nunca incluyas tu API key en el código del cliente
- Usa variables de entorno para las API keys
- Considera usar un proxy o backend para mayor seguridad

### Control de Costos

El parámetro `maxCharacters` controla directamente los tokens enviados al modelo:

- **250 caracteres** ≈ 62 tokens (costo bajo)
- **500 caracteres** ≈ 125 tokens (costo medio)
- **1000 caracteres** ≈ 250 tokens (costo alto)

**Recomendación**: Usa valores entre 200-300 caracteres para resúmenes concisos y económicos.

## 📝 Licencia

MIT

## 🤝 Contribuir

Las contribuciones son bienvenidas. Por favor, abre un issue o pull request.

## 📄 Changelog

### v1.0.0

- Soporte inicial para Gemini y OpenAI
- Funcionalidad básica de resumen de reseñas
- Configuración flexible de opciones