async analyzeDocument(content, existingTags = [], existingCorrespondentList = [], id, customPrompt = null) {
        try {
            // Truncate content if needed
            content = this._truncateContent(content);
            
            // Build prompt
            let prompt;
            if(!customPrompt) {
                prompt = this._buildPrompt(content, existingTags, existingCorrespondentList);
            } else {
                prompt = customPrompt + "\n\n" + JSON.stringify(content);
                console.log('[DEBUG] Ollama Service started with custom prompt');
            }

            // Cache thumbnail
            await this._handleThumbnailCaching(id);
            
            // Generate custom fields for the prompt
            const customFieldsStr = this._generateCustomFieldsTemplate();
            
            // Generate system prompt
            const systemPrompt = this._generateSystemPrompt(customFieldsStr);
            
            // Calculate context window size
            const promptTokenCount = this._calculatePromptTokenCount(prompt);
            const numCtx = this._calculateNumCtx(promptTokenCount, 1024);
            
            // Call Ollama API
            const response = await this._callOllamaAPI(prompt, systemPrompt, numCtx, this.documentAnalysisSchema);
            
            // Process response
            const parsedResponse = this._processOllamaResponse(response);
            
            // Check for missing data
            if(parsedResponse.tags.length === 0 && parsedResponse.correspondent === null) {
                console.warn('No tags or correspondent found in response from Ollama for Document. Please review your prompt or switch to OpenAI for better results.');
            }
            
            // Log the prompt and response
            await this._logPromptAndResponse(prompt, parsedResponse);
            
            // Return results in consistent format
            return {
                document: parsedResponse,
                metrics: {
                    promptTokens: 0,  // Ollama doesn't provide token metrics
                    completionTokens: 0,
                    totalTokens: 0
                },
                truncated: false
            };
        } catch (error) {
            console.error('Error analyzing document with Ollama:', error);
            return {
                document: { tags: [], correspondent: null },
                metrics: null,
                error: error.message
            };
        }
    }
Analyze a document and extract metadata
@param {string} content - Document content
@param {Array} existingTags - List of existing tags
@param {Array} existingCorrespondentList - List of existing correspondents
@param {string} id - Document ID
@param {string} customPrompt - Custom prompt (optional)
@returns {Object} Analysis results