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

ubc-genai-toolkit-core

v0.1.0

Published

Core module for the UBC GenAI Toolkit, providing common interfaces and utilities.

Readme

UBC GenAI Toolkit - Core Module

The ubc-genai-toolkit-core package is the foundational library for the UBC GenAI Toolkit. It provides a set of common interfaces, error handling patterns, and configuration standards that are shared across all other modules in the toolkit.

This module ensures that different components of the toolkit work together seamlessly and provides a consistent development experience for anyone building on top of them.

Installation

You can install the core module from npm:

npm install ubc-genai-toolkit-core

Core Concepts

This module exports several key interfaces that establish the common patterns used throughout the UBC GenAI Toolkit. Other toolkit modules will expect implementations of these interfaces for functionalities like logging and configuration.

Configuration (ModuleConfig)

The ModuleConfig interface defines a standard structure for passing configuration to any toolkit module.

// From: src/config.ts
export interface ModuleConfig {
	logger?: LoggerInterface;
	debug?: boolean;
	[key: string]: any;
}
  • logger: An optional logger instance that conforms to the LoggerInterface.
  • debug: An optional boolean flag to enable or disable debug mode.
  • Module-specific options can be added as additional properties.

Logging (LoggerInterface)

The LoggerInterface provides a standardized way for modules to handle logging, allowing consuming applications to integrate their own logging solutions.

// From: src/logger.ts
export interface LoggerInterface {
	debug(message: string, metadata?: object): void;
	info(message: string, metadata?: object): void;
	warn(message: string, metadata?: object): void;
	error(message: string, metadata?: object): void;
}

If no logger is provided to a module's configuration, a minimal ConsoleLogger (also exported from this module) will be used by default.

Error Handling (ToolkitError)

The ToolkitError class provides a consistent structure for errors thrown by any module in the toolkit. This makes it easier for applications to handle errors reliably.

// From: src/error.ts
export class ToolkitError extends Error {
	public readonly code: number;
	public readonly details?: any;
	public readonly timestamp: string;

	constructor(message: string, code = 500, details?: any) {
		super(message);
		this.name = 'ToolkitError';
		this.code = code;
		this.details = details;
		this.timestamp = new Date().toISOString();
	}
}
  • message: A human-readable error message.
  • code: A numeric error code (often corresponding to an HTTP status code).
  • details: Any additional data that might be useful for debugging.
  • timestamp: An ISO string representing when the error occurred.

Specialized error classes like ConfigurationError and APIError are also available for more specific scenarios.

Usage

This module is primarily a dependency for other ubc-genai-toolkit-* packages. You typically won't interact with it directly, but you will use the interfaces it provides when configuring other modules.

For example, when setting up the ubc-genai-toolkit-llm module, you might pass a configuration object that uses interfaces from this core package:

import { LLMModule, LLMConfig } from 'ubc-genai-toolkit-llm';
import { ConsoleLogger } from 'ubc-genai-toolkit-core'; // From this package

const config: LLMConfig = {
	provider: 'openai',
	apiKey: 'YOUR_API_KEY',
	defaultModel: 'gpt-4o',
	logger: new ConsoleLogger(), // Using the logger from core
	debug: true,
};

const llmModule = new LLMModule(config);