MongoDB repository classes for structured data access in the Weam AI system.

Usage Pattern

All repository classes follow the same pattern:
  1. Call initialization() with required parameters
  2. Invoke the respective _fetch_... method

Repository Classes

CompanyRepository

_fetch_company_data

Retrieves company metadata from MongoDB using _id. Parameters:
  • company_id: str
  • collection_name: str
repo = CompanyRepository()
repo.initialization(company_id="123456", collection_name="companies")
company_data = repo._fetch_company_data()

ChatSessionRepository

_fetch_chat_session_model_data

Retrieves chat session data from MongoDB using _id. Parameters:
  • company_id: str
  • collection_name: str
repo = ChatSessionRepository()
repo.initialization(company_id="123456", collection_name="chatsessions")
session_data = repo._fetch_chat_session_model_data()

LLMModelRepository

_fetch_company_model_data

Retrieves LLM configuration data using API key identifier. Parameters:
  • api_key_id: str
  • collection_name: str
repo = LLMModelRepository()
repo.initialization(api_key_id="apikey-abc", collection_name="llm-models")
llm_config = repo._fetch_company_model_data()

EmbeddingModelRepository

_fetch_company_model_data

Fetches embedding model configurations and vector settings. Parameters:
  • api_key_id: str
  • collection_name: str
repo = EmbeddingModelRepository()
repo.initialization(api_key_id="apikey-abc", collection_name="embedding-models")
embedding_config = repo._fetch_company_model_data()

FileRepository

_fetch_file_model_data

Retrieves file metadata for user or system files. Parameters:
  • file_id: str
  • collection_name: str
repo = FileRepository()
repo.initialization(file_id="file-123", collection_name="files")
file_data = repo._fetch_file_model_data()

ChatMemberRepository

_fetch_chat_member_model_data

Fetches chat participant data for session management. Parameters:
  • chat_session_id: str
  • collection_name: str
repo = ChatMemberRepository()
repo.initialization(chat_session_id="chat-789", collection_name="chat-members")
member_data = repo._fetch_chat_member_model_data()

Implementation Notes

  • Always call initialization() before using _fetch_... methods
  • Methods return native Python dictionaries from MongoDB
  • Error handling should be implemented in calling code
  • These are low-level data access methods for internal use
For higher-level APIs, refer to the API reference.