Download the PHP package wmwgijol28/openai-php without Composer

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

OpenAI PHP

License


OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API, forked from https://github.com/openai-php/client

Table of Contents

Get Started

Requires PHP 7.3+

First, install OpenAI via the Composer package manager:

Ensure that the php-http/discovery composer plugin is allowed to run or install a client manually if your project does not already have a PSR-18 client integrated.

Then, interact with OpenAI's API:

If necessary, it is possible to configure and create a separate client.

Usage

Models Resource

list

Lists the currently available models, and provides basic information about each one such as the owner and availability.

retrieve

Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

delete

Delete a fine-tuned model.

Completions Resource

create

Creates a completion for the provided prompt and parameters.

create streamed

Creates a streamed completion for the provided prompt and parameters.

Chat Resource

create

Creates a completion for the chat message.

created streamed

Creates a streamed completion for the chat message.

Audio Resource

transcribe

Transcribes audio into the input language.

translate

Translates audio into English.

Edits Resource

create

Creates a new edit for the provided input, instruction, and parameters.

Embeddings Resource

create

Creates an embedding vector representing the input text.

Files Resource

list

Returns a list of files that belong to the user's organization.

delete

Delete a file.

retrieve

Returns information about a specific file.

upload

Upload a file that contains document(s) to be used across various endpoints/features.

download

Returns the contents of the specified file.

FineTunes Resource

create

Creates a job that fine-tunes a specified model from a given dataset.

list

List your organization's fine-tuning jobs.

retrieve

Gets info about the fine-tune job.

cancel

Immediately cancel a fine-tune job.

list events

Get fine-grained status updates for a fine-tune job.

list events streamed

Get streamed fine-grained status updates for a fine-tune job.

Moderations Resource

create

Classifies if text violates OpenAI's Content Policy.

Images Resource

create

Creates an image given a prompt.

edit

Creates an edited or extended image given an original image and a prompt.

variation

Creates a variation of a given image.

Testing

The package provides a fake implementation of the OpenAI\Client class that allows you to fake the API responses.

To test your code ensure you swap the OpenAI\Client class with the OpenAI\Testing\ClientFake class in your test case.

The fake responses are returned in the order they are provided while creating the fake client.

All responses are having a fake() method that allows you to easily create a response object by only providing the parameters relevant for your test case.

In case of a streamed response you can optionally provide a resource holding the fake response data.

After the requests have been sent there are various methods to ensure that the expected requests were sent:

To write tests expecting the API request to fail you can provide a Throwable object as the response.

Services

Azure

In order to use the Azure OpenAI Service, it is necessary to construct the client manually using the factory.

To use Azure, you must deploy a model, identified by the {deployment-id}, which is already incorporated into the API calls. As a result, you do not have to provide the model during the calls since it is included in the BaseUri.

Therefore, a basic sample completion call would be:


OpenAI PHP is an open-sourced software licensed under the MIT license.


All versions of openai-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
php-http/discovery Version ^1.18.1
php-http/multipart-stream-builder Version ^1.3.0
psr/http-client Version ^1.0.2
psr/http-client-implementation Version ^1.0.1
psr/http-factory-implementation Version *
psr/http-message Version ^1.0.1|^2.0.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 wmwgijol28/openai-php contains the following files

Loading the files please wait ....