Documentation

Manager extends ContainerAwareObject
in package

Ai Manager

Table of Contents

Constants

CHATGPT_MAX_TOKENS  = 50
CHATGPT_MODEL  = 'gpt-3.5-turbo'
CHATGPT_REMAINING_TOKENS_PATH  = 'app/chatgpt/remaining_tokens'
CHATGPT_TOKEN_PATH  = 'app/chatgpt/token'
CHATGPT_VERSION  = 'v1'
CLAUDE_MAX_TOKENS  = 1000
CLAUDE_MODEL  = 'claude-3-5-sonnet-20241022'
CLAUDE_REMAINING_TOKENS_PATH  = 'app/claude/remaining_tokens'
CLAUDE_TOKEN_PATH  = 'app/claude/token'
CLAUDE_VERSION  = 'v1'
GEMINI_MODEL  = 'gemini-1.5-flash-latest'
GEMINI_TOKEN_PATH  = 'app/gemini/token'
GEMINI_VERSION  = 'v1beta'
MAX_INTERACTIONS_HISTORYLENGTH  = 200
MAX_INTERACTIONS_HISTORYLIFETIME  = 1800
MISTRAL_MAX_TOKENS  = 1000
MISTRAL_MODEL  = 'mistral-medium'
MISTRAL_REMAINING_TOKENS_PATH  = 'app/mistral/remaining_tokens'
MISTRAL_TOKEN_PATH  = 'app/mistral/token'
MISTRAL_VERSION  = 'v1'

Properties

$translators  : array<string|int, mixed>
$container  : ContainerInterface
$interactions  : array<string|int, mixed>

Methods

__call()  : mixed
{@inheritdoc}
__construct()  : mixed
constructor
askChatGPT()  : string
askClaude()  : string
askGoogleGemini()  : string
askMistral()  : string
clearInteractions()  : self
containerCall()  : mixed
call method through container
containerMake()  : mixed
create object through container
getAdminRouter()  : Admin
gets admin service
getAI()  : Manager
gets ai manager service
getApp()  : App
gets app object
getApplicationLogger()  : Manager
gets application_logger service
getAppRouteInfo()  : RouteInfo|null
gets route info
getAppWebsite()  : Website|null
gets current website
getAssets()  : Manager
gets assets manager
getAuth()  : Manager
gets auth manager service
getAvailableAIs()  : array<string|int, mixed>
getCache()  : Manager
get cache manager
getContainer()  : ContainerInterface|Container
gets container object
getCrudRouter()  : Crud
gets crud service
getDb()  : Database|null
gets db object
getDebugbar()  : StandardDebugBar
gets debugbar object
getEnv()  : mixed
gets env variable
getEventManager()  : SharedEventEmitter
gets events manager service
getGoogleAuthenticator()  : PHPGangsta_GoogleAuthenticator
gets google authenticator service
getGuzzle()  : Client
gets guzzle service
getHistory()  : array<string|int, mixed>
getHtmlRenderer()  : HtmlPartsRenderer
gets html renderer service
getIcons()  : Icons
gets icons service
getImagine()  : Imagine
gets imagine service
getInteractions()  : array<string|int, mixed>
getLog()  : Logger
gets log object
getMailer()  : Mailer
gets mailer service
getPdo()  : PDO|null
gets PDO object
getRedis()  : Manager
gets redis service
getRequest()  : Request
gets current request object
getRouters()  : array<string|int, mixed>
gets routers
getSchema()  : Schema|null
gets schema object
getSearch()  : Manager
gets search service
getSesMailer()  : SesClient
gets SES mailer service
getSiteData()  : SiteData
gets site data service
getSmtpMailer()  : Swift_Mailer
gets SMTP mailer service
getTemplates()  : Engine
gets plates engine object
getTranslator()  : Translator
gets translator
getUtils()  : Globals
gets global utils service
getWebhooksRouter()  : Webhooks
gets webhooks service
getWebRouter()  : Web
gets routing service
getZip()  : Zip
gets zip service
isAiAvailable()  : bool
isChatGPTEnabled()  : bool
isClaudeEnabled()  : bool
isGoogleGeminiEnabled()  : bool
isMistralEnabled()  : bool
requestUrl()  : string|bool
executes an http request
getRedisKey()  : string
getService()  : mixed
gets registered service
parseInteraction()  : string
saveInteraction()  : self
padLeftVisible()  : string
Pad a sinistra calcolato sulla larghezza visibile
stripAnsi()  : string
Rimuove le sequenze ANSI (colori, ecc.)
visibleWidth()  : int
Larghezza visibile (senza ANSI), con supporto multibyte

