genai.client module#
- pydantic model genai.client.BaseConfig[source]#
Bases:
BaseServiceConfig
Client’s configuration model
- Config:
extra: str = forbid
validate_assignment: bool = True
validate_default: bool = True
- field api_client_config: ModelLike[ApiClientConfig] | None = None#
- pydantic model genai.client.BaseServices[source]#
Bases:
BaseServiceServices
Appropriate services used by the Client
- Config:
extra: str = forbid
validate_assignment: bool = True
validate_default: bool = True
- field DeploymentService: type[_DeploymentService] = <class 'genai.deployment.deployment_service.DeploymentService'>#
- field FileService: type[_FileService] = <class 'genai.file.file_service.FileService'>#
- field FolderService: type[_FolderService] = <class 'genai.folder.folder_service.FolderService'>#
- field ModelService: type[_ModelService] = <class 'genai.model.model_service.ModelService'>#
- field PromptService: type[_PromptService] = <class 'genai.prompt.prompt_service.PromptService'>#
- field RequestService: type[_RequestService] = <class 'genai.request.request_service.RequestService'>#
- field SystemPromptService: type[_SystemPromptService] = <class 'genai.system_prompt.system_prompt_service.SystemPromptService'>#
- field TagService: type[_TagService] = <class 'genai.tag.tag_service.TagService'>#
- field TaskService: type[_TaskService] = <class 'genai.task.task_service.TaskService'>#
- field TextService: type[_TextService] = <class 'genai.text.text_service.TextService'>#
- field TuneService: type[_TuneService] = <class 'genai.tune.tune_service.TuneService'>#
- field UserService: type[_UserService] = <class 'genai.user.user_service.UserService'>#
- class genai.client.Client[source]#
Bases:
BaseService
[BaseConfig
,BaseServices
]The Client class provides an interface for interacting with various services through an API client. It can be initialized with either an api_client or credentials along with optional configurations and services.
Example:
from genai import Credentials, Client credentials = Credentials.from_env() client = Client(credentials=credentials)
- text#
An instance of the TextService class for text-related operations.
- request#
An instance of the RequestService class for making request-related operations.
- tune#
An instance of the TuneService class for tuning models.
- model#
An instance of the ModelService class for managing models.
- file#
An instance of the FileService class for managing files.
- prompt#
An instance of the PromptService class for working with prompts.
- system_prompt#
An instance of the SystemPromptService class for working with system prompts.
- user#
An instance of the UserService class for managing user-related operations.
- tag#
An instance of the TagService class for working with tags.
- folder#
An instance of the FolderService class for working with folder.
- task#
An instance of the TaskService class for working with tasks.
- Config#
alias of
BaseConfig
- Services#
alias of
BaseServices
- __init__(*, api_client: ApiClient, config: dict | BaseConfig | None = None, services: BaseServices | None = None) None [source]#
- __init__(*, credentials: Credentials, config: dict | BaseConfig | None = None, services: BaseServices | None = None) None
- Parameters:
credentials – The credentials used to authenticate the API client.
api_client – The API client used to make requests to the API.
config – The configuration for the API client.
services – The services object containing instances of various service classes.
- Raises:
ValueError – Either ‘api_client’ or ‘credentials’ needs to be passed.
Note
The api_client parameter must be provided either directly or through credentials. If no services parameter is provided, the client will use the default one.