Neuron AI
GitHubForumNewsletter
  • Getting Started
    • Introduction
  • Key Concepts
  • Installation
  • Agent
  • Tools & Function Calls
  • Streaming
  • RAG
  • Attachments (Documents & Images)
  • Advanced
    • Structured Output
    • Logging & Observability
    • MCP Connector
    • Error Handling
  • Post Processor
  • Asynchronous Processing
  • Components
    • AI provider
    • Chat History & Memory
    • Embeddings Provider
    • Vector Store
    • Data loader
  • Examples
    • YouTube Agent
Powered by GitBook
On this page
  • Requirements
  • Install
  • Create an Agent
  • Talk to the Agent

Installation

Step by step instructions on how to install Neuron AI in your application.

Requirements

  • PHP: ^8.1

Install

Run the composer command below to install the latest version:

composer require inspector-apm/neuron-ai

Create an Agent

You can easily create your first agent extending the NeuronAI\Agent class:

namespace App\Neuron;

use NeuronAI\Agent;
use NeuronAI\Providers\Anthropic\Anthropic;

class MyAgent extends Agent
{
    protected function provider(): AIProviderInterface
    {
        // return an AI provider (Anthropic, OpenAI, Ollama, Gemini, etc.)
        return new Anthropic(
            key: 'ANTHROPIC_API_KEY',
            model: 'ANTHROPIC_MODEL',
        );
    }
}

Talk to the Agent

Send a prompt to the agent to get a response from the underlying LLM:

use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Observability\AgentMonitoring;

// The Inspector instance in your application - https://inspector.dev/
$inspector = new \Inspector\Inspector(
    new \Inspector\Configuration('INSPECTOR_INGESTION_KEY')
);

$response = MyAgent::make($user)    
    ->observe(new AgentMonitoring($inspector))
    ->chat(
        new UserMessage("Hi, I'm Valerio")
    );
    
echo $response->getContent();

// Nice to meet you Valerio, how can I help you today?
PreviousKey ConceptsNextAgent

Last updated 5 days ago