Constants

CHATGPT_MAX_TOKENS

public mixed CHATGPT_MAX_TOKENS = 50

CHATGPT_MODEL

public mixed CHATGPT_MODEL = 'gpt-3.5-turbo'

CHATGPT_REMAINING_TOKENS_PATH

public mixed CHATGPT_REMAINING_TOKENS_PATH = 'app/chatgpt/remaining_tokens'

CHATGPT_TOKEN_PATH

public mixed CHATGPT_TOKEN_PATH = 'app/chatgpt/token'

CHATGPT_VERSION

public mixed CHATGPT_VERSION = 'v1'

CLAUDE_MAX_TOKENS

public mixed CLAUDE_MAX_TOKENS = 1000

CLAUDE_MODEL

public mixed CLAUDE_MODEL = 'claude-3-5-sonnet-20241022'

CLAUDE_REMAINING_TOKENS_PATH

public mixed CLAUDE_REMAINING_TOKENS_PATH = 'app/claude/remaining_tokens'

CLAUDE_TOKEN_PATH

public mixed CLAUDE_TOKEN_PATH = 'app/claude/token'

CLAUDE_VERSION

public mixed CLAUDE_VERSION = 'v1'

GEMINI_MODEL

public mixed GEMINI_MODEL = 'gemini-1.5-flash-latest'

GEMINI_TOKEN_PATH

public mixed GEMINI_TOKEN_PATH = 'app/gemini/token'

GEMINI_VERSION

public mixed GEMINI_VERSION = 'v1beta'

MAX_INTERACTIONS_HISTORYLENGTH

public mixed MAX_INTERACTIONS_HISTORYLENGTH = 200

MAX_INTERACTIONS_HISTORYLIFETIME

public mixed MAX_INTERACTIONS_HISTORYLIFETIME = 1800

MISTRAL_MAX_TOKENS

public mixed MISTRAL_MAX_TOKENS = 1000

MISTRAL_MODEL

public mixed MISTRAL_MODEL = 'mistral-medium'

MISTRAL_REMAINING_TOKENS_PATH

public mixed MISTRAL_REMAINING_TOKENS_PATH = 'app/mistral/remaining_tokens'

MISTRAL_TOKEN_PATH

public mixed MISTRAL_TOKEN_PATH = 'app/mistral/token'

MISTRAL_VERSION

public mixed MISTRAL_VERSION = 'v1'

Properties

$translators

public static array<string|int, mixed> $translators = []

translators

$interactions

protected array<string|int, mixed> $interactions = []

Methods

__construct()

constructor

public __construct(ContainerInterface $container) : mixed
Parameters
$container : ContainerInterface

askChatGPT()

public askChatGPT(string $prompt) : string
Parameters
$prompt : string
Return values
string

askClaude()

public askClaude(string $prompt) : string
Parameters
$prompt : string
Return values
string

askGoogleGemini()

public askGoogleGemini(string $prompt) : string
Parameters
$prompt : string
Return values
string

askMistral()

public askMistral(string $prompt) : string
Parameters
$prompt : string
Return values
string

clearInteractions()

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

containerCall()

call method through container

