AI Platform

Overview

Explore the AxilJS AI platform for TypeScript and Node.js applications, including LLM provider abstraction, streaming, embeddings, vector search, RAG pipelines, AI agents, and MCP tool integration.

4 min readDocumentationEdit this page

AxilJS AI Platform Overview

The AxilJS AI platform provides a unified foundation for building AI applications with TypeScript and Node.js.

It brings together LLM provider abstraction, streaming, embeddings, vector search, retrieval-augmented generation (RAG), AI agents, and Model Context Protocol (MCP) integration under the @axiljs/ai package.

The provider abstraction lets applications work with different AI providers while keeping application-level AI code consistent.

What Is Included

AxilJS AI includes the following capabilities:

  • Provider abstraction — Connect to OpenAI, Anthropic, Gemini, and Ollama through a unified interface.
  • Streaming — Process AI responses token-by-token using streaming and SSE.
  • Embeddings — Convert text into numerical vectors for semantic search and retrieval workflows.
  • Vector store — Store and retrieve vectors for semantic search.
  • RAG pipeline — Index documents and query relevant information for AI applications.
  • Agents — Build ReAct-style AI agents that can reason and use tools.
  • MCP client — Connect AI applications and agents to external tools through Model Context Protocol.

These capabilities can be used independently or combined to build more advanced AI workflows.

Quick Example

The @axiljs/ai package provides a common interface for interacting with supported AI providers.

For example, you can use the Ollama provider with a local model:

typescript
import { OllamaProvider } from '@axiljs/ai'
 
const ai = new OllamaProvider({
  model: 'llama3.2'
})
 
const res = await ai.complete({
  messages: [
    {
      role: 'user',
      content: 'What is AxilJS?'
    }
  ]
})
 
console.log(res.content)

The same completion interface can be used across the supported provider implementations.

Switch LLM Providers

AxilJS separates application-level AI logic from the underlying LLM provider.

This means you can switch providers without rewriting the application code that consumes the AI interface.

text
Application
     │
     ▼
@axiljs/ai
     │
     ▼
Provider Abstraction
     │
 ┌───┼───────────┬──────────┐
 ▼   ▼           ▼          ▼
OpenAI Anthropic Gemini   Ollama

Provider selection can be changed through environment configuration, allowing the underlying model provider to change without requiring changes to the application-level AI logic.

AI Platform Architecture

The main AxilJS AI capabilities can be viewed as layers:

text
                    AxilJS AI
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼              ▼
    Providers      AI Runtime       Tools
        │              │              │
        ▼              ▼              ▼
   LLM Models      Streaming       Agents
                       │              │
                       ▼              ▼
                  Embeddings        MCP
                       │
                       ▼
                 Vector Store
                       │
                       ▼
                      RAG

Each capability addresses a different part of an AI application:

  • Providers handle access to LLMs.
  • Streaming handles incremental AI responses.
  • Embeddings convert text into vectors.
  • Vector stores support semantic retrieval.
  • RAG combines retrieval with AI generation.
  • Agents combine model reasoning with executable tools.
  • MCP provides an interface for integrating external tools.

Build AI Applications with AxilJS

The platform can be used for different levels of AI application complexity.

For a basic AI application, start with a provider and complete():

typescript
const res = await ai.complete({
  messages: [
    {
      role: 'user',
      content: 'What is AxilJS?'
    }
  ]
})

For applications that need semantic retrieval, use embeddings and the RAG capabilities.

For applications that need autonomous multi-step tool execution, use Agents.

For applications that need external tool integration, use the MCP client.

Common Use Cases

AxilJS AI capabilities can be combined to build applications such as:

  • AI chat applications
  • AI assistants
  • Semantic search systems
  • Retrieval-augmented generation applications
  • Document question-answering systems
  • Tool-enabled AI agents
  • Multi-step AI workflows
  • Applications using local LLMs
  • Applications integrating external MCP tools

Explore the AI Platform

Start with Providers to understand the LLM provider abstraction.

Then explore Embeddings and RAG for retrieval-based AI applications.

For tool-enabled AI workflows, see Agents and MCP.

Tip

Start with Providers, then explore RAG and Agents.

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY