Download the PHP package evoware/ollama-php without Composer
On this page you can find all versions of the php package evoware/ollama-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download evoware/ollama-php
More information about evoware/ollama-php
Files in evoware/ollama-php
Package ollama-php
Short Description A PHP library for interacting with local Ollama server.
License GPL-3.0-or-later
Informations about the package ollama-php
Ollama PHP
A comprehensive PHP library designed for seamless interaction with the Ollama server, facilitating a range of operations from generating text completions to managing models and producing embeddings.
But what's Ollama? Ollama is a tool for running open-source Large Language Models locally. You can find more information about Ollama directly at the project repository or documentation page.
Installation
To integrate the Ollama PHP Adapter into your project, use Composer for a smooth installation process:
Usage:
The Ollama PHP Adapter simplifies the complexity of interacting with the Ollama server, providing intuitive methods for various functionalities.
Generating Text Completions
Generate text completions by providing a prompt to the model. Access the completion text using the getResponse() method:
Interacting with models:
Manage your local models by listing, pulling, and interacting through the provided methods:
To learn more about model file format, please visit Ollama Model File documentation here.
Generating embeddings:
Produce embeddings for a given text, returning an array of embedding data through the EmbeddingsResponse
object:
Response Types
The adapter delineates responses into specific object types for clarity and ease of use:
- CompletionResponse: Handles the data from text completion requests.
- ChatCompletionResponse: Manages chat completion data.
- EmbeddingsResponse: Encapsulates embedding data.
- ModelOperationResponse: Represents the outcome of model operations (create, delete, pull, etc.).
Responses provide access to the underlying Guzzle Response via the getHttpResponse()
method for further customization and handling.
Roadmap
- Handling streaming responses.
- Introduction of ChatSession class for storing chat context in a styructured manner.
- Laravel facade support
Caution
⚠️ Development Stage: This project is in its early development stages and is not recommended for production environments. It is provided as-is, without any guarantees. Proceed with caution and use at your own risk. ⚠️