Documentation

Driver

Defines the required methods for Ai Model Drivers, which are attached to Pipelines via dependency injection. The default driver is the WebRequest GuzzleDriver

Table of Contents

Methods

getModel()  : string
Retrieves the current model identifier.
getPrompt()  : mixed
Retrieves the current prompt.
getSystemPrompt()  : mixed
Retrieves the current system prompt.
output()  : mixed
Executes the API request and returns the response body.
setModel()  : self
Sets the model identifier for the driver.
setPrompt()  : self
Sets the prompt for the driver.
setSystemPrompt()  : self
Sets the system prompt.
stream()  : Generator
Executes a streaming API request.

Methods

getModel()

Retrieves the current model identifier.

public getModel() : string
Return values
string —

The model identifier.

getPrompt()

Retrieves the current prompt.

public getPrompt() : mixed
Return values
mixed —

The current prompt value.

getSystemPrompt()

Retrieves the current system prompt.

public getSystemPrompt() : mixed
Return values
mixed —

The system prompt.

output()

Executes the API request and returns the response body.

public output() : mixed

This method should internally call the connect() method and handle any necessary request execution logic.

Return values
mixed —

The response body.

setModel()

Sets the model identifier for the driver.

public setModel(mixed $model) : self
Parameters
$model : mixed

The model identifier.

Return values
self

setPrompt()

Sets the prompt for the driver.

public setPrompt(mixed $prompt) : self
Parameters
$prompt : mixed

The prompt value.

Return values
self

setSystemPrompt()

Sets the system prompt.

public setSystemPrompt(mixed $system) : self

This can be used to provide context or instructions to the AI model.

Parameters
$system : mixed

The system prompt.

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. This is useful for handling responses that include large or streaming payloads.

Return values
Generator —

Yields JSON-encoded data chunks.


        
On this page

Search results