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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@exceleratedk/recommender-api-client

v1.2.3

Published

Client for the Recommender System API

Readme

recommender-api-client

A modern TypeScript/JavaScript client for the internal Recommender System API.


🚀 Installation

npm install @exceleratedk/recommender-api-client

📦 Usage

import { RecommenderAPI } from 'recommender-api-client';

const api = new RecommenderAPI({
  baseURL: 'http://localhost:8000',
  token: 'YOUR_API_TOKEN',
});

// Get job recommendations for a candidate
const jobResponse = await api.getJobRecommendations({ candidateId: 'candidate123' });
console.log('Job recommendations:', jobResponse.recommendations);
console.log('Suggestions:', jobResponse.suggestions);

// Get candidate recommendations for a job
const candidateResponse = await api.getCandidateRecommendations({ jobId: 'job456', limit: 10 });
console.log('Candidate recommendations:', candidateResponse.recommendations);
console.log('Suggestions:', candidateResponse.suggestions);

🛠️ API Reference

new RecommenderAPI(config)

  • config ({ baseURL: string; token: string; }):
    • baseURL: The base URL of the API (e.g., 'http://localhost:8000')
    • token: Bearer token for authentication

getJobRecommendations(config): Promise<RecommenderResponse>

  • config ({ candidateId: string; limit?: number; }):
    • candidateId: The candidate's unique ID (required)
    • limit: Number of recommendations to return (default: 5)
  • Returns: Promise<RecommenderResponse> with recommendations and suggestions

getCandidateRecommendations(config): Promise<RecommenderResponse>

  • config ({ jobId: string; limit?: number; }):
    • jobId: The job's unique ID (required)
    • limit: Number of recommendations to return (default: 5)
  • Returns: Promise<RecommenderResponse> with recommendations and suggestions

📋 Types

Response Structure

export interface RecommenderResponse {
  recommendations: JobRecommendation[] | CandidateRecommendation[];
  suggestions: string[];
}

Core Recommendation Types

export interface JobRecommendation {
  jobId: string;
  score?: number;
  explanation?: RecommendationExplanation;
}

export interface CandidateRecommendation {
  candidateId: string;
  score?: number;
  explanation?: RecommendationExplanation;
}

Explanation Types

export interface ExplanationFactor {
  factor_type: string;        // e.g., "skill_match", "industry_match", "interest_match"
  factor_name: string;        // e.g., "Python", "Technology", "Machine Learning"
  factor_value: number;       // Contribution score
  factor_description: string; // Human-readable description
  factor_weight: number;      // Weight of the factor
}

export interface RecommendationExplanation {
  recommendation_id: string;           // ID of the recommended item
  explanation_type: string;            // Type of explanation
  factors: ExplanationFactor[];        // Contributing factors
  total_score: number;                 // Overall recommendation score
  explanation_summary: string;         // Human-readable summary
  missing_features: Record<string, any>[]; // Enhanced missing features analysis
}

Configuration Types

export interface RecommenderAPIConfig {
  baseURL: string;
  token: string;
}

export interface JobRecommendationConfig {
  candidateId: string;
  limit?: number;
}

export interface CandidateRecommendationConfig {
  jobId: string;
  limit?: number;
}

🔍 Working with Responses

The API now returns complete responses with both recommendations and suggestions. Here's how to work with them:

// Get job recommendations with explanations and suggestions
const jobResponse = await api.getJobRecommendations({ 
  candidateId: 'candidate123',
  limit: 3 
});

// Access recommendations
jobResponse.recommendations.forEach(recommendation => {
  console.log(`Job: ${recommendation.jobId}, Score: ${recommendation.score}`);
  
  if (recommendation.explanation) {
    console.log(`Summary: ${recommendation.explanation.explanation_summary}`);
    console.log(`Total Score: ${recommendation.explanation.total_score}`);
    
    // List contributing factors
    recommendation.explanation.factors.forEach(factor => {
      console.log(`- ${factor.factor_name}: ${factor.factor_description} (${factor.factor_value})`);
    });
  }
});

// Access suggestions for improvement
console.log('Suggestions:', jobResponse.suggestions);

Example Response Output

{
  recommendations: [
    {
      jobId: "job_123",
      score: 6.03,
      explanation: {
        recommendation_id: "job_123",
        explanation_type: "path_based",
        total_score: 6.03,
        explanation_summary: "Strong match based on: Core Interest Match (1.0), Core Skill Match (1.0), Content Similarity (0.2)",
        factors: [
          {
            factor_type: "interests_core_positive",
            factor_name: "Core Interest Match",
            factor_value: 1,
            factor_description: "Essential interest requirements that align (strength: 1.0, impact: 37.10)",
            factor_weight: 37.1
          },
          {
            factor_type: "skills_core_positive",
            factor_name: "Core Skill Match",
            factor_value: 1,
            factor_description: "Essential skill requirements that align (strength: 1.0, impact: 6.31)",
            factor_weight: 6.31
          }
        ],
        missing_features: []
      }
    }
  ],
  suggestions: [
    "Add more interests to your profile to improve job matching. Include both professional and personal interests."
  ]
}

🧪 Running Tests

npm test