Download the PHP package ai-agent/ai-agent without Composer

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

AI Agent Provider

A Laravel package for integrating with various AI providers including OpenAI, Anthropic and Google's Gemini.

Laravel License PHP

Features

Table of Contents

Installation

You can install the package via composer:

Publish the configuration file:

Publish migrations (optional):

Run migrations to create the AI interactions table:

Configuration

Configure your AI providers in the config/ai-agent.php file:

Basic Usage

Text Generation

Chat Completions

Embeddings

Blade Directives

The package provides several Blade directives for easy template integration:

The directives now include a loading indicator that shows while the AI is processing your request, providing better UX for users.

Advanced Usage

Custom Options

Each AI provider supports different options that can be passed to customize the request:

Error Handling

Handle potential errors when working with AI providers:

Logging

Enable or disable logging at runtime:

Rate Limiting

The package includes built-in rate limiting to prevent excessive API usage. You can configure this in the config/ai-agent.php file:

Caching Responses

Cache AI responses to reduce API costs and improve performance:

HTTP API Endpoints

The package provides API endpoints for integration with frontend frameworks:

Get all providers

Response:

Generate text

Request:

Response:

Chat completion

Request:

Generate embeddings

Request:

Extending with Custom Providers

You can create your own adapters to integrate additional AI providers:

  1. Create a new adapter class that extends the BaseAdapter:

  2. Register your custom adapter in the config file:

  3. Use your custom provider:

Artisan Commands

The package provides helpful Artisan commands:

Troubleshooting

Common Issues

  1. API Key Not Found

    Make sure you've set the appropriate API keys in your .env file:

  2. Rate Limiting Errors

    If you're hitting rate limits, consider:

    • Increasing the rate limit in the configuration
    • Implementing better caching strategies
    • Optimizing your prompt to reduce token usage
  3. Provider Not Found Error

    Ensure the provider is correctly configured in config/ai-agent.php and that the enabled flag is set to true.

Debugging

Enable more detailed logging to troubleshoot issues:

API Reference

The package provides the following core API:

AiAgent Facade

AiLoggerService

Testing

License

This package is open-sourced software licensed under the MIT license.

Issues

If you encounter any issues or have suggestions, please submit them through our GitHub Issues page.

Author

Created by Arseno25


All versions of ai-agent with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
illuminate/support Version ^8.0|^9.0|^10.0|^12.0
illuminate/console Version ^8.0|^9.0|^10.0|^12.0
illuminate/contracts Version ^8.0|^9.0|^10.0|^12.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 ai-agent/ai-agent contains the following files

Loading the files please wait ...