About OpenCone
OpenCone is a sophisticated, native iOS application designed to empower users with an on-device Retrieval Augmented Generation (RAG) system. It allows for seamless uploading and processing of various document types (PDFs, text files, Word documents, and even images via OCR). Once processed, text is extracted, intelligently chunked, and converted into vector embeddings using OpenAI's state-of-the-art models. These embeddings are then stored and indexed within a Pinecone serverless vector database.
The core utility of OpenCone lies in its ability to perform semantic searches across the user's entire document corpus. Users can ask natural language questions, and the system will retrieve the most relevant document segments. These segments are then used as context by OpenAI's completion models (like GPT-4o) to generate concise, accurate, and contextually relevant answers.
Built entirely with SwiftUI, OpenCone offers a modern, reactive user interface. It leverages Swift's async/await for concurrency and Combine for managing asynchronous events. The application features a custom, themable design system (OCDesignSystem) ensuring a polished and consistent user experience across its various features, including document management, search, detailed processing logs, and comprehensive settings.
Key Features of OpenCone
Document Management
Upload, view, and manage various document types (PDF, DOCX, TXT, images with OCR). Securely handles file access using bookmarks.
Advanced Processing Pipeline
Automated text extraction, strategic chunking (MIME-type specific), and robust error handling during document ingestion.
OpenAI Embeddings
Generates high-dimensional vector embeddings for text chunks using configurable OpenAI models (e.g., text-embedding-3-large).
Pinecone Integration
Full lifecycle management for Pinecone serverless indexes: create, list, select active index, and manage namespaces. Stores and indexes embeddings.
Semantic Search & RAG
Perform natural language queries. Retrieves semantically similar text chunks from Pinecone and uses them to generate AI answers via OpenAI.
Detailed Statistics
View comprehensive processing statistics per document, including phase timings, token counts, and chunk size distributions.
Custom Design & Theming
Features a bespoke UI library (OCDesignSystem) with OCButton, OCCard, OCBadge. Multiple themes (Light, Dark, Midnight, Forest).
Rich Settings
Securely configure API keys (OpenAI, Pinecone + Project ID), processing parameters (chunk size, overlap), and AI model selection.
Real-time Processing Logs
Detailed, filterable logs for all major operations (document processing, API calls, errors) with timestamps and context.
Guided Setup
User-friendly WelcomeView for initial API key configuration and app introduction.
iOS Native Experience
Built with SwiftUI for a responsive and platform-optimized experience on iPhone and iPad.
How OpenCone Works: Step-by-Step
OpenCone provides a seamless experience from setup to searching your documents. Here’s a typical user journey:
1. Launch & Setup
Upon first launch, or if API keys are not configured, the WelcomeView appears. Follow the prompts to enter your OpenAI API Key, Pinecone API Key, and Pinecone Project ID. These are essential for the app to function.
2. API Key Validation & Service Initialization
Keys are validated, and core services (OpenAIService, PineconeService, EmbeddingService) and ViewModels are initialized. The app then attempts to load available Pinecone indexes.
3. Main Interface (MainView)
After successful setup, the main tabbed interface is displayed, providing access to Documents, Search, Logs, and Settings.
4. Documents Tab (DocumentsView)
- Pinecone Configuration: Select an existing Pinecone index or create a new one. Optionally, manage namespaces within the index.
- Add Documents: Tap "Add File" to select files (PDF, TXT, DOCX, images) using the system document picker.
- Process Documents: Select documents and tap "Process." The app extracts text (using OCR for images), chunks it, generates vector embeddings via OpenAI, and uploads them to your Pinecone index.
- View Details: Tap "Details" on a document to see processing statistics like timings and token counts.
5. Search Tab (SearchView)
- Pinecone Configuration: Select the Pinecone index and namespace to search within.
- Enter Query: Type your natural language question.
- Perform Search: The query is embedded, and Pinecone retrieves semantically similar text chunks. OpenAI then generates a consolidated answer based on these sources (RAG).
- View Results: The AI-generated answer and the source document chunks are displayed.
6. Logs Tab (ProcessingView)
View a real-time stream of detailed logs for all operations. Filter logs by level or search by text content. Logs can be exported.
7. Settings Tab (SettingsView)
View and update API keys, adjust processing parameters (chunk size, overlap), select OpenAI models for embedding and completions, and change the app's visual theme.
For developers looking to run the app from source or contribute, please see the Getting Started guide on GitHub.
Tech Stack & Architecture
OpenCone is built with a modern and robust technology stack, ensuring a high-quality native iOS experience:
- Architectural Pattern: MVVM (Model-View-ViewModel) augmented by a dedicated Service Layer for clean separation of concerns.
- UI Framework: SwiftUI for all UI elements and layout, providing a reactive and modern interface.
- Concurrency: Swift async/await for asynchronous operations and Combine for reactive programming patterns.
- Core Technologies:
- OpenAI API: For generating text embeddings and AI-powered answers.
- Pinecone API: For serverless vector storage, indexing, and similarity search.
- Local Processing: PDFKit, VisionKit (for OCR), and NaturalLanguage framework for on-device document handling.
- Design & Theming: A custom OCDesignSystem with themable components (OCButton, OCCard, OCBadge) and multiple themes.
- Logging: A custom, centralized Logger service for comprehensive application monitoring.
Dive deeper into the architecture and project structure on the OpenCone GitHub repository.