Download the PHP package erdum/php-open-ai-assistant-sdk without Composer

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

OpenAI Assistant API PHP SDK

A PHP class for seamless interaction with the OpenAI Assistant API, enabling developers to build powerful AI assistants capable of performing a variety of tasks.

Table of Contents

Installation

Install with composer

Or install without composer on older PHP versions just clone the project in your working directory and require the OpenAIAssistant.php

Usage

Currently, this usage example does not contain any information about OpenAI Assistant API working for a better understanding of how OpenAI Assistant API works and its lifecycle please refer to the OpenAI documentation and look the Reference to see all the available methods.

How PHP functions will be called

Whatever function names you provide in the tools array will be called in your PHP environment accordingly by the Assistant API, for example in the below code function "get_account_balance" should be present in your PHP environment in order to be executed. If you want to run methods of an object or static methods of a class then you can provide an additional argument to the "execute_tools" method

Create a new Assistant

Reference

Constructor

Parameter Type Description
$api_key string Required. Your OpenAI API key.
$assistant_id string Assistant ID (default = null).
$base_url string OpenAI API base URL (default = 'https://api.openai.com/v1').
$version_header string OpenAI API version header (default = 'OpenAI-Beta: assistants=v1').
Returns void No return value.

create_assistant

Parameter Type Description
$name string Name of the assistant.
$instructions string Instructions for the assistant.
$tools array Array of tools.
Returns string ID of the created assistant.

modify_assistant

Parameter Type Description
$name string Name of the assistant.
$instructions string Instructions for the assistant.
$tools array Array of tools.
Returns string ID of the modified assistant.

list_assistants

No parameters.

Returns array List of available assistants.

create_thread

Parameter Type Description
$content string Content of the thread.
$role string Role (default = 'user').
Returns string ID of the created thread.

get_thread

Parameter Type Description
$thread_id string Thread ID.
Returns array Details of the thread.

add_message

Parameter Type Description
$thread_id string Thread ID.
$content string Content of the message.
$role string Role (default = 'user').
Returns string ID of the added message.

get_message

Parameter Type Description
$thread_id string Thread ID.
$message_id string Message ID.
Returns array Details of the message.

list_thread_messages

Parameter Type Description
$thread_id string Thread ID.
Returns array List of messages in the thread.

run_thread

Parameter Type Description
$thread_id string Thread ID.
Returns string ID of the thread run.

execute_tools

Parameter Type Description
$thread_id string Thread ID.
$execution_id string Execution ID.
$optional_object object Optional object.
Returns array Outputs of executed tools.

submit_tool_outputs

Parameter Type Description
$thread_id string Thread ID.
$execution_id string Execution ID.
$outputs array Tool outputs array.
Returns string ID of the submitted tool outputs.

Feedback

If you have any feedback, please reach out to us at [email protected]

License

MIT License


All versions of php-open-ai-assistant-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
ext-curl Version *
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 erdum/php-open-ai-assistant-sdk contains the following files

Loading the files please wait ....