tredmann/php-llm-client

v0.3.0 2025-01-24 12:42 UTC

This package is auto-updated.

Last update: 2025-04-24 13:18:42 UTC


README

General Client API to easy access to several LLM APIs (OpenAPI, Ollama, Google Gemini)

Installation

composer require tredmann/php-llm-client

Usage

use LLM\Enums\Type;
use LLM\LLM;

$llm = LLM::make(Type::Ollama);

echo $llm->completion(
    model: 'gemma2:latest',
    prompt: 'What is the capital of Germany?',
    temperature: 1.0
);

// Output: The capital of Germany is **Berlin**.

Supported Providers/LLMs

  • OpenAI (Type::OpenAI)
  • OpenAI Legacy Completion (Type::OpenAILegacy)
  • Ollama (Type::Ollama)
  • Google Gemini (Type::Gemini)