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

@angularai/core

v0.0.3

Published

<div align="center"> <h1>@angularai/core</h1> <p>🧠 Core AI functionality for Angular applications</p>

Downloads

544

Readme

Overview

@angularai/core provides a unified interface for working with multiple AI providers in Angular applications. It serves as the foundation for all AngularAI components, offering a consistent API for interacting with various AI services.

✨ Features

  • πŸ”Œ Multi-provider support: Works with OpenAI, Claude, Gemini, HuggingFace, Ollama, DeepSeek, and more
  • 🌐 Fallback mechanism: Continues to work even without API keys during development
  • πŸ”„ Streaming support: Real-time streaming of AI responses via RxJS Observables
  • πŸ›‘οΈ Type safety: Full TypeScript support with comprehensive type definitions
  • 🧩 Modular design: Use only what you need with tree-shakable exports
  • πŸ”§ Customizable: Configure providers, models, and parameters
  • πŸ“± Angular-native: Built with Angular services, dependency injection, and RxJS

πŸ“¦ Installation

npm install @angularai/core

πŸš€ Quick Start

1. Configure the AI Provider

In your app.config.ts or module:

import { ApplicationConfig } from '@angular/core';
import { provideAIClient, AI_CONFIG } from '@angularai/core';

export const appConfig: ApplicationConfig = {
  providers: [
    provideAIClient({
      provider: 'openai',
      apiKey: 'your-api-key', // Use environment variables in production
      model: 'gpt-4o'
    })
  ]
};

2. Use the AI Client Service

import { Component, inject } from '@angular/core';
import { AIClientService } from '@angularai/core';

@Component({
  selector: 'app-example',
  template: `
    <button (click)="askAI()">Ask AI</button>
    <p>{{ response }}</p>
  `
})
export class ExampleComponent {
  private aiClient = inject(AIClientService);
  response = '';

  askAI() {
    this.aiClient.chat([
      { role: 'user', content: 'Hello, can you help me with Angular?' }
    ]).subscribe({
      next: (response) => this.response = response,
      error: (error) => console.error('Error:', error)
    });
  }
}

πŸ”„ Streaming Responses

import { Component, inject } from '@angular/core';
import { AIClientService } from '@angularai/core';

@Component({
  selector: 'app-streaming',
  template: `
    <button (click)="streamResponse()">Stream Response</button>
    <p>{{ streamedText }}</p>
  `
})
export class StreamingComponent {
  private aiClient = inject(AIClientService);
  streamedText = '';

  streamResponse() {
    this.streamedText = '';

    this.aiClient.chatStream([
      { role: 'user', content: 'Write a short poem about Angular' }
    ]).subscribe({
      next: (token) => this.streamedText += token,
      complete: () => console.log('Stream complete'),
      error: (error) => console.error('Error:', error)
    });
  }
}

πŸ”‘ Supported Providers

| Provider | Models | Status | |----------|--------|--------| | OpenAI | GPT-4o, GPT-4, GPT-3.5-turbo | βœ… Available | | Anthropic | Claude 3.5 Sonnet, Claude 3 Opus | βœ… Available | | Google | Gemini Pro, Gemini Ultra | βœ… Available | | HuggingFace | Open-source models | βœ… Available | | Ollama | Local LLM deployment | βœ… Available | | DeepSeek | DeepSeek models | βœ… Available | | Fallback | Mock responses for development | βœ… Available |

πŸ“– API Reference

AIClientService

@Injectable({ providedIn: 'root' })
export class AIClientService {
  // Send a chat request
  chat(messages: Message[], options?: ChatOptions): Observable<string>;

  // Stream a chat response token by token
  chatStream(messages: Message[], options?: ChatOptions): Observable<string>;

  // Simple ask method for single questions
  ask(prompt: string, options?: ChatOptions): Observable<string>;

  // Configure the AI client
  configure(config: AIConfig): void;
}

Configuration Options

interface AIConfig {
  provider: 'openai' | 'claude' | 'gemini' | 'huggingface' | 'ollama' | 'deepseek' | 'fallback';
  apiKey?: string;
  model?: string;
  baseUrl?: string;
  organizationId?: string;
  temperature?: number;
  maxTokens?: number;
}

Message Interface

interface Message {
  role: 'system' | 'user' | 'assistant';
  content: string;
}

πŸ”§ Advanced Configuration

Runtime Configuration

import { Component, inject } from '@angular/core';
import { AIClientService } from '@angularai/core';

@Component({ ... })
export class ConfigComponent {
  private aiClient = inject(AIClientService);

  switchToClaudeAI() {
    this.aiClient.configure({
      provider: 'claude',
      apiKey: 'your-anthropic-key',
      model: 'claude-3-sonnet-20240229'
    });
  }
}

Using with Environment Variables

// environment.ts
export const environment = {
  openaiApiKey: 'your-api-key'
};

// app.config.ts
import { environment } from './environments/environment';

export const appConfig: ApplicationConfig = {
  providers: [
    provideAIClient({
      provider: 'openai',
      apiKey: environment.openaiApiKey
    })
  ]
};

πŸ“¦ Related Packages

Explore the complete @angularai ecosystem:

| Package | Description | |---------|-------------| | @angularai/chatbot | AI-powered chat components | | @angularai/autosuggest | Smart AI suggestions | | @angularai/smartform | AI form validation | | @angularai/analytics | AI-powered analytics | | @angularai/image-caption | AI image captioning | | @angularai/emotion-ui | Emotion-aware UI | | @angularai/doc-intelligence | Document processing | | @angularai/predictive-input | Predictive text input | | @angularai/smart-notify | Smart notifications | | @angularai/voice-actions | Voice commands | | @angularai/smart-datatable | AI data tables | | @angularai/spin-360 | 360Β° product viewer with AI generation |

πŸ”— Related Projects

| Framework | Repository | Status | |-----------|-----------|--------| | Vue.js | @aivue | βœ… Available | | React | @anthropic-ai/react | βœ… Available | | Angular | @angularai | βœ… Available | | Svelte | @svelteai | πŸ’‘ Planned |

πŸ“„ License

MIT Β© AngularAI