Home / Portfolio / FileIQ - Document Intelligence Bot
Backend / API

FileIQ - Document Intelligence Bot

January 2024 3 months Full Stack Developer & AI Engineer
98%
Accuracy Rate
3s
Avg Response Time
24/7
AI Availability

Overview

FileIQ is a sophisticated document intelligence platform that leverages advanced AI models to help users extract insights from their documents.

The Challenge

Professionals spend countless hours manually searching through documents to find specific information.

The Solution

FileIQ implements a Retrieval-Augmented Generation (RAG) pipeline for natural language document interaction.

Key Features

  • Multi-format document support (PDF, DOCX, TXT)
  • Natural language question answering with context
  • Source citations with document references
  • Conversation memory across sessions
  • Document comparison capabilities
  • Real-time streaming responses via WebSockets
  • Multi-LLM provider support (DeepSeek, GLM, OpenAI)
  • Secure user authentication and document isolation
  • Export chat history as text file
  • Responsive Bootstrap 5 interface

Technical Implementation

RAG Pipeline with DeepSeek AI

Implementation of Retrieval-Augmented Generation using DeepSeek's API

PYTHON
class RAGEngine:
    def __init__(self):
        self.client = openai.OpenAI(
            base_url=settings.DEEPSEEK_BASE_URL,
            api_key=settings.DEEPSEEK_API_KEY,
        )
    
    def get_relevant_chunks(self, query, user_id, top_k=5):
        query_embedding = self.get_embedding(query)
        chunks = DocumentChunk.objects.filter(
            document__user_id=user_id
        ).annotate(
            distance=CosineDistance('embedding', query_embedding)
        ).order_by('distance')[:top_k]
        return [{
            'content': chunk.content,
            'document_title': chunk.document.title,
            'score': 1 - chunk.distance
        } for chunk in chunks]

WebSocket Streaming for Real-time Chat

Implementation of Django Channels with WebSocket support

PYTHON
class ChatConsumer(AsyncWebsocketConsumer):
    async def receive(self, text_data):
        data = json.loads(text_data)
        query = data['query']
        async for token in rag.stream_query_async(query):
            await self.send(text_data=json.dumps({
                'type': 'token',
                'content': token
            }))
        await self.send(text_data=json.dumps({'type': 'done'}))

Document Processing Pipeline

Automatic text extraction and chunking for uploaded documents

PYTHON
def process_document(file_content, filename):
    if filename.endswith('.pdf'):
        reader = PdfReader(io.BytesIO(file_content))
        text = '\n'.join([page.extract_text() for page in reader.pages])
    elif filename.endswith('.docx'):
        doc = Document(io.BytesIO(file_content))
        text = '\n'.join([para.text for para in doc.paragraphs])
    else:
        text = file_content.decode('utf-8')
    chunks = chunk_text(text, chunk_size=1000, overlap=200)
    for idx, chunk in enumerate(chunks):
        embedding = get_embedding(chunk)
        DocumentChunk.objects.create(
            content=chunk,
            chunk_index=idx,
            embedding=embedding
        )

Documentation

User Guide

Step-by-step guide for uploading documents and using chat features

Read Documentation

API Documentation

Complete API reference for integrating with FileIQ

Read Documentation

Deployment Guide

How to deploy FileIQ on Coolify or other platforms

Read Documentation

Results & Impact

  • 98% accuracy in document question answering tasks
  • Average response time under 3 seconds for 500+ page documents
  • Successfully processes documents up to 100MB
  • Zero data loss with PostgreSQL persistence
  • Supports concurrent users with Redis caching
  • Deployed successfully on Coolify platform