Download the PHP package displace/ai-contracts without Composer

On this page you can find all versions of the php package displace/ai-contracts. 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 ai-contracts

ai-contracts

Stable PHP interfaces for local-first AI primitives.
Embeddings, generation, vector search, reranking, transcription — zero dependencies, zero implementations.

CI Packagist PHP 8.3 / 8.4 / 8.5 Zero dependencies


What is ai-contracts?

Five interfaces under Displace\AI\Contracts that describe what AI primitives do, without saying how:

Interface Contract
Embedder text in → packed float32 vector out
VectorIndex id-addressed similarity search with allowlist filtering
Generator prompt in → completion out
Reranker query + candidates → best-first relevance scores
Transcriber audio file in → transcript + timestamped segments

The package contains no implementations and no dependencies — it is the integration surface between things that provide AI primitives (ext-infer, ext-turbovec, hosted APIs, anything else) and things that consume them (LLPhant, NeuronAI, Prism, your application). Frameworks ship the drivers; applications code against the interfaces; providers can be swapped without touching either.

The packed-vector contract

Every vector crossing these interfaces is a packed little-endian float32 binary string — the output of pack('g*', ...$floats) — never a PHP float array. Arrays inflate every coordinate into a zval; packed strings are a single contiguous buffer that moves through FFI and extension boundaries with zero per-element overhead, and batches compose by plain string concatenation:

Nothing above names a concrete engine. Wire in a llama.cpp-backed embedder and an in-process quantized index today, swap either side tomorrow.

Writing an adapter

Implementations are intentionally easy to write — here is a complete Embedder over ext-infer:

The test suite ships in-memory reference fakes (tests/Fake/) that double as executable documentation of each contract's semantics — the InMemoryVectorIndex is a brute-force oracle you can test your own adapter against.

Versioning

Interfaces are forever-contracts: methods are never removed or re-signatured within a major version, and new methods only arrive with a major bump (an interface addition is a BC break for every implementor). Pre-1.0, minor versions may still adjust the surface — pin accordingly.

Deliberately out of scope

Implementations (this package never gains a class) · an orchestration framework — chains, agents, pipelines, prompt templates belong to the frameworks integrating these contracts · chat-message abstractions — every framework already has one; Generator is the lowest common denominator they adapt down to · streaming interfaces — premature until the underlying local engines ship streaming · training / fine-tuning.

License

MIT © 2026 Eric Mann / Displace Technologies


All versions of ai-contracts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 displace/ai-contracts contains the following files

Loading the files please wait ...