Admin API Wrapper
The Admin API Wrapper is designed primarily for the AI Enrichment, Model and Classification services and is used by them to register as services. It may help when creating custom enrichment steps, it has methods to get service registrations and configure AI Model Server wrappers.
Initialisation
AdminAPI(host: str, system_secret: str, verify: bool)
Parameters:
host
: A string representing the Admin API URI.system_secret
: A system secret used for authorisation.verify
: A boolean indicating whether to verify SSL certificates.
Methods
register_service(configuration_registration: dict) -> dict
Registers a service with the Admin API.
Parameters:
configuration_registration
: A dictionary containing the configuration details for the service registration.
Returns:
A dictionary containing the registered service configuration.
Raises:
Exception: If the registration fails, an exception is raised with the status code and response text.
get_aie_settings() -> dict
Retrieves the Aiimi Insight Engine settings.
Returns:
A dictionary containing the Aiimi Insight Engine settings.
Raises:
Exception: If the retrieval fails, an exception is raised with the status code and response text.
get_service_registration(service_id: str) -> dict | None
Fetches the registration details for a specific service.
Parameters:
service_id
: A string representing the ID of the service.
Returns:
A dictionary containing the service registration details, or None if the service is not found.
get_model_server(service_id: str) -> ModelServer
Retrieves a ModelServer instance for a given service ID.
Parameters:
service_id
: A string representing the ID of the service.
Returns:
An instance of ModelServer.
Raises:
Exception: If the service ID is invalid or the service type is not AIModelService.
get_generative_model(service_id: str, provider_id: str, model_parameters: dict) -> GenerativeModel
Obtains a GenerativeModel instance based on the provided service and provider IDs, and model parameters.
Parameters:
service_id
: A string representing the ID of the service.provider_id
: A string representing the ID of the provider.model_parameters
: A dictionary containing parameters for the model.
Returns:
An instance of GenerativeModel.
Raises:
ValueError
: If the provider_id is empty.Exception: If the service ID is invalid or the service type is not AIModelService.
get_generative_model_from_parameter(ai_model_parameter: str) -> GenerativeModel
Returns a GenerativeModel wrapper from a parameter string for classification or enrichment parameters configured as 'AIModel' type.
Parameters:
ai_model_parameter
: A JSON string containing the parameters for the AI model, including aiModelServiceId, providerId, and modelParameters.
Returns:
An instance of GenerativeModel.
Notes:
This method parses the ai_model_parameter string into a dictionary and uses it to retrieve the generative model.
Last updated