Giga Request#

Requests to the AI model using the request library#

Module of the GigaChatAI model.

class giga_request.BaseAIImage[source]#

AI image-generate-model base class.

abstract async static request(query, auth_token_giga, token_giga)[source]#

Create image for some users.

Parameters:
  • query (str) – Query from the user.

  • auth_token_giga (str) – Authorization token for some AI Model.

  • token_giga (str) – Token for requests.

Returns:

Image data.

Return type:

str

class giga_request.BaseAIText[source]#

AI text-chat-model base class.

abstract async static request(request_of_user, token_giga, temperature_giga, top_p_giga, n_giga, auth_token_giga)[source]#

Answer for the user from the request (from the user) by some AI Model.

Parameters:
  • request_of_user (str) – Request from the user.

  • token_giga (str) – Token of some AI Model.

  • temperature_giga (float) – Temperature of an answer.

  • top_p_giga (float) – Alternative to temperature.

  • n_giga (int) – Quality and count answer for the generated.

  • auth_token_giga (str) – Authorization token of some AI Model.

Returns:

Result.

Return type:

str

class giga_request.BaseGetData[source]#

The base class for retrieving configuration data.

abstract async static get_data(file_path)[source]#

Base function for getting data (from conf-file, which created by admin).

Parameters:

file_path – File Path of JSON-API-keys for Bot and settings for the GIGACHAT.

Returns:

Dict with data.

Return type:

dict

class giga_request.BaseGetToken[source]#

The base class for obtaining a token AI-API

abstract async static get_token(auth_token_giga)[source]#

Get token for admin-AI-Account.

Parameters:

auth_token_giga (str) – Authorization token.

Returns:

Access (Auth) Token (answer).

Return type:

str

class giga_request.BaseVersionAI[source]#

Base class for selecting the AI version.

abstract async static request(request)[source]#

AI Version. Return answer to the user (str).

Parameters:

request (str) – Request from the user.

Returns:

Answer (tuple) pro-version (“deep” answer).

Return type:

str

class giga_request.GetAuthTokenSber[source]#

The base class for obtaining a token AI SBER API (GigaChat API).

async static get_token(auth_token_giga)[source]#

Get token for admin-AI-Account GigaChat.

Parameters:

auth_token_giga (str) – Authorization token for GigaChatAI (requests only now).

Returns:

Access (Auth) Token for GigaChatAI (answers).

Return type:

str

class giga_request.GetData[source]#

The class-sector for getting conf-data from conf-file.

async static get_data(file_path='bot.json')[source]#

Get data of the GigaChatSettings.

Parameters:

file_path – File Path of JSON-API-keys for Bot and settings for the GIGACHAT.

Returns:

Dict with data.

Return type:

dict

class giga_request.GigaChatLight[source]#

The class of AI-text model GigaChat. Version of the AI-assistance: GigaLight.

async static request(request_of_user, token_giga, temperature_giga, top_p_giga, n_giga, auth_token_giga)[source]#

Answer for the user from the request (from the user) by GigaChatLight. Light answers (‘Really’ Light).

Parameters:
  • request_of_user (str) – Request from the user.

  • token_giga (str) – Token of the GigaChatAI.

  • temperature_giga (float) – Temperature of an answer.

  • top_p_giga (float) – Alternative to temperature.

  • n_giga (int) – Quality and count answer for the generated.

  • auth_token_giga (str) – Authorization token of the GigaChatAI.

Return type:

str

class giga_request.GigaChatPro[source]#

The class of AI-text model GigaChat. Version of the AI-assistance: GigaPro.

async static request(request_of_user, token_giga, temperature_giga, top_p_giga, n_giga, auth_token_giga)[source]#

Answer for the user from the request (from the user) by GigaChatPRO. Limited Version of the Answers for the user. Premium answers (PRO).

Parameters:
  • request_of_user (str) – Request from the user.

  • token_giga (str) – Token of the GigaChatAI.

  • temperature_giga (float) – Temperature of an answer.

  • top_p_giga (float) – Alternative to temperature.

  • n_giga (int) – Quality and count answer for the generated.

  • auth_token_giga (str) – Authorization token of the GigaChatAI.

Returns:

Result.

Return type:

str

class giga_request.GigaImagePro[source]#

Class of generate images for premium-users.

async static request(request, auth_token_giga, token_giga)[source]#

Create image for Premium users.

Parameters:
  • request (str) – Request / Query from the user.

  • auth_token_giga (str) – Authorization token for GigaChatAI (requests only now).

  • token_giga (str) – Token for requests.

Returns:

Image data | Result (str).

Return type:

bytes | str

class giga_request.VersionAIImagePro[source]#
async static request(request)[source]#

Create a new image for premium-user.

Parameters:

request (str) – Request/Query from premium-user.

Returns:

Image data.

Return type:

bytes | str

class giga_request.VersionAILight[source]#
async static request(request)[source]#

GigaChatLight Version. Return answer to the user (str).

Parameters:

request (str) – Request from the user.

Returns:

Answer (tuple) light-version (“low” answer).

Return type:

str

class giga_request.VersionAIPro[source]#
async static request(request)[source]#

GigaChatPro Version. Return answer to the user (str).

Parameters:

request (str) – Request from the user.

Returns:

Answer (tuple) pro-version (“deep” answer).

Return type:

str