APIs
API reference: pe.api package
pe.api.API is responsible for implementing the foundation model APIs. It has the following key methods:
pe.api.API.random_api(): Randomly generates the synthetic samples for the initial samples of the Private Evolution algorithm.pe.api.API.variation_api(): Generates the variations of the given synthetic samples for the initial or the next Private Evolution iteration.
Available APIs
Currently, the following APIs are implemented:
Images
pe.api.StableDiffusion: The APIs of Stable Diffusion (introduced in [1]).pe.api.ImprovedDiffusion: The APIs of the improved diffusion model (introduced in [1]).pe.api.DrawText: The APIs that render text on images (introduced in [3]).pe.api.Avatar: The APIs that generate avatars using the Python Avatars library (introduced in [3]).pe.api.NearestImage: The APIs that utilize a static image dataset (introduced in [3]).
Text
pe.api.LLMAugPE: The APIs for text generation using LLMs (introduced in [2]). When constructing the instance of this API, an LLM instance is required. The LLM instances follow the interface ofpe.llm.LLM. Currently, the following LLMs are implemented:pe.llm.OpenAILLM: The LLMs from OpenAI APIs.pe.llm.AzureOpenAILLM: The LLMs from Azure OpenAI APIs.pe.llm.HuggingfaceLLM: The open-source LLMs from Huggingface.
Adding Your Own APIs
To add your own APIs, you need to create a class that inherits from pe.api.API and implements the pe.api.API.random_api() and pe.api.API.variation_api() methods.
Citations