Core services for MongoDB access, error handling, encryption, notifications, and model defaults.
MongoDBClient
__init__
DB_USERNAME
DB_PASSWORD
DB_HOST
(default: localhost
)DB_PORT
(default: 27017
)DB_DATABASE
(default: customai
)DB_CONNECTION
(default: mongodb
)get_database
db_name
(optional): custom database nameMongoDBCallbackHandler
on_llm_end
response
: LLMResult
object from the modelmongodb_connection_error_handler
ServerSelectionTimeoutError
get_db_instance
db_name
(optional)MessageEncryptor
encrypt(plaintext: str) -> str
: Encrypts text to Base64-encoded ciphertext.MessageDecryptor
decrypt(ciphertext: str) -> str
: Decrypts Base64 string back to plaintext.get_user_data(user_id: str) -> dict
DefaultGeminiModelRepository
get_default_model_key()
get_encrypt_key()
get_decrypt_key()
DefaultAnthropicModelRepository
get_default_model_key()
get_encrypt_key()
get_decrypt_key()
DefaultOpenAIModelRepository
get_default_model_key()
EmailService
send_email(...)
: Sends templated email via configured provider.EMAIL_PROVIDER
environment variable.Firebase
send_push_notification(tokens: list, title: str, body: str = None)
LLMAPIKeyDecryptionHandler
initialization(api_key_id: str, collection_name: str)
decrypt() -> bytes
StreamingResponseWithStatusCode
StreamingResponse
.
stream_response(send)
: Streams and sets status code mid-stream