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

@agenite/ollama

v0.5.0

Published

Ollama provider for Agenite

Readme

@agenite/ollama

Ollama provider for Agenite, enabling seamless integration with local Ollama models.

Features

  • 🚀 Support for all Ollama models (Llama 2, CodeLlama, Mistral, etc.)
  • 🛠️ Function/tool calling support
  • 🖼️ Image input support (with multimodal models)
  • 📝 Rich content types (text, images, tool calls)
  • 🔄 Streaming responses
  • ⚙️ Extensive model parameter controls

Installation

npm install @agenite/ollama

Make sure you have Ollama installed and running locally.

Usage

Basic Chat

import { OllamaProvider } from '@agenite/ollama';

const provider = new OllamaProvider({
  model: 'llama2',
  host: 'http://localhost:11434',
  temperature: 0.7,
});

const messages = [
  {
    role: 'user',
    content: [{ type: 'text', text: 'What are the main features of Llama 2?' }],
  },
];

const response = await provider.generate({ messages });
console.log(response.content[0].text);

Tool Usage

const calculatorTool = {
  name: 'calculator',
  description: 'Performs basic arithmetic operations',
  parameters: {
    type: 'object',
    properties: {
      operation: {
        type: 'string',
        enum: ['add', 'subtract', 'multiply', 'divide'],
      },
      a: { type: 'number' },
      b: { type: 'number' },
    },
    required: ['operation', 'a', 'b'],
  },
};

const response = await provider.generate({
  messages: [
    {
      role: 'user',
      content: [{ type: 'text', text: 'What is 123 multiplied by 456?' }],
    },
  ],
  tools: [calculatorTool],
});

Image Input

const provider = new OllamaProvider({
  model: 'llava',
  host: 'http://localhost:11434',
});

const response = await provider.generate({
  messages: [
    {
      role: 'user',
      content: [
        {
          type: 'image',
          source: {
            type: 'base64',
            media_type: 'image/jpeg',
            data: imageBase64,
          },
        },
        { type: 'text', text: 'What do you see in this image?' },
      ],
    },
  ],
});

Configuration

The provider accepts the following configuration options:

interface OllamaConfig {
  model: string;           // Model name (e.g., 'llama2', 'codellama')
  host?: string;          // Ollama server URL (default: http://localhost:11434)
  temperature?: number;   // Generation temperature (0-1)
  maxTokens?: number;    // Maximum tokens to generate
  systemPrompt?: string; // System prompt for all conversations
  parameters?: {         // Additional model parameters
    mirostat?: number;
    num_ctx?: number;
    num_gpu?: number;
    // ... and more
  };
}

Examples

Check out the examples directory for more detailed examples:

  • basic-chat.ts: Simple text conversation
  • tool-usage.ts: Calculator tool implementation
  • image-input.ts: Image analysis with multimodal models

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run examples
npx ts-node examples/basic-chat.ts

License

MIT