backend.generation_api module¶
- async backend.generation_api.api_regenerate(section_name: str = Form(PydanticUndefined), section_text: str = Form(PydanticUndefined), syllabus: str = Form(PydanticUndefined), regulations: str = Form(PydanticUndefined), suggestions: str = Form(PydanticUndefined), threshold: int = Form(0)) Dict[str, Any]¶
Regenerate a section of a privacy policy using the existing regenerate function.
- Parameters:
section_name – the name of the section
section_text – the text of the section
syllabus – the syllabus for generating sections
regulations – the regulations to comply with
suggestions – the suggestions for improvement
threshold – the maximum number of attempts to regenerate
- Returns:
success or not and the regenerated section
- async backend.generation_api.generate(section_name: SectionNames = Form(PydanticUndefined), information: str = Form(PydanticUndefined), syllabus: str = Form(PydanticUndefined), regulations: str = Form(PydanticUndefined), threshold: int = Form(0)) Dict[str, Any]¶
Generate a section of a privacy policy
- Parameters:
section_name – the name of the section
information – the information for generating the section
syllabus – the syllabus for generating sections
regulations – the regulations to comply with
threshold – the maximum number of attempts to regenerate
- Returns:
success or not and the generated section
- async backend.generation_api.get_raw_syllabus_from_document(document: Document) str¶
Get a privacy policy syllabus from a document
- Parameters:
document – the llamaindex document
- Returns:
a privacy policy’s sections and key points
- async backend.generation_api.get_syllabus(regulations: str = Form(), upload_files: List[UploadFile] = File([])) Dict[str, List[str]]¶
Get a privacy policy syllabus
- Parameters:
regulations – the regulations to comply with
upload_files – the user uploaded files
- Returns:
a privacy policy syllabus
- async backend.generation_api.regenerate(section_name: str, section_text: str, syllabus: Dict[str, List[str]], regulations: str, suggestions: str, threshold: int = 5)¶
Regenerate a section of a privacy policy
- Parameters:
section_name – the name of the section
section_text – the text of the section
syllabus – the syllabus for generating sections
regulations – the regulations to comply with
suggestions – the suggestions for improvement
threshold – the maximum number of attempts to regenerate
- Returns:
success or not and the regenerated section
- backend.generation_api.retry_on_exception(retries: int = 5, delay: float = 1.0)¶
Retry on exception decorator
- Parameters:
retries – the number of retries
delay – the delay between retries
- Returns:
a retry decorator
- async backend.generation_api.select_regulations(areas: str = Form(PydanticUndefined))¶
Select regulations based on the areas of services
- Parameters:
areas – the areas of services
- Returns:
a list of selected regulations, regions, and links