Bitrix API

GigaChat extends CloudEngine implements IContext, IQueueOptional

FinalYes

Table of Contents

Interfaces

IContext
IQueueOptional

Constants

CLOUD_REGISTRATION_NOT_FOUND  = 'CLOUD_REGISTRATION_DATA_NOT_FOUND'
ENGINE_CODE  = 'GigaChat'

Methods

__construct()  : mixed
checkLimits()  : bool
Returns true if current Engine must use limits.
completions()  : void
Makes request to AI Engine. The model will return one or more predicted completions.
completionsInQueue()  : void
Makes request to AI Engine throw the queue.
getAgreement()  : Agreement|null
Returns Agreement if current Engine has it, null otherwise.
getAnalyticData()  : array<string|int, mixed>|array<string|int, string>
Get analytic data
getCategory()  : string
Returns Engine's category.
getCode()  : string
Returns Engine's code.
getConsumptionId()  : string
Returns id consumption from bass
getContext()  : Context
Returns current context.
getContextLimit()  : int
Returns context limit in tokens.
getHistoryGroupId()  : int
Get ID of history group -1 - no grouped, 0 - first item of group
getMaxOutputTokens()  : int
getMessages()  : array<string|int, Message>
Returns array of messages, that represents as Context of current request.
getName()  : string
Returns name of the engine.
getParameters()  : array<string|int, mixed>
Returns all current default and custom parameters.
getPayload()  : IPayload|null
Returns stored payload.
getResponseJsonMode()  : bool
Get response json mode.
getResultFromRaw()  : Result
Prepares raw data and returns Result instance.
hasQuality()  : bool
Returns true, if Engine has required Quality.
inTariff()  : bool
Checks that current Engine is available in the current tariff.
isAvailable()  : bool
Returns true, if this Engine is available for use.
isCache()  : bool
Return cache state
isExpired()  : bool
Returns true if Engine is expired (in REST Application case for example).
isPreferredForQuality()  : bool
Check if Engine recommended to use for Quality
isThirdParty()  : bool
Returns true if current Engine is third party application.
onError()  : void
Sets callback, that will be called on any error occurred.
onResponseError()  : void
On post response error.
onResponseSuccess()  : void
On response success.
onSuccess()  : void
Sets callback, that will be called on successful request.
setAnalyticData()  : void
Extension of setAnalyticData(), set same data for analytic,
setCache()  : void
Set cache state for request
setConsumptionId()  : void
Set id consumption from bass
setHistoryGroupId()  : void
Set ID of history group -1 - no grouped, 0 - first item of group
setHistoryState()  : void
Write or not history, in depend on $state.
setParameters()  : void
Sets additional parameters for future request to Engine.
setPayload()  : void
Stores payload for future request.
setResponseJsonMode()  : void
Set response json mode.
setUserParameters()  : void
Extension of setParameters(), forbids setting by user important engine params, such as allowed query cost (for example).
shouldSkipAgreement()  : bool
shouldWriteHistory()  : bool
Returns true, if history will be written in current request.
skipAgreement()  : self
Skips User Agreement (in fact just accept agreement by current Context's user).
writeErrorInHistory()  : void
Writes error response in history, must depend on isWriteHistory.
writeHistory()  : void
Writes history, must depend on isWriteHistory.

Constants

CLOUD_REGISTRATION_NOT_FOUND

public mixed CLOUD_REGISTRATION_NOT_FOUND = 'CLOUD_REGISTRATION_DATA_NOT_FOUND'

ENGINE_CODE

public mixed ENGINE_CODE = 'GigaChat'

Methods

__construct()

public __construct(Context $context[, mixed $data = null ]) : mixed
Parameters
$context : Context
$data : mixed = null

checkLimits()

Returns true if current Engine must use limits.

public checkLimits() : bool
Return values
bool

completions()

Makes request to AI Engine. The model will return one or more predicted completions.

public final completions() : void

After success completions you must execute writeHistory method.

completionsInQueue()

Makes request to AI Engine throw the queue.

public final completionsInQueue() : void

getAgreement()

Returns Agreement if current Engine has it, null otherwise.

public getAgreement() : Agreement|null
Return values
Agreement|null

getAnalyticData()

Get analytic data

public getAnalyticData() : array<string|int, mixed>|array<string|int, string>
Return values
array<string|int, mixed>|array<string|int, string>

getCategory()

Returns Engine's category.

public getCategory() : string
Return values
string

getCode()

Returns Engine's code.

public getCode() : string
Return values
string

getConsumptionId()

Returns id consumption from bass

public getConsumptionId() : string
Return values
string

getContext()

Returns current context.

public getContext() : Context
Return values
Context

getContextLimit()

Returns context limit in tokens.

public getContextLimit() : int
Return values
int

getHistoryGroupId()

Get ID of history group -1 - no grouped, 0 - first item of group

public getHistoryGroupId() : int
Return values
int

getMaxOutputTokens()

public getMaxOutputTokens() : int
Return values
int

getMessages()

Returns array of messages, that represents as Context of current request.

public getMessages() : array<string|int, Message>

Each item must contain at least one key content.

Return values
array<string|int, Message>

getName()

Returns name of the engine.

public getName() : string
Tags
inheritDoc
Return values
string

getParameters()

Returns all current default and custom parameters.

public getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getResponseJsonMode()

Get response json mode.

public getResponseJsonMode() : bool
Return values
bool

getResultFromRaw()

Prepares raw data and returns Result instance.

public getResultFromRaw(mixed $rawResult[, bool $cached = false ]) : Result
Parameters
$rawResult : mixed

Raw result.

$cached : bool = false
Tags
inheritDoc
Return values
Result

hasQuality()

Returns true, if Engine has required Quality.

public hasQuality(Quality $quality) : bool
Parameters
$quality : Quality
Return values
bool

inTariff()

Checks that current Engine is available in the current tariff.

public inTariff() : bool
Return values
bool

isAvailable()

Returns true, if this Engine is available for use.

public isAvailable() : bool
Return values
bool

isCache()

Return cache state

public isCache() : bool
Return values
bool

isExpired()

Returns true if Engine is expired (in REST Application case for example).

public isExpired() : bool
Return values
bool

isPreferredForQuality()

Check if Engine recommended to use for Quality

public isPreferredForQuality([Quality|null $quality = null ]) : bool
Parameters
$quality : Quality|null = null
Return values
bool

isThirdParty()

Returns true if current Engine is third party application.

public isThirdParty() : bool
Return values
bool

onError()

Sets callback, that will be called on any error occurred.

public onError(callable $callback) : void

This callback will receive Error object as input parameter.

Parameters
$callback : callable

Function will be called.

Tags
see
Error

onResponseError()

On post response error.

public onResponseError(string $message, string $status) : void
Parameters
$message : string
$status : string

onResponseSuccess()

On response success.

public onResponseSuccess(mixed $response, EngineResultCache $cacheManager[, bool $cached = false ]) : void
Parameters
$response : mixed
$cacheManager : EngineResultCache
$cached : bool = false

onSuccess()

Sets callback, that will be called on successful request.

public onSuccess(callable $callback) : void

This callback will receive Result object as input parameter.

Parameters
$callback : callable

Function will be called.

Tags
see
Result

setAnalyticData()

Extension of setAnalyticData(), set same data for analytic,

public setAnalyticData(array<string|int, string> $analyticData) : void
Parameters
$analyticData : array<string|int, string>
Tags
see
setAnalyticData()

setCache()

Set cache state for request

public setCache(bool $cache) : void
Parameters
$cache : bool

setConsumptionId()

Set id consumption from bass

public setConsumptionId(string $consumptionId) : void
Parameters
$consumptionId : string

setHistoryGroupId()

Set ID of history group -1 - no grouped, 0 - first item of group

public setHistoryGroupId(int $groupId) : void
Parameters
$groupId : int

setHistoryState()

Write or not history, in depend on $state.

public setHistoryState(bool $state) : void
Parameters
$state : bool

True to write, false otherwise.

setParameters()

Sets additional parameters for future request to Engine.

public setParameters(array<string|int, mixed> $params) : void

Method replace old parameters, if they were set.

Parameters
$params : array<string|int, mixed>

Array of parameters (linear array key to value).

setPayload()

Stores payload for future request.

public setPayload(IPayload $payload) : void
Parameters
$payload : IPayload

Payload.

setResponseJsonMode()

Set response json mode.

public setResponseJsonMode(bool $enable) : void
Parameters
$enable : bool

setUserParameters()

Extension of setParameters(), forbids setting by user important engine params, such as allowed query cost (for example).

public setUserParameters(array<string|int, mixed> $params) : void
Parameters
$params : array<string|int, mixed>

shouldSkipAgreement()

public shouldSkipAgreement() : bool
Return values
bool

shouldWriteHistory()

Returns true, if history will be written in current request.

public final shouldWriteHistory() : bool
Return values
bool

skipAgreement()

Skips User Agreement (in fact just accept agreement by current Context's user).

public skipAgreement() : self
Return values
self

writeErrorInHistory()

Writes error response in history, must depend on isWriteHistory.

public writeErrorInHistory(Error $error) : void
Parameters
$error : Error

Error instance.

writeHistory()

Writes history, must depend on isWriteHistory.

public writeHistory(Result $result) : void
Parameters
$result : Result

Engine's work result.


        
On this page

Search results