tredmann / php-llm-client
v0.3.0
2025-01-24 12:42 UTC
Requires
- php: ^8.3
- google-gemini-php/client: ^1.0
- nyholm/psr7: ^1.8
- openai-php/client: ^0.10.3
- symfony/http-client: ^7.2
- tredmann/php-ollama: ^1.0
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- laravel/pint: ^1.19
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
)