Download the PHP package adrenallen/ai-agents-laravel without Composer

On this page you can find all versions of the php package adrenallen/ai-agents-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ai-agents-laravel

AI Agents for Laravel

Latest Stable Version Latest Unstable Version License PHP Version Require

Building with AI shouldn't be difficult, and AI Agents does its best to make it easy to build with AI inside of Laravel.

✍️ Spend more time writing code you care about, just provide comments and let the system take care of the rest!

📦 Agents are highly composable . Simply include the trait you need to give your AI the right capabilities for the job.

🔧 Need custom functionality or have an idea for a new AgentTrait? Create your own! Just follow the comment structure and the system will do the rest to ensure the AI understand and can use your functions!

🚀 Create a new AI Agent in <20 lines of code!

Table of Contents

🔧 Setup

Install via composer

composer require adrenallen/ai-agents-laravel

You will need to publish the configuration files and fill out details based on the features you wish to use. You can publish the config files by running the following command:

php artisan vendor:publish --provider="Adrenallen\AiAgentsLaravel\AiAgentsLaravelServiceProvider"

👨‍💻 Usage

In Console/Testing

You can test chatting with an agent directly by using the provided artisan command

php artisan ai:chat <Agent Class>

For example, to chat with the included TestingAgent

php artisan ai:chat TestingAgent

You can type exit to exit the chat.

In Code

🤖 Creating a new agent

To create a new agent you will want to extend the BaseAgent class and define any additional functionality.

NOTE: If you want to require your agent to always call a function, you can extend the FunctionsAgent instead!

The prePrompt property is the pre-prompt that is passed to the chat model. This should describe how you want the agent to think and act.

You can use traits under AgentTraits to pull in specific functionality you may need.

i.e. if you want your agent to be able to send text messages, you could pull in the SMSTrait on your agent class. The bot will automatically know it is able to send text messages.

This is an example of an agent that can send text messages, do math, and get the weather.

This is the total code required to create an agent.

Defining an agent function

To define an agent function, you should follow php DocBlock to describe the params, return type, and method.

For the agent to have access to the function, you must include an additional PHPDoc block param called @aiagent-description. This must be a string that describes the function. Any functions that include that property in the agent's class will automatically be made available to the agent.

Example of the add function:

🧰 Agent Traits

Agent Traits can be used to plug and play functionality for an agent. Some are included in this package under the AgentTraits namespace.

DateTrait - Provides access to date functions (i.e. compareDates or getCurrentDate)

MathTrait - Provides access to math functions (i.e. add or subtract)

SMSTrait - Provides access to send SMS messages via Twilio (i.e. sendSMS)

WeatherTrait - Provides access to weather functions (i.e. getWeather)

GeocodingTrait - Provides access to geocoding functions (i.e. getLatLongOfLocation)

It is highly encouraged that you place re-usable functions in a trait, and then pull that trait into your agent.

📝 Chat Models

Currently Supported

Adding a new chat model

New models can be added by extending AbstractChatModel. This class provides the basic functionality required to interact with the chat model.

❤️ Contributing

Opening new issues is encouraged if you have any questions, issues, or ideas.

Pull requests are also welcome!

See our contribution guide


All versions of ai-agents-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
openai-php/client Version >=0.8.0
twilio/sdk Version ^7.5
guzzlehttp/guzzle Version ^7.8
yethee/tiktoken Version ^0.5.0
illuminate/support Version ^10.40 || ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package adrenallen/ai-agents-laravel contains the following files

Loading the files please wait ....