Skip to content

1.17.3

Choose a tag to compare

@ilvalerione ilvalerione released this 26 Aug 16:08
· 14 commits to 1.x since this release

OpenAILike Provider

Easily connect with providers offering the same data format of the official OpenAI API, without implementing custom class in your application.

namespace App\Neuron;

use NeuronAI\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\HttpClientOptions;
use NeuronAI\Providers\OpenAILike;

class MyAgent extends Agent
{
    public function provider(): AIProviderInterface
    {
        return new OpenAILike(
            baseUri: 'https://api.together.xyz/v1',
            key: 'API_KEY',
            model: 'MODEL',
        );
    }
}

echo MyAgent::make()->chat(new UserMessage("Hi!"));
// Hi, how can I help you today?

Check out the documentaiton.