Download the PHP package mzarnecki/php-llm-evaluation without Composer

On this page you can find all versions of the php package mzarnecki/php-llm-evaluation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-llm-evaluation

PHP LLM EVALUATION

This package is a collection of tools that represent different strategies for evaluating LLM responses.

Table of Contents

  1. Overview
  2. Installation
  3. Usage
  4. Features
  5. Prerequisites
  6. Resources
  7. Contributing

🎯 Overview

Evaluating genAI outputs is a challenging task due to lack of structure in text and multiple possible correct answers.
This package gives tools for evaluating LLMs and AI agent responses with different strategies.

🚀 Features

There are 3 major strategies included for evaluating LLM responses:

String comparison

There are 2 string comparison metrics implemented which compare generated answer to expected text. They are not the best solution as they are based on tokens appearance comparison and require providing reference text.

Trajectory evaluator

Trajectory evaluator cores how closely a language-model-generated answer follows an intended reasoning path (the “trajectory”) rather than judging only the final text. It compares each intermediate step of the model’s output against a reference chain-of-thought, computing metrics such as step-level ROUGE overlap, accumulated divergence, and error propagation. This lets you quantify whether an LLM is merely reaching the right conclusion or genuinely reasoning in the desired way—ideal for debugging, fine-tuning, and safety audits where process integrity matters as much as the end result.

Criteria evaluator

Criteria evaluator passes prompt and generated answer to GPT-4o or Claude model and ask for 1-5 points evaluation in criteria:

📋 Prerequisites

🛠️ Installation

  1. Install Dependencies

💻 Usage

String comparison evaluation example

See this example also in string_comparison.php

Results:

Trajectory evaluation example

See this example also in trajectory.php

Results:

Criteria evaluation example

Before using criteria evaluator create .env file in main package directory and add there your OpenAI API key or Antrophic API key. \ See .env-sample

See this example also in criteria.php

Results:

📚 Resources

📖 For a detailed explanation of concepts used in this application, check out my article on medium.com linked below:\ Evaluating LLM and AI agents Outputs with String Comparison, Criteria & Trajectory Approaches

👥 Contributing

Found a bug or have an improvement in mind? Please:

Your contributions make this project better for everyone!


All versions of php-llm-evaluation with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
guzzlehttp/guzzle Version ^7.8
vlucas/phpdotenv Version ^5.6
openai-php/client Version ^0.12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mzarnecki/php-llm-evaluation contains the following files

Loading the files please wait ...