AI Provider
Interact with LLM providers or extend the framework to implement new ones.
Anthropic
namespace App\Neuron;
use NeuronAI\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Anthropic\Anthropic;
use NeuronAI\Providers\HttpClientOptions;
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Anthropic(
key: 'ANTHROPIC_API_KEY',
model: 'ANTHROPIC_MODEL',
parameters: [], // Add custom params (temperature, logprobs, etc)
httpOptions: new HttpClientOptions(timeout: 30),
);
}
}
echo MyAgent::make()->chat(new UserMessage("Hi!"));
// Hi, how can I help you today?OpenAI
AzureOpenAI
OpenAILike
Ollama
Gemini
Mistral
HuggingFace
Deepseek
Grok (X-AI)
AWS Bedrock Runtime
Custom Http Options
Implement a custom provider
Last updated