How 079035/nascent-rag works
Main Components
• Client Interface: Represented by the main.py, which acts as the entry point that prompts users for inputs (stock ticker and query) and coordinates operations.
• Pipeline Module: Under the src/pipeline directory, there are two specialized modules:
• news_fetcher.py (fetches news data likely through an external API using the RAPIDAPI_KEY)
• transcript_fetcher.py (handles transcript data)
• RAG Module: Under the src/rag directory, which includes:
• elasticsearch_handler.py (responsible for interactions with the Elasticsearch backend)
• query_service.py (manages query operations that leverage the Elasticsearch-indexed data)
• Data Storage / Search Engine: Elasticsearch (an external service) that indexes the fetched data and supports the sentence-based embedding search.
• Containerization & Deployment: Dockerfile, docker-compose.yml, and build.sh illustrate that the system is containerized and deployed using Docker Compose.
• Testing Suite: The tests directory which confirms unit and integration testing for components like news, transcripts, embeddings, query services, and Elasticsearch.
Relationships and Interactions
• The client (main.py) triggers the data retrieval process by interacting with the pipeline components (news_fetcher and transcript_fetcher) which are responsible for fetching data using external APIs.
• Once data is fetched, it is processed and sent to the Elasticsearch backend via the elasticsearch_handler for indexing.
• When the user submits a query, the main.py interacts with the query_service which in turn retrieves relevant data from Elasticsearch.
• Docker Compose manages the orchestration of these containers ensuring that services (such as the Elasticsearch instance and the application container) are running cohesively.
Architectural Patterns and Design Principles
• Separation of Concerns: Clear division between data retrieval (pipeline) and data querying (rag).
• Modular Design: Each module (fetchers, Elasticsearch handlers, query service) encapsulates its responsibilities for easier testing (as indicated by the tests directory) and maintenance.
• Containerized Deployment: Use of Docker ensures that the components (possibly even an Elasticsearch container) run in isolated environments that simplify deployment and scalability.
• Interactive Terminal-Based Operation: Although simple, this design focuses on a clean separation between the interactive client component (main.py) and backend processing.