PHPackages                             php-graph/inference - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. php-graph/inference

ActiveLibrary[API Development](/categories/api)

php-graph/inference
===================

Inference with LLM providers

1.0.0(11mo ago)04MITPHPPHP &gt;=8.3

Since Jun 10Pushed 11mo agoCompare

[ Source](https://github.com/phpgraph/inference)[ Packagist](https://packagist.org/packages/php-graph/inference)[ Docs](https://phpgraph.io)[ RSS](/packages/php-graph-inference/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

[![phpGraph Banner.](/static/banner.png)](/static/banner.png)

Inference
=========

[](#inference)

This project is a PHP component designed to simplify the integration and usage of Large Language Models (LLMs) from various providers, including Ollama, OpenAI, Mistral, DeepSeek, and more. It offers a unified interface for:

- Interacting with chat models (standard completions, streaming, etc.)
- Generating vector embeddings
- Managing multi-provider compatibility without altering your application logic

The goal is to provide a simple, extensible, and developer-oriented abstraction for AI inference, enabling optimal performance and rapid integration into your PHP projects.

Get Started
-----------

[](#get-started)

First, install phpGraph Inference via the [Composer](https://getcomposer.org/) package manager:

```
composer require php-graph/inference
```

Usages
------

[](#usages)

### Ollama

[](#ollama)

#### Chat

[](#chat)

> The following example demonstrates how to use Ollama as a local LLM provider for a standard chat interaction. You instantiate a resource, build your message history, and get the assistant's response.

```
