ollama-js  by ollama

JS SDK for Ollama

created 1 year ago
3,560 stars

Top 13.9% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides a JavaScript interface for interacting with the Ollama API, enabling developers to easily integrate large language models into their web and Node.js applications. It simplifies tasks such as chat completion, text generation, model management, and embedding generation, offering a streamlined developer experience for LLM-powered features.

How It Works

The library acts as a client for the Ollama REST API, abstracting away HTTP requests and responses. It exposes methods that map directly to Ollama's functionalities, such as chat, generate, pull, and embed. The design supports both standard responses and streaming via AsyncGenerator, allowing for real-time LLM output. It also offers browser compatibility and customization for the Ollama host and fetch implementation.

Quick Start & Requirements

Highlighted Details

  • Supports chat, generation, model pulling/pushing/creation/deletion/copying, and embedding.
  • Enables streaming responses via AsyncGenerator for real-time interaction.
  • Includes browser-compatible builds for client-side usage.
  • Allows customization of Ollama host and fetch implementation.

Maintenance & Community

Licensing & Compatibility

  • License: MIT
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

The files parameter for model creation is not currently supported. The abort method throws an AbortError on all listening streams, suggesting careful stream management or dedicated client instances per stream.

Health Check
Last commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
3
Issues (30d)
7
Star History
258 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.