https://github.com/tredmann/php-llm-client
General Client API to access several LLM APIs (OpenAPI, Ollama, Google Gemini)
https://github.com/tredmann/php-llm-client
Last synced: 4 months ago
JSON representation
General Client API to access several LLM APIs (OpenAPI, Ollama, Google Gemini)
- Host: GitHub
- URL: https://github.com/tredmann/php-llm-client
- Owner: tredmann
- License: mit
- Created: 2025-01-03T14:19:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-24T12:43:27.000Z (over 1 year ago)
- Last Synced: 2025-04-04T10:47:11.399Z (about 1 year ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-llm-client
General Client API to easy access to several LLM APIs (OpenAPI, Ollama, Google Gemini)
## Installation
```shell
composer require tredmann/php-llm-client
```
## Usage
```php
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
* [x] OpenAI (`Type::OpenAI`)
* [x] OpenAI Legacy Completion (`Type::OpenAILegacy`)
* [x] Ollama (`Type::Ollama`)
* [x] Google Gemini (`Type::Gemini`)