Back

July 17, 2024

5 mins read

Architectural Overview of RAG-Based AI Assist

Author Image

Ganesh Voona

Co-Founder

A detailed look at the technical design and workflow of stockinsights.ai’s RAG-based AI assistant for equity analysts.

Why It Matters

Investment research demands quick access to accurate data and swift decision-making. Analysts face challenges in sifting through large volumes of data from SEC filings, earnings reports, and other sources. stockinsights.ai’s RAG-based AI assistant enhances data accessibility, accelerates decision-making, and boosts productivity in investment research. By combining data retrieval with natural language generation, it delivers precise insights efficiently.

Key Components

The RAG model used in stockinsights.ai follows a structured data flow from query initiation to response delivery:

User Conversational Interface: The process begins when a user inputs a query. The system captures this query along with conversational history to understand the context.

Middleware: The query is processed to apply relevant filters and route the request to the appropriate data source. The middleware also formats the response generated by the AI model.

Generative AI: The AI system at stockinsights.ai accesses in-house vector databases and employs LLMs to process and respond to the query.

Generative AI Pipeline

The Generative AI pipeline at stockinsights.ai manages queries through several stages:

Contextualization: The system refines the query using chat history, domain and user context.

Query Decomposition: Complex queries may be broken down into sub-queries to address specific aspects more effectively.

Query Routing: The system directs the query to the appropriate knowledge bases (e.g., unstructured data like SEC filings, earnings call transcripts, investor presentations, tabular data such as financial statements and non-GAAP metrics) or external APIs (e.g., market news, stock prices).

Data Retrieval: Information is retrieved using semantic search, SQL queries, or API calls.

Response Processing: The system evaluates whether additional calculations or summarizations are needed.

Response Generation: The response is generated, formatted, and presented in a user-friendly manner.

Knowledge Base Management

The knowledge base at stockinsights.ai employs various strategies such as parsing and chunking to manage data effectively. We use fine-tuning and prompt engineering to enhance response accuracy. We'll explore these aspects in detail in a future blog.

Query Routing and Processing

Queries are routed based on their nature and requirements. For example:

- A query like "Which companies have increased sales by 30% compared to last quarter?" is routed to tabular data, where it is transformed into a SQL query for data retrieval.

- A query such as "What's the latest news about Tesla?" is directed to external APIs to obtain the latest market news.

- A query like "How is Walmart using Generative AI?" is sent to filings data to extract detailed insights from relevant reports.

Use-Cases

stockinsights.ai’s RAG-based AI assistant enhances investment research by improving discoverability, due diligence, and tracking through:

Data Aggregation: Rapidly consolidates information from diverse sources, such as SEC filings, earnings reports, and market news, to facilitate informed decision-making.

Comparative Analysis: Efficiently verifies company data, assesses compliance, and analyzes trends to ensure thorough and accurate investment evaluations.

The architecture of stockinsights.ai’s RAG-based AI assistant is designed to streamline investment research by improving data accessibility, decision-making speed, and overall productivity. By integrating advanced data retrieval mechanisms with sophisticated generative models, we provide analysts and investors with precise, actionable insights. As we refine and enhance our system, we aim to further boost its capabilities and responsiveness to meet the evolving needs of the investment community.