Documentation

AIModelInterface

Table of Contents

Constants

COMPLETIONS_ENDPOINT  = 'completions'
EMBEDDINGS_ENDPOINT  = 'embeddings'

Methods

ask()  : string
buildConversation()  : array<string|int, mixed>
buildEmbeddingRequest()  : array<string|int, mixed>
buildFlowInitialRequest()  : array<string|int, mixed>
embed()  : array<string|int, mixed>
formatAssistantFunctionCallMessage()  : array<string|int, mixed>|null
formatAssistantMessage()  : array<string|int, mixed>
formatUserMessage()  : array<string|int, mixed>
getAvailableModels()  : array<string|int, mixed>
getCode()  : string
getCompletionsEndpoint()  : string
getDefaultModel()  : string
getEmbeddingsEndpoint()  : string
getModel()  : string
getName()  : string
getVersion()  : string
isEnabled()  : bool
normalizeCompletionsResponse()  : array<string|int, mixed>
normalizeEmbeddingsResponse()  : array<string|int, mixed>
prepareRequest()  : array<string|int, mixed>
sendFunctionResponse()  : array<string|int, mixed>
sendRaw()  : array<string|int, mixed>

Constants

Methods

ask()

public ask(string $prompt[, string|null $model = null ][, array<string|int, mixed>|null $previousMessages = null ]) : string
Parameters
$prompt : string
$model : string|null = null
$previousMessages : array<string|int, mixed>|null = null
Return values
string

buildConversation()

public buildConversation(array<string|int, mixed> $previousMessages, string $prompt[, string|null $model = null ]) : array<string|int, mixed>
Parameters
$previousMessages : array<string|int, mixed>
$prompt : string
$model : string|null = null
Return values
array<string|int, mixed>

buildEmbeddingRequest()

public buildEmbeddingRequest(string $input[, string|null $model = null ]) : array<string|int, mixed>
Parameters
$input : string
$model : string|null = null
Return values
array<string|int, mixed>

buildFlowInitialRequest()

public buildFlowInitialRequest(BaseFlow $flow, string $userPrompt[, array<string|int, mixed> &$history = [] ][, string|null $model = null ]) : array<string|int, mixed>
Parameters
$flow : BaseFlow
$userPrompt : string
$history : array<string|int, mixed> = []
$model : string|null = null
Return values
array<string|int, mixed>

embed()

public embed(string $input[, string|null $model = null ]) : array<string|int, mixed>
Parameters
$input : string
$model : string|null = null
Return values
array<string|int, mixed>

formatAssistantFunctionCallMessage()

public formatAssistantFunctionCallMessage(string $functionName, array<string|int, mixed> $args[, string|null $id = null ]) : array<string|int, mixed>|null
Parameters
$functionName : string
$args : array<string|int, mixed>
$id : string|null = null
Return values
array<string|int, mixed>|null

formatAssistantMessage()

public formatAssistantMessage(mixed $message[, string|null $messageType = null ]) : array<string|int, mixed>
Parameters
$message : mixed
$messageType : string|null = null
Return values
array<string|int, mixed>

formatUserMessage()

public formatUserMessage(string $prompt) : array<string|int, mixed>
Parameters
$prompt : string
Return values
array<string|int, mixed>

getAvailableModels()

public getAvailableModels([bool $reset = false ]) : array<string|int, mixed>
Parameters
$reset : bool = false
Return values
array<string|int, mixed>

getCompletionsEndpoint()

public getCompletionsEndpoint([string|null $model = null ]) : string
Parameters
$model : string|null = null
Return values
string

getDefaultModel()

public getDefaultModel() : string
Return values
string

getEmbeddingsEndpoint()

public getEmbeddingsEndpoint([string|null $model = null ]) : string
Parameters
$model : string|null = null
Return values
string

getModel()

public getModel([string|null $model = null ]) : string
Parameters
$model : string|null = null
Return values
string

normalizeCompletionsResponse()

public normalizeCompletionsResponse(array<string|int, mixed> $raw) : array<string|int, mixed>
Parameters
$raw : array<string|int, mixed>
Return values
array<string|int, mixed>

normalizeEmbeddingsResponse()

public normalizeEmbeddingsResponse(array<string|int, mixed> $raw) : array<string|int, mixed>
Parameters
$raw : array<string|int, mixed>
Return values
array<string|int, mixed>

prepareRequest()

public prepareRequest(array<string|int, mixed> $payload) : array<string|int, mixed>
Parameters
$payload : array<string|int, mixed>
Return values
array<string|int, mixed>

sendFunctionResponse()

public sendFunctionResponse(string $functionName, array<string|int, mixed> $result[, array<string|int, mixed>|null $tools = null ][, array<string|int, mixed> &$history = [] ][, string|null $model = null ][, string|null $id = null ]) : array<string|int, mixed>
Parameters
$functionName : string
$result : array<string|int, mixed>
$tools : array<string|int, mixed>|null = null
$history : array<string|int, mixed> = []
$model : string|null = null
$id : string|null = null
Return values
array<string|int, mixed>

sendRaw()

public sendRaw(array<string|int, mixed> $payload[, string|null $model = null ][, string $endpoint = self::COMPLETIONS_ENDPOINT ]) : array<string|int, mixed>
Parameters
$payload : array<string|int, mixed>
$model : string|null = null
$endpoint : string = self::COMPLETIONS_ENDPOINT
Return values
array<string|int, mixed>

        
On this page

Search results