Documentation

BasicPipeline implements Pipeline

Provides a builder-pattern interface for constructing AI API requests by delegating functionality to an injected Driver.

The BasicPipeline allows you to set the model and prompt which are then passed through to the driver. It supports both standard and streaming outputs.

Table of Contents

Interfaces

Pipeline
Defines the required methods for Ai Model Pipelines, which are required for compatibility with LaravelNeuro Agent Networking features.

Properties

$driver  : Driver
The AI model driver.
$model  : mixed
The model identifier used for the request.
$prompt  : mixed
The prompt text to be used for the request.
$system  : mixed
The system message or instruction, if applicable.

Methods

__construct()  : mixed
BasicPipeline constructor.
driver()  : Driver|GuzzleDriver
Accesses the injected Driver instance.
driverClass()  : string
Retrieves the class name of the default associated driver.
getDriver()  : Driver
Retrieves the current driver.
getModel()  : mixed
Retrieves the current model identifier.
getPrompt()  : string
Retrieves the current prompt text.
output()  : mixed
Executes the API request and returns the response body.
promptClass()  : string
Retrieves the class name of the default associated prompt.
setModel()  : self
Sets the model for the pipeline.
setPrompt()  : self
Sets the prompt for the pipeline.
stream()  : Generator
Executes a streaming API request.

Properties

$driver

The AI model driver.

protected Driver $driver

Should implement the Driver contract.

$model

The model identifier used for the request.

protected mixed $model

$prompt

The prompt text to be used for the request.

protected mixed $prompt

$system

The system message or instruction, if applicable.

protected mixed $system

Methods

__construct()

BasicPipeline constructor.

public __construct([Driver|GuzzleDriver $driver = new GuzzleDriver() ]) : mixed

Optionally accepts a Driver instance. If none is provided, a default GuzzleDriver is used.

Parameters
$driver : Driver|GuzzleDriver = new GuzzleDriver()

An instance of a class implementing the Driver contract.

driverClass()

Retrieves the class name of the default associated driver.

public driverClass() : string
Return values
string

getDriver()

Retrieves the current driver.

public getDriver() : Driver
Return values
Driver

The current driver instance.

getModel()

Retrieves the current model identifier.

public getModel() : mixed
Return values
mixed

The current model identifier.

getPrompt()

Retrieves the current prompt text.

public getPrompt() : string
Return values
string

The current prompt.

output()

Executes the API request and returns the response body.

public output() : mixed

Delegates to the driver's output() method.

Return values
mixed

The response body.

promptClass()

Retrieves the class name of the default associated prompt.

public promptClass() : string
Return values
string

setModel()

Sets the model for the pipeline.

public setModel(mixed $model) : self

Assigns the given model to the pipeline and updates the underlying driver's request payload.

Parameters
$model : mixed

The model identifier to be used.

Return values
self

setPrompt()

Sets the prompt for the pipeline.

public setPrompt(string|BasicPrompt $prompt) : self

Accepts either a string or an instance of SUAprompt. If a SUAprompt is provided, the method iterates over its elements to build the complete prompt and system message.

Parameters
$prompt : string|BasicPrompt

The prompt text or SUAprompt instance.

Tags
throws
InvalidArgumentException

If the provided prompt is neither a string nor an instance of SUAprompt.

Return values
self

stream()

Executes a streaming API request.

public stream() : Generator

Enables streaming mode and returns a generator that yields JSON-encoded data chunks from the API response.

Return values
Generator

Yields JSON-encoded data chunks.


        
On this page

Search results