PHP code example of tredmann / php-llm-client

1. Go to this page and download the library: Download tredmann/php-llm-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tredmann / php-llm-client example snippets


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**.
shell
composer