/ restai / constants.py
constants.py
 1  from enum import Enum
 2  
 3  class ERROR_MESSAGES(str, Enum):
 4      def __str__(self) -> str:
 5          return super().__str__()
 6  
 7      DEFAULT = (
 8          lambda err="": f'{"Something went wrong :/" if err == "" else "[ERROR: " + str(err) + "]"}'
 9      )
10      ENV_VAR_NOT_FOUND = "Required environment variable not found. Terminating now."
11      CREATE_USER_ERROR = "Oops! Something went wrong while creating your account. Please try again later. If the issue persists, contact support for assistance."
12      DELETE_USER_ERROR = "Oops! Something went wrong. We encountered an issue while trying to delete the user. Please give it another shot."
13      EMAIL_MISMATCH = "Uh-oh! This email does not match the email your provider is registered with. Please check your email and try again."
14      EMAIL_TAKEN = "Uh-oh! This email is already registered. Sign in with your existing account or choose another email to start anew."
15      USERNAME_TAKEN = (
16          "Uh-oh! This username is already registered. Please choose another username."
17      )
18      FILE_EXISTS = "Uh-oh! This file is already registered. Please choose another file."
19  
20      INVALID_TOKEN = (
21          "Your session has expired or the token is invalid. Please sign in again."
22      )
23      INVALID_CRED = "The email or password provided is incorrect. Please check for typos and try logging in again."
24      INVALID_EMAIL_FORMAT = "The email format you entered is invalid. Please double-check and make sure you're using a valid email address (e.g., yourname@example.com)."
25  
26      UNAUTHORIZED = "401 Unauthorized"
27      ACCESS_PROHIBITED = "You do not have permission to access this resource. Please contact your administrator for assistance."
28  
29      FILE_NOT_SENT = "FILE_NOT_SENT"
30      FILE_NOT_SUPPORTED = "Oops! It seems like the file format you're trying to upload is not supported. Please upload a file with a supported format and try again."
31  
32      NOT_FOUND = "We could not find what you're looking for :/"
33      TEAM_NOT_FOUND = "The team you're looking for could not be found."
34      TEAM_NAME_TAKEN = "This team name is already in use. Please choose a different name."
35      NOT_TEAM_ADMIN = "You do not have administrative privileges for this team."
36      NOT_TEAM_MEMBER = "You are not a member of this team."
37  
38      PANDOC_NOT_INSTALLED = "Pandoc is not installed on the server. Please contact your administrator for assistance."
39      INCORRECT_FORMAT = (
40          lambda err="": f"Invalid format. Please use the correct format{err}"
41      )
42      RATE_LIMIT_EXCEEDED = "API rate limit exceeded"
43  
44      MODEL_NOT_FOUND = lambda name="": f"Model '{name}' was not found"
45      OPENAI_NOT_FOUND = lambda name="": "OpenAI API was not found"
46      CREATE_API_KEY_ERROR = "Oops! Something went wrong while creating your API key. Please try again later. If the issue persists, contact support for assistance."
47      API_KEY_CREATION_NOT_ALLOWED = "API key creation is not allowed in the environment."
48  
49      EMPTY_CONTENT = "The content provided is empty. Please ensure that there is text or data present before proceeding."
50  
51      INVALID_URL = (
52          "Oops! The URL you provided is invalid. Please double-check and try again."
53      )
54  
55      FILE_TOO_LARGE = (
56          lambda size="": f"Oops! The file you're trying to upload is too large. Please upload a file that is less than {size}."
57      )
58  
59      DUPLICATE_CONTENT = (
60          "Duplicate content detected. Please provide unique content to proceed."
61      )
62      FILE_NOT_PROCESSED = "Extracted content is not available for this file. Please ensure that the file is processed before proceeding."
63  
64      INTERNAL_ERROR = "Internal server error"
65      PROJECT_NOT_FOUND = "Project not found"
66      LLM_NOT_FOUND = "LLM not found"
67      EMBEDDING_NOT_FOUND = "Embedding not found"
68      USER_NOT_FOUND = "User not found"
69      LDAP_AUTH_FAILED = "LDAP authentication failed"
70      CLASSIFICATION_FAILED = "Classification failed"