Closed ddebowczyk closed 7 months ago
Hmmm, this might not be trivial, (well to be fair, it probably is fairly trivial, I just have to spend a lot of time figuring out and failing along the way).
@ddebowczyk For context, are you rolling vanilla PHP, wordpress, cake, yii or some symfony-flavor?
Vanilla PHP
Frankly, Saloon has everything thats needed. Laravel stuff could be made an optional plugin.
I've been also thinking on a general client as APIs between Mistral, Anthropic, OpenAI, OpenRouter are so similar that if base client code gives up interacting via classes and accepts arrays as inputs and outputs a single client could be used to interact with all of those APIs. This is not ideal if you want to interact with them manually, but there could be an optional, extra layer which provides those dev friendly translations to object / class based calls. This might be too big change for your library, if so I'm thinking of some quick poc to see how this could work. Ultimately, nobody wants to use 4 different clients to talk to several llms, so i see value in having more flexible client which has minimum dependecies and can be used across various providers with extra typing required to provide all relevant options to call vendor specific options then to consume vendor specific responses. My use case is php port of instructor by Jason Liu.
I've built the integrations with OpenAI, Anthropic, Mistral, OpenRouter, Azure from the scratch using SaloonPHP. This makes my problem solved, so I'm closing the issue.
Ill see if i can make the laravel related stuff suggested in the composer file, gimme a few hours.