inspector-apm / neuron-ai
PHP AI Framework with built-in observability.
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0
- psr/log: ^1.0|^2.0|^3.0
Requires (Dev)
- elasticsearch/elasticsearch: ^7.0|^8.0
- phpunit/phpunit: ^9.0
- symfony/process: ^4.0|^5.0|^6.0|^7.0
Suggests
- elasticsearch/elasticsearch: ^7.0|^8.0
- inspector-apm/inspector-php: ^3.9
- symfony/process: ^4.0|^5.0|^6.0|^7.0
This package is auto-updated.
Last update: 2025-03-17 22:19:49 UTC
README
Before moving on, support the community giving a GitHub star ⭐️. Thank you!
Requirements
- PHP: ^8.0
Install
Install the latest version of the package:
composer require inspector-apm/neuron-ai
Create an Agent
Neuron provides you with the Agent class you can extend to inherit the main features of the framework,
and create fully functional agents. This class automatically manages some advanced mechanisms for you such as memory,
tools and function calls, up to the RAG systems. You can go deeper into these aspects in the documentation.
In the meantime, let's create the first agent, extending the NeuronAI\Agent
class:
use NeuronAI\Agent; use NeuronAI\Providers\AIProviderInterface; use NeuronAI\Providers\Anthropic\Anthropic; class SEOAgent extends Agent { public function provider(): AIProviderInterface { return new Anthropic( key: 'ANTHROPIC_API_KEY', model: 'ANTHROPIC_MODEL', ); } public function instructions() { return "Act as an expert of SEO (Search Engine Optimization). ". "Your role is to analyze a text of an article and provide suggestions ". "on how the content can be improved to get a better rank on Google search."; } }
Talk to the Agent
Send a prompt to the agent to get a response from the underlying LLM:
$seoAgent = SEOAgent::make(); $response = $seoAgent->run(new UserMessage("Who are you?")); echo $response->getContent(); // I'm a SEO expert, how can I help you today? $response = $seoAgent->run( new UserMessage("What do you think about the following article? --- ".file_get_contents('./README.md')) ); echo $response->getContent(); // It's well done! Anyway, let me give you some advice to get a better rank on Google...
Official documentation
Go to the official documentation
Contributing
We encourage you to contribute to the development of Neuron AI Framework! Please check out the Contribution Guidelines about how to proceed. Join us!
LICENSE
This bundle is licensed under the MIT license.