Download the PHP package assistant-engine/php-sdk without Composer

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

Assistant Engine PHP SDK

The Assistant Engine PHP SDK provides a convenient way to interact with the Assistant Engine API, allowing developers to create and manage conversations, tasks, and messages.

Requirements

Important Notice: Both an OpenAI API key and an Assistant Engine API key are required to use this SDK. Make sure these keys are configured correctly by following the respective documentation linked above.

Documentation

Official documentation for the Assistant Engine PHP SDK can be found on the Assistant Engine Documentation website.

Installation

You can install the Assistant Engine PHP SDK via Composer:

Usage

Initialization

To start using the SDK, initialize the AssistantEngine class with your API URL, API token and OpenAI token.

Conversation Management

Create or Find a Conversation

To create or find a conversation, use the findOrCreateConversation method with a ConversationOption object:

ConversationOption represents the settings used to create or find a conversation and includes the following options:

Note: The Assistant Engine will attempt to locate an existing conversation based on the combination of assistant_key, user_id, and subject_id. If a match is found, that conversation will be retrieved; otherwise, a new one will be created.

Retrieve a Conversation by ID

To retrieve a specific conversation:

Conversation represents a conversation session and includes properties such as:

Conversation Item: Represents individual messages, actions, or events within the conversation, such as user messages or assistant responses. Each item can be:

Run: When a request is made to the LLM, it is called a "run." During a run, items may be in a pending state. Once the run completes and reaches a finite state, the pending items become finalized. Until a run reaches a finite state, additional actions such as recreating or re-triggering the run cannot occur.

Available methods for the Conversation object include:

Update a Conversation

To update a conversation's title, context, or additional data:

Deactivate a Conversation

To deactivate a conversation:

Messages

Create a Message in a Conversation

To send a message within an existing conversation:

Task Management

What is a Task?

A task is a defined operation that the LLM should execute. Tasks can be configured in the Assistant Engine, including specifications on required context. Read more in the Assistant Engine Task Documentation.

Required context must be provided in the TaskRunOption; otherwise, an exception will be thrown. This context will be included in the LLM message if marked as required, while other context data will be added to the general instructions.

Initiate a Task Run

To start a task with specific context data:

Poll Task Run Until Complete

To continuously check the status of a task run until it completes:

Initiate Task Run and Poll

To initiate a task and automatically poll until it's complete:

Task Output

The TaskOutput object represents the result of a task execution. Here’s what it looks like:

Example usage to retrieve task output:

One more thing

We’ve created more repositories to make working with the Assistant Engine even easier! Check them out:

We are a young startup aiming to make it easy for developers to add AI to their applications. Feedback, questions, comments, and PRs are welcome. Reach out at [email protected].

License

The MIT License (MIT). Please see License File for more information.


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
guzzlehttp/guzzle Version ^7.0 || ^7.9.2
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 assistant-engine/php-sdk contains the following files

Loading the files please wait ....