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

@edpear/sdk

v1.0.0

Published

EdPear SDK - AI-powered educational components for JavaScript/TypeScript

Downloads

97

Readme

EdPear SDK

JavaScript/TypeScript SDK for EdPear - AI-powered educational components.

Installation

npm install @edpear/sdk

Quick Start

const { EdPearClient } = require('@edpear/sdk');

const client = new EdPearClient({
  apiKey: process.env.EDPEAR_API_KEY
});

// Analyze an image
const result = await client.analyzeImage({
  image: base64Image,
  prompt: "Analyze this textbook page and explain the main concepts"
});

console.log(result.result);

API Reference

EdPearClient

Constructor

const client = new EdPearClient({
  apiKey: string,        // Required: Your EdPear API key
  baseURL?: string       // Optional: API base URL (default: https://api.edpear.com)
});

Methods

analyzeImage(request)

Analyze an image using EdPear's Vision AI.

Parameters:

  • request.image (string): Base64 encoded image
  • request.prompt (string): Analysis prompt
  • request.maxTokens (number, optional): Maximum tokens in response (default: 1000)
  • request.temperature (number, optional): Response creativity (0-1, default: 0.7)

Returns: Promise

Example:

const result = await client.analyzeImage({
  image: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...',
  prompt: 'Create a study guide from this textbook page',
  maxTokens: 1200,
  temperature: 0.7
});

console.log(result.result);
console.log(`Credits used: ${result.creditsUsed}`);
getStatus()

Get account status and remaining credits.

Returns: Promise<{credits: number, user: any}>

Example:

const status = await client.getStatus();
console.log(`Credits remaining: ${status.credits}`);

Types

VisionRequest

interface VisionRequest {
  image: string;           // Base64 encoded image
  prompt: string;          // Analysis prompt
  maxTokens?: number;   // Maximum tokens (optional)
  temperature?: number;   // Response creativity 0-1 (optional)
}

VisionResponse

interface VisionResponse {
  success: boolean;        // Request success status
  result: string;         // Analysis result
  creditsUsed: number;     // Credits consumed
  remainingCredits: number; // Credits remaining
  processingTime: number;  // Processing time in ms
}

Examples

Basic Image Analysis

const fs = require('fs');
const { EdPearClient } = require('@edpear/sdk');

const client = new EdPearClient({
  apiKey: process.env.EDPEAR_API_KEY
});

async function analyzeTextbook() {
  // Read image file
  const imageBuffer = fs.readFileSync('./textbook-page.jpg');
  const base64Image = imageBuffer.toString('base64');

  // Analyze image
  const result = await client.analyzeImage({
    image: base64Image,
    prompt: "Analyze this textbook page and create a study guide with key concepts, formulas, and practice questions."
  });

  console.log('Study Guide:');
  console.log(result.result);
  console.log(`\nCredits used: ${result.creditsUsed}`);
}

Batch Processing

async function analyzeMultiplePages(imagePaths, subject) {
  const results = [];
  
  for (const imagePath of imagePaths) {
    const imageBuffer = fs.readFileSync(imagePath);
    const base64Image = imageBuffer.toString('base64');
    
    const result = await client.analyzeImage({
      image: base64Image,
      prompt: `Analyze this ${subject} page and extract key concepts, formulas, and examples.`
    });
    
    results.push(result);
    
    // Add delay to avoid rate limiting
    await new Promise(resolve => setTimeout(resolve, 1000));
  }
  
  return results;
}

Error Handling

async function safeAnalyze(image, prompt) {
  try {
    const result = await client.analyzeImage({ image, prompt });
    return result;
  } catch (error) {
    if (error.message.includes('Invalid API key')) {
      console.error('Please check your API key');
    } else if (error.message.includes('Insufficient credits')) {
      console.error('Please add more credits to your account');
    } else {
      console.error('Analysis failed:', error.message);
    }
    throw error;
  }
}

Use Cases

Educational Content Analysis

  • Textbook Pages: Extract key concepts, formulas, and examples
  • Handwritten Notes: Convert to structured, searchable content
  • Diagrams: Analyze and explain complex diagrams
  • Charts: Extract data and insights from educational charts

Study Material Generation

  • Study Guides: Create comprehensive study materials
  • Quiz Generation: Generate questions from content
  • Summaries: Create concise summaries of long content
  • Flashcards: Generate flashcards from educational material

Learning Assessment

  • Content Understanding: Assess student understanding of material
  • Progress Tracking: Track learning progress over time
  • Personalized Learning: Adapt content to individual needs

Best Practices

Image Preparation

  • Use high-quality images (minimum 300x300 pixels)
  • Ensure good contrast and readability
  • Avoid heavily compressed images
  • Use standard formats (JPEG, PNG)

Prompt Engineering

  • Be specific about what you want analyzed
  • Include context about the subject matter
  • Ask for structured output when needed
  • Use clear, educational language

Rate Limiting

  • Add delays between requests (1-2 seconds)
  • Monitor your credit usage
  • Use batch processing for multiple images
  • Implement retry logic for failed requests

Error Codes

| Error | Description | Solution | |-------|-------------|----------| | 401 | Invalid API key | Check your API key | | 402 | Insufficient credits | Add credits to your account | | 400 | Bad request | Check your request parameters | | 429 | Rate limited | Reduce request frequency | | 500 | Server error | Try again later |

Support