Layered of System Architecture
Definition
The proposed system leverages RAG with additional layers for enhanced data retrieval, contextual awareness, and ethical content filtering. This system:
Integrates structured and unstructured data using a local vector database for real-time knowledge updates.
Employs content-filtering LLM prompts to ensure safety and compliance.
Uses dynamic prompts and external API integrations for domain-specific data queries, including real-time cryptocurrency prices, historical OHLCV data, and market trend analysis.
Content Filter Layer
This layer is the first checkpoint for incoming user queries. It uses a large language model (LLM) with a specialized content-filter prompt to detect inappropriate content, including:
Toxicity: Offensive or harmful language.
NSFW: Not Safe for Work content.
NSFL: Not Safe for Life content.
If the content is deemed inappropriate, the system respectfully declines the request and notifies the user. Otherwise, it passes the query forward for processing.
2. Retrieval-Augmented Generation (RAG)
The heart of the system, the RAG module combines retrieval capabilities with generative AI to produce contextually relevant and accurate responses. Key components include:
Market Assessment Prompt: Queries market-specific data (e.g., cryptocurrency trends, historical OHLCV data) from the local vector database or external knowledge bases.
Context Awareness Prompt: Uses conversational history to refine responses, ensuring continuity and personalization in interactions.
Market Assessment Prompts:
Leverage external APIs and databases for real-time financial insights.
Support for cryptocurrency-specific use cases such as trending gainers/losers or market cap analysis.
3. Data Retrieval and Knowledge Integration
The RAG module interacts with both structured and unstructured data sources via:
Local Vector Database:
Stores pre-indexed embeddings of structured and unstructured knowledge for fast retrieval.
Serves as a bridge between real-time queries and the external knowledge base.
External Knowledge Base:
Houses historical and domain-specific data, enabling comprehensive responses.
Integrates with APIs to fetch real-time updates (e.g., cryptocurrency prices, trading volume).
JSON Analysis Layer
+ For data-heavy requests, the system employs an LLM-based JSON analyzer to parse structured inputs. The workflow includes:
+ Using a JSON prompt for structured data (e.g., historical OHLCV data for cryptocurrencies).
+ Producing machine-readable outputs for further processing, such as JSON files for technical analysis.
Call Function Module
Handles external data fetching via real-time APIs and supports functions such as:
+ Web search API
+ Cryptocurrency data retrieval APIs (e.g. prices, chart data, and news).
+ Analysis of domain-specific data.
Response Generation and Real-Time Websocket
Once the RAG module synthesizes data, responses are sent to the user via a real-time websocket. This ensures:
+ Low latency communication.
+ Human-readable, concise, and actionable insights.
+ Dynamic adjustments to context or follow-up questions.
By combining RAG with content filtering and hybrid data retrieval, the system ensures accurate, safe, and responsive interactions for users in high-stakes industries such as cryptocurrency and finance
Last updated