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>
COMPLETIONS_ENDPOINT
public
mixed
COMPLETIONS_ENDPOINT
= 'completions'
EMBEDDINGS_ENDPOINT
public
mixed
EMBEDDINGS_ENDPOINT
= 'embeddings'
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
-
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>
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
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>
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>
getCode()
public
static getCode() : string
getCompletionsEndpoint()
public
getCompletionsEndpoint([string|null $model = null ]) : string
Parameters
-
$model
: string|null
= null
-
getDefaultModel()
public
getDefaultModel() : string
getEmbeddingsEndpoint()
public
getEmbeddingsEndpoint([string|null $model = null ]) : string
Parameters
-
$model
: string|null
= null
-
getModel()
public
getModel([string|null $model = null ]) : string
Parameters
-
$model
: string|null
= null
-
getName()
public
static getName() : string
getVersion()
public
getVersion() : string
isEnabled()
public
static isEnabled() : bool
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>