Download the PHP package caiquebispo/ai-agents-php without Composer

On this page you can find all versions of the php package caiquebispo/ai-agents-php. 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-php

🔧 Setup

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Installation

Install the package via Composer:

Prerequisites

Make sure you have the phpdotenv package installed. You can install it via Composer:

In your laravel application you do not need to install the vlucas/phpdotenv package.

Configuring the .env file

In the root of your project, create a file named .env with the following variables:

In Code

🤖 Creating a new agent

To create a new agent, you must extend the BaseAgent class and define any additional functionality.

NOTE: If you want 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 in AgentTraits to add specific functionalities that you may need.

This is an example of an agent that can send text messages, perform calculations.

This is the total code needed to create an agent.

Defining an agent function

To define an agent function, you must follow the PHP DocBlock to describe the parameters, return type, and method.

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

Example of the add function:

🧰 Agent Traits

Agent Traits can be used to add functionalities to an agent. Some are included in this package under the AgentTraits namespace.

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

It is highly recommended that you place reusable functions in a trait and then add that trait to your agent.

📝 Chat Models

Currently Supported

Adding a new chat model

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

❤️ Contributing

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

Pull requests are also welcome!

See our contribution guide


All versions of ai-agents-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
openai-php/client Version ^v0.10.3.0
guzzlehttp/guzzle Version ^7.8
yethee/tiktoken Version ^0.5.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 caiquebispo/ai-agents-php contains the following files

Loading the files please wait ....