Blue vs Red

A PHP Library for OpenAI Assistants API

TL;DR – you can find hiddenhatpress/openai-assistants, our quick and dirty Assistants client on Github

The phrase OpenAI Assistants API might seem obscure but it’s also a must-have if you want your AI model to be able to interpret large documents on your behalf, to invoke third party tools and integrate their responses, and to maintain state without you having to save the context locally.

When I heard that this feature was in beta it was almost more interesting to me than the soap opera at OpenAI HQ. But, hey, I can do more than one thing at once. So I cranked up the Hard Fork podcast for the drama and opened a Vim document to try out the API.

Aaaand then I discovered that there wasn’t yet a PHP library for me to play with. That’s not a big problem, of course, the popular libraries will get to it soon enough and, of course, there’s always Python.

Except that I’d like to extend my command line chat client, Shelley – which I wrote about here and already use as a general advisor.

So then my productivity ground to a halt on all other projects while I created this little PHP library. Since there may be other PHP developers out there who might like to play with the Assistants API while it’s still in beta, I thought I’d release it.

The README includes a short worked example to get you started. I will likely release this on Packagist so that I can use it with Shelley. I’ll announce on Mastodon and X when I do that and update this article.

UPDATE: The library is now available on Packagist which means you can use it in your projects via composer:

composer require hiddenhatpress/openai-assistants

The README is updated accordingly. I’ll post again with details of the new Shelley feature once I’ve incorporated assistants support.

Whatever your P(doom), please do enjoy. Again… get it here.

Yes! Please sign me up to this newsletter

Photo by Rodion Kutsaiev on Unsplash