Cookies Manager Backend
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
RulegenClient Class Reference

Public Member Functions

def extract_model (self, str system_task, str content, response_model)
 
def get_selector (self, str content)
 

Static Public Member Functions

def save_model_as_json (dict model_dict)
 

Static Public Attributes

 client = instructor.patch(OpenAI())
 
string system_task_confirm_choices = "Find a button to confirm my choices"
 
string system_task_open_settings = "Find a button to open cookie settings"
 
string system_task_reject = "Find a button to reject the cookie policy"
 

Detailed Description

A client class for generating UI interaction rules using an AI model provided by OpenAI.

Attributes:
    client (OpenAI): An instance of the OpenAI client, patched for specific functionalities.
    system_task_reject (str): Description of the task to find a rejection button in the UI.
    system_task_open_settings (str): Description of the task to find a settings button.
    system_task_confirm_choices (str): Description of the task to find a confirmation button.

Member Function Documentation

◆ extract_model()

def extract_model (   self,
str  system_task,
str  content,
  response_model 
)
Sends a request to OpenAI's API to generate a response based on the provided system task and user content.

Args:
    system_task (str): The predefined task for the system to execute (e.g., finding a button).
    content (str): User-defined content that guides the AI in model generation.
    response_model (Model): The Pydantic model expected as the response structure.

Returns:
    The response from the OpenAI API as determined by the response_model.

◆ get_selector()

def get_selector (   self,
str  content 
)
Utilizes the extract_model method to get a CSS selector from the OpenAI model based on provided content.

Args:
    content (str): The content used to guide the AI in selecting the appropriate CSS selector.

Returns:
    str: The CSS selector as extracted from the model's response.

◆ save_model_as_json()

def save_model_as_json ( dict  model_dict)
static
Saves a model dictionary to a JSON file.

Args:
    model_dict (dict): The dictionary containing model data to be serialized.

Member Data Documentation

◆ client

client = instructor.patch(OpenAI())
static

◆ system_task_confirm_choices

string system_task_confirm_choices = "Find a button to confirm my choices"
static

◆ system_task_open_settings

string system_task_open_settings = "Find a button to open cookie settings"
static

◆ system_task_reject

string system_task_reject = "Find a button to reject the cookie policy"
static

The documentation for this class was generated from the following file: