Documentation

PipelineManager implements PipelineManagerContract

The PipelineManager class provides a structured way to instantiate and manage AI pipelines.

This manager offers quick access to different AI functionalities such as chat completion, text-to-speech, image generation, and speech-to-text, ensuring modularity and ease of use.

Table of Contents

Interfaces

PipelineManagerContract
The Contract for the CorporationManager, defining the required methods.

Properties

$pipeline  : Pipeline
The currently active pipeline instance.
$prompt  : BasicPrompt
The associated prompt class instance.

Methods

chatCompletion()  : PipelineManagerContract
Initializes a ChatCompletion pipeline.
connection()  : ChatCompletion|AudioTTS|DallE|Whisper
Retrieves the configured pipeline instance.
generateImage()  : PipelineManagerContract
Initializes an AI Image Generation pipeline.
make()  : PipelineManagerContract
Initializes the provided pipeline.
prompt()  : BasicPrompt
Retrieves the associated prompt instance for the active pipeline.
speechToText()  : PipelineManagerContract
Initializes a Speech-to-Text (STT) pipeline.
textToSpeech()  : PipelineManagerContract
Initializes a Text-to-Speech (TTS) pipeline.
setPipeline()  : PipelineManagerContract
Configures a pipeline with a specified model and driver.

Properties

Methods

chatCompletion()

Initializes a ChatCompletion pipeline.

public chatCompletion([string|null $model = null ][, Driver|null $driver = null ]) : PipelineManagerContract
Parameters
$model : string|null = null

The model name (e.g., "gpt-4-turbo-preview").

$driver : Driver|null = null

The driver instance to use (defaults to GuzzleDriver).

Return values
PipelineManagerContract

Returns the current instance for method chaining.

generateImage()

Initializes an AI Image Generation pipeline.

public generateImage([string|null $model = null ][, Driver|null $driver = null ]) : PipelineManagerContract
Parameters
$model : string|null = null

The model name (e.g., "dall-e-3").

$driver : Driver|null = null

The driver instance to use (defaults to GuzzleDriver).

Return values
PipelineManagerContract

Returns the current instance for method chaining.

make()

Initializes the provided pipeline.

public make(string $pipelineClass[, string|null $model = null ][, Driver|null $driver = null ]) : PipelineManagerContract
Parameters
$pipelineClass : string

the fully qualified class name of the pipeline.

$model : string|null = null

The model name (e.g., "gpt-4-turbo-preview", defaults to the pipeline's default model).

$driver : Driver|null = null

The driver instance to use (defaults to the pipeline's default driver).

Return values
PipelineManagerContract

Returns the current instance for method chaining.

prompt()

Retrieves the associated prompt instance for the active pipeline.

public prompt() : BasicPrompt
Tags
throws
Exception

If no pipeline has been set before calling this method.

Return values
BasicPrompt

The prompt class instance.

speechToText()

Initializes a Speech-to-Text (STT) pipeline.

public speechToText([string|null $model = null ][, Driver|null $driver = null ]) : PipelineManagerContract
Parameters
$model : string|null = null

The model name (e.g., "whisper-1").

$driver : Driver|null = null

The driver instance to use (defaults to GuzzleDriver).

Return values
PipelineManagerContract

Returns the current instance for method chaining.

textToSpeech()

Initializes a Text-to-Speech (TTS) pipeline.

public textToSpeech([string|null $model = null ][, Driver|null $driver = null ]) : PipelineManagerContract
Parameters
$model : string|null = null

The model name (e.g., "tts-1", "eleven-monolingual-v1").

$driver : Driver|null = null

The driver instance to use (defaults to GuzzleDriver).

Return values
PipelineManagerContract

Returns the current instance for method chaining.

setPipeline()

Configures a pipeline with a specified model and driver.

protected setPipeline(string $pipelineClass, string $promptClass, string $model[, Driver|null $driver = null ]) : PipelineManagerContract
Parameters
$pipelineClass : string

The fully qualified class name of the pipeline.

$promptClass : string

The fully qualified class name of the prompt.

$model : string

The model to use within the pipeline.

$driver : Driver|null = null

The driver instance (defaults to GuzzleDriver).

Return values
PipelineManagerContract

Returns the current instance for method chaining.


        
On this page

Search results