public containerCall(callable $callable[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
$callable : callable
$arguments : array<string|int, mixed> = []

containerMake()

create object through container

public containerMake(string $className[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
$className : string
$arguments : array<string|int, mixed> = []

getAvailableAIs()

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

getContainer()

gets container object

public getContainer() : ContainerInterface|Container
Return values
ContainerInterface|Container

getDb()

gets db object

public getDb() : Database|null
Tags
throws
BasicException
Return values
Database|null

getDebugbar()

gets debugbar object

public getDebugbar() : StandardDebugBar
Tags
throws
BasicException
Return values
StandardDebugBar

getEnv()

gets env variable

public getEnv(string $variable[, mixed $default = null ]) : mixed
Parameters
$variable : string
$default : mixed = null
Tags
throws
BasicException

getEventManager()

gets events manager service

public getEventManager() : SharedEventEmitter
Tags
throws
BasicException
Return values
SharedEventEmitter

getGoogleAuthenticator()

gets google authenticator service

public getGoogleAuthenticator() : PHPGangsta_GoogleAuthenticator
Tags
throws
BasicException
Return values
PHPGangsta_GoogleAuthenticator

getGuzzle()

gets guzzle service

public getGuzzle() : Client
Tags
throws
BasicException
Return values
Client

getHistory()

public getHistory(string $aiType[, int $terminalWidth = 80 ]) : array<string|int, mixed>
Parameters
$aiType : string
$terminalWidth : int = 80
Return values
array<string|int, mixed>

getIcons()

gets icons service

public getIcons() : Icons
Tags
throws
BasicException
Return values
Icons

getImagine()

gets imagine service

public getImagine() : Imagine
Tags
throws
BasicException
Return values
Imagine

getInteractions()

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

getLog()

gets log object

public getLog() : Logger
Tags
throws
BasicException
Return values
Logger

getPdo()

gets PDO object

public getPdo() : PDO|null
Tags
throws
BasicException
Return values
PDO|null

getRequest()

gets current request object

public getRequest() : Request
Tags
throws
BasicException
Return values
Request

getRouters()

gets routers

public getRouters() : array<string|int, mixed>
Tags
throws
BasicException
Return values
array<string|int, mixed>

getSchema()

gets schema object

public getSchema() : Schema|null
Tags
throws
BasicException
Return values
Schema|null

getSesMailer()

gets SES mailer service

public getSesMailer() : SesClient
Tags
throws
BasicException
Return values
SesClient

getSmtpMailer()

gets SMTP mailer service

public getSmtpMailer() : Swift_Mailer
Tags
throws
BasicException
Return values
Swift_Mailer

getTemplates()

gets plates engine object

public getTemplates() : Engine
Tags
throws
BasicException
Return values
Engine

getTranslator()

gets translator

public getTranslator([string|null $locale_code = null ]) : Translator
Parameters
$locale_code : string|null = null
Tags
throws
DependencyException
throws
NotFoundException
Return values
Translator

isAiAvailable()

public isAiAvailable([string|array<string|int, mixed>|null $ai = null ]) : bool
Parameters
$ai : string|array<string|int, mixed>|null = null
Return values
bool

isChatGPTEnabled()

public static isChatGPTEnabled() : bool
Return values
bool

isClaudeEnabled()

public static isClaudeEnabled() : bool
Return values
bool

isGoogleGeminiEnabled()

public static isGoogleGeminiEnabled() : bool
Return values
bool

isMistralEnabled()

public static isMistralEnabled() : bool
Return values
bool

requestUrl()

executes an http request

public requestUrl(string $url[, string $method = 'GET' ][, array<string|int, mixed> $options = [] ]) : string|bool
Parameters
$url : string
$method : string = 'GET'
$options : array<string|int, mixed> = []
Tags
throws
Exception
throws
GuzzleException
Return values
string|bool

getRedisKey()

protected getRedisKey([string|null $model = null ]) : string
Parameters
$model : string|null = null
Return values
string

getService()

gets registered service

protected getService(string $service_key) : mixed
Parameters
$service_key : string
Tags
throws
BasicException

parseInteraction()

protected parseInteraction(array<string|int, mixed> $interaction, string $aiType[, int $terminalWidth = 80 ]) : string
Parameters
$interaction : array<string|int, mixed>
$aiType : string
$terminalWidth : int = 80
Return values
string

saveInteraction()

protected saveInteraction(string $prompt, string $generatedText[, string|null $model = null ]) : self
Parameters
$prompt : string
$generatedText : string
$model : string|null = null
Return values
self

padLeftVisible()

Pad a sinistra calcolato sulla larghezza visibile

private padLeftVisible(string $s, int $width) : string
Parameters
$s : string
$width : int
Return values
string

stripAnsi()

Rimuove le sequenze ANSI (colori, ecc.)

private stripAnsi(string $s) : string
Parameters
$s : string
Return values
string

visibleWidth()

Larghezza visibile (senza ANSI), con supporto multibyte

private visibleWidth(string $s) : int
Parameters
$s : string
Return values
int

        
On this page

Search results