Documentation

Pipeline

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

Table of Contents

Methods

__construct()  : mixed
Each pipeline should be instantiated with a valid Driver injection.
driver()  : Driver
Accesses the injected Driver instance.
driverClass()  : string
Retrieves the class name of the default associated driver.
getDriver()  : Driver
Retrieves the active Ai Model Driver for this pipeline.
getModel()  : mixed
Retrieves the current model.
getPrompt()  : string
Retrieves the current prompt.
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.

Methods

__construct()

Each pipeline should be instantiated with a valid Driver injection.

public __construct(Driver $driver) : mixed

Default Driver: \LaravelNeuro\Contracts\WebRequest\GuzzleDriver

Parameters
$driver : Driver

driver()

Accesses the injected Driver instance.

public driver() : Driver
Return values
Driver

the Driver instance stored in this instance of the class.

driverClass()

Retrieves the class name of the default associated driver.

public driverClass() : string
Return values
string

getDriver()

Retrieves the active Ai Model Driver for this pipeline.

public getDriver() : Driver
Return values
Driver

The current pipeline Driver.

getModel()

Retrieves the current model.

public getModel() : mixed
Return values
mixed

The current model identifier.

getPrompt()

Retrieves the current prompt.

public getPrompt() : string
Return values
string

The current prompt text.

output()

Executes the API request and returns the response body.

public output() : mixed

This method leverages the connect() method and retrieves the response body.

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

This method assigns the given model to the pipeline and updates the request payload accordingly.

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

This method accepts either a string or an instance of SUAPrompt. If a SUAPrompt instance is provided, it iterates over the prompt elements to build the complete prompt and system message.

Parameters
$prompt : string|BasicPrompt

The prompt text or a prompt-class that is validated against the Pipeline inside setPrompt 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. Useful for handling responses that include large or streaming payloads.

Return values
Generator

Yields JSON-encoded data chunks.


        
On this page

Search results