ollama-laravel  by cloudstudio

Laravel package for Ollama API integration

created 1 year ago
417 stars

Top 71.3% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This package provides a Laravel integration for the Ollama API, enabling developers to easily incorporate large language model capabilities into their web applications. It offers functionalities for model management, prompt engineering, and structured output, simplifying the process of leveraging LLMs within the Laravel ecosystem.

How It Works

The package acts as a fluent wrapper around the Ollama REST API, abstracting away direct HTTP requests. It utilizes Laravel's Facade pattern for convenient access and provides a chainable API for constructing prompts, specifying models, setting generation options (like temperature), and handling both standard responses and streaming outputs. Vision and tool-calling capabilities are also supported through dedicated methods.

Quick Start & Requirements

  • Install via Composer: composer require cloudstudio/ollama-laravel
  • Requires a running Ollama instance.
  • Configuration is managed via a published config file (php artisan vendor:publish --tag="ollama-laravel-config").
  • Official documentation and examples are available within the README.

Highlighted Details

  • Supports text generation, image-to-text (vision), chat completions, and function calling (tools).
  • Enables streaming responses for interactive applications.
  • Provides utilities for managing Ollama models (show, copy, delete) and generating embeddings.
  • Offers a configurable connection timeout for the Ollama API.

Maintenance & Community

  • Developed by Toni Soriano.
  • Contributions are welcomed, with guidelines provided in the README.
  • Testing is done using Pest.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Compatible with Laravel 10.x (specific version V1.0.9 recommended).
  • Permissive MIT license allows for commercial use and integration into closed-source applications.

Limitations & Caveats

The package relies on an external Ollama service; therefore, its functionality is dependent on the availability and configuration of a local or remote Ollama instance. Specific version compatibility notes are provided for older Laravel versions.

Health Check
Last commit

1 week ago

Responsiveness

1 week

Pull Requests (30d)
1
Issues (30d)
0
Star History
25 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.