From 4743e775c83b7ae749de10e8a6aacbec142b3b98 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 08:58:17 +0200 Subject: [PATCH 01/68] docs: add AI index model & prompt benchmark Controlled comparison of 8 local GGUF models x 2 prompt versions for the plugin's .ai.md code-summarization task (config+provider scope, 16K context, CPU / Ryzen 7 5800H), plus the full-project 30B baseline. 17 output trees (431 .ai.md) under docs/ai-index-benchmark/outputs with COMPARISON.md (scored matrix, findings, recommendation) and README.md (methodology + reproduce commands). Key findings: - No reasoning leakage or keyword hallucination in any cell (llama.cpp strips Qwen and gpt-oss harmony server-side; output is clean). - Qwen3-Coder-30B-A3B validated as the default; Granite-4.0-H-Tiny is the standout new pick (~4x faster, Apache-2.0, accurate). - Prompt v2 cuts verbosity/accessor bloat but regresses with code fences on code-specialized models -> not yet shippable. - Reasoning/thinking is a pure throughput tax here (non-thinking models win). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/COMPARISON.md | 121 ++++++++++++++++++ docs/ai-index-benchmark/README.md | 62 +++++++++ .../config/AiFieldGenerationConfig.java.ai.md | 72 +++++++++++ .../AiFieldGenerationSelector.java.ai.md | 48 +++++++ .../config/AiGenerationConfig.java.ai.md | 77 +++++++++++ .../config/AiGenerationKind.java.ai.md | 39 ++++++ .../config/AiModelDefinition.java.ai.md | 99 ++++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 53 ++++++++ .../llamacpp/aiindex/config/package.ai.md | 53 ++++++++ .../maven/llamacpp/aiindex/package.ai.md | 98 ++++++++++++++ .../provider/AiCompletionParser.java.ai.md | 57 +++++++++ .../provider/AiGenerationProvider.java.ai.md | 46 +++++++ .../AiGenerationProviderFactory.java.ai.md | 56 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 58 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 79 ++++++++++++ .../MockAiGenerationProvider.java.ai.md | 52 ++++++++ .../llamacpp/aiindex/provider/package.ai.md | 77 +++++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 58 +++++++++ .../java/net/ladenthin/maven/package.ai.md | 58 +++++++++ .../main/java/net/ladenthin/package.ai.md | 58 +++++++++ .../main/java/net/package.ai.md | 58 +++++++++ .../main/java/package.ai.md | 58 +++++++++ .../main/package.ai.md | 58 +++++++++ .../package.ai.md | 58 +++++++++ .../project.ai.md | 43 +++++++ .../config/AiFieldGenerationConfig.java.ai.md | 53 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 60 +++++++++ .../config/AiGenerationConfig.java.ai.md | 56 ++++++++ .../config/AiGenerationKind.java.ai.md | 41 ++++++ .../config/AiModelDefinition.java.ai.md | 112 ++++++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 54 ++++++++ .../llamacpp/aiindex/config/package.ai.md | 47 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 43 +++++++ .../provider/AiCompletionParser.java.ai.md | 48 +++++++ .../provider/AiGenerationProvider.java.ai.md | 47 +++++++ .../AiGenerationProviderFactory.java.ai.md | 51 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 52 ++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 88 +++++++++++++ .../MockAiGenerationProvider.java.ai.md | 46 +++++++ .../llamacpp/aiindex/provider/package.ai.md | 58 +++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 42 ++++++ .../java/net/ladenthin/maven/package.ai.md | 42 ++++++ .../main/java/net/ladenthin/package.ai.md | 42 ++++++ .../main/java/net/package.ai.md | 42 ++++++ .../main/java/package.ai.md | 42 ++++++ .../main/package.ai.md | 42 ++++++ .../package.ai.md | 42 ++++++ .../project.ai.md | 43 +++++++ .../config/AiFieldGenerationConfig.java.ai.md | 51 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 46 +++++++ .../config/AiGenerationConfig.java.ai.md | 77 +++++++++++ .../config/AiGenerationKind.java.ai.md | 35 +++++ .../config/AiModelDefinition.java.ai.md | 50 ++++++++ .../AiModelDefinitionSupport.java.ai.md | 59 +++++++++ .../llamacpp/aiindex/config/package.ai.md | 55 ++++++++ .../maven/llamacpp/aiindex/package.ai.md | 58 +++++++++ .../provider/AiCompletionParser.java.ai.md | 51 ++++++++ .../provider/AiGenerationProvider.java.ai.md | 50 ++++++++ .../AiGenerationProviderFactory.java.ai.md | 54 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 65 ++++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 75 +++++++++++ .../MockAiGenerationProvider.java.ai.md | 50 ++++++++ .../llamacpp/aiindex/provider/package.ai.md | 59 +++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 57 +++++++++ .../java/net/ladenthin/maven/package.ai.md | 54 ++++++++ .../main/java/net/ladenthin/package.ai.md | 54 ++++++++ .../main/java/net/package.ai.md | 55 ++++++++ .../main/java/package.ai.md | 56 ++++++++ .../ai__gptoss-20b__v1/main/package.ai.md | 54 ++++++++ .../outputs/ai__gptoss-20b__v1/package.ai.md | 54 ++++++++ .../outputs/ai__gptoss-20b__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 54 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 46 +++++++ .../config/AiGenerationConfig.java.ai.md | 62 +++++++++ .../config/AiGenerationKind.java.ai.md | 13 ++ .../config/AiModelDefinition.java.ai.md | 105 +++++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 45 +++++++ .../llamacpp/aiindex/config/package.ai.md | 51 ++++++++ .../maven/llamacpp/aiindex/package.ai.md | 55 ++++++++ .../provider/AiCompletionParser.java.ai.md | 41 ++++++ .../provider/AiGenerationProvider.java.ai.md | 41 ++++++ .../AiGenerationProviderFactory.java.ai.md | 44 +++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 50 ++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 54 ++++++++ .../MockAiGenerationProvider.java.ai.md | 40 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 58 +++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 52 ++++++++ .../java/net/ladenthin/maven/package.ai.md | 11 ++ .../main/java/net/ladenthin/package.ai.md | 11 ++ .../main/java/net/package.ai.md | 38 ++++++ .../main/java/package.ai.md | 38 ++++++ .../ai__gptoss-20b__v2/main/package.ai.md | 38 ++++++ .../outputs/ai__gptoss-20b__v2/package.ai.md | 38 ++++++ .../outputs/ai__gptoss-20b__v2/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 53 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 53 ++++++++ .../config/AiGenerationConfig.java.ai.md | 84 ++++++++++++ .../config/AiGenerationKind.java.ai.md | 53 ++++++++ .../config/AiModelDefinition.java.ai.md | 69 ++++++++++ .../AiModelDefinitionSupport.java.ai.md | 43 +++++++ .../llamacpp/aiindex/config/package.ai.md | 57 +++++++++ .../maven/llamacpp/aiindex/package.ai.md | 74 +++++++++++ .../provider/AiCompletionParser.java.ai.md | 43 +++++++ .../provider/AiGenerationProvider.java.ai.md | 39 ++++++ .../AiGenerationProviderFactory.java.ai.md | 39 ++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 53 ++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 64 +++++++++ .../MockAiGenerationProvider.java.ai.md | 43 +++++++ .../llamacpp/aiindex/provider/package.ai.md | 59 +++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 73 +++++++++++ .../java/net/ladenthin/maven/package.ai.md | 73 +++++++++++ .../main/java/net/ladenthin/package.ai.md | 73 +++++++++++ .../main/java/net/package.ai.md | 73 +++++++++++ .../main/java/package.ai.md | 73 +++++++++++ .../main/package.ai.md | 73 +++++++++++ .../ai__granite4-h-tiny__v1/package.ai.md | 73 +++++++++++ .../ai__granite4-h-tiny__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 60 +++++++++ .../AiFieldGenerationSelector.java.ai.md | 55 ++++++++ .../config/AiGenerationConfig.java.ai.md | 78 +++++++++++ .../config/AiGenerationKind.java.ai.md | 40 ++++++ .../config/AiModelDefinition.java.ai.md | 71 ++++++++++ .../AiModelDefinitionSupport.java.ai.md | 47 +++++++ .../llamacpp/aiindex/config/package.ai.md | 66 ++++++++++ .../maven/llamacpp/aiindex/package.ai.md | 62 +++++++++ .../provider/AiCompletionParser.java.ai.md | 44 +++++++ .../provider/AiGenerationProvider.java.ai.md | 41 ++++++ .../AiGenerationProviderFactory.java.ai.md | 45 +++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 57 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 53 ++++++++ .../MockAiGenerationProvider.java.ai.md | 41 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 56 ++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 11 ++ .../java/net/ladenthin/maven/package.ai.md | 41 ++++++ .../main/java/net/ladenthin/package.ai.md | 41 ++++++ .../main/java/net/package.ai.md | 41 ++++++ .../main/java/package.ai.md | 41 ++++++ .../main/package.ai.md | 41 ++++++ .../ai__granite4-h-tiny__v2/package.ai.md | 41 ++++++ .../ai__granite4-h-tiny__v2/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 78 +++++++++++ .../AiFieldGenerationSelector.java.ai.md | 44 +++++++ .../config/AiGenerationConfig.java.ai.md | 109 ++++++++++++++++ .../config/AiGenerationKind.java.ai.md | 21 +++ .../config/AiModelDefinition.java.ai.md | 109 ++++++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 62 +++++++++ .../llamacpp/aiindex/config/package.ai.md | 48 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 41 ++++++ .../provider/AiCompletionParser.java.ai.md | 47 +++++++ .../provider/AiGenerationProvider.java.ai.md | 37 ++++++ .../AiGenerationProviderFactory.java.ai.md | 61 +++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 64 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 83 ++++++++++++ .../MockAiGenerationProvider.java.ai.md | 46 +++++++ .../llamacpp/aiindex/provider/package.ai.md | 50 ++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 40 ++++++ .../java/net/ladenthin/maven/package.ai.md | 40 ++++++ .../main/java/net/ladenthin/package.ai.md | 40 ++++++ .../main/java/net/package.ai.md | 40 ++++++ .../main/java/package.ai.md | 40 ++++++ .../ai__qwen25coder-7b__v1/main/package.ai.md | 40 ++++++ .../ai__qwen25coder-7b__v1/package.ai.md | 40 ++++++ .../ai__qwen25coder-7b__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 48 +++++++ .../AiFieldGenerationSelector.java.ai.md | 44 +++++++ .../config/AiGenerationConfig.java.ai.md | 71 ++++++++++ .../config/AiGenerationKind.java.ai.md | 23 ++++ .../config/AiModelDefinition.java.ai.md | 89 +++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 53 ++++++++ .../llamacpp/aiindex/config/package.ai.md | 46 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 46 +++++++ .../provider/AiCompletionParser.java.ai.md | 40 ++++++ .../provider/AiGenerationProvider.java.ai.md | 42 ++++++ .../AiGenerationProviderFactory.java.ai.md | 24 ++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 55 ++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 72 +++++++++++ .../MockAiGenerationProvider.java.ai.md | 32 +++++ .../llamacpp/aiindex/provider/package.ai.md | 44 +++++++ .../ladenthin/maven/llamacpp/package.ai.md | 45 +++++++ .../java/net/ladenthin/maven/package.ai.md | 45 +++++++ .../main/java/net/ladenthin/package.ai.md | 45 +++++++ .../main/java/net/package.ai.md | 45 +++++++ .../main/java/package.ai.md | 45 +++++++ .../ai__qwen25coder-7b__v2/main/package.ai.md | 45 +++++++ .../ai__qwen25coder-7b__v2/package.ai.md | 45 +++++++ .../ai__qwen25coder-7b__v2/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 57 +++++++++ .../AiFieldGenerationSelector.java.ai.md | 53 ++++++++ .../config/AiGenerationConfig.java.ai.md | 64 +++++++++ .../config/AiGenerationKind.java.ai.md | 40 ++++++ .../config/AiModelDefinition.java.ai.md | 86 +++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 52 ++++++++ .../llamacpp/aiindex/config/package.ai.md | 49 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 52 ++++++++ .../provider/AiCompletionParser.java.ai.md | 46 +++++++ .../provider/AiGenerationProvider.java.ai.md | 48 +++++++ .../AiGenerationProviderFactory.java.ai.md | 50 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 63 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 83 ++++++++++++ .../MockAiGenerationProvider.java.ai.md | 40 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 59 +++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 51 ++++++++ .../java/net/ladenthin/maven/package.ai.md | 50 ++++++++ .../main/java/net/ladenthin/package.ai.md | 50 ++++++++ .../main/java/net/package.ai.md | 50 ++++++++ .../main/java/package.ai.md | 50 ++++++++ .../ai__qwen3-4b-2507__v1/main/package.ai.md | 50 ++++++++ .../ai__qwen3-4b-2507__v1/package.ai.md | 50 ++++++++ .../ai__qwen3-4b-2507__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 50 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 44 +++++++ .../config/AiGenerationConfig.java.ai.md | 70 ++++++++++ .../config/AiGenerationKind.java.ai.md | 40 ++++++ .../config/AiModelDefinition.java.ai.md | 55 ++++++++ .../AiModelDefinitionSupport.java.ai.md | 43 +++++++ .../llamacpp/aiindex/config/package.ai.md | 50 ++++++++ .../maven/llamacpp/aiindex/package.ai.md | 63 +++++++++ .../provider/AiCompletionParser.java.ai.md | 42 ++++++ .../provider/AiGenerationProvider.java.ai.md | 41 ++++++ .../AiGenerationProviderFactory.java.ai.md | 43 +++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 48 +++++++ .../provider/LlamaCppJniConfig.java.ai.md | 75 +++++++++++ .../MockAiGenerationProvider.java.ai.md | 40 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 49 +++++++ .../ladenthin/maven/llamacpp/package.ai.md | 61 +++++++++ .../java/net/ladenthin/maven/package.ai.md | 61 +++++++++ .../main/java/net/ladenthin/package.ai.md | 61 +++++++++ .../main/java/net/package.ai.md | 61 +++++++++ .../main/java/package.ai.md | 61 +++++++++ .../ai__qwen3-4b-2507__v2/main/package.ai.md | 61 +++++++++ .../ai__qwen3-4b-2507__v2/package.ai.md | 61 +++++++++ .../ai__qwen3-4b-2507__v2/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 59 +++++++++ .../AiFieldGenerationSelector.java.ai.md | 46 +++++++ .../config/AiGenerationConfig.java.ai.md | 82 ++++++++++++ .../config/AiGenerationKind.java.ai.md | 33 +++++ .../config/AiModelDefinition.java.ai.md | 88 +++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 47 +++++++ .../llamacpp/aiindex/config/package.ai.md | 51 ++++++++ .../maven/llamacpp/aiindex/package.ai.md | 47 +++++++ .../provider/AiCompletionParser.java.ai.md | 41 ++++++ .../provider/AiGenerationProvider.java.ai.md | 48 +++++++ .../AiGenerationProviderFactory.java.ai.md | 41 ++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 52 ++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 55 ++++++++ .../MockAiGenerationProvider.java.ai.md | 43 +++++++ .../llamacpp/aiindex/provider/package.ai.md | 52 ++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 46 +++++++ .../java/net/ladenthin/maven/package.ai.md | 46 +++++++ .../main/java/net/ladenthin/package.ai.md | 46 +++++++ .../main/java/net/package.ai.md | 46 +++++++ .../ai__qwen35-4b__v1/main/java/package.ai.md | 46 +++++++ .../ai__qwen35-4b__v1/main/package.ai.md | 46 +++++++ .../outputs/ai__qwen35-4b__v1/package.ai.md | 46 +++++++ .../outputs/ai__qwen35-4b__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 48 +++++++ .../AiFieldGenerationSelector.java.ai.md | 44 +++++++ .../config/AiGenerationConfig.java.ai.md | 76 +++++++++++ .../config/AiGenerationKind.java.ai.md | 38 ++++++ .../config/AiModelDefinition.java.ai.md | 76 +++++++++++ .../AiModelDefinitionSupport.java.ai.md | 44 +++++++ .../llamacpp/aiindex/config/package.ai.md | 50 ++++++++ .../maven/llamacpp/aiindex/package.ai.md | 48 +++++++ .../provider/AiCompletionParser.java.ai.md | 42 ++++++ .../provider/AiGenerationProvider.java.ai.md | 46 +++++++ .../AiGenerationProviderFactory.java.ai.md | 44 +++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 57 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 50 ++++++++ .../MockAiGenerationProvider.java.ai.md | 40 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 54 ++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 47 +++++++ .../java/net/ladenthin/maven/package.ai.md | 47 +++++++ .../main/java/net/ladenthin/package.ai.md | 47 +++++++ .../main/java/net/package.ai.md | 47 +++++++ .../ai__qwen35-4b__v2/main/java/package.ai.md | 47 +++++++ .../ai__qwen35-4b__v2/main/package.ai.md | 47 +++++++ .../outputs/ai__qwen35-4b__v2/package.ai.md | 47 +++++++ .../outputs/ai__qwen35-4b__v2/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 49 +++++++ .../AiFieldGenerationSelector.java.ai.md | 53 ++++++++ .../config/AiGenerationConfig.java.ai.md | 84 ++++++++++++ .../config/AiGenerationKind.java.ai.md | 40 ++++++ .../config/AiModelDefinition.java.ai.md | 81 ++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 42 ++++++ .../llamacpp/aiindex/config/package.ai.md | 49 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 49 +++++++ .../provider/AiCompletionParser.java.ai.md | 43 +++++++ .../provider/AiGenerationProvider.java.ai.md | 46 +++++++ .../AiGenerationProviderFactory.java.ai.md | 53 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 57 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 51 ++++++++ .../MockAiGenerationProvider.java.ai.md | 47 +++++++ .../llamacpp/aiindex/provider/package.ai.md | 56 ++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 48 +++++++ .../java/net/ladenthin/maven/package.ai.md | 48 +++++++ .../main/java/net/ladenthin/package.ai.md | 48 +++++++ .../main/java/net/package.ai.md | 48 +++++++ .../main/java/package.ai.md | 48 +++++++ .../ai__qwen3coder-30b__v1/main/package.ai.md | 48 +++++++ .../ai__qwen3coder-30b__v1/package.ai.md | 48 +++++++ .../ai__qwen3coder-30b__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 62 +++++++++ .../AiFieldGenerationSelector.java.ai.md | 52 ++++++++ .../config/AiGenerationConfig.java.ai.md | 85 ++++++++++++ .../config/AiGenerationKind.java.ai.md | 36 ++++++ .../config/AiModelDefinition.java.ai.md | 78 +++++++++++ .../AiModelDefinitionSupport.java.ai.md | 41 ++++++ .../aiindex/config/package-info.java.ai.md | 42 ++++++ .../llamacpp/aiindex/config/package.ai.md | 54 ++++++++ .../document/AiGenerationRequest.java.ai.md | 43 +++++++ .../document/AiGenerationResult.java.ai.md | 44 +++++++ .../AiMdChildEntryLineFormatter.java.ai.md | 42 ++++++ .../aiindex/document/AiMdDocument.java.ai.md | 56 ++++++++ .../document/AiMdDocumentCodec.java.ai.md | 52 ++++++++ .../aiindex/document/AiMdHeader.java.ai.md | 51 ++++++++ .../document/AiMdHeaderCodec.java.ai.md | 58 +++++++++ .../document/AiMdHeaderSupport.java.ai.md | 54 ++++++++ .../document/AiMdLeadExtractor.java.ai.md | 53 ++++++++ .../aiindex/document/package-info.java.ai.md | 41 ++++++ .../llamacpp/aiindex/document/package.ai.md | 62 +++++++++ .../AiFieldGenerationSupport.java.ai.md | 57 +++++++++ .../aiindex/indexer/PackageIndexer.java.ai.md | 50 ++++++++ .../aiindex/indexer/ProjectIndexer.java.ai.md | 68 ++++++++++ .../indexer/SourceFileIndexer.java.ai.md | 96 ++++++++++++++ .../aiindex/indexer/package-info.java.ai.md | 44 +++++++ .../llamacpp/aiindex/indexer/package.ai.md | 49 +++++++ .../mojo/AbstractAiIndexMojo.java.ai.md | 96 ++++++++++++++ .../mojo/AggregatePackagesMojo.java.ai.md | 71 ++++++++++ .../mojo/AggregateProjectMojo.java.ai.md | 50 ++++++++ .../aiindex/mojo/GenerateMojo.java.ai.md | 80 ++++++++++++ .../aiindex/mojo/package-info.java.ai.md | 39 ++++++ .../maven/llamacpp/aiindex/mojo/package.ai.md | 51 ++++++++ .../llamacpp/aiindex/package-info.java.ai.md | 43 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 52 ++++++++ .../prompt/AiPreparedPrompt.java.ai.md | 45 +++++++ .../prompt/AiPromptDefinition.java.ai.md | 50 ++++++++ .../AiPromptPreparationSupport.java.ai.md | 54 ++++++++ .../aiindex/prompt/AiPromptSupport.java.ai.md | 42 ++++++ .../aiindex/prompt/package-info.java.ai.md | 39 ++++++ .../llamacpp/aiindex/prompt/package.ai.md | 46 +++++++ .../provider/AiCompletionParser.java.ai.md | 45 +++++++ .../provider/AiGenerationProvider.java.ai.md | 45 +++++++ .../AiGenerationProviderFactory.java.ai.md | 53 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 58 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 51 ++++++++ .../MockAiGenerationProvider.java.ai.md | 43 +++++++ .../aiindex/provider/package-info.java.ai.md | 39 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 50 ++++++++ .../support/AiChecksumSupport.java.ai.md | 56 ++++++++ .../aiindex/support/AiPathSupport.java.ai.md | 48 +++++++ .../support/AiSourceExcludeFilter.java.ai.md | 46 +++++++ .../aiindex/support/AiTimeSupport.java.ai.md | 47 +++++++ .../support/ConvertToRecord.java.ai.md | 41 ++++++ .../Java8CompatibilityHelper.java.ai.md | 65 ++++++++++ .../aiindex/support/package-info.java.ai.md | 39 ++++++ .../llamacpp/aiindex/support/package.ai.md | 51 ++++++++ .../ladenthin/maven/llamacpp/package.ai.md | 45 +++++++ .../java/net/ladenthin/maven/package.ai.md | 45 +++++++ .../main/java/net/ladenthin/package.ai.md | 45 +++++++ .../main/java/net/package.ai.md | 45 +++++++ .../main/java/package.ai.md | 45 +++++++ .../main/package.ai.md | 45 +++++++ .../package.ai.md | 45 +++++++ .../project.ai.md | 45 +++++++ .../config/AiFieldGenerationConfig.java.ai.md | 50 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 44 +++++++ .../config/AiGenerationConfig.java.ai.md | 73 +++++++++++ .../config/AiGenerationKind.java.ai.md | 33 +++++ .../config/AiModelDefinition.java.ai.md | 69 ++++++++++ .../AiModelDefinitionSupport.java.ai.md | 44 +++++++ .../llamacpp/aiindex/config/package.ai.md | 48 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 62 +++++++++ .../provider/AiCompletionParser.java.ai.md | 43 +++++++ .../provider/AiGenerationProvider.java.ai.md | 44 +++++++ .../AiGenerationProviderFactory.java.ai.md | 43 +++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 46 +++++++ .../provider/LlamaCppJniConfig.java.ai.md | 51 ++++++++ .../MockAiGenerationProvider.java.ai.md | 40 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 48 +++++++ .../ladenthin/maven/llamacpp/package.ai.md | 61 +++++++++ .../java/net/ladenthin/maven/package.ai.md | 61 +++++++++ .../main/java/net/ladenthin/package.ai.md | 61 +++++++++ .../main/java/net/package.ai.md | 61 +++++++++ .../main/java/package.ai.md | 61 +++++++++ .../ai__qwen3coder-30b__v2/main/package.ai.md | 61 +++++++++ .../ai__qwen3coder-30b__v2/package.ai.md | 61 +++++++++ .../ai__qwen3coder-30b__v2/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 56 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 49 +++++++ .../config/AiGenerationConfig.java.ai.md | 78 +++++++++++ .../config/AiGenerationKind.java.ai.md | 38 ++++++ .../config/AiModelDefinition.java.ai.md | 81 ++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 53 ++++++++ .../llamacpp/aiindex/config/package.ai.md | 46 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 42 ++++++ .../provider/AiCompletionParser.java.ai.md | 44 +++++++ .../provider/AiGenerationProvider.java.ai.md | 50 ++++++++ .../AiGenerationProviderFactory.java.ai.md | 53 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 64 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 58 +++++++++ .../MockAiGenerationProvider.java.ai.md | 40 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 46 +++++++ .../ladenthin/maven/llamacpp/package.ai.md | 41 ++++++ .../java/net/ladenthin/maven/package.ai.md | 41 ++++++ .../main/java/net/ladenthin/package.ai.md | 41 ++++++ .../main/java/net/package.ai.md | 41 ++++++ .../main/java/package.ai.md | 41 ++++++ .../ai__seed-coder-8b__v1/main/package.ai.md | 41 ++++++ .../ai__seed-coder-8b__v1/package.ai.md | 41 ++++++ .../ai__seed-coder-8b__v1/project.ai.md | 35 +++++ .../config/AiFieldGenerationConfig.java.ai.md | 50 ++++++++ .../AiFieldGenerationSelector.java.ai.md | 44 +++++++ .../config/AiGenerationConfig.java.ai.md | 67 ++++++++++ .../config/AiGenerationKind.java.ai.md | 35 +++++ .../config/AiModelDefinition.java.ai.md | 80 ++++++++++++ .../AiModelDefinitionSupport.java.ai.md | 51 ++++++++ .../llamacpp/aiindex/config/package.ai.md | 45 +++++++ .../maven/llamacpp/aiindex/package.ai.md | 49 +++++++ .../provider/AiCompletionParser.java.ai.md | 42 ++++++ .../provider/AiGenerationProvider.java.ai.md | 40 ++++++ .../AiGenerationProviderFactory.java.ai.md | 50 ++++++++ ...LlamaCppJniAiGenerationProvider.java.ai.md | 58 +++++++++ .../provider/LlamaCppJniConfig.java.ai.md | 53 ++++++++ .../MockAiGenerationProvider.java.ai.md | 39 ++++++ .../llamacpp/aiindex/provider/package.ai.md | 45 +++++++ .../ladenthin/maven/llamacpp/package.ai.md | 48 +++++++ .../java/net/ladenthin/maven/package.ai.md | 48 +++++++ .../main/java/net/ladenthin/package.ai.md | 48 +++++++ .../main/java/net/package.ai.md | 48 +++++++ .../main/java/package.ai.md | 48 +++++++ .../ai__seed-coder-8b__v2/main/package.ai.md | 48 +++++++ .../ai__seed-coder-8b__v2/package.ai.md | 48 +++++++ .../ai__seed-coder-8b__v2/project.ai.md | 35 +++++ 433 files changed, 22418 insertions(+) create mode 100644 docs/ai-index-benchmark/COMPARISON.md create mode 100644 docs/ai-index-benchmark/README.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationRequest.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationResult.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdChildEntryLineFormatter.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocument.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocumentCodec.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeader.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderCodec.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdLeadExtractor.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/PackageIndexer.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/ProjectIndexer.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregatePackagesMojo.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregateProjectMojo.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPreparedPrompt.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiChecksumSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiPathSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiSourceExcludeFilter.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiTimeSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/ConvertToRecord.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/Java8CompatibilityHelper.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package-info.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/project.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/package.ai.md create mode 100644 docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/project.ai.md diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md new file mode 100644 index 0000000..2ff2278 --- /dev/null +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -0,0 +1,121 @@ +# AI Index — Model & Prompt Comparison + +Scored comparison of 8 local GGUF models × 2 prompt versions for the plugin's `.ai.md` +code-summarization task. Scope, hardware, and reproduction: see [README.md](README.md). +Generated 2026-06-27 from the trees in [outputs/](outputs/). + +All cells: 12 source files (`config` + `provider`) → 23 `.ai.md` each, 16K context, CPU. + +--- + +## 1. Quantitative metrics + +Columns: **avgLn** = mean lines per `.ai.md` (verbosity); **KB** = total output size; +**kw** = "keyword" hallucination hits; **fence** = stray ```` ``` ```` code fences (prompt forbids +them); **leak** = reasoning/``/harmony markers in output; **enum** = lines for the +trivial `AiGenerationKind` enum (lower = better section-omission); **pojo** = lines for the +`AiGenerationConfig` bean (lower = less accessor bloat); **s/file** = wall-seconds per summary. + +| Cell | avgLn | KB | kw | fence | leak | enum | pojo | s/file | +|---|---|---|---|---|---|---|---|---| +| deepseek-coder-v2-lite v1 | 62.4 | 70 | 0 | 0 | 0 | 39 | 77 | 84.1 | +| deepseek-coder-v2-lite v2 | 52.9 | 62 | 0 | **24** | 0 | 41 | 56 | 66.6 | +| gptoss-20b v1 | 55.5 | 60 | 0 | 0 | 0 | 35 | 77 | 129.0 | +| gptoss-20b v2 | 45.3 | 43 | 0 | 0 | 0 | **13** | 62 | 121.4 | +| granite4-h-tiny v1 | 60.7 | 82 | 0 | 0 | 0 | 53 | 84 | 59.8 | +| granite4-h-tiny v2 | 49.2 | 44 | 0 | 0 | 0 | 40 | 78 | **33.9** | +| qwen25coder-7b v1 | 53.8 | 57 | 0 | 0 | 0 | 21 | 109 | 141.1 | +| qwen25coder-7b v2 | 47.9 | 51 | 0 | **12** | 0 | 23 | 71 | 132.8 | +| qwen3-4b-2507 v1 | 54.4 | 63 | 0 | 0 | 0 | 40 | 64 | 80.6 | +| qwen3-4b-2507 v2 | 53.8 | 60 | 0 | 0 | 0 | 40 | 70 | 72.3 | +| qwen35-4b v1 | 50.7 | 71 | 0 | 0 | 0 | 33 | 82 | 100.8 | +| qwen35-4b v2 | 49.7 | 62 | 0 | 0 | 0 | 38 | 76 | 90.6 | +| qwen3coder-30b v1 | 51.9 | 52 | 0 | 0 | 0 | 40 | 84 | 72.6 | +| qwen3coder-30b v2 | 53.2 | 57 | 0 | 0 | 0 | 33 | 73 | 71.4 | +| seed-coder-8b v1 | 49.7 | 39 | 0 | 0 | 0 | 38 | 78 | 79.5 | +| seed-coder-8b v2 | 49.7 | 44 | 0 | **4** | 0 | 35 | 67 | 85.1 | + +--- + +## 2. Headline findings + +1. **No reasoning leakage anywhere (leak = 0 in all 16 cells).** llama.cpp's default + reasoning parsing strips Qwen `` *and* gpt-oss *harmony* channels server-side, so + `chatCompleteText` returns clean `content`. The Gemma-only `AiCompletionParser` was never + needed. **gpt-oss output is clean** — the feared harmony-marker leakage does not occur. +2. **No "keyword" hallucination (kw = 0 everywhere).** The keyword tic seen in the original + full-project 30B run did **not** reproduce in the `config`+`provider` scope — so v2's explicit + keyword ban is **untested here** (nothing to suppress). Re-check on the mojo/indexer packages. +3. **Prompt v2 reduces verbosity and accessor bloat broadly** — lower `avgLn`/`KB` for most + models, and `pojo` drops notably (qwen2.5-coder 109→71, deepseek 77→56, 30B 84→73, gpt-oss + 77→62). This is v2's clearest win. +4. **v2 induces code-fence violations on the *code-specialized* models** — DeepSeek (24), + Qwen2.5-Coder (12), Seed-Coder (4) wrap e.g. the `#### Type` line in ```` ```java ````; the + general models (gpt-oss, granite, qwen3-4b, qwen3.5-4b, qwen3-coder-30b) stay at **0**. This + is a v2 **regression** that must be fixed before v2 ships. +5. **Trivial-file omission (enum) is only partially honored** by v2 — gpt-oss obeyed it well + (35→13), 30B and granite partly; most models did not shrink. Prompt wording is not a reliable + lever for small models — filtering/deterministic handling is more dependable. +6. **Reasoning/thinking is a pure throughput tax with no quality payoff here.** + `qwen3.5-4b` (hybrid, thinks) ran 90–101 s/file vs the non-thinking `qwen3-4b-2507` at + 72–81 s/file with equal-or-better output. `gpt-oss-20b` is slowest of all (121–129 s/file) + despite being MoE — it spends tokens on harmony reasoning that is then discarded. + +--- + +## 3. Speed ranking (v2, s/file, fastest first) + +`granite4-h-tiny` **33.9** ≪ `deepseek-v2-lite` 66.6 < `qwen3coder-30b` 71.4 < `qwen3-4b-2507` +72.3 < `seed-coder-8b` 85.1 < `qwen35-4b` 90.6 < `gptoss-20b` 121.4 < `qwen25coder-7b` 132.8. + +Active-param count dominates CPU decode: the ~1B-active Granite hybrid is **~4× faster** than the +dense 7B Qwen2.5-Coder, and MoE low-active models (Granite, DeepSeek 2.4B, Qwen3-Coder 3.3B) lead. + +--- + +## 4. Qualitative quality (sampled: `provider/AiGenerationProviderFactory.java`) + +| Tier | Models | Notes | +|---|---|---| +| **A — clean + accurate** | gpt-oss-20b, seed-coder-8b, qwen3-coder-30b | gpt-oss had the highest fidelity (captured the exact `"Unsupported AI provider: " + providerName` message and full dependency list) but is the slowest. Seed-Coder and Qwen3-Coder are clean, terse, and accurate. | +| **B — good, minor gaps** | granite-4.0-h-tiny, qwen3-4b-2507 | Granite is impressively accurate for ~1B active and by far the fastest (slightly incomplete dependency lists). Qwen3-4B-2507 is solid, terse, non-thinking. | +| **C — accurate but noisy** | deepseek-coder-v2-lite, qwen2.5-coder-7b, qwen3.5-4b | DeepSeek repeats the heading inside each section (`- **Purpose**: …`), leaks `{@link}` Javadoc tags, and triggers the most fences. Qwen2.5-Coder is the slowest and fences under v2. Qwen3.5-4B pays the thinking tax with no quality edge over Qwen3-4B-2507. | + +--- + +## 5. Recommendations + +- **Default for this task: `Qwen3-Coder-30B-A3B-Instruct`** — clean, accurate, code-specialized, + Apache-2.0, and fast for its quality (~71 s/file via ~3.3B active MoE). The current production + choice is validated. +- **Best speed/quality for large repos or overnight runs: `Granite-4.0-H-Tiny`** — ~4× faster + than the dense coders, Apache-2.0, surprisingly accurate. The standout new candidate. +- **Best permissive small dense coder: `Seed-Coder-8B-Instruct`** — MIT, clean output. Good + middle option. +- **Budget / laptop: `Qwen3-4B-Instruct-2507`** (non-thinking) over `Qwen3.5-4B` — faster, no + thinking tax, equal-or-better output. +- **Avoid for batch summarization:** `gpt-oss-20b` (highest fidelity but slowest — reasoning + overhead not worth it), `Qwen2.5-Coder-7B` (slowest dense), `DeepSeek-Coder-V2-Lite v2` + (formatting noise). + +### Prompt v1 vs v2 + +v2 is **promising but not yet shippable**: it genuinely tightens output and cuts accessor bloat, +but the **code-fence regression on code-specialized models** is a blocker. Recommended before +adoption: add an explicit, example-backed "never wrap any section in a code fence" instruction +(and/or strip leading ```` ```lang ```` deterministically), then re-test. For non-code models v2 is +already a net improvement. The trivial-file omission and keyword-ban goals are better served by +the indexer's filtering than by prompt wording. + +--- + +## 6. Caveats + +- Quality tiers (§4) are from a **representative file sample**, not a full read of all 368 + summaries; metrics (§1) cover every file. +- The `config`+`provider` scope is small and light on package-info/enum-heavy or + keyword-prone files, so §2.2 (keywords) and §2.5 (omission) are under-exercised here. +- `s/file` includes one-time model load amortized across 23 generations; absolute numbers are + hardware-specific (Ryzen 7 5800H, CPU-only, 8 threads). +- The full-project 30B baseline (`*__fullproject-c64k`) differs in scope and context (47 files, + 65536) and is reference-only. diff --git a/docs/ai-index-benchmark/README.md b/docs/ai-index-benchmark/README.md new file mode 100644 index 0000000..8ce7bfd --- /dev/null +++ b/docs/ai-index-benchmark/README.md @@ -0,0 +1,62 @@ +# AI Index Benchmark — model & prompt comparison + +This directory captures a controlled comparison of **local GGUF models** and **two prompt +versions** for the plugin's code-summarization task (`.ai.md` generation), run on CPU. + +- **[COMPARISON.md](COMPARISON.md)** — scored results, findings, and recommendation. +- **[outputs/](outputs/)** — the raw generated `.ai.md` trees, one directory per cell. + +## What was tested + +- **8 models × 2 prompts = 16 cells**, plus 1 full-project baseline (17 output trees). +- **Subtree scope:** `config` + `provider` packages (12 source files → 23 `.ai.md` each: + 12 file summaries + 10 package roll-ups + 1 project index). `package-info.java` / + `module-info.java` excluded. +- **Context:** all experiment cells run at **16384** (CPU-feasible; native windows up to 262144 + are not). The baseline used 65536. +- **Hardware:** AMD Ryzen 7 5800H, 8 threads, CPU-only, via `net.ladenthin:llama` (llama.cpp JNI). + +### Models (all Q4_K_M @ 16K ctx) + +| Cell key | Model | Active params | Sampling | +|---|---|---|---| +| qwen35-4b | Qwen3.5-4B | 4B dense | t0.7 p0.8 k20 rep1.05 | +| qwen25coder-7b | Qwen2.5-Coder-7B | 7B dense | t0.7 p0.8 k20 rep1.05 | +| gptoss-20b | gpt-oss-20b | ~3.6B (MoE) | t1.0 p1.0 k0 | +| qwen3coder-30b | Qwen3-Coder-30B-A3B | ~3.3B (MoE) | t0.7 p0.8 k20 rep1.05 | +| deepseek-coder-v2-lite | DeepSeek-Coder-V2-Lite | 2.4B (MoE) | t0.3 p0.9 k40 rep1.05 | +| seed-coder-8b | Seed-Coder-8B-Instruct | 8B dense | t0.3 p0.9 k40 rep1.05 | +| granite4-h-tiny | Granite-4.0-H-Tiny | ~1B (MoE-hybrid) | t0.0 (greedy) | +| qwen3-4b-2507 | Qwen3-4B-Instruct-2507 | 4B dense | t0.7 p0.8 k20 rep1.05 | + +### Prompts + +- **v1** — the production prompts (`file-body-java`, `package-body`). +- **v2** — experimental (`file-body-java-v2`, `package-body-v2`): adds a trivial-file + omission rule, JavaBean accessor grouping, an explicit "no invented keywords" ban, + single-child package pass-through, and a tighter brevity instruction. + +### Baseline + +`outputs/ai__qwen3coder-30b__v1__fullproject-c64k/` is the earlier **full-project** run +(47 files, 65536 ctx, v1). Different scope/context — **not** directly comparable to the 16K +config+provider cells; kept for reference. + +## Reproduce + +The self-test profile is parameterized. Each cell was produced by: + +```bash +mvn prepare-package -P ai-index-selftest -DskipTests \ + -Dexp.model= \ + -Dexp.filePrompt= \ + -Dexp.pkgPrompt= \ + -Dai.index.output.directory= +``` + +`EXP-*` model definitions, the v2 prompt templates, the `config`+`provider` subtree scope, and +the `package-info`/`module-info` excludes all live in the `ai-index-selftest` profile in +`pom.xml` (marked `claude2026_06_26_00`). The model files are catalogued in `X:\Modelle\index.md`. + +> These are temporary experiment scaffolds on the `claude2026_06_26_00` branch, not production +> configuration. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..74f4288 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,72 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:05:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices by configuring AI-driven field generation in a Maven plugin for code assistance. + +#### Purpose +- **Configure AI-driven field generation** for specific file types and prompts. +- **Associate prompts with AI model definitions** for generating content based on specified criteria. + +#### Type +- Class (`public`) +- Extends: `Object` +- Annotations: `@SuppressWarnings("NullAway.Init", "initialization.fields.uninitialized")`, `@ToString` + +#### Input +- Constructor parameters: None +- Method parameters: + - `promptKey`: String + - `aiDefinitionKey`: String + - `fileExtensions`: Collection (nullable) +- Injected dependencies: None +- Consumed fields: None +- Read resources: None + +#### Output +- Return types: + - `String getPromptKey()`: Returns the prompt template key. + - `String getAiDefinitionKey()`: Returns the AI model definition key. + - `List getFileExtensions()`: Returns the source file extensions that select this entry, or `null`. +- Produced state: None +- Mutated fields: + - `promptKey` + - `aiDefinitionKey` + - `fileExtensions` +- Written resources: None +- Side effects: None + +#### Core logic +- **Initialize the configuration** with default values. +- **Set and get prompt keys** for AI generation. +- **Set and get AI model definition keys** for specific configurations. +- **Manage file extensions** to determine applicability based on file types. + +#### Public API +- `getPromptKey() -> String`: Returns the key that identifies the prompt template. +- `setPromptKey(promptKey) -> void`: Sets the key that references an `AiPromptDefinition`. +- `getAiDefinitionKey() -> String`: Returns the key that references the `AiModelDefinition`. +- `setAiDefinitionKey(aiDefinitionKey) -> void`: Sets the key that references an `AiModelDefinition`. +- `getFileExtensions() -> List`: Returns the selecting file extensions, or `null`. +- `setFileExtensions(fileExtensions) -> void`: Sets the selecting file extensions. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Throws no exceptions. +- Handles null file extensions by setting them to `null`. + +#### Concurrency +- The class is not thread-safe as it does not manage any shared resources or synchronization mechanisms. + +#### EOF diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..0bd27e2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,48 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:07:06Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the {@link AiFieldGenerationConfig} that applies to a given source file, based on the entries' {@link AiFieldGenerationConfig#getFileExtensions() file extensions}. + +#### Purpose +- To determine the appropriate {@link AiFieldGenerationConfig} for a given source file based on its file extension. + +#### Type +- Class (`public final class AiFieldGenerationSelector`) + +#### Input +- `configs`: An iterable of {@link AiFieldGenerationConfig} objects, which may be null and will be skipped. +- `fileName`: The name of the source file (e.g., `Foo.java`). + +#### Output +- Returns the first matching {@link AiFieldGenerationConfig} based on the file extension or the first fallback entry if no match is found. If no entry matches and no fallback is configured, returns `null`. + +#### Core logic +1. Initialize a variable to hold the fallback configuration. +2. Iterate through each {@link AiFieldGenerationConfig} in the provided iterable. +3. Check if the current config is null; if so, skip to the next iteration. +4. Retrieve the file extensions for the current config. +5. If the extension list is null or empty, set this config as the fallback and continue. +6. Iterate through each extension in the current config's extension list. +7. Check if the file name ends with the current extension; if so, return this config. +8. After the loop, return the fallback config if no match was found. + +#### Public API +- `selectForFileName(configs: Iterable, fileName: String) -> @Nullable AiFieldGenerationConfig` + - Purpose: Returns the {@link AiFieldGenerationConfig} that applies to the given file name based on its extensions. + +#### Dependencies +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Throws no exceptions; handles null entries in the configs iterable by skipping them. + +#### Concurrency +- The class and its methods are not thread-safe or synchronized, implying single-threaded usage. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..82c59fe --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,77 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:07:51Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Provide a mutable configuration object for AI generation parameters. +- Support default values and provide access to these parameters through setters and getters. + +#### Type +- Class (`public final class AiGenerationConfig`) +- Lombok annotations: `@ToString` + +#### Input +- No constructor parameters. +- Default values are applied in the constructors. + +#### Output +- Return types for getter methods (e.g., `String getModelPath()`, `int getContextSize()`). +- Mutation of instance fields through setter methods (e.g., `setModelPath(String modelPath)`, `setStopStrings(@Nullable List stopStrings)`). + +#### Core logic +- **Initialization**: No explicit constructor logic beyond default values. +- **Parameter Setting**: Methods like `setModelPath(String modelPath)`, `setContextSize(int contextSize)`, etc., to modify configuration parameters. +- **Default Values**: Defined constants for each parameter (e.g., `DEFAULT_CONTEXT_SIZE`). + +#### Public API +- `getModelPath() -> String`: Returns the GGUF model file path. +- `setModelPath(String modelPath) -> void`: Sets the GGUF model file path. +- `getContextSize() -> int`: Returns the context window size in tokens. +- `setContextSize(int contextSize) -> void`: Sets the context window size in tokens. +- `getMaxOutputTokens() -> int`: Returns the maximum number of output tokens per inference call. +- `setMaxOutputTokens(int maxOutputTokens) -> void`: Sets the maximum number of output tokens per inference call. +- `getTemperature() -> float`: Returns the sampling temperature. +- `setTemperature(float temperature) -> void`: Sets the sampling temperature. +- `getThreads() -> int`: Returns the number of CPU threads used for inference. +- `setThreads(int threads) -> void`: Sets the number of CPU threads used for inference. +- `getCharsPerToken() -> int`: Returns the number of characters per token used in automatic maxInputChars calculation. +- `setCharsPerToken(int charsPerToken) -> void`: Sets the number of characters per token. +- `getMaxInputChars() -> int`: Returns the maximum number of input characters fed to the prompt. +- `setMaxInputChars(int maxInputChars) -> void`: Sets the maximum number of input characters fed to the prompt. +- `isWarnOnTrim() -> boolean`: Returns whether a warning is emitted when the prompt source text is trimmed. +- `setWarnOnTrim(boolean warnOnTrim) -> void`: Sets whether a warning is emitted when the prompt source text is trimmed. +- `getMaxRetries() -> int`: Returns the maximum number of retry attempts on empty-body responses. +- `setMaxRetries(int maxRetries) -> void`: Sets the maximum number of retry attempts on empty-body responses. +- `getRetryTemperatureIncrement() -> float`: Returns the temperature increment added on each retry attempt. +- `setRetryTemperatureIncrement(float retryTemperatureIncrement) -> void`: Sets the temperature increment added on each retry attempt. +- `getTopP() -> float`: Returns the nucleus-sampling probability threshold. +- `setTopP(float topP) -> void`: Sets the nucleus-sampling probability threshold. +- `getTopK() -> int`: Returns the top-k sampling limit. +- `setTopK(int topK) -> void`: Sets the top-k sampling limit. +- `getRepeatPenalty() -> float`: Returns the repetition penalty. +- `setRepeatPenalty(float repeatPenalty) -> void`: Sets the repetition penalty. +- `isChatTemplateEnableThinking() -> boolean`: Returns whether the model's chat-template thinking mode is enabled. +- `setChatTemplateEnableThinking(boolean chatTemplateEnableThinking) -> void`: Sets whether the model's chat-template thinking mode is enabled. +- `getStopStrings() -> @Nullable List`: Returns an unmodifiable view of the configured stop strings. +- `setStopStrings(@Nullable List stopStrings) -> void`: Sets the list of stop strings. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `org.jspecify.annotations.Nullable` +- `lombok.ToString` + +#### Exceptions / Errors +- No explicit error handling or exception throwing mentioned. +- Nullable handling for `@Nullable List stopStrings`. + +#### Concurrency +- Class is final, implying it is not thread-safe. +- Fields are mutable but accessed through setter methods, suggesting controlled mutation in a single-threaded context. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..ba9143a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,39 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:10:51Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies whether an AI generation operates on a single source file or a whole package. + +#### Purpose +- **Identify** the scope of AI generation (single file or entire package). + +#### Type +- `enum` +- Modifiers: `public` + +#### Input +- No input parameters. + +#### Output +- Enum constants: `FILE_SUMMARY`, `PACKAGE_SUMMARY`. + +#### Core logic +- **Define** two modes of AI generation based on the scope (single file or package). + +#### Public API +- `FILE_SUMMARY() -> AiGenerationKind` - Indicates AI generation for a single source file. +- `PACKAGE_SUMMARY() -> AiGenerationKind` - Indicates AI generation for an entire package. + +#### Dependencies +- No imports or referenced types. + +#### Exceptions / Errors +- No exceptions or error handling mentioned. + +#### Concurrency +- Enum values are thread-safe and do not involve concurrency. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..e63d4ee --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,99 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:11:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices by defining and managing AI model configurations for a Maven plugin, allowing for customization of parameters such as context size, number of threads, and more. + +#### Purpose +- **Configure AI model settings** for use in a Maven plugin that generates code based on specified AI model configurations. +- **Enable or disable thinking mode** for chat templates to control the chain-of-thought reasoning during generation. + +#### Type +- Class: `AiModelDefinition` +- Modifiers: `public` +- Extends: None +- Implements: None +- Key Generics or Bounds: None +- Notable Annotations: `@ToString`, `@SuppressWarnings` + +#### Input +- Parameters in constructors and setters: + - `key`: Unique identifier for the AI model definition. + - `modelPath`: Path to the GGUF model file. + - `contextSize`: Number of tokens in the model context window. + - `maxOutputTokens`: Maximum number of output tokens per inference call. + - `temperature`: Base sampling temperature for text generation. + - `threads`: Number of CPU threads for inference. + - `charsPerToken`: Characters per token for automatic max-input-chars calculation. + - `warnOnTrim`: Whether to emit a warning when source text is trimmed. + - `maxRetries`: Maximum number of retry attempts on empty body response. + - `retryTemperatureIncrement`: Temperature increment applied on each retry. + - `topP`: Nucleus-sampling probability threshold. + - `topK`: Top-k sampling limit. + - `repeatPenalty`: Repetition penalty applied to generated tokens. + - `chatTemplateEnableThinking`: Whether to enable thinking mode for chat templates. + - `stopStrings`: List of stop strings that terminate generation. + +#### Output +- Returns: + - `String getKey()`: Unique key for the AI model definition. + - `String getModelPath()`: Path to the GGUF model file. + - `int getContextSize()`: Context size in tokens. + - `int getMaxOutputTokens()`: Maximum output tokens per inference call. + - `float getTemperature()`: Base sampling temperature. + - `int getThreads()`: Number of threads for inference. + - `int getCharsPerToken()`: Characters per token for input character calculation. + - `boolean isWarnOnTrim()`: Whether to warn on trim. + - `int getMaxRetries()`: Maximum number of retry attempts. + - `float getRetryTemperatureIncrement()`: Temperature increment for retries. + - `float getTopP()`: Top-p value. + - `int getTopK()`: Top-k value. + - `float getRepeatPenalty()`: Repetition penalty. + - `boolean isChatTemplateEnableThinking()`: Whether thinking mode is enabled. + - `List getStopStrings()`: List of stop strings. +- Sets: + - Various fields through setter methods to configure the AI model settings. + +#### Core logic +1. **Default Constructor**: Initializes the object with default values from `AiGenerationConfig`. +2. **Setters and Getters**: Provide access to private fields for reading and updating the AI model configuration parameters. +3. **Utility Methods**: + - **getStopStrings()**: Returns an unmodifiable list of stop strings, ensuring immutability. + - **setStopStrings(Collection)**: Sets the stop strings collection, converting it to a mutable ArrayList internally. + +#### Public API +- `getKey() -> String`: Returns the unique key for the AI model definition. +- `getModelPath() -> String`: Returns the path to the GGUF model file. +- `getContextSize() -> int`: Returns the context size in tokens. +- `getMaxOutputTokens() -> int`: Returns the maximum output tokens per inference call. +- `getTemperature() -> float`: Returns the base sampling temperature. +- `getThreads() -> int`: Returns the number of threads for inference. +- `getCharsPerToken() -> int`: Returns the characters per token for input character calculation. +- `isWarnOnTrim() -> boolean`: Returns whether to warn on trim. +- `getMaxRetries() -> int`: Returns the maximum number of retry attempts. +- `getRetryTemperatureIncrement() -> float`: Returns the temperature increment for retries. +- `getTopP() -> float`: Returns the top-p value. +- `getTopK() -> int`: Returns the top-k value. +- `getRepeatPenalty() -> float`: Returns the repetition penalty. +- `isChatTemplateEnableThinking() -> boolean`: Returns whether thinking mode is enabled. +- `getStopStrings() -> List`: Returns the list of stop strings. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Throws no exceptions. +- Handles null values by using `@Nullable` annotations and defensive copying where necessary. + +#### Concurrency +- The class is not inherently thread-safe as it does not synchronize access to its fields. However, the immutability of the configuration parameters ensures that concurrent access within a single thread is safe. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..1ab0f7e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,53 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:14:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by their key, returning the corresponding generation configurations. + +#### Purpose +- To provide a lookup table for AI model definitions to convert them into ready-to-use generation configurations. +- To enforce contract by ensuring non-null keys in the supplied list of definitions. + +#### Type +- Class (`public final class AiModelDefinitionSupport`) +- Uses Lombok annotations (`@ToString`). + +#### Input +- Constructor parameter: `definitions` (List) +- Method parameter: `key` (String) + +#### Output +- Return type: `AiGenerationConfig` +- Side effect: Throws exceptions for missing keys. + +#### Core logic +- Constructs a lookup table from the supplied list of AI model definitions. +- Ensures non-null keys and populates the map with corresponding generation configurations. +- Provides a method to retrieve the configuration by key. + +#### Public API +- `public AiModelDefinitionSupport(List definitions)` + - Constructs a new `AiModelDefinitionSupport` from the supplied definitions list. +- `public AiGenerationConfig getConfig(String key)` + - Returns the generation config associated with the given key. + +#### Dependencies +- `import java.util.HashMap;` +- `import java.util.List;` +- `import java.util.Map;` +- `import java.util.Objects;` +- `import lombok.ToString;` +- `import net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper;` + +#### Exceptions / Errors +- Throws `NullPointerException` if any entry has a null key. +- Throws `IllegalArgumentException` if no definition is registered for the given key. + +#### Concurrency +- The class and its methods are not thread-safe, as they rely on mutable state. +- Immutable objects or thread-local storage are not used within this class. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..88936e4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,53 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:20:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Calculates VAT for invoices by configuring AI-driven field generation in a Maven plugin for code assistance. + +#### Purpose +- **Configure AI-driven field generation** for specific file types and prompts. +- **Associate prompts with AI model definitions** for generating content based on specified criteria. + +#### Responsibilities +- **AiFieldGenerationConfig**: Manages configuration for AI-driven field generation, including prompt keys and AI model definitions. +- **AiFieldGenerationSelector**: Selects the appropriate `AiFieldGenerationConfig` for a given source file based on its file extensions. +- **AiGenerationConfig**: Provides a mutable configuration object for AI generation parameters, supporting default values and access through setters and getters. +- **AiGenerationKind**: Identifies whether an AI generation operates on a single source file or a whole package. +- **AiModelDefinition**: Defines and manages AI model configurations for use in a Maven plugin, allowing customization of parameters such as context size, number of threads, and more. +- **AiModelDefinitionSupport**: Resolves AI model definitions by their key, returning the corresponding generation configurations. + +#### Key units +- **AiFieldGenerationConfig**: Manages configuration for AI-driven field generation. +- **AiFieldGenerationSelector**: Selects appropriate configurations based on file extensions. +- **AiGenerationConfig**: Mutable configuration object for AI generation parameters. +- **AiGenerationKind**: Enumerates the scope of AI generation (single file or package). +- **AiModelDefinition**: Defines and manages AI model configurations. +- **AiModelDefinitionSupport**: Resolves AI model definitions by key. + +#### Data flow +Inputs are typically passed through constructors, setters, and getters to configure and retrieve parameters for AI field generation and model management. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Cross-cutting +- **Shared configuration parameters**: Many classes share configuration parameters such as model paths, context sizes, and more. +- **Exception handling**: No exceptions are explicitly thrown in the provided summaries, but null values are handled with annotations. +- `java.util.List` is frequently used for collections of configurations or extensions. + +#### EOF diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..70f9f7e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,98 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:25:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Calculates VAT for invoices by configuring AI-driven field generation in a Maven plugin for code assistance. + +#### Purpose +- **Configure AI-driven field generation** for specific file types and prompts. +- **Associate prompts with AI model definitions** for generating content based on specified criteria. + +#### Responsibilities +- **AiFieldGenerationConfig**: Manages configuration for AI-driven field generation, including prompt keys and AI model definitions. +- **AiFieldGenerationSelector**: Selects the appropriate `AiFieldGenerationConfig` for a given source file based on its file extensions. +- **AiGenerationConfig**: Provides a mutable configuration object for AI generation parameters, supporting default values and access through setters and getters. +- **AiGenerationKind**: Identifies whether an AI generation operates on a single source file or a whole package. +- **AiModelDefinition**: Defines and manages AI model configurations for use in a Maven plugin, allowing customization of parameters such as context size, number of threads, and more. +- **AiModelDefinitionSupport**: Resolves AI model definitions by their key, returning the corresponding generation configurations. + +#### Key units +- **AiFieldGenerationConfig**: Manages configuration for AI-driven field generation. +- **AiFieldGenerationSelector**: Selects appropriate configurations based on file extensions. +- **AiGenerationConfig**: Mutable configuration object for AI generation parameters. +- **AiGenerationKind**: Enumerates the scope of AI generation (single file or package). +- **AiModelDefinition**: Defines and manages AI model configurations. +- **AiModelDefinitionSupport**: Resolves AI model definitions by key. + +#### Data flow +Inputs are typically passed through constructors, setters, and getters to configure and retrieve parameters for AI field generation and model management. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Cross-cutting +- **Shared configuration parameters**: Many classes share configuration parameters such as model paths, context sizes, and more. +- **Exception handling**: No exceptions are explicitly thrown in the provided summaries, but null values are handled with annotations. +- `java.util.List` is frequently used for collections of configurations or extensions. + +#### EOF + +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..499200f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,57 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:15:00Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Purpose +- To clean and extract the actual model answer from raw LLM completion text by removing internal reasoning blocks. + +#### Type +- Class (`public final class AiCompletionParser`) +- Modifiers: none +- Extends: `Object` +- Implements: none +- Key generics or type bounds: none +- Notable annotations: `@ToString` from Lombok + +#### Input +- Constructor parameters: none +- Method parameters: `response` (the raw completion text, may be `null`) +- Injected dependencies: none +- Consumed fields: none +- Read resources: none + +#### Output +- Return type: `String` (the cleaned answer text, never `null`) +- Produced state: none +- Mutated fields: none +- Written resources: none +- Side effects: Throws an `IOException` if a thinking block is started but the token budget is exhausted before the closing marker is emitted. + +#### Core logic +- **If `response` is `null`, return an empty string.** +- **Find the position of `THINKING_BLOCK_END_MARKER` in `response`.** + - If found, return the substring from this position to the end, trimmed. +- **Check if `THINKING_BLOCK_START_MARKER` is present without a corresponding `THINKING_BLOCK_END_MARKER`.** + - If true, throw an `IOException` with a message indicating the token budget was exhausted. +- **If neither marker is present, return the trimmed `response`.** + +#### Public API +- `parseCompletion(String response) -> String`: Strips any Gemma-4 thinking block from the response and returns the clean answer text, handling null input and potential exceptions. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` if a thinking block is started but the token budget is exhausted before the closing marker is emitted. +- Treats `null` input as an empty response. + +#### Concurrency +- The class and its methods are not explicitly designed for concurrency, but they handle null inputs and exceptions safely in a single-threaded context. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..e3b228b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:15:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a pluggable AI backend for generating text based on specific requests. + +#### Purpose +- To enable various AI backend providers to generate text based on request specifications. +- To allow implementations to be either local (using llama.cpp) or mock for testing purposes. + +#### Type +- Interface (`public interface AiGenerationProvider extends AutoCloseable`) +- Extends: `AutoCloseable` + +#### Input +- Constructor and method parameters: + - `AiGenerationRequest request` in `generate(AiGenerationRequest request) throws IOException` + - `AiGenerationRequest request, float temperatureOverride` in `generate(final AiGenerationRequest request, final float temperatureOverride) throws IOException` + +#### Output +- Return type: `String` +- Side effects: Throws `IOException` if the underlying provider fails. + +#### Core logic +- **Primary Method**: + - Takes an `AiGenerationRequest` and generates text using the provider's default sampling parameters. +- **Default Method**: + - Allows overriding the temperature for specific generation calls, which can help in breaking EOS-early failure modes. + +#### Public API +- `String generate(AiGenerationRequest request) throws IOException` -> Generates text using default sampling parameters. +- `default String generate(final AiGenerationRequest request, final float temperatureOverride) throws IOException` -> Generates text using a specified temperature override. + +#### Dependencies +- Referenced types: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` + +#### Exceptions / Errors +- Throws `IOException` if the underlying provider fails. + +#### Concurrency +- The interface extends `AutoCloseable`, suggesting that implementations should handle resource management and potential concurrency issues. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..cca15e5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,56 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:16:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an {@link AiGenerationProvider} implementation by name. + +#### Purpose +- To provide a factory method for creating different types of {@link AiGenerationProvider} implementations based on the provided name. + +#### Type +- Class (`public class AiGenerationProviderFactory`) +- Modifiers: `public` +- Extends: None +- Implements: None +- Key Generics or Type Bounds: None +- Notable Annotations: `@ToString` from Lombok + +#### Input +- Parameters: + - `providerName`: A string representing the provider key, which can be `"mock"` or `"llamacpp-jni"`. + - `llamaConfig`: Configuration for the llama.cpp JNI provider. + - `promptSupport`: Prompt lookup support passed to providers that need it. + +#### Output +- Return Type: {@link AiGenerationProvider} +- Produced State: A newly-created provider instance based on the provided name. +- Mutated Fields: None +- Written Resources: None +- Side Effects: Throws an `IllegalArgumentException` if the provider name is not recognized. + +#### Core logic +- **Default Provider**: If `providerName` is `null` or blank, return a {@link MockAiGenerationProvider}. +- **Switch Case**: Based on the `providerName`, instantiate and return the appropriate provider: + - `"mock"`: Returns a {@link MockAiGenerationProvider}. + - `"llamacpp-jni"`: Returns a {@link LlamaCppJniAiGenerationProvider} with the given configuration and prompt support. + +#### Public API +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` + - Creates and returns an {@link AiGenerationProvider} instance based on the provided name. + +#### Dependencies +- Imports: + - `lombok.ToString` + - `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` + - `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` if the provider name is not recognized. + +#### Concurrency +- The class and its methods do not appear to handle concurrency explicitly, but it should be thread-safe given the immutability of the objects created and the absence of mutable state in the class itself. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..eaafdf2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,58 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:17:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. + +#### Purpose +- Provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Type +- Class: `LlamaCppJniAiGenerationProvider` +- Modifiers: `final` +- Implements: `AiGenerationProvider`, `AutoCloseable` + +#### Input +- Constructor parameters: `config`, `promptSupport` +- Method parameters: `request`, `temperatureOverride` + +#### Output +- Return type: `String` +- Produced state: AI-generated text response +- Mutated fields: `model` + +#### Core logic +- Lazily initializes the `LlamaModel` on the first call to `generate()`. +- Constructs a prompt using `AiPromptSupport.buildPrompt()`. +- Sets up `InferenceParameters` for model inference. +- Parses the completion result using `AiCompletionParser.parseCompletion()`. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates AI-generated text based on the request. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates AI-generated text with an optional temperature override. +- `close()`: Closes the `LlamaModel` when no longer needed. + +#### Dependencies +- `java.io.IOException` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Throws `IOException` in `generate()` methods. +- Handles null inputs and parameters gracefully, using `Objects.requireNonNull()`. + +#### Concurrency +- The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- The `model` field is marked with `@ToString.Exclude` to exclude it from string representations for security and performance reasons. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..bdd0cc0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,79 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:18:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable configuration for the llama.cpp JNI provider. + +#### Purpose +- Define and encapsulate configuration parameters for the llama.cpp JNI provider. +- Provide a record-shaped value type for future Java 17+ migration. + +#### Type +- Class (`final`): `LlamaCppJniConfig` +- Lombok annotations: `@ToString`, `@EqualsAndHashCode` +- Interface implemented: `ConvertToRecord` (annotation) + +#### Input +- Constructor parameters: + - `libraryPath`: String, may be null + - `modelPath`: String, must not be null + - `contextSize`: int + - `maxOutputTokens`: int + - `temperature`: float + - `threads`: int + - `topP`: float + - `topK`: int + - `repeatPenalty`: float + - `chatTemplateEnableThinking`: boolean + - `stopStrings`: List, may be null (treated as empty list) + +#### Output +- Public methods: + - `libraryPath() -> String` + - `modelPath() -> String` + - `contextSize() -> int` + - `maxOutputTokens() -> int` + - `temperature() -> float` + - `threads() -> int` + - `topP() -> float` + - `topK() -> int` + - `repeatPenalty() -> float` + - `chatTemplateEnableThinking() -> boolean` + - `stopStrings() -> List` + +#### Core logic +- **Initialization**: Ensures `modelPath` is not null. +- **Accessors**: Provide read-only access to all configuration fields. +- **Immutability**: All fields are final, ensuring the object cannot be modified once created. + +#### Public API +- `libraryPath() -> String`: Returns the native library path. +- `modelPath() -> String`: Returns the GGUF model file path. +- `contextSize() -> int`: Returns the context window size in tokens. +- `maxOutputTokens() -> int`: Returns the maximum number of output tokens per call. +- `temperature() -> float`: Returns the sampling temperature. +- `threads() -> int`: Returns the number of CPU threads. +- `topP() -> float`: Returns the nucleus-sampling probability threshold. +- `topK() -> int`: Returns the top-k sampling limit. +- `repeatPenalty() -> float`: Returns the repetition penalty. +- `chatTemplateEnableThinking() -> boolean`: Returns whether chat-template thinking mode is enabled. +- `stopStrings() -> List`: Returns an unmodifiable view of the configured stop strings. + +#### Dependencies +- `java.util.Collections` +- `java.util.List` +- `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Exceptions / Errors +- Throws a `NullPointerException` if `modelPath` is null during initialization. +- Handles null `stopStrings` by treating them as empty lists. + +#### Concurrency +- The class is immutable, making it inherently thread-safe and not requiring synchronization. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..d34b947 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,52 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:19:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. +- To generate a deterministic summary based on an `AiGenerationRequest`. + +#### Type +- Class (`public final class MockAiGenerationProvider`) +- Implements `AiGenerationProvider` interface. +- Uses Lombok's `@ToString` annotation for generating string representations. + +#### Input +- Constructor parameters: none. +- Method parameters: `request` of type `AiGenerationRequest`. +- Consumed fields: `sourceFile` from `request`. + +#### Output +- Return type: `String`. +- Produced state: A mock summary based on the file name and content. +- Side effects: None explicitly stated, but assumes reading from the file system. + +#### Core logic +- Retrieves the source file path from the request. +- Extracts the file name from the path. +- Constructs a mock summary string using the file name. + +#### Public API +- `MockAiGenerationProvider() -> void`: Constructor for creating a new `MockAiGenerationProvider`. +- `generate(AiGenerationRequest request) -> String`: Generates a mock summary for an invoice based on the provided request. + +#### Dependencies +- `java.io.IOException` +- `java.nio.file.Path` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider` + +#### Exceptions / Errors +- Throws `IOException` if there's an issue reading the file. +- Handles null file names by defaulting to the full path string. + +#### Concurrency +- The class is not thread-safe as it directly interacts with the file system and does not manage any shared resources or synchronization mechanisms. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..9a8e314 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,77 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:22:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..383ca12 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:28:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..5252a61 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:29:36Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..ab23fbe --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:30:51Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..1d8a51b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/net/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:32:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/package.ai.md new file mode 100644 index 0000000..82ad53d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/java/package.ai.md @@ -0,0 +1,58 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:33:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/package.ai.md new file mode 100644 index 0000000..1febdab --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/main/package.ai.md @@ -0,0 +1,58 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:34:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/package.ai.md new file mode 100644 index 0000000..bf6473c --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/package.ai.md @@ -0,0 +1,58 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:35:50Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Purpose +- To provide AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides a pluggable AI backend for generating text based on specific requests. +- Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Key units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Provides a pluggable AI backend for generating text based on request specifications. +- `AiGenerationProviderFactory`: Selects and instantiates an {@link AiGenerationProvider} implementation by name. +- `LlamaCppJniAiGenerationProvider`: Calculates VAT for invoices backed by the JNI binding of the llama.cpp library, providing AI-generated responses based on user prompts. +- `LlamaCppJniConfig`: Defines and encapsulates configuration parameters for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: To provide a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Data flow +- `AiCompletionParser` consumes raw completion text and produces cleaned answer text. +- `AiGenerationProvider` consumes `AiGenerationRequest` and produces AI-generated text. +- `AiGenerationProviderFactory` consumes provider name and configuration, producing an `AiGenerationProvider` instance. +- `LlamaCppJniAiGenerationProvider` consumes `AiGenerationRequest` and configuration, producing AI-generated text. +- `LlamaCppJniConfig` provides configuration parameters for the JNI provider. +- `MockAiGenerationProvider` consumes an `AiGenerationRequest`, produces a mock summary based on the file name and content. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) +- Interface `ConvertToRecord` (annotation) + +#### Cross-cutting +- Shared base types/interfaces: `AiGenerationProvider`, `AutoCloseable` +- Common exception/error handling: Throws `IOException` in several methods. +- Threading/concurrency notes: The provider is designed to be thread-safe as long as the underlying `LlamaModel` is thread-safe. +- Configuration: `LlamaCppJniConfig` provides configuration parameters for the JNI provider. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/project.ai.md new file mode 100644 index 0000000..e5d2253 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v1/project.ai.md @@ -0,0 +1,43 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: ABB3E8A8 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:37:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project, "llamacpp-ai-index-maven-plugin," is designed to enhance code assistance through AI-driven field generation in a Maven plugin. It integrates with the llama.cpp library to provide AI-generated text responses based on user prompts, supporting various functionalities from configuration management to detailed provider services. Key subsystems include: + +1. **Configuration Management**: In the "config" package, VAT calculations for invoices are configured through AI-driven field generation, ensuring accurate and efficient processing within the Maven plugin framework. + +2. **AI-Generated Text Responses**: The "provider" package leverages a local GGUF model to generate text responses based on user prompts. This functionality is crucial for dynamic code assistance and decision support across the project. + +3. **Library Integration**: The core "llamacpp" package interfaces with the llama.cpp library, enabling advanced AI capabilities that are essential for the project's performance and accuracy in generating AI-driven text responses. + +These subsystems work cohesively to deliver a comprehensive solution for enhancing code assistance through AI within a Maven plugin environment. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Calculates VAT for invoices by configuring AI-driven field generation in a Maven plugin for code assistance. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Calculates VAT for invoices by configuring AI-driven field generation in a Maven plugin for code assistance. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- main/java/net/ladenthin/maven/llamacpp — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- main/java/net/ladenthin/maven — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- main/java/net/ladenthin — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- main/java/net — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- main/java — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- main — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. +- . — Provides AI-generated text responses based on user prompts using a local GGUF model via the llama.cpp library. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..849819d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,53 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:37:48Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> This file defines a configuration POJO for field generation in a Maven plugin, associating prompt templates with AI model definitions for specific file types. + +#### Purpose +- **Associates** a prompt template with an AI model definition for field generation. +- **Declares** within the `` list in the plugin configuration. + +#### Type +```java +public class AiFieldGenerationConfig { + // Constructor, setters, and getters for private fields +} +``` + +#### Input +- `promptKey`: Key referencing an {@link AiPromptDefinition}. +- `aiDefinitionKey`: Key referencing an {@link AiModelDefinition}. +- `fileExtensions`: Optional list of file extensions to select this field generation. + +#### Output +- Returns: `String` for prompt key, AI definition key, and file extensions. +- Sets: `promptKey`, `aiDefinitionKey`, and `fileExtensions`. + +#### Core logic +1. **Constructor**: Initializes a new {@link AiFieldGenerationConfig}. +2. **getters/setters**: Provide access to private fields for prompt key, AI definition key, and file extensions. + +#### Public API +- `getPromptKey() -> String`: Returns the key for the prompt template. +- `setPromptKey(String promptKey)`: Sets the key for the prompt template. +- `getAiDefinitionKey() -> String`: Returns the key for the AI model definition. +- `setAiDefinitionKey(String aiDefinitionKey)`: Sets the key for the AI model definition. +- `getFileExtensions() -> @Nullable List`: Returns the file extensions that select this entry, or null if it's the fallback. +- `setFileExtensions(@Nullable Collection fileExtensions)`: Sets the file extensions that select this entry. + +#### Dependencies +- {@link AiModelDefinition} +- {@link AiModelDefinitionSupport} +- {@link net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition} + +#### Exceptions / Errors +- No notable exceptions or error conditions mentioned. + +#### Concurrency +- The class is mutable and instantiated via reflection, suggesting thread-unsafe usage without synchronization. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..6fc77c6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,60 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:39:06Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the AiFieldGenerationConfig that applies to a given source file, based on the entries' file extensions. + +#### Purpose +- Determines which AiFieldGenerationConfig applies to a specific source file based on its file extension. +- Provides a fallback configuration for files without a matching extension. +- Returns null if no configuration matches and no fallback is configured. + +#### Type +```java +public final class AiFieldGenerationSelector +extends Object +``` + +#### Input +- `configs`: Iterable - The list of configurations to evaluate, which may include null entries. +- `fileName`: String - The name of the source file (e.g., "Foo.java"). + +#### Output +- Returns the first matching AiFieldGenerationConfig based on the file extension. +- If no match is found and a fallback is configured, returns the fallback configuration. +- Returns null if no configuration matches and no fallback is configured. + +#### Core logic +1. Initialize a variable to hold the fallback configuration. +2. Iterate through each AiFieldGenerationConfig in the provided configs. +3. Skip null entries. +4. Check if the current config's file extensions list is empty or null. + - If empty, set this config as the fallback and continue. +5. Check if the fileName ends with any of the current config's extensions. + - If a match is found, return the current config. +6. After checking all configs, return the fallback config if no match was found. +7. Return null if no configuration matches and no fallback is configured. + +#### Public API +```java +selectForFileName(configs: Iterable, fileName: String) -> @Nullable AiFieldGenerationConfig +``` + +#### Dependencies +- `AiFieldGenerationConfig` +- `List` +- `@Nullable` + +#### Exceptions / Errors +- No exceptions are explicitly thrown. The method handles null entries by skipping them. + +#### Concurrency +- The class is not thread-safe as it does not maintain any state that could be affected by concurrent access. + +#### Purpose +- Defines the purpose of the AiFieldGenerationSelector class and its role in selecting a configuration based on file extensions. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..e0911f2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,56 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:39:50Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configuration object for AI generation parameters in a Maven plugin, facilitating interaction between the plugin and AI provider implementations. + +#### Purpose +- Define and manage AI generation parameters for a Maven plugin. +- Provide default values for various configuration options. + +#### Type +- Class (`public final class AiGenerationConfig`) +- Extends: `Object` +- Implements: `java.io.Serializable` (implicitly via Lombok's `@ToString`) +- Annotations: `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})`, `@ToString` + +#### Input +- No constructor parameters. +- No dependencies injected. +- No resources read. + +#### Output +- Returns: Various types (`String`, `int`, `float`, `boolean`, `List`) for configuration options. +- Sets: State of the object (fields) based on input values. + +#### Core logic +1. **Default Values**: Each field has a corresponding default value, ensuring flexibility and configurability. +2. **Getters and Setters**: Methods to retrieve and modify the state of the configuration object. +3. **Unmodifiable List**: The `stopStrings` field returns an unmodifiable view of the list to prevent external modification. + +#### Public API +1. `getModelPath() -> String`: Retrieve the model file path. +2. `setModelPath(String modelPath)`: Set the model file path. +3. `getContextSize() -> int`: Get the context window size in tokens. +4. `setContextSize(int contextSize)`: Set the context window size in tokens. +5. ... (similar for all fields) +6. `getStopStrings() -> @Nullable List`: Get an unmodifiable view of the stop strings. +7. `setStopStrings(@Nullable List stopStrings)`: Set the list of stop strings, allowing null to reset to an empty list. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No exceptions or errors explicitly mentioned in the source code. +- Null handling is implicit in the use of `@Nullable` and defaulting to empty collections. + +#### Concurrency +- The class is not thread-safe as it stands, since setters modify state without synchronization. +- For thread safety, additional synchronization would be required around setter methods. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..9dc8295 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,41 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:41:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> This file defines constants for specifying the kind of AI generation, whether it operates on a single source file or a whole package. + +#### Purpose +- Define constants for specifying the kind of AI generation. + +#### Type +- `enum AiGenerationKind` +- Modifiers: public +- Extends: none +- Notable annotations: none + +#### Input +- None + +#### Output +- Constants: `FILE_SUMMARY`, `PACKAGE_SUMMARY` + +#### Core logic +- Represents the kind of AI generation. + +#### Public API +- `FILE_SUMMARY() -> AiGenerationKind`: Generation for a single source file. +- `PACKAGE_SUMMARY() -> AiGenerationKind`: Generation for a package aggregate. + +#### Dependencies +- None + +#### Exceptions / Errors +- None + +#### Concurrency +- Thread-safe: enum constants are inherently thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..8452ac1 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,112 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:42:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a mutable JavaBean configuration class for AI model parameters used in a Maven plugin, facilitating the reuse of model configurations across multiple field-generation entries and goals. + +#### Purpose +- **Configuration**: Provides a mutable POJO for storing and managing AI model parameters. +- **Reusability**: Allows a single model configuration to be defined once and reused across multiple field-generation entries and goals. + +#### Type +- `class AiModelDefinition` +- Modifiers: `public` +- Extends/Implements: None +- Notable Annotations: `@SuppressWarnings`, `@ToString` + +#### Input +- Constructor parameters: None +- Injected dependencies: None +- Consumed fields: + - `key` + - `modelPath` + - `contextSize` + - `maxOutputTokens` + - `temperature` + - `threads` + - `charsPerToken` + - `warnOnTrim` + - `maxRetries` + - `retryTemperatureIncrement` + - `topP` + - `topK` + - `repeatPenalty` + - `chatTemplateEnableThinking` + - `stopStrings` + +#### Output +- Return types: + - `String getKey()` + - `String getModelPath()` + - `int getContextSize()` + - `int getMaxOutputTokens()` + - `float getTemperature()` + - `int getThreads()` + - `int getCharsPerToken()` + - `boolean isWarnOnTrim()` + - `int getMaxRetries()` + - `float getRetryTemperatureIncrement()` + - `float getTopP()` + - `int getTopK()` + - `float getRepeatPenalty()` + - `boolean isChatTemplateEnableThinking()` + - `@Nullable List getStopStrings()` +- Produced/Mutated state: + - Fields are set via public setter methods. + +#### Core logic +- **Default Values**: Initializes fields with default values from `AiGenerationConfig`. +- **Getter and Setter Methods**: Provide access to private fields, ensuring flexibility in configuration management. + +#### Public API +- `String getKey()`: Returns the unique lookup key for this definition. +- `void setKey(final String key)`: Sets the unique lookup key for this definition. +- `String getModelPath()`: Returns the path to the GGUF model file. +- `void setModelPath(final String modelPath)`: Sets the path to the GGUF model file. +- `int getContextSize()`: Returns the context window size (in tokens). +- `void setContextSize(final int contextSize)`: Sets the context window size (in tokens). +- `int getMaxOutputTokens()`: Returns the maximum number of output tokens per inference call. +- `void setMaxOutputTokens(final int maxOutputTokens)`: Sets the maximum number of output tokens per inference call. +- `float getTemperature()`: Returns the base sampling temperature. +- `void setTemperature(final float temperature)`: Sets the base sampling temperature. +- `int getThreads()`: Returns the number of CPU threads for inference. +- `void setThreads(final int threads)`: Sets the number of CPU threads for inference. +- `int getCharsPerToken()`: Returns the number of characters per token used to automatically calculate the maximum input characters for the source code. +- `void setCharsPerToken(final int charsPerToken)`: Sets the number of characters per token for automatic max-input-chars calculation. +- `boolean isWarnOnTrim()`: Returns whether a warning is emitted when source text is trimmed. +- `void setWarnOnTrim(final boolean warnOnTrim)`: Sets whether a warning is emitted when source text is trimmed. +- `int getMaxRetries()`: Returns the maximum number of retry attempts when the provider returns an empty body. +- `void setMaxRetries(final int maxRetries)`: Sets the maximum number of retry attempts when the provider returns an empty body. +- `float getRetryTemperatureIncrement()`: Returns the temperature increment applied on each successive retry attempt. +- `void setRetryTemperatureIncrement(final float retryTemperatureIncrement)`: Sets the temperature increment applied on each successive retry attempt. +- `float getTopP()`: Returns the nucleus-sampling probability threshold. +- `void setTopP(final float topP)`: Sets the nucleus-sampling probability threshold. +- `int getTopK()`: Returns the top-k sampling limit. +- `void setTopK(final int topK)`: Sets the top-k sampling limit. +- `float getRepeatPenalty()`: Returns the repetition penalty. +- `void setRepeatPenalty(final float repeatPenalty)`: Sets the repetition penalty applied to already-generated tokens. +- `boolean isChatTemplateEnableThinking()`: Returns whether the model's chat-template thinking mode is enabled. +- `void setChatTemplateEnableThinking(final boolean chatTemplateEnableThinking)`: Sets whether the model's chat-template thinking mode is enabled. +- `@Nullable List getStopStrings()`: Returns the list of stop strings that terminate generation when encountered. +- `void setStopStrings(final @Nullable Collection stopStrings)`: Sets the list of stop strings that terminate generation when encountered. + +#### Dependencies +- Referenced types: + - `java.util.ArrayList` + - `java.util.Collection` + - `java.util.Collections` + - `org.jspecify.annotations.Nullable` + - `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig` + +#### Exceptions / Errors +- Throws: None +- Handles: Null values in setters, especially for collections like `stopStrings`. + +#### Concurrency +- The class is designed to be used in a single-threaded context as it does not manage any thread-safe operations internally. +- It is assumed that the Maven plugin framework managing instances of this class ensures thread safety when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..46d497c --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,54 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:45:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> This file defines a support class for resolving AI model definitions into generation configurations, ensuring efficient lookups and contract enforcement for missing keys. + +#### Purpose +- Provides a lookup table for AI model definitions to convert them into ready-to-use generation configurations. +- Ensures that every entry in the supplied list has a non-null key, throwing exceptions for null keys. + +#### Type +```java +public final class AiModelDefinitionSupport extends Object +``` + +#### Input +- `definitions`: List of `AiModelDefinition` entries; may be null or empty. + +#### Output +- A `Map` containing the resolved configurations. + +#### Core logic +1. Initializes the `configs` map with a capacity based on the size of the definitions list. +2. Iterates through the definitions list to populate the map, ensuring each entry has a non-null key. +3. Converts an `AiModelDefinition` into an `AiGenerationConfig` by copying all field values. + +#### Public API +```java +public AiGenerationConfig getConfig(String key) -> AiGenerationConfig +``` +- Purpose: Retrieves the generation configuration associated with the given key, throwing an exception if the key is not found. + +#### Dependencies +- `Map` +- `Java8CompatibilityHelper` + +#### Exceptions / Errors +- Throws `NullPointerException` if any entry in the definitions list has a null key. +- Throws `IllegalArgumentException` if no definition is registered for the given key. + +#### Concurrency +- The class is not thread-safe as it uses mutable state and external dependencies. + +#### Purpose +- Converts an `AiModelDefinition` into an `AiGenerationConfig`. + +```java +private static AiGenerationConfig toConfig(AiModelDefinition definition) -> AiGenerationConfig +``` diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..174072a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,47 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:51:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> This package provides a comprehensive set of tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..a3c9f24 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,43 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:55:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..23cd4f6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,48 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:46:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Purpose +- To strip internal reasoning from a model's completion text and return only the actual answer. + +#### Type +```java +public class AiCompletionParser +``` +extends `Object` + +#### Input +- `response`: the raw completion text from the model, may be `null`. + +#### Output +- Returns the cleaned answer text, never `null`. +- Throws an `IOException` if a thinking block was started but the token budget was exhausted before the closing marker was emitted. + +#### Core logic +1. Check if `response` is `null`. If so, return an empty string. +2. Find the position of `THINKING_BLOCK_END_MARKER` in the response. +3. If found, return the substring from the end of this marker to the end of the string, trimmed. +4. If `THINKING_BLOCK_START_MARKER` is present but `THINKING_BLOCK_END_MARKER` is absent, throw an `IOException`. +5. If neither marker is present, return the response trimmed. + +#### Public API +```java +parseCompletion(response) -> String +``` +- Strips any Gemma-4 thinking block from `response` and returns the clean answer text. + +#### Dependencies +- `IOException` + +#### Exceptions / Errors +- Throws `IOException` if `THINKING_BLOCK_START_MARKER` is present but `THINKING_BLOCK_END_MARKER` is absent, indicating a token budget exhaustion inside the thinking block. + +#### Concurrency +- The class and its method do not inherently handle threading or concurrency issues. However, the method's behavior is stateless and thread-safe in its current implementation. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..46bec28 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,47 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:47:04Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a pluggable AI backend for generating text based on an AI generation request. + +#### Purpose +- To enable various AI backend implementations that can generate text from a given request. +- To abstract the details of the AI backend, allowing for different providers to be used interchangeably. + +#### Type +- `interface AiGenerationProvider extends AutoCloseable` + +#### Input +- `AiGenerationRequest request` + +#### Output +- `String` + +#### Core logic +- **Generate text** using the provider's default sampling parameters. +- **Handle exceptions** by throwing `IOException`. +- **Optional temperature override** for retry attempts, which delegates to the main generate method. + +#### Public API +- `generate(AiGenerationRequest request) -> String` + - Generates text for the given request using the provider's default sampling parameters. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String` + - Generates text with a specified temperature override, which replaces any provider's own configuration. + +#### Dependencies +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `java.io.IOException` + +#### Exceptions / Errors +- Throws `IOException` if the underlying provider fails. + +#### Concurrency +- The interface extends `AutoCloseable`, implying that implementations should manage resource lifecycle properly. + +#### Concurrency +- Not explicitly mentioned in the provided source, but typical for resource management interfaces. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..6369bda --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,51 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:47:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an {@link AiGenerationProvider} implementation by name. + +#### Purpose +- **Purpose**: Defines a factory for creating instances of `AiGenerationProvider` based on the provided name. + +#### Type +- **Type**: Class (`public final class`), extends no other class, implements no interfaces. + +#### Input +- **Input**: + - `providerName`: A string representing the provider key (e.g., "mock" or "llamacpp-jni"). + - `llamaConfig`: Configuration for the llama.cpp JNI provider. + - `promptSupport`: Support for prompt lookup passed to providers that need it. + +#### Output +- **Output**: + - Returns an instance of `AiGenerationProvider`. + - Throws `IllegalArgumentException` if the provider name is not recognized. + +#### Core logic +- **Core logic**: + - Check if `providerName` is null or blank, and default to "mock" if true. + - Use a switch statement to return the appropriate `AiGenerationProvider` based on the `providerName`. + +#### Public API +- **Public API**: + - `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` + - **Purpose**: Creates an `AiGenerationProvider` for the given provider name. + +#### Dependencies +- **Dependencies**: + - `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` + - `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` + - `net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider` + - `net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniAiGenerationProvider` + +#### Exceptions / Errors +- **Exceptions**: + - Throws `IllegalArgumentException` if the provider name is not recognized. + +#### Concurrency +- **Concurrency**: Not applicable (no threading or state mutations mentioned). diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..61076f0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,52 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:48:15Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a JNI-backed implementation for generating AI text using local llama.cpp models, supporting configurable prompts and inference settings. + +#### Purpose +- **To provide a JNI-backed implementation** of an AI text generation provider that uses local llama.cpp models. +- **To support configurable prompts and inference settings** for generating AI text based on user requests. + +#### Type +```java +public final class LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable +``` + +#### Input +- `config`: `LlamaCppJniConfig` - configuration for the llama.cpp model. +- `promptSupport`: `AiPromptSupport` - support for building prompts based on user requests. + +#### Output +- `String` - generated AI text based on the provided request and configuration settings. +- Throws `IOException` - if there's an issue with input/output operations. + +#### Core logic +1. **Initialization**: Constructs a new `LlamaCppJniAiGenerationProvider` object, initializing it with the given configuration and prompt support. +2. **Model Loading**: Loads the GGUF model lazily on the first call to `generate(...)`, using the provided configuration settings. +3. **Prompt Building**: Constructs a prompt based on the user request using the `promptSupport`. +4. **Inference Parameters Configuration**: Sets up inference parameters including messages, temperature, and other settings based on the configuration. +5. **Completion Parsing**: Parses the completion text from the model's output using `AiCompletionParser`. +6. **Resource Management**: Closes the model when the provider is closed, releasing resources. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates AI text based on the given request. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates AI text with an optional temperature override. +- `close()`: Closes the provider, releasing native resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` - JNI binding for llama.cpp models. +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` - Represents an AI generation request. +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` - Supports building prompts for AI generation. +- `org.jspecify.annotations.Nullable` - For nullable type annotations. + +#### Exceptions / Errors +- Throws `IOException` if there's an issue with input/output operations during generation. + +#### Concurrency +- The provider is not thread-safe; it should be managed in a single-threaded context or with appropriate synchronization. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..babc7d3 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,88 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:49:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable configuration for the llama.cpp JNI provider. + +#### Purpose +- Provides immutable configuration settings for the llama.cpp JNI provider. +- Uses a record-shaped value type marked with `@ConvertToRecord` for future Java 17+ migration. + +#### Type +```java +public final class LlamaCppJniConfig +``` + +#### Input +- `libraryPath`: native library path; may be `null`. +- `modelPath`: path to the GGUF model file. +- `contextSize`: context window size in tokens. +- `maxOutputTokens`: maximum number of output tokens per call. +- `temperature`: sampling temperature. +- `threads`: number of CPU threads. +- `topP`: nucleus-sampling probability threshold. +- `topK`: top-k sampling limit. +- `repeatPenalty`: repetition penalty. +- `chatTemplateEnableThinking`: whether chat-template thinking mode is enabled. +- `stopStrings`: stop strings; may be `null` (treated as empty). + +#### Output +- Returns: + - `libraryPath`: native library path, or `null` to use the bundled library. + - `modelPath`: model file path. + - `contextSize`: context window size. + - `maxOutputTokens`: maximum output tokens. + - `temperature`: sampling temperature. + - `threads`: number of CPU threads. + - `topP`: top-p value. + - `topK`: top-k value. + - `repeatPenalty`: repeat penalty. + - `chatTemplateEnableThinking`: whether chat-template thinking mode is enabled. + - `stopStrings`: unmodifiable list of stop strings. + +#### Core logic +1. Ensures `modelPath` is not `null`. +2. Initializes all fields with provided values, treating `null` stop strings as an empty list. + +#### Public API +- `libraryPath() -> String` + - Returns the native library path. +- `modelPath() -> String` + - Returns the GGUF model file path. +- `contextSize() -> int` + - Returns the context window size in tokens. +- `maxOutputTokens() -> int` + - Returns the maximum number of output tokens per call. +- `temperature() -> float` + - Returns the sampling temperature. +- `threads() -> int` + - Returns the number of CPU threads. +- `topP() -> float` + - Returns the nucleus-sampling probability threshold. +- `topK() -> int` + - Returns the top-k sampling limit. +- `repeatPenalty() -> float` + - Returns the repetition penalty. +- `chatTemplateEnableThinking() -> boolean` + - Returns whether chat-template thinking mode is enabled. +- `stopStrings() -> List` + - Returns an unmodifiable view of the configured stop strings. + +#### Dependencies +- `java.util.Objects` +- `java.util.List` +- `java.util.Collections` +- `lombok.EqualsAndHashCode` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord` + +#### Exceptions / Errors +- Throws `NullPointerException` if `modelPath` is `null`. + +#### Concurrency +- The class is immutable, hence thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..b409f23 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:50:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> MockAiGenerationProvider is a deterministic test-only implementation of AiGenerationProvider that returns a mock summary for testing purposes. + +#### Purpose +- Provide a mock AI generation summary for testing purposes. + +#### Type +```java +public class MockAiGenerationProvider implements AiGenerationProvider { +``` + +#### Input +- `final AiGenerationRequest request`: The AI generation request containing the source file to be summarized. + +#### Output +- `String`: A mock summary string for the given file name. + +#### Core logic +1. Extract the source file path from the request. +2. Retrieve the file name from the path. +3. Construct a mock summary string using the file name. + +#### Public API +```java +public String generate(final AiGenerationRequest request) -> String { + // Returns a mock summary for the given file. +} +``` + +#### Dependencies +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `java.nio.file.Path` + +#### Exceptions / Errors +- Throws `IOException`: If there is an issue reading the file or processing the request. + +#### Concurrency +- This class is thread-safe as it does not maintain any state that would be affected by concurrent access. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..11e4c68 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T03:53:33Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Provides a pluggable AI backend for generating text based on an AI generation request, with support for configurable prompts and inference settings. + +#### Purpose +- To enable various AI backend implementations that can generate text from a given request. +- To abstract the details of the AI backend, allowing for different providers to be used interchangeably. + +#### Responsibilities +- **AiCompletionParser.java**: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- **AiGenerationProvider.java**: Provides a pluggable AI backend for generating text based on an AI generation request. +- **AiGenerationProviderFactory.java**: Selects and instantiates an `AiGenerationProvider` implementation by name. +- **LlamaCppJniAiGenerationProvider.java**: Provides a JNI-backed implementation for generating AI text using local llama.cpp models, supporting configurable prompts and inference settings. +- **LlamaCppJniConfig.java**: Immutable configuration for the llama.cpp JNI provider. +- **MockAiGenerationProvider.java**: MockAiGenerationProvider is a deterministic test-only implementation of AiGenerationProvider that returns a mock summary for testing purposes. + +#### Key units +- **AiCompletionParser**: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- **AiGenerationProvider**: Provides a pluggable AI backend for generating text based on an AI generation request. +- **AiGenerationProviderFactory**: Selects and instantiates an `AiGenerationProvider` implementation by name. +- **LlamaCppJniAiGenerationProvider**: Provides a JNI-backed implementation for generating AI text using local llama.cpp models, supporting configurable prompts and inference settings. +- **LlamaCppJniConfig**: Immutable configuration for the llama.cpp JNI provider. +- **MockAiGenerationProvider**: MockAiGenerationProvider is a deterministic test-only implementation of AiGenerationProvider that returns a mock summary for testing purposes. + +#### Data flow +Inputs move through the package to outputs as follows: +1. `AiGenerationRequest` objects are processed by `AiGenerationProvider` implementations to generate text. +2. Configurations and prompts are managed by `LlamaCppJniConfig` and passed to `LlamaCppJniAiGenerationProvider`. +3. The result is parsed using `AiCompletionParser` before being stored in an AI index file. + +#### Dependencies +- **External modules**: + - `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` + - `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` + - `org.jspecify.annotations.Nullable` +- **Internal modules**: + - `net.ladenthin.llama.LlamaModel` + - `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` + - `net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider` + +#### Cross-cutting +- **Shared base types**: `IOException`, `AutoCloseable` +- **Common error handling**: Throws `IOException` for issues with input/output operations. +- **Concurrency**: The provider is not thread-safe and should be managed in a single-threaded context or with appropriate synchronization. +- **Configuration management**: Configurations are managed by `LlamaCppJniConfig`, which ensures that `modelPath` is not `null`. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..d47894a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,42 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:56:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..6e37bce --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,42 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:57:43Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..e3f951b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,42 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:58:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..4acf386 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/net/package.ai.md @@ -0,0 +1,42 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T03:59:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/package.ai.md new file mode 100644 index 0000000..b64f845 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/java/package.ai.md @@ -0,0 +1,42 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:00:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/package.ai.md new file mode 100644 index 0000000..5c91641 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/main/package.ai.md @@ -0,0 +1,42 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:00:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/package.ai.md new file mode 100644 index 0000000..2c6f220 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/package.ai.md @@ -0,0 +1,42 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:01:43Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. + +#### Purpose +- **Flexibility**: Allows for the association of prompt templates with specific AI models tailored for different file types. +- **Reusability**: Enables the reuse of AI model configurations across multiple field generation entries and Maven plugin goals. + +#### Responsibilities +- **Configuration Management**: Defines and manages AI model parameters in a mutable POJO format, suitable for configuration via Maven settings or programmatically. +- **Lookup Mechanism**: Provides a lookup table to convert AI model definitions into ready-to-use generation configurations, ensuring efficient access and error handling for missing keys. + +#### Key units +- **AiFieldGenerationConfig**: A mutable POJO for configuring field generation with prompt templates and AI models, associated with specific file extensions. +- **AiFieldGenerationSelector**: A utility class for selecting the appropriate `AiFieldGenerationConfig` based on the file extension of a source file. +- **AiGenerationConfig**: A configuration object encapsulating various parameters required for AI generation, including model path, context size, and more. +- **AiModelDefinition**: Defines constants for specifying the kind of AI generation, such as FILE_SUMMARY or PACKAGE_SUMMARY. +- **AiModelDefinitionSupport**: A support class providing a lookup mechanism for converting `AiModelDefinition` entries into `AiGenerationConfig` instances. + +#### Data flow +- Inputs to the package include various configuration parameters and a list of `AiModelDefinition` entries. +- The data flows through internal mechanisms to populate a map of `AiGenerationConfig` instances, which are then used by the `AiFieldGenerationSelector` to determine the appropriate configuration for a given file. + +#### Dependencies +- **Internal Collaborations**: The package depends on other units within the same package for configuration and lookup purposes. +- **External Modules**: No external modules are explicitly listed as dependencies, focusing on internal collaborations. + +#### Cross-cutting +- **Shared Base Types**: Utilizes Java's base types and collections for data handling. +- **Common Patterns**: Emphasizes the use of mutable POJOs and lookup tables to manage configurations efficiently. +- **Error Handling**: Implements exception handling for null keys and missing definitions, ensuring robust operation. + +#### Cross-cutting +- **Thread Safety**: The package does not inherently handle thread safety, relying on external frameworks to ensure thread-safe operations when multiple instances are created and manipulated concurrently. diff --git a/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/project.ai.md new file mode 100644 index 0000000..47c5442 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__deepseek-coder-v2-lite__v2/project.ai.md @@ -0,0 +1,43 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: DA1C3F88 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:02:36Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project "llamacpp-ai-index-maven-plugin" is designed to facilitate the integration of AI-driven text generation capabilities within a Maven plugin framework. It achieves this by organizing its functionality into several key packages, each serving specific purposes: + +1. The `config` package is pivotal for setting up and customizing AI model configurations, which are essential for generating text based on specific prompts and settings. This ensures that the plugin can adapt to various file types and goals, enhancing its flexibility and utility. + +2. The `provider` package introduces a pluggable AI backend that supports different inference settings and configurable prompts. This allows the system to dynamically generate text according to varying requirements, making it adaptable to diverse applications within the Maven plugin context. + +3. The core packages such as `llamacpp`, `maven`, and `ladenthin` are responsible for managing and configuring AI field generation across different file types and goals. They ensure that the AI model configurations can be reused and extended as needed, thereby enhancing the overall functionality and scalability of the plugin. + +These packages work cohesively to provide a comprehensive solution for incorporating AI-driven text generation into Maven plugin development, ensuring high flexibility and reusability in managing AI configurations. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — This package provides a comprehensive set of tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides a pluggable AI backend for generating text based on an AI generation request, with support for configurable prompts and inference settings. +- main/java/net/ladenthin/maven/llamacpp — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main/java/net/ladenthin/maven — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main/java/net/ladenthin — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main/java/net — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main/java — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- main — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. +- . — This package provides comprehensive tools for configuring and managing AI field generation in a Maven plugin, ensuring flexibility and reusability of AI model configurations across various file types and goals. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..c8fec14 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,51 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:03:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures a prompt template and AI model key for Maven index field generation. + +#### Purpose +- Defines plugin configuration for a single AI field-generation step. +- Links prompt key to model definition for each file processed. + +#### Type +- Class `AiFieldGenerationConfig` +- Mutability: mutable JavaBean +- Annotation: `@ToString` +- Suppresses initialization warnings. + +#### Input +- Constructor: no-arg, no-op. +- Setters: `setPromptKey(String)`, `setAiDefinitionKey(String)`, `setFileExtensions(Collection)`. +- Parameters: prompt key, model definition key, optional file extensions. + +#### Output +- Getters: `getPromptKey()`, `getAiDefinitionKey()`, `getFileExtensions()`. +- `getFileExtensions()` returns unmodifiable list or null. +- Mutated internal state via setters. + +#### Core logic +- Defensive copy of file extension collection on set. +- Null handling: null or empty collection → null fallback. +- `getFileExtensions()` wraps internal list with `Collections.unmodifiableList`. + +#### Public API +- `AiFieldGenerationConfig() -> void` – create instance. +- `getPromptKey() -> String` – retrieve prompt key. +- `setPromptKey(String)` – set prompt key. +- `getAiDefinitionKey() -> String` – retrieve AI model key. +- `setAiDefinitionKey(String)` – set AI model key. +- `getFileExtensions() -> List` – get unmodifiable file extensions. +- `setFileExtensions(Collection)` – set file extensions defensively. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- Referenced types: `AiModelDefinition`, `AiPromptDefinition`, `AiFieldGenerationSelector` +- Maven plugin configuration context. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..8f0b43d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,46 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:05:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the field‑generation configuration applicable to a source file by file‑extension matching. + +#### Purpose +- Resolve AiFieldGenerationConfig for a given file name. + +#### Type +- `final class AiFieldGenerationSelector` +- Annotated with `@ToString`; no superclass. + +#### Input +- `Iterable configs` – declaration order; null entries ignored. +- `String fileName` – source file name to match. + +#### Output +- `@Nullable AiFieldGenerationConfig` – first extension‑matching config, else first fallback, else `null`. + +#### Core logic +- Iterate over `configs`; skip `null`. +- Retrieve `config.getFileExtensions()`; if null/empty store as `fallback`. +- For each `extension` in list, if `fileName.endsWith(extension)` return `config`. +- After loop, return `fallback`. + +#### Public API +- `AiFieldGenerationSelector()` – constructor, no initialization. +- `selectForFileName(configs, fileName) -> AiFieldGenerationConfig?` – determine config for file. + +#### Dependencies +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig` + +#### Exceptions / Errors +- None; no checked exceptions thrown. + +#### Concurrency +- No synchronization; instance is immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..b907558 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,77 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:07:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> A mutable configuration holder for AI generation parameters, used to transfer settings from Maven to AI providers. + +#### Purpose +- Stores AI generation options (model path, sampling, retries, input limits). +- Acts as a JavaBean populated by Maven plugin. + +#### Type +- Class `AiGenerationConfig` (public), final by default, annotated `@ToString` (Lombok), no additional modifiers. + +#### Input +- Constructor (no parameters). +- Setters: `setModelPath`, `setContextSize`, `setMaxOutputTokens`, `setTemperature`, `setThreads`, `setCharsPerToken`, `setMaxInputChars`, `setWarnOnTrim`, `setMaxRetries`, `setRetryTemperatureIncrement`, `setTopP`, `setTopK`, `setRepeatPenalty`, `setChatTemplateEnableThinking`, `setStopStrings`. +- Defaults initialized in field declarations. + +#### Output +- Getters: `getModelPath`, `getContextSize`, `getMaxOutputTokens`, `getTemperature`, `getThreads`, `getCharsPerToken`, `getMaxInputChars`, `isWarnOnTrim`, `getMaxRetries`, `getRetryTemperatureIncrement`, `getTopP`, `getTopK`, `getRepeatPenalty`, `isChatTemplateEnableThinking`, `getStopStrings`. +- Unmodifiable view of stop strings. + +#### Core logic +- Constants define default values for context, output tokens, temperature, threads, input chars, etc. +- Fields hold mutable state initialized to defaults. +- `setStopStrings` replaces internal list or clears to empty. +- `getStopStrings` returns `Collections.unmodifiableList` or `null` if internal list unset. +- No additional computation or algorithm. + +#### Public API +- `AiGenerationConfig()` → construct empty config. +- `getModelPath() -> String` → model file path. +- `setModelPath(String)` → set model path. +- `getContextSize() -> int` → context window size. +- `setContextSize(int)` → set context size. +- `getMaxOutputTokens() -> int` → max output tokens. +- `setMaxOutputTokens(int)` → set max output tokens. +- `getTemperature() -> float` → sampling temperature. +- `setTemperature(float)` → set temperature. +- `getThreads() -> int` → CPU thread count. +- `setThreads(int)` → set thread count. +- `getCharsPerToken() -> int` → chars per token ratio. +- `setCharsPerToken(int)` → set ratio. +- `getMaxInputChars() -> int` → max input chars. +- `setMaxInputChars(int)` → set max input chars. +- `isWarnOnTrim() -> boolean` → trim warning flag. +- `setWarnOnTrim(boolean)` → set trim warning. +- `getMaxRetries() -> int` → max retry attempts. +- `setMaxRetries(int)` → set max retries. +- `getRetryTemperatureIncrement() -> float` → retry temperature increment. +- `setRetryTemperatureIncrement(float)` → set increment. +- `getTopP() -> float` → nucleus sampling threshold. +- `setTopP(float)` → set top‑p. +- `getTopK() -> int` → top‑k limit. +- `setTopK(int)` → set top‑k. +- `getRepeatPenalty() -> float` → repetition penalty. +- `setRepeatPenalty(float)` → set penalty. +- `isChatTemplateEnableThinking() -> boolean` → chat‑template thinking flag. +- `setChatTemplateEnableThinking(boolean)` → set flag. +- `getStopStrings() -> List` → unmodifiable stop strings. +- `setStopStrings(List)` → set stop strings. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`. +- `lombok.ToString`. +- `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- No checked or unchecked exceptions thrown. + +#### Concurrency +- Class is not thread‑safe; state changes via setters. No synchronization. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..34f2fd2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,35 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:11:06Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines AI generation target: single file or entire package. + +#### Purpose +- Identifies AI generation scope for configuration. +- Distinguishes file‑level from package‑level generation steps. + +#### Type +- `enum AiGenerationKind` +- Final, non‑abstract; extends `java.lang.Enum`. + +#### Core logic +- Declares constants `FILE_SUMMARY` and `PACKAGE_SUMMARY`. +- No additional methods or logic. + +#### Public API +- `FILE_SUMMARY` → single‑file generation. +- `PACKAGE_SUMMARY` → package‑wide generation. + +#### Dependencies +- None. + +#### Exceptions / Errors +- None. + +#### Concurrency +- Immutable by design; thread‑safe. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..c4f3c0b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,50 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:12:08Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a Maven‑plugin configuration bean for AI model parameters such as model path, context size, temperature, and stop strings, allowing reuse across field‑generation goals. + +#### Purpose +- Holds AI model configuration for Maven plugin. +- Enables definition sharing via lookup key. + +#### Type +- Public class, mutable JavaBean, annotated @ToString, @SuppressWarnings. + +#### Input +- Constructor: no-arg, default values. +- Setters accept: + - key (String) + - modelPath (String) + - contextSize (int) + - maxOutputTokens (int) + - temperature (float) + - threads (int) + - charsPerToken (int) + - warnOnTrim (boolean) + - maxRetries (int) + - retryTemperatureIncrement (float) + - topP (float) + - topK (int) + - repeatPenalty (float) + - chatTemplateEnableThinking (boolean) + - stopStrings (Collection\) + +#### Output +- Getters return stored values; getStopStrings returns unmodifiable view or null. +- Mutators assign provided values; setStopStrings clones collection. + +#### Core logic +- Numeric fields initialized with defaults from AiGenerationConfig. +- No validation or error handling. +- List handling: defensive copy on set, unmodifiable view on get. + +#### Public API +- `getKey() -> String` – retrieve lookup key. +- `setKey(String) -> void` – assign lookup key. +- `getModelPath() -> String` diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..033d100 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,59 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:16:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Builds a lookup table for AI model definitions, returning ready‑to‑use generation configs. + +#### Purpose +- Provides mapping from a definition key to a fully populated `AiGenerationConfig`. +- Ensures early validation of configuration entries. + +#### Type +- `final class` `AiModelDefinitionSupport` +- Annotated `@ToString`. + +#### Input +- Constructor `AiModelDefinitionSupport(List definitions)` + - Accepts `null` or empty list → no configs. + - Each `AiModelDefinition` must have non‑null `key`. +- `getConfig(String key)` receives key for lookup. + +#### Output +- Constructor initializes `configs: Map`. +- `getConfig` returns the corresponding config or throws `IllegalArgumentException`. + +#### Core logic +- Constructor + - If `definitions` null → empty `HashMap` with capacity for 0. + - Else pre‑size `HashMap` for count. + - Iterate over definitions: + - Validate key non‑null, error message includes index and definition. + - Convert definition to config via `toConfig`. + - Put key‑config pair into map. +- `getConfig` + - Retrieve from map; if missing → throw `IllegalArgumentException` with prefix `Missing AI model definition for key: `. +- `toConfig` + - Instantiates `AiGenerationConfig`. + - Copies all properties from `AiModelDefinition`. + +#### Public API +- `AiModelDefinitionSupport(List definitions) -> void` – build lookup map. +- `AiGenerationConfig getConfig(String key) -> config` – fetch config by key. + +#### Dependencies +- `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` +- `AiModelDefinition`, `AiGenerationConfig` + +#### Exceptions / Errors +- Constructor: throws `NullPointerException` if any `AiModelDefinition.key` is null, message includes list index. +- `getConfig`: throws `IllegalArgumentException` when key not found. + +#### Concurrency +- Immutable after construction; `configs` not modified elsewhere. No synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..da413cc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,55 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:29:28Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Provides a framework for configuring, selecting, and mapping AI model settings used by a Maven plugin to generate index fields. + +#### Purpose +- Manage AI model and prompt definitions for Maven-based index field generation. +- Resolve appropriate configuration per source file and convert definitions into executable AI settings. + +#### Responsibilities +- **Configuration beans** – `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`. +- **Selection logic** – `AiFieldGenerationSelector` chooses the config that matches a file’s extension. +- **Definition support** – `AiModelDefinitionSupport` builds a key‑to‑config lookup for model definitions. +- **Scope identification** – `AiGenerationKind` distinguishes file‑level from package‑level AI generation. + +#### Key units +- **AiFieldGenerationConfig** – mutable bean holding prompt key, model key, and optional file‑extension filters. +- **AiFieldGenerationSelector** – selects the first matching config for a file name, falls back to a generic config. +- **AiGenerationConfig** – holds concrete AI generation parameters (model path, context size, temperature, etc.) and is used by the AI engine. +- **AiModelDefinition** – Maven‑plugin bean that defines reusable AI model settings, referenced by key. +- **AiModelDefinitionSupport** – constructs a read‑only map from definition key to `AiGenerationConfig`; validates keys. +- **AiGenerationKind** – enum marking generation scope (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. Maven plugin reads `` and `` XML elements → creates `AiFieldGenerationConfig` and `AiModelDefinition` instances. +2. `AiModelDefinitionSupport` converts each `AiModelDefinition` into an `AiGenerationConfig` and stores in a lookup map. +3. During execution, `AiFieldGenerationSelector` receives a file name and a list of `AiFieldGenerationConfig` objects and returns the applicable config. +4. The selected config supplies the prompt key and model definition key, which are resolved to an `AiGenerationConfig` via `AiModelDefinitionSupport`. +5. The resulting `AiGenerationConfig` drives the AI generation engine to produce index fields. + +#### Dependencies +- Standard Java collections (`ArrayList`, `HashMap`, `List`, `Map`, `Collections`). +- Lombok `@ToString` for readable `toString` implementations. +- `org.jspecify.annotations.Nullable` to denote optional values. +- `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` used by `AiModelDefinitionSupport`. +- Maven plugin configuration context (implicit). + +#### Cross-cutting +- Defensive copying of collections in setters; unmodifiable views in getters to preserve immutability of exposed data. +- Null‑aware logic: file‑extension lists may be `null` to indicate “no restriction”. +- No validation of numeric ranges; defaults mirror `AiGenerationConfig` constants. +- Thread‑unsafe state in configuration classes; `AiModelDefinitionSupport` is immutable after construction. +- Reuse of the same `@ToString` annotation across all beans for consistent logging. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..3d7d6ca --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:36:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Enables Maven to generate index fields by selecting AI prompts and running llama.cpp locally or via a mock, producing clean text for documentation. + +#### Purpose +- Configure AI prompts, models, and context for Maven index generation. +- Execute AI generation using llama.cpp JNI or deterministic mock. + +#### Responsibilities +- **Configuration** – Parse `` and `` XML elements, expose `AiFieldGenerationConfig`, `AiGenerationConfig`, and `AiModelDefinition`. +- **Selection** – `AiFieldGenerationSelector` picks the first matching config for a file’s extension. +- **Provider** – `AiGenerationProviderFactory` creates a provider (`MockAiGenerationProvider` or `LlamaCppJniAiGenerationProvider`). +- **Parsing** – `AiCompletionParser` extracts the final answer from raw completions. +- **Prompt building** – `AiPromptSupport` (used by JNI provider) creates prompt strings for the model. + +#### Key units +- **AiFieldGenerationConfig** – mutable bean: prompt key, model key, optional file‑extension filters. +- **AiGenerationConfig** – concrete AI parameters: model path, context, temperature, etc.; drives the generation engine. +- **AiModelDefinition** – reusable definition referenced by key; converted by `AiModelDefinitionSupport`. +- **AiGenerationProvider** – interface for generating text; default temperature/close logic. +- **AiGenerationProviderFactory** – selects provider implementation based on key. +- **LlamaCppJniAiGenerationProvider** – builds prompt, configures `InferenceParameters`, calls `model.chatCompleteText`, parses result. +- **MockAiGenerationProvider** – deterministic summary for tests. +- **AiCompletionParser** – removes Gemma‑4 thinking blocks, returns clean string. + +#### Data flow +1. Maven reads `` & `` → creates config objects. +2. `AiModelDefinitionSupport` builds a read‑only map `definitionKey → AiGenerationConfig`. +3. During run, `AiFieldGenerationSelector` selects the applicable `AiFieldGenerationConfig` for a source file. +4. Selected config’s model key resolves to an `AiGenerationConfig` via the support map. +5. `AiGenerationProviderFactory.create` returns the provider. +6. Caller submits `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, wraps in chat messages, configures `InferenceParameters`, invokes `model.chatCompleteText`. +8. Raw completion is parsed by `AiCompletionParser` → cleaned answer returned. + +#### Dependencies +- Java collections (`List`, `Map`, etc.). +- Lombok `@ToString` for logging. +- `org.jspecify.annotations.Nullable` for optional fields. +- `net.ladenthin.llama` model, parameters, and Pair classes. +- Native JNI library via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- **Immutability**: Config objects are immutable after construction; mutable setters expose defensive copies. +- **Thread‑safety**: JNI provider performs lazy, unsynchronized initialization; parser and mock provider are stateless. +- **Exception handling**: `IOException` for JNI failures, `IllegalArgumentException` for unknown provider keys. +- **Factory pattern**: Centralizes provider creation, simplifying extension. +- **Logging**: Consistent `@ToString` annotations across beans. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..37e014b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,51 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:17:43Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Extracts the model's final answer from LLM output by removing Gemma‑4 thinking blocks. + +#### Purpose +- Parse raw LLM completion text. +- Remove internal reasoning block. + +#### Type +- **class** AiCompletionParser, non‑final, annotated `@ToString`. +- Extends `Object`. + +#### Input +- `AiCompletionParser()` constructor – no arguments. +- `parseCompletion(String response)` – raw completion string, may be `null`. + +#### Output +- Clean answer string, never `null`. +- Throws `IOException` if thinking block starts but ends missing. + +#### Core logic +- If `response` is `null`, return empty string. +- Find last index of `THINKING_BLOCK_END_MARKER`. +- If present, return substring after it, trimmed. +- If `THINKING_BLOCK_START_MARKER` exists without end marker, throw `IOException`. +- Otherwise, return trimmed original response. + +#### Public API +- `AiCompletionParser()` → `void` – constructor. +- `String parseCompletion(String response)` → `String` – parse response, remove thinking block. +- `String THINKING_BLOCK_START_MARKER` → `String` – start marker token. +- `String THINKING_BLOCK_END_MARKER` → `String` – end marker token. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` when start marker present but end marker missing. +- Error message advises increasing `maxOutputTokens`. + +#### Concurrency +- No explicit synchronization; instance fields are immutable constants. +- Thread‑safe for shared usage. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..b151921 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,50 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:19:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a pluggable AI backend that generates text for AiGenerationRequest objects. + +#### Purpose +- Supplies a text generation service for Maven llama.cpp AI indexing. +- Supports local or mock implementations. + +#### Type +- `interface` +- `extends AutoCloseable` +- Default methods for temperature override and close. + +#### Input +- `generate(AiGenerationRequest request)` – prompt key, source file, source text, current header. +- `generate(AiGenerationRequest request, float temperatureOverride)` – same request plus override temperature. +- `close()` – no arguments. + +#### Output +- `String generate(...)` – generated text, never `null`. +- `String generate(..., float)` – delegates to default, may ignore temperature. +- `void close()` – does nothing by default. + +#### Core logic +- `generate(AiGenerationRequest)` – must produce text using provider’s default sampling. +- `generate(..., float)` – default delegates to `generate(request)`. +- `close()` – default no‑op; can be overridden for resource cleanup. + +#### Public API +- `generate(AiGenerationRequest) -> String` – generate text. +- `generate(AiGenerationRequest, float) -> String` – generate with temperature override. +- `close() -> void` – close provider. + +#### Dependencies +- `java.io.IOException` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` + +#### Exceptions / Errors +- `throws IOException` if underlying provider fails. +- Temperature override ignored by default; provider may override. + +#### Concurrency +- No synchronization; default implementation stateless. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..830b868 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,54 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:20:57Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Creates an AI generation provider instance based on a supplied provider key. + +#### Purpose +- Factory for `AiGenerationProvider` implementations. + +#### Type +- `class AiGenerationProviderFactory` +- `@ToString` via Lombok. +- No inheritance or interfaces. + +#### Input +- Constructor: none. +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)` + - `providerName`: key, may be null or blank. + - `llamaConfig`: config for JNI provider. + - `promptSupport`: prompt lookup support. + +#### Output +- Returns a new `AiGenerationProvider` instance. +- Throws `IllegalArgumentException` for unknown providerName. + +#### Core logic +- If `providerName` is null or blank → return `MockAiGenerationProvider`. +- `switch` on `providerName`: + - `"mock"` → `MockAiGenerationProvider`. + - `"llamacpp-jni"` → `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)`. + - default → throw `IllegalArgumentException`. + +#### Public API +- `AiGenerationProviderFactory()` – no‑op constructor. +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` – selects provider. + +#### Dependencies +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` +- `net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider` +- `net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniAiGenerationProvider` +- `net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider` + +#### Exceptions / Errors +- `IllegalArgumentException` – “Unsupported AI provider: ”. + +#### Concurrency +- No thread‑safety concerns; instance field is immutable helper. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..7612941 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,65 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:22:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates text with a local llama.cpp model via JNI. + +#### Purpose +- Implements local text generation for AiGenerationProvider +- Lazy‑initializes llama.cpp model to reduce startup cost + +#### Type +- final class `LlamaCppJniAiGenerationProvider` +- implements `AiGenerationProvider`, `AutoCloseable` +- fields: `LlamaCppJniConfig config`; `@Nullable LlamaModel model`; `AiPromptSupport promptSupport`; `AiCompletionParser completionParser` + +#### Input +- Constructor receives `LlamaCppJniConfig config`, `AiPromptSupport promptSupport` +- `generate(request)` consumes `AiGenerationRequest` +- `generate(request, temperatureOverride)` consumes `AiGenerationRequest`, `float temperatureOverride` + +#### Output +- `generate(...)` returns generated text `String` +- `close()` frees native llama model resources + +#### Core logic +- Lazily create `LlamaModel` with `ModelParameters` derived from `config` +- Build request prompt via `promptSupport.buildPrompt(request)` +- Wrap prompt in a user `Pair` message list +- Configure `InferenceParameters` with chat template, temperature, max output tokens, top‑p, top‑k, repeat penalty, stop strings +- Call `model.chatCompleteText(inferenceParameters)` to get raw completion +- Parse raw completion through `AiCompletionParser.parseCompletion` + +#### Public API +- `LlamaCppJniAiGenerationProvider(config, promptSupport)` → initializes provider +- `generate(request)` → returns text, uses default temperature +- `generate(request, temperatureOverride)` → returns text with overridden temperature +- `close()` → releases native model + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` +- `java.io.IOException` +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `java.util.Objects` +- `lombok.ToString` + +#### Exceptions / Errors +- `generate` declares `throws IOException` +- Constructor enforces non‑null `config` and `promptSupport` via `Objects.requireNonNull` + +#### Concurrency +- `model()` performs unsynchronized lazy initialization; not thread‑safe +- Provider assumes single‑threaded usage or external synchronization diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..87108d2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,75 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:25:29Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable config holder for llama.cpp JNI provider parameters. + +#### Purpose +- Supplies configuration to llama.cpp JNI provider +- Defines model, inference, and sampling options + +#### Type +- `final class LlamaCppJniConfig` +- Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode` +- Fields: `libraryPath`, `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings` + +#### Input +- Constructor parameters: + - `String libraryPath` (native lib path, may be null) + - `String modelPath` (GGUF model file, non‑null) + - `int contextSize` (context window tokens) + - `int maxOutputTokens` (max tokens per call) + - `float temperature` (sampling temperature) + - `int threads` (CPU threads) + - `float topP` (nucleus threshold) + - `int topK` (top‑k limit) + - `float repeatPenalty` (repetition penalty) + - `boolean chatTemplateEnableThinking` (chat‑template mode) + - `List stopStrings` (may be null → empty list) + +#### Output +- Getter methods expose stored values: + - `libraryPath()` + - `modelPath()` + - `contextSize()` + - `maxOutputTokens()` + - `temperature()` + - `threads()` + - `topP()` + - `topK()` + - `repeatPenalty()` + - `chatTemplateEnableThinking()` + - `stopStrings()` returns unmodifiable list + +#### Core logic +- Constructor enforces `modelPath` non‑null +- Normalizes `stopStrings` to `Collections.emptyList()` if null + +#### Public API +- `libraryPath() -> String` (native lib path) +- `modelPath() -> String` (model file path) +- `contextSize() -> int` (context tokens) +- `maxOutputTokens() -> int` (max output tokens) +- `temperature() -> float` (sampling temp) +- `threads() -> int` (CPU threads) +- `topP() -> float` (top‑p) +- `topK() -> int` (top‑k) +- `repeatPenalty() -> float` (repetition penalty) +- `chatTemplateEnableThinking() -> boolean` (chat‑template mode) +- `stopStrings() -> List` (unmodifiable stop strings) + +#### Dependencies +- `java.util.Collections`, `java.util.List`, `java.util.Objects` +- `lombok.EqualsAndHashCode`, `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord` + +#### Exceptions / Errors +- Constructor throws `NullPointerException` if `modelPath` is null + +#### Concurrency +- Immutable after construction; thread‑safe access to all fields. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..84808e3 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,50 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:28:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides deterministic AI summary mock for testing purposes. + +#### Purpose +- Supplies a mock AiGenerationProvider for unit tests. +- Returns a predictable summary string for a given source file. + +#### Type +- `class MockAiGenerationProvider` +- `public` +- implements `AiGenerationProvider` +- annotated with `@ToString` (Lombok) + +#### Input +- `AiGenerationRequest request` +- `request.sourceFile()` yields a `Path` + +#### Output +- `String` in format `"Mock summary for "` +- May throw `IOException` + +#### Core logic +- Retrieve source file path from request. +- Resolve file name: `file.getFileName()` or fallback to full path string. +- Concatenate prefix with file name and return. + +#### Public API +- `generate(AiGenerationRequest) -> String` – returns deterministic mock summary. + +#### Dependencies +- `java.io.IOException` +- `java.nio.file.Path` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider` + +#### Exceptions / Errors +- Declares `throws IOException`; no internal error handling. +- Handles null `fileNamePath` with fallback to full path string. + +#### Concurrency +- No synchronization; class is stateless and thread‑safe. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..6947e68 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,59 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:32:48Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Provides pluggable AI text generation for Maven‑based llama.cpp indexing, featuring a JNI local provider, a deterministic mock, and parsing utilities to clean LLM output. + +#### Purpose +- Deliver AI generation services for Maven llama.cpp indexer. +- Support local (JNI) and mock backends. + +#### Responsibilities +- **Parsing** – Extract final answer from raw completion (AiCompletionParser). +- **Contract** – Define generation API (`AiGenerationProvider`). +- **Factory** – Create provider instances from a key (`AiGenerationProviderFactory`). +- **JNI Implementation** – Lazily load llama.cpp, build prompts, run inference (`LlamaCppJniAiGenerationProvider`). +- **Configuration** – Immutable holder for JNI parameters (`LlamaCppJniConfig`). +- **Mocking** – Deterministic summary for tests (`MockAiGenerationProvider`). + +#### Key units +- `AiCompletionParser`: strips Gemma‑4 thinking blocks, returns clean string. +- `AiGenerationProvider`: interface for generating text, with default temperature/close logic. +- `AiGenerationProviderFactory`: selects provider (`"mock"` → `MockAiGenerationProvider`, `"llamacpp-jni"` → `LlamaCppJniAiGenerationProvider`). +- `LlamaCppJniAiGenerationProvider`: builds prompt via `AiPromptSupport`, configures `InferenceParameters`, invokes `model.chatCompleteText`, parses result. +- `LlamaCppJniConfig`: record‑style immutable config (paths, context, tokens, temperature, threads, top‑p/k, repeat penalty, stop strings). +- `MockAiGenerationProvider`: returns `"Mock summary for "` from `AiGenerationRequest`. + +#### Data flow +1. `AiGenerationProviderFactory.create` → provider instance. +2. Caller passes `AiGenerationRequest` (prompt key, source, header). +3. JNI provider builds prompt (`promptSupport.buildPrompt`). +4. Wraps prompt in chat message pair, configures `InferenceParameters` from `LlamaCppJniConfig`. +5. Calls `model.chatCompleteText` → raw completion. +6. `AiCompletionParser.parseCompletion` → trimmed answer. +7. Result returned to caller. + +#### Dependencies +- `net.ladenthin.llama` (model, parameters, Pair). +- `lombok` for annotations. +- `jspecify.annotations.Nullable`. +- Internal: `AiGenerationRequest`, `AiPromptSupport`, `Java8CompatibilityHelper`. +- Native JNI library path supplied via `LlamaCppJniConfig`. + +#### Cross-cutting +- **Immutability**: `LlamaCppJniConfig` and most helper classes are immutable, thread‑safe. +- **Exception handling**: `IOException` for provider failures, `IllegalArgumentException` for unknown provider keys. +- **Concurrency**: `AiCompletionParser` is stateless; `LlamaCppJniAiGenerationProvider` performs unsynchronized lazy initialization, not thread‑safe by default. +- **Factory pattern**: Centralizes provider creation, allows easy extension. +- **Logging/ToString**: Lombok `@ToString` on key classes for debugging. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..86099c6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,57 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:38:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Generates index documentation fields by selecting AI prompts and executing llama.cpp or a mock provider to produce clean, model‑driven text. + +#### Purpose +- Configure AI prompts and models for Maven index generation. +- Execute AI generation via llama.cpp JNI or deterministic mock. + +#### Responsibilities +- **Configuration** – parse `` and `` XML; expose `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`. +- **Selection** – `AiFieldGenerationSelector` picks the first matching config for a file’s extension. +- **Provider** – `AiGenerationProviderFactory` creates `MockAiGenerationProvider` or `LlamaCppJniAiGenerationProvider`. +- **Parsing** – `AiCompletionParser` extracts the final answer from raw completions. +- **Prompt building** – `AiPromptSupport` (used by JNI provider) creates prompt strings for the model. + +#### Key units +- **AiFieldGenerationConfig** – bean with prompt key, model key, optional file‑extension filters. +- **AiGenerationConfig** – concrete AI parameters: model path, context, temperature, etc.; drives the generation engine. +- **AiModelDefinition** – reusable definition referenced by key; converted by `AiModelDefinitionSupport`. +- **AiGenerationProvider** – interface for generating text; default temperature/close logic. +- **AiGenerationProviderFactory** – selects provider implementation based on key. +- **LlamaCppJniAiGenerationProvider** – builds prompt, configures `InferenceParameters`, calls `model.chatCompleteText`. +- **MockAiGenerationProvider** – deterministic summary for tests. +- **AiCompletionParser** – removes Gemma‑4 thinking blocks, returns clean string. + +#### Data flow +1. Maven reads `` & `` → creates config objects. +2. `AiModelDefinitionSupport` builds a read‑only map `definitionKey → AiGenerationConfig`. +3. During run, `AiFieldGenerationSelector` selects the applicable `AiFieldGenerationConfig` for a source file. +4. Selected config’s model key resolves to an `AiGenerationConfig` via the support map. +5. `AiGenerationProviderFactory.create` returns the provider. +6. Caller submits `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, wraps in chat messages, configures `InferenceParameters`, invokes `model.chatCompleteText`. +8. Raw completion is parsed by `AiCompletionParser` → cleaned answer returned. + +#### Dependencies +- Java collections (`List`, `Map`). +- Lombok `@ToString`. +- `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model, parameters, and `Pair` classes. +- Native JNI library via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- **Immutability** – config objects immutable after construction; mutable setters expose defensive copies. +- **Thread‑safety** – JNI provider performs lazy, unsynchronized initialization; parser and mock provider are stateless. +- **Exception handling** – `IOException` for JNI failures, `IllegalArgumentException` for unknown provider keys. +- **Factory pattern** – centralizes provider creation. +- **Logging** – consistent `@ToString` annotations across beans. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..963e0f2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,54 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:40:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Generates AI‑driven index fields for Maven projects using llama.cpp or a mock provider, converting configured prompts into clean, model‑produced text for documentation. + +#### Purpose +- Automate generation of index documentation fields via AI prompts. +- Support deterministic testing with a mock provider alongside live llama.cpp execution. + +#### Responsibilities +- **Configuration** – parse XML `` & `` into beans (`AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`). +- **Selection** – `AiFieldGenerationSelector` chooses the applicable config per source file extension. +- **Provider Creation** – `AiGenerationProviderFactory` supplies either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. +- **Prompt Building & Parsing** – `AiPromptSupport` constructs prompts; `AiCompletionParser` extracts clean answers from raw completions. + +#### Key units +- **AiFieldGenerationConfig** – immutable bean with prompt key, model key, and optional file‑extension filters. +- **AiGenerationConfig** – concrete AI settings (model path, context size, temperature). +- **AiModelDefinition** – reusable definition referenced by key; mapped by `AiModelDefinitionSupport`. +- **AiGenerationProvider** – interface for generating text; implemented by JNI and mock providers. +- **LlamaCppJniAiGenerationProvider** – builds chat messages, configures `InferenceParameters`, calls `model.chatCompleteText`. +- **MockAiGenerationProvider** – deterministic summaries for unit tests. +- **AiCompletionParser** – strips Gemma‑4 thinking blocks, returns clean string. +- **AiFieldGenerationSelector** – matches file extensions to the first matching `AiFieldGenerationConfig`. + +#### Data flow +1. Maven loads `` and `` XML → constructs config objects. +2. `AiModelDefinitionSupport` creates a read‑only map `definitionKey → AiGenerationConfig`. +3. During execution, `AiFieldGenerationSelector` selects the config applicable to the source file. +4. Selected config’s model key resolves to an `AiGenerationConfig`. +5. `AiGenerationProviderFactory.create` returns the appropriate provider. +6. Caller issues `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, configures `InferenceParameters`, invokes `model.chatCompleteText`. +8. `AiCompletionParser` cleans the raw completion → final answer returned. + +#### Dependencies +- Java collections (`List`, `Map`), Lombok `@ToString`, `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model and parameter classes. +- Native JNI library via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- **Immutability** – configuration beans immutable after construction; defensive copies in setters. +- **Thread‑safety** – JNI provider lazily initializes the model without synchronization; parser and mock provider are stateless. +- **Exception handling** – `IOException` for JNI errors, `IllegalArgumentException` for unknown provider keys. +- **Factory pattern** – centralizes provider creation in `AiGenerationProviderFactory`. +- **Logging & Debugging** – consistent `@ToString` annotations across all beans for traceability. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..ad6c583 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,54 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:42:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Generates AI‑driven index fields for Maven projects, converting configured prompts into clean, model‑produced text for documentation. + +#### Purpose +- Automate generation of index documentation fields via AI prompts. +- Support deterministic testing with a mock provider alongside live llama.cpp execution. + +#### Responsibilities +- **Configuration** – parse XML `` & `` into beans (`AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`). +- **Selection** – `AiFieldGenerationSelector` chooses applicable config per source file extension. +- **Provider Creation** – `AiGenerationProviderFactory` supplies either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. +- **Prompt Building & Parsing** – `AiPromptSupport` constructs prompts; `AiCompletionParser` extracts clean answers from raw completions. + +#### Key units +- **AiFieldGenerationConfig** – immutable bean with prompt key, model key, optional file‑extension filters. +- **AiGenerationConfig** – concrete AI settings (model path, context size, temperature). +- **AiModelDefinition** – reusable definition referenced by key; mapped by `AiModelDefinitionSupport`. +- **AiGenerationProvider** – interface for generating text; implemented by JNI and mock providers. +- **LlamaCppJniAiGenerationProvider** – builds chat messages, configures `InferenceParameters`, calls `model.chatCompleteText`. +- **MockAiGenerationProvider** – deterministic summaries for unit tests. +- **AiCompletionParser** – strips Gemma‑4 thinking blocks, returns clean string. +- **AiFieldGenerationSelector** – matches file extensions to the first matching `AiFieldGenerationConfig`. + +#### Data flow +1. Maven reads `` & `` XML → constructs config objects. +2. `AiModelDefinitionSupport` creates a read‑only map `definitionKey → AiGenerationConfig`. +3. During execution, `AiFieldGenerationSelector` selects config applicable to the source file. +4. Selected config’s model key resolves to an `AiGenerationConfig`. +5. `AiGenerationProviderFactory.create` returns the appropriate provider. +6. Caller issues `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, configures `InferenceParameters`, invokes `model.chatCompleteText`. +8. `AiCompletionParser` cleans raw completion → final answer returned. + +#### Dependencies +- Java collections (`List`, `Map`), Lombok `@ToString`, `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model and parameter classes. +- Native JNI library via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- **Immutability** – configuration beans immutable after construction; defensive copies in setters. +- **Thread‑safety** – JNI provider lazily initializes the model without synchronization; parser and mock provider are stateless. +- **Exception handling** – `IOException` for JNI errors, `IllegalArgumentException` for unknown provider keys. +- **Factory pattern** – centralizes provider creation in `AiGenerationProviderFactory`. +- **Logging & Debugging** – consistent `@ToString` annotations across all beans for traceability. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..31a32bb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/net/package.ai.md @@ -0,0 +1,55 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:44:24Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Generates AI‑driven index fields for Maven projects, converting configured prompts into clean, model‑produced text for documentation. + +#### Purpose +- Automates creation of documentation index fields via AI prompts. +- Supports deterministic testing with a mock provider alongside live llama.cpp execution. + +#### Responsibilities +- **Configuration** – parse `` & `` XML into immutable beans (`AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`). +- **Selection** – `AiFieldGenerationSelector` matches file‑extension filters to the first applicable config. +- **Provider Creation** – `AiGenerationProviderFactory` supplies `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. +- **Prompt Handling** – `AiPromptSupport` builds prompts; `AiCompletionParser` extracts clean answers from raw completions. + +#### Key units +- `AiFieldGenerationConfig`: prompt key, model key, optional file‑extension filters. +- `AiGenerationConfig`: model path, context size, temperature. +- `AiModelDefinition`: reusable model definition referenced by key. +- `AiGenerationProvider`: interface; implementations include `LlamaCppJniAiGenerationProvider` and `MockAiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider`: configures `InferenceParameters`, calls `model.chatCompleteText`. +- `MockAiGenerationProvider`: deterministic summaries for unit tests. +- `AiCompletionParser`: removes Gemma‑4 thinking blocks, returns clean string. +- `AiFieldGenerationSelector`: matches source file extensions to the first matching `AiFieldGenerationConfig`. +- `AiPromptSupport`: constructs prompt text from configuration. + +#### Data flow +1. Maven reads XML → constructs config objects. +2. `AiModelDefinitionSupport` maps definition keys to `AiGenerationConfig`. +3. During execution, `AiFieldGenerationSelector` selects applicable config for a source file. +4. Selected config’s model key retrieves an `AiGenerationConfig`. +5. `AiGenerationProviderFactory.create` provides the appropriate provider. +6. Caller submits `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, configures `InferenceParameters`, invokes `model.chatCompleteText`. +8. `AiCompletionParser` cleans raw completion → final answer returned. + +#### Dependencies +- Java collections (`List`, `Map`), Lombok `@ToString`, `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model and parameter classes. +- Native JNI library via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- **Immutability** – configuration beans are immutable after construction; defensive copies in setters. +- **Thread‑safety** – JNI provider lazily initializes the model without synchronization; parser and mock provider are stateless. +- **Exception handling** – `IOException` for JNI errors, `IllegalArgumentException` for unknown provider keys. +- **Factory pattern** – `AiGenerationProviderFactory` centralizes provider creation. +- **Logging & Debugging** – consistent `@ToString` annotations across all beans for traceability. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/package.ai.md new file mode 100644 index 0000000..445dcc1 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/java/package.ai.md @@ -0,0 +1,56 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:46:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Generates AI‑driven index fields for Maven projects, converting configured prompts into clean, model‑produced text for documentation. + +#### Purpose +- Automates creation of documentation index fields via AI prompts. +- Supports deterministic testing with a mock provider and live llama.cpp execution. + +#### Responsibilities +- **Configuration** – parse `` & `` XML into immutable beans (`AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`). +- **Selection** – `AiFieldGenerationSelector` matches file‑extension filters to the first applicable config. +- **Provider Creation** – `AiGenerationProviderFactory` supplies `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. +- **Prompt Handling** – `AiPromptSupport` builds prompts; `AiCompletionParser` extracts clean answers from raw completions. + +#### Key units +- `AiFieldGenerationConfig`: prompt key, model key, optional file‑extension filters. +- `AiGenerationConfig`: model path, context size, temperature. +- `AiModelDefinition`: reusable model definition referenced by key. +- `AiGenerationProvider`: interface; implementations include `LlamaCppJniAiGenerationProvider` and `MockAiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider`: configures `InferenceParameters`, calls `model.chatCompleteText`. +- `MockAiGenerationProvider`: deterministic summaries for unit tests. +- `AiCompletionParser`: removes Gemma‑4 thinking blocks, returns clean string. +- `AiFieldGenerationSelector`: matches source file extensions to the first matching `AiFieldGenerationConfig`. +- `AiPromptSupport`: constructs prompt text from configuration. + +#### Data flow +1. Maven reads XML → constructs config objects. +2. `AiModelDefinitionSupport` maps definition keys to `AiGenerationConfig`. +3. During execution, `AiFieldGenerationSelector` selects applicable config for a source file. +4. Selected config’s model key retrieves an `AiGenerationConfig`. +5. `AiGenerationProviderFactory.create` supplies the appropriate provider. +6. Caller submits `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, configures `InferenceParameters`, invokes `model.chatCompleteText`. +8. `AiCompletionParser` cleans raw completion → final answer returned. + +#### Dependencies +- Java collections (`List`, `Map`). +- Lombok `@ToString`, `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model and parameter classes. +- Native JNI library via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- **Immutability** – configuration beans are immutable after construction. +- **Thread‑safety** – JNI provider lazily initializes the model without synchronization. +- **Exception handling** – `IOException` for JNI errors, `IllegalArgumentException` for unknown provider keys. +- **Factory pattern** – `AiGenerationProviderFactory` centralizes provider creation. +- **Logging & debugging** – consistent `@ToString` annotations across all beans for traceability. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/package.ai.md new file mode 100644 index 0000000..d9e0da6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/main/package.ai.md @@ -0,0 +1,54 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:48:28Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Generates AI‑based documentation index fields for Maven projects, translating XML configuration into prompts and extracting clean model completions. + +#### Purpose +- Automates creation of AI‑driven index fields for Maven documentation. +- Supports deterministic testing and live llama.cpp execution. + +#### Responsibilities +- **Configuration** – parse `` & `` XML into immutable beans (`AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`). +- **Selection** – `AiFieldGenerationSelector` matches file‑extension filters to the first applicable config. +- **Provider Creation** – `AiGenerationProviderFactory` supplies `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. +- **Prompt Handling** – `AiPromptSupport` builds prompts; `AiCompletionParser` extracts clean answers from raw completions. + +#### Key units +- `AiFieldGenerationConfig` – prompt key, model key, optional file‑extension filters. +- `AiGenerationConfig` – model path, context size, temperature. +- `AiModelDefinition` – reusable model definition referenced by key. +- `AiGenerationProvider` – interface; implementations `LlamaCppJniAiGenerationProvider` and `MockAiGenerationProvider`. +- `AiCompletionParser` – removes Gemma‑4 thinking blocks, returns clean string. +- `AiFieldGenerationSelector` – matches source file extensions to the first matching config. +- `AiPromptSupport` – constructs prompt text from configuration. + +#### Data flow +1. Maven parses XML → constructs config beans. +2. `AiModelDefinitionSupport` maps keys to `AiGenerationConfig`. +3. Execution: `AiFieldGenerationSelector` picks applicable config for a source file. +4. Selected config’s model key yields `AiGenerationConfig`. +5. `AiGenerationProviderFactory.create` supplies the appropriate provider. +6. Caller submits `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, configures `InferenceParameters`, calls `model.chatCompleteText`. +8. `AiCompletionParser` cleans raw completion → final answer returned. + +#### Dependencies +- Java collections (`List`, `Map`). +- Lombok `@ToString`, `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model and parameter classes. +- Native JNI via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- Immutability of configuration beans. +- Thread‑safety: JNI provider lazily initializes model. +- Exception handling: `IOException` for JNI errors, `IllegalArgumentException` for unknown provider keys. +- Factory pattern: `AiGenerationProviderFactory` centralizes provider creation. +- Consistent logging via `@ToString`. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/package.ai.md new file mode 100644 index 0000000..f696b08 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/package.ai.md @@ -0,0 +1,54 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:50:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Generates AI‑driven Maven documentation index fields by parsing XML config, selecting model definitions, and invoking llama.cpp for clean completions. + +#### Purpose +- Automates creation of AI‑driven index fields for Maven projects. +- Enables deterministic testing and live llama.cpp execution. + +#### Responsibilities +- **Configuration** – parse `` & `` XML into immutable beans (`AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`). +- **Selection** – `AiFieldGenerationSelector` matches file‑extension filters to the first applicable config. +- **Provider Creation** – `AiGenerationProviderFactory` supplies `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. +- **Prompt Handling** – `AiPromptSupport` builds prompts; `AiCompletionParser` extracts clean answers from raw completions. + +#### Key units +- `AiFieldGenerationConfig` – prompt key, model key, optional file‑extension filters. +- `AiGenerationConfig` – model path, context size, temperature. +- `AiModelDefinition` – reusable model definition referenced by key. +- `AiGenerationProvider` – interface; implementations `LlamaCppJniAiGenerationProvider` and `MockAiGenerationProvider`. +- `AiCompletionParser` – removes Gemma‑4 thinking blocks, returns clean string. +- `AiFieldGenerationSelector` – matches source file extensions to the first matching config. +- `AiPromptSupport` – constructs prompt text from configuration. + +#### Data flow +1. Maven parses XML → constructs config beans. +2. `AiModelDefinitionSupport` maps keys to `AiGenerationConfig`. +3. `AiFieldGenerationSelector` picks applicable config for a source file. +4. Selected config’s model key yields `AiGenerationConfig`. +5. `AiGenerationProviderFactory.create` supplies the appropriate provider. +6. Caller submits `AiGenerationRequest` (prompt key, source, header). +7. JNI provider builds prompt, configures `InferenceParameters`, calls `model.chatCompleteText`. +8. `AiCompletionParser` cleans raw completion → final answer returned. + +#### Dependencies +- Java collections (`List`, `Map`). +- Lombok `@ToString`, `org.jspecify.annotations.Nullable`. +- `net.ladenthin.llama` model and parameter classes. +- Native JNI via `LlamaCppJniConfig`. +- Internal helpers: `Java8CompatibilityHelper`, `AiPromptSupport`, `AiGenerationRequest`. + +#### Cross-cutting +- Immutability of configuration beans. +- Thread‑safety: JNI provider lazily initializes model. +- Exception handling: `IOException` for JNI errors, `IllegalArgumentException` for unknown provider keys. +- Factory pattern: `AiGenerationProviderFactory` centralizes provider creation. +- Consistent logging via Lombok `@ToString`. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/project.ai.md new file mode 100644 index 0000000..5f04f9e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: B269F9D9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:51:57Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The llamacpp‑ai‑index‑maven‑plugin translates XML configuration into AI prompts, selects model settings via a configurable mapping framework, and generates clean, model‑driven index fields for documentation. Core subsystems include a configuration package that maps model settings, an AI index package that orchestrates prompt selection and llama.cpp execution, and a provider package that offers pluggable providers such as a JNI local llama.cpp provider, a deterministic mock, and parsing utilities for cleaning LLM output. The plugin invokes llama.cpp locally or through the mock provider, then parses and sanitises the completion text before injecting it into the generated documentation index. This design enables developers to integrate AI‑generated index content into Maven projects while maintaining control over model selection and output formatting. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Provides a framework for configuring, selecting, and mapping AI model settings used by a Maven plugin to generate index fields. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Enables Maven to generate index fields by selecting AI prompts and running llama.cpp locally or via a mock, producing clean text for documentation. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides pluggable AI text generation for Maven‑based llama.cpp indexing, featuring a JNI local provider, a deterministic mock, and parsing utilities to clean LLM output. +- main/java/net/ladenthin/maven/llamacpp — Generates index documentation fields by selecting AI prompts and executing llama.cpp or a mock provider to produce clean, model‑driven text. +- main/java/net/ladenthin/maven — Generates AI‑driven index fields for Maven projects using llama.cpp or a mock provider, converting configured prompts into clean, model‑produced text for documentation. +- main/java/net/ladenthin — Generates AI‑driven index fields for Maven projects, converting configured prompts into clean, model‑produced text for documentation. +- main/java/net — Generates AI‑driven index fields for Maven projects, converting configured prompts into clean, model‑produced text for documentation. +- main/java — Generates AI‑driven index fields for Maven projects, converting configured prompts into clean, model‑produced text for documentation. +- main — Generates AI‑based documentation index fields for Maven projects, translating XML configuration into prompts and extracting clean model completions. +- . — Generates AI‑driven Maven documentation index fields by parsing XML config, selecting model definitions, and invoking llama.cpp for clean completions. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..00b4f6a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,54 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:53:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines the configuration for a single AI field‑generation step, mapping a prompt key to a model key and optionally restricting it to file extensions. + +#### Purpose +- Configure a single AI generation step. +- Associate a prompt template with a model definition. + +#### Type +- `public class AiFieldGenerationConfig` – extends `Object`; annotated with `@ToString`, `@SuppressWarnings`. + +#### Input +- Constructor: `AiFieldGenerationConfig()`. +- Setters: `setPromptKey(String)`, `setAiDefinitionKey(String)`, `setFileExtensions(Collection)`. +- Maven injects values via setters. + +#### Output +- `getPromptKey()` → `String` – returns prompt key. +- `getAiDefinitionKey()` → `String` – returns model key. +- `getFileExtensions()` → `@Nullable List` – unmodifiable list or `null`. + +#### Core logic +- Defensive copy of incoming file extensions (`new ArrayList<>(fileExtensions)`). +- Return unmodifiable view (`Collections.unmodifiableList`) in getter. +- Null handling: `null` or empty treated as fallback. + +#### Public API +- `AiFieldGenerationConfig()` → void – default constructor. +- `String getPromptKey()` → prompt key. +- `void setPromptKey(String)` → set prompt key. +- `String getAiDefinitionKey()` → model key. +- `void setAiDefinitionKey(String)` → set model key. +- `@Nullable List getFileExtensions()` → list or null. +- `void setFileExtensions(Collection)` → copy list. + +#### Dependencies +- `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition` + +#### Exceptions / Errors +- No checked or unchecked exceptions thrown or caught. + +#### Concurrency +- None declared; class is mutable but no thread‑safety guarantees. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..0cf5fcb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,46 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:55:45Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the AI field generation configuration for a file by matching its extension, returning the first applicable entry or a fallback. + +#### Purpose +- Determines the `AiFieldGenerationConfig` that applies to a source file. +- Provides a language‑specific configuration or a generic fallback. + +#### Type +class, final; Lombok `@ToString`; in package `net.ladenthin.maven.llamacpp.aiindex.config`. + +#### Input +- `Iterable configs` (may contain `null` entries) +- `String fileName` (e.g., `"Foo.java"`) + +#### Output +- `@Nullable AiFieldGenerationConfig` – first matching entry, fallback, or `null`. + +#### Core logic +- Initialize `fallback = null`. +- Iterate over `configs`; skip if `config == null`. +- Retrieve `config.getFileExtensions()`. +- If the extension list is `null` or empty, assign as `fallback` if unset. +- Else iterate extensions; if `fileName.endsWith(extension)` return `config`. +- After loop, return `fallback`. + +#### Public API +- `selectForFileName(Iterable, String) -> @Nullable AiFieldGenerationConfig` returns the matching or fallback config. + +#### Dependencies +- `AiFieldGenerationConfig` +- `java.util.List` +- `lombok.ToString` + +#### Exceptions / Errors +- None thrown; handles `null` config entries gracefully. + +#### Concurrency +- Thread‑safe: only local variables are used, no shared mutable state. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..2ae11ba --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,62 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T21:57:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Mutable configuration carrying AI generation parameters between Maven config and AI provider implementations. + +#### Purpose +- Stores AI model path, sampling, retry, and prompt limits. +- Exposes getters/setters for Maven plugin configuration. + +#### Type +`class AiGenerationConfig; public; Lombok @ToString; no equals/hashCode; mutable JavaBean.` + +#### Input +- `new AiGenerationConfig()` (no args). +- `setModelPath(String)`, `setContextSize(int)`, `setMaxOutputTokens(int)`, `setTemperature(float)`, `setThreads(int)`, `setCharsPerToken(int)`, `setMaxInputChars(int)`, `setWarnOnTrim(boolean)`, `setMaxRetries(int)`, `setRetryTemperatureIncrement(float)`, `setTopP(float)`, `setTopK(int)`, `setRepeatPenalty(float)`, `setChatTemplateEnableThinking(boolean)`, `setStopStrings(List)`. + +#### Output +- `getModelPath() -> String`. +- `getContextSize() -> int`. +- `getMaxOutputTokens() -> int`. +- `getTemperature() -> float`. +- `getThreads() -> int`. +- `getCharsPerToken() -> int`. +- `getMaxInputChars() -> int`. +- `isWarnOnTrim() -> boolean`. +- `getMaxRetries() -> int`. +- `getRetryTemperatureIncrement() -> float`. +- `getTopP() -> float`. +- `getTopK() -> int`. +- `getRepeatPenalty() -> float`. +- `isChatTemplateEnableThinking() -> boolean`. +- `getStopStrings() -> @Nullable List (unmodifiable)`. + +#### Core logic +- Declares default constants for context size, output tokens, temperature, threads, input char limits, etc. +- Initializes fields with default values. +- Provides mutable JavaBean setters that update fields. +- `getStopStrings()` returns `Collections.unmodifiableList` of internal list. +- `setStopStrings(null)` resets to an empty `ArrayList`. +- `@ToString` generates a diagnostic string over all fields. + +#### Public API +- `getModelPath() -> String returns GGUF model path`. +- `setModelPath(String) -> void assigns model file path`. +- `getContextSize() -> int returns token window size`. +- `setContextSize(int) -> void sets context size`. +- `getMaxOutputTokens() -> int returns max output tokens`. +- `setMaxOutputTokens(int) -> void sets max output tokens`. +- `getTemperature() -> float returns sampling temperature`. +- `setTemperature(float) -> void sets sampling temperature`. +- `getThreads() -> int returns CPU thread count`. +- `setThreads(int) -> void sets thread count`. +- `getCharsPerToken() -> int returns chars‑per‑token ratio`. +- `setCharsPerToken(int) -> void sets ratio`. +- `getMaxInputChars() -> int returns max input chars`. +- `setMaxInputChars(int) -> diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..0716eec --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,13 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:02:27Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines AI generation scopes: file or package + +#### Purpose +- Specifies the granularity of AI generation: FILE_SUMMARY or PACKAGE_SUMMARY. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..8c2f8b5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,105 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:03:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines mutable configuration for an LLM model used by a Maven plugin. + +#### Purpose +- Holds model lookup key and parameters +- Allows reuse across field‑generation goals + +#### Type +- public class AiModelDefinition; Lombok @ToString; defaults from AiGenerationConfig + +#### Input +- Constructor AiModelDefinition() – no‑op +- setKey(String) – assigns lookup key +- setModelPath(String) – assigns GGUF model path +- setContextSize(int) – assigns context window size +- setMaxOutputTokens(int) – assigns max tokens per inference +- setTemperature(float) – assigns base temperature +- setThreads(int) – assigns CPU thread count +- setCharsPerToken(int) – assigns char‑per‑token ratio +- setWarnOnTrim(boolean) – enables trim warning +- setMaxRetries(int) – assigns retry limit +- setRetryTemperatureIncrement(float) – sets retry temperature delta +- setTopP(float) – assigns nucleus‑sampling threshold +- setTopK(int) – assigns top‑k limit +- setRepeatPenalty(float) – assigns repetition penalty +- setChatTemplateEnableThinking(boolean) – toggles chat‑template thinking +- setStopStrings(Collection) – assigns stop‑strings list + +#### Output +- getKey() -> lookup key +- getModelPath() -> model file path +- getContextSize() -> context token count +- getMaxOutputTokens() -> max output tokens +- getTemperature() -> sampling temperature +- getThreads() -> CPU thread count +- getCharsPerToken() -> char‑per‑token value +- isWarnOnTrim() -> trim‑warning flag +- getMaxRetries() -> retry limit +- getRetryTemperatureIncrement() -> retry temperature delta +- getTopP() -> nucleus‑sampling threshold +- getTopK() -> top‑k limit +- getRepeatPenalty() -> repetition penalty +- isChatTemplateEnableThinking() -> chat‑template flag +- getStopStrings() -> immutable stop‑string list + +#### Core logic +- Initializes numeric fields with AiGenerationConfig defaults +- Stores fields; setters perform shallow assignments +- getStopStrings() returns unmodifiable view to preserve immutability + +#### Public API +- AiModelDefinition() -> no‑op constructor +- getKey() -> String key lookup +- setKey(String) -> assign key +- getModelPath() -> String path +- setModelPath(String) -> assign path +- getContextSize() -> int context size +- setContextSize(int) -> assign context size +- getMaxOutputTokens() -> int max output +- setMaxOutputTokens(int) -> assign max output +- getTemperature() -> float temperature +- setTemperature(float) -> assign temperature +- getThreads() -> int thread count +- setThreads(int) -> assign threads +- getCharsPerToken() -> int chars per token +- setCharsPerToken(int) -> assign chars per token +- isWarnOnTrim() -> boolean trim warning flag +- setWarnOnTrim(boolean) -> set trim warning flag +- getMaxRetries() -> int retries +- setMaxRetries(int) -> set retry limit +- getRetryTemperatureIncrement() -> float retry delta +- setRetryTemperatureIncrement(float) -> set retry delta +- getTopP() -> float top‑p value +- setTopP(float) -> set top‑p value +- getTopK() -> int top‑k value +- setTopK(int) -> set top‑k value +- getRepeatPenalty() -> float repeat penalty +- setRepeatPenalty(float) -> set repeat penalty +- isChatTemplateEnableThinking() -> boolean chat template flag +- setChatTemplateEnableThinking(boolean) -> set chat template flag +- getStopStrings() -> List stop strings +- setStopStrings(Collection) -> assign stop strings + +#### Dependencies +- AiGenerationConfig +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- None declared; all setters accept null where allowed + +#### Concurrency +- No explicit thread‑safety mechanisms; instance is not immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..19b6485 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,45 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:07:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> This class maps AI model definitions to ready‑to‑use generation configurations for the llama‑cpp AI plugin. + +#### Purpose +- Maps `AiModelDefinition` entries to `AiGenerationConfig` objects. +- Validates non‑null keys and provides eager lookup errors. + +#### Type +final class `AiModelDefinitionSupport`; Lombok `@ToString`; holds `configs` map and a `Java8CompatibilityHelper`. + +#### Input +- Constructor `AiModelDefinitionSupport(List definitions)` – list may be `null`/empty. +- `getConfig(String key)` – key must not be `null`. + +#### Output +- Constructor builds the internal `configs` map. +- `getConfig` returns the matching `AiGenerationConfig` or throws. + +#### Core logic +- **Constructor**: + - If `definitions` is `null`, create an empty map. + - Otherwise pre‑size a `HashMap` using `Java8CompatibilityHelper`. + - Iterate definitions; for each, `Objects.requireNonNull` on `definition.getKey()` with an index‑based message. + - Put `definition.getKey()` → `toConfig(definition)` into `configs`. +- **getConfig**: Retrieve config from `configs`; if `null`, throw `IllegalArgumentException` with `"Missing AI model definition for key: " + key`. +- **toConfig**: Instantiate `AiGenerationConfig` and copy all fields from `AiModelDefinition`. + +#### Public API +- `AiModelDefinitionSupport(List)` → builds lookup map. +- `getConfig(String)` → `AiGenerationConfig`; throws if key absent. + +#### Dependencies +`AiModelDefinition`, `AiGenerationConfig`, `Java8CompatibilityHelper`, `HashMap`, `List`, `Map`, `Objects`, Lombok `@ToString`. + +#### Exceptions / Errors +- Constructor: `NullPointerException` when any `definition.getKey()` is `null`. +- `getConfig`: `IllegalArgumentException` if key not found. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..a960b65 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,51 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:19:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Configures and maps AI field‑generation steps for Maven‑based projects, allowing field‑specific prompts, model definitions, and extension‑based selection. + +#### Purpose +- Central AI configuration provider for Maven Llama‑Cpp plugin. +- Supplies prompt‑model mappings, file‑extension filtering, and runtime generation settings. + +#### Responsibilities +- **Prompt‑Model mapping** – `AiFieldGenerationConfig` holds prompt key ↔ model key. +- **Extension selection** – `AiFieldGenerationSelector` resolves applicable config per file. +- **Runtime generation parameters** – `AiGenerationConfig` and `AiModelDefinition` expose model path, context, temperature, etc. +- **Definition lookup** – `AiModelDefinitionSupport` validates and retrieves `AiGenerationConfig` for a given key. + +#### Key units +- **AiFieldGenerationConfig** – mutable DTO for a single field‑generation step; defensive copies of file extensions. +- **AiFieldGenerationSelector** – static helper returning the first matching or fallback config for a filename. +- **AiGenerationConfig** – JavaBean holding generation hyper‑parameters; exposes unmodifiable stop‑string list. +- **AiModelDefinition** – mutable model definition mirroring `AiGenerationConfig`; used by plugin configuration. +- **AiModelDefinitionSupport** – constructs a lookup map of key → `AiGenerationConfig`; throws on missing keys. +- **AiGenerationKind** – enum defining FILE_SUMMARY or PACKAGE_SUMMARY scopes (unused in current flow). + +#### Data flow +1. Maven injects `AiFieldGenerationConfig` instances via setters. +2. `AiFieldGenerationSelector.selectForFileName()` chooses the config matching a source file’s extension. +3. `AiModelDefinitionSupport` builds a map from `AiModelDefinition` keys to `AiGenerationConfig`. +4. The chosen `AiGenerationConfig` drives the Llama‑Cpp AI provider during field generation. + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiModelDefinition`, `AiGenerationConfig`, `AiFieldGenerationSelector`. +- External: Lombok (`@ToString`), Java Collections (`ArrayList`, `Collections`, `List`, `Map`, `HashMap`), `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition`. + +#### Cross-cutting +- Defensive copying of mutable collections and returning unmodifiable views. +- Null handling: `null` or empty file extensions treated as fallbacks. +- Thread safety: selector uses local variables; other classes are mutable without synchronization. +- Lombok `@ToString` for diagnostics but no `equals`/`hashCode`. +- Consistent use of JavaBean getters/setters for Maven injection. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..45fc638 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,55 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:26:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Provides a Maven‑based AI field‑generation framework with configurable prompt‑model mappings and pluggable Llama‑Cpp JNI or mock providers for text generation. + +#### Purpose +- Configure AI field generation for Maven Llama‑Cpp plugin. +- Expose pluggable Llama‑Cpp JNI or mock generation backends. + +#### Responsibilities +- **Configuration** – `AiFieldGenerationConfig`, `AiFieldGenerationSelector`, `AiGenerationConfig`, `AiModelDefinition`, `AiModelDefinitionSupport`. +- **Provider** – `AiCompletionParser`, `AiGenerationProvider`, `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `LlamaCppJniConfig`, `MockAiGenerationProvider`. + +#### Key units +- `AiFieldGenerationConfig` – DTO for a single prompt‑model mapping, copies extensions. +- `AiFieldGenerationSelector` – static helper selecting the first matching config for a filename. +- `AiGenerationConfig` – JavaBean of hyper‑parameters, exposes unmodifiable stop strings. +- `AiModelDefinition` – mutable model definition mirroring `AiGenerationConfig`. +- `AiModelDefinitionSupport` – builds key → `AiGenerationConfig` map, validates keys. +- `AiGenerationProvider` – contract: `generate(AiGenerationRequest)` with optional temperature, `close()`. +- `AiGenerationProviderFactory` – selects provider implementation, defaults to `MockAiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider` – lazily constructs `LlamaModel`, builds `InferenceParameters`, calls native `chatCompleteText`, parses result. +- `LlamaCppJniConfig` – immutable settings: library path, model path, context size, max output, sampling params, stop strings. +- `MockAiGenerationProvider` – deterministic summary `"Mock summary for "`. +- `AiCompletionParser` – removes `THINKING_BLOCK_*` markers, throws `IOException` on incomplete blocks. + +#### Data flow +1. Maven injects `AiFieldGenerationConfig` instances. +2. `AiFieldGenerationSelector.selectForFileName()` picks config by file extension. +3. `AiModelDefinitionSupport` maps `AiModelDefinition` keys to `AiGenerationConfig`. +4. `AiGenerationProviderFactory.create()` selects provider (JNI or mock). +5. Provider builds prompt via `AiPromptSupport`, constructs `InferenceParameters`. +6. Native `LlamaModel.chatCompleteText` executes. +7. `AiCompletionParser.parseCompletion()` strips internal reasoning blocks. +8. Final answer returned to caller. + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiModelDefinition`, `AiGenerationConfig`, `AiFieldGenerationSelector`, `AiModelDefinitionSupport`, `AiPromptSupport`. +- External: Lombok (`@ToString`, `@EqualsAndHashCode`), Java Collections (`List`, `Map`, `HashMap`), `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition`. +- Provider internals: `Java8CompatibilityHelper`, `InferenceParameters`, `ModelParameters`, `LlamaModel`. + +#### Cross-cutting +- Defensive copying and unmodifiable views for mutable collections. +- Null handling: empty/`null` extensions treated as fallbacks. +- Thread safety: selector uses local variables; config classes immutable after construction. +- Lombok for concise data classes. +- Consistent `IOException` for parsing or I/O errors. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..50a3c02 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,41 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:10:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses LLM completion text to strip internal thinking blocks and retrieve the final answer. + +#### Purpose +- Parses Gemma‑4 responses, removing internal chain‑of‑thought reasoning. +- Provides a clean answer string for AI indexing. + +#### Type +public class AiCompletionParser @ToString + +#### Input +- `parseCompletion(String response)` receives raw completion text, may be `null`. + +#### Output +- Returns a non‑null trimmed answer string. +- Throws `IOException` if a thinking block is opened but not closed. + +#### Core logic +- If `response` is `null`, return empty string. +- Find last index of `THINKING_BLOCK_END_MARKER`. +- If found, return substring after the end marker, trimmed. +- If not found but `THINKING_BLOCK_START_MARKER` exists, throw `IOException` with actionable message. +- Otherwise return trimmed `response`. + +#### Public API +- `parseCompletion(String response) -> String cleaned answer` (throws IOException if thinking block incomplete) + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- `IOException` if `THINKING_BLOCK_START_MARKER` is present without a corresponding `THINKING_BLOCK_END_MARKER`; message suggests increasing token budget. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..db4d1d9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,41 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:11:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> AiGenerationProvider defines a pluggable backend that generates AI text from an AiGenerationRequest. + +#### Purpose +- Pluggable AI backend for generating text from AiGenerationRequest. +- Supports local llama.cpp or mock providers for testing. + +#### Type +- interface AiGenerationProvider extends AutoCloseable. + +#### Input +- `generate(AiGenerationRequest request)` – request includes prompt key, source file, source text, and current header. +- `generate(AiGenerationRequest request, float temperatureOverride)` – same request plus per‑call temperature. + +#### Output +- `String` – never `null`, may be blank if no tokens. +- `void close()` – default no‑op. + +#### Core logic +- `generate(request)` must produce text. +- `generate(request, temperatureOverride)` defaults to delegating to `generate(request)`. +- `close()` performs no operation. + +#### Public API +- `generate(AiGenerationRequest) -> String`: generates text with default sampling parameters. +- `generate(AiGenerationRequest, float) -> String`: generates text overriding temperature; defaults to `generate(request)`. +- `close() -> void`: closes the provider (no-op by default). + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest + +#### Exceptions / Errors +- Both `generate` methods and `close` declare `throws IOException`. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..647aeff --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,44 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:13:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an `AiGenerationProvider` implementation by name. + +#### Purpose +- Instantiate the requested `AiGenerationProvider` based on a provider key. + +#### Type +- `class` `AiGenerationProviderFactory` (public) annotated with `@ToString`; holds a `Java8CompatibilityHelper` field. + +#### Input +- `String providerName` +- `LlamaCppJniConfig llamaConfig` +- `AiPromptSupport promptSupport` + +#### Output +- A newly created `AiGenerationProvider` instance +- Defaults to `MockAiGenerationProvider` when `providerName` is blank or `null` + +#### Core logic +- If `providerName` is `null` or blank → return `MockAiGenerationProvider` +- Switch on `providerName`: + - `"mock"` → return `MockAiGenerationProvider` + - `"llamacpp-jni"` → return `LlamaCppJniAiGenerationProvider(llamaConfig, promptSupport)` + - otherwise → throw `IllegalArgumentException("Unsupported AI provider: " + providerName)` + +#### Public API +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider` – creates provider instance + +#### Dependencies +- `Java8CompatibilityHelper`, `AiPromptSupport`, `LlamaCppJniConfig`, `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `AiGenerationProvider` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` for unrecognized provider names + +#### Concurrency +- No threading or immutability concerns shown. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..f38f037 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,50 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:14:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides local AI text generation using llama.cpp via JNI, lazily loading a GGUF model and parsing chat completions. + +#### Purpose +- Supplies text completions for AI generation requests. +- Lazily loads and caches a native LlamaModel. + +#### Type +final class LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable @ToString + +#### Input +- LlamaCppJniConfig config (modelPath, contextSize, threads, etc.) +- AiPromptSupport promptSupport +- AiGenerationRequest request +- Optional float temperatureOverride + +#### Output +- String completion +- closes native LlamaModel on close() + +#### Core logic +- `model()` lazily constructs `LlamaModel` with `ModelParameters` from config. +- `generate(request)` calls `generate(request, config.temperature())`. +- `generate(request, temp)` builds prompt via `promptSupport.buildPrompt`. +- Builds `InferenceParameters` with messages, temperature, NPredict, topP, topK, repeatPenalty, stopStrings. +- Calls `model().chatCompleteText(inferenceParameters)` and parses result with `AiCompletionParser.parseCompletion`. +- `close()` releases native resources if model is loaded. + +#### Public API +- generate(AiGenerationRequest) -> String produces completion with configured temperature +- generate(AiGenerationRequest, float) -> String produces completion with overridden temperature +- close() -> void releases native model + +#### Dependencies +- LlamaCppJniConfig, AiPromptSupport, AiGenerationRequest, AiCompletionParser, LlamaModel, InferenceParameters, ModelParameters, Pair + +#### Exceptions / Errors +- generate methods throw IOException if native call fails +- close() handles absent model gracefully + +#### Concurrency +- No thread‑safety guarantees; single‑thread use implied. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..34418e9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,54 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:16:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable configuration holder for llama.cpp JNI provider parameters. + +#### Purpose +- Holds immutable settings for llama.cpp JNI invocation. + +#### Type +- public final class LlamaCppJniConfig; annotations: @ConvertToRecord, @ToString, @EqualsAndHashCode. + +#### Input +- Constructor params: String libraryPath, String modelPath, int contextSize, int maxOutputTokens, float temperature, int threads, float topP, int topK, float repeatPenalty, boolean chatTemplateEnableThinking, List stopStrings. +- modelPath required, stopStrings may be null. + +#### Output +- Accessors return field values; stopStrings() returns unmodifiable view. +- No side effects. + +#### Core logic +- Validate modelPath non‑null. +- Assign all fields; default empty list for null stopStrings. +- Provide record‑style getters. + +#### Public API +- `LlamaCppJniConfig(String, String, int, int, float, int, float, int, float, boolean, List) -> LlamaCppJniConfig` creates immutable config. +- `String libraryPath() -> String` native library path or null. +- `String modelPath() -> String` GGUF model path. +- `int contextSize() -> int` token window size. +- `int maxOutputTokens() -> int` max output per call. +- `float temperature() -> float` sampling temperature. +- `int threads() -> int` CPU thread count. +- `float topP() -> float` nucleus‑sampling threshold. +- `int topK() -> int` top‑k sampling limit. +- `float repeatPenalty() -> float` repetition penalty. +- `boolean chatTemplateEnableThinking() -> boolean` chat‑template thinking flag. +- `List stopStrings() -> List` unmodifiable stop‑strings list. + +#### Dependencies +- java.util.Collections, java.util.List, java.util.Objects +- lombok.EqualsAndHashCode, lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +- NullPointerException if modelPath is null. + +#### Concurrency +- Class is immutable; thread‑safe. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..db0acc9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:18:24Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Deterministic provider returning mock summaries for AiGenerationRequests during testing. + +#### Purpose +- Deterministic mock for `AiGenerationProvider` used in unit tests. + +#### Type +- public class `MockAiGenerationProvider` implements `AiGenerationProvider`; @ToString. + +#### Input +- `AiGenerationRequest request` – retrieves source file via `request.sourceFile()`. + +#### Output +- `String` "Mock summary for " + fileName; may throw `IOException`. + +#### Core logic +- Retrieve `Path file = request.sourceFile()`. +- Extract file name with `file.getFileName()`. +- Fallback to full path string if `getFileName()` is null. +- Return `"Mock summary for " + fileName`. + +#### Public API +- `generate(AiGenerationRequest) -> String` deterministic mock summary. + +#### Dependencies +- `AiGenerationRequest`, `AiGenerationProvider`, `java.io.IOException`, `java.nio.file.Path`, `lombok.ToString`. + +#### Exceptions / Errors +- Declares `throws IOException` (no runtime checks performed). + +#### Concurrency +- None. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..4d6ba9a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,58 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:22:58Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Provides pluggable AI text generation backends (llama.cpp JNI or mock) and parses LLM completions into clean answers. + +#### Purpose +- Expose a configurable AI generation provider API. +- Parse raw model outputs, removing internal reasoning blocks. + +#### Responsibilities +- **Parsing**: `AiCompletionParser` cleans completion text. +- **Interface**: `AiGenerationProvider` defines generation contract. +- **Factory**: `AiGenerationProviderFactory` selects provider implementation. +- **JNI provider**: `LlamaCppJniAiGenerationProvider` loads a GGUF model, builds prompts, and invokes native inference. +- **Configuration**: `LlamaCppJniConfig` holds immutable JNI settings. +- **Mock**: `MockAiGenerationProvider` supplies deterministic summaries for tests. + +#### Key units +- `AiCompletionParser` – removes `THINKING_BLOCK_*` markers; throws `IOException` on incomplete blocks. +- `AiGenerationProvider` – `generate(AiGenerationRequest)` and optional temperature override; `close()` default no‑op. +- `AiGenerationProviderFactory` – `create(String, LlamaCppJniConfig, AiPromptSupport)` returns provider; defaults to `MockAiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider` – lazily builds `LlamaModel`, constructs `InferenceParameters`, calls native `chatCompleteText`, and parses result. +- `LlamaCppJniConfig` – immutable holder for library path, model path, context size, max output, sampling params, stop strings. +- `MockAiGenerationProvider` – returns `"Mock summary for "` based on request’s source file. + +#### Data flow +1. Caller invokes `AiGenerationProviderFactory.create(...)`. +2. Provider receives `AiGenerationRequest` (prompt key, source file/text, header). +3. For JNI provider, `AiPromptSupport.buildPrompt` generates chat prompt. +4. `InferenceParameters` constructed with temperature, NPredict, topP/K, repeatPenalty, stopStrings. +5. Native `LlamaModel.chatCompleteText` executed. +6. Output parsed by `AiCompletionParser.parseCompletion` to strip reasoning blocks. +7. Final answer returned to caller. + +#### Dependencies +- Factory ↔ `Java8CompatibilityHelper`, `AiPromptSupport`, `LlamaCppJniConfig`, provider classes. +- JNI provider ↔ `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `LlamaModel`, `InferenceParameters`, `ModelParameters`. +- Config ↔ `ConvertToRecord`, `Objects`, `List`. +- Parser ↔ `IOException`, `lombok.ToString`. +- Mock ↔ `AiGenerationRequest`, `Path`. + +#### Cross-cutting +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) for concise data classes. +- Consistent `IOException` for I/O or parsing errors. +- Immutability of `LlamaCppJniConfig` ensures thread safety. +- Lazy initialization pattern in `LlamaCppJniAiGenerationProvider`. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..47555d4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,52 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:28:56Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> A Maven‑based AI field‑generation framework for Llama‑Cpp that maps prompts to models and offers pluggable JNI or mock providers. + +#### Purpose +- Configure AI field generation for the Llama‑Cpp Maven plugin. +- Provide pluggable Llama‑Cpp JNI or deterministic mock backends. + +#### Responsibilities +- **Configuration** – `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiModelDefinitionSupport`. +- **Provider** – `AiGenerationProvider`, `AiGenerationProviderFactory`, `LlamaCppJniAiGenerationProvider`, `MockAiGenerationProvider`. +- **Parsing** – `AiCompletionParser`. + +#### Key units +- `AiFieldGenerationConfig`: DTO for prompt‑model mapping, copies extensions. +- `AiFieldGenerationSelector`: chooses first matching config by file extension. +- `AiGenerationConfig`: immutable hyper‑parameters, unmodifiable stop strings. +- `AiModelDefinition`: mutable mirror of `AiGenerationConfig`. +- `AiModelDefinitionSupport`: builds key → `AiGenerationConfig` map, validates keys. +- `AiGenerationProvider`: contract `generate(AiGenerationRequest)`; optional temperature; `close()`. +- `AiGenerationProviderFactory`: selects provider implementation; defaults to `MockAiGenerationProvider`. +- `LlamaCppJniAiGenerationProvider`: lazily constructs `LlamaModel`, builds `InferenceParameters`, calls native `chatCompleteText`, parses result. +- `LlamaCppJniConfig`: immutable settings (library path, model path, context size, max output, sampling, stop strings). +- `MockAiGenerationProvider`: deterministic summary `"Mock summary for "`. +- `AiCompletionParser`: removes `THINKING_BLOCK_*` markers, throws `IOException` on incomplete blocks. + +#### Data flow +1. Maven injects `AiFieldGenerationConfig` instances. +2. `AiFieldGenerationSelector.selectForFileName()` picks config by file extension. +3. `AiModelDefinitionSupport` maps `AiModelDefinition` keys to `AiGenerationConfig`. +4. `AiGenerationProviderFactory.create()` selects provider (JNI or mock). +5. Provider builds prompt via `AiPromptSupport`, constructs `InferenceParameters`. +6. Native `LlamaModel.chatCompleteText` executes. +7. `AiCompletionParser.parseCompletion()` removes internal reasoning blocks. +8. Final answer returned to caller. + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiModelDefinition`, `AiGenerationConfig`, `AiFieldGenerationSelector`, `AiModelDefinitionSupport`, `AiPromptSupport`. +- External: Lombok annotations, Java Collections (`List`, `Map`, `HashMap`), `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition`, Llama‑Cpp JNI types (`InferenceParameters`, `ModelParameters`, `LlamaModel`). + +#### Cross-cutting +- Defensive copying and unmodifiable views for mutable collections. +- Null handling: empty/`null` extensions treated as fallbacks. +- Thread safety via local variables; config classes immutable after construction. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..af153c8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,11 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:31:50Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> A Maven‑based AI field‑generation framework for Llama‑Cpp that maps prompts to models and offers pluggable JNI or mock providers. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..a791fa8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,11 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:33:00Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> A Maven‑based AI field‑generation framework for Llama‑Cpp that maps prompts to models and offers pluggable JNI or mock providers. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..2fb14ed --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/net/package.ai.md @@ -0,0 +1,38 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:33:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> A Maven‑based AI field‑generation framework that maps prompts to Llama‑Cpp models and provides pluggable JNI or mock providers. + +#### Purpose +- Enables field‑generation in AI applications using Llama‑Cpp. +- Supports flexible provider configuration (JNI, mock). + +#### Responsibilities +- **Prompt‑Model Mapping** – translates user prompts into specific Llama‑Cpp model calls. +- **Provider Abstraction** – offers a common interface for JNI or mock implementations. + +#### Key units +- **Framework Core** – orchestrates prompt mapping and provider selection. +- **Provider Interface** – defines contract for JNI and mock providers. + +#### Data flow +1. Prompt received from user/API. +2. Framework Core selects appropriate model. +3. Provider Interface invokes Llama‑Cpp via JNI or mock. +4. Result returned to caller. + +#### Dependencies +- Llama‑Cpp native library via JNI. +- Maven build system for dependency management. +- Optional mock provider for testing. + +#### Cross-cutting +- Pluggable provider pattern for extensibility. +- Mock support for isolated testing and CI. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/package.ai.md new file mode 100644 index 0000000..5bbed40 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/java/package.ai.md @@ -0,0 +1,38 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:35:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> A Maven‑based AI field‑generation framework mapping prompts to Llama‑Cpp models with pluggable JNI or mock providers. + +#### Purpose +- Enables field‑generation in AI applications using Llama‑Cpp. +- Supports flexible provider configuration (JNI, mock). + +#### Responsibilities +- **Prompt‑Model Mapping** – translates user prompts into specific Llama‑Cpp model calls. +- **Provider Abstraction** – offers a common interface for JNI or mock implementations. + +#### Key units +- **Framework Core** – orchestrates prompt mapping and provider selection. +- **Provider Interface** – defines contract for JNI and mock providers. + +#### Data flow +1. Prompt received from user/API. +2. Framework Core selects appropriate model. +3. Provider Interface invokes Llama‑Cpp via JNI or mock. +4. Result returned to caller. + +#### Dependencies +- Llama‑Cpp native library via JNI. +- Maven build system for dependency management. +- Optional mock provider for testing. + +#### Cross-cutting +- Pluggable provider pattern for extensibility. +- Mock support for isolated testing and CI. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/package.ai.md new file mode 100644 index 0000000..a1c938b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/main/package.ai.md @@ -0,0 +1,38 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:36:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> A Maven‑based AI field‑generation framework mapping prompts to Llama‑Cpp models with pluggable JNI or mock providers. + +#### Purpose +- Enables field‑generation in AI applications using Llama‑Cpp. +- Supports flexible provider configuration (JNI, mock). + +#### Responsibilities +- **Prompt‑Model Mapping** – translates user prompts into specific Llama‑Cpp model calls. +- **Provider Abstraction** – offers a common interface for JNI or mock implementations. + +#### Key units +- **Framework Core** – orchestrates prompt mapping and provider selection. +- **Provider Interface** – defines contract for JNI and mock providers. + +#### Data flow +1. Prompt received from user/API. +2. Framework Core selects appropriate model. +3. Provider Interface invokes Llama‑Cpp via JNI or mock. +4. Result returned to caller. + +#### Dependencies +- Llama‑Cpp native library via JNI. +- Maven build system for dependency management. +- Optional mock provider for testing. + +#### Cross-cutting +- Pluggable provider pattern for extensibility. +- Mock support for isolated testing and CI. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/package.ai.md new file mode 100644 index 0000000..8ee1a1b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/package.ai.md @@ -0,0 +1,38 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:37:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> This package provides a Maven‑based AI field‑generation framework that maps prompts to Llama‑Cpp models with pluggable JNI or mock providers. + +#### Purpose +- Enables field‑generation in AI applications using Llama‑Cpp. +- Supports flexible provider configuration (JNI, mock). + +#### Responsibilities +- **Prompt‑Model Mapping** – translates user prompts into specific Llama‑Cpp model calls. +- **Provider Abstraction** – offers a common interface for JNI and mock implementations. + +#### Key units +- **Framework Core** – orchestrates prompt mapping and provider selection. +- **Provider Interface** – defines contract for JNI and mock providers. + +#### Data flow +1. Prompt received from user/API. +2. Framework Core selects appropriate model. +3. Provider Interface invokes Llama‑Cpp via JNI or mock. +4. Result returned to caller. + +#### Dependencies +- Llama‑Cpp native library via JNI. +- Maven build system for dependency management. +- Optional mock provider for testing. + +#### Cross-cutting +- Pluggable provider pattern for extensibility. +- Mock support for isolated testing and CI. diff --git a/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/project.ai.md new file mode 100644 index 0000000..50d3d19 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__gptoss-20b__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: D8A7261C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:38:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +llamacpp-ai-index-maven-plugin is a Maven‑based AI field‑generation framework that maps prompts to Llama‑Cpp models with pluggable JNI or mock providers. Its core subsystems include the aiindex package, which orchestrates prompt‑to‑model mappings and field‑generation logic, and the provider package, which supplies pluggable text‑generation backends and parses LLM completions into clean answers. The config package offers configuration and mapping of AI field‑generation steps, allowing field‑specific prompts, model definitions, and extension‑based selection, thereby tying the framework together for declarative Maven project integration. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Configures and maps AI field‑generation steps for Maven‑based projects, allowing field‑specific prompts, model definitions, and extension‑based selection. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Provides a Maven‑based AI field‑generation framework with configurable prompt‑model mappings and pluggable Llama‑Cpp JNI or mock providers for text generation. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides pluggable AI text generation backends (llama.cpp JNI or mock) and parses LLM completions into clean answers. +- main/java/net/ladenthin/maven/llamacpp — A Maven‑based AI field‑generation framework for Llama‑Cpp that maps prompts to models and offers pluggable JNI or mock providers. +- main/java/net/ladenthin/maven — A Maven‑based AI field‑generation framework for Llama‑Cpp that maps prompts to models and offers pluggable JNI or mock providers. +- main/java/net/ladenthin — A Maven‑based AI field‑generation framework for Llama‑Cpp that maps prompts to models and offers pluggable JNI or mock providers. +- main/java/net — A Maven‑based AI field‑generation framework that maps prompts to Llama‑Cpp models and provides pluggable JNI or mock providers. +- main/java — A Maven‑based AI field‑generation framework mapping prompts to Llama‑Cpp models with pluggable JNI or mock providers. +- main — A Maven‑based AI field‑generation framework mapping prompts to Llama‑Cpp models with pluggable JNI or mock providers. +- . — This package provides a Maven‑based AI field‑generation framework that maps prompts to Llama‑Cpp models with pluggable JNI or mock providers. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..3c7683d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,53 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:06:26Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Associates a prompt template key with an AI model definition key for field generation. + +#### Type +- Class, final, no extends/implements, no generics. + +#### Input +- Constructor and method parameters: `promptKey`, `aiDefinitionKey`, `fileExtensions`. +- Consumed fields: `promptKey`, `aiDefinitionKey`, `fileExtensions`. +- Read resources: none. + +#### Output +- Return types: `String` for getters, `List` for `getFileExtensions()`. +- Produced state: none. +- Mutated fields: `promptKey`, `aiDefinitionKey`, `fileExtensions`. +- Written resources: none. +- Side effects: none. + +#### Core Logic +- Retrieves prompt key. +- Retrieves AI model definition key. +- Retrieves file extensions. +- Sets prompt key. +- Sets AI model definition key. +- Sets file extensions. + +#### Public API +- `getPromptKey() -> String`: Returns the prompt template key. +- `setPromptKey(promptKey) -> void`: Sets the prompt template key. +- `getAiDefinitionKey() -> String`: Returns the AI model definition key. +- `setAiDefinitionKey(aiDefinitionKey) -> void`: Sets the AI model definition key. +- `getFileExtensions() -> @Nullable List`: Returns the file extensions. +- `setFileExtensions(fileExtensions) -> void`: Sets the file extensions. + +#### Dependencies +- Imports: `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. + +#### Exceptions / Errors +- None notable. + +#### Concurrency +- No threading, synchronization, immutability, or thread-safety notes. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..e9957ff --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,53 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:07:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Selects the appropriate AI field generation configuration based on source file extensions. + +#### Type +- Class: `AiFieldGenerationSelector` +- Final: Yes +- Extends: None +- Implements: None +- Key generics and type bounds: None + +#### Input +- Constructor: None +- Method Parameters: + - `configs` (Iterable): Configured field generations + - `fileName` (String): Source file name + +#### Output +- Return Types: + - `AiFieldGenerationConfig`: The selected configuration + - `null`: When no match is found and no fallback is configured + +#### Core Logic +- Iterates over `configs`: + - Skips `null` entries + - Checks if the configuration has non-empty extensions + - Matches `fileName` with extensions + - Returns the first matching configuration + - Falls back to the first extension-agnostic entry if no match is found + - Returns `null` if no match and no fallback is configured + +#### Public API +- `selectForFileName(Iterable, String) -> @Nullable AiFieldGenerationConfig`: Returns the first extension-matching entry, else the first fallback entry, else `null`. + +#### Dependencies +- Imports: `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable` +- Referenced Types: `AiFieldGenerationConfig` + +#### Exceptions / Errors +- None explicitly thrown or caught in the provided source. + +#### Concurrency +- Not explicitly addressed in the provided source. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..a25413a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,84 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:07:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI generation parameters for Maven-based AI model interactions + +#### Purpose +- Mutable configuration object for AI generation steps +- Carries parameters between Maven configuration and AI provider implementations + +#### Type +- Class: `AiGenerationConfig` +- Final: Yes +- Extends: None +- Implements: None +- Key generics and type bounds: None +- Annotations: `@ToString`, `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})` + +#### Input +- Constructor and method parameters: `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `maxRetries`, `retryTemperatureIncrement`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings` +- Injected dependencies: None +- Consumed fields: `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `maxRetries`, `retryTemperatureIncrement`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings` +- Read resources: None + +#### Output +- Return types: `String`, `int`, `float`, `List` +- Produced state: None +- Mutated fields: `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `maxRetries`, `retryTemperatureIncrement`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings` +- Written resources: None +- Side effects: None + +#### Core logic +- Default values for configuration parameters +- Getter and setter methods for each configuration parameter +- Automatic calculation of `maxInputChars` based on context size, output tokens, prompt overhead, and safety margin +- Unmodifiable view of stop strings + +#### Public API +- `getModelPath() -> String`: Returns the GGUF model file path +- `setModelPath(String) -> void`: Sets the GGUF model file path +- `getContextSize() -> int`: Returns the context window size in tokens +- `setContextSize(int) -> void`: Sets the context window size in tokens +- `getMaxOutputTokens() -> int`: Returns the maximum number of output tokens per inference call +- `setMaxOutputTokens(int) -> void`: Sets the maximum number of output tokens per inference call +- `getTemperature() -> float`: Returns the sampling temperature +- `setTemperature(float) -> void`: Sets the sampling temperature +- `getThreads() -> int`: Returns the number of CPU threads used for inference +- `setThreads(int) -> void`: Sets the number of CPU threads used for inference +- `getCharsPerToken() -> int`: Returns the number of characters per token used in automatic `maxInputChars` calculation +- `setCharsPerToken(int) -> void`: Sets the number of characters per token +- `getMaxInputChars() -> int`: Returns the maximum number of input characters fed to the prompt +- `setMaxInputChars(int) -> void`: Sets the maximum number of input characters fed to the prompt +- `isWarnOnTrim() -> boolean`: Returns whether a warning is emitted when the prompt source text is trimmed +- `setWarnOnTrim(boolean) -> void`: Sets whether a warning is emitted when the prompt source text is trimmed +- `getMaxRetries() -> int`: Returns the maximum number of retry attempts on empty-body responses +- `setMaxRetries(int) -> void`: Sets the maximum number of retry attempts on empty-body responses +- `getRetryTemperatureIncrement() -> float`: Returns the temperature increment added on each retry attempt +- `setRetryTemperatureIncrement(float) -> void`: Sets the temperature increment added on each retry attempt +- `getTopP() -> float`: Returns the nucleus-sampling probability threshold +- `setTopP(float) -> void`: Sets the nucleus-sampling probability threshold +- `getTopK() -> int`: Returns the top-k sampling limit +- `setTopK(int) -> void`: Sets the top-k sampling limit +- `getRepeatPenalty() -> float`: Returns the repetition penalty +- `setRepeatPenalty(float) -> void`: Sets the repetition penalty +- `isChatTemplateEnableThinking() -> boolean`: Returns whether the model's chat-template thinking mode is enabled +- `setChatTemplateEnableThinking(boolean) -> void`: Sets whether the model's chat-template thinking mode is enabled +- `getStopStrings() -> @Nullable List`: Returns an unmodifiable view of the configured stop strings +- `setStopStrings(@Nullable List) -> void`: Sets the list of stop strings + +#### Dependencies +- Imports: `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable` +- Referenced types: `ArrayList`, `Collections`, `Lombok`, `Net.ladenthin.maven.llamacpp.aiindex.config`, `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No notable thrown/caught exceptions +- No notable null-handling or error conditions + +#### Concurrency +- No threading, synchronization, immutability, or thread-safety notes diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..10e0a56 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,53 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:09:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies whether an AI generation operates on a single source file or a whole package. + +#### Purpose +- Identifies AI generation operation scope: single file or package. + +#### Type +- Enum: `AiGenerationKind` +- Modifiers: `public` +- No extends / implements +- No generics or type bounds +- No notable annotations + +#### Input +- No constructor parameters +- No injected dependencies +- No consumed fields +- No read resources + +#### Output +- No return values +- No produced state +- No mutated fields +- No written resources +- No side effects + +#### Core logic +- Enum with two constants: + - `FILE_SUMMARY`: Generation step for a single source file. + - `PACKAGE_SUMMARY`: Generation step for a package aggregate. + +#### Public API +- `FILE_SUMMARY`: Identifies generation for a single source file. +- `PACKAGE_SUMMARY`: Identifies generation for a package aggregate. + +#### Dependencies +- No imports +- No referenced types + +#### Exceptions / Errors +- No notable thrown/caught exceptions +- No null-handling or error conditions + +#### Concurrency +- No threading, synchronization, immutability, or thread-safety notes diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..7238055 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,69 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:09:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Provides a configuration POJO for pairing a lookup key with AI model parameters. + +#### Type +- Class, final, no extends/implements, uses lombok.ToString, lombok.NonNull, org.jspecify.annotations.Nullable. + +#### Input +- Constructor and method parameters: key, modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, warnOnTrim, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings. + +#### Output +- Returns: key, modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, warnOnTrim, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings. +- Mutates: key, modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, warnOnTrim, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings. + +#### Core logic +- Provides getters and setters for all configuration parameters. +- Manages default values from `AiGenerationConfig`. +- Handles nullable stop strings. + +#### Public API +- `getKey() -> String`: Returns the lookup key. +- `setKey(String) -> void`: Sets the lookup key. +- `getModelPath() -> String`: Returns the model path. +- `setModelPath(String) -> void`: Sets the model path. +- `getContextSize() -> int`: Returns context size. +- `setContextSize(int) -> void`: Sets context size. +- `getMaxOutputTokens() -> int`: Returns max output tokens. +- `setMaxOutputTokens(int) -> void`: Sets max output tokens. +- `getTemperature() -> float`: Returns temperature. +- `setTemperature(float) -> void`: Sets temperature. +- `getThreads() -> int`: Returns thread count. +- `setThreads(int) -> void`: Sets thread count. +- `getCharsPerToken() -> int`: Returns chars-per-token ratio. +- `setCharsPerToken(int) -> void`: Sets chars-per-token ratio. +- `isWarnOnTrim() -> boolean`: Returns warning flag. +- `setWarnOnTrim(boolean) -> void`: Sets warning flag. +- `getMaxRetries() -> int`: Returns max retries. +- `setMaxRetries(int) -> void`: Sets max retries. +- `getRetryTemperatureIncrement() -> float`: Returns retry temperature increment. +- `setRetryTemperatureIncrement(float) -> void`: Sets retry temperature increment. +- `getTopP() -> float`: Returns top-p value. +- `setTopP(float) -> void`: Sets top-p value. +- `getTopK() -> int`: Returns top-k value. +- `setTopK(int) -> void`: Sets top-k value. +- `getRepeatPenalty() -> float`: Returns repeat penalty. +- `setRepeatPenalty(float) -> void`: Sets repeat penalty. +- `isChatTemplateEnableThinking() -> boolean`: Returns chat template thinking flag. +- `setChatTemplateEnableThinking(boolean) -> void`: Sets chat template thinking flag. +- `getStopStrings() -> @Nullable List`: Returns stop strings. +- `setStopStrings(Collection) -> void`: Sets stop strings. + +#### Dependencies +- Imports: java.util.ArrayList, java.util.Collection, java.util.Collections, java.util.List, lombok.ToString, org.jspecify.annotations.Nullable, net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig. + +#### Exceptions / Errors +- No notable exceptions or errors. + +#### Concurrency +- No concurrency considerations noted. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..01db891 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,43 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:11:00Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Resolves {@link AiModelDefinition} entries by their key, returning the corresponding {@link AiGenerationConfig}. + +#### Type +- Class, final, implements Java8CompatibilityHelper. + +#### Input +- List definitions. + +#### Output +- Map configs; AiGenerationConfig getConfig(String key). + +#### Core Logic +- Constructs a lookup table from AI model definitions. +- Ensures each definition has a non-null key. +- Converts definitions to generation configs. +- Throws NullPointerException for null keys. +- Throws IllegalArgumentException for missing keys. + +#### Public API +- AiGenerationConfig getConfig(String key) -> AiGenerationConfig; Returns generation config for a key. +- toConfig(AiModelDefinition) -> AiGenerationConfig; Converts definition to config. + +#### Dependencies +- java.util.HashMap; java.util.List; java.util.Map; java.util.Objects; net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper. + +#### Exceptions / Errors +- NullPointerException for null keys. +- IllegalArgumentException for missing keys. + +#### Concurrency +- HashMap is not thread-safe; consider synchronization for concurrent access. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..62ed7e7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,57 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:14:16Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Calculates VAT for invoices + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. + +#### Cross-cutting +- No recurring patterns across files noted. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..53dd83f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,74 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:16:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..835e01d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,43 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:11:29Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Purpose +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Type +- Class, final + +#### Input +- `response`: raw completion text from the model, may be `null` + +#### Output +- Cleaned answer text, never `null` + +#### Core Logic +- If `response` is `null`, return an empty string. +- Find the last occurrence of `THINKING_BLOCK_END_MARKER`. + - If found, return the substring after this marker, trimmed. + - If not found but `THINKING_BLOCK_START_MARKER` is present, throw an `IOException` indicating the token budget was exhausted. + - If neither marker is present, return the trimmed response. + +#### Public API +- `parseCompletion(response) -> String` + Strips any Gemma-4 thinking block from `response` and returns the clean answer text. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` if a thinking block was started but the token budget was exhausted before the closing marker was emitted. + +#### Concurrency +- Not explicitly noted, but the class is non-final to allow subclassing and mocking in tests. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..97fc10a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,39 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:11:58Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides AI text generation for prompts using specified or default sampling parameters. + +#### Purpose +- Pluggable AI backend for generating text based on prompts. + +#### Type +- Interface: `AiGenerationProvider` extending `AutoCloseable`. + +#### Input +- `AiGenerationRequest` (prompt key, source file, source text, current header). + +#### Output +- Generated text (`String`); never `null`, but may be blank. + +#### Core Logic +- `generate(AiGenerationRequest request)`: Generates text using default parameters. +- `generate(AiGenerationRequest request, float temperatureOverride)`: Overrides temperature for sampling. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates text with default settings. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates text with specified temperature. + +#### Dependencies +- `java.io.IOException`: For handling I/O exceptions. + +#### Exceptions / Errors +- `IOException`: Thrown by underlying provider failures. + +#### Concurrency +- Not explicitly noted; assumes thread safety based on interface design. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..d3abc18 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,39 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:12:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Selects and instantiates an `AiGenerationProvider` implementation by name. + +#### Type +- Class, final, no extends/implements, no generics. + +#### Input +- `providerName` (String), `llamaConfig` (LlamaCppJniConfig), `promptSupport` (AiPromptSupport). + +#### Output +- `AiGenerationProvider` instance. + +#### Core Logic +- Returns `MockAiGenerationProvider` if `providerName` is null or blank. +- Returns `LlamaCppJniAiGenerationProvider` for "llamacpp-jni". +- Throws `IllegalArgumentException` for unsupported providers. + +#### Public API +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` selects provider based on name. + +#### Dependencies +- `Java8CompatibilityHelper`, `LlamaCppJniConfig`, `AiPromptSupport`. + +#### Exceptions / Errors +- Throws `IllegalArgumentException` for unsupported providers. + +#### Concurrency +- No explicit concurrency notes. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..d96ad6e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,53 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:12:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. + +#### Purpose +- Provides a service for generating AI-based completion based on llama.cpp configurations. + +#### Type +- Class, final, implements `AiGenerationProvider` and `AutoCloseable`. + +#### Input +- `AiGenerationRequest request`: Request parameters for generation. +- `float temperatureOverride`: Override temperature for generation. + +#### Output +- `String`: Generated completion text. + +#### Core Logic +- Loads the GGUF model lazily on first use. +- Constructs `InferenceParameters` with provided configurations. +- Builds prompt using `AiPromptSupport`. +- Parses completion using `completionParser`. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig config, AiPromptSupport promptSupport)`: Initializes the provider. +- `String generate(AiGenerationRequest request)`: Generates completion text. +- `String generate(AiGenerationRequest request, float temperatureOverride)`: Generates completion text with temperature override. +- `void close()`: Closes the native llama.cpp model. + +#### Dependencies +- `java.io.IOException`: For handling I/O exceptions. +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`: For data structures. +- `java.util.Objects`: For object utility methods. +- `lombok.ToString`: For generating toString method. +- `net.ladenthin.llama.LlamaModel`: For llama.cpp model handling. +- `net.ladenthin.llama.parameters.InferenceParameters`: For inference parameters. +- `net.ladenthin.llama.parameters.ModelParameters`: For model parameters. +- `net.ladenthin.llama.value.Pair`: For pairing strings. +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`: For generation request. +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`: For prompt support. + +#### Exceptions / Errors +- `IOException`: Thrown when handling I/O operations. + +#### Concurrency +- The class is thread-safe due to the lazy initialization of the model and use of immutable parameters. No explicit synchronization is required. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..156d1c6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,64 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:13:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates VAT for invoices + +#### Purpose +- Provides configuration for the llama.cpp JNI provider. + +#### Type +- Kind: final class +- Modifiers: none +- Extends: none +- Implements: none +- Key generics and type bounds: none +- Notable annotations: @ConvertToRecord, @ToString, @EqualsAndHashCode + +#### Input +- Constructor and method parameters: libraryPath, modelPath, contextSize, maxOutputTokens, temperature, threads, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings +- Injected dependencies: none +- Consumed fields: none +- Read resources: none + +#### Output +- Produced state: none +- Mutated fields: none +- Written resources: none +- Side effects: none + +#### Core logic +- Immutable configuration with value semantics +- Accessors for each configuration parameter + +#### Public API +- libraryPath() -> String: Returns the native library path +- modelPath() -> String: Returns the GGUF model file path +- contextSize() -> int: Returns the context window size in tokens +- maxOutputTokens() -> int: Returns the maximum number of output tokens per call +- temperature() -> float: Returns the sampling temperature +- threads() -> int: Returns the number of CPU threads +- topP() -> float: Returns the nucleus-sampling probability threshold +- topK() -> int: Returns the top-k sampling limit +- repeatPenalty() -> float: Returns the repetition penalty +- chatTemplateEnableThinking() -> boolean: Returns whether chat-template thinking mode is enabled +- stopStrings() -> List: Returns an unmodifiable view of the configured stop strings + +#### Dependencies +- java.util.Collections +- java.util.List +- java.util.Objects +- lombok.EqualsAndHashCode +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +- None + +#### Concurrency +- Immutable configuration; thread-safe by design diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..2f29fe6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,43 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:13:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Calculates deterministic mock summaries for AI generation requests in testing. + +#### Purpose +- Provides deterministic mock summaries for AI generation requests. + +#### Type +- Class +- Final +- Implements `AiGenerationProvider` + +#### Input +- `AiGenerationRequest request`: Source file path and name. + +#### Output +- Returns a mock summary string for the provided request. + +#### Core Logic +- Retrieves file name from `request`. +- Constructs and returns a mock summary string. + +#### Public API +- `MockAiGenerationProvider()`: No-op constructor. +- `String generate(final AiGenerationRequest request) throws IOException`: Generates a mock summary. + +#### Dependencies +- `java.io.IOException` +- `java.nio.file.Path` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` if file name retrieval fails. + +#### Concurrency +- Not explicitly noted, but the class is thread-safe due to its stateless nature. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..1493daf --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,59 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:15:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> A package for parsing LLM completion text and providing AI text generation services using llama.cpp JNI bindings. + +#### Purpose +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Pluggable AI backend for generating text based on prompts. +- Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. + +#### Key Units +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `java.io.IOException`: For handling I/O exceptions. +- `java.util.ArrayList`, `java.util.Collections`, `java.util.List`: For data structures. +- `java.util.Objects`: For object utility methods. +- `lombok.ToString`: For generating toString method. +- `net.ladenthin.llama.LlamaModel`: For llama.cpp model handling. +- `net.ladenthin.llama.parameters.InferenceParameters`: For inference parameters. +- `net.ladenthin.llama.parameters.ModelParameters`: For model parameters. +- `net.ladenthin.llama.value.Pair`: For pairing strings. +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`: For generation request. +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`: For prompt support. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides comprehensive tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, with a focus on modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..fba0c8f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,73 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:18:15Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..bec72c6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,73 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:19:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..149035f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,73 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:21:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..5bc8317 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/net/package.ai.md @@ -0,0 +1,73 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:22:50Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/package.ai.md new file mode 100644 index 0000000..10eea6a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/java/package.ai.md @@ -0,0 +1,73 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:24:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/package.ai.md new file mode 100644 index 0000000..876ab6f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/main/package.ai.md @@ -0,0 +1,73 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:25:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/package.ai.md new file mode 100644 index 0000000..340805e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/package.ai.md @@ -0,0 +1,73 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:27:24Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. + +#### Purpose +- Provides configuration and selection mechanisms for AI field generation based on file extensions and model definitions. +- Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. +- Provides AI text generation for prompts using specified or default sampling parameters. + +#### Responsibilities +- `AiFieldGenerationConfig`: Associates prompt and AI model definition keys with file extensions for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Configures AI generation parameters for Maven-based AI model interactions. +- `AiGenerationKind`: Identifies whether AI generation operates on a single source file or a whole package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Pluggable AI backend for generating text based on prompts. +- `AiGenerationProviderFactory`: Calculates VAT for invoices using the llama.cpp JNI binding and GGUF models locally. +- `LlamaCppJniAiGenerationProvider`: Provides a service for generating AI-based completion based on llama.cpp configurations. +- `LlamaCppJniConfig`: Provides configuration for the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Key Units +- `AiFieldGenerationConfig`: Associates prompt template keys with AI model definition keys for field generation. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on source file extensions. +- `AiGenerationConfig`: Carries parameters between Maven configuration and AI provider implementations. +- `AiGenerationKind`: Identifies AI generation operation scope: single file or package. +- `AiModelDefinition`: Provides a configuration POJO for pairing a lookup key with AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser`: Parses raw LLM completion text to extract the model answer. +- `AiGenerationProvider`: Generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory`: Selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider`: Uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig`: Configures the llama.cpp JNI provider. +- `MockAiGenerationProvider`: Provides deterministic mock summaries for AI generation requests in testing. + +#### Data Flow +- `AiFieldGenerationConfig` is instantiated with prompt and AI model definition keys and file extensions. +- `AiFieldGenerationSelector` iterates over configurations to select one based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` determines the scope of AI generation (single file or package). +- `AiModelDefinition` provides configuration parameters for AI model interactions. +- `AiModelDefinitionSupport` resolves AI model definition entries by their key, returning the corresponding AI generation configuration. +- `AiCompletionParser` processes raw completion text to extract the model answer. +- `AiGenerationProvider` generates text based on `AiGenerationRequest`. +- `AiGenerationProviderFactory` selects and instantiates an `AiGenerationProvider` implementation by name. +- `LlamaCppJniAiGenerationProvider` uses llama.cpp JNI bindings to generate text. +- `LlamaCppJniConfig` configures the llama.cpp JNI provider. + +#### Dependencies +- `AiFieldGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiFieldGenerationSelector` imports `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationConfig` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +- `AiGenerationKind` has no imports. +- `AiModelDefinition` imports `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`. +- `AiModelDefinitionSupport` imports `java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. +- `AiCompletionParser` imports `java.io.IOException`, `java.util.ArrayList`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.llama.LlamaModel`, `net.ladenthin.llama.parameters.InferenceParameters`, `net.ladenthin.llama.parameters.ModelParameters`, `net.ladenthin.llama.value.Pair`, `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`. + +#### Cross-cutting +- Thread-safe due to lazy initialization of the model and use of immutable parameters. +- Immutable configuration with value semantics. + +#### Summary +This package provides a comprehensive set of classes and configurations for calculating VAT for invoices through AI field generation, selection, and AI model interactions, with clear dependencies and responsibilities structured around specific functional roles. Additionally, it includes tools for parsing LLM completion text and generating AI text using llama.cpp JNI bindings, emphasizing modularity, thread safety, and configurability. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/project.ai.md new file mode 100644 index 0000000..620357a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: D6FBE2AC +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:28:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The llamacpp-ai-index-maven-plugin project is structured around a central package for calculating VAT for invoices using AI field generation, selection, and AI model interactions. It includes sub-packages for parsing LLM completion text and providing AI text generation services using llama.cpp JNI bindings. The project integrates various components to facilitate seamless AI interactions and invoice processing, ensuring efficient and accurate financial calculations. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Calculates VAT for invoices +- main/java/net/ladenthin/maven/llamacpp/aiindex — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — A package for parsing LLM completion text and providing AI text generation services using llama.cpp JNI bindings. +- main/java/net/ladenthin/maven/llamacpp — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- main/java/net/ladenthin/maven — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- main/java/net/ladenthin — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- main/java/net — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- main/java — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- main — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. +- . — A package for calculating VAT for invoices through AI field generation, selection, and AI model interactions. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..be5f7e8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,60 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:29:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Maven plugin configuration POJO associating prompt templates with AI model definitions for field generation. + +#### Purpose +- Config POJO for associating prompt templates with AI model definitions. +- Used in Maven plugin configuration for field generation. + +#### Type +- Class: `AiFieldGenerationConfig` +- Extends: `java.lang.Object` +- Implements: `java.io.Serializable` +- Key generics: `java.util.List` +- Annotations: `@ToString`, `@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"})` + +#### Input +- Constructor parameters: none +- Dependencies: none +- Consumed fields: `promptKey`, `aiDefinitionKey`, `fileExtensions` +- Read resources: none + +#### Output +- Return types: `String` for getters, `void` for setters +- Produced/mutated state: none +- Written resources: none +- Side effects: none + +#### Core logic +- Creates a new instance with no-op. +- Sets and gets `promptKey`, `aiDefinitionKey`, and `fileExtensions`. +- `getFileExtensions()` returns an unmodifiable list or `null`. + +#### Public API +- `AiFieldGenerationConfig()`: no-op constructor +- `getPromptKey() -> String`: returns prompt template key +- `setPromptKey(String)`: sets prompt template key +- `getAiDefinitionKey() -> String`: returns AI model definition key +- `setAiDefinitionKey(String)`: sets AI model definition key +- `getFileExtensions() -> @Nullable List`: returns file extensions or `null` +- `setFileExtensions(Collection)`: sets file extensions, defensively copied + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- None notable + +#### Concurrency +- Not applicable (no threading or concurrency concerns) diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..0ba8dae --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,55 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:30:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the appropriate AI field generation configuration based on a source file's extensions. + +#### Purpose +- Chooses the correct AI field generation configuration for a given source file based on file extensions. +- Supports extension-specific prompts and a fallback for files without matching extensions. + +#### Type +- Class: `AiFieldGenerationSelector` +- Extends: None +- Implements: None +- Key generics: None +- Annotations: `@ToString`, `@lombok.ToString`, `@org.jspecify.annotations.Nullable` + +#### Input +- Constructor: None +- Method `selectForFileName`: + - `Iterable configs`: Configurations in declaration order. + - `String fileName`: The source file name. + +#### Output +- Returns: `AiFieldGenerationConfig` or `null` +- Produces: Config selection based on file extensions. +- Writes: None +- Side effects: None + +#### Core Logic +- Iterates over `configs`: + - Skips `null` entries. + - Checks if the configuration has non-empty extensions. + - Matches `fileName` with each extension. + - Returns the first matching configuration. + - Falls back to the first configuration with no extensions or `null` if none match. + +#### Public API +- `AiFieldGenerationSelector()`: No-op constructor. +- `selectForFileName(Iterable, String)`: Returns the appropriate `AiFieldGenerationConfig` based on file extensions. + +#### Dependencies +- `AiFieldGenerationConfig` +- `List` + +#### Exceptions / Errors +- None explicitly thrown or caught. + +#### Concurrency +- Not explicitly threaded or thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..d9f1db4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,78 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:30:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> This file defines a mutable configuration object for AI generation steps, managing parameters like model path, context size, output tokens, temperature, retry policies, input trimming, and stop strings. + +#### Purpose +- Mutable configuration object for AI generation parameters. +- Manages model path, context size, output tokens, temperature, retry policies, input trimming, and stop strings. + +#### Type +- Class (`AiGenerationConfig`) extends `java.lang.Object`; implements `java.io.Serializable`. + +#### Input +- Constructor parameters: none. +- Dependencies: none. +- Consumed fields: `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `maxRetries`, `retryTemperatureIncrement`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings`. + +#### Output +- Returns: instance fields (`modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `maxInputChars`, `warnOnTrim`, `maxRetries`, `retryTemperatureIncrement`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings`). +- Produced state: none. +- Written resources: none. +- Side effects: none. + +#### Core logic +- Initializes with default values. +- Provides getter and setter methods for all configuration parameters. +- Manages stop strings as an unmodifiable list. + +#### Public API +- `AiGenerationConfig()`: Creates a new instance with default parameters. +- `getModelPath()`: Returns the model path. +- `setModelPath(String)`: Sets the model path. +- `getContextSize()`: Returns the context size. +- `setContextSize(int)`: Sets the context size. +- `getMaxOutputTokens()`: Returns the max output tokens. +- `setMaxOutputTokens(int)`: Sets the max output tokens. +- `getTemperature()`: Returns the temperature. +- `setTemperature(float)`: Sets the temperature. +- `getThreads()`: Returns the number of threads. +- `setThreads(int)`: Sets the number of threads. +- `getCharsPerToken()`: Returns chars per token. +- `setCharsPerToken(int)`: Sets chars per token. +- `getMaxInputChars()`: Returns max input chars. +- `setMaxInputChars(int)`: Sets max input chars. +- `isWarnOnTrim()`: Returns trim warning status. +- `setWarnOnTrim(boolean)`: Sets trim warning status. +- `getMaxRetries()`: Returns max retries. +- `setMaxRetries(int)`: Sets max retries. +- `getRetryTemperatureIncrement()`: Returns retry temperature increment. +- `setRetryTemperatureIncrement(float)`: Sets retry temperature increment. +- `getTopP()`: Returns top-p value. +- `setTopP(float)`: Sets top-p value. +- `getTopK()`: Returns top-k value. +- `setTopK(int)`: Sets top-k value. +- `getRepeatPenalty()`: Returns repeat penalty. +- `setRepeatPenalty(float)`: Sets repeat penalty. +- `isChatTemplateEnableThinking()`: Returns chat-template thinking status. +- `setChatTemplateEnableThinking(boolean)`: Sets chat-template thinking status. +- `getStopStrings()`: Returns unmodifiable list of stop strings. +- `setStopStrings(List)`: Sets stop strings. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- None explicitly mentioned. + +#### Concurrency +- Thread-safe for immutable fields; mutable fields are managed within the class. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..3684a7d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,40 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:32:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies whether an AI generation operates on a single source file or a whole package. + +#### Purpose +- Enum for AI generation kind: single file or package summary. + +#### Type +- Enum: `AiGenerationKind` + +#### Input +- None + +#### Output +- None + +#### Core logic +- Defines two constants: + - `FILE_SUMMARY` + - `PACKAGE_SUMMARY` + +#### Public API +- `FILE_SUMMARY`: Identifies generation for a single source file. +- `PACKAGE_SUMMARY`: Identifies generation for a package aggregate. + +#### Dependencies +- None + +#### Exceptions / Errors +- None + +#### Concurrency +- Not thread-safe (enum is inherently immutable and thread-safe) diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..54a173b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,71 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:32:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Maven plugin configuration POJO that pairs a lookup key with a complete set of AI model parameters. + +#### Purpose +- Represents AI model configuration for Maven plugin. +- Allows reuse across multiple field-generation entries and goals. + +#### Type +- Class, `public class AiModelDefinition`, extends `java.lang.Object`, implements `java.io.Serializable`. + +#### Input +- Constructor parameters: none. +- Dependencies: none. + +#### Output +- Returns: getters for configuration parameters. +- Produces: mutable state changes via setters. + +#### Core Logic +- Initializes with default values from `AiGenerationConfig`. +- Provides getters/setters for configuration parameters. +- Manages stop strings list. + +#### Public API +- `getKey() -> String`: Returns the unique lookup key. +- `setKey(String) -> void`: Sets the unique lookup key. +- `getModelPath() -> String`: Returns the model path. +- `setModelPath(String) -> void`: Sets the model path. +- `getContextSize() -> int`: Returns context size. +- `setContextSize(int) -> void`: Sets context size. +- `getMaxOutputTokens() -> int`: Returns max output tokens. +- `setMaxOutputTokens(int) -> void`: Sets max output tokens. +- `getTemperature() -> float`: Returns temperature. +- `setTemperature(float) -> void`: Sets temperature. +- `getThreads() -> int`: Returns thread count. +- `setThreads(int) -> void`: Sets thread count. +- `getCharsPerToken() -> int`: Returns chars-per-token ratio. +- `setCharsPerToken(int) -> void`: Sets chars-per-token ratio. +- `isWarnOnTrim() -> boolean`: Returns warning flag. +- `setWarnOnTrim(boolean) -> void`: Sets warning flag. +- `getMaxRetries() -> int`: Returns max retries. +- `setMaxRetries(int) -> void`: Sets max retries. +- `getRetryTemperatureIncrement() -> float`: Returns retry temperature increment. +- `setRetryTemperatureIncrement(float) -> void`: Sets retry temperature increment. +- `getTopP() -> float`: Returns top-p value. +- `setTopP(float) -> void`: Sets top-p value. +- `getTopK() -> int`: Returns top-k value. +- `setTopK(int) -> void`: Sets top-k value. +- `getRepeatPenalty() -> float`: Returns repeat penalty. +- `setRepeatPenalty(float) -> void`: Sets repeat penalty. +- `isChatTemplateEnableThinking() -> boolean`: Returns chat template thinking flag. +- `setChatTemplateEnableThinking(boolean) -> void`: Sets chat template thinking flag. +- `getStopStrings() -> @Nullable List`: Returns stop strings. +- `setStopStrings(Collection) -> void`: Sets stop strings. + +#### Dependencies +- `AiGenerationConfig`: referenced for default values. + +#### Exceptions / Errors +- None notable. + +#### Concurrency +- Not explicitly noted, but all setters allow mutable state changes. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..55d7f9e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,47 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:33:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to generate AI generation configurations. + +#### Purpose +- Provides a lookup table for AI model definitions. +- Converts `AiModelDefinition` entries to `AiGenerationConfig` objects. + +#### Type +- Class + final + lombok.ToString + +#### Input +- List of `AiModelDefinition` objects +- Java8CompatibilityHelper dependency + +#### Output +- Map of `String` keys to `AiGenerationConfig` objects +- Throws `NullPointerException` for null keys +- Throws `IllegalArgumentException` for missing keys + +#### Core logic +- Constructs a map of `AiGenerationConfig` objects from `AiModelDefinition` entries +- Ensures each `AiModelDefinition` has a non-null `key` +- Converts `AiModelDefinition` fields to `AiGenerationConfig` fields + +#### Public API +- `AiModelDefinitionSupport(List)`: Builds the configuration map +- `AiGenerationConfig getConfig(String)`: Retrieves config by key + +#### Dependencies +- `HashMap` +- `Objects` +- `Java8CompatibilityHelper` + +#### Exceptions / Errors +- `NullPointerException` for null keys +- `IllegalArgumentException` for missing keys + +#### Concurrency +- Thread-safe due to immutable `HashMap` usage diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..ae3ba4f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,66 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:36:36Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> This package provides a comprehensive configuration and generation framework for AI field generation in Maven plugins, facilitating the association of prompt templates with AI model definitions and the selection of appropriate configurations based on source file extensions. + +#### Purpose +- Config POJO for associating prompt templates with AI model definitions. +- Chooses the correct AI field generation configuration for a given source file based on file extensions. +- Defines mutable configuration object for AI generation parameters. +- Identifies whether an AI generation operates on a single source file or a whole package. +- Represents AI model configuration for Maven plugin. +- Provides a lookup table for AI model definitions. + +#### Responsibilities +- `AiFieldGenerationConfig`: Config POJO for associating prompt templates with AI model definitions. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on a source file's extensions. +- `AiGenerationConfig`: Mutable configuration object for AI generation parameters. +- `AiGenerationKind`: Enum for AI generation kind: single file or package summary. +- `AiModelDefinition`: Maven plugin configuration POJO that pairs a lookup key with a complete set of AI model parameters. +- `AiModelDefinitionSupport`: Resolves AI model definitions by key to generate AI generation configurations. + +#### Key units +- `AiFieldGenerationConfig`: Config POJO for associating prompt templates with AI model definitions. +- `AiFieldGenerationSelector`: Chooses the correct AI field generation configuration for a given source file based on file extensions. +- `AiGenerationConfig`: Mutable configuration object for AI generation parameters. +- `AiGenerationKind`: Enum for AI generation kind: single file or package summary. +- `AiModelDefinition`: Represents AI model configuration for Maven plugin. +- `AiModelDefinitionSupport`: Resolves AI model definitions by key to generate AI generation configurations. + +#### Data flow +- `AiFieldGenerationConfig` is instantiated and configured with prompt keys, AI model definition keys, and file extensions. +- `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` identifies the type of AI generation. +- `AiModelDefinition` is used to configure AI model parameters. +- `AiModelDefinitionSupport` resolves `AiModelDefinition` entries to `AiGenerationConfig` objects. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `HashMap` +- `Objects` +- `Java8CompatibilityHelper` + +#### Cross-cutting +- Immutable configuration objects for thread safety. +- Default values for mutable configurations. +- Error handling for missing keys and null inputs. + +#### Summary +This package offers a robust framework for AI field generation in Maven plugins, providing configuration POJOs, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions, all designed to streamline the integration and customization of AI functionalities within Maven projects. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..2d7e254 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,62 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:38:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> This package provides a comprehensive configuration and generation framework for AI field generation in Maven plugins, facilitating the association of prompt templates with AI model definitions and the selection of appropriate configurations based on source file extensions. + +#### Purpose +- Config POJO for associating prompt templates with AI model definitions. +- Chooses the correct AI field generation configuration for a given source file based on file extensions. +- Defines mutable configuration object for AI generation parameters. +- Identifies whether an AI generation operates on a single source file or a whole package. +- Represents AI model configuration for Maven plugin. +- Provides a lookup table for AI model definitions. + +#### Responsibilities +- `AiFieldGenerationConfig`: Config POJO for associating prompt templates with AI model definitions. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration based on a source file's extensions. +- `AiGenerationConfig`: Mutable configuration object for AI generation parameters. +- `AiGenerationKind`: Enum for AI generation kind: single file or package summary. +- `AiModelDefinition`: Represents AI model configuration for Maven plugin. +- `AiModelDefinitionSupport`: Resolves AI model definitions by key to generate AI generation configurations. + +#### Key units +- `AiFieldGenerationConfig`: Config POJO for associating prompt templates with AI model definitions. +- `AiFieldGenerationSelector`: Chooses the correct AI field generation configuration based on a source file's extensions. +- `AiGenerationConfig`: Mutable configuration object for AI generation parameters. +- `AiGenerationKind`: Enum for AI generation kind: single file or package summary. +- `AiModelDefinition`: Represents AI model configuration for Maven plugin. +- `AiModelDefinitionSupport`: Resolves AI model definitions by key to generate AI generation configurations. + +#### Data flow +- `AiFieldGenerationConfig` is instantiated and configured with prompt keys, AI model definition keys, and file extensions. +- `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on source file extensions. +- `AiGenerationConfig` is used to configure AI generation parameters. +- `AiGenerationKind` identifies the type of AI generation. +- `AiModelDefinition` is used to configure AI model parameters. +- `AiModelDefinitionSupport` resolves `AiModelDefinition` entries to `AiGenerationConfig` objects. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` +- `HashMap` +- `Objects` +- `Java8CompatibilityHelper` + +#### Cross-cutting +- Immutable configuration objects for thread safety. +- Default values for mutable configurations. +- Error handling for missing keys and null inputs. + +#### Summary +This package offers a robust framework for AI field generation in Maven plugins, providing configuration POJOs, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions, all designed to streamline the integration and customization of AI functionalities within Maven projects. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..1336943 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,44 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:33:51Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Purpose +- Parses raw LLM completion text. +- Strips model-internal thinking block. +- Returns the actual model answer. + +#### Type +- Class: `AiCompletionParser` (non-final). + +#### Input +- `String response`: raw completion text from the model, may be `null`. + +#### Output +- `String`: cleaned answer text, never `null`. + +#### Core Logic +- Checks if `response` is `null`; returns empty string if true. +- Finds the last occurrence of `THINKING_BLOCK_END_MARKER`. + - If found, returns text after the marker, trimmed. + - If not found but `THINKING_BLOCK_START_MARKER` is present, throws `IOException`. + - If neither marker is present, returns trimmed `response`. + +#### Public API +- `parseCompletion(String response) throws IOException`: Strips thinking block and returns answer. + +#### Dependencies +- `java.io.IOException`. +- `lombok.ToString`. + +#### Exceptions / Errors +- Throws `IOException` if thinking block starts but end marker is absent. + +#### Concurrency +- Not explicitly covered in the source. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..fcc6650 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,41 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:34:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> A pluggable AI backend that generates text for an AiGenerationRequest, supporting both local and mock providers. + +#### Purpose +- Provides AI text generation functionality. +- Supports both local and mock implementations. + +#### Type +- Interface: `AiGenerationProvider` extends `AutoCloseable`. + +#### Input +- `AiGenerationRequest` for prompt key, source file, source text, and current header. + +#### Output +- Generated text as a `String`. +- May throw `IOException`. + +#### Core Logic +- `generate(AiGenerationRequest request)`: Generates text using default parameters. +- `generate(AiGenerationRequest request, float temperatureOverride)`: Overrides temperature for generation. + +#### Public API +- `String generate(AiGenerationRequest request) throws IOException`: Generates text with default settings. +- `String generate(AiGenerationRequest request, float temperatureOverride) throws IOException`: Generates text with specified temperature. + +#### Dependencies +- `AiGenerationRequest`: Used for generating text. + +#### Exceptions / Errors +- `IOException`: Thrown by the provider on failure. + +#### Concurrency +- Not explicitly mentioned, but the interface is designed to be thread-safe as it is stateless. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..5107e88 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,45 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:34:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> A factory for selecting and instantiating an AI generation provider by name. + +#### Purpose +- Factory class to instantiate `AiGenerationProvider` implementations based on a provider name. + +#### Type +- Class: `AiGenerationProviderFactory` extends `Object`; implements no interfaces; no generics; `@ToString`. + +#### Input +- Constructor: none. +- Method `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport)`. + +#### Output +- Returns: `AiGenerationProvider` instance. +- Produces: `MockAiGenerationProvider` or `LlamaCppJniAiGenerationProvider` based on input. + +#### Core Logic +- If `providerName` is null or blank, return `MockAiGenerationProvider`. +- If `providerName` is "mock", return `MockAiGenerationProvider`. +- If `providerName` is "llamacpp-jni", return `LlamaCppJniAiGenerationProvider`. +- Otherwise, throw `IllegalArgumentException`. + +#### Public API +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` + Creates an AI generation provider based on the provider name. + +#### Dependencies +- `Java8CompatibilityHelper` +- `LlamaCppJniConfig` +- `AiPromptSupport` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` for unsupported provider names. + +#### Concurrency +- Not explicitly noted; assumes single-threaded usage. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..130094a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,57 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:35:04Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> This file provides a Java implementation of an AI generation provider using the llama.cpp JNI binding to run GGUF models locally. + +#### Purpose +- Implements `AiGenerationProvider` for local GGUF model inference. +- Lazy-loads and caches `LlamaModel` instances. + +#### Type +- Class: `LlamaCppJniAiGenerationProvider` +- Implements: `AiGenerationProvider`, `AutoCloseable` +- Extends: None +- Key generics: None +- Annotations: `@ToString`, `@Nullable` + +#### Input +- Constructor parameters: `LlamaCppJniConfig config`, `AiPromptSupport promptSupport` +- Consumed fields: None + +#### Output +- Return types: `String` (generated text) +- Produced/mutated state: `LlamaModel` (cached) +- Written resources: None +- Side effects: Lazy loading of native llama.cpp model + +#### Core logic +- Lazy initialization of `LlamaModel` on first `generate` call. +- Builds prompt using `AiPromptSupport`. +- Constructs `InferenceParameters` with configuration settings. +- Executes `model.chatCompleteText` to generate completion. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig config, AiPromptSupport promptSupport)` +- `String generate(AiGenerationRequest request) throws IOException` +- `String generate(AiGenerationRequest request, float temperatureOverride) throws IOException` +- `void close()` + +#### Dependencies +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `LlamaModel` +- `InferenceParameters` +- `Pair` +- `AiCompletionParser` + +#### Exceptions / Errors +- `IOException` from `completionParser.parseCompletion` and `model.chatCompleteText`. + +#### Concurrency +- Not explicitly covered in the source. Assumes single-threaded usage due to lack of threading constructs. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..35c28d5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,53 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:35:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable configuration for the llama.cpp JNI provider. + +#### Purpose +- Immutable configuration class for llama.cpp JNI provider. +- Record-shaped value type with generated equals, hashCode, and toString. + +#### Type +- Class `LlamaCppJniConfig` (final) extends `Object`; implements `java.lang.AutoCloseable` (not present in source). + +#### Input +- Constructor parameters: `libraryPath`, `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings`. + +#### Output +- Returns: `libraryPath()`, `modelPath()`, `contextSize()`, `maxOutputTokens()`, `temperature()`, `threads()`, `topP()`, `topK()`, `repeatPenalty()`, `chatTemplateEnableThinking()`, `stopStrings()`. + +#### Core logic +- Ensures `modelPath` is not null. +- Initializes fields with provided values; `stopStrings` defaults to empty list if null. + +#### Public API +- `libraryPath() -> String` +- `modelPath() -> String` +- `contextSize() -> int` +- `maxOutputTokens() -> int` +- `temperature() -> float` +- `threads() -> int` +- `topP() -> float` +- `topK() -> int` +- `repeatPenalty() -> float` +- `chatTemplateEnableThinking() -> boolean` +- `stopStrings() -> List` + +#### Dependencies +- `java.util.Collections` +- `java.util.List` +- `java.util.Objects` +- `lombok.EqualsAndHashCode` +- `lombok.ToString` + +#### Exceptions / Errors +- None notable. + +#### Concurrency +- Immutable configuration; thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..d7f60a8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,41 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:36:16Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> A deterministic AI generation provider that returns a mock summary for testing. + +#### Purpose +- Provides a deterministic mock summary for testing AI generation requests. + +#### Type +- Class: `MockAiGenerationProvider` implements `AiGenerationProvider`. + +#### Input +- `AiGenerationRequest request`: Input request containing source file details. + +#### Output +- `String`: Returns a mock summary string for the provided request. + +#### Core Logic +- Retrieves the file name from the request. +- Constructs and returns a mock summary string prefixed with "Mock summary for " followed by the file name. + +#### Public API +- `MockAiGenerationProvider()`: No-op constructor. +- `String generate(final AiGenerationRequest request) throws IOException`: Generates a mock summary for the given request. + +#### Dependencies +- `java.io.IOException`: Exception thrown if an I/O error occurs. +- `lombok.ToString`: Annotation for generating toString method. +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`: Interface for AI generation requests. + +#### Exceptions / Errors +- `IOException`: Thrown if an I/O error occurs during request processing. + +#### Concurrency +- Not explicitly noted in the source. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..b183014 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,56 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:37:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> A package for parsing LLM completion text, generating AI text, and providing configurable AI generation providers. + +#### Purpose +- Parses raw LLM completion text. +- Generates AI text with configurable providers. + +#### Responsibilities +- `AiCompletionParser`: Strips thinking block from completion text. +- `AiGenerationProvider`: Interface for AI text generation. +- `AiGenerationProviderFactory`: Factory for instantiating `AiGenerationProvider` implementations. +- `LlamaCppJniAiGenerationProvider`: JNI-based local GGUF model inference. +- `LlamaCppJniConfig`: Configuration for llama.cpp JNI provider. +- `MockAiGenerationProvider`: Mock provider for deterministic testing. + +#### Key units +- `AiCompletionParser`: Parses and cleans completion text. +- `AiGenerationProvider`: Generates AI text. +- `AiGenerationProviderFactory`: Factory for provider instantiation. +- `LlamaCppJniAiGenerationProvider`: Local GGUF model inference. +- `LlamaCppJniConfig`: Configuration for llama.cpp. +- `MockAiGenerationProvider`: Mock text generation. + +#### Data flow +- `AiGenerationRequest` -> `AiGenerationProviderFactory` -> `AiGenerationProvider` -> `String` (generated text). + +#### Dependencies +- `java.io.IOException`. +- `lombok.ToString`. +- `lombok.EqualsAndHashCode`. +- `lombok.ToString`. +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`. +- `lombok`. + +#### Cross-cutting +- Thread-safe design for `AiGenerationProvider`. +- Lazy loading of `LlamaModel` in `LlamaCppJniAiGenerationProvider`. + +#### Notable internal collaborations +- `AiCompletionParser` for text parsing. +- `LlamaCppJniConfig` for llama.cpp configuration. +- `AiGenerationRequest` for request handling. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..0ddbe91 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,11 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:39:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> This package offers a robust framework for AI field generation in Maven plugins, providing configuration POJOs, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions, all designed to streamline the integration and customization of AI functionalities within Maven projects. diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..96b9cf4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:39:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions to streamline AI integration and customization in Maven projects. + +#### Purpose +- Facilitates AI field generation in Maven plugins +- Provides configuration management and selection mechanisms +- Supports mutable generation configurations +- Includes a lookup system for AI model definitions + +#### Responsibilities +- Configuration POJOs for AI field generation +- Mechanisms for selecting AI models +- Mutable generation configurations +- Lookup system for AI model definitions + +#### Key Units +- `Configuration`: Manages AI field generation configurations +- `ModelSelector`: Selects appropriate AI models based on criteria +- `MutableGenerationConfig`: Provides mutable configurations for AI generation +- `ModelLookup`: Facilitates lookup of AI model definitions + +#### Data Flow +Inputs from configuration files and user preferences flow through the system, processed by `Configuration` and `ModelSelector` to generate mutable configurations via `MutableGenerationConfig`, which are then utilized by `ModelLookup` to retrieve the appropriate AI models. + +#### Dependencies +- Utilizes Maven plugin infrastructure +- Relies on external AI model definitions and configurations + +#### Cross-cutting +- Shared base types for configuration and model management +- Common error handling across components +- Concurrency considerations in mutable generation configurations diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..85101f7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:40:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. + +#### Purpose +- Facilitates AI field generation in Maven plugins +- Provides configuration management and selection mechanisms +- Supports mutable generation configurations +- Includes a lookup system for AI model definitions + +#### Responsibilities +- Configuration POJOs for AI field generation +- Mechanisms for selecting AI models +- Mutable generation configurations +- Lookup system for AI model definitions + +#### Key Units +- `Configuration`: Manages AI field generation configurations +- `ModelSelector`: Selects appropriate AI models based on criteria +- `MutableGenerationConfig`: Provides mutable configurations for AI generation +- `ModelLookup`: Facilitates lookup of AI model definitions + +#### Data Flow +Inputs from configuration files and user preferences flow through the system, processed by `Configuration` and `ModelSelector` to generate mutable configurations via `MutableGenerationConfig`, which are then utilized by `ModelLookup` to retrieve the appropriate AI models. + +#### Dependencies +- Utilizes Maven plugin infrastructure +- Relies on external AI model definitions and configurations + +#### Cross-cutting +- Shared base types for configuration and model management +- Common error handling across components +- Concurrency considerations in mutable generation configurations diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..dba4424 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/net/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:40:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. + +#### Purpose +- Facilitates AI field generation in Maven plugins +- Provides configuration management and selection mechanisms +- Supports mutable generation configurations +- Includes a lookup system for AI model definitions + +#### Responsibilities +- Configuration POJOs for AI field generation +- Mechanisms for selecting AI models +- Mutable generation configurations +- Lookup system for AI model definitions + +#### Key Units +- `Configuration`: Manages AI field generation configurations +- `ModelSelector`: Selects appropriate AI models based on criteria +- `MutableGenerationConfig`: Provides mutable configurations for AI generation +- `ModelLookup`: Facilitates lookup of AI model definitions + +#### Data Flow +Inputs from configuration files and user preferences flow through the system, processed by `Configuration` and `ModelSelector` to generate mutable configurations via `MutableGenerationConfig`, which are then utilized by `ModelLookup` to retrieve the appropriate AI models. + +#### Dependencies +- Utilizes Maven plugin infrastructure +- Relies on external AI model definitions and configurations + +#### Cross-cutting +- Shared base types for configuration and model management +- Common error handling across components +- Concurrency considerations in mutable generation configurations diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/package.ai.md new file mode 100644 index 0000000..5f1ff7a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/java/package.ai.md @@ -0,0 +1,41 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:40:45Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. + +#### Purpose +- Facilitates AI field generation in Maven plugins +- Provides configuration management and selection mechanisms +- Supports mutable generation configurations +- Includes a lookup system for AI model definitions + +#### Responsibilities +- Configuration POJOs for AI field generation +- Mechanisms for selecting AI models +- Mutable generation configurations +- Lookup system for AI model definitions + +#### Key Units +- `Configuration`: Manages AI field generation configurations +- `ModelSelector`: Selects appropriate AI models based on criteria +- `MutableGenerationConfig`: Provides mutable configurations for AI generation +- `ModelLookup`: Facilitates lookup of AI model definitions + +#### Data Flow +Inputs from configuration files and user preferences flow through the system, processed by `Configuration` and `ModelSelector` to generate mutable configurations via `MutableGenerationConfig`, which are then utilized by `ModelLookup` to retrieve the appropriate AI models. + +#### Dependencies +- Utilizes Maven plugin infrastructure +- Relies on external AI model definitions and configurations + +#### Cross-cutting +- Shared base types for configuration and model management +- Common error handling across components +- Concurrency considerations in mutable generation configurations diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/package.ai.md new file mode 100644 index 0000000..fc29032 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/main/package.ai.md @@ -0,0 +1,41 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:41:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. + +#### Purpose +- Facilitates AI field generation in Maven plugins +- Provides configuration management and selection mechanisms +- Supports mutable generation configurations +- Includes a lookup system for AI model definitions + +#### Responsibilities +- Configuration POJOs for AI field generation +- Mechanisms for selecting AI models +- Mutable generation configurations +- Lookup system for AI model definitions + +#### Key Units +- `Configuration`: Manages AI field generation configurations +- `ModelSelector`: Selects appropriate AI models based on criteria +- `MutableGenerationConfig`: Provides mutable configurations for AI generation +- `ModelLookup`: Facilitates lookup of AI model definitions + +#### Data Flow +Inputs from configuration files and user preferences flow through the system, processed by `Configuration` and `ModelSelector` to generate mutable configurations via `MutableGenerationConfig`, which are then utilized by `ModelLookup` to retrieve the appropriate AI models. + +#### Dependencies +- Utilizes Maven plugin infrastructure +- Relies on external AI model definitions and configurations + +#### Cross-cutting +- Shared base types for configuration and model management +- Common error handling across components +- Concurrency considerations in mutable generation configurations diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/package.ai.md new file mode 100644 index 0000000..1c75721 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/package.ai.md @@ -0,0 +1,41 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:41:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. + +#### Purpose +- Facilitates AI field generation in Maven plugins +- Provides configuration management and selection mechanisms +- Supports mutable generation configurations +- Includes a lookup system for AI model definitions + +#### Responsibilities +- Configuration POJOs for AI field generation +- Mechanisms for selecting AI models +- Mutable generation configurations +- Lookup system for AI model definitions + +#### Key Units +- `Configuration`: Manages AI field generation configurations +- `ModelSelector`: Selects appropriate AI models based on criteria +- `MutableGenerationConfig`: Provides mutable configurations for AI generation +- `ModelLookup`: Facilitates lookup of AI model definitions + +#### Data Flow +Inputs from configuration files and user preferences flow through the system, processed by `Configuration` and `ModelSelector` to generate mutable configurations via `MutableGenerationConfig`, which are then utilized by `ModelLookup` to retrieve the appropriate AI models. + +#### Dependencies +- Utilizes Maven plugin infrastructure +- Relies on external AI model definitions and configurations + +#### Cross-cutting +- Shared base types for configuration and model management +- Common error handling across components +- Concurrency considerations in mutable generation configurations diff --git a/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/project.ai.md new file mode 100644 index 0000000..640a82a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__granite4-h-tiny__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 69D7D78F +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:41:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The llamacpp-ai-index-maven-plugin project is structured around a comprehensive framework for AI field generation within Maven plugins. It includes packages dedicated to configuration management, AI model selection, and AI text generation, facilitating seamless integration of AI functionalities into Maven projects. The main components are organized to support prompt template association with AI model definitions, selection of appropriate configurations based on source file extensions, and parsing of LLM completion text for AI generation. Together, these packages form a cohesive system designed to streamline the development and customization of AI features in Maven-based applications. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — This package provides a comprehensive configuration and generation framework for AI field generation in Maven plugins, facilitating the association of prompt templates with AI model definitions and the selection of appropriate configurations based on source file extensions. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package provides a comprehensive configuration and generation framework for AI field generation in Maven plugins, facilitating the association of prompt templates with AI model definitions and the selection of appropriate configurations based on source file extensions. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — A package for parsing LLM completion text, generating AI text, and providing configurable AI generation providers. +- main/java/net/ladenthin/maven/llamacpp — This package offers a robust framework for AI field generation in Maven plugins, providing configuration POJOs, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions, all designed to streamline the integration and customization of AI functionalities within Maven projects. +- main/java/net/ladenthin/maven — This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions to streamline AI integration and customization in Maven projects. +- main/java/net/ladenthin — This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. +- main/java/net — This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. +- main/java — This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. +- main — This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. +- . — This package provides a comprehensive framework for AI field generation within Maven plugins, offering configuration management, selection mechanisms, mutable generation configurations, and a lookup system for AI model definitions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..08d364e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,78 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:18:48Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Manages AI field generation configuration in Maven plugin + +#### Purpose +- Holds configuration for associating prompt templates with AI models for field generation. +- Used within a list in the plugin configuration to define individual field-generation steps. + +#### Type +- Class +- Abstract: No +- Final: Yes +- Sealed: No +- Extends: None +- Implements: None +- Generics: None +- Key annotations: `@ToString`, `@Nullable` + +#### Input +- Constructor parameters: None +- Injected dependencies: None +- Consumed fields: None +- Read resources: None + +#### Output +- Return types: + - `String` (getters) + - `List` (getters) +- Produced state: + - `promptKey` + - `aiDefinitionKey` + - `fileExtensions` +- Written resources: None +- Side effects: None + +#### Core logic +- Holds configuration for a single field-generation step. +- References an AI model definition by key. +- Optionally specifies file extensions to select this entry. + +#### Public API +- `AiFieldGenerationConfig() -> void` — Creates a new configuration instance. +- `String getPromptKey() -> String` — Returns the prompt template key. +- `void setPromptKey(final String promptKey) -> void` — Sets the prompt template key. +- `String getAiDefinitionKey() -> String` — Returns the AI model definition key. +- `void setAiDefinitionKey(final String aiDefinitionKey) -> void` — Sets the AI model definition key. +- `@Nullable List getFileExtensions() -> @Nullable List` — Returns the source file extensions that select this entry. +- `void setFileExtensions(final @Nullable Collection fileExtensions) -> void` — Sets the source file extensions that select this entry. + +#### Dependencies +- Imports: + - `java.util.ArrayList` + - `java.util.Collection` + - `java.util.Collections` + - `java.util.List` + - `lombok.ToString` + - `org.jspecify.annotations.Nullable` +- Referenced types: + - `AiModelDefinition` + - `AiPromptDefinition` + +#### Exceptions / Errors +- Notable thrown/caught exceptions: None +- Null-handling: Uses `@Nullable` and defensive copying for list operations +- Error conditions: None + +#### Concurrency +- Threading: None +- Synchronization: None +- Immutability: None +- Thread-safety notes: None diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..63f25b4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,44 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:21:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the `AiFieldGenerationConfig` that applies to a given source file based on file extensions. + +#### Purpose +- Configures selection of AI field generation settings for source files based on their extensions. + +#### Type +- Class (`public final class`) +- Annotations: `@ToString`, `@Nullable` + +#### Input +- `configs`: Iterable of `AiFieldGenerationConfig` objects (nullable entries are skipped) +- `fileName`: String representing the source file name + +#### Output +- Returns the first `AiFieldGenerationConfig` whose non-empty extension list matches the file name, else the first fallback entry, else `null` + +#### Core logic +- Iterates through each `AiFieldGenerationConfig` in the provided iterable +- Skips any `null` entries +- Checks if the `AiFieldGenerationConfig` has a non-empty list of file extensions +- If no extension list or it is empty, sets this as the fallback configuration +- For each extension, checks if the file name ends with that extension and returns the corresponding `AiFieldGenerationConfig` +- If no matching configuration is found, returns the fallback configuration + +#### Public API +- `selectForFileName(final Iterable configs, final String fileName) -> @Nullable AiFieldGenerationConfig`: Selects the appropriate field generation configuration for a given file name. + +#### Dependencies +- Imports: `java.util.List`, `lombok.ToString`, `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No notable exceptions; handles `null` entries in `configs` by skipping them + +#### Concurrency +- Not thread-safe; intended to be used in a single-threaded environment diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..4d9d24a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,109 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:22:58Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Manages configuration parameters for AI generation steps in a Maven project. + +#### Purpose +- Holds all parameters for an AI generation step. +- Transports these parameters between the Maven configuration layer and AI provider implementations. + +#### Type +- Class +- Final +- Lombok annotations: `@ToString` + +#### Input +- No constructor parameters. +- No injected dependencies. +- Consumed fields: + - `modelPath` + - `contextSize` + - `maxOutputTokens` + - `temperature` + - `threads` + - `charsPerToken` + - `maxInputChars` + - `warnOnTrim` + - `maxRetries` + - `retryTemperatureIncrement` + - `topP` + - `topK` + - `repeatPenalty` + - `chatTemplateEnableThinking` + - `stopStrings` + +#### Output +- No return types. +- Mutated fields: + - `modelPath` + - `contextSize` + - `maxOutputTokens` + - `temperature` + - `threads` + - `charsPerToken` + - `maxInputChars` + - `warnOnTrim` + - `maxRetries` + - `retryTemperatureIncrement` + - `topP` + - `topK` + - `repeatPenalty` + - `chatTemplateEnableThinking` + - `stopStrings` + +#### Core logic +- Defines default values for AI generation parameters. +- Provides getter and setter methods to configure and retrieve these parameters. + +#### Public API +- `AiGenerationConfig()`: Creates a new instance with default settings. +- `getModelPath() -> String`: Returns the model file path. +- `setModelPath(String modelPath)`: Sets the model file path. +- `getContextSize() -> int`: Returns the context window size in tokens. +- `setContextSize(int contextSize)`: Sets the context window size in tokens. +- `getMaxOutputTokens() -> int`: Returns the maximum number of output tokens per inference call. +- `setMaxOutputTokens(int maxOutputTokens)`: Sets the maximum number of output tokens per inference call. +- `getTemperature() -> float`: Returns the sampling temperature. +- `setTemperature(float temperature)`: Sets the sampling temperature. +- `getThreads() -> int`: Returns the number of CPU threads used for inference. +- `setThreads(int threads)`: Sets the number of CPU threads used for inference. +- `getCharsPerToken() -> int`: Returns the number of characters per token used in automatic `maxInputChars` calculation. +- `setCharsPerToken(int charsPerToken)`: Sets the number of characters per token. +- `getMaxInputChars() -> int`: Returns the maximum number of input characters fed to the prompt. +- `setMaxInputChars(int maxInputChars)`: Sets the maximum number of input characters fed to the prompt. +- `isWarnOnTrim() -> boolean`: Returns whether a warning is emitted when the prompt source text is trimmed. +- `setWarnOnTrim(boolean warnOnTrim)`: Sets whether a warning is emitted when the prompt source text is trimmed. +- `getMaxRetries() -> int`: Returns the maximum number of retry attempts on empty-body responses. +- `setMaxRetries(int maxRetries)`: Sets the maximum number of retry attempts on empty-body responses. +- `getRetryTemperatureIncrement() -> float`: Returns the temperature increment added on each retry attempt. +- `setRetryTemperatureIncrement(float retryTemperatureIncrement)`: Sets the temperature increment added on each retry attempt. +- `getTopP() -> float`: Returns the nucleus-sampling probability threshold. +- `setTopP(float topP)`: Sets the nucleus-sampling probability threshold. +- `getTopK() -> int`: Returns the top-k sampling limit. +- `setTopK(int topK)`: Sets the top-k sampling limit. +- `getRepeatPenalty() -> float`: Returns the repetition penalty. +- `setRepeatPenalty(float repeatPenalty)`: Sets the repetition penalty. +- `isChatTemplateEnableThinking() -> boolean`: Returns whether the model's chat-template thinking mode is enabled. +- `setChatTemplateEnableThinking(boolean chatTemplateEnableThinking)`: Sets whether the model's chat-template thinking mode is enabled. +- `getStopStrings() -> List`: Returns an unmodifiable view of the configured stop strings. +- `setStopStrings(List stopStrings)`: Sets the list of stop strings. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No notable exceptions. +- Null-handling: `stopStrings` is set to an empty list if `null` is passed. + +#### Concurrency +- Not concurrency-related. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..aa02345 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,21 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:29:16Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies whether an AI generation operates on a single source file or a whole package. + +#### Type +enum + +#### Core logic +- Defines two constants: `FILE_SUMMARY` and `PACKAGE_SUMMARY`. +- Each constant represents a type of AI generation step. + +#### Public API +- `FILE_SUMMARY` -> Represents a generation step that produces fields for a single source file. +- `PACKAGE_SUMMARY` -> Represents a generation step that produces fields for a package aggregate. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..697990b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,109 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:29:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Represents a configuration POJO for AI model definitions used in a Maven plugin. + +#### Purpose +- Stores and manages parameters for AI models. +- Configurable via Maven plugin. +- Shared across multiple field-generation entries. + +#### Type +- Class +- Lombok `@ToString` annotation + +#### Input +- No constructor parameters +- Injected dependencies: None noted +- Consumed fields: + - `key` + - `modelPath` + - `contextSize` + - `maxOutputTokens` + - `temperature` + - `threads` + - `charsPerToken` + - `warnOnTrim` + - `maxRetries` + - `retryTemperatureIncrement` + - `topP` + - `topK` + - `repeatPenalty` + - `chatTemplateEnableThinking` + - `stopStrings` + +#### Output +- Produced state: + - `key` + - `modelPath` + - `contextSize` + - `maxOutputTokens` + - `temperature` + - `threads` + - `charsPerToken` + - `warnOnTrim` + - `maxRetries` + - `retryTemperatureIncrement` + - `topP` + - `topK` + - `repeatPenalty` + - `chatTemplateEnableThinking` + - `stopStrings` + +#### Core logic +- Holds configuration parameters for AI models. +- Provides getter and setter methods for each parameter. +- Ensures default values are set from `AiGenerationConfig` when not explicitly defined. + +#### Public API +- `AiModelDefinition()` -> Creates a new instance with default values. +- `String getKey()` -> Returns the unique lookup key. +- `void setKey(String key)` -> Sets the unique lookup key. +- `String getModelPath()` -> Returns the path to the GGUF model file. +- `void setModelPath(String modelPath)` -> Sets the path to the GGUF model file. +- `int getContextSize()` -> Returns the context window size. +- `void setContextSize(int contextSize)` -> Sets the context window size. +- `int getMaxOutputTokens()` -> Returns the maximum number of output tokens. +- `void setMaxOutputTokens(int maxOutputTokens)` -> Sets the maximum number of output tokens. +- `float getTemperature()` -> Returns the base sampling temperature. +- `void setTemperature(float temperature)` -> Sets the base sampling temperature. +- `int getThreads()` -> Returns the number of CPU threads for inference. +- `void setThreads(int threads)` -> Sets the number of CPU threads for inference. +- `int getCharsPerToken()` -> Returns the number of characters per token. +- `void setCharsPerToken(int charsPerToken)` -> Sets the number of characters per token. +- `boolean isWarnOnTrim()` -> Returns whether a warning is emitted when source text is trimmed. +- `void setWarnOnTrim(boolean warnOnTrim)` -> Sets whether a warning is emitted when source text is trimmed. +- `int getMaxRetries()` -> Returns the maximum number of retry attempts. +- `void setMaxRetries(int maxRetries)` -> Sets the maximum number of retry attempts. +- `float getRetryTemperatureIncrement()` -> Returns the temperature increment applied on each successive retry attempt. +- `void setRetryTemperatureIncrement(float retryTemperatureIncrement)` -> Sets the temperature increment applied on each successive retry attempt. +- `float getTopP()` -> Returns the nucleus-sampling probability threshold. +- `void setTopP(float topP)` -> Sets the nucleus-sampling probability threshold. +- `int getTopK()` -> Returns the top-k sampling limit. +- `void setTopK(int topK)` -> Sets the top-k sampling limit. +- `float getRepeatPenalty()` -> Returns the repetition penalty. +- `void setRepeatPenalty(float repeatPenalty)` -> Sets the repetition penalty applied to already-generated tokens. +- `boolean isChatTemplateEnableThinking()` -> Returns whether the model's chat-template thinking mode is enabled. +- `void setChatTemplateEnableThinking(boolean chatTemplateEnableThinking)` -> Sets whether the model's chat-template thinking mode is enabled. +- `List getStopStrings()` -> Returns the list of stop strings that terminate generation when encountered. +- `void setStopStrings(Collection stopStrings)` -> Sets the list of stop strings that terminate generation when encountered. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- No notable exceptions or error handling explicitly noted. + +#### Concurrency +- No concurrency-related notes or synchronization mechanisms. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..0d5063e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,62 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:35:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key, converting them to ready-to-use generation configurations. + +#### Purpose +- Provides a lookup table for AI model configurations. +- Validates and processes AI model definition entries. +- Converts `AiModelDefinition` entries into `AiGenerationConfig` objects. + +#### Type +- Class: final +- Extends: None +- Implements: None +- Key generics and type bounds: `` +- Lombok annotations: `@ToString` + +#### Input +- Constructor parameter: + - `definitions`: List of `AiModelDefinition` +- Dependencies: + - `Java8CompatibilityHelper` + +#### Output +- Return type: None (throws exceptions) +- Produced state: `configs`: Map of AI model keys to generation configurations +- Mutated fields: None +- Written resources: None +- Side effects: Throws exceptions for invalid configurations + +#### Core logic +- Validates each `AiModelDefinition` entry to ensure it has a non-null key. +- Constructs a `HashMap` to store the configuration mappings. +- Converts each `AiModelDefinition` into an `AiGenerationConfig`. +- Throws `NullPointerException` if any entry has a null key. +- Throws `IllegalArgumentException` if no definition is registered for a given key. + +#### Public API +- `AiModelDefinitionSupport(List definitions) -> Constructs a new AiModelDefinitionSupport from the supplied definitions list.` +- `AiGenerationConfig getConfig(String key) -> Returns the AiGenerationConfig associated with the given key.` + +#### Dependencies +- Imports: + - `java.util.HashMap` + - `java.util.List` + - `java.util.Map` + - `java.util.Objects` + - `lombok.ToString` + - `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` + +#### Exceptions / Errors +- Throws `NullPointerException` if any entry has a null key. +- Throws `IllegalArgumentException` if no definition is registered for a given key. + +#### Concurrency +- Not explicitly handled; thread safety is not guaranteed. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..67e43fd --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:47:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Manages AI-related configurations and operations in a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. +- **External Modules/Tables**: None explicitly mentioned in the provided summaries. + +#### Cross-cutting +- **Shared Base Types/Interfaces**: None explicitly mentioned in the provided summaries. +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. +- **Concurrency**: Not explicitly handled; thread safety is not guaranteed. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..f7fb8fb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:57:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..8679ee3 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,47 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:37:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Purpose +- Parses raw LLM completion text. +- Extracts the model answer by removing internal thinking blocks. +- Stores the clean answer text in an AI index file. + +#### Type +- Class +- Non-final + +#### Input +- `response`: The raw completion text from the model, may be `null`. + +#### Output +- Returns the cleaned answer text, never `null`. +- Throws `IOException` if a thinking block was started but the token budget was exhausted before the closing marker was emitted. + +#### Core logic +- If `response` is `null`, return an empty string. +- Find the last occurrence of `THINKING_BLOCK_END_MARKER`. + - If found, return the text after the marker, trimmed. + - If not found and `THINKING_BLOCK_START_MARKER` is present, throw an `IOException`. +- If neither marker is present, return the response, trimmed. + +#### Public API +- `AiCompletionParser() -> void`: Creates a new `AiCompletionParser`. +- `parseCompletion(final String response) -> String`: Strips any Gemma-4 thinking block from `response` and returns the clean answer text. + +#### Dependencies +- `java.io.IOException` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` if a thinking block was started but the token budget was exhausted before the closing marker was emitted. + +#### Concurrency +- Not applicable diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..0ab7265 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,37 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:38:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a pluggable interface for generating text based on AI requests. + +#### Purpose +- Defines a contract for generating text from AI requests. +- Supports both default and temperature-overridden generations. +- Ensures proper resource management with `AutoCloseable`. + +#### Type +- Interface +- Extends `AutoCloseable` + +#### Core logic +- `generate(AiGenerationRequest request)`: Generates text using default parameters. +- `generate(AiGenerationRequest request, float temperatureOverride)`: Generates text with a specified temperature override. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates text using the provider's default sampling parameters. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates text with the specified temperature override. +- `close() -> void`: Closes the provider, ensuring resources are properly released. + +#### Dependencies +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` + +#### Exceptions / Errors +- Throws `IOException` if the underlying provider fails. + +#### Concurrency +- Not explicitly addressed in the provided source. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..231cabc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,61 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:39:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an `AiGenerationProvider` implementation by name. + +#### Purpose +- Selects and instantiates an `AiGenerationProvider` based on the provided name. + +#### Type +- Class: `public class AiGenerationProviderFactory` +- Modifiers: None +- Extends: None +- Implements: None +- Generics: None +- Annotations: `@ToString` + +#### Input +- Constructor: No parameters +- Method: + - `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` + - Parameters: + - `providerName`: The name of the provider to create. + - `llamaConfig`: Configuration for the llama.cpp JNI provider. + - `promptSupport`: Support for prompt lookup passed to providers. + +#### Output +- Return type: `AiGenerationProvider` +- Produced state: None +- Mutated fields: None +- Written resources: None +- Side effects: None + +#### Core logic +- Checks if `providerName` is null or blank using `compatibilityHelper.isBlank(providerName)`. +- If `providerName` is null or blank, returns a new `MockAiGenerationProvider`. +- Switches on `providerName`: + - If `"mock"`, returns a new `MockAiGenerationProvider`. + - If `"llamacpp-jni"`, returns a new `LlamaCppJniAiGenerationProvider` with `llamaConfig` and `promptSupport`. + - Throws an `IllegalArgumentException` if the provider name is not recognized. + +#### Public API +- `create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider`: Creates an `AiGenerationProvider` based on the given provider name. + +#### Dependencies +- Imports: + - `lombok.ToString` + - `net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory` + - `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` + - `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` + +#### Exceptions / Errors +- Throws `IllegalArgumentException` if the provider name is not recognized. + +#### Concurrency +- No concurrency or synchronization notes. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..f6c7e67 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,64 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:41:24Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Implements an AI generation provider using the llama.cpp JNI binding to generate text based on prompts. + +#### Purpose +- Provides a service for generating AI text based on prompts using the llama.cpp JNI binding. +- Lazy loads the GGUF model on first use and caches it for subsequent calls. +- Handles the generation process, including building prompts, setting inference parameters, and parsing completions. + +#### Type +- Class +- Final +- Implements `AiGenerationProvider` and `AutoCloseable` +- Imports Lombok's `@ToString` annotation + +#### Input +- Constructor parameters: + - `config` (`LlamaCppJniConfig`) + - `promptSupport` (`AiPromptSupport`) +- Method parameters: + - `request` (`AiGenerationRequest`) + - `temperatureOverride` (`float`) + +#### Output +- Return type: `String` +- Produced state: None +- Mutated fields: `model` +- Written resources: None +- Side effects: Loads the GGUF model, generates text using llama.cpp, and closes the model handle + +#### Core logic +- Lazy loads the GGUF model on first use. +- Builds a prompt from the `AiGenerationRequest`. +- Sets inference parameters based on the configuration and request. +- Calls `chatCompleteText` on the model to generate text. +- Parses the generated completion using `AiCompletionParser`. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig config, AiPromptSupport promptSupport)` -> Initializes the provider with a configuration and prompt support object. +- `String generate(AiGenerationRequest request) throws IOException` -> Generates text using the default temperature. +- `String generate(AiGenerationRequest request, float temperatureOverride) throws IOException` -> Generates text with a specified temperature override. +- `void close()` -> Closes the model handle. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Throws `IOException` from the `generate` methods. + +#### Concurrency +- Not explicitly handled in the provided source. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..da32b2f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,83 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:43:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides immutable configuration for the llama.cpp JNI provider. + +#### Purpose +- Immutable configuration for the llama.cpp JNI provider. +- Used to store and access various parameters for the provider's operation. + +#### Type +- Class +- Final +- `@ConvertToRecord` +- `@ToString` +- `@EqualsAndHashCode` +- Extends: `java.lang.Object` + +#### Input +- Constructor parameters: + - `libraryPath`: native library path; may be `null` + - `modelPath`: path to the GGUF model file (required) + - `contextSize`: context window size in tokens + - `maxOutputTokens`: maximum number of output tokens per call + - `temperature`: sampling temperature + - `threads`: number of CPU threads + - `topP`: nucleus-sampling probability threshold + - `topK`: top-k sampling limit + - `repeatPenalty`: repetition penalty + - `chatTemplateEnableThinking`: whether chat-template thinking mode is enabled + - `stopStrings`: stop strings; may be `null` (treated as empty) + +#### Output +- Return types: + - `String`: native library path, or `null` to use the bundled library + - `String`: model file path + - `int`: context window size + - `int`: maximum output tokens + - `float`: sampling temperature + - `int`: number of CPU threads + - `float`: nucleus-sampling probability threshold + - `int`: top-k value + - `float`: repeat penalty + - `boolean`: whether chat-template thinking mode is enabled + - `List`: unmodifiable list of stop strings + +#### Core logic +- Immutable configuration class with eleven fields. +- Constructor validates the `modelPath` and initializes all fields. +- Accessor methods return the values of the fields. + +#### Public API +- `LlamaCppJniConfig(String libraryPath, String modelPath, int contextSize, int maxOutputTokens, float temperature, int threads, float topP, int topK, float repeatPenalty, boolean chatTemplateEnableThinking, List stopStrings) -> void` : Creates a new configuration instance. +- `String libraryPath() -> String` : Returns the native library path. +- `String modelPath() -> String` : Returns the GGUF model file path. +- `int contextSize() -> int` : Returns the context window size in tokens. +- `int maxOutputTokens() -> int` : Returns the maximum number of output tokens per call. +- `float temperature() -> float` : Returns the sampling temperature. +- `int threads() -> int` : Returns the number of CPU threads. +- `float topP() -> float` : Returns the nucleus-sampling probability threshold. +- `int topK() -> int` : Returns the top-k sampling limit. +- `float repeatPenalty() -> float` : Returns the repetition penalty. +- `boolean chatTemplateEnableThinking() -> boolean` : Returns whether chat-template thinking mode is enabled. +- `List stopStrings() -> List` : Returns an unmodifiable view of the configured stop strings. + +#### Dependencies +- `java.util.Collections` +- `java.util.List` +- `java.util.Objects` +- `lombok.EqualsAndHashCode` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord` + +#### Exceptions / Errors +- `NullPointerException` when `modelPath` is `null`. + +#### Concurrency +- Immutable, thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..28207db --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:46:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a mock implementation of the `AiGenerationProvider` interface for testing purposes. + +#### Purpose +- Returns a mock summary for an AI generation request, used for testing. + +#### Type +- Class +- Public +- Implements `AiGenerationProvider` +- Annotated with `@ToString` + +#### Input +- `AiGenerationRequest request` (constructor parameter) +- Consumed field: `sourceFile()` from `AiGenerationRequest` + +#### Output +- Returns a string: "Mock summary for [filename]" + +#### Core logic +- Extracts the file name from the `sourceFile()` in the `AiGenerationRequest` +- Returns a mock summary string using the file name + +#### Public API +- `MockAiGenerationProvider() -> void` - Creates a new `MockAiGenerationProvider`. +- `generate(AiGenerationRequest request) -> String` - Generates a mock summary for the provided request. + +#### Dependencies +- `java.io.IOException` +- `java.nio.file.Path` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `lombok.ToString` + +#### Exceptions / Errors +- Throws `IOException` if an I/O error occurs while accessing the file name + +#### Concurrency +- No concurrency concerns; the implementation is stateless and thread-safe diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..8231c45 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:53:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> This package provides a suite of classes and interfaces for handling AI text generation, including parsing raw completion text, generating text based on requests, and selecting appropriate generation providers. + +#### Purpose +- Parses raw LLM completion text to extract model answers. +- Provides a pluggable interface for AI text generation. +- Selects and instantiates AI generation providers based on configuration. + +#### Responsibilities +- **Text Parsing**: Responsible for cleaning raw LLM completion text by removing internal thinking blocks and storing the cleaned answer in an AI index file. +- **Text Generation**: Defines contracts for generating text from AI requests, supporting both default and temperature-overridden generations. +- **Provider Selection**: Selects and instantiates appropriate AI generation providers based on configuration. + +#### Key units +- **AiCompletionParser**: Parses raw LLM completion text to extract the model answer by stripping any internal thinking block. +- **AiGenerationProvider**: Defines a contract for generating text from AI requests, supporting both default and temperature-overridden generations. +- **AiGenerationProviderFactory**: Selects and instantiates an `AiGenerationProvider` based on the provided name. +- **LlamaCppJniAiGenerationProvider**: Implements an AI generation provider using the llama.cpp JNI binding to generate text based on prompts. +- **LlamaCppJniConfig**: Provides immutable configuration for the llama.cpp JNI provider. + +#### Data flow +- **Input**: Raw LLM completion text or AI generation requests. +- **Process**: Parsing, generation, and provider selection. +- **Output**: Cleaned answer text or generated text based on requests. + +#### Dependencies +- **Internal Collaborations**: + - `AiCompletionParser` depends on `java.io.IOException`. + - `AiGenerationProviderFactory` depends on `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`. + - `LlamaCppJniAiGenerationProvider` depends on various classes from the `net.ladenthin.llama` package and other utilities. +- **External Modules/Tables**: None noted. + +#### Cross-cutting +- **Shared Types/Interfaces**: `AiGenerationProvider`. +- **Exception/Errors**: `IOException` is thrown in several places for handling errors during text generation. +- **Concurrency**: Not explicitly handled in the provided source. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..28138fc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,40 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:59:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..0b79500 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,40 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:01:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..53ae45c --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,40 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:03:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..745a930 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/net/package.ai.md @@ -0,0 +1,40 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:05:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/package.ai.md new file mode 100644 index 0000000..216bd1b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/java/package.ai.md @@ -0,0 +1,40 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:06:45Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/package.ai.md new file mode 100644 index 0000000..2a21b39 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/main/package.ai.md @@ -0,0 +1,40 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:08:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/package.ai.md new file mode 100644 index 0000000..09c0e37 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/package.ai.md @@ -0,0 +1,40 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:10:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. + +#### Purpose +- Handles the configuration and management of AI models and operations within a Maven project. +- Provides mechanisms for selecting and applying AI configurations based on file types. +- Facilitates the execution of AI operations such as generating fields for source files or packages. + +#### Responsibilities +- **AI Configuration Management**: Defines and manages parameters for AI generation steps, including model settings and generation parameters. +- **Configuration Resolution**: Resolves and validates AI model definitions to generate ready-to-use configurations. +- **Field Generation Configuration**: Manages the configuration for associating prompt templates with AI models for field generation. +- **File Extension-based Selection**: Selects appropriate AI field generation settings based on file extensions. + +#### Key Units +- **AiGenerationConfig**: Manages all parameters for an AI generation step, ensuring they are correctly configured and transported between layers. +- **AiModelDefinition**: Represents a configuration POJO for AI model definitions, storing parameters that can be used across multiple field-generation entries. +- **AiFieldGenerationConfig**: Holds configuration for associating prompt templates with AI models for field generation, used within a list in the plugin configuration. +- **AiFieldGenerationSelector**: Selects the appropriate AI field generation settings for source files based on their extensions, ensuring that the correct configurations are applied. + +#### Data Flow +- Configuration data flows from the Maven plugin configuration to `AiModelDefinition` and `AiGenerationConfig`, where it is validated and stored. +- When a source file needs to be processed, the `AiFieldGenerationSelector` selects the appropriate `AiFieldGenerationConfig` based on the file's extension, and the `AiGenerationConfig` is used to execute the AI operations. + +#### Dependencies +- **Internal Collaborations**: + - `AiModelDefinitionSupport`: Provides a lookup table for AI model configurations and converts them into ready-to-use generation configurations. + - `Java8CompatibilityHelper`: Ensures compatibility with Java 8 features. + +#### Cross-cutting +- **Common Exception/Error Handling**: Handles `NullPointerException` and `IllegalArgumentException` for invalid configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/project.ai.md new file mode 100644 index 0000000..d38e0c5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 9AD3E89B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:12:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The `llamacpp-ai-index-maven-plugin` project is structured around managing AI-related configurations and operations within a Maven plugin. It includes packages for configuration management, text generation provider handling, and model definition support. The main subsystems work together to provide comprehensive AI functionalities, enabling developers to integrate advanced AI capabilities into their Maven-based projects efficiently. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Manages AI-related configurations and operations in a Maven plugin, including field generation, model definitions, and configuration support. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — This package provides a suite of classes and interfaces for handling AI text generation, including parsing raw completion text, generating text based on requests, and selecting appropriate generation providers. +- main/java/net/ladenthin/maven/llamacpp — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- main/java/net/ladenthin/maven — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- main/java/net/ladenthin — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- main/java/net — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- main/java — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- main — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. +- . — Manages AI-related configurations and operations within a Maven plugin, including field generation, model definitions, and configuration support. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..907db0d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,48 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:12:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Represents a configuration for an AI field generation step within a Maven plugin, associating a prompt template and AI model definition. + +#### Purpose +- Holds configuration for a single field-generation step in an AI-based Maven plugin. +- Used to define the prompt template and AI model for generating content in files based on specified criteria. + +#### Type +`public class AiFieldGenerationConfig` + +#### Input +- `promptKey`: Key that references an `AiModelDefinition` registered in the plugin configuration. +- `aiDefinitionKey`: Key that references the AI model definition to use. +- `fileExtensions`: Optional list of file extensions that select this field generation for specific files. + +#### Output +- Returns the prompt template key, AI model definition key, and source file extensions. + +#### Core logic +- Initializes with default values. +- Provides setters and getters for `promptKey`, `aiDefinitionKey`, and `fileExtensions`. + +#### Public API +- `AiFieldGenerationConfig()`: Creates a new `AiFieldGenerationConfig` instance. +- `String getPromptKey()`: Returns the prompt template key. +- `void setPromptKey(String promptKey)`: Sets the prompt template key. +- `String getAiDefinitionKey()`: Returns the AI model definition key. +- `void setAiDefinitionKey(String aiDefinitionKey)`: Sets the AI model definition key. +- `@Nullable List getFileExtensions()`: Returns the source file extensions that select this entry. +- `void setFileExtensions(@Nullable Collection fileExtensions)`: Sets the source file extensions that select this entry. + +#### Dependencies +- `AiModelDefinition` +- `AiPromptDefinition` + +#### Exceptions / Errors +- None explicitly handled; relies on Lombok annotations for null handling. + +#### Concurrency +- Not applicable; mutable JavaBean designed for reflection-based configuration injection. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..a8a4d41 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,44 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:15:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the `AiFieldGenerationConfig` that applies to a given source file based on file extensions. + +#### Purpose +- Configures the selection of AI field generation settings for different file types. + +#### Type +- `public final class` + `@ToString` + +#### Input +- `configs`: Iterable of `AiFieldGenerationConfig` entries. +- `fileName`: The source file name. + +#### Output +- Returns the first `AiFieldGenerationConfig` whose non-empty extension list matches the file name, or the first fallback entry if no match is found, or `null` if no entries are configured and no fallback is set. + +#### Core logic +- Iterates over the `configs`. +- Skips any `null` entries. +- Checks each `AiFieldGenerationConfig`'s `fileExtensions`. +- Returns the first matching config based on file extension. +- If no match, returns the first fallback config (if any). +- Returns `null` if no match and no fallback is configured. + +#### Public API +- `selectForFileName(final Iterable configs, final String fileName) -> @Nullable AiFieldGenerationConfig`: Returns the `AiFieldGenerationConfig` for the given file name. + +#### Dependencies +- `AiFieldGenerationConfig` +- `@Nullable` + +#### Exceptions / Errors +- Throws no exceptions; handles `null` entries in `configs`. + +#### Concurrency +- Not applicable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..3fa4122 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,71 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:16:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Manages configuration parameters for AI generation steps between Maven and AI provider implementations. + +#### Purpose +- Carries parameters for a single AI generation step. +- Provides getters/setters for configuration properties. +- Implements `toString` using Lombok for diagnostics. +- Ensures instances are mutable JavaBeans managed by identity. + +#### Type +```java +public class AiGenerationConfig +``` + +#### Core logic +- Initializes default values for various AI generation parameters. +- Provides getter and setter methods for each parameter. + +#### Public API +- `AiGenerationConfig()` -> Creates a new configuration with default values. +- `getModelPath() -> String` -> Returns the model file path. +- `setModelPath(String)` -> Sets the model file path. +- `getContextSize() -> int` -> Returns the context window size. +- `setContextSize(int)` -> Sets the context window size. +- `getMaxOutputTokens() -> int` -> Returns the maximum number of output tokens. +- `setMaxOutputTokens(int)` -> Sets the maximum number of output tokens. +- `getTemperature() -> float` -> Returns the sampling temperature. +- `setTemperature(float)` -> Sets the sampling temperature. +- `getThreads() -> int` -> Returns the number of CPU threads. +- `setThreads(int)` -> Sets the number of CPU threads. +- `getCharsPerToken() -> int` -> Returns the number of characters per token. +- `setCharsPerToken(int)` -> Sets the number of characters per token. +- `getMaxInputChars() -> int` -> Returns the maximum number of input characters. +- `setMaxInputChars(int)` -> Sets the maximum number of input characters. +- `isWarnOnTrim() -> boolean` -> Returns whether to warn on trim. +- `setWarnOnTrim(boolean)` -> Sets whether to warn on trim. +- `getMaxRetries() -> int` -> Returns the maximum number of retries. +- `setMaxRetries(int)` -> Sets the maximum number of retries. +- `getRetryTemperatureIncrement() -> float` -> Returns the retry temperature increment. +- `setRetryTemperatureIncrement(float)` -> Sets the retry temperature increment. +- `getTopP() -> float` -> Returns the nucleus-sampling probability threshold. +- `setTopP(float)` -> Sets the nucleus-sampling probability threshold. +- `getTopK() -> int` -> Returns the top-k sampling limit. +- `setTopK(int)` -> Sets the top-k sampling limit. +- `getRepeatPenalty() -> float` -> Returns the repetition penalty. +- `setRepeatPenalty(float)` -> Sets the repetition penalty. +- `isChatTemplateEnableThinking() -> boolean` -> Returns whether chat-template thinking mode is enabled. +- `setChatTemplateEnableThinking(boolean)` -> Sets whether chat-template thinking mode is enabled. +- `getStopStrings() -> List` -> Returns an unmodifiable list of stop strings. +- `setStopStrings(List)` -> Sets the list of stop strings. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- None + +#### Concurrency +- None diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..40494b9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,23 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:22:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies whether an AI generation operates on a single source file or a whole package. + +#### Purpose +- Enumerates the kinds of AI generation steps. +- Defines constants for summarizing individual files and packages. + +#### Type +```java +enum AiGenerationKind +``` + +#### Core logic +- `FILE_SUMMARY`: Indicates that the AI generation step produces fields for a single source file. +- `PACKAGE_SUMMARY`: Indicates that the AI generation step produces fields for a package aggregate. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..b200146 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,89 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:23:10Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Represents a Maven plugin configuration POJO that pairs a lookup key with a complete set of AI model parameters. + +#### Purpose +- Holds the configuration for an AI model definition. +- Used in a Maven plugin to manage and reuse AI model configurations across multiple field-generation entries and goals. + +#### Type +```java +public class AiModelDefinition +``` + +#### Input +- `key` (String): Unique lookup key for this definition. +- `modelPath` (String): Path to the GGUF model file. +- `contextSize` (int): Context window size (in tokens). +- `maxOutputTokens` (int): Maximum number of output tokens per inference call. +- `temperature` (float): Base sampling temperature. +- `threads` (int): Number of CPU threads for inference. +- `charsPerToken` (int): Number of characters per token. +- `warnOnTrim` (boolean): Whether to emit a warning when source text is trimmed. +- `maxRetries` (int): Maximum number of retry attempts. +- `retryTemperatureIncrement` (float): Temperature increment applied on each successive retry attempt. +- `topP` (float): Nucleus-sampling probability threshold. +- `topK` (int): Top-k sampling limit. +- `repeatPenalty` (float): Repetition penalty. +- `chatTemplateEnableThinking` (boolean): Whether the model's chat-template thinking mode is enabled. +- `stopStrings` (List): List of stop strings that terminate generation when encountered. + +#### Output +- None + +#### Core logic +- Manages and stores configuration for AI model definitions. +- Provides getters and setters for all configuration fields. + +#### Public API +- `getKey() -> String`: Returns the unique lookup key for this definition. +- `getModelPath() -> String`: Returns the path to the GGUF model file. +- `getContextSize() -> int`: Returns the context window size (in tokens). +- `getMaxOutputTokens() -> int`: Returns the maximum number of output tokens per inference call. +- `getTemperature() -> float`: Returns the base sampling temperature. +- `getThreads() -> int`: Returns the number of CPU threads for inference. +- `getCharsPerToken() -> int`: Returns the number of characters per token. +- `isWarnOnTrim() -> boolean`: Returns whether to emit a warning when source text is trimmed. +- `getMaxRetries() -> int`: Returns the maximum number of retry attempts. +- `getRetryTemperatureIncrement() -> float`: Returns the temperature increment applied on each successive retry attempt. +- `getTopP() -> float`: Returns the nucleus-sampling probability threshold. +- `getTopK() -> int`: Returns the top-k sampling limit. +- `getRepeatPenalty() -> float`: Returns the repetition penalty. +- `isChatTemplateEnableThinking() -> boolean`: Returns whether the model's chat-template thinking mode is enabled. +- `getStopStrings() -> List`: Returns the list of stop strings that terminate generation when encountered. +- `setKey(String key)`: Sets the unique lookup key for this definition. +- `setModelPath(String modelPath)`: Sets the path to the GGUF model file. +- `setContextSize(int contextSize)`: Sets the context window size (in tokens). +- `setMaxOutputTokens(int maxOutputTokens)`: Sets the maximum number of output tokens per inference call. +- `setTemperature(float temperature)`: Sets the base sampling temperature. +- `setThreads(int threads)`: Sets the number of CPU threads for inference. +- `setCharsPerToken(int charsPerToken)`: Sets the number of characters per token. +- `setWarnOnTrim(boolean warnOnTrim)`: Sets whether to emit a warning when source text is trimmed. +- `setMaxRetries(int maxRetries)`: Sets the maximum number of retry attempts. +- `setRetryTemperatureIncrement(float retryTemperatureIncrement)`: Sets the temperature increment applied on each successive retry attempt. +- `setTopP(float topP)`: Sets the nucleus-sampling probability threshold. +- `setTopK(int topK)`: Sets the top-k sampling limit. +- `setRepeatPenalty(float repeatPenalty)`: Sets the repetition penalty. +- `setChatTemplateEnableThinking(boolean chatTemplateEnableThinking)`: Sets whether the model's chat-template thinking mode is enabled. +- `setStopStrings(Collection stopStrings)`: Sets the list of stop strings that terminate generation when encountered. + +#### Dependencies +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- None + +#### Concurrency +- Not applicable diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..cf8a004 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,53 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:29:24Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key, returning corresponding generation configurations. + +#### Purpose +- Lookup table for converting `AiModelDefinition` entries to `AiGenerationConfig` objects. +- Ensures non-null keys and throws exceptions for misconfigured entries. +- Provides a method to retrieve `AiGenerationConfig` based on a key. + +#### Type +- `public final class` +- Implements none + +#### Input +- `List definitions`: List of AI model definitions. + +#### Output +- Returns `AiGenerationConfig` associated with the given key. +- Throws `NullPointerException` if any entry has a `null` key. +- Throws `IllegalArgumentException` if no definition is registered for the key. + +#### Core logic +- Initializes a `HashMap` to store `AiGenerationConfig` objects. +- Iterates over the list of `AiModelDefinition` entries, converting each to an `AiGenerationConfig`. +- Validates non-null keys and throws exceptions for invalid entries. +- Provides a method to retrieve an `AiGenerationConfig` by key. + +#### Public API +- `AiModelDefinitionSupport(List definitions) -> Constructs a new AiModelDefinitionSupport from the supplied definitions list.` +- `AiGenerationConfig getConfig(String key) -> Returns the AiGenerationConfig associated with the given key.` + +#### Dependencies +- `java.util.HashMap` +- `java.util.List` +- `java.util.Map` +- `java.util.Objects` +- `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig` + +#### Exceptions / Errors +- Throws `NullPointerException` if any entry has a `null` key. +- Throws `IllegalArgumentException` if no definition is registered for the key. + +#### Concurrency +- Not applicable diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..bfc5b22 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:40:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Represents configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Selects the appropriate AI field generation configuration for a given source file. +- `AiGenerationConfig`: Manages parameters for a single AI generation step. +- `AiModelDefinition`: Holds the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configurations. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate configuration based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..4fc60c7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:49:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..112b7e9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,40 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:31:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before the result is stored in an AI index file. + +#### Purpose +- Parses LLM completion text to isolate the actual model answer. +- Strips internal reasoning blocks to ensure only the final answer is retained. +- Handles edge cases where the token budget is exhausted or no markers are present. + +#### Type +public class AiCompletionParser + +#### Input +- `response` (String): The raw completion text from the model, may be `null`. + +#### Output +- Returns the cleaned answer text as a String, never `null`. +- Throws `IOException` if a thinking block was started but not completed. + +#### Core logic +- Trims the input `response` if it is `null`. +- Searches for `THINKING_BLOCK_END_MARKER` to remove internal reasoning. +- If `THINKING_BLOCK_START_MARKER` is found without `THINKING_BLOCK_END_MARKER`, throws `IOException`. +- Returns the trimmed text after `THINKING_BLOCK_END_MARKER`. + +#### Public API +- `parseCompletion(final String response) -> String`: Strips any Gemma-4 thinking block from the response and returns the clean answer text. + +#### Dependencies +- `java.io.IOException` + +#### Exceptions / Errors +- Throws `IOException` if the token budget is exhausted inside a thinking block. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..4ff04ee --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,42 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:33:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a pluggable AI backend for generating text from an `AiGenerationRequest`, supporting default and temperature-override generation. + +#### Purpose +- Interface for AI backend implementations that can generate text based on a request. +- Allows for local execution (e.g., llama.cpp) or mock providers for testing. + +#### Type +- Interface + public; implements `AutoCloseable`; no generics; no notable annotations. + +#### Input +- `generate(AiGenerationRequest request)`: The generation request containing prompt, source file, source text, and current header. +- `generate(AiGenerationRequest request, float temperatureOverride)`: The generation request and a specified temperature override for sampling. + +#### Output +- `String`: Generated text; never `null`, may be blank if no tokens are produced. + +#### Core logic +- **generate(AiGenerationRequest request)**: Generates text using the provider's default sampling parameters. +- **generate(AiGenerationRequest request, float temperatureOverride)**: Delegates to `generate(AiGenerationRequest request)` by default. Implementations supporting per-call temperature overrides should override this method. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates text using the provider's default sampling parameters. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates text using a specified temperature override, or delegates to the default implementation. +- `close() -> void`: Closes the provider, throwing an `IOException` if the underlying provider fails. + +#### Dependencies +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` + +#### Exceptions / Errors +- Throws `IOException` if the underlying provider fails. + +#### Concurrency +- No specific concurrency notes; implementations should handle thread safety as needed. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..fc858f9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,24 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:34:26Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an `AiGenerationProvider` implementation by name. + +#### Purpose +- Factory for creating instances of different AI generation providers based on the provided name. + +#### Type +public class AiGenerationProviderFactory + +#### Core logic +- Determines which `AiGenerationProvider` to create based on the `providerName` parameter. +- Supports two provider types: "mock" and "llamacpp-jni". +- Returns a new instance of the selected provider or throws an exception if the provider is not recognized. + +#### Public API +- `create(final String providerName, final LlamaCppJniConfig llamaConfig, final AiPromptSupport promptSupport) -> AiGenerationProvider`: Creates an `AiGenerationProvider` for the given provider name. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..1e2dae8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,55 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:35:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides AI generation functionality using the Llama.cpp JNI binding. + +#### Purpose +- Implements `AiGenerationProvider` for generating AI text based on requests. +- Uses a native Llama model for inference. +- Supports lazy loading of the model to save memory and improve initialization performance. + +#### Type +```java +public final class LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable +``` + +#### Input +- `config` (`LlamaCppJniConfig`): Configuration for Llama.cpp. +- `promptSupport` (`AiPromptSupport`): Support for building AI prompts. +- `request` (`AiGenerationRequest`): Request containing the text prompt and other parameters. + +#### Output +- Returns generated AI text as a `String`. + +#### Core logic +- **Initialization**: Stores configuration and prompt support in fields. +- **Model Loading**: Lazily loads the native Llama model on first use. +- **Text Generation**: Constructs a prompt, sets inference parameters, and generates completion using the model. +- **Resource Management**: Closes the model when the provider is closed. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates AI text using the default temperature. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates AI text with an overridden temperature. +- `close() -> void`: Closes the native Llama model. + +#### Dependencies +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `AiCompletionParser` +- `LlamaModel` +- `InferenceParameters` +- `ModelParameters` +- `Pair` +- `AiGenerationRequest` + +#### Exceptions / Errors +- Throws `IOException` if an I/O error occurs during model loading or text generation. + +#### Concurrency +- The native model handle is lazily initialized, so the provider can be created without loading the model. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..b8d7011 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,72 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:37:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable configuration for the llama.cpp JNI provider. + +#### Purpose +- Immutable data class to hold configuration parameters for the llama.cpp JNI provider. +- Provides methods to access individual configuration properties. + +#### Type +```java +public final class LlamaCppJniConfig implements java.io.Serializable { + // ... +} +``` + +#### Input +- Constructor parameters: + - `libraryPath`: native library path; may be `null` + - `modelPath`: path to the GGUF model file + - `contextSize`: context window size in tokens + - `maxOutputTokens`: maximum number of output tokens per call + - `temperature`: sampling temperature + - `threads`: number of CPU threads + - `topP`: nucleus-sampling probability threshold + - `topK`: top-k sampling limit + - `repeatPenalty`: repetition penalty + - `chatTemplateEnableThinking`: whether chat-template thinking mode is enabled + - `stopStrings`: stop strings; may be `null` (treated as empty) + +#### Output +- Return types: + - `libraryPath()`: native library path, or `null` to use the bundled library + - `modelPath()`: model file path + - `contextSize()`: context window size + - `maxOutputTokens()`: maximum output tokens + - `temperature()`: sampling temperature + - `threads()`: number of CPU threads + - `topP()`: nucleus-sampling probability threshold + - `topK()`: top-k sampling limit + - `repeatPenalty()`: repetition penalty + - `chatTemplateEnableThinking()`: whether chat-template thinking mode is enabled + - `stopStrings()`: unmodifiable list of stop strings + +#### Core logic +- Immutable configuration class with all fields marked as `final`. +- Constructor validates the `modelPath` parameter. +- Provides getter methods for each configuration property. + +#### Public API +- `LlamaCppJniConfig(String libraryPath, String modelPath, int contextSize, int maxOutputTokens, float temperature, int threads, float topP, int topK, float repeatPenalty, boolean chatTemplateEnableThinking, List stopStrings) -> Constructs a new configuration instance.` +- JavaBean getters/setters for: `libraryPath, modelPath, contextSize, maxOutputTokens, temperature, threads, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings` + +#### Dependencies +- `java.util.List` +- `java.util.Objects` +- `java.util.Collections` +- `lombok.EqualsAndHashCode` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord` + +#### Exceptions / Errors +- `NullPointerException` if `modelPath` is `null`. + +#### Concurrency +- Thread-safe due to immutability. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..16dfd34 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,32 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:40:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a mock implementation of `AiGenerationProvider` for testing purposes. + +#### Purpose +- To provide a deterministic implementation of `AiGenerationProvider` that returns a mock summary for testing. + +#### Type +```java +public class MockAiGenerationProvider implements AiGenerationProvider +``` + +#### Core logic +- Creates a new `MockAiGenerationProvider`. +- Generates a mock summary for the given `AiGenerationRequest`. + +#### Public API +- `generate(AiGenerationRequest request) -> String` : Generates a mock summary for the given request. + +#### Dependencies +- `AiGenerationRequest` +- `Path` + +#### Exceptions / Errors +- Throws `IOException` if an I/O error occurs. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..2edf0d9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,44 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T20:46:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> This package provides the infrastructure and functionality for interacting with AI models, specifically focusing on text generation and parsing of model responses. It includes interfaces, factories, and implementations for generating AI text using different backends, as well as utilities for configuring and parsing the responses. + +#### Responsibilities +- **AI Generation**: Interface and implementation for generating text based on requests. +- **Configuration**: Immutable configuration class for setting up the AI model. +- **Parsing**: Utility for extracting the actual model answer from raw completion text. +- **Mock Implementation**: A mock provider for testing purposes. + +#### Key Units +- **AiGenerationProvider**: Interface for pluggable AI backend implementations. +- **LlamaCppJniAiGenerationProvider**: Provides AI generation functionality using the Llama.cpp JNI binding. +- **MockAiGenerationProvider**: Mock implementation of `AiGenerationProvider` for testing. +- **AiCompletionParser**: Parses raw LLM completion text to extract the model answer. + +#### Data Flow +1. **Input**: An `AiGenerationRequest` containing the prompt and other parameters. +2. **Processing**: + - The request is passed to an `AiGenerationProvider` implementation, which generates text using a specific backend. + - The generated text may be processed by `AiCompletionParser` to remove any internal reasoning blocks. +3. **Output**: The cleaned answer text as a String. + +#### Dependencies +- Internal collaborations: `AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`, and other components within the package. +- External dependencies: `java.io.IOException`. + +#### Cross-cutting +- **Concurrency**: No specific concurrency notes; implementations should handle thread safety as needed. +- **Configuration**: Managed through the `LlamaCppJniConfig` class. +- **Error Handling**: Exceptions like `IOException` are handled in various components. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..7d150a8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:52:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..8343b5e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:53:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..1636c2b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:55:15Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..8e7f411 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/net/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:56:45Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/package.ai.md new file mode 100644 index 0000000..a93935d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/java/package.ai.md @@ -0,0 +1,45 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:58:16Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/package.ai.md new file mode 100644 index 0000000..c9fe859 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/main/package.ai.md @@ -0,0 +1,45 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T20:59:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/package.ai.md new file mode 100644 index 0000000..0099fb3 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/package.ai.md @@ -0,0 +1,45 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:01:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. + +#### Purpose +- Configures and selects AI generation parameters based on file types. +- Integrates with AI model definitions to produce summaries. + +#### Responsibilities +- **Configuration Management**: Holds and manages configuration parameters for AI generation steps. +- **Selection Logic**: Selects appropriate AI field generation configurations based on file extensions. +- **Model Definition Support**: Resolves AI model definitions to their corresponding generation configurations. + +#### Key Units +- `AiFieldGenerationConfig`: Manages configuration for a single AI field generation step. +- `AiFieldGenerationSelector`: Chooses the most suitable AI field generation config based on file types. +- `AiGenerationConfig`: Stores parameters for a single AI generation step. +- `AiModelDefinition`: Contains the configuration for an AI model definition. +- `AiModelDefinitionSupport`: Resolves AI model definitions to their corresponding generation configs. + +#### Data Flow +1. **Input**: `AiFieldGenerationConfig` and `AiModelDefinition` instances are configured. +2. **Processing**: + - `AiFieldGenerationSelector` iterates over `AiFieldGenerationConfig` entries to select the most appropriate config based on file extensions. + - `AiModelDefinitionSupport` resolves an `AiModelDefinition` key to an `AiGenerationConfig`. +3. **Output**: Selected `AiFieldGenerationConfig` and resolved `AiGenerationConfig`. + +#### Dependencies +- **Internal Collaborations**: + - `AiFieldGenerationConfig` depends on `AiPromptDefinition`. + - `AiFieldGenerationSelector` depends on `AiFieldGenerationConfig`. + - `AiModelDefinitionSupport` depends on `AiModelDefinition` and `AiGenerationConfig`. +- **External Modules**: None explicitly mentioned. + +#### Cross-cutting +- **Configuration Management**: Uses Lombok for JavaBean design and easy configuration management. +- **Null Handling**: Handles null entries gracefully using Lombok and manual checks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/project.ai.md new file mode 100644 index 0000000..7670d35 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen25coder-7b__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: D3AA3C76 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T21:02:50Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The `llamacpp-ai-index-maven-plugin` project is a comprehensive suite of Java packages designed to integrate AI-driven content generation into Maven projects. At its core, the plugin manages configuration and selection logic for AI field generation steps, seamlessly integrating with various AI model definitions. The `provider` package extends this functionality by offering the necessary infrastructure and utilities for interacting with AI models, specifically tailored for text generation and response parsing. Together, these subsystems enable developers to automatically generate summaries for individual files or entire packages, leveraging advanced AI capabilities within their Maven environments. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — This package provides the infrastructure and functionality for interacting with AI models, specifically focusing on text generation and parsing of model responses. It includes interfaces, factories, and implementations for generating AI text using different backends, as well as utilities for configuring and parsing the responses. +- main/java/net/ladenthin/maven/llamacpp — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main/java/net/ladenthin/maven — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main/java/net/ladenthin — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main/java/net — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main/java — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- main — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. +- . — Manages configuration and selection logic for AI field generation steps within Maven projects, integrating with AI model definitions and providing mechanisms to generate summaries for individual files or entire packages. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..618d90b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,57 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:42:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Associates a prompt template with an AI model definition to generate field values for specific file types in Maven plugin processing + +#### Purpose +- Defines a mapping between a prompt template and an AI model for field generation per file type +- Enables selective AI processing based on source file extensions + +#### Type +class, public, final none; @ToString; implements none; extends none; generics: none +key annotations: @ToString, @Nullable (on fields), @SuppressWarnings("NullAway.Init", "initialization.fields.uninitialized") + +#### Input +- Constructor: no parameters +- Method parameters: promptKey (String), aiDefinitionKey (String), fileExtensions (Collection) +- Injected via Maven plugin reflection through setters + +#### Output +- Returns promptKey (String) +- Returns aiDefinitionKey (String) +- Returns fileExtensions (List or null) as unmodifiable view +- Produces immutable list when fileExtensions is set + +#### Core logic +- Maps a prompt key to an AI model definition by key +- Applies field generation only to files matching specified extensions +- Uses fallback behavior when no extensions are defined +- Defensively copies fileExtensions list to prevent external modification + +#### Public API +- getPromptKey() → String (returns prompt template key) +- setPromptKey(String) → void (sets prompt template key) +- getAiDefinitionKey() → String (returns AI model definition key) +- setAiDefinitionKey(String) → void (sets AI model definition key) +- getFileExtensions() → List or null (returns file extensions or fallback) +- setFileExtensions(Collection) → void (sets file extensions; null = fallback) + +#### Dependencies +AiModelDefinition, AiPromptDefinition, Collection, List, ArrayList, Collections, lombok.ToString + +#### Exceptions / Errors +- No explicit exceptions thrown +- Null handling via @Nullable on fileExtensions and method parameters +- Null values are allowed and treated as fallback + +#### Concurrency +- Immutable output for fileExtensions after set +- No thread-safety or synchronization annotations +- Safe for concurrent access due to defensive copying of list +- Mutable state only in setter methods, not exposed externally diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..18f571e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,53 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:43:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the AI field generation config based on file extension, using a priority order of matching rules and fallback + +#### Purpose +- Determines which AI prompt configuration to apply to a source file by file extension +- Supports fallback logic for files without matching extensions + +#### Type +- final class with public constructor +- implements no interfaces +- extends no classes +- key generics: Iterable +- annotations: @ToString, @Nullable (on return type) + +#### Input +- configs: Iterable of AiFieldGenerationConfig entries in declaration order; null entries are skipped +- fileName: source file name (e.g. "Foo.java") + +#### Output +- AiFieldGenerationConfig instance matching the file extension, or null if no match and no fallback + +#### Core logic +- Iterates over configured AI generation rules in order +- Skips null config entries +- For each config, checks if its non-empty extensions list matches the file name via endsWith +- Returns first matching config immediately +- If no match, retains first config with empty or absent extension list as fallback +- Returns null if no valid config and no fallback is defined + +#### Public API +- selectForFileName(Iterable, String) → AiFieldGenerationConfig (returns matching config or fallback, or null) + +#### Dependencies +- java.util.List +- java.lang.Iterable +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No exceptions thrown; handles null inputs gracefully by skipping null configs +- Returns null when no match and no fallback exists + +#### Concurrency +- Thread-safe by design due to immutable state and pure logic (no shared mutable state) +- No synchronization or concurrent access required diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..7061f04 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,64 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:44:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines default and mutable parameters for AI model inference in Maven-based AI generation steps + +#### Purpose +- Configures sampling, context, and retry behavior for AI model inference +- Bridges Maven plugin configuration with llama.cpp inference parameters + +#### Type +class, public, mutable, final fields, Lombok @ToString, static defaults + +#### Input +- Constructor: no input +- Method parameters: modelPath (String), contextSize (int), temperature (float), threads (int), charsPerToken (int), maxInputChars (int), warnOnTrim (boolean), maxRetries (int), retryTemperatureIncrement (float), topP (float), topK (int), repeatPenalty (float), chatTemplateEnableThinking (boolean), stopStrings (List) + +#### Output +- Returns configured values via getter methods +- Produces immutable list of stop strings when requested +- Updates internal state via setters (mutable) + +#### Core logic +- Stores model-specific inference parameters in a mutable object +- Uses static defaults for all fields to provide consistent baseline behavior +- Automatically calculates maxInputChars from context size, output tokens, and safety margin when charsPerToken > 0 +- Implements retry logic with temperature increment per attempt to improve model response quality +- Supports chat-template thinking mode control to suppress or enable chain-of-thought reasoning + +#### Public API +- getModelPath() → String (get model file path) +- getContextSize() → int (get context window size) +- getMaxOutputTokens() → int (get max output tokens) +- getTemperature() → float (get sampling temperature) +- getThreads() → int (get CPU threads) +- getCharsPerToken() → int (get chars per token) +- getMaxInputChars() → int (get max input characters) +- isWarnOnTrim() → boolean (check trim warning status) +- getMaxRetries() → int (get retry count) +- getRetryTemperatureIncrement() → float (get retry temp increment) +- getTopP() → float (get top-p sampling) +- getTopK() → int (get top-k sampling) +- getRepeatPenalty() → float (get repetition penalty) +- isChatTemplateEnableThinking() → boolean (check thinking mode) +- getStopStrings() → List (get stop strings, immutable) + +#### Dependencies +- java.util.List, java.util.ArrayList, java.util.Collections +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No explicit exceptions thrown; null handling via nullable fields and defensive checks in setters +- null modelPath allowed; null stopStrings resets to empty list + +#### Concurrency +- Immutable getters; mutable state only updated via setters +- Thread-safe access via immutable views (e.g. getStopStrings returns unmodifiable list) +- No synchronization or shared state; safe for concurrent reads diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..a6924bb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,40 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:47:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines whether AI generation targets individual source files or entire packages + +#### Purpose +- Specifies scope of AI-generated content: per-file or per-package +- Enables routing of generation steps based on context size and output type + +#### Type +public enum AiGenerationKind + +#### Input +None + +#### Output +None + +#### Core logic +- No computation; only provides named constants for scope selection +- Values are statically defined and immutably accessible + +#### Public API +- FILE_SUMMARY(file) → void — generates fields for a single source file +- PACKAGE_SUMMARY(pkg) → void — generates fields for a package aggregate + +#### Dependencies +AiGenerationKind, net.ladenthin.maven.llamacpp.aiindex.config + +#### Exceptions / Errors +None thrown; no runtime error handling + +#### Concurrency +Immutable and thread-safe by design diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..e8c5bfc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,86 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:47:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines AI model parameters by key for reuse in field generation configurations + +#### Purpose +- Stores AI model configuration parameters (e.g., context size, temperature) tied to a unique lookup key +- Enables reusable model settings across multiple field-generation entries + +#### Type +- class: public, final (not final), mutable JavaBean +- implements: none +- extends: none +- generics: none +- annotations: @ToString, @Nullable, @SuppressWarnings("NullAway.Init", "initialization.fields.uninitialized") + +#### Input +- constructor: default values from AiGenerationConfig +- parameters: key (String), modelPath (String), and various numeric/boolean fields via setters +- injected dependencies: none directly; relies on external configuration via reflection + +#### Output +- returns: key, model path, and all model-specific parameters (e.g., context size, temperature) +- produces: immutable view of stopStrings list via unmodifiableList +- side effects: sets internal state through setters; no mutations beyond field assignment + +#### Core logic +- Defines a reusable AI model configuration with default values from AiGenerationConfig +- Uses key-based lookup for reference in field-generation configs +- All numeric and boolean fields inherit defaults from AiGenerationConfig +- stopStrings are managed as a nullable list, converted to immutable view on access +- setters update internal state; no validation or transformation logic + +#### Public API +- getKey() → String (returns unique model key) +- setKey(String) → void (assigns key for lookup) +- getModelPath() → String (returns model file path) +- setModelPath(String) → void (sets GGUF model path) +- getContextSize() → int (returns context window size) +- setContextSize(int) → void (configures input tokens) +- getMaxOutputTokens() → int (returns max output tokens) +- setMaxOutputTokens(int) → void (limits generated output) +- getTemperature() → float (returns sampling temperature) +- setTemperature(float) → void (controls randomness) +- getThreads() → int (returns CPU threads for inference) +- setThreads(int) → void (configures parallelism) +- getCharsPerToken() → int (returns chars per token for input trimming) +- setCharsPerToken(int) → void (enables dynamic max input calculation) +- isWarnOnTrim() → boolean (checks trim warning flag) +- setWarnOnTrim(boolean) → void (toggles input trim warning) +- getMaxRetries() → int (returns retry attempts on empty response) +- setMaxRetries(int) → void (configures retry policy) +- getRetryTemperatureIncrement() → float (returns retry temp increment) +- setRetryTemperatureIncrement(float) → void (adjusts temperature on retries) +- getTopP() → float (returns nucleus sampling threshold) +- setTopP(float) → void (configures top-p filtering) +- getTopK() → int (returns top-k token limit) +- setTopK(int) → void (limits sampling to top-k tokens) +- getRepeatPenalty() → float (returns repetition penalty) +- setRepeatPenalty(float) → void (penalizes repeated tokens) +- isChatTemplateEnableThinking() → boolean (checks thinking mode enable) +- setChatTemplateEnableThinking(boolean) → void (controls chain-of-thought reasoning) +- getStopStrings() → List (returns stop strings, null if not set) +- setStopStrings(Collection) → void (configures generation termination strings) + +#### Dependencies +- AiGenerationConfig +- java.util.List, java.util.Collections, java.util.ArrayList +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- no explicit throws; no error handling or validation logic +- null fields allowed via @Nullable; stopStrings may be null +- defaults used for all fields; no bounds checking or input sanitization + +#### Concurrency +- thread-safe by design: immutable views (e.g., stopStrings) and state updates via setters +- no synchronization or shared mutable state +- safe for concurrent access due to immutability of returned values and no shared state mutations diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..16f6b9b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,52 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:50:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to produce ready-to-use generation configurations + +#### Purpose +- Acts as a lookup table to convert AI model keys into full generation configurations +- Enforces configuration validity at build time by validating non-null keys and missing definitions + +#### Type +- final class with @ToString annotation +- implements no interfaces, extends no type +- generic: none +- key dependencies: AiModelDefinition → AiGenerationConfig via key lookup + +#### Input +- List definitions (may be null or empty) +- Individual entries must have non-null key; null key triggers immediate NullPointerException + +#### Output +- Map internal state (immutable after construction) +- Returns AiGenerationConfig on lookup by key +- Throws IllegalArgumentException for missing keys + +#### Core logic +- Presizes map to avoid rehashing during bulk population +- Validates each definition's key at insertion time and enforces non-null requirement +- Converts each AiModelDefinition into a full AiGenerationConfig via field-by-field copy +- Returns null-config if key not found, then throws IllegalArgumentException with descriptive message + +#### Public API +- AiModelDefinitionSupport(List definitions) → void (builds lookup map from list) +- getConfig(String key) → AiGenerationConfig (returns config for given key or throws error) + +#### Dependencies +AiModelDefinition, AiGenerationConfig, Java8CompatibilityHelper, Objects + +#### Exceptions / Errors +- NullPointerException if any entry has null key (with index and entry detail) +- IllegalArgumentException if key not found in map (with prefix message) +- Null key in getConfig() throws IllegalArgumentException + +#### Concurrency +- Immutable state after construction +- No shared mutable state; thread-safe via final fields and immutable config objects +- Safe for concurrent access without synchronization diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..f0f2881 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,49 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:56:58Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> This package enables AI-driven field generation in Maven plugin workflows by defining model configurations, prompt mappings, and execution scopes tailored to source file types. + +#### Purpose +- Configures AI model parameters and inference behavior for Maven-based source processing +- Maps AI prompt templates to specific file extensions to enable per-file or per-package field generation + +#### Responsibilities +- AI model configuration management (parameters, context, retries) +- Prompt/template routing based on file extension +- Scope definition: individual files vs. entire packages +- Model lookup and validation via key-based configuration + +#### Key units +- `AiFieldGenerationConfig`: maps prompt and model keys to file extensions for selective AI field generation +- `AiFieldGenerationSelector`: selects the appropriate generation config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, retries, stop strings) +- `AiModelDefinition`: stores reusable AI model settings keyed by identifier +- `AiModelDefinitionSupport`: resolves model keys to full generation configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves associated prompt and model key → `AiModelDefinitionSupport` resolves model key to full `AiGenerationConfig` → applies model parameters to generate field values via AI inference pipeline + +#### Dependencies +- Internal: `AiModelDefinition`, `AiGenerationConfig`, `AiFieldGenerationConfig`, `AiGenerationKind`, `Collection`, `List`, `Iterable`, `Map`, `Objects` +- External: Maven plugin reflection, llama.cpp inference engine (via model paths), Java 8+ features + +#### Cross-cutting +- Immutable output views for lists and configs (e.g., `getStopStrings()` returns unmodifiable list) +- Null handling via `@Nullable` annotations and fallback behavior for missing values +- Thread-safe by design due to immutability and no shared mutable state +- Lombok `@ToString` used across all classes for debugging and logging +- Static defaults in `AiGenerationConfig` provide baseline inference behavior +- Error handling: explicit `NullPointerException` on null keys, `IllegalArgumentException` on missing definitions or invalid inputs diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..e603f94 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,52 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:01:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> This package enables AI-driven field generation and text inference in Maven plugin workflows by configuring and executing local LLMs (like llama.cpp) to generate source metadata based on file type and prompt templates. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer +- `MockAiGenerationProvider`: generates deterministic, testable responses for isolation and testing + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..856cfca --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,46 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:51:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Extracts the model's final answer from raw LLM completion text by removing internal reasoning blocks + +#### Purpose +- Strips internal chain-of-thought reasoning from LLM responses +- Ensures only the final model output is stored in AI index files + +#### Type +class, public, non-final, @ToString +implements none, extends none +generics: none + +#### Input +- raw completion text from an LLM (String), may be null + +#### Output +- cleaned final answer text (String), never null + +#### Core logic +- If input is null, return empty string +- Find position of thinking block end marker +- If end marker found, return text after it, trimmed +- If start marker present but end marker absent, throw IOException with actionable message +- Otherwise, return trimmed original input + +#### Public API +- parseCompletion(String) -> String: extracts final model answer by removing internal reasoning + +#### Dependencies +- java.io.IOException +- lombok.ToString + +#### Exceptions / Errors +- Throws IOException if thinking block start is found without corresponding end marker +- Handles null input by treating it as empty string + +#### Concurrency +- No thread safety concerns; stateless, immutable operations diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..8cb3820 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,48 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:52:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI text from a document request using configurable sampling parameters + +#### Purpose +- Enables pluggable AI backends (e.g., llama.cpp or mock providers) to produce text from document prompts +- Supports per-call temperature overrides to avoid early termination and empty responses + +#### Type +- interface +- extends AutoCloseable +- key generics: none +- notable annotations: none + +#### Input +- AiGenerationRequest containing: prompt key, source file, source text, current header +- temperatureOverride (float) for override-based generation + +#### Output +- String with generated text; never null, may be blank if no tokens produced + +#### Core logic +- Uses default sampling parameters when no temperature override is provided +- On temperature override, temporarily overrides provider’s internal temperature setting +- Delegates to base generate() method in default implementation +- Handles I/O errors from underlying AI provider + +#### Public API +- generate(AiGenerationRequest) → String (generates text with default settings) +- generate(AiGenerationRequest, float) → String (overrides temperature for retry resilience) + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest + +#### Exceptions / Errors +- Throws IOException if provider fails during generation or I/O operations +- No null inputs; request is guaranteed to be non-null + +#### Concurrency +- Not thread-safe; no synchronization or concurrency handling +- Designed for single-threaded AI generation calls diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..4452b15 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,50 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:53:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an AI generation provider based on configuration name + +#### Purpose +- Creates and returns an AI generation provider instance by provider name +- Supports fallback to mock provider when name is missing or invalid + +#### Type +- class: public, final (not explicitly marked), non-sealed +- implements: none +- extends: none +- generics: none +- annotations: @ToString + +#### Input +- providerName: String, provider key (e.g. "mock", "llamacpp-jni") +- llamaConfig: LlamaCppJniConfig, configuration for JNI-based provider +- promptSupport: AiPromptSupport, prompt handling support for providers that need it + +#### Output +- AiGenerationProvider instance: new provider object based on providerName + +#### Core logic +- Returns mock provider if providerName is null or blank +- Uses switch statement to select provider by name: "mock" → MockAiGenerationProvider; "llamacpp-jni" → LlamaCppJniAiGenerationProvider +- Throws IllegalArgumentException for unrecognized provider names + +#### Public API +- create(String, LlamaCppJniConfig, AiPromptSupport) → AiGenerationProvider (instantiates provider by name) + +#### Dependencies +- Java8CompatibilityHelper +- AiPromptSupport +- LlamaCppJniConfig +- MockAiGenerationProvider +- LlamaCppJniAiGenerationProvider + +#### Exceptions / Errors +- IllegalArgumentException if providerName is unknown or unsupported + +#### Concurrency +- No thread safety concerns; stateless, single-threaded creation logic diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..94fe8f1 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,63 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:53:43Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI responses from GGUF models using llama.cpp via JNI, with lazy loading and prompt templating + +#### Purpose +- Executes AI text generation using local GGUF models via llama.cpp JNI binding +- Delays model loading until first generation to reduce startup overhead + +#### Type +- final class implements AiGenerationProvider, AutoCloseable +- extends none, implements AiGenerationProvider, AutoCloseable +- generics: none +- key annotations: @ToString, @Nullable, Lombok @ToString.Exclude + +#### Input +- LlamaCppJniConfig (model path, context size, threads, temperature, etc.) +- AiPromptSupport (for building prompts from request) +- AiGenerationRequest (input prompt and metadata) +- float temperatureOverride (optional override for generation temperature) + +#### Output +- String (generated AI response text) +- Model closed on dispose (native resources freed) + +#### Core logic +- Lazily loads GGUF model on first generate() call using provided config +- Builds prompt from request via prompt support +- Constructs chat message list with user prompt +- Sets inference parameters: temperature, max tokens, top-p, top-k, stop strings +- Executes chat completion via native llama.cpp model +- Parses and returns generated response text + +#### Public API +- generate(AiGenerationRequest) -> String (generates response using default temperature) +- generate(AiGenerationRequest, float) -> String (generates with custom temperature) +- close() -> void (releases native model handle) + +#### Dependencies +- net.ladenthin.llama.LlamaModel +- net.ladenthin.llama.parameters.InferenceParameters +- net.ladenthin.llama.parameters.ModelParameters +- net.ladenthin.llama.value.Pair +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiCompletionParser + +#### Exceptions / Errors +- Throws IOException on model load or generation failure +- Null checks on config and promptSupport at construction +- No explicit error handling beyond standard JNI/IO exceptions + +#### Concurrency +- Thread-safe only via lazy initialization and model caching +- No shared state; each generate() call is independent +- Model loaded per instance, not shared across threads +- Immutable inference parameters prevent mutation during use diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..550ed01 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,83 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:55:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines immutable configuration for llama.cpp JNI-based AI model inference + +#### Purpose +- Configures runtime parameters for llama.cpp JNI-based LLM inference +- Encapsulates model and execution settings in a thread-safe, immutable format + +#### Type +- final class +- extends: none +- implements: none +- generics: none +- annotations: @ConvertToRecord, @ToString, @EqualsAndHashCode + +#### Input +- libraryPath (native library path; may be null) +- modelPath (path to GGUF model file) +- contextSize (context window size in tokens) +- maxOutputTokens (max output tokens per call) +- temperature (sampling temperature) +- threads (CPU thread count) +- topP (nucleus sampling threshold) +- topK (top-k sampling limit) +- repeatPenalty (repetition penalty) +- chatTemplateEnableThinking (boolean for thinking mode) +- stopStrings (list of stop strings; null → empty list) + +#### Output +- libraryPath (native library path) +- modelPath (model file path) +- contextSize (context window size) +- maxOutputTokens (max output tokens) +- temperature (sampling temperature) +- threads (thread count) +- topP (nucleus sampling threshold) +- topK (top-k limit) +- repeatPenalty (repetition penalty) +- chatTemplateEnableThinking (thinking mode enabled) +- stopStrings (unmodifiable list of stop strings) + +#### Core logic +- Requires non-null modelPath at construction +- Null stopStrings default to empty list +- All fields are final and initialized in constructor +- All accessors return immutable, defensive copies +- Lombok generates equals, hashCode, toString with bit-level float comparison + +#### Public API +- libraryPath() → String (native library path) +- modelPath() → String (model file path) +- contextSize() → int (context window size) +- maxOutputTokens() → int (max output tokens) +- temperature() → float (sampling temperature) +- threads() → int (CPU thread count) +- topP() → float (top-p threshold) +- topK() → int (top-k limit) +- repeatPenalty() → float (repetition penalty) +- chatTemplateEnableThinking() → boolean (thinking mode enabled) +- stopStrings() → List (unmodifiable stop strings) + +#### Dependencies +- java.util.Collections +- java.util.List +- java.util.Objects +- lombok.EqualsAndHashCode +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +- Throws NullPointerException if modelPath is null + +#### Concurrency +- Immutable state; thread-safe by design +- No shared mutable fields or synchronization needed +- All accessors return defensive copies of internal state diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..1283fe2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:56:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a deterministic mock summary for AI generation testing + +#### Purpose +- Generates testable, predictable summaries for AI document processing +- Replaces real AI generation in unit and integration tests + +#### Type +class, public, final, implements AiGenerationProvider + +#### Input +- AiGenerationRequest (sourceFile) → Path object + +#### Output +- String (mock summary of the input file name) + +#### Core logic +- Extracts source file name from request +- Constructs a deterministic mock summary using the filename +- Returns the summary without external dependencies or side effects + +#### Public API +- generate(AiGenerationRequest request) → String (creates mock summary from file name) + +#### Dependencies +AiGenerationRequest, Path, IOException + +#### Exceptions +- Throws IOException on failure (no actual I/O performed) + +#### Concurrency +- Immutable state, thread-safe by design — no shared mutable state or synchronization needed diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..17f4382 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,59 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T05:59:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> This package enables pluggable, configurable AI text generation from document prompts using local LLMs like llama.cpp, with support for mocking and deterministic testing of AI response pipelines. + +#### Purpose +- Provides a modular, extensible pipeline for generating AI responses from document inputs using configurable backends +- Supports both real (llama.cpp JNI) and mock-based AI generation for testing and fallback scenarios + +#### Responsibilities +- AI generation execution via provider interfaces (e.g., llama.cpp or mock) +- Configuration management for LLM inference parameters +- Parsing raw LLM output to extract final answers by removing internal reasoning blocks +- Provider instantiation and selection based on configuration name +- Deterministic mock generation for test environments + +#### Key units +- `AiGenerationProvider`: abstracts AI text generation with pluggable backends; supports temperature overrides and I/O error handling +- `LlamaCppJniAiGenerationProvider`: executes GGUF model inference via llama.cpp JNI with lazy loading and prompt templating +- `LlamaCppJniConfig`: immutable configuration object defining model path, context size, temperature, top-p/k, stop strings +- `AiCompletionParser`: extracts final model output from raw completion text by removing internal thinking blocks +- `MockAiGenerationProvider`: generates deterministic, testable summaries from file names to simulate AI responses in isolation +- `AiGenerationProviderFactory`: creates and returns an instance of an AI provider based on configuration name with fallback to mock + +#### Data flow +- A document request is processed into an `AiGenerationRequest` object containing prompt and metadata +- The `AiGenerationProviderFactory` selects a provider (real or mock) by name and instantiates it +- The selected provider generates text via `generate()` using configured or overridden temperature parameters +- For real providers, the model is lazily loaded and inference parameters are set; output is parsed and returned +- For mock providers, a deterministic summary derived from the input file name is returned +- Raw completion text (if generated) is passed to `AiCompletionParser` to strip internal reasoning blocks before storage + +#### Dependencies +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiCompletionParser` +- `net.ladenthin.llama.LlamaModel`, `InferenceParameters`, `ModelParameters` +- `java.io.IOException` +- `java.util.List`, `java.util.Collections` +- `lombok.ToString`, `@EqualsAndHashCode`, `@ConvertToRecord` + +#### Cross-cutting +- All providers are stateless and thread-safe, with no shared mutable state +- Immutable configuration objects (`LlamaCppJniConfig`) used throughout to ensure safe concurrent access +- Common exception handling: `IOException` thrown on I/O failures or null model paths +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Use of Lombok annotations for immutability, toString, equals, and hash code generation across units diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..5194a66 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,51 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:03:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer +- `MockAiGenerationProvider`: generates deterministic, testable responses for isolation and testing + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..5cfa8b1 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:04:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..809e30f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:05:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..60a9423 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/net/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:07:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/package.ai.md new file mode 100644 index 0000000..ffc04a8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/java/package.ai.md @@ -0,0 +1,50 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:08:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> This package enables AI-driven metadata generation for source files in Maven plugin workflows by dynamically creating field definitions based on file type using local LLMs or mock providers. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/package.ai.md new file mode 100644 index 0000000..43824f8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/main/package.ai.md @@ -0,0 +1,50 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:10:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> This package enables AI-driven metadata generation for source files in Maven plugin workflows by dynamically creating field definitions based on file type using local LLMs or mock providers. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/package.ai.md new file mode 100644 index 0000000..4a1a576 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/package.ai.md @@ -0,0 +1,50 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:11:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> This package enables AI-driven metadata generation for source files in Maven plugin workflows by dynamically creating field definitions based on file type using local LLMs or mock providers. + +#### Purpose +- Configures AI model behavior and prompt routing for per-file or per-package field generation in Maven-based source processing +- Provides a pluggable, testable pipeline for AI text generation using local LLMs or mock providers + +#### Responsibilities +- AI model configuration and parameter management (temperature, context size, retries) +- Prompt/template selection based on file extension or type +- Scope definition: file-level vs. package-level field generation +- Real-time AI inference via llama.cpp or deterministic mock execution +- Input parsing and output cleaning to extract final responses from raw LLM outputs + +#### Key units +- `AiFieldGenerationConfig`: maps prompt templates and model keys to file extensions for selective field generation +- `AiFieldGenerationSelector`: selects config by file extension with fallback logic +- `AiGenerationConfig`: holds mutable inference parameters (temperature, context size, stop strings) +- `AiModelDefinition`: stores reusable AI model settings by identifier +- `AiModelDefinitionSupport`: resolves model keys to full configs with validation and error handling +- `AiGenerationKind`: defines scope of AI output as file-level or package-level +- `AiGenerationProvider`: abstract interface for pluggable AI generation backends +- `LlamaCppJniAiGenerationProvider`: executes GGUF models via llama.cpp JNI with lazy loading +- `LlamaCppJniConfig`: immutable config object defining model path, context, temperature, stop strings +- `AiCompletionParser`: strips internal reasoning blocks from raw LLM output to extract final answer + +#### Data flow +Input file name → `AiFieldGenerationSelector` matches extension → selects `AiFieldGenerationConfig` → retrieves prompt and model key → `AiModelDefinitionSupport` resolves key to full `AiGenerationConfig` → applies parameters to AI provider → provider generates text (real or mock) → raw output passed to `AiCompletionParser` → final clean response stored + +#### Dependencies +- Internal: `AiFieldGenerationConfig`, `AiGenerationConfig`, `AiModelDefinition`, `AiGenerationKind`, `Collection`, `List`, `Map`, `Objects`, `AiGenerationRequest`, `AiPromptSupport` +- External: Maven plugin reflection, llama.cpp inference engine (via GGUF models), Java 8+ features + +#### Cross-cutting +- Immutable configuration and state objects (e.g., `LlamaCppJniConfig`, `AiGenerationConfig`) for thread safety and concurrent access +- Null handling via `@Nullable` annotations and fallback logic for missing values +- Stateless, thread-safe providers with no shared mutable state +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`, `@ConvertToRecord`) used across all classes for immutability and debugging +- Explicit error handling: `NullPointerException` on null keys, `IllegalArgumentException` on invalid inputs or missing definitions +- Deterministic output patterns in mock provider and parser for consistent test behavior +- Static defaults in `AiGenerationConfig` provide baseline inference parameters diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/project.ai.md new file mode 100644 index 0000000..239b24c --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 7529C57E +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:12:45Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project implements an AI-driven metadata generation pipeline for Maven plugin workflows, where source files are analyzed by type to trigger dynamic field creation. Core functionality is centered around AI text inference via local LLMs such as llama.cpp, with prompt configurations and execution scopes tailored per file type. A pluggable provider architecture enables flexible integration of AI generation pipelines, including mock providers for deterministic testing. The system organizes these capabilities into layered components: from high-level routing and configuration to low-level model execution and prompt mapping. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — This package enables AI-driven field generation in Maven plugin workflows by defining model configurations, prompt mappings, and execution scopes tailored to source file types. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package enables AI-driven field generation and text inference in Maven plugin workflows by configuring and executing local LLMs (like llama.cpp) to generate source metadata based on file type and prompt templates. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — This package enables pluggable, configurable AI text generation from document prompts using local LLMs like llama.cpp, with support for mocking and deterministic testing of AI response pipelines. +- main/java/net/ladenthin/maven/llamacpp — This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. +- main/java/net/ladenthin/maven — This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. +- main/java/net/ladenthin — This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. +- main/java/net — This package enables AI-driven source metadata generation in Maven plugin workflows by routing file-specific prompts to local LLMs or mock providers for dynamic field creation based on file type. +- main/java — This package enables AI-driven metadata generation for source files in Maven plugin workflows by dynamically creating field definitions based on file type using local LLMs or mock providers. +- main — This package enables AI-driven metadata generation for source files in Maven plugin workflows by dynamically creating field definitions based on file type using local LLMs or mock providers. +- . — This package enables AI-driven metadata generation for source files in Maven plugin workflows by dynamically creating field definitions based on file type using local LLMs or mock providers. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..7e60f10 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,50 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:13:14Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI prompt and model keys for field generation by file extension in Maven plugin + +#### Purpose +- Defines mapping between prompt templates and AI models for field generation +- Enables selective application based on source file extensions + +#### Type +class @ToString public mutable JavaBean with setters; key generics: none; notable annotations: @ToString, @Nullable + +#### Input +- promptKey (String): key to prompt template +- aiDefinitionKey (String): key to AI model definition +- fileExtensions (List): optional list of file extensions to match + +#### Output +- promptKey (String) – retrieved from config +- aiDefinitionKey (String) – retrieved from config +- fileExtensions (List) – returned as unmodifiable view or null + +#### Core logic +- Stores prompt and model keys for AI field generation +- Uses file extensions to filter which files trigger generation +- Defensively copies fileExtensions list on set to prevent mutation +- Returns immutable view of fileExtensions when queried + +#### Public API +- getPromptKey() -> String: returns prompt template key +- setPromptKey(String) -> void: sets prompt template key +- getAiDefinitionKey() -> String: returns AI model definition key +- setAiDefinitionKey(String) -> void: sets AI model definition key +- getFileExtensions() -> List (nullable): returns file extensions list or null +- setFileExtensions(Collection) -> void: sets file extensions; null/empty makes it fallback + +#### Dependencies +AiModelDefinition, AiPromptDefinition, AiFieldGenerationSelector + +#### Exceptions / Errors +None explicitly thrown; null handling via @Nullable and defensive copying + +#### Concurrency +Immutable output view; no thread-safety guarantees; mutable state only in instance fields diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..51668f8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,44 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:14:27Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects AI field generation config by file extension to enable language-specific prompts + +#### Purpose +- Chooses AI configuration based on file extension match +- Provides fallback for files without matching extensions + +#### Type +class @ToString final public in net.ladenthin.maven.llamacpp.aiindex.config + +#### Input +- configs: Iterable (in declaration order, null entries skipped) +- fileName: String (e.g. "Foo.java") + +#### Output +- AiFieldGenerationConfig (first match by extension, fallback if none, null if no config matches) + +#### Core logic +- Iterates over configs in order +- Skips null entries +- For each config, checks if its extensions list is empty: if so, records it as fallback +- Otherwise, checks if file name ends with any extension in the list; returns first match +- Returns fallback if no extension match found and fallback was set +- Returns null if no config matches and no fallback exists + +#### Public API +selectForFileName(Iterable, String) -> AiFieldGenerationConfig: selects config by file extension or fallback + +#### Dependencies +AiFieldGenerationConfig + +#### Exceptions / Errors +None thrown; handles null inputs gracefully via null checks + +#### Concurrency +Immutable state; thread-safe due to final class and no shared mutable state diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..a41016b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,70 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:15:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines configuration parameters for AI generation steps in a Maven plugin using llama.cpp, including model settings, sampling behavior, and input/output limits. + +#### Purpose +- Configures AI generation parameters such as temperature, max tokens, context size, and retry policies. +- Manages prompt trimming, stop sequences, and model-specific thinking modes. + +#### Type +class AiGenerationConfig + modifiers; extends/implements: none; generics: none; annotations: @ToString, @Nullable, @SuppressWarnings("NullAway.Init", "initialization.fields.uninitialized") + +#### Input +- Model path (String), context size (int), output tokens (int), temperature (float), threads (int), chars per token (int), max input chars (int), retry settings (int/float), stop strings (List) + +#### Output +- Configured generation parameters via getters; mutable state updated through setters; unmodifiable stop string list returned + +#### Core logic +- Holds all AI inference configuration fields with defaults. +- Automatically calculates maxInputChars based on context size, output tokens, chars per token, and safety margin when charsPerToken > 0. +- Uses Lombok's @ToString for readable instance representation. +- Provides immutability for stopStrings via unmodifiableList wrapper. + +#### Public API +getModelPath() -> String: returns model path +setModelPath(String) -> void: sets model path +getContextSize() -> int: returns context size +setContextSize(int) -> void: sets context size +getMaxOutputTokens() -> int: returns max output tokens +setMaxOutputTokens(int) -> void: sets max output tokens +getTemperature() -> float: returns sampling temperature +setTemperature(float) -> void: sets sampling temperature +getThreads() -> int: returns thread count +setThreads(int) -> void: sets thread count +getCharsPerToken() -> int: returns chars per token +setCharsPerToken(int) -> void: sets chars per token +getMaxInputChars() -> int: returns max input characters +setMaxInputChars(int) -> void: sets max input characters +isWarnOnTrim() -> boolean: checks trim warning setting +setWarnOnTrim(boolean) -> void: enables/disables trim warnings +getMaxRetries() -> int: returns retry count +setMaxRetries(int) -> void: sets retry count +getRetryTemperatureIncrement() -> float: returns retry temperature increment +setRetryTemperatureIncrement(float) -> void: sets retry temperature increment +getTopP() -> float: returns top-p value +setTopP(float) -> void: sets top-p value +getTopK() -> int: returns top-k limit +setTopK(int) -> void: sets top-k limit +getRepeatPenalty() -> float: returns repetition penalty +setRepeatPenalty(float) -> void: sets repetition penalty +isChatTemplateEnableThinking() -> boolean: checks thinking mode +setChatTemplateEnableThinking(boolean) -> void: enables/disables thinking mode +getStopStrings() -> List: returns stop strings (null-safe) +setStopStrings(List) -> void: sets or clears stop strings + +#### Dependencies +net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No exceptions thrown; null handling via @Nullable and defensive checks in setters. + +#### Concurrency +- Immutable stopStrings list; all fields are mutable but no concurrent access or synchronization shown. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..c6cd842 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,40 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:17:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines whether AI generates per-file or per-package summaries + +#### Purpose +- Specifies scope of AI-generated code summaries +- Distinguishes between file-level and package-level generation + +#### Type +enum public AiGenerationKind + +#### Input +none + +#### Output +none + +#### Core logic +- Provides two distinct values for generation scope: FILE_SUMMARY and PACKAGE_SUMMARY +- No computation or state transformation; purely a domain enum + +#### Public API +FILE_SUMMARY() -> void: Represents per-file AI summary generation +PACKAGE_SUMMARY() -> void: Represents per-package AI summary generation + +#### Dependencies +none + +#### Exceptions / Errors +none + +#### Concurrency +none diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..af95096 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,55 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:18:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines AI model configurations for reuse across field-generation tasks in a Maven plugin + +#### Purpose +- Stores AI model parameters with a unique key for lookup and reuse +- Enables consistent, configurable model behavior via defaults inherited from AiGenerationConfig + +#### Type +class public @ToString + +#### Input +- None (initialized via constructor or setters) + +#### Output +- Key, model path, and all model-specific parameters (context size, temperature, threads, etc.) +- Unmodifiable stop strings list on access + +#### Core logic +- Provides default values from AiGenerationConfig for all numeric and boolean fields +- Ensures immutability of stopStrings via unmodifiableList wrapper +- Supports dynamic configuration through public setters with defaults applied + +#### Public API +setKey(String) → void: sets unique lookup key +setModelPath(String) → void: sets GGUF model file path +setContextSize(int) → void: sets context window size in tokens +setMaxOutputTokens(int) → void: sets max output tokens per call +setTemperature(float) → void: sets base sampling temperature +setThreads(int) → void: sets CPU threads for inference +setCharsPerToken(int) → void: configures chars per token for input trimming +setWarnOnTrim(boolean) → void: enables warnings on input trim +setMaxRetries(int) → void: sets max retry attempts on empty responses +setRetryTemperatureIncrement(float) → void: increments temperature on retries +setTopP(float) → void: sets nucleus sampling threshold +setTopK(int) → void: sets top-k token sampling limit +setRepeatPenalty(float) → void: applies repetition penalty +setChatTemplateEnableThinking(boolean) → void: enables/disable thinking mode in chat templates +setStopStrings(Collection) → void: sets generation stop strings + +#### Dependencies +AiGenerationConfig + +#### Exceptions / Errors +- None explicitly thrown; null handling via @Nullable and defensive checks on stopStrings + +#### Concurrency +- Immutable fields except for mutable stopStrings (thread-safe if accessed via immutable views) diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..6aeb081 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,43 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:19:56Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to generate configuration objects in the AI modeling domain + +#### Purpose +- Acts as a lookup table for converting AI model definitions into runtime generation configurations +- Enforces validation of non-null keys during initialization to prevent silent configuration failures + +#### Type +class final public @ToString + implements none; extends none; generics: Map; notable annotations: @ToString + +#### Input +- List definitions (may be null or empty) + +#### Output +- AiGenerationConfig object for a given key; throws IllegalArgumentException on missing key + +#### Core logic +- Initializes map with presized capacity to avoid rehashing during bulk insertion +- Validates each definition's key at insertion, throwing NullPointerException if null +- Converts each AiModelDefinition into an AiGenerationConfig via field copying +- Returns config on lookup; throws IllegalArgumentException if key not found + +#### Public API +getConfig(String key) -> AiGenerationConfig: returns generation config by key; throws if missing +toConfig(AiModelDefinition) -> AiGenerationConfig: converts definition to config (private) + +#### Dependencies +AiModelDefinition, AiGenerationConfig, Java8CompatibilityHelper + +#### Exceptions / Errors +- NullPointerException if any entry has null key (with index and entry details) +- IllegalArgumentException if lookup key not found in map + +#### Concurrency +Immutable state; no shared mutable state; thread-safe via final fields and immutable config objects diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..64b3275 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:25:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> This package configures and orchestrates AI-driven field generation and model settings for Maven plugins using llama.cpp, enabling language-specific prompts and per-file or per-package summarization. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) +- Supports both per-file and per-package AI summary scopes + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used for AI prompt generation and inference + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..7faa618 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,63 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:28:36Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> This package enables AI-driven source code field generation and summarization in Maven plugins using llama.cpp, configuring model parameters and orchestrating local LLM inference through pluggable providers. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) +- Supports both per-file and per-package AI summary scopes + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..9ab9f16 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,42 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:20:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Extracts the final AI model answer from raw completion text by stripping internal reasoning blocks + +#### Purpose +- Strips internal model thinking blocks to isolate the final answer +- Validates token budget exhaustion in chain-of-thought reasoning + +#### Type +class @ToString public non-final + +#### Input +- response: raw model completion text (may be null) + +#### Output +- cleaned, trimmed final answer text (never null) + +#### Core logic +- If input is null, return empty string +- Find position of closing thinking block marker +- If found, return text after the marker (trimmed) +- If start marker present but end marker missing, throw IOException with actionable message +- Otherwise return trimmed input + +#### Public API +parseCompletion(String response) -> String: Extracts final answer from raw model output + +#### Dependencies +THINKING_BLOCK_START_MARKER, THINKING_BLOCK_END_MARKER + +#### Exceptions / Errors +- IOException if thinking block start found but end not found (with diagnostic message) + +#### Concurrency +none diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..0af5856 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,41 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:21:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides text generation for AI requests via pluggable backend implementations + +#### Purpose +- Enables local or mock-based AI text generation from source code prompts +- Supports temperature override during retries to avoid early EOS failures + +#### Type +interface AiGenerationProvider extends AutoCloseable + +#### Input +- AiGenerationRequest (prompt key, source file, source text, current header) + +#### Output +- String (generated text; never null, may be blank) + +#### Core logic +- Generates text using default sampling parameters +- Overrides temperature per-call to break retry loops that produce empty responses +- Delegates temperature override to default implementation if not implemented + +#### Public API +generate(AiGenerationRequest) -> String: Generate text with default settings +generate(AiGenerationRequest, float) -> String: Generate text with overridden temperature + +#### Dependencies +AiGenerationRequest + +#### Exceptions / Errors +- IOException on provider failure; no null inputs allowed + +#### Concurrency +none diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..01a0eb0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,43 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:21:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an AI generation provider based on a name + +#### Purpose +- Creates and returns an AI generation provider instance by provider name +- Falls back to mock provider if name is missing or invalid + +#### Type +class public net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory + +#### Input +- providerName (String): key for provider selection; defaults to "mock" if null/blank +- llamaConfig (LlamaCppJniConfig): config for llama.cpp JNI provider +- promptSupport (AiPromptSupport): prompt lookup support for providers needing it + +#### Output +- AiGenerationProvider: a newly instantiated provider instance + +#### Core logic +- Returns mock provider if providerName is null or blank +- Uses switch to select provider based on providerName +- Returns LlamaCppJniAiGenerationProvider for "llamacpp-jni" +- Throws IllegalArgumentException for unrecognized provider names + +#### Public API +create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider: instantiates provider by name + +#### Dependencies +LlamaCppJniConfig, AiPromptSupport, MockAiGenerationProvider, LlamaCppJniAiGenerationProvider + +#### Exceptions / Errors +- IllegalArgumentException when providerName is unrecognized + +#### Concurrency +none diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..89c11fd --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,48 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:22:33Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Enables local AI text generation using GGUF models via llama.cpp JNI bindings in a Maven-based indexing pipeline. + +#### Purpose +- Provides lazy-loaded, local AI text generation using llama.cpp JNI bindings. +- Integrates prompt rendering and completion parsing for structured AI response handling. + +#### Type +class final LlamaCppJniAiGenerationProvider implements AiGenerationProvider, AutoCloseable + +#### Input +- LlamaCppJniConfig (model path, context size, threads, etc.) +- AiPromptSupport (for building prompts from request) + +#### Output +- String (generated AI response text) +- Native model handle closed on shutdown + +#### Core logic +- Lazily loads GGUF model on first generate() call to minimize startup cost. +- Constructs inference parameters from config and request with temperature, stop strings, top-p/k, and context settings. +- Builds prompt chain using user message and system message (optional). +- Invokes native chat completion via model().chatCompleteText(). +- Parses output using completion parser. + +#### Public API +generate(AiGenerationRequest) -> String: generates response from request +generate(AiGenerationRequest, float) -> String: generates with override temperature +close() -> void: releases native model resources + +#### Dependencies +LlamaModel, InferenceParameters, ModelParameters, Pair, AiPromptSupport, AiCompletionParser, LlamaCppJniConfig + +#### Exceptions / Errors +- IOException on model loading or native call failure +- Null handling via requireNonNull on config and promptSupport + +#### Concurrency +- Immutable inference parameters; thread-safe only if model access is serialized (not explicitly guarded) +- Model loaded lazily; concurrent calls may result in duplicated model creation unless synchronized — not observed here diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..a01f47e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,75 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:23:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines immutable configuration for llama.cpp JNI-based AI model inference + +#### Purpose +- Configures runtime parameters for llama.cpp JNI-based LLM inference +- Encapsulates model, library, and generation settings with value semantics + +#### Type +class final public @ConvertToRecord @ToString @EqualsAndHashCode + +#### Input +- libraryPath (String): native library path or null +- modelPath (String): GGUF model file path +- contextSize (int): context window size in tokens +- maxOutputTokens (int): max output tokens per call +- temperature (float): sampling temperature +- threads (int): CPU thread count +- topP (float): nucleus-sampling threshold +- topK (int): top-k sampling limit +- repeatPenalty (float): repetition penalty +- chatTemplateEnableThinking (boolean): enables thinking mode in chat templates +- stopStrings (List): list of stop strings; null treated as empty + +#### Output +- libraryPath() → String +- modelPath() → String +- contextSize() → int +- maxOutputTokens() → int +- temperature() → float +- threads() → int +- topP() → float +- topK() → int +- repeatPenalty() → float +- chatTemplateEnableThinking() → boolean +- stopStrings() → List (unmodifiable) + +#### Core logic +- Validates modelPath at construction +- Null stopStrings is converted to empty list +- All fields are final and immutable +- Lombok generates equals, hashCode, toString with bit-level float precision + +#### Public API +- libraryPath() → String: native library path +- modelPath() → String: GGUF model file path +- contextSize() → int: context window size +- maxOutputTokens() → int: max output tokens +- temperature() → float: sampling temperature +- threads() → int: CPU thread count +- topP() → float: nucleus-sampling threshold +- topK() → int: top-k limit +- repeatPenalty() → float: repetition penalty +- chatTemplateEnableThinking() → boolean: enables thinking mode +- stopStrings() → List: unmodifiable stop strings + +#### Dependencies +- java.util.Collections +- java.util.Objects +- lombok.EqualsAndHashCode +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +- Throws IllegalArgumentException if modelPath is null + +#### Concurrency +- Immutable; thread-safe by design due to final fields and no mutable state diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..dbc9495 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:24:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides deterministic mock summaries for AI generation testing. + +#### Purpose +- Implements a testable AI generation provider that returns fixed, predictable outputs. +- Used to simulate AI response behavior during unit and integration tests. + +#### Type +class MockAiGenerationProvider implements AiGenerationProvider + +#### Input +- AiGenerationRequest request (sourceFile()) + +#### Output +- String (mock summary of the source file) + +#### Core logic +- Extracts source file name from request. +- Constructs a deterministic mock summary using the file name. +- Returns the generated summary string. + +#### Public API +generate(AiGenerationRequest request) -> String: Generates mock summary from input file name + +#### Dependencies +AiGenerationRequest + +#### Exceptions / Errors +- Throws IOException on generation failure (per contract) + +#### Concurrency +- Not applicable (stateless, single-threaded operation) diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..485ceeb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,49 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T06:27:08Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Enables local AI text generation and response parsing in a Maven-based indexing pipeline using llama.cpp JNI bindings or mock providers + +#### Purpose +- Facilitates AI-driven source code summarization via pluggable generation backends +- Supports both real-time LLM inference (via llama.cpp) and deterministic testing (via mock provider) + +#### Responsibilities +- AI generation orchestration through provider factory and interface abstraction +- Local model execution via llama.cpp JNI bindings with configurable inference parameters +- Parsing of raw model outputs to extract final answers from reasoning chains +- Test simulation through a mock provider with predictable, deterministic responses + +#### Key units +- `AiGenerationProvider`: abstracts AI text generation across backends +- `LlamaCppJniAiGenerationProvider`: implements local GGUF model inference via llama.cpp JNI +- `AiCompletionParser`: extracts final answer from raw completion text containing reasoning blocks +- `LlamaCppJniConfig`: immutable configuration for model and inference settings +- `AiGenerationProviderFactory`: selects and instantiates provider based on name + +#### Data flow +AiGenerationRequest → AiGenerationProviderFactory (selects provider) → Provider.generate() → LlamaCppJniAiGenerationProvider (loads model, runs inference) → Native chat completion → AiCompletionParser (strips thinking blocks) → Final answer output + +#### Dependencies +- `LlamaCppJniConfig` for model and generation parameters +- `AiPromptSupport` to build prompts from source context +- `MockAiGenerationProvider` as fallback/test provider +- `AiCompletionParser` to validate and clean response outputs + +#### Cross-cutting +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..3f87dab --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:30:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..546acae --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:31:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..763aff3 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:33:10Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..44afc75 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/net/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:34:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/package.ai.md new file mode 100644 index 0000000..2b41825 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/java/package.ai.md @@ -0,0 +1,61 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:36:04Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/package.ai.md new file mode 100644 index 0000000..7d5d161 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/main/package.ai.md @@ -0,0 +1,61 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:37:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/package.ai.md new file mode 100644 index 0000000..3e17695 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/package.ai.md @@ -0,0 +1,61 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:38:58Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. + +#### Purpose +- Defines AI configuration for field generation based on file extensions +- Manages model parameters and generation behavior (temperature, context size, retries) + +#### Responsibilities +- Field generation configuration via file extension matching +- Model-specific AI parameter definitions and lookup +- Generation parameter tuning and validation +- Scope selection for AI summaries (file-level vs package-level) +- AI text generation orchestration through pluggable backends +- Local LLM inference via llama.cpp JNI bindings +- Parsing of model outputs to extract final answers from reasoning chains +- Test simulation using deterministic mock providers + +#### Key units +- **AiFieldGenerationConfig**: maps prompt and model keys to file extensions for selective field generation +- **AiFieldGenerationSelector**: selects the appropriate config by file extension, with fallback support +- **AiGenerationConfig**: holds core AI inference settings like temperature, max tokens, stop strings +- **AiModelDefinition**: stores reusable model configurations with defaults from AiGenerationConfig +- **AiModelDefinitionSupport**: resolves model definitions by key to generate runtime AI configs +- **AiGenerationProvider**: abstracts AI text generation across backends +- **LlamaCppJniAiGenerationProvider**: implements local GGUF model inference via llama.cpp JNI +- **AiCompletionParser**: extracts final answer from raw completion text containing reasoning blocks +- **LlamaCppJniConfig**: immutable configuration for model and inference settings +- **AiGenerationProviderFactory**: selects and instantiates provider based on name + +#### Data flow +Input file name → matched against file extensions in AiFieldGenerationConfig → selected via AiFieldGenerationSelector → resolved into AiGenerationConfig via AiModelDefinitionSupport → used to build prompt (via AiPromptSupport) → passed to AiGenerationProviderFactory → provider selected and executed → LlamaCppJniAiGenerationProvider runs inference → raw output processed by AiCompletionParser → final answer extracted and returned + +#### Dependencies +- AiFieldGenerationSelector depends on AiFieldGenerationConfig +- AiGenerationConfig depends on AiModelDefinition and Llama model parameters +- AiModelDefinitionSupport uses AiModelDefinition and AiGenerationConfig for conversion +- LlamaCppJniAiGenerationProvider depends on LlamaCppJniConfig and AiPromptSupport +- AiCompletionParser depends on raw output and prompt context +- AiGenerationProviderFactory selects from AiGenerationProvider and MockAiGenerationProvider +- Cross-package: net.ladenthin.llama.parameters.ModelParameters, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Immutable stop strings via unmodifiableList wrappers +- Null safety enforced with @Nullable and defensive checks in setters +- Immutability of output views (fileExtensions, stopStrings) +- Final classes (AiFieldGenerationSelector, AiModelDefinitionSupport) ensure thread safety +- Uniform use of @ToString for readable instance representation across classes +- Immutable configuration via record-like design (LlamaCppJniConfig) +- Shared error handling: IOException for provider failures or parsing issues +- Deterministic mock behavior for testing +- Temperature override during retries to avoid empty responses +- Thread safety in immutable units; model loading is lazy but not synchronized, risking concurrent access issues diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/project.ai.md new file mode 100644 index 0000000..5a60a69 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3-4b-2507__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: C0C95CB3 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T06:40:27Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project implements an AI-driven source code indexing pipeline for Maven plugins, centered around local Llama.cpp inference for field generation and code summarization. Core functionality is organized into a provider layer that handles text generation and response parsing via llama.cpp JNI bindings or mock implementations, enabling pluggable backends. Configuration and orchestration of model settings, language-specific prompts, and per-file or per-package summarization are managed through the AI index configuration subsystem, which integrates with the main execution flow to drive AI-driven field creation. Together, these components form a modular, extensible pipeline for AI-powered source code analysis within Maven-based builds. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — This package configures and orchestrates AI-driven field generation and model settings for Maven plugins using llama.cpp, enabling language-specific prompts and per-file or per-package summarization. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package enables AI-driven source code field generation and summarization in Maven plugins using llama.cpp, configuring model parameters and orchestrating local LLM inference through pluggable providers. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Enables local AI text generation and response parsing in a Maven-based indexing pipeline using llama.cpp JNI bindings or mock providers +- main/java/net/ladenthin/maven/llamacpp — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. +- main/java/net/ladenthin/maven — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. +- main/java/net/ladenthin — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. +- main/java/net — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. +- main/java — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. +- main — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. +- . — Enables AI-driven field generation and source code summarization in Maven plugins using local Llama.cpp inference with configurable model parameters and pluggable generation backends. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..5879e1a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,59 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:05:26Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI field generation steps by linking prompt templates to model definitions and optional file extension filters. + +#### Purpose +* Defines a mutable POJO for mapping prompt keys to AI model definitions within Maven plugin configuration. +* Selects field-generation operations based on source file extensions or as a fallback for all files. + +#### Type +* Class: `AiFieldGenerationConfig` +* Annotations: `@ToString`, `@SuppressWarnings("NullAway.Init", "initialization.fields.uninitialized")` +* Fields: `private String promptKey`, `private String aiDefinitionKey`, `private @Nullable List fileExtensions` + +#### Input +* `String promptKey`: Key referencing an `AiPromptDefinition`. +* `String aiDefinitionKey`: Key referencing an `AiModelDefinition` for model parameters. +* `Collection fileExtensions`: Optional list of file extensions (e.g., `.java`) to target. + +#### Output +* `String promptKey`: Returns the configured prompt template key. +* `String aiDefinitionKey`: Returns the configured AI model definition key. +* `List fileExtensions`: Returns an unmodifiable view or null for extension filtering. +* `void setFileExtensions(Collection)`: Mutates internal list with defensive copy. + +#### Core logic +* Associates a prompt template key with an AI model definition for single field-generation steps. +* Applies selection logic to files based on matching extensions or acts as a global fallback. +* Ensures immutability of returned lists via `Collections.unmodifiableList` and defensive copying during mutation. + +#### Public API +* `getPromptKey() -> String`: Retrieves prompt template identifier. +* `setPromptKey(String) -> void`: Updates prompt template identifier. +* `getAiDefinitionKey() -> String`: Retrieves AI model definition identifier. +* `setAiDefinitionKey(String) -> void`: Updates AI model definition identifier. +* `getFileExtensions() -> List`: Retrieves file extension filter list. +* `setFileExtensions(Collection) -> void`: Sets file extension filter list with safety copy. + +#### Dependencies +* `net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig` +* `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition` +* `net.ladenthin.maven.llamacpp.aiindex.AiModelDefinition` +* `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List` +* `lombok.ToString` +* `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +* Handles null inputs gracefully in `setFileExtensions` by allowing null to become a fallback. +* No explicit exceptions thrown; relies on caller to provide valid keys and collection types. + +#### Concurrency +* Thread-safe for read operations due to return of unmodifiable views or null. +* Mutable state in fields requires external synchronization if accessed concurrently by plugin framework. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..dc1dce6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,46 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:07:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the appropriate AI field generation configuration for a source file based on file extension matching rules. + +#### Purpose +- Applies language-specific or generic AI prompts to source files by matching extensions. +- Enables dynamic prompt variation per file while keeping a single loaded AI model active. + +#### Type +class; final; extends Object; implements none; annotated with @ToString; key generics none; type bounds none; notable annotations @lombok.ToString, @jspecify.annotations.Nullable. + +#### Input +- Iterable configs: list of configured field generation rules. +- String fileName: the name of the source file being processed. +- Injected dependencies none; consumed fields none; read resources none. + +#### Output +- AiFieldGenerationConfig: the selected configuration instance matching the file extension or fallback rule. +- Produced state none; mutated fields none; written resources none; side effects none. + +#### Core logic +- Iterates through configured field generation configs in declaration order. +- Skips null entries and identifies extension-agnostic fallbacks (null or empty extension lists). +- Matches the input fileName against specific file extensions defined in each config using endsWith. +- Returns the first matching config immediately upon finding a match. +- Returns the last identified fallback config if no specific extension matches. +- Returns null if no config matches and no fallback is configured. + +#### Public API +- selectForFileName(Iterable configs, String fileName) -> @Nullable AiFieldGenerationConfig: selects matching config by extension. + +#### Dependencies +AiFieldGenerationConfig, Iterable, List, String, AiFieldGenerationSelector. + +#### Exceptions / Errors +No exceptions thrown; null input handled gracefully via skip logic and return value. + +#### Concurrency +Immutability ensures thread-safety; no synchronization required as stateless selection logic. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..bef740f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,82 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:08:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI generation parameters including model paths, sampling rates, and retry policies for Llama.cpp inference. + +#### Purpose +* Holds mutable configuration for AI model inference steps including context size, temperature, and token limits. +* Provides JavaBean setters for Maven plugin injection and log diagnostics via Lombok. + +#### Type +* `public class AiGenerationConfig` with `@ToString` annotation. +* Contains 25 default constant fields (`DEFAULT_*`) and 16 mutable instance fields. +* Uses `List` for stop strings without custom collection management. + +#### Input +* Constructor: None (uses defaults). +* Setters: Accepts `String` (model path), `int` (context size, max output tokens, threads, chars per token, max input chars, retries, top k), `float` (temperature, retry increment, top p, repeat penalty), `boolean` (warn on trim, chat template thinking), and `List` (stop strings). + +#### Output +* Returns: `String`, `int`, `float`, `boolean`, or `List` via getter methods. +* State: Mutates internal fields directly without validation or side effects. +* Resources: None produced or consumed within this class scope. + +#### Core logic +* Initializes all instance fields with corresponding static default constants on construction. +* Allows external configuration via setter methods for model path, sampling parameters, and retry policies. +* Calculates maximum input characters dynamically if `charsPerToken` is non-zero using a safety margin formula. +* Returns unmodifiable list views of stop strings to prevent runtime modification. + +#### Public API +* `getModelPath()` -> String (returns model file path) +* `setModelPath(String)` -> void (sets GGUF model file path) +* `getContextSize()` -> int (returns context window size in tokens) +* `setContextSize(int)` -> void (sets context window size in tokens) +* `getMaxOutputTokens()` -> int (returns max output tokens per call) +* `setMaxOutputTokens(int)` -> void (sets max output tokens per call) +* `getTemperature()` -> float (returns sampling temperature value) +* `setTemperature(float)` -> void (sets sampling temperature value) +* `getThreads()` -> int (returns number of CPU threads for inference) +* `setThreads(int)` -> void (sets number of CPU threads for inference) +* `getCharsPerToken()` -> int (returns chars per token ratio) +* `setCharsPerToken(int)` -> void (sets chars per token ratio) +* `getMaxInputChars()` -> int (returns max input characters limit) +* `setMaxInputChars(int)` -> void (sets max input characters limit) +* `isWarnOnTrim()` -> boolean (returns trim warning enabled status) +* `setWarnOnTrim(boolean)` -> void (sets trim warning enabled status) +* `getMaxRetries()` -> int (returns max retry attempts count) +* `setMaxRetries(int)` -> void (sets max retry attempts count) +* `getRetryTemperatureIncrement()` -> float (returns temp increment per retry) +* `setRetryTemperatureIncrement(float)` -> void (sets temp increment per retry) +* `getTopP()` -> float (returns top-p sampling threshold) +* `setTopP(float)` -> void (sets top-p sampling threshold) +* `getTopK()` -> int (returns top-k sampling limit) +* `setTopK(int)` -> void (sets top-k sampling limit) +* `getRepeatPenalty()` -> float (returns repetition penalty value) +* `setRepeatPenalty(float)` -> void (sets repetition penalty value) +* `isChatTemplateEnableThinking()` -> boolean (returns thinking mode enabled status) +* `setChatTemplateEnableThinking(boolean)` -> void (sets chat-template thinking mode) +* `getStopStrings()` -> List (returns unmodifiable stop strings list) +* `setStopStrings(List)` -> void (sets list of stop strings) + +#### Dependencies +* `java.util.ArrayList`, `java.util.Collections`, `java.util.List` +* `lombok.ToString` +* `org.jspecify.annotations.Nullable` +* `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig` + +#### Exceptions / Errors +* No explicit exceptions thrown by methods. +* Handles null input in `setStopStrings` by resetting to empty list. +* Allows null model path return via getter if not set. + +#### Concurrency +* Not thread-safe; fields are mutable and accessed via setters. +* Designed for single-instance use managed by Maven plugin framework. +* No synchronization or immutability guarantees provided. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..83d5e28 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,33 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:11:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines enumeration values to distinguish between AI generation operations on individual source files versus entire packages. + +#### Purpose +- Identifies single-file summary generation steps. +- Identifies package-aggregate summary generation steps. + +#### Type +Enum with no modifiers. No extends or implements. No annotations. + +#### Input +None. + +#### Output +None. + +#### Core logic +None. Enum values are constant identifiers for generation scope. + +#### Public API +`FILE_SUMMARY` -> constant (single-file scope) +`PACKAGE_SUMMARY` -> constant (package-aggregate scope) + +#### Dependencies +net.ladenthin.maven.llamacpp.aiindex.config diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..624c8b0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,88 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:12:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures LLM inference parameters for Maven plugin field generation by defining a reusable POJO for model paths, context sizes, and sampling algorithms. + +#### Purpose +* Defines a single-source configuration object for AI model parameters used in Java-based field generation within Maven plugins. +* Supports reusability across multiple generation goals via a unique lookup key mechanism. + +#### Type +* Class: `public class AiModelDefinition` +* Annotations: `@ToString`, `@SuppressWarnings` +* Fields: Mutable JavaBean with getters/setters; uses `java.util.List` (via `ArrayList`/`Collections`) for stop strings. + +#### Input +* Constructor: None (default constructor applies). +* Parameters: `String key`, `String modelPath`, `int contextSize`, `int maxOutputTokens`, `float temperature`, `int threads`, `int charsPerToken`, `boolean warnOnTrim`, `int maxRetries`, `float retryTemperatureIncrement`, `float topP`, `int topK`, `float repeatPenalty`, `boolean chatTemplateEnableThinking`, `Collection stopStrings`. + +#### Output +* Returns: String (key, modelPath), Int (contextSize, maxOutputTokens, threads, charsPerToken, maxRetries, topK), Float (temperature, retryTemperatureIncrement, topP, repeatPenalty), Boolean (warnOnTrim, chatTemplateEnableThinking), List (stopStrings). +* State: Mutable fields updated via setters to configure LLM behavior. + +#### Core logic +* Initializes numeric fields with defaults from `AiGenerationConfig` unless explicitly overridden. +* Stores a unique string key for mapping between field-generation configs and this model definition. +* Tracks the file path to the GGUF model binary for inference execution. +* Configures context window size to limit input token consumption. +* Sets sampling parameters (temperature, top-p, top-k) to control generation randomness and diversity. +* Defines retry logic thresholds including maximum attempts and temperature increments per failure. +* Calculates automatic max input character limits based on `charsPerToken` ratio for source code trimming. +* Manages stop sequences to terminate generation upon specific string patterns. + +#### Public API +* `getKey() -> String`: Retrieves unique model identifier. +* `setKey(String) -> void`: Assigns unique model identifier. +* `getModelPath() -> String`: Retrieves GGUF model file path. +* `setModelPath(String) -> void`: Assigns GGUF model file path. +* `getContextSize() -> int`: Retrieves context window size in tokens. +* `setContextSize(int) -> void`: Sets context window size in tokens. +* `getMaxOutputTokens() -> int`: Retrieves max output token limit. +* `setMaxOutputTokens(int) -> void`: Sets max output token limit. +* `getTemperature() -> float`: Retrieves base sampling temperature. +* `setTemperature(float) -> void`: Sets base sampling temperature. +* `getThreads() -> int`: Retrieves CPU thread count for inference. +* `setThreads(int) -> void`: Sets CPU thread count for inference. +* `getCharsPerToken() -> int`: Retrieves chars-per-token ratio for input calculation. +* `setCharsPerToken(int) -> void`: Sets chars-per-token ratio for input calculation. +* `isWarnOnTrim() -> boolean`: Checks warning flag on source trimming. +* `setWarnOnTrim(boolean) -> void`: Enables/disables warning on source trimming. +* `getMaxRetries() -> int`: Retrieves max retry attempt count. +* `setMaxRetries(int) -> void`: Sets max retry attempt count. +* `getRetryTemperatureIncrement() -> float`: Retrieves temp increment per retry. +* `setRetryTemperatureIncrement(float) -> void`: Sets temp increment per retry. +* `getTopP() -> float`: Retrieves nucleus sampling threshold. +* `setTopP(float) -> void`: Sets nucleus sampling threshold. +* `getTopK() -> int`: Retrieves top-k sampling limit. +* `setTopK(int) -> void`: Sets top-k sampling limit. +* `getRepeatPenalty() -> float`: Retrieves repetition penalty factor. +* `setRepeatPenalty(float) -> void`: Sets repetition penalty factor. +* `isChatTemplateEnableThinking() -> boolean`: Checks chat template thinking mode. +* `setChatTemplateEnableThinking(boolean) -> void`: Toggles chat template thinking mode. +* `getStopStrings() -> List`: Retrieves list of generation stop strings. +* `setStopStrings(Collection) -> void`: Sets list of generation stop strings. + +#### Dependencies +* `java.util.ArrayList` +* `java.util.Collection` +* `java.util.Collections` +* `java.util.List` +* `lombok.ToString` +* `org.jspecify.annotations.Nullable` +* `AiGenerationConfig` +* `net.ladenthin.llama.parameters.ModelParameters` + +#### Exceptions / Errors +* Throws: None declared. +* Null Handling: Allows null for key, modelPath, stopStrings; returns unmodifiable lists for safe access. +* Error Conditions: Relies on defaults from `AiGenerationConfig` if fields are unset. + +#### Concurrency +* Thread Safety: Not explicitly synchronized; assumes configuration is set before use by inference engine. +* Immutability: Mutable state via setters; `getStopStrings()` returns unmodifiable view to prevent runtime mutation. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..ab653bc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,47 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:15:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to generate ready-to-use configuration objects for plugin goals. + +#### Purpose +* Converts `AiModelDefinition` entries from Maven POM configuration into `AiGenerationConfig` instances. +* Enforces strict contract validation on definition keys to fail fast at build time. + +#### Type +`public final class AiModelDefinitionSupport` extends `Object`. Annotations: `@ToString`. Fields: `private final Map configs`. + +#### Input +* Constructor parameter: `List definitions` (may be null or empty). +* Internal state: Presized `HashMap` populated from input list. + +#### Output +* Method return: `AiGenerationConfig` object for a given key via `getConfig()`. +* Side effects: Mutates internal `configs` map during construction; creates new config objects in `toConfig()`. + +#### Core logic +* Validates every `AiModelDefinition` entry has a non-null `key`, throwing `NullPointerException` with index details on failure. +* Presizes internal HashMap capacity to optimize insertion performance. +* Iterates definitions, calls `toConfig()` for each, storing result in key-value map. +* `toConfig()` clones all parameters (model path, context size, tokens, temperature, etc.) into a new `AiGenerationConfig`. +* Lookup retrieves config via key; throws `IllegalArgumentException` if key missing to ensure eager error detection. + +#### Public API +* `AiModelDefinitionSupport(List) -> void`: Constructs lookup table from definitions. +* `getConfig(String) -> AiGenerationConfig`: Retrieves configuration by definition key. + +#### Dependencies +`java.util.HashMap`, `java.util.List`, `java.util.Map`, `java.util.Objects`, `lombok.ToString`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`. Referenced types: `AiModelDefinition`, `AiGenerationConfig`. + +#### Exceptions / Errors +* Throws `NullPointerException` if any definition key is null during construction. +* Throws `IllegalArgumentException` if requested key is not found in the map. +* Null definitions list or empty list handled gracefully (initialized with zero capacity). + +#### Concurrency +* Thread-safe via immutable internal state; `configs` map populated once in constructor and never modified after creation. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..18ecd04 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,51 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:23:44Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Provides Llama.cpp inference configuration and field generation selection logic for Maven plugins, mapping file extensions to AI models while managing context windows, sampling parameters, and retry policies. + +#### Purpose +* Defines POJOs for configuring AI model paths, sampling algorithms (temperature, top-p), and inference limits for Java source code processing. +* Implements a selector mechanism to dynamically assign AI generation rules based on source file extensions or fallback to global defaults. + +#### Responsibilities +* **AI Generation Configuration**: Manages mutable settings for context size, token limits, threading, and sampling parameters (temperature, top-p, top-k) within `AiGenerationConfig` and `AiModelDefinition`. +* **Field Generation Selection**: Filters and selects specific AI prompt templates based on source file extensions using `AiFieldGenerationSelector`. +* **Definition Resolution**: Converts Maven POM `AiModelDefinition` entries into executable `AiGenerationConfig` instances via `AiModelDefinitionSupport`. + +#### Key units +* `AiGenerationConfig`: Holds 25+ constants and 16 mutable fields for model paths, context sizes, sampling rates, and retry policies. +* `AiModelDefinition`: Defines reusable parameters including GGUF model paths, token limits, and stop strings with a unique lookup key. +* `AiFieldGenerationConfig`: Maps prompt keys to model definitions and optional file extension filters (e.g., `.java`). +* `AiFieldGenerationSelector`: Iterates through configs to select the appropriate generation rule for a given source filename. +* `AiModelDefinitionSupport`: Validates definition keys and resolves `AiModelDefinition` entries into ready-to-use `AiGenerationConfig` objects. +* `AiGenerationKind`: Enumerates scope types (`FILE_SUMMARY`, `PACKAGE_SUMMARY`) for generation operations. + +#### Data flow +* Maven POM configuration provides a list of `AiModelDefinition` objects. +* `AiModelDefinitionSupport` validates these definitions and populates an internal map, converting each to a new `AiGenerationConfig`. +* The plugin framework queries `AiModelDefinitionSupport.getConfig()` using a specific key to retrieve active inference parameters. +* `AiFieldGenerationSelector` receives the list of `AiFieldGenerationConfig` rules and iterates them against a source file name. +* If a file extension matches a rule, that rule's prompt and model definition are applied; otherwise, a fallback rule or null is returned. + +#### Dependencies +* **Internal**: `AiGenerationConfig`, `AiModelDefinition`, `AiFieldGenerationConfig`, `AiFieldGenerationSelector`, `AiModelDefinitionSupport`. +* **External Modules/Types**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Java Standard Libs**: `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.HashMap`, `java.util.List`, `java.util.Map`. + +#### Cross-cutting +* **Immutability Patterns**: Public getters for lists (e.g., `getStopStrings()`) return unmodifiable views to prevent runtime mutation, while internal state remains mutable for configuration updates. +* **Null Handling**: Default constructors rely on static constants; null inputs in setters often trigger graceful resets (e.g., empty lists) or allow null fallbacks rather than throwing exceptions immediately. +* **Thread Safety**: Configuration objects are generally designed for single-instance use within the plugin lifecycle, though `AiFieldGenerationSelector` is stateless and thread-safe. Concurrent access to mutable fields requires external synchronization outside these classes. +* **Error Strategy**: Fail-fast validation on definition keys during construction (`NullPointerException`), with runtime errors primarily manifested as missing key lookups (`IllegalArgumentException`). diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..85ea11f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,47 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:29:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Provides local AI document indexing via JNI-backed Llama.cpp inference, configuring model paths, sampling parameters, and field-specific generation rules for Java source code processing. + +#### Purpose +* Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files. +* Bridges Maven POM definitions with runtime inference configurations while supporting deterministic mock testing. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, manages chat context windows, and executes token generation with configurable sampling (temperature, top-p). +* **Configuration Resolution**: Maps Maven `AiModelDefinition` entries to executable `AiGenerationConfig` objects and selects file-specific prompt templates. +* **Prompt Construction & Parsing**: Builds chat messages from source files and parses raw model outputs to strip reasoning markers and extract clean answers. +* **Provider Abstraction**: Offers a unified interface for switching between native Llama.cpp inference and deterministic mock providers. + +#### Key units +* `AiGenerationProvider`: Defines the contract for generating text from prompts and source file paths. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record holding model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text from raw completion strings by removing reasoning block markers and handling budget exhaustion. +* `AiGenerationProviderFactory`: Instantiates specific providers (`Mock` or `LlamaCppJni`) based on configuration names. +* `AiModelDefinitionSupport`: Resolves Maven POM `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Load**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig` instances. +2. **Provider Selection**: The framework queries `AiGenerationProviderFactory` or directly instantiates `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: For a given source file, `AiPromptSupport` constructs a chat message including headers and content; the native backend executes `chatCompleteText`. +4. **Response Processing**: Raw output is passed to `AiCompletionParser` to remove `THINKING_BLOCK_START/END_MARKERS`, returning a clean string or raising an exception on malformed reasoning blocks. + +#### Dependencies +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Native Bindings**: JNI wrappers for llama.cpp (`libllama`), native memory management, and GGUF model loading. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability Strategy**: Configuration objects (e.g., `LlamaCppJniConfig`) use immutable records to ensure thread-safety without external locks. +* **Null Safety**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Strategy**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..99ec4b0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,41 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:17:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +`). + +#### Input +* `response`: Raw completion string from the model (may be null). +* Constants: Defined markers for Gemma-4 reasoning blocks. + +#### Output +* `String`: Cleaned answer text following the closing marker or trimmed original input. +* Side effects: Throws `IOException` if start marker exists without end marker. +* State: Mutates no state; returns new string. + +#### Core logic +* Returns empty string if input is null. +* Finds last occurrence of `THINKING_BLOCK_END_MARKER` to truncate reasoning. +* Throws `IOException` if `THINKING_BLOCK_START_MARKER` appears but end marker is missing (budget exhaustion). +* Returns trimmed original response if no markers are detected. + +#### Public API +`parseCompletion(String response) -> String`: Extracts clean answer from raw completion. + +#### Dependencies +* `java.io.IOException` +* `lombok.ToString` +* Constants: `THINKING_BLOCK_START_MARKER`, `THINKING_BLOCK_END_MARKER`. + +#### Exceptions / Errors +* Throws `IOException` when thinking block is started but not closed (token budget exhausted). +* Handles null input gracefully as empty string. + +#### Concurrency +* Thread-safe via pure functional logic and immutability of returned strings. +* No synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..a23cc7f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,48 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:18:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a pluggable AI backend interface for generating text responses from local LLMs (llama.cpp) or mock providers based on input requests. + +#### Purpose +* Defines the contract for generating AI text from prompts, source files, and headers via `AiGenerationRequest`. +* Supports configurable sampling parameters like temperature to resolve generation failures. + +#### Type +Kind: interface; extends AutoCloseable; implements default methods for fallback logic. + +#### Input +* `AiGenerationRequest`: Contains prompt key, source file path, source text, and current header context. +* `float temperatureOverride`: Optional sampling parameter to override provider configuration during retry logic. + +#### Output +* `String`: Generated text response (never null, may be blank if model produces no tokens). +* Side effect: Closes underlying resource on invocation of `close()` method. + +#### Core logic +* Validates `AiGenerationRequest` parameters for prompt construction and header injection. +* Applies optional `temperatureOverride` to sampling configuration before invoking the generation engine. +* Executes model inference locally via llama.cpp or mock fallback to produce text output. +* Handles resource cleanup automatically via `AutoCloseable` contract implementation. + +#### Public API +* `generate(request) -> String`: Generates text using default provider parameters. +* `generate(request, temperatureOverride) -> String`: Generates text with forced temperature override for retry logic. +* `close() -> void`: Releases underlying AI backend resources safely. + +#### Dependencies +* `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +* `java.io.IOException` + +#### Exceptions / Errors +* Throws `IOException` if the underlying AI provider fails during text generation. +* Returns blank strings instead of null if the model produces zero tokens. + +#### Concurrency +* Stateless interface design ensures thread-safety across concurrent requests. +* No internal synchronization required; relies on external resource management. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..3e4e060 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,41 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:19:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Factory selects and instantiates an AI generation provider implementation by name for integration into the Llama.cpp AI index system. + +#### Purpose +* Instantiates `AiGenerationProvider` instances for `mock` or `llamacpp-jni` modes within the AI index module. +* Validates provider names and returns configured `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. + +#### Type +Class `AiGenerationProviderFactory` with `@ToString` annotation; final field `Java8CompatibilityHelper`. + +#### Input +Constructor takes no parameters; `create` method accepts `String providerName`, `LlamaCppJniConfig llamaConfig`, and `AiPromptSupport promptSupport`. + +#### Output +Returns `AiGenerationProvider` instance (`MockAiGenerationProvider` or `LlamaCppJniAiGenerationProvider`); throws `IllegalArgumentException` on invalid names. + +#### Core logic +* Initializes internal `Java8CompatibilityHelper` for string validation. +* Checks if `providerName` is null or blank to default to `mock` mode. +* Switches on `providerName` string value to instantiate specific provider types. +* Throws error for unrecognized provider keys in `llamacpp-jni` AI index context. + +#### Public API +`create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider`: creates provider instance. + +#### Dependencies +`AiGenerationProvider`, `AiPromptSupport`, `LlamaCppJniConfig`, `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `Java8CompatibilityHelper`. + +#### Exceptions / Errors +Throws `IllegalArgumentException` when `providerName` is unrecognized or invalid string. + +#### Concurrency +No concurrency concerns; uses single-threaded instantiation logic with immutability for internal helpers. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..63265b2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,52 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:20:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides local LLM text generation via JNI-backed llama.cpp for AI index document processing. + +#### Purpose +- Implements `AiGenerationProvider` interface for generating AI completions using local GGUF models. +- Manages lifecycle of native llama.cpp instance including lazy initialization and cleanup. + +#### Type +Class: `final`, extends `Object`, implements `AiGenerationProvider` and `AutoCloseable`. Fields annotated with `@ToString.Exclude` and `@Nullable`. Lombok `@ToString` applied. + +#### Input +- Constructor parameters: `LlamaCppJniConfig`, `AiPromptSupport`. +- Method parameters: `AiGenerationRequest`, `float temperatureOverride`. +- Consumed fields: `config`, `promptSupport`, internal `model` handle, `completionParser`. +- Resources read: configuration values (model path, context size, threads), prompt templates. + +#### Output +- Return type: `String` containing generated AI completion text. +- Produced state: Cached `LlamaModel` instance after first generation. +- Side effects: Native memory allocation for model loading, potential native pointer access. + +#### Core logic +- Lazily initializes native `LlamaModel` from GGUF file on first `generate()` call using configuration parameters. +- Constructs chat messages list from request and prompt support template. +- Configures inference parameters (temperature, tokens, top-p/k, repeat penalty) before calling native `chatCompleteText`. +- Parses raw completion output into structured text via `AiCompletionParser`. + +#### Public API +- `generate(AiGenerationRequest) -> String`: Generates text using default temperature. +- `generate(AiGenerationRequest, float) -> String`: Generates text with overridden temperature. +- `close() -> void`: Releases native model resources and closes handle. + +#### Dependencies +`net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `LlamaModel`, `InferenceParameters`, `AiCompletionParser`, `java.util.List`, `java.io.IOException`. + +#### Exceptions / Errors +- Throws `IOException` from `generate()` and `close()` methods. +- Validates input arguments via `Objects.requireNonNull` in constructor. +- Handles null model gracefully during close operation. + +#### Concurrency +- Single-threaded design assuming sequential access to shared `model` state. +- Lazy initialization ensures native resources are not shared across threads without synchronization. +- Immutable inference parameters prevent race conditions during configuration assembly. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..7179d84 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,55 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:21:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures native llama.cpp inference parameters for Java AI indexing providers. + +#### Purpose +* Immutable configuration holder for llama.cpp JNI provider settings. +* Defines model paths, sampling parameters, and thread counts for LLM execution. + +#### Type +Class: `final` with Lombok-generated `equals`, `hashCode`, `toString`. +Fields: 11 private final fields (`libraryPath`, `modelPath`, numeric configs). +Annotations: `@ConvertToRecord`, `@ToString`, `@EqualsAndHashCode`. + +#### Input +Constructor parameters: `String libraryPath`, `String modelPath` (required), `int contextSize`, `int maxOutputTokens`, `float temperature`, `int threads`, `float topP`, `int topK`, `float repeatPenalty`, `boolean chatTemplateEnableThinking`, `List stopStrings`. + +#### Output +Return types: 11 getter methods returning respective config values (`String`, `int`, `float`, `boolean`, `List`). +Side effects: Validates `modelPath` non-null; converts null `stopStrings` to empty list. + +#### Core logic +* Validates `modelPath` is not null during construction. +* Initializes immutable fields with provided configuration values. +* Converts null `stopStrings` to an unmodifiable empty list for safety. +* Generates value-based equality and hash code via Lombok over all fields. + +#### Public API +`libraryPath() -> String` (native lib path or null) +`modelPath() -> String` (GGUF model file path) +`contextSize() -> int` (context window token count) +`maxOutputTokens() -> int` (max output token limit) +`temperature() -> float` (sampling temperature factor) +`threads() -> int` (CPU thread count) +`topP() -> float` (nucleus sampling threshold) +`topK() -> int` (top-k sampling limit) +`repeatPenalty() -> float` (repetition penalty weight) +`chatTemplateEnableThinking() -> boolean` (thinking mode flag) +`stopStrings() -> List` (unmodifiable stop tokens list) + +#### Dependencies +`java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.EqualsAndHashCode`, `lombok.ToString`, `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord`. + +#### Exceptions / Errors +Throws `NullPointerException` if `modelPath` is null. +Handles null `stopStrings` gracefully by converting to empty list. + +#### Concurrency +Thread-safe due to immutability; no synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..66aa0e6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,43 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:23:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a deterministic mock implementation of AI generation summaries for testing purposes without external dependencies. + +#### Purpose +- Replaces real AI generation with static mock summaries during unit testing. +- Simulates the `AiGenerationProvider` interface for deterministic validation. + +#### Type +Class implementing `AiGenerationProvider`, annotated with `@ToString`. + +#### Input +- `AiGenerationRequest` containing a `Path` source file representing the document to process. + +#### Output +- Returns a `String` formatted as "Mock summary for [filename]". + +#### Core logic +- Extracts filename from `sourceFile()` parameter of the request. +- Fallbacks to full path string if filename extraction fails or returns null. +- Concatenates static prefix with filename to generate mock response. + +#### Public API +- `generate(AiGenerationRequest) -> String` + generates mock summary for requested file. + +#### Dependencies +- `AiGenerationProvider` interface. +- `AiGenerationRequest` request container. +- `java.nio.file.Path` for file path handling. + +#### Exceptions / Errors +- Throws `IOException` on method execution (mock implementation ignores actual I/O errors). +- Handles null filename gracefully by falling back to full path string representation. + +#### Concurrency +- Thread-safe via immutability; no shared mutable state or synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..56a471d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,52 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:27:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Provides a pluggable local LLM inference backend using JNI-backed llama.cpp for AI document processing, supporting deterministic mock testing and configurable sampling parameters. + +#### Purpose +* Implements local AI text generation for AI index documents via native llama.cpp or fallback mock providers. +* Manages lifecycle of native resources (models, contexts) and provides a clean interface for prompt-based completion. + +#### Responsibilities +* **Native LLM Inference**: Handles GGUF model loading, chat message construction, and token generation using JNI. +* **Configuration Management**: Stores immutable inference parameters (context size, temperature, threads, stop strings). +* **Response Parsing**: Extracts clean answer text from raw model outputs by truncating reasoning blocks. +* **Factory & Abstraction**: Provides interfaces for provider selection and mock implementations for testing. + +#### Key units +* `AiGenerationProvider`: Interface defining the contract for generating text from prompts and source files. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, managing lazy initialization of `LlamaModel`. +* `LlamaCppJniConfig`: Immutable holder for model paths, context sizes, sampling settings (temperature, top-p/k), and stop strings. +* `AiCompletionParser`: Utility to parse raw completion strings, removing reasoning markers and handling budget exhaustion errors. +* `AiGenerationProviderFactory`: Factory class instantiating specific provider types (`Mock` or `LlamaCppJni`) based on name. +* `MockAiGenerationProvider`: Deterministic test implementation returning static summaries based on file paths. + +#### Data flow +1. **Request**: `AiGenerationRequest` containing prompt, source file path, and header context enters the system. +2. **Configuration**: `LlamaCppJniConfig` supplies model path, context limits, and sampling parameters to the provider. +3. **Inference**: `LlamaCppJniAiGenerationProvider` constructs chat messages using `AiPromptSupport`, calls native `chatCompleteText`, and receives raw output. +4. **Parsing**: Raw output is fed into `AiCompletionParser` to strip reasoning blocks (`THINKING_BLOCK_START/END_MARKERS`). +5. **Output**: Cleaned string is returned; if markers are incomplete, an `IOException` indicates token budget exhaustion. + +#### Dependencies +* **Internal**: `AiPromptSupport`, `LlamaModel`, `InferenceParameters`, `Java8CompatibilityHelper`. +* **External**: JNI bindings for llama.cpp (`libllama`, native memory), `java.nio.file.Path`, `java.io.IOException`. +* **Data**: GGUF model files, configuration strings, stop token lists. + +#### Cross-cutting +* **Immutability**: `LlamaCppJniConfig` uses `@ConvertToRecord` for thread-safe configuration storage. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; returns blank strings on zero-token outputs instead of nulls. +* **Concurrency**: Relies on lazy initialization and immutability; native resources are not shared across threads without explicit synchronization. +* **Testing**: Includes a `MockAiGenerationProvider` to decouple unit tests from native dependencies. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..be80760 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:31:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Provides local AI document indexing via JNI-backed Llama.cpp inference, configuring model paths, sampling parameters, and field-specific generation rules for Java source code processing. + +#### Purpose +* Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files. +* Bridges Maven POM definitions with runtime inference configurations while supporting deterministic mock testing. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, manages chat context windows, and executes token generation with configurable sampling (temperature, top-p). +* **Configuration Resolution**: Maps Maven `AiModelDefinition` entries to executable `AiGenerationConfig` objects and selects file-specific prompt templates. +* **Prompt Construction & Parsing**: Builds chat messages from source files and parses raw model outputs to strip reasoning markers and extract clean answers. +* **Provider Abstraction**: Offers a unified interface for switching between native Llama.cpp inference and deterministic mock providers. + +#### Key units +* `AiGenerationProvider`: Defines the contract for generating text from prompts and source file paths. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record holding model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text from raw completion strings by removing reasoning block markers and handling budget exhaustion. +* `AiGenerationProviderFactory`: Instantiates specific providers (`Mock` or `LlamaCppJni`) based on configuration names. +* `AiModelDefinitionSupport`: Resolves Maven POM `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Load**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig` instances. +2. **Provider Selection**: The framework queries `AiGenerationProviderFactory` or directly instantiates `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: For a given source file, `AiPromptSupport` constructs a chat message including headers and content; the native backend executes `chatCompleteText`. +4. **Response Processing**: Raw output is passed to `AiCompletionParser` to remove `THINKING_BLOCK_START/END_MARKERS`, returning a clean string or raising an exception on malformed reasoning blocks. + +#### Dependencies +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Native Bindings**: JNI wrappers for llama.cpp (`libllama`), native memory management, and GGUF model loading. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability Strategy**: Configuration objects (e.g., `LlamaCppJniConfig`) use immutable records to ensure thread-safety without external locks. +* **Null Safety**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Strategy**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..03e89c8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:33:06Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Provides local AI document indexing via JNI-backed Llama.cpp inference, configuring model paths, sampling parameters, and field-specific generation rules for Java source code processing. + +#### Purpose +* Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files. +* Bridges Maven POM definitions with runtime inference configurations while supporting deterministic mock testing. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, manages chat context windows, and executes token generation with configurable sampling (temperature, top-p). +* **Configuration Resolution**: Maps Maven `AiModelDefinition` entries to executable `AiGenerationConfig` objects and selects file-specific prompt templates. +* **Prompt Construction & Parsing**: Builds chat messages from source files and parses raw model outputs to strip reasoning markers and extract clean answers. +* **Provider Abstraction**: Offers a unified interface for switching between native Llama.cpp inference and deterministic mock providers. + +#### Key units +* `AiGenerationProvider`: Defines the contract for generating text from prompts and source file paths. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record holding model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text from raw completion strings by removing reasoning block markers and handling budget exhaustion. +* `AiGenerationProviderFactory`: Instantiates specific providers (`Mock` or `LlamaCppJni`) based on configuration names. +* `AiModelDefinitionSupport`: Resolves Maven POM `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Load**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig` instances. +2. **Provider Selection**: The framework queries `AiGenerationProviderFactory` or directly instantiates `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: For a given source file, `AiPromptSupport` constructs a chat message including headers and content; the native backend executes `chatCompleteText`. +4. **Response Processing**: Raw output is passed to `AiCompletionParser` to remove `THINKING_BLOCK_START/END_MARKERS`, returning a clean string or raising an exception on malformed reasoning blocks. + +#### Dependencies +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Native Bindings**: JNI wrappers for llama.cpp (`libllama`), native memory management, and GGUF model loading. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability Strategy**: Configuration objects (e.g., `LlamaCppJniConfig`) use immutable records to ensure thread-safety without external locks. +* **Null Safety**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Strategy**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..8dd0050 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:34:50Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files, bridging Maven POM definitions with runtime inference configurations. + +#### Purpose +* Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files. +* Bridges Maven POM definitions with runtime inference configurations while supporting deterministic mock testing. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, manages chat context windows, and executes token generation with configurable sampling (temperature, top-p). +* **Configuration Resolution**: Maps Maven `AiModelDefinition` entries to executable `AiGenerationConfig` objects and selects file-specific prompt templates. +* **Prompt Construction & Parsing**: Builds chat messages from source files and parses raw model outputs to strip reasoning markers and extract clean answers. +* **Provider Abstraction**: Offers a unified interface for switching between native Llama.cpp inference and deterministic mock providers. + +#### Key units +* `AiGenerationProvider`: Defines the contract for generating text from prompts and source file paths. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record holding model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text from raw completion strings by removing reasoning block markers and handling budget exhaustion. +* `AiGenerationProviderFactory`: Instantiates specific providers (`Mock` or `LlamaCppJni`) based on configuration names. +* `AiModelDefinitionSupport`: Resolves Maven POM `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Load**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig` instances. +2. **Provider Selection**: The framework queries `AiGenerationProviderFactory` or directly instantiates `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: For a given source file, `AiPromptSupport` constructs a chat message including headers and content; the native backend executes `chatCompleteText`. +4. **Response Processing**: Raw output is passed to `AiCompletionParser` to remove `THINKING_BLOCK_START/END_MARKERS`, returning a clean string or raising an exception on malformed reasoning blocks. + +#### Dependencies +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Native Bindings**: JNI wrappers for llama.cpp (`libllama`), native memory management, and GGUF model loading. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability Strategy**: Configuration objects (e.g., `LlamaCppJniConfig`) use immutable records to ensure thread-safety without external locks. +* **Null Safety**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Strategy**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..e50d403 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/net/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:36:33Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files, bridging Maven POM definitions with runtime inference configurations. + +#### Purpose +* Manages native Java-GGUF inference via JNI to generate text from source files with configurable sampling parameters. +* Resolves Maven `AiModelDefinition` entries into executable `AiGenerationConfig` objects while supporting deterministic mock testing. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, manages chat context windows, and executes token generation with configurable temperature and top-p settings. +* **Configuration Resolution**: Maps Maven `AiModelDefinition` entries to `AiGenerationConfig` instances and selects file-specific prompt templates. +* **Prompt Construction & Parsing**: Builds chat messages from source files and parses raw model outputs to strip reasoning markers and extract clean answers. +* **Provider Abstraction**: Provides a unified interface for switching between native Llama.cpp inference and deterministic mock providers. + +#### Key units +* `AiGenerationProvider`: Defines the contract for generating text from prompts and source file paths. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record holding model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text from raw completion strings by removing reasoning block markers and handling budget exhaustion. +* `AiGenerationProviderFactory`: Instantiates specific providers (`Mock` or `LlamaCppJni`) based on configuration names. +* `AiModelDefinitionSupport`: Resolves Maven POM `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Load**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig` instances. +2. **Provider Selection**: The framework queries `AiGenerationProviderFactory` or directly instantiates `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: For a given source file, `AiPromptSupport` constructs a chat message including headers and content; the native backend executes `chatCompleteText`. +4. **Response Processing**: Raw output is passed to `AiCompletionParser` to remove `THINKING_BLOCK_START/END_MARKERS`, returning a clean string or raising an exception on malformed reasoning blocks. + +#### Dependencies +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Native Bindings**: JNI wrappers for llama.cpp (`libllama`), native memory management, and GGUF model loading. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability Strategy**: Configuration objects (e.g., `LlamaCppJniConfig`) use immutable records to ensure thread-safety without external locks. +* **Null Safety**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Strategy**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/package.ai.md new file mode 100644 index 0000000..d1a40f2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/java/package.ai.md @@ -0,0 +1,46 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:38:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Manages native Java-GGUF inference via JNI to generate text from source files with configurable sampling parameters. + +#### Purpose +* Orchestrates local LLM text generation using native `llama.cpp` bindings to index and summarize source files. +* Bridges Maven POM definitions (`AiModelDefinition`) with runtime inference configurations (`AiGenerationConfig`). + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, manages chat context windows, and executes token generation with configurable temperature and top-p settings. +* **Configuration Resolution**: Maps Maven `AiModelDefinition` entries to `AiGenerationConfig` instances and selects file-specific prompt templates. +* **Prompt Construction & Parsing**: Builds chat messages from source files and parses raw model outputs to strip reasoning markers and extract clean answers. +* **Provider Abstraction**: Provides a unified interface for switching between native Llama.cpp inference and deterministic mock providers. + +#### Key units +* `AiGenerationProvider`: Defines the contract for generating text from prompts and source file paths. +* `LlamaCppJniAiGenerationProvider`: Implements native inference via JNI, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record holding model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text from raw completion strings by removing reasoning block markers and handling budget exhaustion. +* `AiGenerationProviderFactory`: Instantiates specific providers (`Mock` or `LlamaCppJni`) based on configuration names. +* `AiModelDefinitionSupport`: Resolves Maven POM `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Load**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig` instances. +2. **Provider Selection**: The framework queries `AiGenerationProviderFactory` or directly instantiates `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: For a given source file, `AiPromptSupport` constructs a chat message including headers and content; the native backend executes `chatCompleteText`. +4. **Response Processing**: Raw output is passed to `AiCompletionParser` to remove `THINKING_BLOCK_START/END_MARKERS`, returning a clean string or raising an exception on malformed reasoning blocks. + +#### Dependencies +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Native Bindings**: JNI wrappers for llama.cpp (`libllama`), native memory management, and GGUF model loading. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability Strategy**: Configuration objects (e.g., `LlamaCppJniConfig`) use immutable records to ensure thread-safety without external locks. +* **Null Safety**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Strategy**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/package.ai.md new file mode 100644 index 0000000..f76b3b7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/main/package.ai.md @@ -0,0 +1,46 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:40:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Orchestrates local Large Language Model (LLM) text generation and summarization using native C++ bindings via JNI, bridging Maven model definitions with runtime inference configurations. + +#### Purpose +* Provides a unified interface for generating text from source files using configurable native `llama.cpp` inference or deterministic mock providers. +* Resolves Maven `AiModelDefinition` entries into runtime `AiGenerationConfig` and manages chat context windows and sampling parameters. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, initializes `LlamaModel`, and executes token generation with dynamic temperature and top-p settings. +* **Configuration Resolution**: Maps Maven POM artifacts to immutable inference configs and selects file-specific prompt templates. +* **Prompt Engineering & Parsing**: Constructs chat messages from source content and strips reasoning block markers (`THINKING_BLOCK_START/END_MARKERS`) from raw outputs. +* **Provider Abstraction**: Switches between native `LlamaCppJni` and `Mock` providers based on configuration names without changing the application logic. + +#### Key units +* `AiGenerationProvider`: Core interface defining contracts for prompt execution, source file paths, and output extraction. +* `LlamaCppJniAiGenerationProvider`: Implements native inference logic, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record specifying model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text by removing reasoning markers and handling budget exhaustion or malformed blocks. +* `AiGenerationProviderFactory`: Factory class instantiating specific providers (`Mock` or `LlamaCppJni`) based on configuration keys. +* `AiModelDefinitionSupport`: Utility resolving Maven `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Initialization**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig`. +2. **Provider Instantiation**: Framework queries `AiGenerationProviderFactory` or directly constructs `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: `AiPromptSupport` builds chat messages with headers and source content; native backend calls `chatCompleteText`. +4. **Output Extraction**: Raw completion string flows to `AiCompletionParser`, which removes reasoning block markers and returns a clean string or raises an exception on errors. + +#### Dependencies +* **Native Bindings**: JNI wrappers for `libllama` (llama.cpp), native memory management, and GGUF model loading libraries. +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability & Thread Safety**: Configuration objects (e.g., `LlamaCppJniConfig`) utilize immutable records to ensure thread-safety without external locks. +* **Null Safety Patterns**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling Strategy**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Architecture**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/package.ai.md new file mode 100644 index 0000000..32deb30 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/package.ai.md @@ -0,0 +1,46 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:41:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Orchestrates local Large Language Model (LLM) text generation and summarization using native C++ bindings via JNI, bridging Maven model definitions with runtime inference configurations. + +#### Purpose +* Provides a unified interface for generating text from source files using configurable native `llama.cpp` inference or deterministic mock providers. +* Resolves Maven `AiModelDefinition` entries into runtime `AiGenerationConfig` and manages chat context windows and sampling parameters. + +#### Responsibilities +* **Native Inference Management**: Loads GGUF models via JNI, initializes `LlamaModel`, and executes token generation with dynamic temperature and top-p settings. +* **Configuration Resolution**: Maps Maven POM artifacts to immutable inference configs and selects file-specific prompt templates. +* **Prompt Engineering & Parsing**: Constructs chat messages from source content and strips reasoning block markers (`THINKING_BLOCK_START/END_MARKERS`) from raw outputs. +* **Provider Abstraction**: Switches between native `LlamaCppJni` and `Mock` providers based on configuration names without changing the application logic. + +#### Key units +* `AiGenerationProvider`: Core interface defining contracts for prompt execution, source file paths, and output extraction. +* `LlamaCppJniAiGenerationProvider`: Implements native inference logic, handling lazy initialization of `LlamaModel` and chat message construction. +* `LlamaCppJniConfig`: Immutable record specifying model paths, context limits, sampling parameters, and stop strings. +* `AiCompletionParser`: Extracts clean text by removing reasoning markers and handling budget exhaustion or malformed blocks. +* `AiGenerationProviderFactory`: Factory class instantiating specific providers (`Mock` or `LlamaCppJni`) based on configuration keys. +* `AiModelDefinitionSupport`: Utility resolving Maven `AiModelDefinition` entries into active inference configurations. + +#### Data flow +1. **Configuration Initialization**: Maven POM defines `AiModelDefinition` objects; `AiModelDefinitionSupport` validates keys and converts them to `AiGenerationConfig`. +2. **Provider Instantiation**: Framework queries `AiGenerationProviderFactory` or directly constructs `LlamaCppJniAiGenerationProvider` using the resolved config. +3. **Inference Execution**: `AiPromptSupport` builds chat messages with headers and source content; native backend calls `chatCompleteText`. +4. **Output Extraction**: Raw completion string flows to `AiCompletionParser`, which removes reasoning block markers and returns a clean string or raises an exception on errors. + +#### Dependencies +* **Native Bindings**: JNI wrappers for `libllama` (llama.cpp), native memory management, and GGUF model loading libraries. +* **Internal Modules**: `net.ladenthin.llama.parameters.ModelParameters`, `lombok.ToString`, `org.jspecify.annotations.Nullable`. +* **Standard Library**: `java.nio.file.Path`, `java.io.IOException`, `java.util.HashMap`, `java.util.List`. + +#### Cross-cutting +* **Immutability & Thread Safety**: Configuration objects (e.g., `LlamaCppJniConfig`) utilize immutable records to ensure thread-safety without external locks. +* **Null Safety Patterns**: Default constructors rely on static constants; null inputs in setters trigger graceful resets rather than immediate exceptions. +* **Error Handling Strategy**: Standardizes `IOException` for native failures and reasoning block mismatches; zero-token outputs return blank strings instead of nulls. +* **Testing Architecture**: Includes `MockAiGenerationProvider` to decouple unit tests from native dependencies, ensuring deterministic behavior during development. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/project.ai.md new file mode 100644 index 0000000..f1e3ad7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 632FEE1C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:43:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The project orchestrates local Large Language Model text generation using native C++ bindings via JNI to index and summarize Java source files while bridging Maven POM definitions with runtime inference configurations. This architecture manages native Java-GGUF inference through a pluggable Llama.cpp backend that enforces deterministic mock testing and supports configurable sampling parameters alongside context window management. Field-specific generation rules are applied during the processing of Java code to produce accurate summaries, ensuring seamless integration between model definitions and file extension mappings for AI document indexing. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Provides Llama.cpp inference configuration and field generation selection logic for Maven plugins, mapping file extensions to AI models while managing context windows, sampling parameters, and retry policies. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Provides local AI document indexing via JNI-backed Llama.cpp inference, configuring model paths, sampling parameters, and field-specific generation rules for Java source code processing. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides a pluggable local LLM inference backend using JNI-backed llama.cpp for AI document processing, supporting deterministic mock testing and configurable sampling parameters. +- main/java/net/ladenthin/maven/llamacpp — Provides local AI document indexing via JNI-backed Llama.cpp inference, configuring model paths, sampling parameters, and field-specific generation rules for Java source code processing. +- main/java/net/ladenthin/maven — Provides local AI document indexing via JNI-backed Llama.cpp inference, configuring model paths, sampling parameters, and field-specific generation rules for Java source code processing. +- main/java/net/ladenthin — Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files, bridging Maven POM definitions with runtime inference configurations. +- main/java/net — Orchestrates local LLM text generation using native llama.cpp bindings to index and summarize source files, bridging Maven POM definitions with runtime inference configurations. +- main/java — Manages native Java-GGUF inference via JNI to generate text from source files with configurable sampling parameters. +- main — Orchestrates local Large Language Model (LLM) text generation and summarization using native C++ bindings via JNI, bridging Maven model definitions with runtime inference configurations. +- . — Orchestrates local Large Language Model (LLM) text generation and summarization using native C++ bindings via JNI, bridging Maven model definitions with runtime inference configurations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..8250329 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,48 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:44:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a mutable Maven plugin configuration POJO linking a prompt template key to an AI model definition for single-field-generation steps in the Llama.cpp index builder. + +#### Purpose +- Represents configuration for one field-generation step within the `` list of the Maven plugin POM. +- Associates a specific prompt template (`promptKey`) with an AI model definition (`aiDefinitionKey`) to drive generation calls on indexed files or packages. + +#### Type +public class AiFieldGenerationConfig extends Object; annotated with @ToString; uses JavaBeans pattern with mutable fields and setters for Maven reflection injection. + +#### Input +- `String promptKey`: Key referencing a prompt template in `AiPromptDefinition`. +- `String aiDefinitionKey`: Key referencing an AI model definition in `AiModelDefinition`. +- `Collection fileExtensions`: Optional list of source file extensions (.java, .sql) that restrict applicability; null or empty acts as fallback. + +#### Output +- Modifies internal state: `promptKey`, `aiDefinitionKey`, and `fileExtensions` fields. +- Returns unmodifiable `List` for `getFileExtensions()` if the list is not null. + +#### Core logic +- Validates and stores prompt template key, AI model definition key, and optional file extension filters. +- Ensures immutability of returned collection via `Collections.unmodifiableList`. +- Converts input `Collection` to `ArrayList` defensively during `setFileExtensions`. + +#### Public API +- `getPromptKey()`: Retrieves the prompt template identifier. +- `setPromptKey(String)`: Assigns a new prompt template identifier. +- `getAiDefinitionKey()`: Retrieves the AI model definition identifier. +- `setAiDefinitionKey(String)`: Assigns a new AI model definition identifier. +- `getFileExtensions()`: Retrieves the list of file extensions or null for fallback. +- `setFileExtensions(Collection)`: Updates the list of file extensions, creating a defensive copy. + +#### Dependencies +- AiModelDefinition +- AiPromptDefinition +- AiFieldGenerationSelector +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..229db60 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,44 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T18:45:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the appropriate AI field generation configuration for a given source file based on its extension or a configured fallback. + +#### Purpose +- Maps source file names (e.g., `.java`, `.sql`) to specific `AiFieldGenerationConfig` instances. +- Supports language-specific prompts while maintaining a single loaded AI model. + +#### Type +public final class AiFieldGenerationSelector; @ToString annotation. + +#### Input +- `Iterable configs`: Ordered list of configured field generations (null entries skipped). +- `String fileName`: Source file name (e.g., `Foo.java`). + +#### Output +- `@Nullable AiFieldGenerationConfig`: The first extension-matching config, or the first extension-agnostic fallback, or `null` if none match. + +#### Core logic +- Iterates through `configs` in declaration order. +- Skips null entries. +- Checks if an entry has non-empty file extensions; if yes, returns the first entry where `fileName.endsWith(extension)`. +- If no extension matches, stores the entry as a fallback if not already set. +- Returns the stored fallback only if the loop completes without finding an extension match. + +#### Public API +`selectForFileName(Iterable configs, String fileName) -> @Nullable AiFieldGenerationConfig` — selects matching config or fallback. + +#### Dependencies +`AiFieldGenerationConfig`, `List`, `String`, `Iterable`. + +#### Exceptions / Errors +- Returns `null` if no config matches and no fallback is configured. +- Handles null entries in the `configs` list by skipping them. + +#### Concurrency +None; logic is single-threaded and stateless. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..e0dc5bc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,76 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:46:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Mutable configuration carrier for AI generation parameters including model paths, sampling settings, retry policies, and input limits between Maven plugin and AI provider. + +#### Purpose +- Holds all configurable parameters for a single AI generation step (model path, sampling, retries, input limits). +- Provides Lombok-generated `toString()` for build logs while remaining mutable via setters managed by the Maven plugin. + +#### Type +- public class; extends Object; implements nothing; annotated with @ToString; fields initialized to DEFAULT_* constants. + +#### Input +- Constructor arguments: none (no-arg constructor uses defaults). +- Setter parameters: modelPath (String), contextSize (int), maxOutputTokens (int), temperature (float), threads (int), charsPerToken (int), maxInputChars (int), warnOnTrim (boolean), maxRetries (int), retryTemperatureIncrement (float), topP (float), topK (int), repeatPenalty (float), chatTemplateEnableThinking (boolean), stopStrings (@Nullable List). + +#### Output +- Getter returns: modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, maxInputChars, warnOnTrim, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings (unmodifiable view). +- State mutations via setters; no resource writes or side effects. + +#### Core logic +- Defaults for all numeric and boolean fields are initialized to static final constants upon instantiation. +- `getStopStrings()` safely returns an unmodifiable list or null based on `stopStrings` state. +- `setStopStrings()` normalizes null input to an empty ArrayList before assignment. +- No algorithmic computation; pure data storage and retrieval. + +#### Public API +- getModelPath() -> String: GGUF model file path. +- setModelPath(String) -> void: sets GGUF model file path. +- getContextSize() -> int: context window size in tokens. +- setContextSize(int) -> void: sets context window size in tokens. +- getMaxOutputTokens() -> int: max output tokens per inference call. +- setMaxOutputTokens(int) -> void: sets max output tokens per inference call. +- getTemperature() -> float: sampling temperature (lower = deterministic). +- setTemperature(float) -> void: sets sampling temperature. +- getThreads() -> int: CPU threads for llama.cpp inference. +- setThreads(int) -> void: sets CPU threads for inference. +- getCharsPerToken() -> int: chars per token ratio; 0 disables auto calc. +- setCharsPerToken(int) -> void: sets chars per token (0 disables auto calc). +- getMaxInputChars() -> int: max input characters fed to prompt. +- setMaxInputChars(int) -> void: sets max input characters fed to prompt. +- isWarnOnTrim() -> boolean: whether trim warnings are emitted. +- setWarnOnTrim(boolean) -> void: enables/disables trim warnings. +- getMaxRetries() -> int: max retry attempts on empty-body responses. +- setMaxRetries(int) -> void: sets max retry attempts on empty-body responses. +- getRetryTemperatureIncrement() -> float: temp increment per retry attempt. +- setRetryTemperatureIncrement(float) -> void: sets temp increment per retry attempt. +- getTopP() -> float: nucleus-sampling probability threshold. +- setTopP(float) -> void: sets nucleus-sampling probability threshold. +- getTopK() -> int: top-k sampling limit. +- setTopK(int) -> void: sets top-k sampling limit. +- getRepeatPenalty() -> float: repetition penalty factor. +- setRepeatPenalty(float) -> void: sets repetition penalty factor. +- isChatTemplateEnableThinking() -> boolean: whether chat-template thinking mode is enabled. +- setChatTemplateEnableThinking(boolean) -> void: enables/disables chat-template thinking mode. +- getStopStrings() -> List: unmodifiable list of stop strings. +- setStopStrings(List) -> void: sets list of stop strings (null clears). + +#### Dependencies +- java.util.ArrayList +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- None; no checked exceptions or null-handling logic beyond standard field assignment. + +#### Concurrency +- Mutable state; not thread-safe; managed by Maven plugin framework via setters. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..fc162cb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,38 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:49:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines enumeration values distinguishing AI generation scope between a single source file and an entire package. + +#### Purpose +- Represents operation modes for generating field summaries in AI processing. +- Differentiates granularity: `FILE_SUMMARY` for individual files vs `PACKAGE_SUMMARY` for packages. + +#### Type +enum; no extends/implements; notable annotations (Javadoc). + +#### Input +None. + +#### Output +None. + +#### Core logic +None. + +#### Public API +None. + +#### Dependencies +None. + +#### Exceptions / Errors +None. + +#### Concurrency +None. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..db526f7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,76 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:50:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures LLM model parameters for a Maven plugin to define reusable AI generation settings. + +#### Purpose +- Defines a mutable JavaBean POJO to hold a unique key and all configurable parameters for a specific LLM model in the plugin system. +- Serves as a single source of truth that can be reused across multiple field-generation entries and plugin goals. + +#### Type +Class; extends `Object`; implements no interfaces; annotated with `@ToString` and `@Nullable` for fields; mutable via reflection-safe setters. + +#### Input +Constructor parameters: None (defaults applied). +Fields: `key`, `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `charsPerToken`, `warnOnTrim`, `maxRetries`, `retryTemperatureIncrement`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, `stopStrings`. + +#### Output +Returns: String (key, modelPath), int/float (contextSize, maxOutputTokens, temperature, threads, charsPerToken, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking), boolean (warnOnTrim, chatTemplateEnableThinking), List (stopStrings). +State: Modifies internal fields via setters; no external resources written or consumed. + +#### Core logic +- Initializes instance variables with default values from `AiGenerationConfig` if not explicitly set by the user. +- Stores unique identifiers (`key`) and file paths (`modelPath`) for model resolution. +- Manages inference tuning parameters including context window, output limits, sampling strategies (temperature, top-p, top-k), and repetition penalties. +- Configures runtime behavior regarding source code trimming warnings, retry logic for empty responses, and chat-template thinking mode. +- Handles stop strings by converting collections to unmodifiable lists upon retrieval to prevent external modification. + +#### Public API +`getKey() -> String`: Retrieves the unique lookup identifier. +`setKey(String) -> void`: Assigns a new unique identifier. +`getModelPath() -> String`: Retrieves the path to the GGUF model file. +`setModelPath(String) -> void`: Sets the path to the model file. +`getContextSize() -> int`: Retrieves the context window size in tokens. +`setContextSize(int) -> void`: Sets the context window size. +`getMaxOutputTokens() -> int`: Retrieves max output tokens per inference call. +`setMaxOutputTokens(int) -> void`: Sets max output tokens limit. +`getTemperature() -> float`: Retrieves base sampling temperature. +`setTemperature(float) -> void`: Sets base sampling temperature. +`getThreads() -> int`: Retrieves CPU thread count for inference. +`setThreads(int) -> void`: Sets number of threads for llama.cpp inference. +`getCharsPerToken() -> int`: Retrieves characters per token ratio for auto-calculation. +`setCharsPerToken(int) -> void`: Sets chars per token ratio (0 disables auto-calc). +`isWarnOnTrim() -> boolean`: Checks if warnings are emitted on source trimming. +`setWarnOnTrim(boolean) -> void`: Enables or disables trim warnings. +`getMaxRetries() -> int`: Retrieves max retry attempts for empty bodies. +`setMaxRetries(int) -> void`: Sets max retries (0 disables). +`getRetryTemperatureIncrement() -> float`: Gets temperature increment per retry. +`setRetryTemperatureIncrement(float) -> void`: Sets retry temperature increment. +`getTopP() -> float`: Retrieves nucleus-sampling probability threshold. +`setTopP(float) -> void`: Sets top-p sampling threshold. +`getTopK() -> int`: Retrieves top-k sampling limit. +`setTopK(int) -> void`: Sets top-k sampling limit. +`getRepeatPenalty() -> float`: Retrieves repetition penalty factor. +`setRepeatPenalty(float) -> void`: Sets repetition penalty. +`isChatTemplateEnableThinking() -> boolean`: Checks if chat-template thinking mode is enabled. +`setChatTemplateEnableThinking(boolean) -> void`: Toggles chat-template thinking mode. +`getStopStrings() -> List`: Retrieves immutable list of generation stop strings. +`setStopStrings(Collection) -> void`: Sets collection of stop strings. + +#### Dependencies +`AiGenerationConfig`, `AiModelDefinitionSupport`, `net.ladenthin.llama.parameters.ModelParameters`. + +#### Exceptions / Errors +- Returns `null` for optional fields (`key`, `modelPath`, `stopStrings`) if not set. +- No checked exceptions thrown; unchecked exceptions handled internally or propagated by caller. +- Null checks performed on `stopStrings` before conversion to unmodifiable list. + +#### Concurrency +- Mutable state managed via setters; safe for single-threaded configuration injection by Maven plugin framework. +- `getStopStrings()` returns an unmodifiable view to prevent concurrent modification from external code. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..a704d7e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,44 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:53:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key into ready-to-use generation configurations for Maven Mojo execution. + +#### Purpose +* Converts `AiModelDefinition` entries from plugin configuration into executable `AiGenerationConfig` objects. +* Enforces strict validation that every definition key is non-null to fail fast at build time. + +#### Type +public final class AiModelDefinitionSupport; extends Object; implements none; annotated with @ToString; uses Lombok. + +#### Input +Constructor parameter: `List definitions` (may be null or empty). + +#### Output +Returns `AiGenerationConfig` objects for lookup by key; constructs new instances via internal conversion logic. + +#### Core logic +* Validates that all `AiModelDefinition` entries in the input list have non-null keys, throwing `NullPointerException` if not. +* Presizes an internal `HashMap` to avoid rehashing during population. +* Iterates through definitions, extracting values via `toConfig()` which clones fields into a new `AiGenerationConfig`. +* Performs key-based lookup in the map, throwing `IllegalArgumentException` if a requested key is missing. + +#### Public API +`AiModelDefinitionSupport(List definitions) -> void` - Constructs lookup table from definitions. +`AiGenerationConfig getConfig(String key) -> AiGenerationConfig` - Retrieves config for a specific model key. + +#### Dependencies +`AiModelDefinition`, `AiGenerationConfig`, `Java8CompatibilityHelper`, `HashMap`, `List`, `Map`, `Objects`. + +#### Exceptions / Errors +* Throws `NullPointerException` if any definition entry has a null key (contract enforcement). +* Throws `IllegalArgumentException` with message "Missing AI model definition for key: " if lookup fails. +* Null input list is handled gracefully, resulting in an empty map. + +#### Concurrency +No explicit concurrency logic; uses mutable HashMap populated in constructor (thread-safety not guaranteed during construction or concurrent access). diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..a9ac684 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:00:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Executes AI-driven field generation for Maven plugin builds by mapping source file extensions to prompt templates and model configurations. + +#### Purpose +- Orchestrates Llama.cpp-based code analysis by resolving file extensions to specific AI generation prompts and model parameters. +- Manages configuration lifecycles for single-field steps, distinguishing between file-level and package-level generation scopes. + +#### Responsibilities +- **Configuration Management**: Stores and validates prompt keys, model definitions, and extension filters within `AiFieldGenerationConfig`. +- **Selector Logic**: Maps source file names to appropriate generation configurations via `AiFieldGenerationSelector`, handling fallbacks for unlisted extensions. +- **Parameter Resolution**: Converts high-level `AiModelDefinition` entries into executable inference parameters via `AiModelDefinitionSupport`. +- **Scope Definition**: Enumerates generation granularity modes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`) to control output scope. + +#### Key units +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to specific file extension filters. +- `AiFieldGenerationSelector`: Selects the correct generation config based on source file extension or fallback rules. +- `AiGenerationConfig`: Holds mutable runtime parameters for inference (context size, temperature, threads). +- `AiModelDefinition`: Defines reusable model settings keyed by unique identifiers for plugin reflection. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via a lookup map. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +- User POM configuration defines `AiFieldGenerationConfig` entries mapping extensions to prompts/models. +- `AiFieldGenerationSelector` iterates these configs during build execution to match incoming source files. +- Matching files trigger generation calls using parameters resolved from `AiModelDefinition` via `AiModelDefinitionSupport`. +- Output is determined by the scope defined in `AiGenerationKind` (file vs package). + +#### Dependencies +- Internal: `AiPromptDefinition`, `net.ladenthin.llama.parameters.ModelParameters`, `Java8CompatibilityHelper`. +- External: Maven Plugin reflection framework, Llama.cpp native bindings (via model paths), standard Java collections. + +#### Cross-cutting +- **Immutable Views**: All collection outputs (`getFileExtensions()`, `getStopStrings()`) return unmodifiable lists to prevent external mutation. +- **Defensive Copying**: List modifications (e.g., `setFileExtensions`) create defensive copies before assignment. +- **Null Safety**: Selectors and configs handle null entries in configuration lists gracefully by skipping or falling back. +- **Thread-Safety**: Configuration objects are mutable but managed by the single-threaded Maven Mojo lifecycle; no explicit locking required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..78b1b8f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:05:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Orchestrates local Llama.cpp inference and field generation for Maven plugin builds by mapping source files to AI prompts and sanitizing reasoning outputs. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..12d3ab4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,42 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:54:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping Gemma-4 internal thinking blocks before storing in an AI index file. + +#### Purpose +* Strips internal reasoning from Gemma-4 chain-of-thought responses. +* Returns clean model answers for AI index persistence. + +#### Type +Class; extends Object; uses @ToString annotation. + +#### Input +String response (raw completion text, may be null). + +#### Output +String cleaned answer text; throws IOException on incomplete thinking blocks. + +#### Core logic +* Checks if input response is null and returns empty string. +* Searches for THINKING_BLOCK_END_MARKER to locate end of internal reasoning. +* If end marker found, returns substring after it trimmed. +* If start marker exists but end marker is missing, throws IOException. +* If no markers found, returns trimmed original response. + +#### Public API +parseCompletion(String) -> String <=6-word purpose clause: Strips thinking block and returns clean answer. + +#### Dependencies +java.io.IOException, net.ladenthin.maven.llamacpp.aiindex.provider.AiCompletionParser. + +#### Exceptions / Errors +IOException thrown if THINKING_BLOCK_START_MARKER appears without THINKING_BLOCK_END_MARKER due to token budget exhaustion. + +#### Concurrency +Non-final class designed for subclassing and mocking; logic is stateless and thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..1dc2d0f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:55:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a pluggable interface for generating AI text from requests, supporting local models and test mocks. + +#### Purpose +- Defines the contract for generating text from `AiGenerationRequest` objects. +- Supports both live backend implementations and mock providers for testing. + +#### Type +Interface; extends `AutoCloseable`. + +#### Input +- `AiGenerationRequest`: Contains prompt key, source file, source text, and current header. +- `float temperatureOverride`: Sampling temperature parameter (optional). + +#### Output +- `String`: Generated text (never null, may be blank). +- Side effect: Resources released via `close()`. + +#### Core logic +- Delegates `generate(AiGenerationRequest)` to underlying backend or mock implementation. +- Applies optional `temperatureOverride` if implemented; otherwise ignores it. +- Handles cleanup and error propagation via `AutoCloseable` contract. + +#### Public API +- `generate(AiGenerationRequest request) -> String`: Generates text using default parameters. +- `generate(AiGenerationRequest request, float temperatureOverride) -> String`: Generates text with overridden temperature. +- `close()`: Releases resources. + +#### Dependencies +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `java.io.IOException` + +#### Exceptions / Errors +- Throws `IOException` if underlying provider fails or during closure. +- Returns blank string if model produces no tokens. + +#### Concurrency +- Interface does not explicitly declare thread-safety; implementations must ensure safety. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..4e8c5cc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,44 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:56:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an `AiGenerationProvider` implementation by name string within the Llama.cpp AI indexing domain. + +#### Purpose +- Instantiates either a `MockAiGenerationProvider` or `LlamaCppJniAiGenerationProvider` based on provider key. +- Validates provider names and handles default fallback behavior for blank inputs. + +#### Type +public class AiGenerationProviderFactory; extends Object; implements none; annotated with @ToString. + +#### Input +- `providerName`: String (key identifier, defaults to "mock" if null/blank). +- `llamaConfig`: `LlamaCppJniConfig` object for JNI provider configuration. +- `promptSupport`: `AiPromptSupport` object for prompt lookup support. + +#### Output +- Returns an `AiGenerationProvider` instance (`MockAiGenerationProvider` or `LlamaCppJniAiGenerationProvider`). +- Throws `IllegalArgumentException` if `providerName` is unrecognized. + +#### Core logic +- Checks if `providerName` is null or blank; if so, instantiates `MockAiGenerationProvider`. +- Switches on `providerName`: returns `MockAiGenerationProvider` for "mock". +- Switches on `providerName`: instantiates `LlamaCppJniAiGenerationProvider` with provided `llamaConfig` and `promptSupport`. +- Throws exception in default case for unsupported names. + +#### Public API +`create(String providerName, LlamaCppJniConfig llamaConfig, AiPromptSupport promptSupport) -> AiGenerationProvider` + +#### Dependencies +`AiGenerationProvider`, `MockAiGenerationProvider`, `LlamaCppJniAiGenerationProvider`, `Java8CompatibilityHelper`, `LlamaCppJniConfig`, `AiPromptSupport`. + +#### Exceptions / Errors +- Throws `IllegalArgumentException` with message "Unsupported AI provider: " + providerName. + +#### Concurrency +No concurrency indicators; uses standard single-threaded instantiation logic. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..dee4644 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,57 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:57:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides a local Java implementation for generating text using GGUF models via the llama.cpp JNI backend. + +#### Purpose +- Implements `AiGenerationProvider` to run LLM inference locally. +- Manages lazy loading and caching of native GGUF model handles. + +#### Type +Final class; implements `AiGenerationProvider` and `AutoCloseable`; annotated with `@ToString`. + +#### Input +- `LlamaCppJniConfig`: model path, context size, threads, chat template settings. +- `AiPromptSupport`: prompt builder for request rendering. +- `AiGenerationRequest`: input data for generation. +- `float temperatureOverride`: optional temperature override (defaulting to config). + +#### Output +- `String`: generated text completion. +- Side effect: loads native `LlamaModel` handle on first use if not cached; releases handle in `close()`. + +#### Core logic +- Validates and stores configuration and prompt support. +- Lazily instantiates `LlamaModel` using config parameters only when `generate()` is called. +- Constructs inference parameters (messages, chat template, temperature, topP, topK, stop strings) from request and config. +- Executes `model().chatCompleteText()` to obtain completion tokens. +- Parses the raw completion text via `AiCompletionParser` into a clean string result. + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport)`: creates provider with config and prompt support. +- `String generate(AiGenerationRequest)`: generates text using default temperature. +- `String generate(AiGenerationRequest, float)`: generates text with optional temperature override. +- `void close()`: releases native model resources. + +#### Dependencies +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `AiCompletionParser` +- `LlamaModel` +- `InferenceParameters` +- `AiGenerationRequest` +- `Pair` + +#### Exceptions / Errors +- Throws `IOException` during generation if native call fails. +- Throws `NullPointerException` if config or prompt support is null (via `Objects.requireNonNull`). + +#### Concurrency +- Not thread-safe; `LlamaModel` handle must be accessed sequentially. +- Uses immutable builder pattern for inference parameters to avoid concurrency issues during configuration setup. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..854ac5a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,50 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T18:58:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Immutable configuration record for llama.cpp JNI provider settings including library paths, model selection, sampling parameters, and chat template options. + +#### Purpose +- Encapsulates all runtime configuration parameters for the LlamaCppJniProvider. +- Provides immutable accessors for native library paths, model files, and inference tuning values. + +#### Type +Record (final class) with Lombok annotations; extends none; implements none; key generics: List. + +#### Input +Constructor accepts: libraryPath, modelPath, contextSize, maxOutputTokens, temperature, threads, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings. + +#### Output +Returns field values via getters; returns unmodifiable List for stopStrings; no external resources written. + +#### Core logic +- Validates that modelPath is not null during construction. +- Converts null stopStrings to an empty list via Collections.emptyList(). +- Stores all parameters as final fields to ensure immutability. + +#### Public API +libraryPath() -> String <= native library path +modelPath() -> String <= GGUF model file path +contextSize() -> int <= context window size +maxOutputTokens() -> int <= max output tokens +temperature() -> float <= sampling temperature +threads() -> int <= CPU thread count +topP() -> float <= nucleus-sampling threshold +topK() -> int <= top-k limit +repeatPenalty() -> float <= repetition penalty +chatTemplateEnableThinking() -> boolean <= thinking mode enabled +stopStrings() -> List <= unmodifiable stop strings + +#### Dependencies +net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord, java.util.Collections, java.util.List, java.util.Objects, lombok.EqualsAndHashCode, lombok.ToString. + +#### Exceptions / Errors +Throws NullPointerException if modelPath is null; otherwise no exceptions thrown. + +#### Concurrency +Thread-safe due to immutability and final fields; no synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..d3b4a72 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:00:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> A deterministic mock provider generating static summaries for testing AI generation logic. + +#### Purpose +- Provides a no-op implementation of AiGenerationProvider for unit testing. +- Returns a predictable string based on the input file name instead of real processing. + +#### Type +Class; implements AiGenerationProvider; annotated with @ToString; public constructor. + +#### Input +AiGenerationRequest request containing sourceFile path; derived file name from Path object. + +#### Output +String summary formatted as "Mock summary for ". + +#### Core logic +- Extracts fileName from request.sourceFile(). +- Handles null file name fallback by converting full path to string. +- Concatenates static text with fileName to return mock result. + +#### Public API +generate(request) -> String: Creates a deterministic mock summary string. + +#### Dependencies +AiGenerationProvider, AiGenerationRequest, java.io.IOException, java.nio.file.Path. + +#### Exceptions / Errors +Throws IOException; no explicit null checks beyond basic Path utility usage. + +#### Concurrency +Synchronous method with no concurrency concerns. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..1e39de2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,54 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T19:03:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Provides a pluggable local LLM inference engine via llama.cpp JNI, extracting clean model answers by stripping internal reasoning blocks for AI indexing. + +#### Purpose +* Enables local text generation using GGUF models through the llama.cpp native backend. +* Ensures clean data persistence by stripping internal chain-of-thought reasoning before indexing. + +#### Responsibilities +* **Provider Interface**: Defines contracts for generating text from requests, supporting live and mock implementations. +* **Factory & Configuration**: Manages instantiation of providers based on name keys and immutable runtime settings (paths, sampling params). +* **Native Inference**: Executes local LLM inference via JNI, handling lazy model loading and parameter construction. +* **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage. +* **Testing Support**: Provides deterministic mock implementations for unit testing generation logic. + +#### Key units +* `AiGenerationProvider`: Interface defining the contract for generating text from `AiGenerationRequest` objects. +* `LlamaCppJniAiGenerationProvider`: Final class implementing local inference via `LlamaModel` and `InferenceParameters`. +* `LlamaCppJniConfig`: Immutable record holding native library paths, model files, and sampling parameters (temperature, topP, threads). +* `AiCompletionParser`: Utility stripping `THINKING_BLOCK` markers from raw responses to return clean answers. +* `AiGenerationProviderFactory`: Factory selecting and instantiating providers (`Mock`, `LlamaCppJni`) by name string. + +#### Data flow +1. **Request Ingestion**: `AiGenerationRequest` (prompt key, source text) enters the system. +2. **Provider Selection**: `AiGenerationProviderFactory` selects implementation (`Mock` or `LlamaCppJni`) based on `providerName`. +3. **Inference Execution**: + * `LlamaCppJniAiGenerationProvider` lazily loads `LlamaModel` if needed. + * Constructs `InferenceParameters` (messages, chat template) from `LlamaCppJniConfig` and request. + * Calls native `chatCompleteText()` to get raw completion. +4. **Sanitization**: Raw output passed to `AiCompletionParser` to strip internal reasoning blocks. +5. **Output**: Cleaned string returned to caller or stored in AI index. + +#### Dependencies +* **Internal**: `LlamaCppJniConfig`, `AiPromptSupport`, `AiGenerationRequest`, `InferenceParameters`, `Pair`. +* **External Modules**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, native `LlamaModel` (GGUF), `java.io.IOException`, `java.nio.file.Path`. + +#### Cross-cutting +* **Immutability**: `LlamaCppJniConfig` uses final fields and Lombok annotations to ensure thread-safe configuration. +* **Null Safety**: Critical checks for `modelPath` in config and request parameters; throws `NullPointerException` if null. +* **Error Handling**: Centralized `IOException` usage for native failures and incomplete thinking blocks. +* **Resource Management**: `AutoCloseable` pattern ensures native model handles are released via `close()`. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..4f0f491 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,47 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:07:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..d3610ce --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,47 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:08:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..9a69404 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,47 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:10:27Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..e0b8993 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/net/package.ai.md @@ -0,0 +1,47 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:12:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/package.ai.md new file mode 100644 index 0000000..321d159 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/java/package.ai.md @@ -0,0 +1,47 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:13:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/package.ai.md new file mode 100644 index 0000000..9b12f11 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/main/package.ai.md @@ -0,0 +1,47 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:15:08Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/package.ai.md new file mode 100644 index 0000000..c015213 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/package.ai.md @@ -0,0 +1,47 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:16:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. + +#### Purpose +- Enables local LLM inference via JNI using GGUF models while stripping internal chain-of-thought reasoning for clean indexing. +- Orchestrates AI-driven field generation for Maven builds by resolving file extensions to prompt templates and model configurations. + +#### Responsibilities +- **Local Inference Engine**: Executes text generation through `LlamaCppJniAiGenerationProvider` using native bindings, handling lazy model loading and parameter construction. +- **Prompt & Model Management**: Maps source file extensions to specific prompts via `AiFieldGenerationSelector` and resolves model definitions for inference parameters. +- **Data Sanitization**: Parses raw completion text to remove internal thinking blocks before storage or indexing. +- **Configuration Lifecycle**: Manages runtime settings for context size, temperature, and threads across file-level and package-level generation scopes. + +#### Key units +- `LlamaCppJniAiGenerationProvider`: Implements native inference via `LlamaModel` and `InferenceParameters`. +- `AiCompletionParser`: Strips `THINKING_BLOCK` markers from raw responses to return clean answers. +- `AiFieldGenerationConfig`: Links prompt templates and model definitions to file extension filters. +- `AiGenerationProviderFactory`: Selects and instantiates providers (`Mock`, `LlamaCppJni`) by name string. +- `AiModelDefinitionSupport`: Resolves definition keys to active generation configurations via lookup maps. +- `AiGenerationKind`: Enumerates operation scopes (`FILE_SUMMARY`, `PACKAGE_SUMMARY`). + +#### Data flow +1. User POM configuration defines `AiFieldGenerationConfig` mapping extensions to prompts/models. +2. `AiFieldGenerationSelector` matches incoming source files against configs during build execution. +3. `AiGenerationProviderFactory` selects the appropriate provider (e.g., `LlamaCppJni`) based on request settings. +4. Native inference executes via `chatCompleteText()`, producing raw completion containing potential reasoning blocks. +5. `AiCompletionParser` sanitizes the output by stripping internal thinking markers. +6. Cleaned text is returned for AI indexing or stored in the package index. + +#### Dependencies +- **Internal**: `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest`, `LlamaCppJniConfig`, `AiPromptSupport`. +- **External Modules**: `net.ladenthin.llama.parameters.ModelParameters`, native `LlamaModel` (GGUF), `Java8CompatibilityHelper`, standard Java collections. + +#### Cross-cutting +- **Immutability**: Configuration records (`LlamaCppJniConfig`) use final fields and defensive copying to ensure thread safety. +- **Null Safety**: Selectors handle null entries in configuration lists gracefully by skipping or falling back. +- **Resource Management**: Native model handles are released via `AutoCloseable` pattern using `close()`. +- **Error Handling**: Centralized usage of `IOException` for native failures and incomplete thinking blocks. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/project.ai.md new file mode 100644 index 0000000..741b579 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen35-4b__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 07339891 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T19:18:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The `llamacpp-ai-index-maven-plugin` subsystems orchestrate a localized Llama.cpp inference pipeline within Maven builds to generate AI-driven code indices. Core components handle the mapping of source file extensions to custom prompt templates and execute native GGUF model generation for field extraction. The architecture includes a pluggable provider layer that sanitizes raw reasoning outputs from the model, ensuring clean, indexed data while maintaining extensible configuration for different build contexts. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Executes AI-driven field generation for Maven plugin builds by mapping source file extensions to prompt templates and model configurations. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Orchestrates local Llama.cpp inference and field generation for Maven plugin builds by mapping source files to AI prompts and sanitizing reasoning outputs. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides a pluggable local LLM inference engine via llama.cpp JNI, extracting clean model answers by stripping internal reasoning blocks for AI indexing. +- main/java/net/ladenthin/maven/llamacpp — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. +- main/java/net/ladenthin/maven — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. +- main/java/net/ladenthin — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. +- main/java/net — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. +- main/java — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. +- main — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. +- . — Orchestrates local Llama.cpp inference for Maven builds by mapping source files to AI prompts, executing native GGUF generation, and sanitizing reasoning outputs before indexing. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..265ed15 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,49 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:39:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI-driven field generation by linking prompt templates and model definitions for Maven plugin execution. + +#### Purpose +- Associates AI prompt templates with model configurations for field generation. +- Supports file extension-based selection of generation rules. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString annotation. Generics: none. Type bounds: none. + +#### Input +- Constructor takes no parameters. +- Setters accept: String promptKey, String aiDefinitionKey, @Nullable Collection fileExtensions. +- Dependencies: java.util.ArrayList, java.util.Collection, java.util.Collections, java.util.List, org.jspecify.annotations.Nullable, lombok.ToString. + +#### Output +- Getters return: String promptKey, String aiDefinitionKey, @Nullable List fileExtensions. +- Setters mutate internal fields: promptKey, aiDefinitionKey, fileExtensions. +- Defensive copy in setFileExtensions ensures immutability of returned list. + +#### Core logic +- Maps a prompt template key to an AI model definition key for field generation. +- Filters files by optional extensions; fallback behavior when no match. +- Maven plugin configuration object for declarative field generation. + +#### Public API +- getPromptKey() -> String: Retrieves the prompt template identifier. +- setPromptKey(String): Sets the prompt template identifier. +- getAiDefinitionKey() -> String: Retrieves the AI model definition identifier. +- setAiDefinitionKey(String): Sets the AI model definition identifier. +- getFileExtensions() -> @Nullable List: Returns file extension filter list. +- setFileExtensions(@Nullable Collection): Assigns file extension filter. + +#### Dependencies +java.util.ArrayList, java.util.Collection, java.util.Collections, java.util.List, lombok.ToString, org.jspecify.annotations.Nullable + +#### Exceptions / Errors +No explicit throws. Defensive copying prevents external mutation of fileExtensions list. + +#### Concurrency +No concurrency handling; class is not thread-safe. Intended for Maven plugin configuration use only. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..4bcb8ef --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,53 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:41:44Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects appropriate AI field generation configuration based on file extensions and fallback rules. + +#### Purpose +- Matches source files to AI prompt configurations by file extension. +- Provides fallback behavior when no matching extension is found. + +#### Type +Class, final. No extends or implements. Uses @ToString annotation. Generic type: Iterable. + +#### Input +- Constructor takes no parameters. +- Method `selectForFileName` consumes: + - configs: Iterable of AiFieldGenerationConfig, may contain nulls + - fileName: String representing a file name (e.g., "Foo.java") + +#### Output +- Method returns @Nullable AiFieldGenerationConfig. +- Returns first matching config by extension or first fallback config if none match. +- Returns null when no match and no fallback is present. + +#### Core logic +- Iterates through configured AiFieldGenerationConfig entries. +- Skips null configs in the input iterable. +- For each config, checks if it has an empty or absent file extension list; tracks first such entry as fallback. +- For non-empty extension lists, checks if fileName ends with any of those extensions. +- Returns matching config immediately upon first match. +- Falls back to tracked fallback config if no extension matches. +- Returns null if no match and no fallback exists. + +#### Public API +- `selectForFileName(configs, fileName) -> AiFieldGenerationConfig` selects configuration by file name + +#### Dependencies +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable +- AiFieldGenerationConfig + +#### Exceptions / Errors +- Null handling: skips null entries in configs iterable. +- Returns null when no matching config and no fallback is configured. + +#### Concurrency +- No concurrency concerns; class is stateless and method is pure. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..8c30edb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,84 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:42:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures parameters for AI model inference steps including context size, sampling, retries, and input limits. + +#### Purpose +- Carries AI generation settings between Maven plugin and provider implementations. +- Manages mutable configuration state for llama.cpp inference parameters. + +#### Type +class public final +extends Object +implements + +#### Input +- Constructor takes no parameters; initializes defaults. +- Setters accept primitive types, strings, lists, and nullables. +- Dependencies: Lombok for `@ToString`, `org.jspecify.annotations.Nullable`. + +#### Output +- Getters return fields directly or unmodifiable views of collections. +- Side effects: mutation of instance state via setters. + +#### Core logic +- Holds mutable configuration fields for AI inference parameters. +- Provides default constants for context size, output tokens, temperature, threads, etc. +- Manages automatic input character calculation based on token ratios. +- Supports retry logic with incremental temperature adjustments. +- Controls stop strings and chat template thinking mode. + +#### Public API +- getModelPath() -> String +- setModelPath(String) -> void +- getContextSize() -> int +- setContextSize(int) -> void +- getMaxOutputTokens() -> int +- setMaxOutputTokens(int) -> void +- getTemperature() -> float +- setTemperature(float) -> void +- getThreads() -> int +- setThreads(int) -> void +- getCharsPerToken() -> int +- setCharsPerToken(int) -> void +- getMaxInputChars() -> int +- setMaxInputChars(int) -> void +- isWarnOnTrim() -> boolean +- setWarnOnTrim(boolean) -> void +- getMaxRetries() -> int +- setMaxRetries(int) -> void +- getRetryTemperatureIncrement() -> float +- setRetryTemperatureIncrement(float) -> void +- getTopP() -> float +- setTopP(float) -> void +- getTopK() -> int +- setTopK(int) -> void +- getRepeatPenalty() -> float +- setRepeatPenalty(float) -> void +- isChatTemplateEnableThinking() -> boolean +- setChatTemplateEnableThinking(boolean) -> void +- getStopStrings() -> List +- setStopStrings(List) -> void + +#### Dependencies +- java.util.ArrayList +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No explicit throws. +- Null handling via `@Nullable` annotation on `stopStrings`. +- Default values prevent null pointer access. + +#### Concurrency +- Instance is mutable and not thread-safe. +- Intended for use in single-threaded Maven plugin context. +- Fields are accessed directly without synchronization. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..7bea948 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,40 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:45:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies the scope of AI generation tasks for source files or packages + +#### Purpose +- Distinguishes AI generation modes for individual files vs. package-level aggregates +- Supports configuration of AI processing workflows + +#### Type +Enum, final. No extends or implements clauses. + +#### Input +None directly consumed. Enum constants defined statically. + +#### Output +None produced. Constants serve as labeled identifiers. + +#### Core logic +- Defines two distinct AI generation modes: FILE_SUMMARY and PACKAGE_SUMMARY +- Represents discrete processing scopes for automated code analysis + +#### Public API +- FILE_SUMMARY() -> AiGenerationKind - single file analysis mode +- PACKAGE_SUMMARY() -> AiGenerationKind - package aggregate analysis mode + +#### Dependencies +None imported. No external type references. + +#### Exceptions / Errors +None thrown or caught. No null handling required. + +#### Concurrency +No concurrency concerns. Enum constants are immutable and thread-safe by design. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..83cac88 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,81 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:45:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines reusable AI model configurations for Maven plugin field generation. + +#### Purpose +- Stores AI model parameters for reuse across multiple field-generation tasks. +- Maps configuration entries to lookup keys for reference by other plugin components. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString annotation. Fields are private with public getters/setters. + +#### Input +- Constructor accepts no arguments; defaults initialized from AiGenerationConfig. +- Setters accept parameters to configure model-specific properties including key, modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, warnOnTrim, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking, and stopStrings. + +#### Output +- Getters return internal state values or unmodifiable views of collections. +- Setters mutate internal fields; stopStrings is copied to new ArrayList before assignment. + +#### Core logic +- Provides a JavaBean configuration object for Maven plugin AI model settings. +- Supports default value inheritance from AiGenerationConfig constants. +- Enables lookup by key from AiFieldGenerationConfig. +- Manages mutable state through standard getter/setter accessors. + +#### Public API +- getKey() -> String +- setKey(String) -> void +- getModelPath() -> String +- setModelPath(String) -> void +- getContextSize() -> int +- setContextSize(int) -> void +- getMaxOutputTokens() -> int +- setMaxOutputTokens(int) -> void +- getTemperature() -> float +- setTemperature(float) -> void +- getThreads() -> int +- setThreads(int) -> void +- getCharsPerToken() -> int +- setCharsPerToken(int) -> void +- isWarnOnTrim() -> boolean +- setWarnOnTrim(boolean) -> void +- getMaxRetries() -> int +- setMaxRetries(int) -> void +- getRetryTemperatureIncrement() -> float +- setRetryTemperatureIncrement(float) -> void +- getTopP() -> float +- setTopP(float) -> void +- getTopK() -> int +- setTopK(int) -> void +- getRepeatPenalty() -> float +- setRepeatPenalty(float) -> void +- isChatTemplateEnableThinking() -> boolean +- setChatTemplateEnableThinking(boolean) -> void +- getStopStrings() -> List +- setStopStrings(Collection) -> void + +#### Dependencies +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable +- net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig +- net.ladenthin.llama.parameters.ModelParameters + +#### Exceptions / Errors +- Null handling for stopStrings; null-checks and defensive copying applied. +- No explicit exception throwing. + +#### Concurrency +- Not thread-safe due to mutable state. +- Designed for single-threaded use during Maven plugin configuration phase. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..274a9da --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,42 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:48:08Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to produce generation configurations for use in field generation tasks. + +#### Purpose +- Maps AI model definition keys to ready-to-use generation configs. +- Enforces required fields and validates configuration at build time. + +#### Type +Final class extending no types; implements no interfaces. Generics: none. Annotations: @ToString. + +#### Input +Constructor takes List; throws NullPointerException for null keys. getConfig method takes String key. + +#### Output +getConfig returns AiGenerationConfig; toConfig produces AiGenerationConfig from AiModelDefinition. Side effect: throws IllegalArgumentException for missing keys. + +#### Core logic +- Builds internal HashMap from list of AiModelDefinition entries using their keys. +- Validates each definition has a non-null key during construction. +- Converts each AiModelDefinition into an AiGenerationConfig via field copying. +- Looks up AiGenerationConfig by key; throws exception if not found. + +#### Public API +getConfig(key) -> AiGenerationConfig: retrieves generation config by key +toConfig(definition) -> AiGenerationConfig: converts definition to config + +#### Dependencies +Imports: java.util.HashMap, java.util.List, java.util.Map, java.util.Objects, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper, net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition, net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig + +#### Exceptions / Errors +Throws NullPointerException for null keys in definitions list. Throws IllegalArgumentException for missing keys during lookup. + +#### Concurrency +No concurrency controls; class is immutable after construction. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..1655104 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,49 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:54:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Configures and manages AI-driven code generation workflows for Maven plugins, enabling field-level analysis and summarization of source files using customizable model parameters and prompt templates. + +#### Purpose +- Defines AI model configurations and generation parameters for Maven plugin execution. +- Supports declarative setup of AI inference settings with fallback behaviors. + +#### Responsibilities +- **Configuration Management**: Handles AI model definitions, generation configs, and field generation rules. +- **File Selection Logic**: Matches source files to appropriate AI processing configurations based on extensions. +- **Inference Parameters**: Manages mutable settings for context size, sampling, retries, and input limits used in llama.cpp inference. + +#### Key units +- AiFieldGenerationConfig: Maps prompt templates to model definitions with file extension filters. +- AiFieldGenerationSelector: Selects appropriate config by file name using extension matching and fallback rules. +- AiGenerationConfig: Carries mutable AI inference parameters like context size, temperature, and stop strings. +- AiGenerationKind: Enum distinguishing FILE_SUMMARY and PACKAGE_SUMMARY processing modes. +- AiModelDefinition: Reusable model configuration with key-based lookup support. +- AiModelDefinitionSupport: Resolves model definitions into generation configs with validation. + +#### Data flow +- Maven plugin reads AiFieldGenerationConfig entries to determine which prompt/template to apply per file. +- AiFieldGenerationSelector matches input file names against configured extensions and selects the appropriate config. +- Selected config references an AiModelDefinition through aiDefinitionKey, which is resolved via AiModelDefinitionSupport into a concrete AiGenerationConfig. +- AiGenerationConfig carries inference parameters used by the llama.cpp backend for AI processing. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiGenerationKind, AiModelDefinition, AiModelDefinitionSupport +- External: Lombok (@ToString), org.jspecify.annotations.Nullable, java.util packages + +#### Cross-cutting +- Defensive copying in setters ensures immutability of returned collections. +- Null handling via @Nullable annotations and explicit null checks. +- Thread safety considerations: classes are not thread-safe; intended for single-threaded Maven plugin use only. +- Configuration validation at construction time (e.g., null keys in AiModelDefinitionSupport). diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..dd65091 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,49 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:58:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..b85ec4f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,43 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:49:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract and clean model answers by removing internal reasoning blocks. + +#### Purpose +- Strips Gemma-4 thinking blocks from model responses. +- Provides cleaned answer text for AI index storage. + +#### Type +Class, non-final. Implements no interfaces. Uses @ToString annotation. + +#### Input +- Constructor takes no parameters. +- Method parseCompletion(String) consumes raw completion text (may be null). + +#### Output +- Returns cleaned string with internal reasoning removed. +- Throws IOException when token budget is exhausted inside a thinking block. + +#### Core logic +- Checks for presence of THINKING_BLOCK_END_MARKER in input. +- If found, removes everything up to and including the end marker. +- If THINKING_BLOCK_START_MARKER exists without END_MARKER, throws IOException. +- Otherwise returns trimmed input string. + +#### Public API +parseCompletion(response) -> String Cleans model response by stripping reasoning blocks. + +#### Dependencies +java.io.IOException, lombok.ToString + +#### Exceptions / Errors +Throws IOException when THINKING_BLOCK_START_MARKER is present but END_MARKER is missing due to token limit exhaustion. + +#### Concurrency +No concurrency concerns; stateless class with immutable constants. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..bb5e158 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:49:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides pluggable text generation for AI inference requests, supporting local and mock backends. + +#### Purpose +- Defines a contract for generating text from AI prompts. +- Enables flexible backend implementations for inference tasks. + +#### Type +Interface, no modifiers. Implements AutoCloseable. + +#### Input +- `AiGenerationRequest` object containing prompt key, source file, source text, and current header. +- Optional `float temperatureOverride` parameter in overloaded method. + +#### Output +- Generated text as `String`; never null. +- Throws `IOException` on failure. + +#### Core logic +- Generates textual output based on input request. +- Supports overriding sampling temperature for retry strategies. +- Delegates to default implementation if not overridden. + +#### Public API +- `generate(AiGenerationRequest) -> String` produces text from request. +- `generate(AiGenerationRequest, float) -> String` overrides temperature for a single call. + +#### Dependencies +- `AiGenerationRequest` +- `IOException` +- `AutoCloseable` + +#### Exceptions / Errors +- Throws `IOException` on backend failure. +- Guarantees non-null return value. + +#### Concurrency +- No explicit concurrency handling; assumes thread-safe usage of implementations. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..cfd575b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,53 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:50:26Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an AI text generation provider implementation based on a name identifier. + +#### Purpose +- Instantiates AI generation providers +- Maps provider names to concrete implementations + +#### Type +class public final +extends Object +implements no interfaces +generics no type bounds +annotations @ToString + +#### Input +- Constructor: no parameters +- Method create: providerName (String), llamaConfig (LlamaCppJniConfig), promptSupport (AiPromptSupport) + +#### Output +- Return type: AiGenerationProvider +- Side effects: none +- State mutation: none + +#### Core logic +- Checks if providerName is null or blank, returns MockAiGenerationProvider +- Uses switch statement to match providerName against "mock" or "llamacpp-jni" +- Throws IllegalArgumentException for unrecognized provider names + +#### Public API +create(providerName, llamaConfig, promptSupport) -> AiGenerationProvider selects and creates AI provider instance + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniAiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniConfig + +#### Exceptions / Errors +- IllegalArgumentException thrown when providerName is not recognized +- Null handling for providerName parameter + +#### Concurrency +No concurrency considerations noted diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..33d506b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,57 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:51:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI responses using a local GGUF model via JNI bindings, supporting customizable inference parameters and prompt templating. + +#### Purpose +- Provides AI text generation using a native llama.cpp backend. +- Supports dynamic configuration of inference parameters and prompt rendering. + +#### Type +Final class implementing `AiGenerationProvider` and `AutoCloseable`. Uses Lombok's `@ToString` with `@ToString.Exclude` for native model handle. + +#### Input +- Constructor accepts `LlamaCppJniConfig` and `AiPromptSupport`. +- `generate` methods take `AiGenerationRequest` and optional `temperatureOverride`. +- Reads model path, context size, thread count, and other config from `LlamaCppJniConfig`. + +#### Output +- Returns generated AI text as a `String`. +- Mutates internal `model` field on first use. +- Closes native `LlamaModel` handle during `close()`. + +#### Core logic +- Lazily initializes native `LlamaModel` on first `generate()` call. +- Builds prompt using `AiPromptSupport`. +- Configures inference parameters via `InferenceParameters` chain. +- Invokes `chatCompleteText` on the model with configured parameters. +- Parses output using `AiCompletionParser`. + +#### Public API +- `generate(AiGenerationRequest) -> String` Generates AI text with default temperature. +- `generate(AiGenerationRequest, float) -> String` Generates AI text with custom temperature. +- `close() -> void` Releases native model resources. + +#### Dependencies +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `AiCompletionParser` +- `LlamaModel` +- `InferenceParameters` +- `ModelParameters` +- `Pair` +- `AiGenerationRequest` + +#### Exceptions / Errors +- Throws `IOException` during model inference or prompt building. +- Null checks on constructor parameters and prompt support. + +#### Concurrency +- Not thread-safe; native `LlamaModel` is not marked as thread-safe. +- Lazy initialization uses double-checked locking pattern for model. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..89d5919 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,51 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:52:15Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures native llama.cpp inference parameters for AI model execution. + +#### Purpose +- Encapsulates immutable settings for JNI-based llama.cpp model invocation. +- Provides a structured interface for configuring model behavior and resource limits. + +#### Type +Final class implementing value semantics via Lombok annotations. Implements `equals`, `hashCode`, and `toString`. Fields are private and final; accessors follow record-style naming. + +#### Input +Constructor accepts 11 parameters including `libraryPath`, `modelPath`, `contextSize`, `maxOutputTokens`, `temperature`, `threads`, `topP`, `topK`, `repeatPenalty`, `chatTemplateEnableThinking`, and `stopStrings`. `modelPath` is required; `stopStrings` may be null, treated as empty list. + +#### Output +Accessors return field values directly. `stopStrings()` returns an immutable view of the internal list. No mutation or side effects occur during access. + +#### Core logic +- Validates that `modelPath` is not null. +- Assigns constructor parameters to private fields. +- Converts null `stopStrings` to empty immutable list. +- Exposes all configuration values through getter-style methods. + +#### Public API +- `libraryPath() -> String` retrieves native library path. +- `modelPath() -> String` retrieves GGUF model file path. +- `contextSize() -> int` retrieves context window size. +- `maxOutputTokens() -> int` retrieves maximum output tokens. +- `temperature() -> float` retrieves sampling temperature. +- `threads() -> int` retrieves CPU thread count. +- `topP() -> float` retrieves nucleus-sampling threshold. +- `topK() -> int` retrieves top-k sampling limit. +- `repeatPenalty() -> float` retrieves repetition penalty. +- `chatTemplateEnableThinking() -> boolean` retrieves thinking mode flag. +- `stopStrings() -> List` retrieves immutable stop strings. + +#### Dependencies +java.util.Collections, java.util.List, java.util.Objects, lombok.EqualsAndHashCode, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +Throws `NullPointerException` if `modelPath` is null. Null `stopStrings` results in empty list, not exception. + +#### Concurrency +Immutable design ensures thread safety. No synchronization required. All fields are final and accessed via immutable views. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..17a1aa2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,47 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:53:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides deterministic mock AI summaries for testing purposes. + +#### Purpose +- Supplies fake AI-generated content for unit tests. +- Enables isolated testing of components dependent on AI generation. + +#### Type +- Class, final +- Implements AiGenerationProvider +- Uses Lombok @ToString annotation + +#### Input +- Constructor takes no parameters +- Method generate() consumes AiGenerationRequest with sourceFile Path + +#### Output +- Returns String summary prefixed with "Mock summary for " +- Side effect: none + +#### Core logic +- Extracts filename from request's source file path +- Constructs deterministic mock response using filename + +#### Public API +- generate(request) → String Generates mock AI summary for given request + +#### Dependencies +- java.io.IOException +- java.nio.file.Path +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider + +#### Exceptions / Errors +- Throws IOException from generate method (not handled internally) + +#### Concurrency +- No concurrency considerations; stateless implementation diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..ee69311 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,56 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T22:56:51Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Enables pluggable local and mock AI text generation for code indexing, with support for native llama.cpp inference and reasoning block parsing. + +#### Purpose +- Provides flexible AI inference backends for generating code summaries. +- Supports both local GGUF model execution and deterministic mock responses for testing. + +#### Responsibilities +- AI text generation via JNI-bound llama.cpp models +- Mock AI response generation for unit testing +- Parsing of LLM completion outputs to remove internal reasoning +- Configuration management for native inference parameters + +#### Key units +- **AiCompletionParser** cleans model outputs by stripping thinking blocks +- **AiGenerationProvider** defines the contract for text generation +- **AiGenerationProviderFactory** selects and instantiates AI providers +- **LlamaCppJniAiGenerationProvider** implements local GGUF model inference +- **LlamaCppJniConfig** holds immutable configuration for llama.cpp invocation +- **MockAiGenerationProvider** supplies deterministic mock summaries + +#### Data flow +1. Input request with prompt and source file is passed to `AiGenerationProvider` +2. Factory selects appropriate provider (`LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`) +3. Provider builds prompt using `AiPromptSupport`, configures inference, and calls native model +4. Raw completion text is processed by `AiCompletionParser` to remove reasoning blocks +5. Cleaned output is returned for indexing + +#### Dependencies +- Native llama.cpp library via JNI bindings +- `AiPromptSupport` for prompt templating +- `LlamaModel` and related inference classes from native bindings +- `AiGenerationRequest` for input structure +- `ConvertToRecord` for configuration value semantics + +#### Cross-cutting +- All providers implement `AiGenerationProvider` interface +- Shared exception handling via `IOException` +- Lombok annotations (`@ToString`, `@EqualsAndHashCode`) for boilerplate +- Immutable configuration objects (`LlamaCppJniConfig`) +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider` +- Thread safety considerations noted for native model usage diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..7e71b93 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T22:59:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..88b309b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:00:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..154236b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:01:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..d093d1b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/net/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:02:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/package.ai.md new file mode 100644 index 0000000..b69a9f4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/java/package.ai.md @@ -0,0 +1,48 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:03:51Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/package.ai.md new file mode 100644 index 0000000..a5d19e2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/main/package.ai.md @@ -0,0 +1,48 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:04:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/package.ai.md new file mode 100644 index 0000000..621ef30 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/package.ai.md @@ -0,0 +1,48 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:05:48Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Automates intelligent code summarization and indexing for Java projects using configurable AI backends. + +#### Purpose +- Configures AI workflows for analyzing and summarizing Java source files. +- Enables flexible, pluggable text generation backends including local llama.cpp models and mock responses. + +#### Responsibilities +- **Configuration Management**: Defines AI model settings, prompt templates, and file selection rules. +- **Inference Execution**: Provides local GGUF model support via JNI and deterministic mocking for testing. +- **Output Processing**: Cleans AI completions by removing internal reasoning blocks for clean indexing. + +#### Key units +- AiFieldGenerationConfig: Maps file extensions to prompt templates and model definitions. +- AiFieldGenerationSelector: Matches input files to appropriate generation configurations. +- AiGenerationConfig: Carries mutable inference parameters for llama.cpp. +- AiGenerationProvider: Interface for AI text generation implementations. +- LlamaCppJniAiGenerationProvider: Implements native GGUF model inference using JNI. +- MockAiGenerationProvider: Supplies deterministic mock responses for testing. +- AiCompletionParser: Strips reasoning blocks from raw AI outputs. + +#### Data flow +- Maven plugin loads AiFieldGenerationConfig entries to match files with prompt templates. +- AiFieldGenerationSelector resolves the correct config by file extension. +- Config references an AiModelDefinition, resolved into AiGenerationConfig via AiModelDefinitionSupport. +- AiGenerationProviderFactory selects between LlamaCppJniAiGenerationProvider or MockAiGenerationProvider. +- Input prompts are processed through AiPromptSupport, native inference is called, and output is cleaned by AiCompletionParser. + +#### Dependencies +- Internal: AiFieldGenerationConfig, AiFieldGenerationSelector, AiGenerationConfig, AiModelDefinition, AiModelDefinitionSupport, AiGenerationProviderFactory, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, AiCompletionParser +- External: Native llama.cpp via JNI bindings, Lombok annotations, org.jspecify.annotations.Nullable + +#### Cross-cutting +- Defensive copying in setters ensures immutability of collections. +- Null handling with @Nullable and explicit checks across configuration classes. +- Thread safety: Not thread-safe; designed for single-threaded Maven plugin use. +- Immutable configuration objects (`LlamaCppJniConfig`) enforce consistency. +- Stateful lazy initialization in `LlamaCppJniAiGenerationProvider`. +- Shared exception handling via IOException. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/project.ai.md new file mode 100644 index 0000000..17736f5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: DB079F76 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:06:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +This Maven plugin automates AI-powered code summarization and indexing for Java projects through configurable inference backends. The core subsystem handles field-level analysis and source file summarization using customizable model parameters and prompt templates. The provider module enables pluggable local and mock AI text generation with support for native llama.cpp inference and reasoning block parsing. These components work together to deliver intelligent code indexing capabilities across the entire project structure. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Configures and manages AI-driven code generation workflows for Maven plugins, enabling field-level analysis and summarization of source files using customizable model parameters and prompt templates. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Enables pluggable local and mock AI text generation for code indexing, with support for native llama.cpp inference and reasoning block parsing. +- main/java/net/ladenthin/maven/llamacpp — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- main/java/net/ladenthin/maven — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- main/java/net/ladenthin — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- main/java/net — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- main/java — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- main — Automates AI-powered code summarization and indexing for Maven projects using configurable inference backends. +- . — Automates intelligent code summarization and indexing for Java projects using configurable AI backends. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..d53459d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,62 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T15:50:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI-driven field generation by linking prompt templates and model definitions for Maven plugin execution. + +#### Purpose +- Maps AI prompt templates to model configurations for field generation. +- Supports file extension filtering for targeted generation. + +#### Type +class public final +extends java.lang.Object +implements no interfaces +generics no type bounds +annotations @ToString, @SuppressWarnings + +#### Input +- Constructor: no parameters. +- Method parameters: setPromptKey(String), setAiDefinitionKey(String), setFileExtensions(Collection). +- Fields read: promptKey, aiDefinitionKey, fileExtensions. +- Dependencies injected via setters. + +#### Output +- Return types: getPromptKey(), getAiDefinitionKey(), getFileExtensions(). +- State mutated: promptKey, aiDefinitionKey, fileExtensions. +- Side effects: defensive copy in setFileExtensions(). + +#### Core logic +- Associates a prompt template key with an AI model definition key. +- Filters files by extension list or applies as fallback. +- Provides getter/setter access for configuration fields. + +#### Public API +- getPromptKey() -> String selects the prompt template. +- setPromptKey(String) -> void assigns the prompt template key. +- getAiDefinitionKey() -> String selects the AI model definition. +- setAiDefinitionKey(String) -> void assigns the AI model definition key. +- getFileExtensions() -> List filters files by extension. +- setFileExtensions(Collection) -> void sets file extension filter. + +#### Dependencies +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No explicit throws. +- Null handling in getFileExtensions() and setFileExtensions(). +- Defensive copying prevents external mutation of fileExtensions. + +#### Concurrency +- Not thread-safe due to mutable fields. +- No synchronization mechanisms. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..727bc86 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,52 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T15:52:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects AI field generation configuration based on file extensions and fallback rules. + +#### Purpose +- Matches source files to AI prompt configurations by file extension. +- Provides fallback behavior when no extension matches. + +#### Type +Class, final. No extends or implements. Generics: Iterable. Annotations: @ToString. + +#### Input +- Constructor takes no parameters. +- Method `selectForFileName` consumes: + - configs: Iterable of AiFieldGenerationConfig, may contain nulls + - fileName: String, e.g. "Foo.java" + +#### Output +- Method returns @Nullable AiFieldGenerationConfig. +- Null when no matching config or fallback is found. + +#### Core logic +- Iterates through AiFieldGenerationConfig entries in order. +- Skips null configs. +- For each config: + - If file extensions list is empty/absent, stores as fallback if not already set. + - Otherwise checks if fileName ends with any extension in the list. + - Returns first matching config. +- Returns fallback if no match found. + +#### Public API +- `selectForFileName(configs, fileName) -> AiFieldGenerationConfig` selects config by file extension + +#### Dependencies +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable +- AiFieldGenerationConfig + +#### Exceptions / Errors +- Null handling: skips null configs in Iterable. +- Returns null when no match and no fallback. + +#### Concurrency +- No concurrency concerns; stateless class with immutable inputs. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..e8a92fc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,85 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T15:53:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures parameters for AI model inference steps including context size, sampling settings, and retry logic. + +#### Purpose +- Carries AI generation parameters between Maven configuration and provider implementations. +- Supports mutable JavaBean style configuration through setters. + +#### Type +class public final +extends Object +implements + +#### Input +- Constructor parameters: none +- Method parameters: all setter methods accept primitive or collection types +- Dependencies: Lombok for `@ToString`, JSpecify for `@Nullable` + +#### Output +- Return types: primitives, String, List +- State mutations: fields modified by setters +- Side effects: none explicitly + +#### Core logic +- Holds mutable configuration state for AI inference +- Provides default values for all configurable parameters +- Manages automatic calculation of input character limits based on token counts +- Supports retry behavior with increasing temperature +- Exposes stop strings as an unmodifiable list + +#### Public API +- getModelPath() -> String +- setModelPath(String) -> void +- getContextSize() -> int +- setContextSize(int) -> void +- getMaxOutputTokens() -> int +- setMaxOutputTokens(int) -> void +- getTemperature() -> float +- setTemperature(float) -> void +- getThreads() -> int +- setThreads(int) -> void +- getCharsPerToken() -> int +- setCharsPerToken(int) -> void +- getMaxInputChars() -> int +- setMaxInputChars(int) -> void +- isWarnOnTrim() -> boolean +- setWarnOnTrim(boolean) -> void +- getMaxRetries() -> int +- setMaxRetries(int) -> void +- getRetryTemperatureIncrement() -> float +- setRetryTemperatureIncrement(float) -> void +- getTopP() -> float +- setTopP(float) -> void +- getTopK() -> int +- setTopK(int) -> void +- getRepeatPenalty() -> float +- setRepeatPenalty(float) -> void +- isChatTemplateEnableThinking() -> boolean +- setChatTemplateEnableThinking(boolean) -> void +- getStopStrings() -> List +- setStopStrings(List) -> void + +#### Dependencies +- java.util.ArrayList +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No explicit exceptions thrown +- Null handling via `@Nullable` annotation on `getStopStrings()` and `setStopStrings()` +- Default values prevent null field access + +#### Concurrency +- Not thread-safe due to mutable state +- Intended for use in single-threaded Maven plugin context +- Identity-based equality used instead of generated equals/hashCode diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..adc3b7f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,36 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T15:56:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Determines whether AI generation processes individual files or entire packages + +#### Purpose +- Distinguishes AI processing scope for code analysis +- Supports configuration of generation strategies + +#### Type +Enum, final + +#### Core logic +- Defines two generation modes: FILE_SUMMARY and PACKAGE_SUMMARY +- Represents discrete AI processing strategies based on scope + +#### Public API +- FILE_SUMMARY() -> AiGenerationKind: Single file analysis mode +- PACKAGE_SUMMARY() -> AiGenerationKind: Package aggregate analysis mode + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationKind + +#### Exceptions / Errors +- No explicit exceptions handled +- Null handling not applicable for enum values + +#### Concurrency +- Enum is inherently immutable and thread-safe +- No synchronization required for usage diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..8594a5f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,78 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T15:56:43Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines reusable AI model configurations for Maven plugin field generation. + +#### Purpose +- Stores AI model parameters for reuse across multiple generation tasks. +- Supports Maven plugin configuration via JavaBean setters. + +#### Type +Class, final. Implements no interfaces. Generics: none. Annotations: @ToString, @SuppressWarnings. + +#### Input +- Constructor: no parameters. +- Setters: key, modelPath, contextSize, maxOutputTokens, temperature, threads, charsPerToken, warnOnTrim, maxRetries, retryTemperatureIncrement, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings. +- Dependencies: AiGenerationConfig defaults. + +#### Output +- Getters return stored values or unmodifiable collections. +- State changes via setter methods. + +#### Core logic +- Holds configuration values for AI model inference. +- Provides default values from AiGenerationConfig. +- Supports immutable access to stopStrings list. +- Enables Maven plugin instantiation via reflection-based injection. + +#### Public API +- getKey() -> String +- setKey(String) +- getModelPath() -> String +- setModelPath(String) +- getContextSize() -> int +- setContextSize(int) +- getMaxOutputTokens() -> int +- setMaxOutputTokens(int) +- getTemperature() -> float +- setTemperature(float) +- getThreads() -> int +- setThreads(int) +- getCharsPerToken() -> int +- setCharsPerToken(int) +- isWarnOnTrim() -> boolean +- setWarnOnTrim(boolean) +- getMaxRetries() -> int +- setMaxRetries(int) +- getRetryTemperatureIncrement() -> float +- setRetryTemperatureIncrement(float) +- getTopP() -> float +- setTopP(float) +- getTopK() -> int +- setTopK(int) +- getRepeatPenalty() -> float +- setRepeatPenalty(float) +- isChatTemplateEnableThinking() -> boolean +- setChatTemplateEnableThinking(boolean) +- getStopStrings() -> List +- setStopStrings(Collection) + +#### Dependencies +- java.util.ArrayList, java.util.Collection, java.util.Collections, java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable +- net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig + +#### Exceptions / Errors +- Null handling: stopStrings may be null; returned list is unmodifiable. +- No explicit exceptions thrown. + +#### Concurrency +- Not thread-safe due to mutable state. +- No synchronization mechanisms. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..3271857 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,41 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T15:59:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to provide configured generation settings for AI field generation. + +#### Purpose +- Maps AI model definition keys to ready-to-use generation configurations. +- Enforces required fields and validates configuration at build time. + +#### Type +Final class extending no types; implements no interfaces. Uses generics: Map. Key annotations: @ToString. + +#### Input +Constructor takes List; each definition must have a non-null key. Dependencies include Java8CompatibilityHelper. + +#### Output +Returns AiGenerationConfig for valid keys; throws IllegalArgumentException for missing keys. Produces HashMap of configs from definitions. + +#### Core logic +- Builds lookup map from input definitions, ensuring no null keys. +- Maps each definition to a generation config via field copying. +- Provides fast key-based retrieval with error handling for missing keys. + +#### Public API +getConfig(key) -> AiGenerationConfig: retrieves config by key +toConfig(definition) -> AiGenerationConfig: converts model def to gen config + +#### Dependencies +Imports: java.util.HashMap, java.util.List, java.util.Map, java.util.Objects, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper, net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition, net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig + +#### Exceptions / Errors +Throws NullPointerException for null keys in definitions; IllegalArgumentException for missing keys during lookup. + +#### Concurrency +No concurrency considerations noted. Class is immutable post-construction. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package-info.java.ai.md new file mode 100644 index 0000000..5e447ba --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package-info.java.ai.md @@ -0,0 +1,42 @@ +### package-info.java +- H: 1.0 +- C: 119B56BD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:00:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines configuration and model lookup mechanisms for AI indexing in Maven projects. + +#### Purpose +- Configures generation parameters for AI-driven code indexing +- Provides model definitions and lookup utilities for LlamaCpp integration + +#### Type +package `net.ladenthin.maven.llamacpp.aiindex.config` + +#### Input +- Package-level documentation comments +- No constructor or method parameters +- No injected dependencies or consumed fields + +#### Output +- No return types or side effects +- No produced state or mutated fields + +#### Core logic +- Establishes package structure for AI indexing configuration +- Supports model definition and lookup functionality + +#### Public API +- No public/protected members + +#### Dependencies +- No imports or referenced types + +#### Exceptions / Errors +- No exceptions or null-handling mentioned + +#### Concurrency +- No concurrency considerations applicable diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..2834a4a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,54 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: D29D30C8 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:10:35Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> Configures and manages AI-driven code indexing and generation for Maven projects using model definitions, prompt templates, and generation parameters. + +#### Purpose +- Defines AI model configurations and generation parameters for Maven plugin execution. +- Supports field-level code generation based on file extensions and prompt templates. + +#### Responsibilities +- AI configuration management: encapsulates settings for AI inference including context size, sampling, and retry logic. +- Prompt and model mapping: links prompt templates to AI model definitions for targeted field generation. +- File extension filtering: selects appropriate configurations based on source file types. +- Model lookup and validation: resolves model definitions by key with build-time checks. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions and filters files by extension. +- AiFieldGenerationSelector: matches source files to field generation configurations using extension-based logic. +- AiGenerationConfig: carries AI inference parameters such as context size, temperature, and retry settings. +- AiGenerationKind: distinguishes between file-level and package-level AI processing scopes. +- AiModelDefinition: stores reusable AI model parameters for Maven plugin use. +- AiModelDefinitionSupport: resolves model definitions into ready-to-use generation configurations with key-based lookup. + +#### Data flow +- Input files are matched to AiFieldGenerationConfig entries by extension. +- Matching configs link to AiModelDefinition instances via keys. +- AiModelDefinitionSupport resolves these definitions into AiGenerationConfig objects. +- These configurations drive AI inference parameters for code analysis or generation tasks. + +#### Dependencies +- java.util.ArrayList, Collections, List +- lombok.ToString, @SuppressWarnings +- org.jspecify.annotations.Nullable +- AiGenerationConfig, AiModelDefinition +- Java8CompatibilityHelper + +#### Cross-cutting +- Shared use of Lombok annotations for boilerplate reduction. +- Null safety via @Nullable annotations and defensive copying in collections. +- Immutable access patterns for configuration lists like stopStrings. +- Thread-safety considerations: all classes are mutable and not thread-safe; intended for single-threaded Maven contexts. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationRequest.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationRequest.java.ai.md new file mode 100644 index 0000000..af05a00 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationRequest.java.ai.md @@ -0,0 +1,43 @@ +### AiGenerationRequest.java +- H: 1.0 +- C: BE482ECE +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:00:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Encapsulates input for AI content generation requests, including prompt template, source file, and header data. + +#### Purpose +- Carries immutable data for AI generation tasks. +- Supports mapping of source files to AI prompt templates and headers. + +#### Type +Final class implementing value semantics via Lombok annotations. Implements `EqualsAndHashCode`, `ToString`. No interfaces or generics. + +#### Input +Constructor takes: `String promptKey`, `Path sourceFile`, `String sourceText`, `AiMdHeader currentHeader`. All parameters are required and validated with `Objects.requireNonNull`. + +#### Output +Public accessors return: `promptKey`, `sourceFile`, `sourceText`, `currentHeader` as declared types. + +#### Core logic +- Constructs immutable request object from four fields. +- Provides record-style accessors for all fields. +- Enforces non-null inputs at construction time. + +#### Public API +- `promptKey() -> String` retrieves prompt template identifier +- `sourceFile() -> Path` retrieves source file path +- `sourceText() -> String` retrieves source file content +- `currentHeader() -> AiMdHeader` retrieves current AI markdown header + +#### Dependencies +Imports: `java.nio.file.Path`, `java.util.Objects`, `lombok.EqualsAndHashCode`, `lombok.ToString`, `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord`, `net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader` + +#### Exceptions / Errors +Throws `NullPointerException` if any constructor argument is null. Null-checks enforced via `Objects.requireNonNull`. + +#### Concurrency +Immutable design ensures thread-safe usage without synchronization. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationResult.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationResult.java.ai.md new file mode 100644 index 0000000..360fdc6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiGenerationResult.java.ai.md @@ -0,0 +1,44 @@ +### AiGenerationResult.java +- H: 1.0 +- C: DE646195 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:01:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Represents the outcome of an AI-driven document field generation process, encapsulating the generated content as a structured, immutable value. + +#### Purpose +- Encapsulates AI-generated text output from field processing. +- Provides a stable, value-based representation for downstream use. + +#### Type +Final class implementing record-like behavior via Lombok annotations. Marked with `@ConvertToRecord` for future migration. No extends or implements clauses. + +#### Input +Constructor takes a `String body` parameter; enforced to be non-null via `Objects.requireNonNull`. + +#### Output +Public accessor method `body()` returns the immutable `String` field, which may be empty but never null. + +#### Core logic +- Validates input `body` is not null during construction. +- Stores AI-generated text in an immutable field. +- Exposes the stored text through a record-style getter method. + +#### Public API +- `AiGenerationResult(String body)` → constructor; initializes result with body text +- `String body()` → accessor; retrieves generated body content + +#### Dependencies +- `java.util.Objects` +- `lombok.EqualsAndHashCode` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord` + +#### Exceptions / Errors +Throws `NullPointerException` if constructor argument `body` is null. + +#### Concurrency +Immutable design ensures thread-safe access to instance state. No synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdChildEntryLineFormatter.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdChildEntryLineFormatter.java.ai.md new file mode 100644 index 0000000..096c562 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdChildEntryLineFormatter.java.ai.md @@ -0,0 +1,42 @@ +### AiMdChildEntryLineFormatter.java +- H: 1.0 +- C: 12412458 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:01:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates deterministic checksum lines for package-level manifest entries from child names and headers. + +#### Purpose +- Formats structured manifest lines for AI index package checksums. +- Supports aggregation of child entries in a deterministic order. + +#### Type +class AiMdChildEntryLineFormatter final + +#### Input +- Constructor: no parameters. +- Method format: name (String), childHeader (AiMdHeader). + +#### Output +- Return value: String with format `|||\n`. + +#### Core logic +- Concatenates child name and header fields (c, d, x) using a pipe separator. +- Appends newline character to form a complete manifest line. +- Ensures deterministic order via fixed field sequence. + +#### Public API +format(name, childHeader) -> String builds checksum line + +#### Dependencies +AiMdHeader +net.ladenthin.maven.llamacpp.aiindex.document.AiMdChildEntryLineFormatter + +#### Exceptions / Errors +No explicit exceptions. Null handling depends on input parameters. + +#### Concurrency +No concurrency concerns; stateless and immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocument.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocument.java.ai.md new file mode 100644 index 0000000..36f7ca6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocument.java.ai.md @@ -0,0 +1,56 @@ +### AiMdDocument.java +- H: 1.0 +- C: 3B8113EA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:02:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Represents an immutable .ai.md document with structured metadata and content for AI indexing. + +#### Purpose +- Stores structured document data for AI processing +- Provides access to metadata and content separately + +#### Type +- final class +- Implements @ToString and @EqualsAndHashCode from Lombok +- Marked @ConvertToRecord for future migration + +#### Input +- Constructor requires AiMdHeader and String body parameters +- Both parameters must be non-null +- Header parameter is required to be non-null +- Body parameter is required to be non-null + +#### Output +- Returns AiMdHeader via header() accessor method +- Returns String body via body() accessor method +- Produces immutable instances with consistent state + +#### Core logic +- Validates constructor arguments for null values +- Stores header and body as final fields +- Provides record-style accessors for header and body fields + +#### Public API +- AiMdDocument(AiMdHeader, String) -> void Creates new document instance +- header() -> AiMdHeader Retrieves metadata header +- body() -> String Retrieves markdown content + +#### Dependencies +- java.util.Objects +- lombok.EqualsAndHashCode +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader + +#### Exceptions / Errors +- Throws NullPointerException if header or body parameters are null +- Null validation occurs in constructor + +#### Concurrency +- Immutable design ensures thread safety +- Final fields prevent modification after construction +- No synchronization required for instance usage diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocumentCodec.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocumentCodec.java.ai.md new file mode 100644 index 0000000..5cba4f4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdDocumentCodec.java.ai.md @@ -0,0 +1,52 @@ +### AiMdDocumentCodec.java +- H: 1.0 +- C: E353030C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:03:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Reads and writes structured markdown documents with metadata headers and bodies from disk. + +#### Purpose +- Parses .ai.md files into structured document objects. +- Serializes document objects back into .ai.md file format. + +#### Type +Class, final. Implements no interfaces. Uses generics: List, StringBuilder. Notable annotations: @ToString. + +#### Input +- Constructor: no parameters. +- read(Path): Path to .ai.md file. +- read(List): Lines of .ai.md content. +- write(AiMdDocument): Document object with header and body. +- write(Path, AiMdDocument): File path and document object. + +#### Output +- read(Path): AiMdDocument object. +- read(List): AiMdDocument object. +- write(AiMdDocument): String representation of .ai.md content. +- write(Path, AiMdDocument): writes UTF-8 file. + +#### Core logic +- Splits input lines into header and body sections based on separator line. +- Identifies header lines by prefix patterns (title, field). +- Skips blank lines before header ends. +- Parses header section using AiMdHeaderCodec. +- Serializes header and body with proper formatting and separator. + +#### Public API +- read(Path) -> AiMdDocument: Reads file to document object. +- write(Path, AiMdDocument) -> void: Writes document to UTF-8 file. + +#### Dependencies +Imports: java.io.IOException, java.nio.charset.StandardCharsets, java.nio.file.Files, java.nio.file.Path, java.util.ArrayList, java.util.List, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper. + +Referenced types: AiMdDocument, AiMdHeaderCodec, AiMdHeader. + +#### Exceptions / Errors +Throws IOException when reading or writing files. Handles null or malformed input through compatibility helper and blank line checks. + +#### Concurrency +No explicit concurrency handling; assumes single-threaded file access. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeader.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeader.java.ai.md new file mode 100644 index 0000000..cc6d6f2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeader.java.ai.md @@ -0,0 +1,51 @@ +### AiMdHeader.java +- H: 1.0 +- C: C6F165E5 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:04:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a structured header model for AI-generated Markdown documents, separating deterministic metadata from AI content for machine parsing. + +#### Purpose +- Represents metadata for .ai.md documents. +- Supports deterministic node comparison and navigation. + +#### Type +Class, final. Implements `EqualsAndHashCode`, `ToString`. Annotated with `@ConvertToRecord`. + +#### Input +Constructor parameters include title, h, c, d, t, g, a, x, and children. Dependencies: `Collection` for children, `String` fields. Injected or consumed fields: `title`, `h`, `c`, `d`, `t`, `g`, `a`, `x`, `children`. + +#### Output +Return types include `String` (title, h, c, d, t, g, a, x) and `List` (children). Mutated fields: `children` stored as unmodifiable list. Side effects: defensive copy of input collection. + +#### Core logic +- Enforces non-null constraints on all constructor parameters. +- Stores children in an immutable list after copying input. +- Provides accessor methods for each field. +- Ensures deterministic header comparison via structural fields. + +#### Public API +- `AiMdHeader(title, h, c, d, t, g, a, x, children)` → AiMdHeader: Creates header with child links. +- `AiMdHeader(title, h, c, d, t, g, a, x)` → AiMdHeader: Creates header without child links. +- `title()` → String: Returns display title. +- `h()` → String: Returns header version. +- `c()` → String: Returns checksum. +- `d()` → String: Returns source timestamp. +- `t()` → String: Returns generation timestamp. +- `g()` → String: Returns generator version. +- `a()` → String: Returns AI schema version. +- `x()` → String: Returns node type. +- `children()` → List: Returns unmodifiable child links. + +#### Dependencies +Imports: `java.util.ArrayList`, `java.util.Collection`, `java.util.Collections`, `java.util.List`, `java.util.Objects`, `lombok.EqualsAndHashCode`, `lombok.ToString`, `net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord`. + +#### Exceptions / Errors +Throws `NullPointerException` on null inputs. Defensive copying prevents external mutation of children list. + +#### Concurrency +No explicit concurrency handling; fields are final and immutable. Thread-safe for read-only access. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderCodec.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderCodec.java.ai.md new file mode 100644 index 0000000..233be5f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderCodec.java.ai.md @@ -0,0 +1,58 @@ +### AiMdHeaderCodec.java +- H: 1.0 +- C: 529B3335 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:06:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses and serializes metadata headers for AI index documents. + +#### Purpose +- Reads and writes structured metadata from AI index document files. +- Manages key-value fields and child-link references in document headers. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString annotation. + +#### Input +- Constructor: no parameters. +- read(List lines): list of text lines from a .ai.md file header. +- read(Path file): file path to an .ai.md file. +- write(AiMdHeader header): structured metadata object. + +#### Output +- read(List): AiMdHeader instance with parsed fields and children. +- write(AiMdHeader): serialized string representing the header. +- read(Path): AiMdHeader from file contents. + +#### Core logic +- Parses lines to extract title, scalar fields, and child links. +- Matches field keys against predefined constants for correct mapping. +- Formats output strings using fixed prefixes and field values. +- Collects multiple child-link entries into a list in encounter order. + +#### Public API +- read(List) -> AiMdHeader: parses header from text lines. +- write(AiMdHeader) -> String: serializes header to string. +- read(Path) -> AiMdHeader: reads and parses header from file. + +#### Dependencies +- java.io.IOException +- java.nio.charset.StandardCharsets +- java.nio.file.Files +- java.nio.file.Path +- java.util.ArrayList +- java.util.HashMap +- java.util.List +- java.util.Map +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader + +#### Exceptions / Errors +- IOException: thrown when reading file contents fails. +- Null handling: defaults missing scalar fields to empty string. + +#### Concurrency +- No explicit concurrency control; class is stateless and immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderSupport.java.ai.md new file mode 100644 index 0000000..8d23137 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdHeaderSupport.java.ai.md @@ -0,0 +1,54 @@ +### AiMdHeaderSupport.java +- H: 1.0 +- C: F47C5B40 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:07:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Determines if an .ai.md document header needs regeneration based on version, content, or structural differences. + +#### Purpose +- Compares document headers to decide whether to rewrite a file. +- Evaluates file existence, content, and header version for changes. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString annotation. + +#### Input +- Constructor: no parameters. +- Method `shouldWrite`: boolean force, Path targetFile, AiMdHeader expectedHeader. +- Dependencies: Java8CompatibilityHelper, AiMdDocumentCodec, AiMdHeaderCodec. +- Reads file content via Files.exists, Files.read. + +#### Output +- Returns boolean indicating whether to rewrite the file. +- Side effect: reads from filesystem at targetFile path. + +#### Core logic +- If force flag is true, always returns true. +- If target file does not exist, returns true. +- Parses existing document using AiMdDocumentCodec. +- Checks if header version matches HEADER_VERSION_1_0. +- Checks if body is blank using Java8CompatibilityHelper. +- Compares all fields of expectedHeader against actualHeader. + +#### Public API +- `shouldWrite(force, targetFile, expectedHeader) -> boolean` determines rewrite necessity. + +#### Dependencies +- java.io.IOException +- java.nio.file.Files +- java.nio.file.Path +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader + +#### Exceptions / Errors +- Throws IOException when file cannot be read. +- Null handling: assumes expectedHeader is not null. + +#### Concurrency +- No explicit concurrency control; class is stateless. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdLeadExtractor.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdLeadExtractor.java.ai.md new file mode 100644 index 0000000..9025657 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/AiMdLeadExtractor.java.ai.md @@ -0,0 +1,53 @@ +### AiMdLeadExtractor.java +- H: 1.0 +- C: 650CFCE3 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:08:36Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Extracts the first meaningful line from .ai.md document bodies, stripping blockquote markers to produce navigable package summaries. + +#### Purpose +- Parses markdown document bodies to isolate descriptive leads. +- Supports deterministic, marker-aware lead extraction for index generation. + +#### Type +class public final +implements no interfaces +generics no type bounds +annotations @ToString + +#### Input +- Constructor: no parameters +- Method extractLead: String body (required, not null) +- Field compatibilityHelper: Java8CompatibilityHelper instance + +#### Output +- Method extractLead returns String (trimmed lead line or empty string) +- Side effect: none +- State mutation: none + +#### Core logic +- Splits input body into lines using newline delimiter +- Skips blank lines until first non-blank line is found +- Trims first non-blank line +- Checks if trimmed line starts with blockquote marker (>) +- Strips marker and trims result if present; otherwise returns trimmed line +- Returns empty string if no non-blank line exists + +#### Public API +extractLead(body) -> String extracts the lead line from a markdown body + +#### Dependencies +- Java8CompatibilityHelper +- String (JDK) + +#### Exceptions / Errors +- Throws NullPointerException if body is null +- No explicit error handling for invalid input beyond null check + +#### Concurrency +- No concurrency concerns; stateless and immutable operation +- Thread-safe due to lack of shared mutable state diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package-info.java.ai.md new file mode 100644 index 0000000..10cb4fb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package-info.java.ai.md @@ -0,0 +1,41 @@ +### package-info.java +- H: 1.0 +- C: 94A5AB2C +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:09:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines the domain model and serialization logic for .ai.md documents. + +#### Purpose +- Models the structure of .ai.md files +- Provides encoding/decoding functionality for .ai.md content + +#### Type +Package `net.ladenthin.maven.llamacpp.aiindex.document` + +#### Input +- Package-level documentation comment +- No parameters or dependencies in package-info.java + +#### Output +- No return values or side effects +- Defines package scope and documentation + +#### Core logic +- Declares package namespace for document model +- Documents the purpose of .ai.md file handling + +#### Public API +- Package-level documentation only + +#### Dependencies +- None directly referenced + +#### Exceptions / Errors +- No exception handling or null checks + +#### Concurrency +- Not applicable to package-info.java diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package.ai.md new file mode 100644 index 0000000..9a951f0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/document/package.ai.md @@ -0,0 +1,62 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/document +- H: 1.0 +- C: F4674983 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:13:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiGenerationRequest.java](AiGenerationRequest.java.ai.md) +- F: [AiGenerationResult.java](AiGenerationResult.java.ai.md) +- F: [AiMdChildEntryLineFormatter.java](AiMdChildEntryLineFormatter.java.ai.md) +- F: [AiMdDocument.java](AiMdDocument.java.ai.md) +- F: [AiMdDocumentCodec.java](AiMdDocumentCodec.java.ai.md) +- F: [AiMdHeader.java](AiMdHeader.java.ai.md) +- F: [AiMdHeaderCodec.java](AiMdHeaderCodec.java.ai.md) +- F: [AiMdHeaderSupport.java](AiMdHeaderSupport.java.ai.md) +- F: [AiMdLeadExtractor.java](AiMdLeadExtractor.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> This package manages the structured representation, parsing, and serialization of AI-generated Markdown (.ai.md) documents, enabling deterministic indexing and content processing. + +#### Purpose +- Defines the data model for AI index documents. +- Provides mechanisms to read, write, and validate .ai.md file formats. + +#### Responsibilities +- Document structure management: defines metadata headers and content bodies for .ai.md files. +- File I/O operations: reads and writes structured .ai.md documents from disk. +- Header parsing and serialization: extracts and formats document metadata. +- AI generation request/response handling: encapsulates inputs and outputs for AI processing tasks. +- Manifest line formatting: generates checksum lines for package-level indexing. +- Lead extraction: identifies descriptive summaries from document bodies. +- Change detection logic: determines when .ai.md files should be regenerated. + +#### Key units +- `AiGenerationRequest` carries immutable input data for AI generation tasks. +- `AiGenerationResult` encapsulates the output of AI-driven field processing. +- `AiMdDocument` stores structured metadata and content for AI indexing. +- `AiMdHeader` defines deterministic document metadata fields. +- `AiMdDocumentCodec` handles file-level read/write operations for .ai.md documents. +- `AiMdHeaderCodec` parses and serializes header sections of .ai.md files. +- `AiMdChildEntryLineFormatter` formats manifest lines for package checksums. +- `AiMdLeadExtractor` isolates descriptive leads from document bodies. +- `AiMdHeaderSupport` determines if a document needs regeneration based on version or content changes. + +#### Data flow +Input files are parsed by `AiMdDocumentCodec` into `AiMdDocument` objects, which contain an `AiMdHeader` and body text. These documents are processed through AI generation workflows using `AiGenerationRequest`, producing `AiGenerationResult`. The results may be written back to `.ai.md` files via `AiMdDocumentCodec`. Manifest lines are generated by `AiMdChildEntryLineFormatter` for package-level indexing. Descriptive leads are extracted from document bodies by `AiMdLeadExtractor`. + +#### Dependencies +Internal collaborations: +- `AiMdHeaderCodec` and `AiMdDocumentCodec` work together to parse and serialize headers and documents. +- `AiMdHeaderSupport` uses `AiMdDocumentCodec` and `AiMdHeaderCodec` for file comparison logic. +- `AiGenerationRequest` integrates with `AiMdHeader` and source text for AI processing. +External dependencies: +- `Java8CompatibilityHelper` used for compatibility handling in several components. + +#### Cross-cutting +- Immutable design across all core classes ensures thread safety without synchronization. +- Null validation is enforced via `Objects.requireNonNull` in constructors and method parameters. +- Lombok annotations (`@EqualsAndHashCode`, `@ToString`) are widely used for boilerplate code reduction. +- Consistent field ordering and formatting (e.g., pipe-separated manifest lines) support deterministic behavior. +- Shared exception handling through `NullPointerException` for invalid inputs. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java.ai.md new file mode 100644 index 0000000..3843208 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java.ai.md @@ -0,0 +1,57 @@ +### AiFieldGenerationSupport.java +- H: 1.0 +- C: 8B242F21 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:09:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI-powered field documentation by processing configuration lists, preparing prompts, and handling retry logic for failed generations. + +#### Purpose +- Processes AI field generation requests. +- Manages prompt preparation, retries, and trim warnings. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString. + +#### Input +- Constructor: Log, AiGenerationProvider, AiPromptPreparationSupport, AiModelDefinitionSupport. +- Method processFieldGenerations: List, Path, String, String, AiMdHeader. +- Dependencies: AiFieldGenerationConfig, AiGenerationConfig, AiGenerationRequest, AiPreparedPrompt. + +#### Output +- Return type: AiGenerationResult. +- Side effects: Log warnings for trimming and empty outputs; log retry attempts at INFO level. + +#### Core logic +- Iterates over field generation configurations. +- Prepares prompts using AiPromptPreparationSupport. +- Truncates source text if needed, logs warning when configured. +- Generates AI output via AiGenerationProvider. +- Retries up to maxRetries times with increasing temperature for blank outputs. +- Logs detailed calculations of max input characters per prompt configuration. + +#### Public API +- processFieldGenerations(fieldGenerations, contextFile, contextType, sourceText, baseHeader) -> AiGenerationResult + Generates and accumulates AI field documentation. + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig +- net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPreparedPrompt +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- org.apache.maven.plugin.logging.Log + +#### Exceptions / Errors +- Throws IOException if generation provider fails. +- IllegalArgumentException if AI definition key is not found. + +#### Concurrency +- No explicit concurrency handling. Uses thread-safe Map cache for maxInputChars. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/PackageIndexer.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/PackageIndexer.java.ai.md new file mode 100644 index 0000000..cb7ddb8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/PackageIndexer.java.ai.md @@ -0,0 +1,50 @@ +### PackageIndexer.java +- H: 1.0 +- C: 1E8F476A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:13:26Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Aggregates package-level AI index files by walking output directories, collecting child summaries, and generating consolidated package-level AI content. + +#### Purpose +- Builds package-level AI documentation from child entries. +- Integrates AI-generated summaries into structured markdown documents. + +#### Type +class final PackageIndexer extends Object implements Serializable + +#### Input +- Constructor parameters: Log, Path baseDirectory, Path outputRoot, String pluginVersion, String aiVersion, Collection sourceSubtrees, boolean force, AiGenerationProvider generationProvider, Collection fieldGenerations, AiPromptSupport promptSupport, AiModelDefinitionSupport modelDefinitionSupport +- Method parameters: Path rootDirectory in aggregate(), Path directory in writePackageFile(), collectContents(), collectChildLinks(), buildPackageSourceText(), calculatePackageChecksum(), calculatePackageDate() +- Dependencies: AiPathSupport, AiTimeSupport, AiChecksumSupport, AiMdHeaderSupport, AiMdChildEntryLineFormatter, AiMdDocumentCodec, AiMdHeaderCodec, Java8CompatibilityHelper, AiFieldGenerationSupport + +#### Output +- Return values: int from aggregate(), aggregateRecursive() +- Side effects: Writes .ai.md files to disk; logs messages via Log instance +- State mutations: Fields updated during processing, such as checksums and dates + +#### Core logic +- Traverses output directory tree recursively to find package directories. +- Determines whether a package file should be created or updated based on child content presence. +- Collects contents and child links for header metadata. +- Builds source text by embedding child summaries from .ai.md files. +- Generates AI content using configured field generation strategies. +- Calculates checksums and dates from child entries. +- Writes final markdown documents with headers and bodies. + +#### Public API +- aggregate(rootDirectory) -> int: Walks directory tree and aggregates package files. +- writePackageFile(directory) -> void: Writes a single package index file. + +#### Dependencies +net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig, net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport, net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult, net.ladenthin.maven.llamacpp.aiindex.document.AiMdChildEntryLineFormatter, net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocument, net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec, net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader, net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec, net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderSupport, net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport, net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport, net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider, net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport, net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport, net.ladenthin.maven.llamacpp.aiindex.support.AiTimeSupport, net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper, org.apache.maven.plugin.logging.Log + +#### Exceptions / Errors +- IOException: Thrown when reading or writing files fails. +- IllegalStateException: Thrown if Path.getFileName() returns null during sorting. + +#### Concurrency +No explicit concurrency mechanisms. All operations are synchronous and assume single-threaded use per instance. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/ProjectIndexer.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/ProjectIndexer.java.ai.md new file mode 100644 index 0000000..66f4f7c --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/ProjectIndexer.java.ai.md @@ -0,0 +1,68 @@ +### ProjectIndexer.java +- H: 1.0 +- C: D7879C38 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:34:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Builds a project-level AI index by aggregating package-level indexes into a single navigable markdown file. + +#### Purpose +- Aggregates package-level AI indexes into a project-level index. +- Generates optional AI overview paragraph from package leads. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString. + +#### Input +- Constructor: Log, projectTitle, pluginVersion, aiVersion, force, optional AiGenerationProvider, AiFieldGenerationConfig, AiPromptSupport, AiModelDefinitionSupport. +- Method aggregate: Path rootDirectory. +- Dependencies: AiMdDocumentCodec, AiMdLeadExtractor, AiChecksumSupport, AiTimeSupport, Java8CompatibilityHelper. + +#### Output +- Return value: int (1 if written, 0 if unchanged). +- Side effect: Writes project index file at rootDirectory + PROJECT_AI_MD_FILENAME. +- State mutation: None; immutable data structures used. + +#### Core logic +- Walks output tree for package.ai.md files. +- Reads each package index to extract lead and link. +- Builds deterministic body with package listing and leads. +- Calculates checksum including overview signature. +- Conditionally generates AI overview from package leads. +- Writes project index file with header and body. + +#### Public API +- aggregate(rootDirectory) -> int: Aggregates package indexes into project index. +- ProjectIndexer(log, title, version, force) -> ProjectIndexer: Constructs deterministic indexer. +- ProjectIndexer(log, title, version, force, provider, config, promptSupport, modelSupport) -> ProjectIndexer: Constructs AI-overview indexer. + +#### Dependencies +- java.io.IOException, java.nio.file.Files, java.nio.file.Path, java.util.ArrayList, java.util.Collections, java.util.Comparator, java.util.List, java.util.stream.Stream +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig +- net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocument +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderSupport +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdLeadExtractor +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport +- net.ladenthin.maven.llamacpp.aiindex.support.AiTimeSupport +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- org.apache.maven.plugin.logging.Log +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- Throws IOException when reading/writing files or during AI generation. +- Defensive copy of AiFieldGenerationConfig prevents external mutation. + +#### Concurrency +- No concurrency features. Uses immutable data structures and thread-safe helpers. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java.ai.md new file mode 100644 index 0000000..76aa33c --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java.ai.md @@ -0,0 +1,96 @@ +### SourceFileIndexer.java +- H: 1.0 +- C: 2126461D +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:41:20Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI-powered metadata index files for source code, summarizing content and extracting keywords per file. + +#### Purpose +- Creates structured markdown index files for Java source files. +- Populates AI-generated summaries and keyword fields in index documents. + +#### Type +class SourceFileIndexer +- final +- Implements no interfaces +- Notable annotations: @ToString + +#### Input +- Constructor parameters: + - Log log + - Path baseDirectory + - Path outputRoot + - Collection fileExtensions + - String pluginVersion + - String aiVersion + - Collection subtrees + - @Nullable Collection excludes + - boolean force + - AiGenerationProvider generationProvider + - @Nullable Collection fieldGenerations + - AiPromptSupport promptSupport + - AiModelDefinitionSupport modelDefinitionSupport + +#### Output +- Return type: int from indexSourceRoot(Path) +- Side effects: + - Writes .ai.md files to outputRoot directory + - Logs informational and debug messages via Log + +#### Core logic +- Walks source directories recursively using Files.walk +- Filters files by extension, subtree inclusion, and exclusion patterns +- Skips excluded files based on glob patterns relative to baseDirectory +- Generates AI index files with headers containing metadata like checksum and timestamps +- Uses field generation configurations to process source text and extract fields +- Writes final .ai.md documents using AiMdDocumentCodec + +#### Public API +- indexSourceRoot(Path) -> int: indexes files under a given root directory +- isExcluded(Path) -> boolean: checks if file matches exclusion patterns +- matchesExtension(Path) -> boolean: verifies file extension match +- writeAiFile(Path) -> void: generates and writes AI index for a single source file +- matchesSubtree(Path) -> boolean: determines if path is within configured subtrees + +#### Dependencies +Imports: +- java.io.IOException +- java.nio.file.Files +- java.nio.file.Path +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- java.util.stream.Stream +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig +- net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationSelector +- net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocument +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec +- net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderSupport +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport +- net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport +- net.ladenthin.maven.llamacpp.aiindex.support.AiSourceExcludeFilter +- net.ladenthin.maven.llamacpp.aiindex.support.AiTimeSupport +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- org.apache.maven.plugin.logging.Log +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- Throws IOException when reading or writing files +- Throws IllegalArgumentException when no field generation is configured or matches a file name +- Handles null inputs gracefully where annotations indicate @Nullable + +#### Concurrency +No explicit concurrency mechanisms; assumes single-threaded use during Maven plugin execution. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package-info.java.ai.md new file mode 100644 index 0000000..ba78192 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package-info.java.ai.md @@ -0,0 +1,44 @@ +### package-info.java +- H: 1.0 +- C: 9027E72C +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:13:10Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Orchestrates traversal of source trees to drive AI field generation for indexing. + +#### Purpose +- Drives automated field generation from source code +- Coordinates package tree traversal for indexing + +#### Type +package `net.ladenthin.maven.llamacpp.aiindex.indexer` + +#### Input +- Source package trees +- File system resources +- Configuration parameters (not shown) + +#### Output +- Generated field metadata +- Indexable artifacts +- Processed package structures + +#### Core logic +- Traverses source/package hierarchies +- Identifies candidates for field generation +- Coordinates generation workflow + +#### Public API +- No public members in package-info.java + +#### Dependencies +- No external imports or references + +#### Exceptions / Errors +- No explicit error handling shown + +#### Concurrency +- No concurrency concerns indicated diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package.ai.md new file mode 100644 index 0000000..84a1af5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package.ai.md @@ -0,0 +1,49 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/indexer +- H: 1.0 +- C: 368B3C1F +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:16:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationSupport.java](AiFieldGenerationSupport.java.ai.md) +- F: [PackageIndexer.java](PackageIndexer.java.ai.md) +- F: [ProjectIndexer.java](ProjectIndexer.java.ai.md) +- F: [SourceFileIndexer.java](SourceFileIndexer.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> Automates AI-powered documentation and indexing of Java source code packages, files, and projects by generating structured markdown summaries with field-level metadata. + +#### Purpose +- Generates AI-driven documentation for Java source files, packages, and projects. +- Consolidates AI outputs into navigable, hierarchical index structures. + +#### Responsibilities +- Source file indexing: processes individual Java files to create AI-powered metadata documents. +- Package aggregation: builds package-level AI indexes from child entries and field generations. +- Project consolidation: aggregates package indexes into a project-wide navigable markdown file. +- Field generation: applies AI prompts to extract structured information from source code. + +#### Key units +- **AiFieldGenerationSupport**: Processes AI field generation requests, prepares prompts, handles retries. +- **PackageIndexer**: Builds package-level AI documentation by collecting child summaries and generating consolidated content. +- **ProjectIndexer**: Aggregates package-level indexes into a project-level index with optional AI overview. +- **SourceFileIndexer**: Creates structured markdown index files for Java source files with AI-generated summaries. + +#### Data flow +- Source code files are walked and filtered, then processed by `SourceFileIndexer` to generate `.ai.md` documents. +- Package directories are scanned by `PackageIndexer` to collect child content and build consolidated package indexes. +- `ProjectIndexer` aggregates all package-level `.ai.md` files into a project-level index file. +- AI field generation workflows use `AiFieldGenerationSupport` to process configurations, prepare prompts, and retry failed generations. + +#### Dependencies +- Internal modules: AiMdDocument, AiMdHeader, AiGenerationProvider, AiPromptPreparationSupport, AiModelDefinitionSupport. +- External libraries: Lombok, Maven plugin logging, Java 8 compatibility helpers. +- Configuration types: AiFieldGenerationConfig, AiGenerationConfig, AiPromptSupport. + +#### Cross-cutting +- Shared interfaces and patterns for AI generation and prompt preparation across components. +- Common exception handling with IOException, IllegalArgumentException, and retry logic for blank outputs. +- Thread-safe caching for max input character calculations in `AiFieldGenerationSupport`. +- Immutable data structures used in `ProjectIndexer` to ensure deterministic output. +- Use of `@ToString` and Lombok annotations for code clarity. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java.ai.md new file mode 100644 index 0000000..cd1f373 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java.ai.md @@ -0,0 +1,96 @@ +### AbstractAiIndexMojo.java +- H: 1.0 +- C: B294B09C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:44:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides shared configuration and utility methods for Maven Mojo plugins that generate AI-powered documentation and summaries from source code. + +#### Purpose +- Centralizes common AI index parameters and logic across multiple Maven goals. +- Supplies helper methods for resolving paths, building configurations, and logging execution details. + +#### Type +- Abstract class extending `org.apache.maven.plugin.AbstractMojo` +- Implements no interfaces +- Uses Lombok `@ToString` annotation + +#### Input +- Constructor: none +- Fields: + - `baseDirectory`: injected by Maven (`${project.basedir}`) + - `outputDirectory`: configurable property with default `${project.basedir}/src/site/ai` + - `skip`: global toggle flag + - `force`: regeneration control flag + - `subtrees`: list of relative paths to restrict processing + - `generationProvider`: string identifier for AI provider (e.g., "mock", "llamacpp-jni") + - `promptDefinitions`: list of prompt templates used by field generation + - `aiDefinitions`: list of model configurations referenced by field generations + - `fieldGenerations`: list of per-field AI configuration entries + - `llamaLibraryPath`, `llamaModelPath`, `llamaMaxOutputTokens`, `llamaTemperature`: llama.cpp specific parameters +- Methods: + - `resolveSubtrees(Path basePath)` consumes `subtrees` and `baseDirectory` + - `buildLlamaCppJniConfig()` uses `fieldGenerations`, `aiDefinitions`, and individual llama parameters + - `buildPromptSupport()` uses `promptDefinitions` + - `buildAiModelDefinitionSupport()` uses `aiDefinitions` + - `logExecutionParameters(...)` consumes various execution parameters + +#### Output +- Return types: + - `List` from `resolveSubtrees()` + - `int` from `sizeOf()` + - `LlamaCppJniConfig` from `buildLlamaCppJniConfig()` + - `AiPromptSupport` from `buildPromptSupport()` + - `AiModelDefinitionSupport` from `buildAiModelDefinitionSupport()` +- Side effects: + - Logs execution parameters using `getLog().info()` + - Warns about missing subtrees via `getLog().warn()` + +#### Core logic +- Determines whether to skip execution based on global or phase-specific skip flags. +- Resolves configured subtree paths against the project base directory, filtering out non-existent paths. +- Builds a LlamaCppJniConfig using either field-generation-driven definitions or fallback parameters. +- Constructs prompt and AI model definition support instances, handling missing required fields via exceptions. +- Logs standardized execution parameter set for debugging. + +#### Public API +- `getLlamaContextSize() -> int` declares context size for llama.cpp +- `getLlamaThreads() -> int` declares thread count for llama.cpp inference +- `isPhaseSkipped() -> boolean` returns phase-specific skip flag +- `shouldSkip() -> boolean` evaluates overall skip condition +- `resolveSubtrees(Path basePath) -> List` resolves configured subtrees +- `sizeOf(Collection collection) -> int` counts elements safely +- `buildLlamaCppJniConfig() -> LlamaCppJniConfig` constructs llama config +- `buildPromptSupport() -> AiPromptSupport` builds prompt support instance +- `buildAiModelDefinitionSupport() -> AiModelDefinitionSupport` builds model definition support +- `logExecutionParameters(...) -> void` logs execution parameters + +#### Dependencies +- `java.io.File` +- `java.nio.file.Path` +- `java.util.ArrayList` +- `java.util.Collection` +- `java.util.Collections` +- `java.util.List` +- `lombok.ToString` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition` +- `net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniConfig` +- `org.apache.maven.plugin.AbstractMojo` +- `org.apache.maven.plugin.MojoExecutionException` +- `org.apache.maven.plugins.annotations.Parameter` + +#### Exceptions / Errors +- Throws `MojoExecutionException` when prompt or AI definition lists contain missing required fields +- Throws `IllegalArgumentException` in `buildLlamaCppJniConfig()` if referenced model definition key is invalid + +#### Concurrency +- No explicit concurrency handling; relies on Maven's per-execution instantiation model +- Thread-safe methods assume immutable inputs and do not mutate shared state diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregatePackagesMojo.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregatePackagesMojo.java.ai.md new file mode 100644 index 0000000..0d9974d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregatePackagesMojo.java.ai.md @@ -0,0 +1,71 @@ +### AggregatePackagesMojo.java +- H: 1.0 +- C: 6A34E4E4 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:49:44Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Aggregates per-package AI-generated index files into a unified summary and keyword structure. + +#### Purpose +- Builds aggregated package index files from individual .ai.md files. +- Configures AI model parameters for fast inference during package processing. + +#### Type +Class, final. Extends AbstractAiIndexMojo. Implements no interfaces. + +#### Input +- Constructor: no parameters. +- Parameters: + - skipPackage: boolean flag to conditionally skip phase. + - pluginVersion: Maven project version string. + - aiVersion: AI model version string. + - llamaContextSize: integer for context window size. + - llamaThreads: integer for CPU threads used during inference. +- Fields read: + - baseDirectory, outputDirectory, force, generationProvider, fieldGenerations. + +#### Output +- Side effects: logs informational messages. +- Return type: void (execute method). +- Mutated fields: none directly; indirectly affects package index file content. + +#### Core logic +- Checks if execution should be skipped based on global or phase-specific flags. +- Resolves subtree paths from base directory. +- Builds prompt and model definition support objects. +- Instantiates AI generation provider with configured llama.cpp JNI settings. +- Creates PackageIndexer with all necessary parameters including provider. +- Executes aggregation of package index files into output directory. +- Logs results and execution summary. + +#### Public API +- execute() -> void: runs the main aggregation logic. +- getLlamaContextSize() -> int: returns configured context window size. +- getLlamaThreads() -> int: returns configured thread count for inference. +- isPhaseSkipped() -> boolean: checks if current phase is skipped. + +#### Dependencies +- java.io.IOException +- java.nio.file.Path +- java.util.Collections +- java.util.List +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport +- net.ladenthin.maven.llamacpp.aiindex.indexer.PackageIndexer +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory +- org.apache.maven.plugin.MojoExecutionException +- org.apache.maven.plugins.annotations.Mojo +- org.apache.maven.plugins.annotations.Parameter + +#### Exceptions / Errors +- IOException: thrown when output directory does not exist or cannot be accessed. +- MojoExecutionException: wraps IOExceptions during execution. + +#### Concurrency +- Thread-safe due to @Mojo annotation with threadSafe = true. +- Uses try-with-resources for AiGenerationProvider to ensure proper cleanup. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregateProjectMojo.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregateProjectMojo.java.ai.md new file mode 100644 index 0000000..d9ff6ce --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AggregateProjectMojo.java.ai.md @@ -0,0 +1,50 @@ +### AggregateProjectMojo.java +- H: 1.0 +- C: CB445C6F +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:51:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Aggregates per-package AI index files into a single project-level index, optionally including an AI-generated overview paragraph. + +#### Purpose +- Generates a consolidated AI index for a Maven project. +- Optionally produces an AI summary of package-level indexes. + +#### Type +Class `AggregateProjectMojo` extends `AbstractAiIndexMojo`, final. Implements no interfaces. Uses Lombok `@ToString`. + +#### Input +- Constructor: none. +- Parameters from Maven: `outputDirectory`, `force`, `skip`, `projectName`, `pluginVersion`, `aiVersion`, `llamaContextSize`, `llamaThreads`, `fieldGenerations`. +- Dependencies injected by Maven: `getLog()`, `generationProvider`, `buildLlamaCppJniConfig()`, `buildPromptSupport()`, `buildAiModelDefinitionSupport()`. + +#### Output +- Writes one or more `.ai.md` files to `outputDirectory`. +- Logs informational and error messages via `getLog()`. + +#### Core logic +- Skips execution if global or phase-specific skip flag is set. +- Determines project title from `projectName` or defaults to "project". +- Chooses deterministic aggregation path if no `fieldGenerations` configured; otherwise, creates AI provider and executes AI-driven summary. +- Calls `ProjectIndexer.aggregate()` for either path. + +#### Public API +- `execute() -> void` : Runs the index aggregation process. +- `getLlamaContextSize() -> int` : Returns context size for llama.cpp. +- `getLlamaThreads() -> int` : Returns thread count for llama.cpp. +- `isPhaseSkipped() -> boolean` : Checks if project phase is skipped. + +#### Dependencies +Imports: `java.io.IOException`, `java.nio.file.Path`, `lombok.ToString`, `net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig`, `net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport`, `net.ladenthin.maven.llamacpp.aiindex.indexer.ProjectIndexer`, `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport`, `net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider`, `net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory`, `net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper`, `org.apache.maven.plugin.MojoExecutionException`, `org.apache.maven.plugins.annotations.Mojo`, `org.apache.maven.plugins.annotations.Parameter`. + +#### Exceptions / Errors +- Throws `MojoExecutionException` when provider/model setup fails or I/O error occurs. +- Handles null or blank `projectName` with default title. +- Catches and rethrows `IOException` during index writing. + +#### Concurrency +- Marked `@Mojo(threadSafe = true)`. +- Uses immutable fields; no shared mutable state. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java.ai.md new file mode 100644 index 0000000..e630182 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java.ai.md @@ -0,0 +1,80 @@ +### GenerateMojo.java +- H: 1.0 +- C: 64782257 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T16:53:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI-powered summaries and keywords for Java source files within a Maven project. + +#### Purpose +- Indexes Java source files. +- Populates AI-generated metadata into indexed files. + +#### Type +Class, final. Extends AbstractAiIndexMojo. Implements no interfaces. + +#### Input +- Constructor: none. +- Parameters: + - `skipFile`: boolean, controls skipping file phase. + - `pluginVersion`: String, Maven plugin version. + - `aiVersion`: String, AI model version. + - `fileExtensions`: List, file extensions to index. + - `excludes`: List, glob patterns for excluded files. + - `llamaContextSize`: int, context window size for llama.cpp. + - `llamaThreads`: int, CPU threads for inference. +- Fields: + - `baseDirectory`: File, project base directory. + - `outputDirectory`: File, output directory for AI index files. + - `generationProvider`: String, AI provider identifier. + - `force`: boolean, whether to overwrite existing files. + - `fieldGenerations`: List, fields to generate. +- Resources: + - File system paths resolved from base and output directories. + +#### Output +- Side effects: + - Writes AI-generated index files to output directory. + - Logs execution status and warnings. +- Return types: + - None directly, but mutates state via file writes and logging. + +#### Core logic +- Skips execution if global or phase skip flag is set. +- Resolves base path, output path, and file extensions. +- Builds prompt support and AI model definition support. +- Instantiates an AI generation provider using JNI config. +- Creates a source file indexer with resolved parameters. +- Iterates over subtrees to index Java files. +- Logs count of generated AI files upon completion. + +#### Public API +- `execute() -> void`: Runs the AI indexing process. +- `getLlamaContextSize() -> int`: Returns configured llama context size. +- `getLlamaThreads() -> int`: Returns configured llama thread count. +- `isPhaseSkipped() -> boolean`: Indicates if file phase is skipped. + +#### Dependencies +- java.io.IOException +- java.nio.file.Path +- java.util.List +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport +- net.ladenthin.maven.llamacpp.aiindex.indexer.SourceFileIndexer +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- org.apache.maven.plugin.MojoExecutionException +- org.apache.maven.plugins.annotations.Mojo +- org.apache.maven.plugins.annotations.Parameter + +#### Exceptions / Errors +- Throws MojoExecutionException on IOException during file operations. +- Logs warnings for missing subtrees. + +#### Concurrency +- Thread-safe due to `@Mojo(threadSafe = true)`. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package-info.java.ai.md new file mode 100644 index 0000000..10b54e0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package-info.java.ai.md @@ -0,0 +1,39 @@ +### package-info.java +- H: 1.0 +- C: A3C622F1 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:55:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides Maven plugin entry points for AI indexing tasks. + +#### Purpose +- Defines the root package for Maven Mojo implementations. +- Organizes the ai-index plugin goals under a cohesive namespace. + +#### Type +- Package `net.ladenthin.maven.llamacpp.aiindex.mojo` with no class, interface, or type declarations. + +#### Input +- No parameters, dependencies, or resources consumed directly by this file. + +#### Output +- No return values or side effects; serves only as a package declaration. + +#### Core logic +- Establishes the namespace for Maven plugin Mojo classes. +- Supports organization of ai-index functionality within the Maven build lifecycle. + +#### Public API +- None; no methods or members exposed. + +#### Dependencies +- None directly imported or referenced. + +#### Exceptions / Errors +- No exceptions or error handling present. + +#### Concurrency +- Not applicable; this is a package-info file with no runtime behavior. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package.ai.md new file mode 100644 index 0000000..129e0c0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package.ai.md @@ -0,0 +1,51 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/mojo +- H: 1.0 +- C: A7DF4B16 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:19:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AbstractAiIndexMojo.java](AbstractAiIndexMojo.java.ai.md) +- F: [AggregatePackagesMojo.java](AggregatePackagesMojo.java.ai.md) +- F: [AggregateProjectMojo.java](AggregateProjectMojo.java.ai.md) +- F: [GenerateMojo.java](GenerateMojo.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> Automates the generation of AI-powered documentation and code summaries from Java source files within Maven projects, supporting per-file, per-package, and project-level indexing. + +#### Purpose +- Generates AI-enhanced metadata and summaries for Java source code. +- Integrates with Maven build lifecycle to produce structured documentation artifacts. + +#### Responsibilities +- **File-level indexing**: Processes individual Java files to extract and augment code information using AI. +- **Package-level aggregation**: Combines per-file AI indexes into consolidated package summaries. +- **Project-level synthesis**: Creates a unified project overview from aggregated package indexes, optionally including an AI-generated summary paragraph. +- **Configuration management**: Centralizes AI model parameters and prompt definitions for consistent usage across indexing phases. + +#### Key units +- `AbstractAiIndexMojo`: Base class providing shared configuration and utility methods for all AI index Mojos. +- `GenerateMojo`: Indexes individual Java files using AI to produce per-file `.ai.md` outputs. +- `AggregatePackagesMojo`: Aggregates package-level AI indexes into a structured summary. +- `AggregateProjectMojo`: Consolidates project-wide AI indexes into a single, optionally summarized index file. +- `LlamaCppJniConfig`: Configuration object for llama.cpp inference settings. +- `AiPromptSupport`: Manages prompt templates used in AI generation. +- `AiModelDefinitionSupport`: Encapsulates model configurations for AI providers. + +#### Data flow +- Input source files are resolved from project base directory and filtered by extensions and exclusions. +- AI models are instantiated with configured parameters (e.g., context size, threads) via `LlamaCppJniConfig`. +- Prompt and model definitions are built from lists of configurations, used during generation steps. +- Generated content is written to output directories as `.ai.md` files, organized per file, package, or project scope. + +#### Dependencies +- Internal: `net.ladenthin.maven.llamacpp.aiindex.config`, `net.ladenthin.maven.llamacpp.aiindex.indexer`, `net.ladenthin.maven.llamacpp.aiindex.prompt`, `net.ladenthin.maven.llamacpp.aiindex.provider` +- External: Maven plugin API (`org.apache.maven.plugin`), Lombok annotations, Java NIO and collections + +#### Cross-cutting +- All Mojos extend `AbstractAiIndexMojo` for shared behavior. +- Uses consistent logging via `getLog()`. +- Configurable skip flags control execution at both global and phase levels. +- Thread safety ensured by `@Mojo(threadSafe = true)` on final classes. +- Exception handling wraps low-level I/O and configuration errors in `MojoExecutionException`. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package-info.java.ai.md new file mode 100644 index 0000000..5260445 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package-info.java.ai.md @@ -0,0 +1,43 @@ +### package-info.java +- H: 1.0 +- C: A05AE952 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:55:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates .ai.md index files for Java source trees using llama.cpp within a Maven plugin context. + +#### Purpose +- Produces AI-powered documentation index files for Java projects +- Integrates with Maven build lifecycle for automated documentation generation + +#### Type +Package-level documentation only; no class, interface, or type declaration present + +#### Input +- No direct inputs; package is purely for organizing Maven plugin modules + +#### Output +- No direct outputs; serves as module organization container for plugin artifacts + +#### Core logic +- Declares module-level null safety contract via JSpecify @NullMarked annotation +- Configures compile-time nullness checking using Error Prone and Checker Framework +- Excludes Maven plugin parameters from null initialization checks due to reflection-based population + +#### Public API +- No public API exposed; package is for internal organizational purposes only + +#### Dependencies +- References module-info.java for JSpecify @NullMarked declaration +- Depends on Maven plugin framework for parameter injection +- Integrates with Error Prone compiler plugin for null checking enforcement + +#### Exceptions / Errors +- No explicit exception handling or error conditions in this file +- Relies on transitive null safety enforcement from module-level annotations + +#### Concurrency +- No concurrency concerns; package is static organizational unit diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..4817bc1 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,52 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: E5A0A8E1 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:28:10Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [document/](document/package.ai.md) +- F: [indexer/](indexer/package.ai.md) +- F: [mojo/](mojo/package.ai.md) +- F: [package-info.java](package-info.java.ai.md) +- F: [prompt/](prompt/package.ai.md) +- F: [provider/](provider/package.ai.md) +- F: [support/](support/package.ai.md) +--- +> This package automates AI-powered documentation and indexing of Java source code, generating structured markdown summaries with field-level metadata for Maven projects. + +#### Purpose +- Generates AI-driven documentation for Java source files, packages, and projects. +- Produces structured markdown index files with deterministic metadata and content. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats with metadata headers. +- Source indexing: creates AI-powered summaries for individual Java files and aggregates them into package and project indexes. +- AI inference and generation: supports local GGUF models and mock backends for code analysis and field extraction. +- Maven integration: automates documentation generation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPreparedPrompt.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPreparedPrompt.java.ai.md new file mode 100644 index 0000000..6771797 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPreparedPrompt.java.ai.md @@ -0,0 +1,45 @@ +### AiPreparedPrompt.java +- H: 1.0 +- C: EBEFC327 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:56:07Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Represents the outcome of prompt preparation, including substituted text and trimming metrics. + +#### Purpose +- Encapsulates results from prompt processing +- Tracks source text trimming and character usage + +#### Type +Final class implementing value semantics via Lombok annotations; marked for future record migration + +#### Input +Constructor accepts: prompt String, sourceText String, trimmed boolean, originalSourceLength int, trimmedSourceLength int, availableSourceChars int; validates non-null prompt and sourceText + +#### Output +Public accessors return: prompt String, sourceText String, trimmed boolean, originalSourceLength int, trimmedSourceLength int, availableSourceChars int + +#### Core logic +- Stores immutable prompt preparation results +- Tracks whether source text was truncated +- Preserves character count metrics for source trimming analysis + +#### Public API +prompt() -> String returns prepared prompt text +sourceText() -> String returns substituted source text +trimmed() -> boolean indicates if source was trimmed +originalSourceLength() -> int returns original source length +trimmedSourceLength() -> int returns trimmed source length +availableSourceChars() -> int returns character budget + +#### Dependencies +lombok.EqualsAndHashCode, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +Throws NullPointerException for null prompt or sourceText parameters + +#### Concurrency +Immutable design ensures thread-safe usage without synchronization diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptDefinition.java.ai.md new file mode 100644 index 0000000..1a36252 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptDefinition.java.ai.md @@ -0,0 +1,50 @@ +### AiPromptDefinition.java +- H: 1.0 +- C: 149C1FBD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:56:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a configuration object for AI prompt templates used in a Maven plugin, associating lookup keys with template strings. + +#### Purpose +- Stores and manages prompt template configurations for AI processing. +- Supports Maven plugin integration via JavaBean property mapping. + +#### Type +class public final +Implements: none +Generics: none +Annotations: @ToString + +#### Input +- Constructor: no parameters. +- Methods: setKey(String), setTemplate(String). +- Fields read: key, template (via getters). + +#### Output +- Methods: getKey(), getTemplate() return field values. +- Side effects: field mutation via setters. + +#### Core logic +- Encapsulates a key-template pair for AI prompt configuration. +- Provides standard JavaBean accessors for configuration properties. +- Uses Lombok-generated toString for diagnostics without value-based equality. + +#### Public API +getKey() -> String returns lookup key +setKey(String) -> void sets lookup key +getTemplate() -> String returns template string +setTemplate(String) -> void sets template string + +#### Dependencies +lombok.ToString + +#### Exceptions / Errors +Null handling: fields may be null due to reflection initialization. +No explicit exception throwing. + +#### Concurrency +Not thread-safe. Instances are managed by identity in plugin context; mutable state implies no concurrency guarantees. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java.ai.md new file mode 100644 index 0000000..308e1df --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java.ai.md @@ -0,0 +1,54 @@ +### AiPromptPreparationSupport.java +- H: 1.0 +- C: BC50BFE5 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:57:28Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Prepares AI prompts by trimming source code to fit within character limits while preserving syntax integrity. + +#### Purpose +- Trims source text for AI prompts at line boundaries. +- Ensures prompt length fits within configured maximum character limits. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString annotation. + +#### Input +- Constructor: AiPromptSupport dependency. +- Method preparePrompt: AiGenerationRequest, int maxInputChars. +- Method getBasePromptLength: String promptKey, Path contextFile. +- Method trimSourceAtLineBreak: String sourceText, int targetIndex. + +#### Output +- Method preparePrompt returns AiPreparedPrompt with trimmed content and metrics. +- Method getBasePromptLength returns int character count of template with empty source. +- Method trimSourceAtLineBreak returns String trimmed at line boundary. + +#### Core logic +- Renders full prompt using template and source text. +- Compares rendered length to max input characters. +- If within limit, returns full prompt and source. +- Else, calculates available space after removing source from template. +- Trims source at last newline before available space. +- Appends EOF marker to indicate truncation. +- Re-renders prompt with trimmed source and marker. + +#### Public API +- preparePrompt(request, maxInputChars) → AiPreparedPrompt: Trims and renders prompt. +- getBasePromptLength(promptKey, contextFile) → int: Calculates fixed template overhead. +- trimSourceAtLineBreak(sourceText, targetIndex) → String: Trims source at line boundary. + +#### Dependencies +net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest +net.ladenthin.maven.llamacpp.aiindex.prompt.AiPreparedPrompt +net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport + +#### Exceptions / Errors +- IllegalArgumentException thrown by promptSupport.buildPrompt if no template found. +- Null handling: depends on AiPromptSupport and AiGenerationRequest implementations. + +#### Concurrency +No explicit concurrency control. Assumes AiPromptSupport and AiGenerationRequest are immutable or thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java.ai.md new file mode 100644 index 0000000..0b0ef13 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java.ai.md @@ -0,0 +1,42 @@ +### AiPromptSupport.java +- H: 1.0 +- C: 5839F364 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:58:45Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Renders AI prompt templates for generation requests using registered key-value definitions. + +#### Purpose +- Provides prompt string rendering for AI generation tasks. +- Validates and enforces required template definitions at construction time. + +#### Type +Final class implementing no interfaces. Extends no type. Uses generics: Map. Notable annotations: @ToString. + +#### Input +Constructor accepts List which must contain non-null key and template fields. buildPrompt methods consume AiGenerationRequest or individual promptKey, sourceFile, sourceText parameters. + +#### Output +Returns rendered prompt strings from templates using provided file name and source text substitutions. Throws IllegalArgumentException for missing prompt keys. + +#### Core logic +- Initializes internal HashMap with capacity based on input list size. +- Validates each AiPromptDefinition entry for required key and template fields. +- Substitutes filename and source text into registered template strings. +- Throws exception when no matching template is found for a given prompt key. + +#### Public API +buildPrompt(request) -> String: Renders prompt from request data. +buildPrompt(promptKey, sourceFile, sourceText) -> String: Renders prompt from components. + +#### Dependencies +Imports: java.util.HashMap, java.util.List, java.util.Map, java.util.Objects, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest, net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper. References: AiPromptDefinition, AiGenerationRequest. + +#### Exceptions / Errors +Throws NullPointerException during construction if any definition has null key or template. Throws IllegalArgumentException in buildPrompt if no template exists for given promptKey. + +#### Concurrency +No explicit concurrency control; class is immutable after construction. Assumes thread-safe usage of injected dependencies. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package-info.java.ai.md new file mode 100644 index 0000000..1889f19 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package-info.java.ai.md @@ -0,0 +1,39 @@ +### package-info.java +- H: 1.0 +- C: 97D8EFB2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T16:59:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Manages prompt templates, preparation, and lookup for AI indexing workflows. + +#### Purpose +- Defines a package for organizing prompt-related utilities. +- Supports AI indexing by providing structured prompt handling. + +#### Type +Package `net.ladenthin.maven.llamacpp.aiindex.prompt` + +#### Input +- No direct inputs; package-level organization. + +#### Output +- No direct outputs; serves as a logical grouping for related classes. + +#### Core logic +- Provides a namespace for prompt template management. +- Enables lookup and preparation of prompts in AI indexing contexts. + +#### Public API +- Package exports prompt-related utilities for use in AI workflows. + +#### Dependencies +- None directly referenced; part of larger module structure. + +#### Exceptions / Errors +- No exceptions or error handling in package declaration. + +#### Concurrency +- No concurrency concerns; package-level grouping only. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package.ai.md new file mode 100644 index 0000000..05b9433 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/prompt +- H: 1.0 +- C: DF3A2A2D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:22:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiPreparedPrompt.java](AiPreparedPrompt.java.ai.md) +- F: [AiPromptDefinition.java](AiPromptDefinition.java.ai.md) +- F: [AiPromptPreparationSupport.java](AiPromptPreparationSupport.java.ai.md) +- F: [AiPromptSupport.java](AiPromptSupport.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> Enables structured AI prompt generation and source text trimming for Maven-based code indexing workflows. + +#### Purpose +- Manages AI prompt templates and their configurations +- Prepares source code inputs for AI processing by trimming to character limits + +#### Responsibilities +- Prompt definition and configuration management +- Source text preparation and trimming logic +- Prompt rendering and template substitution +- Character limit enforcement and validation + +#### Key units +AiPreparedPrompt represents the result of prompt preparation with trimming metrics +AiPromptDefinition encapsulates key-template pairs for AI prompt configurations +AiPromptPreparationSupport handles source text trimming and prompt construction +AiPromptSupport renders prompts using registered templates and substitutions + +#### Data flow +Source code text is trimmed by AiPromptPreparationSupport to fit within character limits, then rendered into a final prompt string by AiPromptSupport using configured templates and substitutions + +#### Dependencies +net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest +net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord +lombok.EqualsAndHashCode +lombok.ToString + +#### Cross-cutting +Immutable design across AiPreparedPrompt ensures thread-safe usage +Lombok annotations reduce boilerplate for value objects and diagnostics +Null validation occurs at construction time in AiPromptSupport and AiPreparedPrompt constructors +Prompt preparation logic consistently handles template rendering and character budgeting diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..48caeab --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,45 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:00:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract and clean model answers by removing internal reasoning blocks. + +#### Purpose +- Strips Gemma-4 thinking blocks from model responses. +- Provides cleaned output for AI index storage. + +#### Type +Class, non-final. Implements no interfaces. Uses @ToString annotation. + +#### Input +- Constructor: no parameters. +- Method parseCompletion: String response (raw LLM text, may be null). + +#### Output +- Method parseCompletion returns String (cleaned answer text). +- Throws IOException if thinking block is incomplete. + +#### Core logic +- Checks for presence of THINKING_BLOCK_END_MARKER in response. +- If found, extracts text after the end marker and trims it. +- If THINKING_BLOCK_START_MARKER exists without END_MARKER, throws IOException. +- Returns trimmed input if no markers are present. + +#### Public API +parseCompletion(response) -> String removes thinking blocks and returns clean answer +THINKING_BLOCK_START_MARKER -> String identifies start of reasoning block +THINKING_BLOCK_END_MARKER -> String identifies end of reasoning block + +#### Dependencies +java.io.IOException, lombok.ToString + +#### Exceptions / Errors +Throws IOException when THINKING_BLOCK_START_MARKER is found but END_MARKER is missing. + +#### Concurrency +No concurrency considerations; class is stateless. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..aad89f9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,45 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:00:57Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides pluggable text generation for AI-powered code indexing tasks using local or mock backends. + +#### Purpose +- Defines a contract for generating AI-derived text from structured input requests. +- Supports both standard and overridden sampling parameters for retry logic. + +#### Type +Interface, no modifiers. Implements AutoCloseable. + +#### Input +- `AiGenerationRequest` object containing prompt key, source file, source text, and current header. +- Optional `float temperatureOverride` parameter in the extended method. + +#### Output +- Generated text as `String`; never null but may be empty. +- Throws `IOException` on failure. + +#### Core logic +- Delegates generation to underlying AI backend based on request input. +- Supports retry mechanism via temperature override to improve response quality. +- Provides default no-op close behavior for resource management. + +#### Public API +- `generate(AiGenerationRequest) -> String` produces text from a request. +- `generate(AiGenerationRequest, float) -> String` overrides sampling temperature for retries. + +#### Dependencies +- `AiGenerationRequest` +- `IOException` + +#### Exceptions / Errors +- Throws `IOException` if backend fails during generation. +- Handles null return by contract; returns blank string instead. + +#### Concurrency +- No explicit concurrency control. Behavior depends on implementation. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..b96e25e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,53 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:01:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an AI model provider implementation based on a configuration key. + +#### Purpose +- Instantiates AI generation providers dynamically. +- Maps provider names to concrete implementations. + +#### Type +class public final +Implements: none +Generics: none +Annotations: @ToString + +#### Input +- Constructor: none +- Method create: providerName (String), llamaConfig (LlamaCppJniConfig), promptSupport (AiPromptSupport) + +#### Output +- Return type: AiGenerationProvider +- Side effects: none +- Mutated fields: none + +#### Core logic +- Checks if providerName is null or blank, defaults to MockAiGenerationProvider. +- Matches providerName against known keys ("mock", "llamacpp-jni"). +- Throws IllegalArgumentException for unrecognized provider names. + +#### Public API +create(providerName, llamaConfig, promptSupport) -> AiGenerationProvider +Instantiates AI provider by name + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper +- net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniAiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider +- net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniConfig + +#### Exceptions / Errors +Throws IllegalArgumentException for unsupported provider names. +Handles null or blank providerName by defaulting to MockAiGenerationProvider. + +#### Concurrency +None noted. Class is stateless and immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..369ac48 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,58 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:02:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Generates AI responses using a local GGUF model via JNI bindings, supporting configurable inference parameters and prompt templating. + +#### Purpose +- Provides AI text generation using a native llama.cpp model. +- Supports dynamic prompt building and inference configuration. + +#### Type +Final class implementing `AiGenerationProvider` and `AutoCloseable`. Extends no types. Implements interfaces: `AiGenerationProvider`, `AutoCloseable`. + +#### Input +- Constructor accepts `LlamaCppJniConfig` and `AiPromptSupport`. +- `generate()` methods take `AiGenerationRequest` and optional `temperatureOverride`. +- Reads model path, context size, thread count, and inference settings from `config`. +- Consumes `promptSupport` to render prompts from requests. + +#### Output +- Returns generated text as `String`. +- Mutates internal `model` field on first use. +- Produces side effect of loading native GGUF model on first call. + +#### Core logic +- Lazily initializes native `LlamaModel` on first `generate()` call. +- Builds user prompt using `AiPromptSupport`. +- Constructs `InferenceParameters` with request and config values. +- Invokes `chatCompleteText` on the model with parameters. +- Parses output using `AiCompletionParser`. + +#### Public API +- `generate(AiGenerationRequest) -> String` generates response with default temperature. +- `generate(AiGenerationRequest, float) -> String` generates response with custom temperature. +- `close() -> void` releases native model resources. + +#### Dependencies +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniConfig` +- `net.ladenthin.maven.llamacpp.aiindex.provider.AiCompletionParser` + +#### Exceptions / Errors +- Throws `IOException` during model inference or prompt building. +- Null checks on constructor parameters. + +#### Concurrency +- Not thread-safe; assumes single-threaded use per instance. +- Model loading is synchronized via null check and assignment. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..2f09daa --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,51 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:03:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures native llama.cpp inference parameters for AI model execution. + +#### Purpose +- Encapsulates immutable settings for JNI-based llama.cpp model invocation. +- Provides accessors for all configuration fields with defensive copying. + +#### Type +final class implements no interfaces; extends no type; generics: none; annotations: @ConvertToRecord, @ToString, @EqualsAndHashCode + +#### Input +Constructor accepts 11 parameters including String libraryPath, modelPath, int contextSize, int maxOutputTokens, float temperature, int threads, float topP, int topK, float repeatPenalty, boolean chatTemplateEnableThinking, List stopStrings; requires non-null modelPath + +#### Output +Public accessors return field values; stopStrings() returns unmodifiable view of list; all fields are defensively copied or wrapped + +#### Core logic +- Validates non-null modelPath during construction +- Assigns constructor parameters to private final fields +- Converts null stopStrings to empty immutable list +- Provides record-style accessor methods for each field + +#### Public API +libraryPath() -> String returns native library path +modelPath() -> String returns GGUF model file path +contextSize() -> int returns context window size +maxOutputTokens() -> int returns maximum output tokens +temperature() -> float returns sampling temperature +threads() -> int returns CPU threads count +topP() -> float returns nucleus-sampling threshold +topK() -> int returns top-k sampling limit +repeatPenalty() -> float returns repetition penalty +chatTemplateEnableThinking() -> boolean returns thinking mode flag +stopStrings() -> List returns unmodifiable stop strings + +#### Dependencies +java.util.Collections, java.util.List, java.util.Objects, lombok.EqualsAndHashCode, lombok.ToString, net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord + +#### Exceptions / Errors +Throws NullPointerException if modelPath is null; handles null stopStrings by converting to empty list + +#### Concurrency +Immutable field design ensures thread-safe access; no synchronization required; defensive copying prevents external mutation diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..4604d86 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,43 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:04:57Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides deterministic mock AI summaries for testing purposes. + +#### Purpose +- Supplies fake AI-generated content for unit testing. +- Enables isolated testing of components dependent on AI generation. + +#### Type +Class, final. Implements AiGenerationProvider. Uses Lombok @ToString annotation. + +#### Input +- Constructor takes no parameters. +- Method generate consumes AiGenerationRequest with sourceFile field. +- Reads file path from request for summary construction. + +#### Output +- Returns fixed string "Mock summary for {filename}". +- Produces no side effects or state changes. + +#### Core logic +- Extracts filename from input file path. +- Constructs deterministic mock response based on filename. +- Handles null filename case by falling back to full path. + +#### Public API +generate(request) -> String: Creates mock AI summary from file. + +#### Dependencies +AiGenerationProvider, AiGenerationRequest, Path, IOException, lombok.ToString + +#### Exceptions / Errors +Throws IOException when reading file path fails (though not actually doing I/O). + +#### Concurrency +No concurrency concerns; stateless and immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package-info.java.ai.md new file mode 100644 index 0000000..5f156ae --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package-info.java.ai.md @@ -0,0 +1,39 @@ +### package-info.java +- H: 1.0 +- C: 54E2A9C5 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:05:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides AI backend implementations and data carriers for text generation requests and results. + +#### Purpose +- Encapsulates AI generation capabilities using mock and llama.cpp JNI backends. +- Defines data structures for AI generation requests and results. + +#### Type +package `net.ladenthin.maven.llamacpp.aiindex.provider` + +#### Input +- No direct inputs; package-level documentation only. + +#### Output +- No direct outputs; package-level documentation only. + +#### Core logic +- Exposes AI generation backend modules. +- Defines request/response data models for AI text generation. + +#### Public API +- No public API; package-private scope. + +#### Dependencies +- None explicitly imported; relies on package structure. + +#### Exceptions / Errors +- No exception handling or error conditions in this file. + +#### Concurrency +- No concurrency concerns; package-level documentation only. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..3a57736 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,50 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: CC70AD52 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:23:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> Provides pluggable AI text generation for code indexing, supporting local GGUF models and mock backends for testing. + +#### Purpose +- Generates AI-derived text from structured input requests for code indexing tasks. +- Offers flexible backend selection (local or mock) with configurable inference parameters. + +#### Responsibilities +- AI model inference using native llama.cpp via JNI bindings. +- Mock AI generation for unit testing and development. +- Parsing and cleaning of raw LLM responses to remove internal reasoning blocks. +- Dynamic instantiation and configuration of AI generation providers based on runtime settings. + +#### Key units +AiCompletionParser extracts clean text from LLM outputs by removing thinking blocks +AiGenerationProvider defines contract for AI text generation with retry support +AiGenerationProviderFactory selects and instantiates AI backend implementations +LlamaCppJniAiGenerationProvider uses native GGUF models via JNI for inference +LlamaCppJniConfig encapsulates llama.cpp model configuration parameters +MockAiGenerationProvider delivers deterministic mock responses for testing + +#### Data flow +Input requests are processed through AiGenerationRequest objects, which are transformed into prompts by AiPromptSupport. These are fed into either LlamaCppJniAiGenerationProvider (for native inference) or MockAiGenerationProvider (for testing), with outputs parsed by AiCompletionParser to remove internal reasoning before being returned. + +#### Dependencies +- net.ladenthin.llama.LlamaModel for native model invocation +- net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport for prompt construction +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest for input data structure +- java.io.IOException for error handling in text generation + +#### Cross-cutting +Shared interface AiGenerationProvider defines common API across implementations +Stateless, immutable configuration via LlamaCppJniConfig ensures safe concurrent access +Exception handling standardizes on IOException for backend failures +MockAiGenerationProvider enables deterministic test behavior without external dependencies diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiChecksumSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiChecksumSupport.java.ai.md new file mode 100644 index 0000000..6c62a2b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiChecksumSupport.java.ai.md @@ -0,0 +1,56 @@ +### AiChecksumSupport.java +- H: 1.0 +- C: 2A51047F +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:05:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Computes CRC32 checksums for files and strings used in AI metadata headers. + +#### Purpose +- Generates hexadecimal CRC32 checksums for content validation. +- Supports AI index file integrity checks. + +#### Type +class public final +Implements: none +Extends: none +Generics: none +Annotations: @ToString + +#### Input +- Constructor: no parameters +- Method `calculateCrc32Hex(Path)`: Path file +- Method `calculateCrc32Hex(String)`: String value +- Method `calculateCrc32Hex(byte[])`: byte[] bytes + +#### Output +- Return type `String` for all methods +- Side effect: file read (in `calculateCrc32Hex(Path)`) + +#### Core logic +- Read file contents into byte array +- Compute CRC32 checksum on byte array +- Format checksum as 8-character uppercase hexadecimal string + +#### Public API +- `calculateCrc32Hex(Path) -> String` computes file checksum +- `calculateCrc32Hex(String) -> String` computes string checksum +- `calculateCrc32Hex(byte[]) -> String` computes byte array checksum + +#### Dependencies +java.io.IOException +java.nio.charset.StandardCharsets +java.nio.file.Files +java.nio.file.Path +java.util.zip.CRC32 +lombok.ToString + +#### Exceptions / Errors +- Throws IOException when file cannot be read +- Null handling: no explicit null checks, assumes valid inputs + +#### Concurrency +None noted. Class is stateless and immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiPathSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiPathSupport.java.ai.md new file mode 100644 index 0000000..ccd224e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiPathSupport.java.ai.md @@ -0,0 +1,48 @@ +### AiPathSupport.java +- H: 1.0 +- C: 09DC92FB +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:06:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves and cleans source file paths for indexing by removing leading "src" segments. + +#### Purpose +- Normalizes file paths for consistent indexing. +- Strips redundant directory prefixes from source paths. + +#### Type +class AiPathSupport modifiers: public +extends: none +implements: none +generics: none +annotations: @ToString + +#### Input +- Constructor: no parameters +- Method `relativizeFromSrc`: baseDirectory (Path), path (Path) + +#### Output +- Return type: Path +- Side effect: none +- Mutated state: none + +#### Core logic +- Relativizes input path against base directory. +- Checks if the relativized path starts with "src" segment. +- Removes the leading "src" segment if present. + +#### Public API +relativizeFromSrc(baseDirectory, path) -> Path strips leading src from relativized path + +#### Dependencies +java.nio.file.Path +lombok.ToString + +#### Exceptions / Errors +None explicitly handled; relies on standard Path operations. + +#### Concurrency +No concurrency concerns; class is stateless and immutable. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiSourceExcludeFilter.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiSourceExcludeFilter.java.ai.md new file mode 100644 index 0000000..917c540 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiSourceExcludeFilter.java.ai.md @@ -0,0 +1,46 @@ +### AiSourceExcludeFilter.java +- H: 1.0 +- C: C06E0C2D +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:06:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Filters source file paths using glob patterns to exclude generated or trivial code from indexing. + +#### Purpose +- Excludes specific source files from being indexed based on path matching. +- Supports glob-style pattern syntax for flexible exclusion rules. + +#### Type +Class, final. Implements no interfaces. Uses @ToString annotation. Generics: List, Collection. + +#### Input +- Constructor accepts nullable Collection of glob patterns. +- Method isExcluded takes String relativePath. +- Internal method globToRegex converts String glob to regex pattern. + +#### Output +- Returns boolean from isExcluded indicating whether a path should be excluded. +- Compiled List stored in instance field. + +#### Core logic +- Compiles glob patterns into regex patterns during initialization. +- Matches input paths against compiled patterns using anchored regex matching. +- Converts glob wildcards (*, **, ?) into equivalent regex expressions. +- Handles special cases like **/ for zero-directory matching. + +#### Public API +- AiSourceExcludeFilter(Collection) -> void Initializes filter with glob patterns. +- isExcluded(String) -> boolean Determines if a path should be excluded. + +#### Dependencies +java.util.ArrayList, java.util.Collection, java.util.List, java.util.regex.Pattern, lombok.ToString, org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- Null or empty glob patterns are safely ignored during initialization. +- No explicit exception throwing beyond standard Java behavior. + +#### Concurrency +- Immutable state after construction; no synchronization required. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiTimeSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiTimeSupport.java.ai.md new file mode 100644 index 0000000..aeed4d4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiTimeSupport.java.ai.md @@ -0,0 +1,47 @@ +### AiTimeSupport.java +- H: 1.0 +- C: 27F1E50B +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:07:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Formats timestamps for AI index metadata files with second-level precision. + +#### Purpose +- Provides timestamp formatting for AI metadata headers. +- Supports consistent datetime representation in .ai.md files. + +#### Type +class AiTimeSupport final + +#### Input +- Constructor: no parameters +- Method `formatInstant`: Instant instant + +#### Output +- Return type: String +- Side effect: none +- State mutation: none + +#### Core logic +- Truncates an Instant to second precision using ChronoUnit.SECONDS +- Formats the truncated Instant into an ISO-8601 string + +#### Public API +- `formatInstant(final Instant instant) -> String` format timestamp + +#### Dependencies +- java.time.Instant +- java.time.format.DateTimeFormatter +- java.time.temporal.ChronoUnit +- lombok.ToString + +#### Exceptions / Errors +- None explicitly handled or thrown +- Null input may cause NullPointerException + +#### Concurrency +- No concurrency concerns; stateless utility class +- Immutable formatter constant used safely across threads diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/ConvertToRecord.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/ConvertToRecord.java.ai.md new file mode 100644 index 0000000..391798d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/ConvertToRecord.java.ai.md @@ -0,0 +1,41 @@ +### ConvertToRecord.java +- H: 1.0 +- C: BF72A15E +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:08:14Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Marks classes for migration to Java records upon target bytecode upgrade. + +#### Purpose +- Identifies classes suitable for refactoring into Java records. +- Serves as a migration marker for future bytecode upgrades. + +#### Type +- Annotation type: `@interface ConvertToRecord` +- Modifiers: none +- Notable annotations: none + +#### Input +- None + +#### Output +- None + +#### Core logic +- Acts as a compile-time marker for future code transformation. +- Provides no runtime behavior; used exclusively during development. + +#### Public API +- `ConvertToRecord()` -> void: Marks a class for record migration. + +#### Dependencies +- None + +#### Exceptions / Errors +- None + +#### Concurrency +- None diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/Java8CompatibilityHelper.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/Java8CompatibilityHelper.java.ai.md new file mode 100644 index 0000000..63504dd --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/Java8CompatibilityHelper.java.ai.md @@ -0,0 +1,65 @@ +### Java8CompatibilityHelper.java +- H: 1.0 +- C: B9EE5FC2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:08:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides Java 8 compatibility for Java 9+ APIs through wrapper methods for string, file, and collection operations. + +#### Purpose +- Wraps Java 9+ APIs to maintain compatibility with Java 1.8. +- Centralizes compatibility logic for testing and reuse. + +#### Type +Class, final. Implements no interfaces. Uses Lombok @ToString annotation. + +#### Input +- Constructor: no parameters. +- isBlank: String value. +- formatted: Format string and varargs of objects. +- readString: Path to file. +- writeString: Path, content string, charset. +- toList: Stream of elements. +- listOf: Varargs of elements. +- hashMapCapacityFor: Integer number of mappings. + +#### Output +- isBlank: Boolean indicating blank or empty string. +- formatted: Formatted string result. +- readString: File content as String. +- writeString: No return; writes content to file. +- toList: List of stream elements. +- listOf: Immutable list of input elements. +- hashMapCapacityFor: Integer initial capacity for HashMap. + +#### Core logic +- Checks if a string is empty or contains only whitespace. +- Formats strings using String.format as substitute for String.formatted. +- Reads file content using Files.readAllBytes with UTF-8 decoding. +- Writes string to file with specified charset, defaulting to UTF-8. +- Collects stream elements into a list using Collectors.toList. +- Creates immutable list from varargs using Arrays.asList. +- Calculates HashMap initial capacity based on load factor and expected entries. + +#### Public API +- isBlank(str) -> boolean: Checks if string is blank or empty. +- formatted(format, args) -> String: Formats string like Java 15+. +- readString(path) -> String: Reads file content as string. +- writeString(path, content, charset) -> void: Writes string to file. +- toList(stream) -> List: Collects stream into list. +- listOf(elements) -> List: Creates immutable list from elements. +- hashMapCapacityFor(numMappings) -> int: Computes HashMap capacity. + +#### Dependencies +java.io.IOException, java.nio.charset.Charset, java.nio.charset.StandardCharsets, java.nio.file.Files, java.nio.file.Path, java.util.Arrays, java.util.List, java.util.stream.Collectors, java.util.stream.Stream, lombok.ToString + +#### Exceptions / Errors +- readString throws IOException on file read errors. +- writeString throws IOException on file write errors. +- isBlank throws NullPointerException if input string is null. + +#### Concurrency +No concurrency handling; class is stateless and thread-safe for immutable inputs. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package-info.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package-info.java.ai.md new file mode 100644 index 0000000..f882812 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package-info.java.ai.md @@ -0,0 +1,39 @@ +### package-info.java +- H: 1.0 +- C: 6A9CD842 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T17:10:11Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides stateless utility functions for checksums, time, paths, and Java 8 helpers. + +#### Purpose +- Offers reusable, stateless helper methods for common operations. +- Supports foundational tasks in file processing and system utilities. + +#### Type +Package `net.ladenthin.maven.llamacpp.aiindex.support` with no explicit type modifiers. + +#### Input +No parameters or dependencies; package-level documentation only. + +#### Output +No return values or side effects; purely documentation and organizational. + +#### Core logic +- Defines a package for utility classes that do not maintain state. +- Centralizes helper functions for checksums, time handling, path manipulation, and Java 8 functional utilities. + +#### Public API +None; this is a package-info.java file with no public members. + +#### Dependencies +None directly imported; relies on standard Java libraries and package structure. + +#### Exceptions / Errors +No exceptions or error conditions; package documentation only. + +#### Concurrency +No concurrency concerns; utilities are stateless and side-effect free. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package.ai.md new file mode 100644 index 0000000..0daa6fe --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/aiindex/support/package.ai.md @@ -0,0 +1,51 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/support +- H: 1.0 +- C: 4A74F585 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:26:00Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiChecksumSupport.java](AiChecksumSupport.java.ai.md) +- F: [AiPathSupport.java](AiPathSupport.java.ai.md) +- F: [AiSourceExcludeFilter.java](AiSourceExcludeFilter.java.ai.md) +- F: [AiTimeSupport.java](AiTimeSupport.java.ai.md) +- F: [ConvertToRecord.java](ConvertToRecord.java.ai.md) +- F: [Java8CompatibilityHelper.java](Java8CompatibilityHelper.java.ai.md) +- F: [package-info.java](package-info.java.ai.md) +--- +> Provides foundational utility functions for AI metadata indexing, including checksums, path normalization, time formatting, and Java 8 compatibility. + +#### Purpose +- Generates and validates file integrity checksums for AI index metadata. +- Normalizes source paths and formats timestamps for consistent indexing. + +#### Responsibilities +- File integrity and validation: CRC32 checksum computation for files and strings. +- Path manipulation: Normalizing source file paths by stripping redundant segments. +- Time formatting: Formatting timestamps with second-level precision for metadata. +- Java compatibility: Wrapping modern Java APIs for use in older JDKs. +- Exclusion filtering: Applying glob patterns to exclude specific source files from indexing. + +#### Key units +- `AiChecksumSupport` computes hexadecimal CRC32 checksums for file and string content. +- `AiPathSupport` normalizes source paths by removing leading "src" segments. +- `AiTimeSupport` formats timestamps into ISO-8601 strings with second precision. +- `AiSourceExcludeFilter` filters source paths using glob patterns to exclude files from indexing. +- `Java8CompatibilityHelper` wraps Java 9+ APIs for compatibility with Java 8. +- `ConvertToRecord` serves as a compile-time marker for future refactoring to Java records. + +#### Data flow +Input file paths and content are processed through checksum and path normalization utilities before being formatted into AI metadata. Timestamps are generated at indexing time, and exclusion filters determine which files contribute to the index. All operations are stateless and side-effect free. + +#### Dependencies +- `java.io.IOException`, `java.nio.charset.StandardCharsets`, `java.nio.file.Files`, `java.nio.file.Path`, `java.util.zip.CRC32` +- `java.time.Instant`, `java.time.format.DateTimeFormatter`, `java.time.temporal.ChronoUnit` +- `java.util.ArrayList`, `java.util.Collection`, `java.util.List`, `java.util.regex.Pattern` +- `lombok.ToString`, `org.jspecify.annotations.Nullable` + +#### Cross-cutting +- Statelessness: All utility classes are immutable and stateless, ensuring thread safety. +- Exception handling: Standard Java exceptions like `IOException` and `NullPointerException` are used where applicable. +- Java 8 compatibility: The `Java8CompatibilityHelper` centralizes workarounds for Java 9+ APIs to maintain JDK 8 support. +- Glob pattern matching: `AiSourceExcludeFilter` uses regex compilation for efficient path exclusion based on glob syntax. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..c7db920 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 17576EA0 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:31:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> This package automates AI-powered documentation and indexing of Java source code, generating structured markdown summaries with field-level metadata for Maven projects. + +#### Purpose +- Generates AI-driven documentation for Java source files, packages, and projects. +- Produces structured markdown index files with deterministic metadata and content. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats with metadata headers. +- Source indexing: creates AI-powered summaries for individual Java files and aggregates them into package and project indexes. +- AI inference and generation: supports local GGUF models and mock backends for code analysis and field extraction. +- Maven integration: automates documentation generation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..b58805d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 11C81082 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:32:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> This package automates the generation of AI-powered documentation and structured markdown indexes for Maven-based Java projects, enabling intelligent source code analysis and metadata extraction. + +#### Purpose +- Generates AI-driven documentation for Java source files, packages, and projects. +- Produces structured markdown index files with deterministic metadata and content. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats with metadata headers. +- Source indexing: creates AI-powered summaries for individual Java files and aggregates them into package and project indexes. +- AI inference and generation: supports local GGUF models and mock backends for code analysis and field extraction. +- Maven integration: automates documentation generation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..f66e9c7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: CCF0DD0C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:33:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> This package automates the generation of AI-powered documentation and structured markdown indexes for Maven-based Java projects, enabling intelligent source code analysis and metadata extraction. + +#### Purpose +- Generates AI-driven documentation for Java source files, packages, and projects. +- Produces structured markdown index files with deterministic metadata and content. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats with metadata headers. +- Source indexing: creates AI-powered summaries for individual Java files and aggregates them into package and project indexes. +- AI inference and generation: supports local GGUF models and mock backends for code analysis and field extraction. +- Maven integration: automates documentation generation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/package.ai.md new file mode 100644 index 0000000..a5dc458 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/net/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net +- H: 1.0 +- C: 897019F3 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:35:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> This package automates the generation of AI-powered documentation and structured markdown indexes for Maven-based Java projects, enabling intelligent source code analysis and metadata extraction. + +#### Purpose +- Generates AI-driven documentation for Java source files, packages, and projects. +- Produces structured markdown index files with deterministic metadata and content. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats with metadata headers. +- Source indexing: creates AI-powered summaries for individual Java files and aggregates them into package and project indexes. +- AI inference and generation: supports local GGUF models and mock backends for code analysis and field extraction. +- Maven integration: automates documentation generation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/package.ai.md new file mode 100644 index 0000000..761c162 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/java/package.ai.md @@ -0,0 +1,45 @@ +### main/java +- H: 1.0 +- C: 03BE10C3 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:36:14Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> This package automates intelligent documentation generation and structured indexing of Maven-based Java projects using AI-powered analysis. + +#### Purpose +- Generates AI-driven documentation for Java source files and projects. +- Produces deterministic markdown indexes with metadata for code analysis. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats. +- Source indexing: creates per-file and aggregated package/project AI summaries. +- AI inference: supports local GGUF models and mock backends for code analysis. +- Maven integration: automates documentation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/package.ai.md new file mode 100644 index 0000000..2c13fd6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/main/package.ai.md @@ -0,0 +1,45 @@ +### main +- H: 1.0 +- C: 1A7F6F03 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:37:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Automates intelligent documentation generation and structured indexing of Maven-based Java projects using AI-powered analysis. + +#### Purpose +- Generates AI-driven documentation for Java source files and projects. +- Produces deterministic markdown indexes with metadata for code analysis. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats. +- Source indexing: creates per-file and aggregated package/project AI summaries. +- AI inference: supports local GGUF models and mock backends for code analysis. +- Maven integration: automates documentation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/package.ai.md new file mode 100644 index 0000000..343506d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/package.ai.md @@ -0,0 +1,45 @@ +### ai +- H: 1.0 +- C: EBEF804D +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:38:28Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Automates intelligent documentation generation and structured indexing of Maven-based Java projects using AI-powered analysis. + +#### Purpose +- Generates AI-driven documentation for Java source files and projects. +- Produces deterministic markdown indexes with metadata for code analysis. + +#### Responsibilities +- AI configuration and prompt management: defines model parameters, prompt templates, and generation settings. +- Document processing: reads, writes, and validates .ai.md file formats. +- Source indexing: creates per-file and aggregated package/project AI summaries. +- AI inference: supports local GGUF models and mock backends for code analysis. +- Maven integration: automates documentation within the Maven build lifecycle. + +#### Key units +- AiFieldGenerationConfig: maps prompt templates to model definitions for file-specific AI processing. +- AiMdDocument: stores structured metadata and content for AI indexing in .ai.md format. +- AiGenerationProvider: interface for AI text generation with retry logic, implemented by native and mock providers. +- SourceFileIndexer: generates per-file .ai.md documentation using AI prompts and summaries. +- GenerateMojo: Maven plugin goal that indexes Java files and produces AI-enhanced markdown outputs. +- AiPromptSupport: manages prompt templates and renders them into structured inputs for AI models. + +#### Data flow +Source code is filtered by extension, then processed by `SourceFileIndexer` to generate `.ai.md` documents. These are aggregated by `PackageIndexer` into package-level indexes, which are consolidated by `ProjectIndexer` into a project-wide summary. AI prompts are prepared using `AiPromptPreparationSupport`, rendered via `AiPromptSupport`, and fed into either `LlamaCppJniAiGenerationProvider` or `MockAiGenerationProvider`. Results are parsed by `AiCompletionParser` to remove internal reasoning before being written back to `.ai.md` files. + +#### Dependencies +- Internal modules: config, document, indexer, prompt, provider, support. +- External libraries: Maven plugin API, Lombok annotations, Java 8 compatibility helpers. +- AI inference backend: llama.cpp via JNI bindings for native model execution. + +#### Cross-cutting +- Immutable design across core classes ensures thread safety without synchronization. +- Shared use of Lombok annotations reduces boilerplate code. +- Null safety enforced via `@Nullable` and `Objects.requireNonNull`. +- Consistent field ordering and formatting support deterministic behavior in manifests and headers. +- Exception handling wraps low-level I/O, configuration, and AI backend errors in standard Java exceptions. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/project.ai.md new file mode 100644 index 0000000..a557183 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v1__fullproject-c64k/project.ai.md @@ -0,0 +1,45 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 41E9A112 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T17:39:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/document](main/java/net/ladenthin/maven/llamacpp/aiindex/document/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/indexer](main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/mojo](main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/prompt](main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/support](main/java/net/ladenthin/maven/llamacpp/aiindex/support/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +This Maven plugin automates AI-powered documentation and indexing of Java source code, generating structured markdown summaries with field-level metadata for packages, files, and entire projects. The system integrates configurable AI models and prompt templates to produce deterministic outputs, managing document representation and serialization through dedicated packages for Markdown handling and source text trimming. It supports both local GGUF models and mock backends for testing, providing pluggable AI generation capabilities alongside utility functions for metadata extraction, checksums, and path normalization. The plugin enables intelligent source code analysis by automating per-file, per-package, and project-level indexing workflows through Maven MOJOs and configuration management. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Configures and manages AI-driven code indexing and generation for Maven projects using model definitions, prompt templates, and generation parameters. +- main/java/net/ladenthin/maven/llamacpp/aiindex/document — This package manages the structured representation, parsing, and serialization of AI-generated Markdown (.ai.md) documents, enabling deterministic indexing and content processing. +- main/java/net/ladenthin/maven/llamacpp/aiindex/indexer — Automates AI-powered documentation and indexing of Java source code packages, files, and projects by generating structured markdown summaries with field-level metadata. +- main/java/net/ladenthin/maven/llamacpp/aiindex/mojo — Automates the generation of AI-powered documentation and code summaries from Java source files within Maven projects, supporting per-file, per-package, and project-level indexing. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package automates AI-powered documentation and indexing of Java source code, generating structured markdown summaries with field-level metadata for Maven projects. +- main/java/net/ladenthin/maven/llamacpp/aiindex/prompt — Enables structured AI prompt generation and source text trimming for Maven-based code indexing workflows. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Provides pluggable AI text generation for code indexing, supporting local GGUF models and mock backends for testing. +- main/java/net/ladenthin/maven/llamacpp/aiindex/support — Provides foundational utility functions for AI metadata indexing, including checksums, path normalization, time formatting, and Java 8 compatibility. +- main/java/net/ladenthin/maven/llamacpp — This package automates AI-powered documentation and indexing of Java source code, generating structured markdown summaries with field-level metadata for Maven projects. +- main/java/net/ladenthin/maven — This package automates the generation of AI-powered documentation and structured markdown indexes for Maven-based Java projects, enabling intelligent source code analysis and metadata extraction. +- main/java/net/ladenthin — This package automates the generation of AI-powered documentation and structured markdown indexes for Maven-based Java projects, enabling intelligent source code analysis and metadata extraction. +- main/java/net — This package automates the generation of AI-powered documentation and structured markdown indexes for Maven-based Java projects, enabling intelligent source code analysis and metadata extraction. +- main/java — This package automates intelligent documentation generation and structured indexing of Maven-based Java projects using AI-powered analysis. +- main — Automates intelligent documentation generation and structured indexing of Maven-based Java projects using AI-powered analysis. +- . — Automates intelligent documentation generation and structured indexing of Maven-based Java projects using AI-powered analysis. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..085efde --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,50 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:07:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI-driven field generation by linking prompt templates and AI model definitions for Maven plugin execution. + +#### Purpose +- Associates AI prompt templates with model definitions for field generation +- Supports file extension filtering for targeted generation + +#### Type +class public final AiFieldGenerationConfig extends java.lang.Object implements none; key generics: none; notable annotations: @ToString, @Nullable + +#### Input +- Constructor: no parameters +- Methods: setPromptKey(String), setAiDefinitionKey(String), setFileExtensions(Collection) +- Fields read: promptKey, aiDefinitionKey, fileExtensions + +#### Output +- Methods: getPromptKey() → String, getAiDefinitionKey() → String, getFileExtensions() → List +- Fields mutated: promptKey, aiDefinitionKey, fileExtensions + +#### Core logic +- Links AI model definition key to prompt template key for field generation +- Filters files by extension when specified +- Provides immutable view of file extensions list + +#### Public API +- getPromptKey() → String +- setPromptKey(String) +- getAiDefinitionKey() → String +- setAiDefinitionKey(String) +- getFileExtensions() → List +- setFileExtensions(Collection) + +#### Dependencies +net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition +net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition + +#### Exceptions / Errors +- Null handling for fileExtensions field +- Defensive copying of input collection in setFileExtensions + +#### Concurrency +- No explicit concurrency concerns; class is intended for Maven plugin configuration use only diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..18aa6f9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,44 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:09:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects AI field generation configurations based on file extensions to apply language-specific prompts. + +#### Purpose +- Matches source files to AI configuration rules by file extension +- Provides fallback behavior when no extension matches + +#### Type +Final class; implements no interfaces; key generics: `AiFieldGenerationConfig`; notable annotations: `@ToString` + +#### Input +- Constructor takes no parameters +- Method `selectForFileName` consumes: `Iterable configs`, `String fileName` + +#### Output +- Method returns: `@Nullable AiFieldGenerationConfig` +- Side effects: none + +#### Core logic +- Iterates through configured entries in order +- Skips null configurations +- For each config, checks if file name ends with any extension in its list +- Returns first matching config or fallback config if no match found +- Returns null if no matches and no fallback + +#### Public API +`selectForFileName(configs, fileName) -> AiFieldGenerationConfig` Picks configuration by file extension + +#### Dependencies +`AiFieldGenerationConfig`, `Iterable`, `List`, `String` + +#### Exceptions / Errors +Handles null configs gracefully; returns null when no match found + +#### Concurrency +No concurrency concerns; stateless operation diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..2415ea0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,73 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:09:53Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures parameters for AI model inference steps including context size, sampling settings, and retry logic. + +#### Purpose +- Carries mutable configuration for AI generation steps between Maven plugin and AI providers. +- Holds defaults and calculation constants for input trimming and retry policies. + +#### Type +Public class with Lombok @ToString; no implements or extends. + +#### Input +- Constructor takes no parameters. +- Setters accept primitive types, strings, lists, and nullables. + +#### Output +- Getters return primitives, strings, and unmodifiable lists. +- Mutates internal state via setters. + +#### Core logic +- Holds configuration for GGUF model path, context size, output tokens, sampling parameters (temperature, top-p, top-k, repeat penalty). +- Manages retry behavior on empty responses with incremental temperature. +- Calculates max input characters based on context and token estimates. +- Controls prompt trimming warnings and stop strings. + +#### Public API +- getModelPath() -> String +- setModelPath(String) +- getContextSize() -> int +- setContextSize(int) +- getMaxOutputTokens() -> int +- setMaxOutputTokens(int) +- getTemperature() -> float +- setTemperature(float) +- getThreads() -> int +- setThreads(int) +- getCharsPerToken() -> int +- setCharsPerToken(int) +- getMaxInputChars() -> int +- setMaxInputChars(int) +- isWarnOnTrim() -> boolean +- setWarnOnTrim(boolean) +- getMaxRetries() -> int +- setMaxRetries(int) +- getRetryTemperatureIncrement() -> float +- setRetryTemperatureIncrement(float) +- getTopP() -> float +- setTopP(float) +- getTopK() -> int +- setTopK(int) +- getRepeatPenalty() -> float +- setRepeatPenalty(float) +- isChatTemplateEnableThinking() -> boolean +- setChatTemplateEnableThinking(boolean) +- getStopStrings() -> List +- setStopStrings(List) + +#### Dependencies +None beyond java.util.ArrayList, java.util.Collections, org.jspecify.annotations.Nullable. + +#### Exceptions / Errors +- Uses @Nullable annotation on stopStrings list. +- No explicit throws; relies on Java null handling. + +#### Concurrency +Not thread-safe due to mutable fields and lack of synchronization. Managed by identity in Maven plugin framework. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..f3a3760 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,33 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:12:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Enumerates the scope of AI generation tasks, distinguishing between individual file and package-level processing. + +#### Purpose +- Defines discrete AI generation scopes for code analysis. +- Supports configuration of AI behavior per source unit. + +#### Type +Enum public AiGenerationKind implements none; key generics none; notable annotations none + +#### Core logic +- Provides two distinct values: FILE_SUMMARY and PACKAGE_SUMMARY. +- Each value represents a unique processing context for AI tools. + +#### Public API +JavaBean getters/setters for: FILE_SUMMARY, PACKAGE_SUMMARY + +#### Dependencies +none + +#### Exceptions / Errors +none + +#### Concurrency +none diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..83d5669 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,69 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:12:44Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines reusable AI model configurations for Maven plugin field generation. + +#### Purpose +- Encapsulates AI model parameters for reuse across multiple generation tasks. +- Serves as a configuration POJO for Maven plugin settings. + +#### Type +Public class with Lombok @ToString; implements no interfaces; key generics: List; notable annotations: @Nullable, @ToString. + +#### Input +Constructor takes no parameters; setters accept all fields including String, int, float, boolean, and Collection. + +#### Output +Getters return field values; setters mutate internal state; stopStrings returns unmodifiable list view. + +#### Core logic +- Holds immutable model configuration data. +- Provides mutable JavaBean accessors for Maven plugin instantiation via reflection. +- Defaults numeric fields to values from AiGenerationConfig class. + +#### Public API +- getKey() -> String: retrieves lookup key +- setKey(String): sets lookup key +- getModelPath() -> String: retrieves model file path +- setModelPath(String): sets model file path +- getContextSize() -> int: retrieves context window size +- setContextSize(int): sets context window size +- getMaxOutputTokens() -> int: retrieves max output tokens +- setMaxOutputTokens(int): sets max output tokens +- getTemperature() -> float: retrieves sampling temperature +- setTemperature(float): sets sampling temperature +- getThreads() -> int: retrieves thread count +- setThreads(int): sets thread count +- getCharsPerToken() -> int: retrieves chars-per-token ratio +- setCharsPerToken(int): sets chars-per-token ratio +- isWarnOnTrim() -> boolean: retrieves trim warning flag +- setWarnOnTrim(boolean): sets trim warning flag +- getMaxRetries() -> int: retrieves max retry attempts +- setMaxRetries(int): sets max retry attempts +- getRetryTemperatureIncrement() -> float: retrieves retry temperature increment +- setRetryTemperatureIncrement(float): sets retry temperature increment +- getTopP() -> float: retrieves top-p sampling threshold +- setTopP(float): sets top-p sampling threshold +- getTopK() -> int: retrieves top-k sampling limit +- setTopK(int): sets top-k sampling limit +- getRepeatPenalty() -> float: retrieves repetition penalty +- setRepeatPenalty(float): sets repetition penalty +- isChatTemplateEnableThinking() -> boolean: retrieves chat template thinking flag +- setChatTemplateEnableThinking(boolean): sets chat template thinking flag +- getStopStrings() -> List: retrieves stop strings list +- setStopStrings(Collection): sets stop strings collection + +#### Dependencies +AiGenerationConfig, Collection, List, ArrayList, Collections, org.jspecify.annotations.Nullable + +#### Exceptions / Errors +Null handling for stopStrings; no explicit exception throwing. + +#### Concurrency +No concurrency considerations noted; class is designed for Maven plugin use with reflection-based instantiation. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..373480e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,44 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:15:15Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by key to provide configured generation settings for AI field generation tasks. + +#### Purpose +- Maps AI model definition keys to ready-to-use generation configurations. +- Enforces required keys in configuration lists at build time. + +#### Type +Final class implementing no interfaces; key generics: `Map`; notable annotations: `@ToString`. + +#### Input +- Constructor takes `List`; null or empty list treated as no definitions. +- `getConfig(key)` method consumes a `String` key. + +#### Output +- `getConfig(key)` returns `AiGenerationConfig`. +- Constructor builds internal `Map` from input list. + +#### Core logic +- Validates each `AiModelDefinition` has a non-null key; throws `NullPointerException` if not. +- Populates internal map with key → `AiGenerationConfig` mapping via `toConfig()` helper. +- Looks up config by key; throws `IllegalArgumentException` if not found. + +#### Public API +- `getConfig(key) -> AiGenerationConfig`: retrieves generation config for a given definition key. + +#### Dependencies +- `AiModelDefinition`, `AiGenerationConfig`, `Java8CompatibilityHelper` + +#### Exceptions / Errors +- Throws `NullPointerException` on null keys in input list. +- Throws `IllegalArgumentException` when `getConfig()` is called with unknown key. +- Uses `Objects.requireNonNull` for null key validation. + +#### Concurrency +- Immutable internal state; thread-safe read access to `configs` map. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..05e46a1 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:20:25Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..88beb05 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,62 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:23:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..a2bd549 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,43 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:16:16Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses LLM completion text to extract model answers by stripping Gemma-4 thinking blocks. + +#### Purpose +- Strips internal reasoning blocks from LLM responses +- Extracts clean model answers for AI index storage + +#### Type +class public final + +#### Input +- `response` String parameter in `parseCompletion` method + +#### Output +- Cleaned response String from `parseCompletion` method +- IOException thrown when thinking block is incomplete + +#### Core logic +- Check if response contains thinking block end marker +- If found, return text after end marker trimmed +- If start marker present but no end marker, throw IOException +- Otherwise return trimmed response + +#### Public API +- `parseCompletion(response) -> String` extract clean answer from LLM response +- `AiCompletionParser()` create new parser instance + +#### Dependencies +none + +#### Exceptions / Errors +- IOException thrown when thinking block starts but doesn't end + +#### Concurrency +none diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..b9572bc --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,44 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:16:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Defines a contract for pluggable AI text generation backends that produce responses based on structured requests. + +#### Purpose +- Provides a standardized interface for AI text generation. +- Supports both local and mock implementations for testing. + +#### Type +Interface public; extends AutoCloseable + +#### Input +- `AiGenerationRequest` object containing prompt key, source file, source text, and current header +- Optional `float temperatureOverride` parameter in overloaded method + +#### Output +- Generated text as `String`; never null but may be blank +- Throws `IOException` on failure + +#### Core logic +- Delegate generation to underlying AI backend using request data +- Override default temperature for retry attempts when needed +- Close resource via inherited AutoCloseable behavior + +#### Public API +- `generate(AiGenerationRequest) -> String` produce text from request +- `generate(AiGenerationRequest, float) -> String` produce text with custom temperature + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest + +#### Exceptions / Errors +- Throws `IOException` on underlying provider failure +- Handles null return values gracefully by contract + +#### Concurrency +- No explicit concurrency handling; relies on implementation thread safety diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..315d35d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,43 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:17:29Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an AI generation provider implementation by name for use in a Maven plugin. + +#### Purpose +- Instantiates AI generation providers based on configuration +- Provides mock fallback for testing and development + +#### Type +class public final AiGenerationProviderFactory extends java.lang.Object + +#### Input +- `providerName` String: identifies desired provider type +- `llamaConfig` LlamaCppJniConfig: configuration for llama.cpp JNI provider +- `promptSupport` AiPromptSupport: prompt lookup support for providers that need it + +#### Output +- `AiGenerationProvider`: newly created instance based on provider name +- throws `IllegalArgumentException` for unrecognized provider names + +#### Core logic +- Checks if provider name is null or blank, returns mock provider +- Uses switch statement to map provider names to concrete implementations +- Throws exception for unsupported provider names + +#### Public API +create(providerName, llamaConfig, promptSupport) -> AiGenerationProvider: creates AI provider by name + +#### Dependencies +Java8CompatibilityHelper, LlamaCppJniAiGenerationProvider, MockAiGenerationProvider, LlamaCppJniConfig, AiPromptSupport + +#### Exceptions / Errors +IllegalArgumentException: thrown when providerName is not recognized + +#### Concurrency +Not applicable diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..7ee16f7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,46 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:18:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides local AI text generation using GGUF models via JNI bindings. + +#### Purpose +- Wraps JNI llama.cpp integration for local inference. +- Supports prompt building, completion parsing, and resource management. + +#### Type +Final class implementing `AiGenerationProvider` and `AutoCloseable`; extends no types; key generics: `LlamaCppJniConfig`, `AiPromptSupport`. + +#### Input +- Constructor: `LlamaCppJniConfig`, `AiPromptSupport` +- `generate(AiGenerationRequest, float)`: `AiGenerationRequest`, `temperatureOverride` +- Internal use: `config` fields (`modelPath`, `contextSize`, etc.), `promptSupport.buildPrompt()` + +#### Output +- `generate(...)`: `String` completion +- Side effects: lazy model loading, native resource cleanup via `close()` + +#### Core logic +- Lazily initializes `LlamaModel` on first use to defer native load. +- Builds prompt using `AiPromptSupport`. +- Constructs `InferenceParameters` with config and request data. +- Calls `model.chatCompleteText()` and parses result with `AiCompletionParser`. + +#### Public API +- `generate(AiGenerationRequest) -> String`: Generates text from request. +- `generate(AiGenerationRequest, float) -> String`: Generates with override temperature. +- `close() -> void`: Releases native model resources. + +#### Dependencies +`LlamaModel`, `InferenceParameters`, `ModelParameters`, `Pair`, `AiGenerationRequest`, `AiPromptSupport`, `AiCompletionParser` + +#### Exceptions / Errors +Throws `IOException` during generation; null-checked inputs via `Objects.requireNonNull`. + +#### Concurrency +Not explicitly thread-safe; model access synchronized via lazy initialization. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..329ff60 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,51 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:19:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures native llama.cpp inference via JNI with immutable settings for model, context, sampling, and threading. + +#### Purpose +- Encapsulates configuration for llama.cpp JNI provider. +- Provides immutable access to inference parameters. + +#### Type +Final class implementing value semantics via Lombok annotations; marked for future record conversion. + +#### Input +Constructor accepts: libraryPath, modelPath, contextSize, maxOutputTokens, temperature, threads, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings; modelPath is required. + +#### Output +Accessors return: libraryPath, modelPath, contextSize, maxOutputTokens, temperature, threads, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings; stopStrings returned as unmodifiable list. + +#### Core logic +- Validates non-null modelPath. +- Stores all parameters as final fields. +- Normalizes stopStrings to empty list if null. +- Generates equals/hashCode/toString via Lombok. + +#### Public API +libraryPath() -> String +modelPath() -> String +contextSize() -> int +maxOutputTokens() -> int +temperature() -> float +threads() -> int +topP() -> float +topK() -> int +repeatPenalty() -> float +chatTemplateEnableThinking() -> boolean +stopStrings() -> List + +#### Dependencies +ConvertToRecord, Collections, Objects + +#### Exceptions / Errors +Throws NullPointerException if modelPath is null. + +#### Concurrency +Immutable; thread-safe. diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..5799f94 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:20:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides deterministic mock AI generation results for testing purposes. + +#### Purpose +- Supplies fake AI summaries to enable testing of downstream logic without actual AI inference. +- Facilitates unit testing of components that depend on AI-generated content. + +#### Type +- Class public implements AiGenerationProvider; @ToString + +#### Input +- `AiGenerationRequest` consumed via `request.sourceFile()` + +#### Output +- Returns deterministic string summary based on input file name + +#### Core logic +- Extracts file name from input request +- Constructs mock summary string using extracted file name + +#### Public API +- `generate(request) -> String` produces mock AI summary for testing + +#### Dependencies +- AiGenerationRequest +- Path + +#### Exceptions / Errors +- Throws IOException (though implementation does not) + +#### Concurrency +- Not applicable; stateless and immutable behavior diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..56c78f5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-26T23:22:42Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> Enables pluggable local and mock AI text generation for Maven-based code indexing with structured prompt handling and response parsing. + +#### Purpose +- Provides standardized interface for AI text generation in Maven plugins +- Supports local llama.cpp inference and deterministic mocking for testing + +#### Responsibilities +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +- AiGenerationProvider interface defines text generation contract +- LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +- AiCompletionParser strips internal reasoning from LLM responses +- LlamaCppJniConfig holds immutable inference parameters +- AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +- AiPromptSupport for prompt building +- LlamaModel and InferenceParameters for JNI integration +- AiGenerationRequest for structured input data +- Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +- Shared AiGenerationRequest type across provider implementations +- Exception handling with IOException for generation failures +- Immutable configuration via Lombok value semantics +- Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..8f97461 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:25:18Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..51f3657 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:26:34Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..2e8ddb6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:27:49Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..2bdc904 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/net/package.ai.md @@ -0,0 +1,61 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:29:05Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/package.ai.md new file mode 100644 index 0000000..c9b800e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/java/package.ai.md @@ -0,0 +1,61 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:30:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/package.ai.md new file mode 100644 index 0000000..10d3aff --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/main/package.ai.md @@ -0,0 +1,61 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:31:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/package.ai.md new file mode 100644 index 0000000..21ac224 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/package.ai.md @@ -0,0 +1,61 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:32:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. + +#### Purpose +- Defines reusable AI model configurations and generation parameters for Maven plugin execution +- Links prompt templates with AI model settings for field-level code analysis + +#### Responsibilities +- AI model configuration management: AiModelDefinition, AiGenerationConfig +- Field generation setup: AiFieldGenerationConfig, AiFieldGenerationSelector +- Generation scope control: AiGenerationKind +- Model resolution and parameter mapping: AiModelDefinitionSupport +- AI generation provider selection and instantiation +- Local llama.cpp JNI integration with configuration management +- Prompt building, completion parsing, and response cleaning +- Mock implementation for testing and development + +#### Key units +AiFieldGenerationConfig manages prompt-template-to-model mappings with file extension filtering +AiFieldGenerationSelector matches source files to appropriate AI configurations by extension +AiGenerationConfig holds mutable inference parameters for GGUF models including context, sampling, and retry logic +AiModelDefinitionSupport resolves model definitions by key to provide configured generation settings +AiGenerationKind enumerates processing scopes for AI tools: FILE_SUMMARY and PACKAGE_SUMMARY +AiGenerationProvider interface defines text generation contract +LlamaCppJniAiGenerationProvider wraps llama.cpp JNI for local inference +AiCompletionParser strips internal reasoning from LLM responses +LlamaCppJniConfig holds immutable inference parameters +AiGenerationProviderFactory selects and creates provider instances + +#### Data flow +Configuration objects are constructed from Maven plugin inputs, validated for required keys, then mapped to generation tasks; file names are matched against extension rules to select appropriate field generation configurations; these configs are used to instantiate AiGenerationConfig objects with model-specific parameters +Input request flows through AiGenerationProviderFactory to instantiate LlamaCppJniAiGenerationProvider or MockAiGenerationProvider, which builds prompt using AiPromptSupport, generates completion via llama.cpp or mock logic, and returns parsed response via AiCompletionParser + +#### Dependencies +AiModelDefinition collaborates with AiGenerationConfig to provide reusable model settings +AiFieldGenerationConfig depends on AiModelDefinition and AiPromptDefinition for linking templates to models +AiModelDefinitionSupport relies on AiModelDefinition and AiGenerationConfig for resolution and mapping +AiFieldGenerationSelector uses AiFieldGenerationConfig for matching file extensions to configurations +AiPromptSupport for prompt building +LlamaModel and InferenceParameters for JNI integration +AiGenerationRequest for structured input data +Java8CompatibilityHelper for runtime compatibility + +#### Cross-cutting +Shared null handling via @Nullable annotations and defensive copying of mutable collections +Immutable view patterns for file extension lists and stop strings +Configuration validation through required key checks in AiModelDefinitionSupport +Default value management from AiGenerationConfig constants in AiModelDefinition +Shared AiGenerationRequest type across provider implementations +Exception handling with IOException for generation failures +Immutable configuration via Lombok value semantics +Deterministic mock behavior for testing consistency diff --git a/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/project.ai.md new file mode 100644 index 0000000..de1e1d6 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__qwen3coder-30b__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: E56B7358 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-26T23:34:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +This Maven plugin orchestrates AI-powered code generation by defining model configurations, prompt templates, and generation parameters to produce targeted file outputs. It supports pluggable AI providers, including local and mock implementations, that handle structured prompts and parse responses for integration into the build process. The system is designed to work seamlessly within Maven workflows, enabling automated and customizable AI-assisted development tasks. The core functionality centers around managing AI-driven indexing and code generation tasks through configurable parameters and provider interfaces. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main/java/net/ladenthin/maven/llamacpp/aiindex — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — Enables pluggable local and mock AI text generation for Maven-based code indexing with structured prompt handling and response parsing. +- main/java/net/ladenthin/maven/llamacpp — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main/java/net/ladenthin/maven — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main/java/net/ladenthin — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main/java/net — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main/java — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- main — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. +- . — Configures and orchestrates AI-driven code generation tasks within Maven plugins, managing model definitions, prompt templates, and generation parameters for targeted file processing. diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..3da327a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,56 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:03:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI field generation for Maven plugin using prompt templates and model definitions + +#### Purpose +- Associates prompt templates with AI models for single field-generation steps +- Used in Maven plugin configuration + +#### Type +- Class +- Public +- Uses Lombok's @ToString annotation + +#### Input +- Constructor: No parameters +- Setters: promptKey, aiDefinitionKey, fileExtensions + +#### Output +- Getters: promptKey, aiDefinitionKey, fileExtensions +- Mutated fields: promptKey, aiDefinitionKey, fileExtensions + +#### Core logic +- Stores configuration for AI field generation +- Manages associations between prompts and AI models +- Handles file extension selection for field generation + +#### Public API +- `getPromptKey() -> String`: Returns prompt template key +- `setPromptKey(String) -> void`: Sets prompt template key +- `getAiDefinitionKey() -> String`: Returns AI model definition key +- `setAiDefinitionKey(String) -> void`: Sets AI model definition key +- `getFileExtensions() -> List`: Returns file extensions or null +- `setFileExtensions(Collection) -> void`: Sets file extensions + +#### Dependencies +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No explicit exceptions thrown +- Null handling for fileExtensions in getFileExtensions() + +#### Concurrency +- Not explicitly thread-safe +- Mutable state, may require external synchronization diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..c1cd03d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,49 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:05:08Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects AI field generation configuration based on source file extensions + +#### Purpose +- Matches AI field generation config to source files by extension +- Implements selection logic for AI prompts + +#### Type +- `final class` +- Uses Lombok's `@ToString` annotation + +#### Input +- Iterable of `AiFieldGenerationConfig` objects +- Source file name as String + +#### Output +- Matching `AiFieldGenerationConfig` or null + +#### Core logic +- Iterates through configs in declaration order +- Checks for matching extensions +- Handles fallback configs +- Returns first match or fallback + +#### Public API +- `AiFieldGenerationSelector() -> void` + Constructs a new selector instance +- `selectForFileName(Iterable, String) -> @Nullable AiFieldGenerationConfig` + Selects appropriate config for given file name + +#### Dependencies +- `java.util.List` +- `lombok.ToString` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Handles null inputs gracefully +- Returns null when no match and no fallback + +#### Concurrency +- Immutable class, thread-safe diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..bb60d38 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,78 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:06:01Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI generation parameters for Maven build integration + +#### Purpose +- Stores configuration for AI generation steps +- Facilitates communication between Maven config and AI providers + +#### Type +- Class +- Public fields +- Lombok-generated toString() + +#### Input +- Constructor: no input +- Setter methods for all configurable parameters + +#### Output +- Getter methods for all parameters +- Mutable state through setter methods + +#### Core logic +- Manages default values for AI generation settings +- Provides getter/setter pairs for each configuration option +- Handles stop strings list with null safety + +#### Public API +- getModelPath() -> String: Retrieves model file path +- setModelPath(String) -> void: Sets model file path +- getContextSize() -> int: Gets context window size +- setContextSize(int) -> void: Sets context window size +- getMaxOutputTokens() -> int: Retrieves max output tokens +- setMaxOutputTokens(int) -> void: Sets max output tokens +- getTemperature() -> float: Gets sampling temperature +- setTemperature(float) -> void: Sets sampling temperature +- getThreads() -> int: Gets CPU threads count +- setThreads(int) -> void: Sets CPU threads count +- getCharsPerToken() -> int: Gets chars per token ratio +- setCharsPerToken(int) -> void: Sets chars per token ratio +- getMaxInputChars() -> int: Gets max input characters +- setMaxInputChars(int) -> void: Sets max input characters +- isWarnOnTrim() -> boolean: Checks trim warning setting +- setWarnOnTrim(boolean) -> void: Sets trim warning setting +- getMaxRetries() -> int: Gets max retry attempts +- setMaxRetries(int) -> void: Sets max retry attempts +- getRetryTemperatureIncrement() -> float: Gets retry temp increment +- setRetryTemperatureIncrement(float) -> void: Sets retry temp increment +- getTopP() -> float: Gets nucleus sampling threshold +- setTopP(float) -> void: Sets nucleus sampling threshold +- getTopK() -> int: Gets top-k sampling limit +- setTopK(int) -> void: Sets top-k sampling limit +- getRepeatPenalty() -> float: Gets repeat penalty +- setRepeatPenalty(float) -> void: Sets repeat penalty +- isChatTemplateEnableThinking() -> boolean: Checks chat template thinking mode +- setChatTemplateEnableThinking(boolean) -> void: Sets chat template thinking mode +- getStopStrings() -> List: Retrieves stop strings list +- setStopStrings(List) -> void: Sets stop strings list + +#### Dependencies +- java.util.ArrayList +- java.util.Collections +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- Null safety for stop strings list +- No explicit exception handling in methods + +#### Concurrency +- Mutable state allows for concurrent modifications +- Thread-safety depends on external usage diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..027f209 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,38 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:09:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Identifies AI generation scope: single files or packages + +#### Purpose +- Enumerates AI generation targets (per-file or aggregate) + +#### Type +enum public sealed + +#### Input +- None (pure enum) + +#### Output +- None (no methods, only constants) + +#### Core logic +- Defines two constants for file-level and package-level AI generation + +#### Public API +- FILE_SUMMARY -> Represents per-file AI generation +- PACKAGE_SUMMARY -> Represents aggregate package AI generation + +#### Dependencies +- net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationKind + +#### Exceptions / Errors +- None (enum constants) + +#### Concurrency +- Immutable, thread-safe diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..ee5977e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,81 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:10:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configures AI model parameters for Maven plugin integration + +#### Purpose +- Defines AI model configurations for Maven plugin use +- Allows reuse of model definitions across multiple field generations + +#### Type +- Class +- Public +- Lombok @ToString annotation + +#### Input +- Constructor: No input +- Setters: Various AI parameter values and paths + +#### Output +- Getters: Return configured AI parameters and paths +- Mutable state: Field values can be modified after construction + +#### Core logic +- Stores AI model configuration settings +- Provides getter/setter methods for each configurable parameter +- Manages default values from AiGenerationConfig +- Handles nullable stop strings collection + +#### Public API +- getKey() -> String: Retrieves unique identifier +- setKey(String) -> void: Sets unique identifier +- getModelPath() -> String: Gets model file path +- setModelPath(String) -> void: Sets model file path +- getContextSize() -> int: Retrieves context window size +- setContextSize(int) -> void: Sets context window size +- getMaxOutputTokens() -> int: Gets max output tokens +- setMaxOutputTokens(int) -> void: Sets max output tokens +- getTemperature() -> float: Retrieves temperature setting +- setTemperature(float) -> void: Sets temperature +- getThreads() -> int: Gets thread count +- setThreads(int) -> void: Sets thread count +- getCharsPerToken() -> int: Retrieves chars-per-token ratio +- setCharsPerToken(int) -> void: Sets chars-per-token ratio +- isWarnOnTrim() -> boolean: Checks trim warning setting +- setWarnOnTrim(boolean) -> void: Sets trim warning +- getMaxRetries() -> int: Gets max retry attempts +- setMaxRetries(int) -> void: Sets max retry attempts +- getRetryTemperatureIncrement() -> float: Retrieves retry temp increment +- setRetryTemperatureIncrement(float) -> void: Sets retry temp increment +- getTopP() -> float: Gets nucleus sampling threshold +- setTopP(float) -> void: Sets nucleus sampling threshold +- getTopK() -> int: Gets top-k sampling limit +- setTopK(int) -> void: Sets top-k sampling limit +- getRepeatPenalty() -> float: Retrieves repeat penalty +- setRepeatPenalty(float) -> void: Sets repeat penalty +- isChatTemplateEnableThinking() -> boolean: Checks chat template thinking mode +- setChatTemplateEnableThinking(boolean) -> void: Sets chat template thinking mode +- getStopStrings() -> List: Gets stop strings +- setStopStrings(Collection) -> void: Sets stop strings + +#### Dependencies +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- No explicit exception handling +- Null values allowed for optional fields (stopStrings) + +#### Concurrency +- Mutable class, not thread-safe +- Caller must ensure thread-safety when accessing shared instances diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..cc6d907 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,53 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:13:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Resolves AI model definitions by converting them to generation configurations + +#### Purpose +- Maps AI model definitions to generation configurations +- Provides lookup for AI models based on keys + +#### Type +- Class +- Final +- Notable annotations: @ToString + +#### Input +- List of AiModelDefinition objects in constructor +- String key in getConfig method + +#### Output +- Map of String keys to AiGenerationConfig objects +- AiGenerationConfig object from getConfig method + +#### Core logic +- Builds map of definitions during construction +- Converts definitions to configs using toConfig method +- Performs null checks on definition keys +- Throws exceptions for missing or null keys + +#### Public API +- `AiModelDefinitionSupport(List)` -> Constructor +- `AiGenerationConfig getConfig(String)` -> Retrieves config by key + +#### Dependencies +- java.util.HashMap +- java.util.List +- java.util.Map +- java.util.Objects +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper + +#### Exceptions / Errors +- NullPointerException for null keys during construction +- IllegalArgumentException for missing keys in getConfig +- NullPointerExceptions in toConfig if definition is null + +#### Concurrency +- Thread-safe due to final class and immutable state diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..a9da0ab --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:21:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> This package provides AI configuration and field generation capabilities for Maven builds, facilitating integration with various AI models and generation settings. + +#### Purpose +- Facilitates AI model configuration and field generation in Maven projects +- Supports integration with different AI models and generation parameters + +#### Responsibilities +- Configuration management for AI models and generation settings +- Field generation based on AI prompts and model definitions +- Selection of appropriate configurations for source files + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiFieldGenerationSelector`: Selects AI field generation configuration based on file extensions +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiGenerationKind`: Enumerates AI generation targets (per-file or aggregate) +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `AiModelDefinitionSupport`: Resolves AI model definitions to generation configurations + +#### Data flow +AI field generation configurations are applied to source files based on their extensions. The `AiFieldGenerationSelector` matches these configurations to input files, which are then processed using the associated `AiGenerationConfig` and `AiModelDefinition`. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..23bdae2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,42 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:26:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. + +#### Purpose +- Facilitates AI model integration in Maven projects +- Supports configuration and field generation for different AI models + +#### Responsibilities +- AI model configuration management +- Field generation based on AI prompts +- Integration with Maven build processes +- Support for multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with the `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..f1828eb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,44 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:15:02Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses LLM completion text to extract model answer, stripping internal reasoning + +#### Purpose +- Extracts and cleans model answers from LLM completions +- Handles Gemma-4 specific thinking block formatting + +#### Type +- Class +- Non-final for subclassing and testing + +#### Input +- Raw completion text (String) + +#### Output +- Cleaned answer text (String) +- IOException for incomplete reasoning blocks + +#### Core logic +- Identifies start and end markers of thinking blocks +- Removes internal reasoning while preserving the actual answer +- Handles edge cases (null input, exhausted token budget) + +#### Public API +- `AiCompletionParser()` -> Constructor +- `parseCompletion(String response) -> String` -> Strips thinking block from response + +#### Dependencies +- java.io.IOException +- lombok.ToString + +#### Exceptions / Errors +- IOException when token budget is exhausted inside a thinking block + +#### Concurrency +- Thread-safe due to immutable static final markers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..61cbd18 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,50 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:15:59Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides AI text generation for documents based on prompts and parameters. + +#### Purpose +- Defines an interface for pluggable AI backends +- Handles text generation requests for AI models + +#### Type +- Interface +- Implements AutoCloseable +- Extends net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest + +#### Input +- AiGenerationRequest object containing prompt details + +#### Output +- Generated text as String +- May throw IOException + +#### Core logic +- Generates text based on AI model and request parameters +- Supports temperature override for retry attempts +- Provides default close method + +#### Public API +- generate(AiGenerationRequest) -> String + Generates text using provider's default settings +- generate(AiGenerationRequest, float) -> String + Generates text with specified temperature override +- close() -> void + Closes the AI generation provider + +#### Dependencies +- java.io.IOException +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest + +#### Exceptions / Errors +- Throws IOException for underlying provider failures +- Returns null or blank string for empty model responses + +#### Concurrency +- Thread-safe due to interface nature and AutoCloseable implementation diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..fbee0b2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,53 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:16:52Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an AiGenerationProvider implementation by name. + +#### Purpose +- Creates instances of AiGenerationProvider based on a given name +- Handles provider selection logic + +#### Type +- Class +- Public +- Annotated with @ToString + +#### Input +- String providerName +- LlamaCppJniConfig llamaConfig +- AiPromptSupport promptSupport + +#### Output +- AiGenerationProvider instance +- Throws IllegalArgumentException for unsupported providers + +#### Core logic +- Checks if providerName is null or blank +- Uses switch statement to select appropriate provider implementation +- Returns new MockAiGenerationProvider for "mock" or null/blank input +- Returns new LlamaCppJniAiGenerationProvider for "llamacpp-jni" +- Throws exception for unsupported providers + +#### Public API +- create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider + Selects and instantiates an AI generation provider based on the given name. + +#### Dependencies +- lombok.ToString +- Java8CompatibilityHelper +- MockAiGenerationProvider +- LlamaCppJniAiGenerationProvider +- AiPromptSupport + +#### Exceptions / Errors +- Throws IllegalArgumentException for unsupported providers +- Handles null or blank providerName by defaulting to mock provider + +#### Concurrency +- Thread-safe due to immutable state and stateless factory methods diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..bc8503a --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,64 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:17:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides AI text generation using locally-run GGUF models via llama.cpp JNI binding + +#### Purpose +- Implements `AiGenerationProvider` for AI text generation +- Uses llama.cpp JNI binding to run GGUF models locally + +#### Type +- Class +- Final +- Implements `AiGenerationProvider`, `AutoCloseable` +- Uses Lombok's `@ToString` annotation + +#### Input +- `LlamaCppJniConfig` and `AiPromptSupport` in constructor +- `AiGenerationRequest` and optional temperature in `generate` methods + +#### Output +- Generated text as `String` from `generate` methods +- Closes native resources with `close` method + +#### Core logic +- Lazy initialization of llama.cpp model +- Builds AI prompts using `AiPromptSupport` +- Configures inference parameters for text generation +- Parses completion results using `AiCompletionParser` + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport) -> void` +- `generate(AiGenerationRequest) -> String` +- `generate(AiGenerationRequest, float) -> String` +- `close() -> void` + +#### Dependencies +- `java.io.IOException` +- `java.util.ArrayList` +- `java.util.Collections` +- `java.util.List` +- `java.util.Objects` +- `lombok.ToString` +- `net.ladenthin.llama.LlamaModel` +- `net.ladenthin.llama.parameters.InferenceParameters` +- `net.ladenthin.llama.parameters.ModelParameters` +- `net.ladenthin.llama.value.Pair` +- `net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest` +- `net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport` +- `org.jspecify.annotations.Nullable` + +#### Exceptions / Errors +- Throws `IOException` for I/O errors during generation +- Handles null model state in `generate` methods +- Propagates exceptions from native llama.cpp calls + +#### Concurrency +- Thread-safe due to immutable configuration and local model execution +- Model initialization is synchronized via double-checked locking pattern diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..32801d2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,58 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:19:37Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides configuration for llama.cpp JNI provider with immutable fields and accessor methods. + +#### Purpose +- Configures llama.cpp JNI settings +- Immutable value type for safe concurrent use + +#### Type +- `final class` +- Annotated with Lombok annotations +- Implements `ConvertToRecord` interface + +#### Input +- Constructor parameters: library path, model path, context size, etc. +- List of stop strings (may be null) + +#### Output +- Accessor methods returning configuration values +- Immutable list of stop strings + +#### Core logic +- Validates non-null model path in constructor +- Initializes all fields, setting stopStrings to empty list if null +- Provides read-only access to all configuration properties + +#### Public API +- `libraryPath() -> String` - Returns native library path or null +- `modelPath() -> String` - Returns model file path +- `contextSize() -> int` - Returns context window size +- `maxOutputTokens() -> int` - Returns max output tokens +- `temperature() -> float` - Returns sampling temperature +- `threads() -> int` - Returns number of CPU threads +- `topP() -> float` - Returns nucleus-sampling threshold +- `topK() -> int` - Returns top-k sampling limit +- `repeatPenalty() -> float` - Returns repetition penalty +- `chatTemplateEnableThinking() -> boolean` - Returns chat-template mode status +- `stopStrings() -> List` - Returns unmodifiable list of stop strings + +#### Dependencies +- `java.util.Collections` +- `java.util.List` +- `java.util.Objects` +- Lombok annotations +- `ConvertToRecord` interface + +#### Exceptions / Errors +- Throws `NullPointerException` if modelPath is null in constructor + +#### Concurrency +- Immutable, thread-safe class diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..c4a3c41 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:21:16Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides mock AI generation summaries for testing purposes + +#### Purpose +- Implements a deterministic AI generation provider +- Returns mock summaries for testing + +#### Type +class public implements AiGenerationProvider @ToString + +#### Input +- AiGenerationRequest object with source file information + +#### Output +- String containing mock summary + +#### Core logic +1. Extracts filename from source file path +2. Generates mock summary string + +#### Public API +- MockAiGenerationProvider() -> constructor +- generate(AiGenerationRequest) -> String throws IOException + +#### Dependencies +- java.io.IOException +- java.nio.file.Path +- lombok.ToString +- net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest + +#### Exceptions +- Throws IOException if file operations fail diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..ebdedb9 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,46 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:24:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> This package provides AI text generation capabilities using various backends, including local GGUF models via llama.cpp JNI binding and mock implementations for testing. + +#### Purpose +- Offers pluggable AI text generation services +- Supports multiple AI provider implementations + +#### Responsibilities +- AI generation request handling +- Provider selection and instantiation +- Text parsing and cleaning +- Mock provider for testing + +#### Key units +- `AiCompletionParser`: Parses LLM completion text +- `AiGenerationProvider`: Defines AI generation interface +- `AiGenerationProviderFactory`: Creates AI generation providers +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider +- `LlamaCppJniConfig`: Configuration for llama.cpp JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +AI generation requests flow through the factory to select an appropriate provider, which then uses the completion parser to process model outputs. + +#### Dependencies +- Internal collaboration between providers and parsers +- External dependencies include llama.cpp JNI bindings and AI model files + +#### Cross-cutting +- Shared configuration handling across providers +- Common exception handling for I/O operations +- Thread-safe implementations for concurrent use diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..5773b76 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:27:03Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. + +#### Purpose +- Facilitates AI model integration in Maven projects +- Supports configuration and field generation for different AI models + +#### Responsibilities +- AI model configuration management +- Field generation based on AI prompts +- Integration with Maven build processes +- Support for multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with the `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..ab4e5cb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:27:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. + +#### Purpose +- Facilitates AI model integration in Maven projects +- Supports configuration and field generation for different AI models + +#### Responsibilities +- AI model configuration management +- Field generation based on AI prompts +- Integration with Maven build processes +- Support for multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with the `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..f9069a5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:28:46Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. + +#### Purpose +- Facilitates AI model integration in Maven projects +- Supports configuration and field generation for different AI models + +#### Responsibilities +- AI model configuration management +- Field generation based on AI prompts +- Integration with Maven build processes +- Support for multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with the `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/package.ai.md new file mode 100644 index 0000000..07c3c1f --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/net/package.ai.md @@ -0,0 +1,41 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:29:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. + +#### Purpose +- Facilitates AI model integration in Maven projects +- Supports configuration and field generation for different AI models + +#### Responsibilities +- AI model configuration management +- Field generation based on AI prompts +- Integration with Maven build processes +- Support for multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with the `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/package.ai.md new file mode 100644 index 0000000..6494863 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/java/package.ai.md @@ -0,0 +1,41 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:30:30Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> This package streamlines AI integration within Maven projects, enabling seamless configuration and field generation for various AI models. + +#### Purpose +- Simplifies AI model integration in Maven builds +- Automates configuration and field generation for different AI models + +#### Responsibilities +- Manages AI model configurations +- Generates fields based on AI prompts +- Integrates with Maven build processes +- Supports multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/package.ai.md new file mode 100644 index 0000000..a090e30 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/main/package.ai.md @@ -0,0 +1,41 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:31:22Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> This package streamlines AI integration within Maven projects, enabling seamless configuration and field generation for various AI models. + +#### Purpose +- Simplifies AI model integration in Maven builds +- Automates configuration and field generation for different AI models + +#### Responsibilities +- Manages AI model configurations +- Generates fields based on AI prompts +- Integrates with Maven build processes +- Supports multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/package.ai.md new file mode 100644 index 0000000..322ece3 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/package.ai.md @@ -0,0 +1,41 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:32:13Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> This package streamlines AI integration within Maven projects, enabling seamless configuration and field generation for various AI models. + +#### Purpose +- Simplifies AI model integration in Maven builds +- Automates configuration and field generation for different AI models + +#### Responsibilities +- Manages AI model configurations +- Generates fields based on AI prompts +- Integrates with Maven build processes +- Supports multiple AI provider implementations + +#### Key units +- `AiFieldGenerationConfig`: Configures AI field generation for Maven plugin +- `AiGenerationConfig`: Manages AI generation parameters for Maven build integration +- `AiModelDefinition`: Defines AI model configurations for Maven plugin use +- `LlamaCppJniAiGenerationProvider`: Local GGUF model provider for AI text generation + +#### Data flow +AI configurations are applied to source files, with `AiFieldGenerationConfig` and `AiModelDefinition` driving the process. The `LlamaCppJniAiGenerationProvider` handles the actual text generation using local models. + +#### Dependencies +- Java collections framework (List, Map) +- Lombok for annotations (ToString) +- JSpecify for nullability annotations +- llama.cpp JNI bindings for local model support + +#### Cross-cutting +- Configuration management across multiple classes +- Error handling for null inputs and missing configurations +- Thread-safety considerations for mutable state in generation providers diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/project.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/project.ai.md new file mode 100644 index 0000000..5cffd95 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v1/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 10473F99 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:33:08Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +This project provides a comprehensive AI integration solution for Maven builds, offering configuration and field generation capabilities across multiple AI models. It includes subsystems for managing AI configurations, supporting various backends for text generation, and facilitating seamless integration into Maven projects. The core functionality is centered around the llamacpp-ai-index-maven-plugin, which leverages llama.cpp JNI bindings for local GGUF model support and mock implementations for testing purposes. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — This package provides AI configuration and field generation capabilities for Maven builds, facilitating integration with various AI models and generation settings. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — This package provides AI text generation capabilities using various backends, including local GGUF models via llama.cpp JNI binding and mock implementations for testing. +- main/java/net/ladenthin/maven/llamacpp — This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. +- main/java/net/ladenthin/maven — This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. +- main/java/net/ladenthin — This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. +- main/java/net — This package provides AI integration capabilities for Maven builds, supporting configuration and field generation for various AI models. +- main/java — This package streamlines AI integration within Maven projects, enabling seamless configuration and field generation for various AI models. +- main — This package streamlines AI integration within Maven projects, enabling seamless configuration and field generation for various AI models. +- . — This package streamlines AI integration within Maven projects, enabling seamless configuration and field generation for various AI models. diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md new file mode 100644 index 0000000..11cfe17 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java.ai.md @@ -0,0 +1,50 @@ +### AiFieldGenerationConfig.java +- H: 1.0 +- C: D35DA51C +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:33:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Maven plugin configuration for associating prompt templates with AI model definitions for field generation. + +#### Purpose +- Configure AI field generation via prompt templates and AI models. +- Associate configurations with specific file extensions or use as a fallback. + +#### Type +class public @ToString + +#### Input +- String promptKey, aiDefinitionKey +- Collection fileExtensions + +#### Output +- String promptKey, aiDefinitionKey +- List fileExtensions (unmodifiable copy) + +#### Core logic +- Store and retrieve configuration for AI field generation. +- Handle file extension-based selection or fallback. +- Provide defensive copying for file extensions. + +#### Public API +- getPromptKey() -> String: Get prompt template key +- setPromptKey(String) -> void: Set prompt template key +- getAiDefinitionKey() -> String: Get AI model definition key +- setAiDefinitionKey(String) -> void: Set AI model definition key +- getFileExtensions() -> List: Get file extensions (unmodifiable) +- setFileExtensions(Collection) -> void: Set file extensions + +#### Dependencies +- AiModelDefinition +- AiModelDefinitionSupport +- AiPromptDefinition +- List, ArrayList, Collections + +#### Exceptions / Errors +No explicit exceptions. Null handling for fileExtensions is documented. + +#### Concurrency +Not explicitly thread-safe. Mutable state with potential race conditions in multi-threaded environments. diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md new file mode 100644 index 0000000..819ffa7 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java.ai.md @@ -0,0 +1,44 @@ +### AiFieldGenerationSelector.java +- H: 1.0 +- C: ACD28FC9 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:35:32Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects the appropriate AI field generation configuration based on source file extensions. + +#### Purpose +- Selects `AiFieldGenerationConfig` for a given source file. +- Determines applicable config using file extensions. + +#### Type +class final, Lombok @ToString annotation + +#### Input +- Iterable of `AiFieldGenerationConfig` objects +- Source file name as String + +#### Output +- Matching `AiFieldGenerationConfig` or null + +#### Core logic +1. Iterate through configs +2. Check for matching extensions +3. Return first match or fallback +4. Return null if no match and no fallback + +#### Public API +```java +selectForFileName(Iterable, String) -> @Nullable AiFieldGenerationConfig +``` + +#### Dependencies +- `AiFieldGenerationConfig` +- `List` +- `Nullable` annotation + +#### Exceptions / Errors +- Throws exceptions from `AiFieldGenerationConfig.getFileExtensions()` +- Handles null configs and extensions gracefully diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md new file mode 100644 index 0000000..da83387 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java.ai.md @@ -0,0 +1,67 @@ +### AiGenerationConfig.java +- H: 1.0 +- C: 59512635 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:36:21Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configuration object for AI generation parameters between Maven and provider implementations + +#### Purpose +- Mutable configuration for AI generation steps +- Carries all parameters for a single AI generation step + +#### Type +class public @ToString + +#### Input +- Constructor: no input +- Setters: various primitive and String parameters + +#### Output +- Getters: return various primitive types, Strings, or Lists +- Produced state: mutable fields + +#### Core logic +- Stores AI generation parameters +- Provides getter/setter methods for each parameter +- Manages a list of stop strings + +#### Public API +- `getModelPath() -> String`: Returns model file path +- `setModelPath(String) -> void`: Sets model file path +- `getContextSize() -> int`: Returns context size +- `setMaxOutputTokens(int) -> void`: Sets max output tokens +- `getTemperature() -> float`: Returns temperature +- `setTemperature(float) -> void`: Sets temperature +- `getThreads() -> int`: Returns thread count +- `setThreads(int) -> void`: Sets thread count +- `getCharsPerToken() -> int`: Returns chars per token +- `setCharsPerToken(int) -> void`: Sets chars per token +- `getMaxInputChars() -> int`: Returns max input chars +- `setMaxInputChars(int) -> void`: Sets max input chars +- `isWarnOnTrim() -> boolean`: Checks trim warning setting +- `setWarnOnTrim(boolean) -> void`: Sets trim warning setting +- `getMaxRetries() -> int`: Returns max retries +- `setMaxRetries(int) -> void`: Sets max retries +- `getRetryTemperatureIncrement() -> float`: Returns retry temp increment +- `setRetryTemperatureIncrement(float) -> void`: Sets retry temp increment +- `getTopP() -> float`: Returns top-p value +- `setTopP(float) -> void`: Sets top-p value +- `getTopK() -> int`: Returns top-k value +- `setTopK(int) -> void`: Sets top-k value +- `getRepeatPenalty() -> float`: Returns repeat penalty +- `setRepeatPenalty(float) -> void`: Sets repeat penalty +- `isChatTemplateEnableThinking() -> boolean`: Checks chat template thinking mode +- `setChatTemplateEnableThinking(boolean) -> void`: Sets chat template thinking mode +- `getStopStrings() -> List`: Returns stop strings list +- `setStopStrings(List) -> void`: Sets stop strings list + +#### Dependencies +- java.util.ArrayList +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md new file mode 100644 index 0000000..59cb6f8 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationKind.java.ai.md @@ -0,0 +1,35 @@ +### AiGenerationKind.java +- H: 1.0 +- C: 502093E2 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:39:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Enum defining AI generation scope: single file or entire package + +#### Purpose +- Defines AI generation targets (file vs. package) +- Enumerates possible generation modes + +#### Type +enum public + final + +#### Core logic +- Lists two generation modes: FILE_SUMMARY and PACKAGE_SUMMARY +- Each mode represents a distinct purpose for AI processing + +#### Public API +AiGenerationKind() -> void +values() -> AiGenerationKind[] +valueOf(String) -> AiGenerationKind +FILE_SUMMARY -> enum constant representing file-level summary +PACKAGE_SUMMARY -> enum constant representing package-level summary + +#### Dependencies +java.lang.Enum +java.lang.String + +#### Exceptions / Errors +No explicit exceptions diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md new file mode 100644 index 0000000..a5fb381 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java.ai.md @@ -0,0 +1,80 @@ +### AiModelDefinition.java +- H: 1.0 +- C: F0FA9D43 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:40:19Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configuration POJO for AI model parameters, supporting Maven plugin integration and reusable configurations. + +#### Purpose +- Define AI model parameters +- Support Maven plugin configuration +- Enable reuse of model configurations + +#### Type +class public final @ToString + +#### Input +- Constructor: none +- Setters: all fields (key, modelPath, contextSize, etc.) + +#### Output +- Getters: all fields (key, modelPath, contextSize, etc.) +- Returns: various types (String, int, float, boolean, List) + +#### Core logic +- Store and retrieve AI model parameters +- Handle default values from AiGenerationConfig +- Manage collection of stop strings +- Provide immutable access to stop strings list + +#### Public API +- getKey() -> String: Retrieve unique identifier +- setKey(String) -> void: Set unique identifier +- getModelPath() -> String: Get model file path +- setModelPath(String) -> void: Set model file path +- getContextSize() -> int: Get context window size +- setContextSize(int) -> void: Set context window size +- getMaxOutputTokens() -> int: Get max output tokens +- setMaxOutputTokens(int) -> void: Set max output tokens +- getTemperature() -> float: Get sampling temperature +- setTemperature(float) -> void: Set sampling temperature +- getThreads() -> int: Get thread count +- setThreads(int) -> void: Set thread count +- getCharsPerToken() -> int: Get chars per token ratio +- setCharsPerToken(int) -> void: Set chars per token ratio +- isWarnOnTrim() -> boolean: Check trim warning setting +- setWarnOnTrim(boolean) -> void: Set trim warning setting +- getMaxRetries() -> int: Get max retry attempts +- setMaxRetries(int) -> void: Set max retry attempts +- getRetryTemperatureIncrement() -> float: Get retry temperature increment +- setRetryTemperatureIncrement(float) -> void: Set retry temperature increment +- getTopP() -> float: Get nucleus sampling threshold +- setTopP(float) -> void: Set nucleus sampling threshold +- getTopK() -> int: Get top-k sampling limit +- setTopK(int) -> void: Set top-k sampling limit +- getRepeatPenalty() -> float: Get repetition penalty +- setRepeatPenalty(float) -> void: Set repetition penalty +- isChatTemplateEnableThinking() -> boolean: Check chat template thinking mode +- setChatTemplateEnableThinking(boolean) -> void: Set chat template thinking mode +- getStopStrings() -> List: Get stop strings +- setStopStrings(Collection) -> void: Set stop strings + +#### Dependencies +- java.util.ArrayList +- java.util.Collection +- java.util.Collections +- java.util.List +- lombok.ToString +- org.jspecify.annotations.Nullable + +#### Exceptions / Errors +- NullPointerException: Possible from getStopStrings() if not initialized +- UnsupportedOperationException: From unmodifiableList in getStopStrings() + +#### Concurrency +- Not thread-safe due to mutable fields +- Collections.unmodifiableList provides some level of protection for stop strings diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md new file mode 100644 index 0000000..e9797cb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java.ai.md @@ -0,0 +1,51 @@ +### AiModelDefinitionSupport.java +- H: 1.0 +- C: 0A078A71 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:43:47Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Manages AI model definitions, converting them to generation configurations for use in Maven plugin configurations. + +#### Purpose +- Resolves `AiModelDefinition` entries into `AiGenerationConfig` objects +- Enforces non-null keys in configuration +- Provides eager error detection for missing definitions + +#### Type +class final + @ToString + +#### Input +- List of `AiModelDefinition` objects (may be null or empty) +- Individual `AiModelDefinition` entries must have non-null keys + +#### Output +- Map of `String` to `AiGenerationConfig` +- `AiGenerationConfig` objects populated from `AiModelDefinition` fields + +#### Core logic +1. Initialize config map with optimized capacity +2. Iterate through definitions, validate keys, and populate config map +3. Convert `AiModelDefinition` to `AiGenerationConfig` using field values +4. Provide lookup method for generation configs by key + +#### Public API +- `AiModelDefinitionSupport(List)` -> Constructs the support object +- `getConfig(String)` -> Returns the corresponding `AiGenerationConfig` for a given key + +#### Dependencies +- `HashMap` +- `List` +- `Objects` +- `Java8CompatibilityHelper` +- `AiModelDefinition` +- `AiGenerationConfig` + +#### Exceptions / Errors +- `NullPointerException` for null keys in definitions +- `IllegalArgumentException` for missing definition lookups + +#### Concurrency +- Thread-safe due to immutable state after construction diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md new file mode 100644 index 0000000..9aafd78 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/config +- H: 1.0 +- C: 7C13CB6A +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:51:39Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiFieldGenerationConfig.java](AiFieldGenerationConfig.java.ai.md) +- F: [AiFieldGenerationSelector.java](AiFieldGenerationSelector.java.ai.md) +- F: [AiGenerationConfig.java](AiGenerationConfig.java.ai.md) +- F: [AiGenerationKind.java](AiGenerationKind.java.ai.md) +- F: [AiModelDefinition.java](AiModelDefinition.java.ai.md) +- F: [AiModelDefinitionSupport.java](AiModelDefinitionSupport.java.ai.md) +--- +> Maven plugin configuration for AI field generation, associating prompt templates with AI model definitions for field generation across various file extensions. + +#### Purpose +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback + +#### Responsibilities +- Manage AI field generation configurations +- Handle file extension-based selection of configurations +- Provide public API for configuration management + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration + +#### Data flow +- Input: Source file name, prompt template key, AI model definition key, file extensions +- Process: Configuration selection based on file extensions +- Output: Matching `AiFieldGenerationConfig` or null + +#### Dependencies +- `AiModelDefinition` +- `AiPromptDefinition` (implied) +- `List`, `ArrayList`, `Collections` (for data structures) + +#### Cross-cutting +- Error handling for null configurations and extensions +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md new file mode 100644 index 0000000..10be087 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md @@ -0,0 +1,49 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex +- H: 1.0 +- C: 83E61DEB +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:55:38Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [config/](config/package.ai.md) +- F: [provider/](provider/package.ai.md) +--- +> This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md new file mode 100644 index 0000000..27ef5a0 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiCompletionParser.java.ai.md @@ -0,0 +1,42 @@ +### AiCompletionParser.java +- H: 1.0 +- C: 78BEBEB3 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:45:17Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Parses raw LLM completion text to extract the model answer by stripping any model-internal thinking block before storing in an AI index file. + +#### Purpose +- Extracts and cleans model answers from LLM completion texts +- Handles Gemma-4 specific thinking block markers + +#### Type +class public final @ToString + +#### Input +- String response: raw completion text from the model, may be null + +#### Output +- String: cleaned answer text, never null +- IOException: if token budget exhausted inside a thinking block + +#### Core logic +1. Check for null input +2. Look for end marker to extract answer +3. Handle case where start marker present but end marker absent +4. Return trimmed response if no markers found + +#### Public API +``` +parseCompletion(String response) -> String throws IOException +``` + +#### Dependencies +- java.io.IOException +- lombok.ToString + +#### Exceptions / Errors +- IOException: when token budget exhausted inside a thinking block diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md new file mode 100644 index 0000000..2062af4 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProvider.java.ai.md @@ -0,0 +1,40 @@ +### AiGenerationProvider.java +- H: 1.0 +- C: 450236CF +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:46:14Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Interface for pluggable AI backend that produces text for generation requests + +#### Purpose +- Defines an interface for AI text generation providers +- Allows for local or mock implementations + +#### Type +interface + public; implements AutoCloseable + +#### Input +AiGenerationRequest object with prompt key, source file, source text, and current header + +#### Output +String containing generated text; may be empty but never null; throws IOException on failure + +#### Core logic +- Generate text based on AiGenerationRequest +- Allow temperature override for retry attempts +- Provide close method for resource management + +#### Public API +generate(AiGenerationRequest) -> String +generate(AiGenerationRequest, float) -> String +close() -> void + +#### Dependencies +AiGenerationRequest +IOException + +#### Exceptions / Errors +Throws IOException if underlying provider fails diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md new file mode 100644 index 0000000..1a9ef20 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactory.java.ai.md @@ -0,0 +1,50 @@ +### AiGenerationProviderFactory.java +- H: 1.0 +- C: 0ADDB961 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:46:54Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Selects and instantiates an `AiGenerationProvider` implementation by name. + +#### Purpose +- Instantiates `AiGenerationProvider` based on a given name. +- Handles default and specific provider cases. + +#### Type +class public; implements none; extends none; key generics none; notable annotations: @ToString + +#### Input +- `String providerName`: Provider key (mock/llamacpp-jni). +- `LlamaCppJniConfig llamaConfig`: Configuration for llama.cpp JNI provider. +- `AiPromptSupport promptSupport`: Prompt lookup support for providers needing it. + +#### Output +- `AiGenerationProvider`: Newly-created provider instance. +- `IllegalArgumentException`: If `providerName` is unrecognized. + +#### Core logic +1. Check if `providerName` is null or blank. +2. Switch on `providerName`: + - Return `MockAiGenerationProvider` for "mock". + - Return `LlamaCppJniAiGenerationProvider` for "llamacpp-jni". + - Throw exception for unsupported providers. + +#### Public API +- `create(String, LlamaCppJniConfig, AiPromptSupport) -> AiGenerationProvider`: Creates and returns an AI generation provider based on the given name and configurations. + +#### Dependencies +- `AiGenerationProvider` +- `MockAiGenerationProvider` +- `LlamaCppJniAiGenerationProvider` +- `Java8CompatibilityHelper` +- `LlamaCppJniConfig` +- `AiPromptSupport` + +#### Exceptions / Errors +- `IllegalArgumentException`: Thrown for unsupported provider names. + +#### Concurrency +No explicit concurrency considerations in the source. diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..b70f9c5 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java.ai.md @@ -0,0 +1,58 @@ +### LlamaCppJniAiGenerationProvider.java +- H: 1.0 +- C: 7DBF06B9 +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:48:00Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Provides AI text generation using locally-run GGUF models via llama.cpp JNI binding. + +#### Purpose +- Implements `AiGenerationProvider` interface +- Manages lifecycle of native LLama model +- Handles AI prompt generation and completion parsing + +#### Type +class final implements AiGenerationProvider, AutoCloseable + +#### Input +- `LlamaCppJniConfig`, `AiPromptSupport` in constructor +- `AiGenerationRequest` in generate methods +- Model parameters from config + +#### Output +- Generated text as `String` +- May mutate internal `LlamaModel` state +- Closes native resources on `close()` + +#### Core logic +1. Lazy-loads GGUF model on first generation +2. Builds AI prompts using `AiPromptSupport` +3. Configures inference parameters from config +4. Calls native model for text completion +5. Parses and returns generated text + +#### Public API +- `LlamaCppJniAiGenerationProvider(LlamaCppJniConfig, AiPromptSupport) -> void` + Initializes provider with configuration and prompt support +- `generate(AiGenerationRequest) -> String` + Generates text using default temperature +- `generate(AiGenerationRequest, float) -> String` + Generates text with specified temperature override +- `close() -> void` + Releases native resources + +#### Dependencies +- `LlamaCppJniConfig` +- `AiPromptSupport` +- `AiGenerationRequest` +- `LlamaModel` +- `InferenceParameters` +- `Pair` +- `AiCompletionParser` + +#### Exceptions / Errors +- Throws `IOException` for native model loading or generation errors +- Handles null values in input parameters diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md new file mode 100644 index 0000000..759338e --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java.ai.md @@ -0,0 +1,53 @@ +### LlamaCppJniConfig.java +- H: 1.0 +- C: 0B74C5FA +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:49:31Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Configuration for llama.cpp JNI provider, managing native library paths and AI model parameters. + +#### Purpose +- Immutable configuration for llama.cpp JNI provider +- Manages native library paths and AI model parameters + +#### Type +class final; implements ConvertToRecord; Lombok annotations: @ToString, @EqualsAndHashCode + +#### Input +- Constructor parameters: libraryPath, modelPath, contextSize, maxOutputTokens, temperature, threads, topP, topK, repeatPenalty, chatTemplateEnableThinking, stopStrings +- List for stopStrings (may be null) + +#### Output +- Getter methods returning primitive types or String +- List for stopStrings (unmodifiable) + +#### Core logic +- Validates modelPath in constructor +- Initializes immutable fields with provided values +- Provides access to configuration parameters via getter methods + +#### Public API +- libraryPath() -> String: Returns native library path or null +- modelPath() -> String: Returns model file path +- contextSize() -> int: Returns context window size +- maxOutputTokens() -> int: Returns maximum output tokens +- temperature() -> float: Returns sampling temperature +- threads() -> int: Returns number of CPU threads +- topP() -> float: Returns nucleus-sampling probability threshold +- topK() -> int: Returns top-k sampling limit +- repeatPenalty() -> float: Returns repetition penalty +- chatTemplateEnableThinking() -> boolean: Returns whether chat-template thinking mode is enabled +- stopStrings() -> List: Returns unmodifiable list of stop strings + +#### Dependencies +- ConvertToRecord +- Collections +- Objects +- List +- String + +#### Exceptions / Errors +- NullPointerException if modelPath is null in constructor diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md new file mode 100644 index 0000000..0a0c2fb --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/MockAiGenerationProvider.java.ai.md @@ -0,0 +1,39 @@ +### MockAiGenerationProvider.java +- H: 1.0 +- C: C1880BAD +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:51:06Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: file +--- +> Mock AI generation provider for testing purposes, returning deterministic mock summaries. + +#### Purpose +- Mock implementation of `AiGenerationProvider` for testing +- Returns a fixed mock summary based on the input file name + +#### Type +class public implements AiGenerationProvider @ToString + +#### Input +- `AiGenerationRequest` object containing source file information + +#### Output +- String containing mock summary + +#### Core logic +1. Extract file name from request +2. Generate mock summary string with file name + +#### Public API +- `MockAiGenerationProvider() -> void` Constructs the provider +- `generate(AiGenerationRequest) -> String` Generates mock summary + +#### Dependencies +- `AiGenerationRequest` +- `Path` +- `IOException` + +#### Exceptions / Errors +- May throw `IOException` if file operations fail diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md new file mode 100644 index 0000000..4b38175 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md @@ -0,0 +1,45 @@ +### main/java/net/ladenthin/maven/llamacpp/aiindex/provider +- H: 1.0 +- C: BA4DB05D +- D: 2026-06-25T05:31:58Z +- T: 2026-06-27T04:53:58Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [AiCompletionParser.java](AiCompletionParser.java.ai.md) +- F: [AiGenerationProvider.java](AiGenerationProvider.java.ai.md) +- F: [AiGenerationProviderFactory.java](AiGenerationProviderFactory.java.ai.md) +- F: [LlamaCppJniAiGenerationProvider.java](LlamaCppJniAiGenerationProvider.java.ai.md) +- F: [LlamaCppJniConfig.java](LlamaCppJniConfig.java.ai.md) +- F: [MockAiGenerationProvider.java](MockAiGenerationProvider.java.ai.md) +--- +> This package provides a flexible AI generation provider framework, supporting multiple backends including local LLMs via JNI and mock implementations for testing. + +#### Purpose +- Offers pluggable AI text generation providers +- Enables integration of various AI backends +- Facilitates testing through mock implementations + +#### Responsibilities +- Provider selection and instantiation +- Interface definition for AI generation +- Handling of different provider types (mock, local LLMs) +- Resource management and lifecycle control + +#### Key units +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +AI generation requests flow through the factory to create appropriate providers, which then generate text based on the provided configuration and input parameters. + +#### Dependencies +- Cross-unit collaborations: Provider implementations depend on shared interfaces and utility classes +- External modules: JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling: IOException thrown for various failure scenarios +- Configuration management: Immutable configuration objects for provider settings +- Concurrency: Potential for concurrent access to shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md new file mode 100644 index 0000000..ba87d91 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/llamacpp/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven/llamacpp +- H: 1.0 +- C: 52B8025B +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:56:57Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [aiindex/](aiindex/package.ai.md) +--- +> This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/package.ai.md new file mode 100644 index 0000000..2895979 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/maven/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin/maven +- H: 1.0 +- C: 192118FD +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:58:12Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [llamacpp/](llamacpp/package.ai.md) +--- +> This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/package.ai.md new file mode 100644 index 0000000..94fcd3b --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/ladenthin/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net/ladenthin +- H: 1.0 +- C: 1F224605 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T04:59:27Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [maven/](maven/package.ai.md) +--- +> This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/package.ai.md new file mode 100644 index 0000000..67e0c8d --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/net/package.ai.md @@ -0,0 +1,48 @@ +### main/java/net +- H: 1.0 +- C: 9BBA9341 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:00:41Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [ladenthin/](ladenthin/package.ai.md) +--- +> This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/package.ai.md new file mode 100644 index 0000000..a48ddfd --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/java/package.ai.md @@ -0,0 +1,48 @@ +### main/java +- H: 1.0 +- C: E9AF7086 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:01:55Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [net/](net/package.ai.md) +--- +> This package provides AI field generation and text generation capabilities, supporting configuration through templates and models, and enabling multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/package.ai.md new file mode 100644 index 0000000..1b397f2 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/main/package.ai.md @@ -0,0 +1,48 @@ +### main +- H: 1.0 +- C: 0D4DE298 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:03:09Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [java/](java/package.ai.md) +--- +> This package provides AI field generation and text generation capabilities, supporting configuration through templates and models, and enabling multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/package.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/package.ai.md new file mode 100644 index 0000000..c0236fe --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/package.ai.md @@ -0,0 +1,48 @@ +### ai +- H: 1.0 +- C: F01CDC07 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:04:23Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: package +- F: [main/](main/package.ai.md) +--- +> This package provides AI field generation and text generation capabilities, supporting configuration through templates and models, and enabling multiple backend integrations including local LLMs and mock implementations. + +#### Purpose +- Manage AI field generation configurations +- Offer pluggable AI text generation providers + +#### Responsibilities +- Configure AI field generation via prompt templates and AI models +- Associate configurations with specific file extensions or use as a fallback +- Provide public API for configuration management +- Offer pluggable AI text generation providers +- Enable integration of various AI backends +- Facilitate testing through mock implementations + +#### Key units +- `AiFieldGenerationConfig`: Manages individual configuration settings +- `AiFieldGenerationSelector`: Selects appropriate configuration based on file extensions +- `AiModelDefinition`: Defines AI model parameters and supports Maven plugin integration +- `AiGenerationProvider`: Core interface for text generation providers +- `AiGenerationProviderFactory`: Factory for creating provider instances +- `LlamaCppJniAiGenerationProvider`: Local LLM implementation via JNI +- `MockAiGenerationProvider`: Mock implementation for testing + +#### Data flow +- AI field generation: Inputs move through `AiFieldGenerationSelector` to produce `AiFieldGenerationConfig`. +- Text generation: Requests flow through `AiGenerationProviderFactory` to instantiate appropriate providers, which generate text. + +#### Dependencies +- `AiModelDefinition`, `AiPromptDefinition` (implied), `List`, `ArrayList`, `Collections` for data structures +- Cross-unit collaborations between provider implementations and shared interfaces/utility classes +- JNI bindings for local LLM integration + +#### Cross-cutting +- Error handling for null configurations, extensions, and provider failures +- Mutable state management in `AiFieldGenerationConfig` +- Immutable access to stop strings list in `AiModelDefinition` +- Configuration management: Immutable configuration objects for provider settings +- Concurrency considerations for shared resources in multi-threaded environments diff --git a/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/project.ai.md b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/project.ai.md new file mode 100644 index 0000000..cbde692 --- /dev/null +++ b/docs/ai-index-benchmark/outputs/ai__seed-coder-8b__v2/project.ai.md @@ -0,0 +1,35 @@ +### llamacpp-ai-index-maven-plugin +- H: 1.0 +- C: 2CF9ADD2 +- D: 2026-06-26T14:41:56Z +- T: 2026-06-27T05:05:40Z +- G: 1.0.1-SNAPSHOT +- A: 0.0.0 +- X: project +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/config](main/java/net/ladenthin/maven/llamacpp/aiindex/config/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex](main/java/net/ladenthin/maven/llamacpp/aiindex/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp/aiindex/provider](main/java/net/ladenthin/maven/llamacpp/aiindex/provider/package.ai.md) +- F: [main/java/net/ladenthin/maven/llamacpp](main/java/net/ladenthin/maven/llamacpp/package.ai.md) +- F: [main/java/net/ladenthin/maven](main/java/net/ladenthin/maven/package.ai.md) +- F: [main/java/net/ladenthin](main/java/net/ladenthin/package.ai.md) +- F: [main/java/net](main/java/net/package.ai.md) +- F: [main/java](main/java/package.ai.md) +- F: [main](main/package.ai.md) +- F: [.](package.ai.md) +--- +> Project index of llamacpp-ai-index-maven-plugin: one line per package; leads here, clickable links in the header F list. + +#### Overview +The llamacpp-ai-index-maven-plugin project offers a comprehensive solution for AI-driven code generation within Maven projects. It primarily focuses on facilitating AI field generation and text generation providers, with a strong emphasis on configuration through prompt templates and AI models. The plugin supports multiple backend integrations, including local LLMs (Large Language Models) via JNI (Java Native Interface) and mock implementations for testing purposes. This versatile framework allows developers to easily incorporate advanced AI capabilities into their Maven builds, enhancing code generation processes across various file extensions. + +#### Packages +- main/java/net/ladenthin/maven/llamacpp/aiindex/config — Maven plugin configuration for AI field generation, associating prompt templates with AI model definitions for field generation across various file extensions. +- main/java/net/ladenthin/maven/llamacpp/aiindex — This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. +- main/java/net/ladenthin/maven/llamacpp/aiindex/provider — This package provides a flexible AI generation provider framework, supporting multiple backends including local LLMs via JNI and mock implementations for testing. +- main/java/net/ladenthin/maven/llamacpp — This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. +- main/java/net/ladenthin/maven — This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. +- main/java/net/ladenthin — This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. +- main/java/net — This package facilitates AI field generation and text generation providers, supporting configuration via prompt templates and AI models, and offering multiple backend integrations including local LLMs and mock implementations. +- main/java — This package provides AI field generation and text generation capabilities, supporting configuration through templates and models, and enabling multiple backend integrations including local LLMs and mock implementations. +- main — This package provides AI field generation and text generation capabilities, supporting configuration through templates and models, and enabling multiple backend integrations including local LLMs and mock implementations. +- . — This package provides AI field generation and text generation capabilities, supporting configuration through templates and models, and enabling multiple backend integrations including local LLMs and mock implementations. From 9b02df459c04cb5041b876f72aac2942f0b520fd Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 09:51:50 +0200 Subject: [PATCH 02/68] docs: deepen AI index benchmark (per-file matrix, pros/cons, external corroboration) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expand docs/ai-index-benchmark/COMPARISON.md and link it from the root README: - §5 per-model pros & cons table (source-grounded) - §6 source-faithfulness deep-dive on AiGenerationConfig.java - §7 recommendations incl. "max precision, time no object" -> gpt-oss-20b and the best-for-large-files pick - §8 per-file model matrix: 6 archetype files x 8 models, scored vs source (gpt-oss-20b most faithful, 5/6; Qwen2.5-Coder-7B wins the trivial enum) - §9 external corroboration from a web research pass: structural findings (speed<->active params, reasoning-as-throughput-tax, hallucination/tooling categories) corroborated; accuracy ranking is novel/unverifiable; only 2/8 models have published IFEval Fixes: DeepSeek-Coder-V2-Lite license corrected to the use-restricted custom DeepSeek Model License (not "commercial-OK"). Root README "Recommended Models" now links the benchmark and lists the validated picks. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 14 +- docs/ai-index-benchmark/COMPARISON.md | 241 ++++++++++++++++++++++++-- docs/ai-index-benchmark/README.md | 21 ++- 3 files changed, 263 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 410c594..f6a2f05 100644 --- a/README.md +++ b/README.md @@ -358,8 +358,18 @@ src/site/ai/ ## TODO - **Expand PIT mutation-testing scope.** `` in `pom.xml` lists an explicit subset of classes verified at 100% mutation parity; widen it incrementally toward the whole `net.ladenthin.maven.llamacpp.aiindex.*` tree (the streambuffer whole-package model) as more classes reach parity. Generic PIT setup and invocation: see the [PIT policy](../workspace/policies/pit-mutation-testing.md). ## Recommended Models -- Qwen2.5 Coder (balanced quality and speed) -- Smaller instruct models for faster indexing +Based on an 8-model × 2-prompt benchmark run against this codebase — full results, per-model +pros/cons, a source-faithfulness deep-dive, and reproduction steps in +[docs/ai-index-benchmark](docs/ai-index-benchmark/COMPARISON.md): + +- **Qwen3-Coder-30B-A3B-Instruct** — best overall and for large Java files: most complete/faithful + output, code-specialized, Apache-2.0, fast for its quality (~3.3B-active MoE, 262K context). +- **Granite-4.0-H-Tiny** — fastest on CPU (~4×, flat-KV hybrid, Apache-2.0); best for very large + or many files when throughput beats the last points of fidelity. +- **Seed-Coder-8B-Instruct** — clean, permissive (MIT) small dense coder. +- `gpt-oss-20b` is the most *accurate* per file (won 5/6 in the per-file matrix) but the slowest + (~2× the 30B) — use only when fidelity beats throughput; avoid `Qwen3.5-4B` (thinking tax, no + quality gain). ## Development Run full build: diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index 2ff2278..a2d6edb 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -83,20 +83,77 @@ dense 7B Qwen2.5-Coder, and MoE low-active models (Granite, DeepSeek 2.4B, Qwen3 --- -## 5. Recommendations +## 5. Per-model pros & cons + +| Model (active params) | Pros | Cons | +|---|---|---| +| **Qwen3-Coder-30B-A3B** (MoE ~3.3B) | Most complete & faithful content; code-specialized; clean (0 fences / 0 leak); fast for its quality (~71 s/file); Apache-2.0; 262K native ctx | Wrongly tags the class `final`; drops the `@SuppressWarnings` annotation; minor dangling `implements` line | +| **gpt-oss-20b** (MoE ~3.6B) | Highest fidelity — captured exact exception strings, constructor calls, and the unmodifiable/nullable `stopStrings` contract; clean; Apache-2.0 | Slowest (~121–129 s/file — harmony reasoning overhead); "final by default" nonsense; drops `@SuppressWarnings` | +| **Granite-4.0-H-Tiny** (MoE ~1B) | Fastest by far (~34 s/file); the only model that captured `@SuppressWarnings`; Apache-2.0; flat-KV hybrid → cheap long context | Verbose (repeats field lists across sections); wrong `final`; junk self-package dependency entry | +| **Seed-Coder-8B** (dense, MIT) | Clean, terse, accurate; avoided the `final` trap; permissive MIT | Calls the private fields "public fields"; drops `@SuppressWarnings`; v2 emits a few code fences | +| **Qwen3-4B-Instruct-2507** (dense) | Fast (~72 s/file); non-thinking; good core-logic capture; no fences | **Dropped all setters** from Public API (incomplete on a long file); overclaims thread-safety; "final fields" wrong | +| **Qwen2.5-Coder-7B** (dense) | Accurate, code-specialized; captured constructor + unmodifiable `stopStrings` | Slowest dense (~133–141 s/file); wrong `final`; accessor bloat (v1: 109 lines); v2 fences | +| **Qwen3.5-4B** (dense, hybrid) | Thorough API listing; avoided the `final` trap | Thinking tax (~90–101 s/file) with no quality edge; **fabricated field counts** (claimed 25 constants / 16 fields vs real ~13 / 14); junk self-dependency | +| **DeepSeek-Coder-V2-Lite** (MoE ~2.4B) | Fast (~67–84 s/file); accurate body content | **Copied the prompt's "Calculates VAT for invoices" example as the lead** — instruction-following failure; redundant `- **Label**:` echoing; most fences (24); leaked `{@link}` Javadoc tags; **license is a use-restricted custom *DeepSeek Model License* (weights), not OSI/commercial-OK** | + +## 6. Source-faithfulness deep-dive — `AiGenerationConfig.java` (largest in-scope file, 414 lines) + +Each model's summary of this complex POJO was checked field-by-field against the real source. +Cross-model findings: + +- **`final` is hallucinated by 6 of 8 models.** The class is `public class AiGenerationConfig` + (NOT final); only Qwen3.5-4B and Seed-Coder got it right. Likely pattern-matching — most classes + in this repo *are* `final`. A reliable, recurring inaccuracy. +- **Annotation capture is poor.** Only Granite reported `@SuppressWarnings({"NullAway.Init", …})`; + every other model dropped it. Most did capture `@ToString`. +- **The blockquote lead is the riskiest field.** DeepSeek emitted the prompt's literal *example* + (`Calculates VAT for invoices`); the others produced correct domain leads. +- **Completeness varies on a long member list.** gpt-oss / Qwen3-Coder-30B / Qwen2.5-Coder listed + the full accessor set accurately; Qwen3-4B-2507 omitted every setter; Qwen3.5-4B invented counts. +- **`equals`/`hashCode` intentionally absent** (managed by identity) — no model surfaced this + subtlety (acceptable; it requires reasoning about a *negative*). + +Implication: the structural facts models get wrong (class modifiers, annotations, exact member +sets, dependency lists) are exactly the ones an **AST / deterministic extractor would get right**. +The prose sections (lead, purpose, core logic) are where the model adds real value — which argues +for a hybrid deterministic-structure + AI-prose design. + +## 7. Recommendations - **Default for this task: `Qwen3-Coder-30B-A3B-Instruct`** — clean, accurate, code-specialized, Apache-2.0, and fast for its quality (~71 s/file via ~3.3B active MoE). The current production choice is validated. -- **Best speed/quality for large repos or overnight runs: `Granite-4.0-H-Tiny`** — ~4× faster - than the dense coders, Apache-2.0, surprisingly accurate. The standout new candidate. -- **Best permissive small dense coder: `Seed-Coder-8B-Instruct`** — MIT, clean output. Good - middle option. +- **Maximum precision, CPU time no object (one-off index of a large/important project): + `gpt-oss-20b`.** When throughput does not matter, this is the most *faithful* model in the study. + It won the per-file matrix **5 of 6** (§8), was the only model to consistently avoid the `final` + hallucination, copied no prompt examples, and captured exact exception messages, the full member + sets, and the complete JNI pipeline — including correct (unsynchronized) lazy-init where others + invented "double-checked locking". Its harmony chain-of-thought — the very thing that makes it + the slowest (~121–129 s/file, §3) — is what buys the extra accuracy, so the speed cost is + irrelevant in this scenario. Pair it with the **v1 prompt** and a **generous `maxOutputTokens`** + so long member lists are never truncated, and run each file at the model's full context. Output is + clean (0 harmony leakage, §2). For an even higher ceiling you *could* trial larger local models + not benchmarked here (e.g. `Qwen3.6-35B-A3B`, `gemma-4-26B-A4B`), but among the tested set + `gpt-oss-20b` is the precision winner. (For the same one-off job where you still want it to finish + noticeably sooner with only a small fidelity trade, fall back to `Qwen3-Coder-30B-A3B`.) +- **Best for large Java files: `Qwen3-Coder-30B-A3B-Instruct`**, with `Granite-4.0-H-Tiny` as the + high-throughput alternative. Large files mean a big prefill + a long member list to enumerate. + On the 414-line `AiGenerationConfig` the 30B kept the member list complete and accurate, and its + 262K native context + ~3.3B-active MoE handle long input affordably; the full-project baseline + (28 KB `PackageIndexer.java`) confirmed it stays complete (one `Serializable` slip). Granite's + flat-KV hybrid makes very large/​many files the cheapest on CPU (~4× faster) — use it when + throughput beats the last few points of fidelity. **Caveat:** large files were not directly swept + across all models (scope was `config`+`provider`, max 414 lines); this extrapolates from that + file, model architecture, and the 30B full-project baseline. Avoid `Qwen3-4B-2507` for large + files specifically — it dropped members on the long list. +- **Best permissive small dense coder: `Seed-Coder-8B-Instruct`** — MIT, clean output. - **Budget / laptop: `Qwen3-4B-Instruct-2507`** (non-thinking) over `Qwen3.5-4B` — faster, no - thinking tax, equal-or-better output. -- **Avoid for batch summarization:** `gpt-oss-20b` (highest fidelity but slowest — reasoning - overhead not worth it), `Qwen2.5-Coder-7B` (slowest dense), `DeepSeek-Coder-V2-Lite v2` - (formatting noise). + thinking tax, equal-or-better output (but not for the largest files; see above). +- **Avoid for *batch / throughput* work:** `gpt-oss-20b` (highest fidelity but slowest — reserve it + for the max-precision use above, not bulk runs), `Qwen2.5-Coder-7B` (slowest dense), + `DeepSeek-Coder-V2-Lite` (the VAT-lead and fence/format noise). +- **Regardless of model:** expect the `final`/annotation/exact-member inaccuracies above. The + durable fix is deterministic AST extraction for the structural sections (see §6). ### Prompt v1 vs v2 @@ -109,7 +166,171 @@ the indexer's filtering than by prompt wording. --- -## 6. Caveats +## 8. Per-file model matrix + +Six source files of deliberately different archetypes were each summarized by all 8 models +(**v1 / production prompt**) and scored field-by-field against the real source. One table per file. + +### AiGenerationKind.java — enum / marker +*Source:* A trivial `public enum AiGenerationKind` with two constants, `FILE_SUMMARY` and `PACKAGE_SUMMARY`, marking AI-generation scope (file vs. package); no methods. + +| Model | Faithfulness (vs source) | Completeness | Key issues | Verdict | +|---|---|---|---|---| +| Qwen3-Coder-30B | Mostly accurate; "final" ok | Over-complete, bloated | Constants as methods `FILE_SUMMARY()`; verbose | Fair — method formatting | +| gpt-oss-20b | Accurate; constants correct | Right-sized | Minor: trailing whitespace only | Good — clean, faithful | +| Granite-4.0-H-Tiny | Accurate; `public` correct | Complete but padded | Many empty "No..." filler lines | Good — faithful, verbose | +| Seed-Coder-8B | Wrong: claims `sealed` | Adequate | Hallucinated `sealed`; self-ref dependency | Poor — invented modifier | +| DeepSeek-Coder-V2-Lite | Accurate; `public enum` right | Good | Constants as methods `FILE_SUMMARY()` | Fair — method formatting | +| Qwen2.5-Coder-7B | Fully accurate | Concise, appropriate | None notable | Excellent — terse, correct | +| Qwen3-4B-2507 | Wrong API signatures | Over-stated | `FILE_SUMMARY(file)→void`; self-ref dep | Poor — invented params | +| Qwen3.5-4B | Wrong: "no modifiers" | Concise | Missed `public`; self-ref dependency | Fair — modifier error | + +**Best for this file:** Qwen2.5-Coder-7B — accurate, no hallucinations, appropriately short for a trivial enum. + +### AiGenerationConfig.java — large config POJO +*Source:* A mutable, non-final JavaBean (`@ToString` + `@SuppressWarnings`) carrying ~13 `DEFAULT_*` constants and ~14 fields with full getter/setter pairs, where `getStopStrings` returns an unmodifiable list or null; equals/hashCode intentionally absent. + +| Model | Faithfulness (vs source) | Completeness | Key issues | Verdict | +|---|---|---|---|---| +| Qwen3-Coder-30B | Mostly right; getStopStrings nuance ok | Full getters+setters, deps correct | Says "final" (wrong); misses @SuppressWarnings | Good — final error | +| gpt-oss-20b | Strong; clean, no fabrication | Full API, deps, lead all correct | "final by default" (wrong); misses @SuppressWarnings | Good — lone final slip | +| Granite-4.0-H-Tiny | Captured @SuppressWarnings correctly | Full API, all fields listed | "Final: Yes" (wrong); junk referenced types | Good — final error, minor junk | +| Seed-Coder-8B | Avoids final but "Public fields" wrong | Full API present | Drops `List` dep; sloppy concurrency claim | Fair — field/dep errors | +| DeepSeek-Coder-V2-Lite | Lead copied from prompt example | Full API present | "Calculates VAT" lead; says final twice | Poor — copied lead + final | +| Qwen2.5-Coder-7B | "No return types" contradicts getters | Full API present | Says "Final"; self-contradictory output | Fair — final + contradiction | +| Qwen3-4B-2507 | "final fields" wrong; bad concurrency | Drops ALL setters | Setters missing; claims thread-safe | Poor — setters dropped | +| Qwen3.5-4B | Correctly non-final `public class` | Full getters+setters | Invents 25 constants/16 fields; junk self-dep | Fair — fabricated counts | + +**Best for this file:** gpt-oss-20b — most complete and faithful with no fabricated counts or junk deps; only flaw is the "final by default" note. + +### AiGenerationProvider.java — interface / contract +*Source:* A `public interface AiGenerationProvider extends AutoCloseable` with an abstract `generate(request)`, a default temperature-override `generate(request, float)` that delegates, and a default no-op `close()`. + +| Model | Faithfulness (vs source) | Completeness | Key issues | Verdict | +|---|---|---|---|---| +| Qwen3-Coder-30B | Correct interface + AutoCloseable, both generate methods | Misses `close()` in API | Lists AutoCloseable as a "dependency" | Good — accurate, slight gap | +| gpt-oss-20b | Fully correct; interface, extends, all 3 members | All methods incl. default `close()` | None notable | Excellent — complete & precise | +| Granite-4.0-H-Tiny | Correct interface/extends, both generate | Omits `close()`; deps miss AiGenerationRequest | Thin coverage | Good — terse but right | +| Seed-Coder-8B | Wrong: "Extends AiGenerationRequest" | Has close, both generate | Fabricated extends; false thread-safety | Poor — invented inheritance | +| DeepSeek-Coder-V2-Lite | Wrong: "Extends AiGenerationRequest" | All 3 methods listed | Fabricated extends; false thread-safety claim | Poor — invented inheritance | +| Qwen2.5-Coder-7B | Correct interface/extends, exact signatures | Misses `close()` in API | "Constructor params" odd for interface | Good — signatures accurate | +| Qwen3-4B-2507 | Correct interface, extends, all 3 members | Complete incl. `close()` | Minor: omits "may be blank" | Good — clean and faithful | +| Qwen3.5-4B | Interface/extends correct | All 3 methods | Invented core logic (validates, runs llama.cpp inference) | Fair — hallucinated impl detail | + +**Best for this file:** gpt-oss-20b — correct interface, all three members with accurate signatures and deps, no hallucination. + +### AiGenerationProviderFactory.java — factory / wiring +*Source:* A `@ToString` (non-final) factory whose `create(providerName, llamaConfig, promptSupport)` returns `MockAiGenerationProvider` for null/blank/"mock", `LlamaCppJniAiGenerationProvider` for "llamacpp-jni", else throws `IllegalArgumentException("Unsupported AI provider: " + providerName)`. + +| Model | Faithfulness (vs source) | Completeness | Key issues | Verdict | +|---|---|---|---|---| +| Qwen3-Coder-30B | Accurate logic, but asserts "final" | All deps (6), full switch | Wrong: class not final; message unquoted | Good — false final | +| gpt-oss-20b | Fully accurate, no final claim | Exact message, full switch | Missing only LlamaCppJniConfig dep | Excellent — exact message | +| Granite-4.0-H-Tiny | Lead is prompt's "Calculates VAT" | Omits "mock" case; 3 deps only | VAT lead; "final"; deps incomplete | Poor — copied lead | +| Seed-Coder-8B | Accurate, correctly not final | Full switch incl. mock | Missing LlamaCppJniConfig + provider iface deps | Good — solid | +| DeepSeek-Coder-V2-Lite | Accurate, not final | Default-throw only in Exceptions section | `{@link}` leakage; deps miss provider classes | Fair — deps thin | +| Qwen2.5-Coder-7B | Very accurate, notes isBlank | Full switch, not final | Self-referential dep (Factory); deps incomplete | Good — junk dep | +| Qwen3-4B-2507 | Accurate; hedged "final (not marked)" | 5 deps, full switch | Confusing final wording; misses lombok dep | Good — final hedge | +| Qwen3.5-4B | Accurate; correctly says final *field* | 6 deps, full switch | Mild invention ("integration into system"); odd phrasing | Good — complete | + +**Best for this file:** gpt-oss-20b — only one with the exact exception message, correct non-final type, and clean full switch logic. + +### AiCompletionParser.java — algorithm / string parsing +*Source:* A non-final parser that strips a Gemma-4 thinking block (markers `<|channel>thought` / ``), returning text after the last end marker, throwing IOException on an unclosed block and mapping null to empty. + +| Model | Faithfulness (vs source) | Completeness | Key issues | Verdict | +|---|---|---|---|---| +| Qwen3-Coder-30B | Accurate; non-final, logic right | All sections, IOException + null | "Checks presence" not "last index" (minor) | Excellent | +| gpt-oss-20b | Fully accurate; last-index, null, msg | Thorough; markers + maxOutputTokens note | None significant | Excellent | +| Granite-4.0-H-Tiny | Logic right but calls class **final** | Good; but contradicts self on final | "Type: final" wrong; verbatim purpose copy | Fair — wrong modifier | +| Seed-Coder-8B | Accurate; non-final, edge cases noted | Concise; less marker detail | No "last marker" specificity | Good | +| DeepSeek-Coder-V2-Lite | Logic right but says **final class** | Very detailed sections | "public final class" wrong; not "last" | Fair — wrong modifier | +| Qwen2.5-Coder-7B | Accurate; non-final, last-index, null | Complete | Purpose claims it "stores" file (overreach) | Good | +| Qwen3-4B-2507 | Fully accurate; non-final, null, msg | Complete, clean | None significant | Excellent | +| Qwen3.5-4B | Content accurate where present | Missing Purpose + Type sections | Leaks stray code-fence; truncated header | Fair — corrupted output | + +**Best for this file:** gpt-oss-20b — accurate logic, captures last-index, null-handling, and the actionable maxOutputTokens message, with no errors. + +### LlamaCppJniAiGenerationProvider.java — heavy implementation (JNI) +*Source:* Lazy-loading llama.cpp JNI provider (implements `AiGenerationProvider` + `AutoCloseable`) that builds inference params via immutable withers, runs `chatCompleteText`, and parses output through `AiCompletionParser`. + +| Model | Faithfulness (vs source) | Completeness | Key issues | Verdict | +|---|---|---|---|---| +| Qwen3-Coder-30B | Accurate; lazy-load, withers, parser captured | Full: API, deps, exclude | Invented "double-checked locking" | Good — one false concurrency claim | +| gpt-oss-20b | Fully accurate; correct unsynchronized lazy-init | Full: fields, deps, withers, parser | None notable | Excellent — precise, complete | +| Granite-4.0-H-Tiny | Lead copied prompt example; wrong thread-safe claim | Moderate; misses parser class name | "Calculates VAT for invoices" lead | Poor — prompt-leak lead | +| Seed-Coder-8B | Mostly accurate; lazy + parser noted | Good | Wrong: thread-safe + double-checked locking | Fair — false concurrency | +| DeepSeek-Coder-V2-Lite | Lead copied prompt example; thread-safe wrong | Good core logic | "Calculates VAT for invoices" lead | Poor — prompt-leak lead | +| Qwen2.5-Coder-7B | Accurate; lazy, parser, withers all noted | Full deps + API | Honest "not handled" concurrency | Good — solid, no hallucination | +| Qwen3-4B-2507 | Accurate logic; lazy + parser captured | Full withers, deps | Wrong AiCompletionParser package; muddled concurrency | Good — minor dep/package slip | +| Qwen3.5-4B | Accurate; lifecycle, parser, exclude noted | Full deps + API | close() doesn't throw IOException | Good — small exception error | + +**Best for this file:** gpt-oss-20b — fully faithful, complete (lazy-load, wither chain, parser pipeline), correct concurrency, no hallucinations. + +### Matrix synthesis + +**"Best for this file" tally:** gpt-oss-20b **5/6**, Qwen2.5-Coder-7B **1/6** (the trivial enum). + +So **gpt-oss-20b is the per-file accuracy leader** — it alone avoided the `final` hallucination on +most files, copied no prompt examples, and captured exact exception messages and the JNI pipeline. +But this must be read against §3: **gpt-oss is the slowest model (~121–129 s/file)** because of +harmony reasoning overhead. The practical pick remains **Qwen3-Coder-30B-A3B** — consistently +"Good" across every archetype at **~71 s/file** — with gpt-oss reserved for when per-file fidelity +outweighs throughput. The dominant cross-file error for nearly every model is the **`final` +modifier hallucination** (a structural fact an AST extractor would get right — see §6); the worst +single failures are DeepSeek/Granite **copying the prompt's "Calculates VAT for invoices" example +as the lead**, and Qwen3-4B-2507 **dropping members** on longer files. + +## 9. External corroboration (published benchmarks) + +A web research pass cross-checked these findings against public benchmarks, leaderboards, and +official model cards. **Headline:** our *structural* findings are corroborated; our *accuracy +ranking* is novel and cannot be corroborated, because no public benchmark scores source-faithfulness +of code-index summaries and IFEval exists for only **2 of our 8** models. + +**Corroborated (at the mechanism / category level):** +- **Speed ↔ active params:** CPU decode is memory-bandwidth-bound and reads only active expert + weights, so a 30B-A3B decodes like a dense ~6B ([llama.cpp #19890](https://github.com/ggml-org/llama.cpp/discussions/19890)). + IBM publishes Granite 4.0 "~2× faster / >70% less RAM" ([IBM](https://www.ibm.com/granite/docs/models/granite)). + *(Our exact "~4× fastest Granite" magnitude is our own measurement.)* +- **Reasoning is a throughput tax** that helps hard tasks but not short summaries + ([OptimalThinkingBench](https://arxiv.org/html/2508.13141v1); "Stop Overthinking" + [survey](https://arxiv.org/pdf/2503.16419)) — supports our Qwen3.5-4B result. The *conditional* + exception (reasoning genuinely raised gpt-oss accuracy at a latency cost) is also documented + ([BrowseComp-Plus](https://arxiv.org/pdf/2508.06600), [DataRobot](https://www.datarobot.com/blog/testing-gpt-oss-models/)). +- **All four hallucination modes are named categories:** attribute/faithfulness hallucination (the + `final` slip), few-shot/prompt leakage (the "Calculates VAT for invoices" copy), format drift + (code fences), and negative-constraint instruction-following failure (ignoring "omit trivial + sections"). +- **Tooling:** llama.cpp `reasoning_format` parsing and the `--reasoning-format none` harmony-leak + are confirmed in the repo ([server README](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md), + [#15341](https://github.com/ggml-org/llama.cpp/discussions/15341)). + +**Novel (no public equivalent):** our source-faithfulness scoring for code-index summaries, the +per-file head-to-head (gpt-oss-20b 5/6), and CPU timings for these exact Q4_K_M quants at 16K on a +Ryzen 7 5800H. **Treat the §5/§8 accuracy ranking as internal evidence, not a public-record claim.** + +**The only published IFEval anchors for our set:** Granite-4.0-H-Tiny ≈ **81.4** avg (84.8 +instruct-strict) and Qwen3-4B-Instruct-2507 ≈ **83.4**. The other six models have no published +IFEval (gpt-oss-20b's official card has none; a ~69.5% figure circulating is unofficial). + +**Where we may be exposed:** +- **Qwen2.5-Coder-7B may be under-ranked.** Public coding benchmarks rank it strongly (Qwen reports + it beats DeepSeek-Coder-V2-Lite and Codestral-22B; leads CRUXEval at its size). Our mid-pack + placement may reflect its **format drift (code fences)** rather than weaker comprehension — worth + a re-score after normalizing fences. +- **DeepSeek-Coder-V2-Lite low** agrees with the public record (its own paper concedes an + instruction-following gap). + +**License correction (applied above):** DeepSeek-Coder-V2-Lite weights are under a use-restricted +custom **DeepSeek Model License** (the repo *code* is MIT) — not "commercial-OK". Codestral remains +MNPL (non-commercial); the rest are Apache-2.0 (Qwen family, gpt-oss, Granite) or MIT (Seed-Coder). + +**Caveat — model-name collisions:** public IFEval figures are easy to mis-attribute across +`Qwen3-Coder-30B-A3B` vs `Qwen3-30B-A3B-2507` (the 83.7 figure is the non-thinking 30B, *not* the +Coder or the 4B) and `Qwen3.5-4B` vs `Qwen3-4B-Instruct-2507`. Anchors above are attributed carefully. + +## 10. Caveats - Quality tiers (§4) are from a **representative file sample**, not a full read of all 368 summaries; metrics (§1) cover every file. diff --git a/docs/ai-index-benchmark/README.md b/docs/ai-index-benchmark/README.md index 8ce7bfd..3db03be 100644 --- a/docs/ai-index-benchmark/README.md +++ b/docs/ai-index-benchmark/README.md @@ -3,9 +3,28 @@ This directory captures a controlled comparison of **local GGUF models** and **two prompt versions** for the plugin's code-summarization task (`.ai.md` generation), run on CPU. -- **[COMPARISON.md](COMPARISON.md)** — scored results, findings, and recommendation. +- **[COMPARISON.md](COMPARISON.md)** — scored results, per-model pros/cons, source deep-dive, recommendation. - **[outputs/](outputs/)** — the raw generated `.ai.md` trees, one directory per cell. +## Bottom line + +- **Best overall (and for large Java files): `Qwen3-Coder-30B-A3B-Instruct`** — most complete & + faithful output, code-specialized, Apache-2.0, fast for its quality (~3.3B-active MoE, 262K ctx). + The current production default is validated. +- **Fastest / best for very large or many files: `Granite-4.0-H-Tiny`** — ~4× faster on CPU + (flat-KV hybrid, ~1B active), Apache-2.0, accept slightly lower fidelity. +- **Cleanest permissive small coder: `Seed-Coder-8B-Instruct`** (MIT). +- **Maximum precision, CPU time no object (one-off index of a large/important project): + `gpt-oss-20b`** — the per-file *accuracy* leader (won 5/6 in the per-file matrix), most faithful, + no hallucinated `final`/examples. It is the slowest (~2× the 30B, harmony reasoning overhead), so + reserve it for precision runs, not bulk throughput. +- **Avoid:** `Qwen3.5-4B` (thinking tax, no quality gain) and `DeepSeek-Coder-V2-Lite` (copied the + prompt's example as a summary). +- **Cross-model caveat:** all models mis-state structural facts (e.g. `final`, annotations, exact + member sets); only prose sections are reliably model-added → a hybrid AST+AI design is the + durable fix. Prompt **v2** helps verbosity but isn't shippable yet (code-fence regression on + code models). Full detail: [COMPARISON.md](COMPARISON.md). + ## What was tested - **8 models × 2 prompts = 16 cells**, plus 1 full-project baseline (17 output trees). From 6aaa6fdbd1d9574cd6196f5a22815af08952c10e Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 11:50:54 +0200 Subject: [PATCH 03/68] feat: per-file prompt-cache reuse and system/user prompt split Two CPU-throughput optimizations for the llama.cpp provider, plus the prompt restructuring they enable: - cache_prompt: the model is loaded once and the shared prompt-template prefix's KV is reused across files (pinned to one slot); only the per-file source is re-prefilled. New per-model `cachePrompt` flag (default true) threaded through AiGenerationConfig -> AiModelDefinition -> AiModelDefinitionSupport -> LlamaCppJniConfig -> AbstractAiIndexMojo -> provider. Benchmarked ~10% faster (1055s -> 950s, 12 files, Qwen3-Coder-30B @ 16K); reuse is logit-exact. - System/user prompt split: static instructions now go in the SYSTEM message and the variable file name + content in the USER message. AiPromptSupport gains systemPrompt(key) and userMessage(file, body); buildPrompt remains a length proxy for trimming. All prompt templates drop their %s placeholders and end with a sentence describing the user message. Verified end-to-end (12/12 files, zero %s/think/harmony/fence leakage). - Context default lowered to 16384 (64K KV caused paging on CPU); pinned slot API requires net.ladenthin:llama 5.0.3-SNAPSHOT. PIT: cachePrompt getters/setters + toConfig copy fully covered; AiPromptPreparation Support made package-testable, fully covered, and added to the 100% mutation gate (config 76/76, prompt 36/36). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 345 ++++++++++++++++-- .../aiindex/config/AiGenerationConfig.java | 28 ++ .../aiindex/config/AiModelDefinition.java | 21 ++ .../config/AiModelDefinitionSupport.java | 1 + .../aiindex/mojo/AbstractAiIndexMojo.java | 2 + .../prompt/AiPromptPreparationSupport.java | 4 +- .../aiindex/prompt/AiPromptSupport.java | 57 ++- .../LlamaCppJniAiGenerationProvider.java | 32 +- .../aiindex/provider/LlamaCppJniConfig.java | 15 +- .../config/AiGenerationConfigTest.java | 11 + .../config/AiModelDefinitionSupportTest.java | 5 + .../aiindex/config/AiModelDefinitionTest.java | 11 + .../AiPromptPreparationSupportTest.java | 68 ++++ .../aiindex/prompt/AiPromptSupportTest.java | 82 +++-- .../AiGenerationProviderFactoryTest.java | 2 +- .../LlamaCppJniAiGenerationProviderTest.java | 1 + 16 files changed, 620 insertions(+), 65 deletions(-) diff --git a/pom.xml b/pom.xml index 58dd748..032c6a7 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,11 @@ SPDX-License-Identifier: Apache-2.0 UTF-8 3.15.2 3.9.16 - 5.0.2 + + 5.0.3-SNAPSHOT 6.1.0 3.0 1.37 @@ -88,6 +92,20 @@ SPDX-License-Identifier: Apache-2.0 ${project.basedir}/src/site/ai + + true + + + ${git.commit.time} @@ -210,6 +228,22 @@ SPDX-License-Identifier: Apache-2.0 + + + + central-snapshots + https://central.sonatype.com/repository/maven-snapshots/ + + false + + + true + + + + @@ -686,6 +720,7 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin.maven.llamacpp.aiindex.document.AiMdLeadExtractor net.ladenthin.maven.llamacpp.aiindex.prompt.AiPreparedPrompt net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition + net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport net.ladenthin.maven.llamacpp.aiindex.provider.AiCompletionParser net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider @@ -756,10 +791,21 @@ SPDX-License-Identifier: Apache-2.0 ${ai.index.output.directory} + - src/main/java/net/ladenthin/maven/llamacpp/aiindex + src/main/java/net/ladenthin/maven/llamacpp/aiindex/config + src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider + + + **/package-info.java + **/module-info.java + + llamacpp-jni + 16384 1536 0.7 8 @@ -1136,6 +1187,7 @@ SPDX-License-Identifier: Apache-2.0 0.8 20 1.05 + ${ai.cachePrompt} + + EXP-Qwen3.5-4B + X:/Modelle/Qwen3.5-4B-Q4_K_M.gguf + 16384 + 1536 + 0.7 + 8 + 4 + true + 0.0 + 0.8 + 20 + 1.05 + false + + + EXP-Qwen2.5-Coder-7B + X:/Modelle/qwen2.5-coder-7b-instruct-q5_k_m.gguf + 16384 + 1536 + 0.7 + 8 + 4 + true + 0.0 + 0.8 + 20 + 1.05 + + + EXP-gpt-oss-20B + X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf + 16384 + 1536 + 1.0 + 8 + 4 + true + 0.0 + 1.0 + 0 + 1.0 + + + EXP-Qwen3-Coder-30B + X:/Modelle/Qwen3-Coder-30B-A3B-Instruct-UD-Q4_K_XL.gguf + 16384 + 1536 + 0.7 + 8 + 4 + true + 0.0 + 0.8 + 20 + 1.05 + + + + EXP-DeepSeek-Coder-V2-Lite + X:/Modelle/DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf + 16384 + 1536 + 0.3 + 8 + 4 + true + 0.0 + 0.9 + 40 + 1.05 + + + EXP-Seed-Coder-8B + X:/Modelle/Seed-Coder-8B-Instruct-Q4_K_M.gguf + 16384 + 1536 + 0.3 + 8 + 4 + true + 0.0 + 0.9 + 40 + 1.05 + + + EXP-Granite-4.0-H-Tiny + X:/Modelle/granite-4.0-h-tiny-Q4_K_M.gguf + 16384 + 1536 + 0.0 + 8 + 4 + true + 0.0 + 1.0 + 0 + 1.0 + + + EXP-Qwen3-4B-Instruct-2507 + X:/Modelle/Qwen3-4B-Instruct-2507-Q4_K_M.gguf + 16384 + 1536 + 0.7 + 8 + 4 + true + 0.0 + 0.8 + 20 + 1.05 + + + file-body-java-v2 + + + + package-body-v2 + + ai-generate diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java index 9ddea62..46b5714 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java @@ -124,6 +124,15 @@ public AiGenerationConfig() { */ public static final boolean DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING = true; + /** + * Default for whether llama.cpp prompt caching ({@code cache_prompt}) is enabled. + * + *

When {@code true}, the provider keeps the shared prompt-template prefix in the KV cache and + * reuses it across files — only the differing source text is re-prefilled per file. This is a + * pure speed optimisation: prefix reuse is exact, so the generated output is unchanged.

+ */ + public static final boolean DEFAULT_CACHE_PROMPT = true; + private String modelPath; private int contextSize = DEFAULT_CONTEXT_SIZE; private int maxOutputTokens = DEFAULT_MAX_OUTPUT_TOKENS; @@ -138,6 +147,7 @@ public AiGenerationConfig() { private int topK = DEFAULT_TOP_K; private float repeatPenalty = DEFAULT_REPEAT_PENALTY; private boolean chatTemplateEnableThinking = DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING; + private boolean cachePrompt = DEFAULT_CACHE_PROMPT; private List stopStrings = new ArrayList<>(); /** @@ -394,6 +404,24 @@ public void setChatTemplateEnableThinking(final boolean chatTemplateEnableThinki this.chatTemplateEnableThinking = chatTemplateEnableThinking; } + /** + * Returns whether llama.cpp prompt caching ({@code cache_prompt}) is enabled. + * + * @return {@code true} when prompt-prefix KV reuse across files is enabled + */ + public boolean isCachePrompt() { + return cachePrompt; + } + + /** + * Sets whether llama.cpp prompt caching ({@code cache_prompt}) is enabled. + * + * @param cachePrompt {@code true} to reuse the shared prompt-prefix KV across calls + */ + public void setCachePrompt(final boolean cachePrompt) { + this.cachePrompt = cachePrompt; + } + /** * Returns an unmodifiable view of the configured stop strings. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java index 9913d6d..b9eddfa 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java @@ -52,6 +52,7 @@ public AiModelDefinition() { private int topK = AiGenerationConfig.DEFAULT_TOP_K; private float repeatPenalty = AiGenerationConfig.DEFAULT_REPEAT_PENALTY; private boolean chatTemplateEnableThinking = AiGenerationConfig.DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING; + private boolean cachePrompt = AiGenerationConfig.DEFAULT_CACHE_PROMPT; private @Nullable List stopStrings; /** @@ -317,6 +318,26 @@ public void setChatTemplateEnableThinking(final boolean chatTemplateEnableThinki this.chatTemplateEnableThinking = chatTemplateEnableThinking; } + /** + * Returns whether llama.cpp prompt caching is enabled for this model. + * + * @return {@code true} to reuse the shared prompt-prefix KV across files; + * defaults to {@link AiGenerationConfig#DEFAULT_CACHE_PROMPT} + */ + public boolean isCachePrompt() { + return cachePrompt; + } + + /** + * Sets whether llama.cpp prompt caching ({@code cache_prompt}) is enabled for this model. + * + * @param cachePrompt {@code true} keeps the prompt-template prefix warm in the KV cache and + * reuses it per file (only the differing source is re-prefilled); output is unchanged + */ + public void setCachePrompt(final boolean cachePrompt) { + this.cachePrompt = cachePrompt; + } + /** * Returns the list of stop strings that terminate generation when encountered. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java index 2ce4e0e..1f358c3 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java @@ -116,6 +116,7 @@ private static AiGenerationConfig toConfig(final AiModelDefinition definition) { config.setRepeatPenalty(definition.getRepeatPenalty()); config.setStopStrings(definition.getStopStrings()); config.setChatTemplateEnableThinking(definition.isChatTemplateEnableThinking()); + config.setCachePrompt(definition.isCachePrompt()); return config; } } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java index cd3630a..7749400 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java @@ -247,6 +247,7 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig() throws MojoExecutionExcepti config.getTopK(), config.getRepeatPenalty(), config.isChatTemplateEnableThinking(), + config.isCachePrompt(), stopStrings != null ? stopStrings : Collections.emptyList()); } return new LlamaCppJniConfig( @@ -260,6 +261,7 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig() throws MojoExecutionExcepti AiGenerationConfig.DEFAULT_TOP_K, AiGenerationConfig.DEFAULT_REPEAT_PENALTY, AiGenerationConfig.DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING, + AiGenerationConfig.DEFAULT_CACHE_PROMPT, Collections.emptyList()); } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java index 6806515..6833061 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupport.java @@ -110,7 +110,9 @@ public int getBasePromptLength(final String promptKey, final java.nio.file.Path * @return the source trimmed at the last newline at or before {@code targetIndex}, * or the entire source if no newline is found before the index */ - private String trimSourceAtLineBreak(final String sourceText, final int targetIndex) { + // Package-private (not private) so the line-boundary trimming branches can be unit-tested + // directly; the method is not part of the public API. + String trimSourceAtLineBreak(final String sourceText, final int targetIndex) { if (targetIndex >= sourceText.length()) { return sourceText; } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java index 8dea753..b8234ed 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupport.java @@ -15,6 +15,16 @@ @ToString public final class AiPromptSupport { + /** Separator between the name line and the body within the user message. */ + private static final String USER_NAME_BODY_SEPARATOR = "\n\n"; + + /** + * Separator used only to concatenate the system instructions and the user message for length + * budgeting in {@link AiPromptPreparationSupport}; at inference time the provider sends the two + * parts as a separate system and user message. + */ + private static final String SYSTEM_USER_SEPARATOR = "\n\n"; + private final Map templates; private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); @@ -73,24 +83,53 @@ public String buildPrompt(final AiGenerationRequest request) { } /** - * Builds the prompt string for the given key, file, and source text without - * requiring a full {@link net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest}. Useful when only template - * length measurement is needed and no {@link net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader} is available. + * Builds the combined system + user text for the given key, file, and source text. * - * @param promptKey the key identifying the prompt template - * @param sourceFile the file path substituted as the filename argument - * @param sourceText the source text substituted into the template - * @return the rendered prompt string + *

This concatenation ({@code systemPrompt + separator + userMessage}) is used only for + * length budgeting / trimming by {@link AiPromptPreparationSupport} and for the + * {@code maxInputChars} calculation; at inference time the provider sends the two parts + * separately — see {@link #systemPrompt(String)} and {@link #userMessage(java.nio.file.Path, String)}.

+ * + * @param promptKey the key identifying the prompt template (system instructions) + * @param sourceFile the file path whose name heads the user message + * @param sourceText the source text delivered in the user message + * @return the combined system + user text * @throws IllegalArgumentException if no template is registered for {@code promptKey} */ public String buildPrompt(final String promptKey, final java.nio.file.Path sourceFile, final String sourceText) { + return systemPrompt(promptKey) + SYSTEM_USER_SEPARATOR + userMessage(sourceFile, sourceText); + } + + /** + * Returns the static system-instruction prompt (the registered template, verbatim) for the + * given key. The template carries no placeholders; the variable file name and content are + * delivered separately via {@link #userMessage(java.nio.file.Path, String)}. + * + * @param promptKey the key identifying the prompt template + * @return the system instructions registered for {@code promptKey} + * @throws IllegalArgumentException if no (non-blank) template is registered for {@code promptKey} + */ + public String systemPrompt(final String promptKey) { final String template = templates.get(promptKey); if (template == null || compatibilityHelper.isBlank(template)) { throw new IllegalArgumentException("Missing prompt template for key: " + promptKey); } + return template; + } + /** + * Builds the user message carrying the variable data: the file (or package/project) name on + * the first line, a blank line, then the body (file source, child summaries, or package leads, + * depending on the prompt). Falls back to the full path when the file name is {@code null} + * (e.g. a filesystem root). + * + * @param sourceFile the file path whose name heads the message + * @param sourceText the body delivered after the name + * @return the user message text + */ + public String userMessage(final java.nio.file.Path sourceFile, final String sourceText) { final java.nio.file.Path fileName = sourceFile.getFileName(); - final Object fileNameArg = fileName != null ? fileName : sourceFile; - return compatibilityHelper.formatted(template, fileNameArg, sourceText); + final Object nameArg = fileName != null ? fileName : sourceFile; + return nameArg + USER_NAME_BODY_SEPARATOR + sourceText; } } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java index 81689d2..e1ccbcc 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java @@ -43,6 +43,14 @@ public final class LlamaCppJniAiGenerationProvider implements AiGenerationProvid private final AiPromptSupport promptSupport; private final AiCompletionParser completionParser = new AiCompletionParser(); + /** + * Fixed llama.cpp server slot every request is pinned to. The model is loaded once and reused + * for all files; pinning each request to the same slot lets the prompt cache + * ({@code cache_prompt}) reuse the shared prompt-template prefix's KV across files instead of + * re-prefilling it for every file. Reuse is exact, so generated output is unchanged. + */ + private static final int REUSE_SLOT_ID = 0; + /** * Creates a new {@link LlamaCppJniAiGenerationProvider}; the GGUF model is loaded lazily on the first generate(...) call. * @@ -77,26 +85,30 @@ public String generate(final AiGenerationRequest request) throws IOException { @Override public String generate(final AiGenerationRequest request, final float temperatureOverride) throws IOException { - final String prompt = promptSupport.buildPrompt(request); + // Static instructions go in the SYSTEM message (byte-identical across files, so its KV + // prefix is reused by cache_prompt); the variable file name + source go in the USER message. + final String systemPrompt = promptSupport.systemPrompt(request.promptKey()); + final String userMessage = promptSupport.userMessage(request.sourceFile(), request.sourceText()); final List> messages = new ArrayList<>(); - messages.add(new Pair<>("user", prompt)); + messages.add(new Pair<>("user", userMessage)); - // withMessages(systemMessage, ...) accepts null upstream to omit the system message, - // but it is unannotated, so Checker Framework infers @NonNull. - // InferenceParameters uses immutable withers (jllama 5.0.2): each with* returns a new - // instance, so withStopStrings is folded into the single chain rather than a separate - // mutating call. - @SuppressWarnings("argument") + // InferenceParameters uses immutable withers: each with* returns a new instance, so the + // whole request is built as a single chain. final InferenceParameters inferenceParameters = new InferenceParameters("") - .withMessages(null, messages) + .withMessages(systemPrompt, messages) .withUseChatTemplate(true) .withTemperature(temperatureOverride) .withNPredict(config.maxOutputTokens()) .withTopP(config.topP()) .withTopK(config.topK()) .withRepeatPenalty(config.repeatPenalty()) - .withStopStrings(config.stopStrings().toArray(new String[0])); + .withStopStrings(config.stopStrings().toArray(new String[0])) + // Keep the shared prompt-template prefix warm in the KV cache and reuse it across + // files (pinned to one slot); only the differing source is re-prefilled. + // Reuse is exact -> output unchanged. + .withCachePrompt(config.cachePrompt()) + .withSlotId(REUSE_SLOT_ID); return completionParser.parseCompletion(model().chatCompleteText(inferenceParameters)); } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java index 1f95e3b..b8ee1bf 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java @@ -15,7 +15,7 @@ * *

Record-shaped value type marked {@link net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord} for the future Java 17+ * migration. Accessors are record-style. {@code equals}, {@code hashCode} and - * {@code toString} are generated by Lombok over all eleven fields; full value semantics + * {@code toString} are generated by Lombok over all twelve fields; full value semantics * apply. Lombok emits the exact-bit float comparison * ({@code Float.floatToIntBits}) automatically.

*/ @@ -33,6 +33,7 @@ public final class LlamaCppJniConfig { private final int topK; private final float repeatPenalty; private final boolean chatTemplateEnableThinking; + private final boolean cachePrompt; private final List stopStrings; /** @@ -48,6 +49,7 @@ public final class LlamaCppJniConfig { * @param topK top-k sampling limit * @param repeatPenalty repetition penalty * @param chatTemplateEnableThinking whether chat-template thinking mode is enabled + * @param cachePrompt whether llama.cpp prompt caching ({@code cache_prompt}) is enabled * @param stopStrings stop strings; may be {@code null} (treated as empty) */ public LlamaCppJniConfig( @@ -61,6 +63,7 @@ public LlamaCppJniConfig( int topK, float repeatPenalty, boolean chatTemplateEnableThinking, + boolean cachePrompt, List stopStrings) { Objects.requireNonNull(modelPath, "modelPath"); this.libraryPath = libraryPath; @@ -73,6 +76,7 @@ public LlamaCppJniConfig( this.topK = topK; this.repeatPenalty = repeatPenalty; this.chatTemplateEnableThinking = chatTemplateEnableThinking; + this.cachePrompt = cachePrompt; this.stopStrings = stopStrings != null ? stopStrings : Collections.emptyList(); } @@ -166,6 +170,15 @@ public boolean chatTemplateEnableThinking() { return chatTemplateEnableThinking; } + /** + * Returns whether llama.cpp prompt caching ({@code cache_prompt}) is enabled. + * + * @return {@code true} when prompt-prefix KV reuse across files is enabled + */ + public boolean cachePrompt() { + return cachePrompt; + } + /** * Returns an unmodifiable view of the configured stop strings. * diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java index 519719b..1ac178c 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java @@ -51,4 +51,15 @@ public void setStopStringsNullResetsToEmptyList() { // null arg resets to an EMPTY (non-null) list — kills the negate mutant on the setter ternary. assertThat(c.getStopStrings(), is(Collections.emptyList())); } + + @Test + public void cachePromptDefaultsTrueAndTogglesFalse() { + AiGenerationConfig c = new AiGenerationConfig(); + // Default true kills the false-default / "return false" getter mutants. + assertThat(c.isCachePrompt(), is(true)); + c.setCachePrompt(false); + // Observing false after the setter kills the "return true" getter mutant and the + // removed-assignment setter mutant. + assertThat(c.isCachePrompt(), is(false)); + } } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java index 579c029..45fdc8d 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java @@ -50,6 +50,7 @@ public void getConfig_knownKey_propagatesAllFields() { definition.setMaxRetries(5); definition.setRetryTemperatureIncrement(0.2f); definition.setChatTemplateEnableThinking(false); + definition.setCachePrompt(false); definition.setTopP(0.55f); definition.setTopK(21); definition.setRepeatPenalty(1.15f); @@ -76,6 +77,9 @@ public void getConfig_knownKey_propagatesAllFields() { assertThat(config.getTopK(), is(equalTo(21))); assertThat(config.getRepeatPenalty(), is(equalTo(1.15f))); assertThat(config.getStopStrings(), is(equalTo(Arrays.asList("", "STOP")))); + // Non-default cachePrompt propagates — kills the void-call mutant that would drop the + // setCachePrompt(...) copy from toConfig(). + assertThat(config.isCachePrompt(), is(false)); } @Test @@ -102,6 +106,7 @@ public void getConfig_defaultValues_matchAiGenerationConfigDefaults() { config.getRetryTemperatureIncrement(), is(equalTo(AiGenerationConfig.DEFAULT_RETRY_TEMPERATURE_INCREMENT))); assertThat(config.isChatTemplateEnableThinking(), is(AiGenerationConfig.DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING)); + assertThat(config.isCachePrompt(), is(AiGenerationConfig.DEFAULT_CACHE_PROMPT)); } @Test diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java index 573e67d..2c3d12e 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java @@ -47,4 +47,15 @@ public void setStopStringsNullClearsToNull() { d.setStopStrings(null); assertThat(d.getStopStrings(), is(nullValue())); } + + @Test + public void cachePromptDefaultsTrueAndTogglesFalse() { + AiModelDefinition d = new AiModelDefinition(); + // Default true kills the false-default / "return false" getter mutants. + assertThat(d.isCachePrompt(), is(true)); + d.setCachePrompt(false); + // Observing false after the setter kills the "return true" getter mutant and the + // removed-assignment setter mutant. + assertThat(d.isCachePrompt(), is(false)); + } } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupportTest.java index 98a96cd..f984c31 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptPreparationSupportTest.java @@ -95,5 +95,73 @@ public void preparePrompt_overheadAlreadyExceedsLimit_sourceTrimmedToEmpty() { assertThat(preparedPrompt.trimmedSourceLength(), is(equalTo(0))); assertThat(preparedPrompt.availableSourceChars(), is(equalTo(0))); } + + @Test + public void preparePrompt_lengthExactlyAtLimit_notTrimmed() { + // arrange + final AiPromptSupport promptSupport = createPromptSupport(); + final AiPromptPreparationSupport support = new AiPromptPreparationSupport(promptSupport); + final String sourceText = "public class Test {}\n"; + final AiGenerationRequest request = + new AiGenerationRequest("file-summary", Paths.get("Test.java"), sourceText, buildHeader()); + // limit set to EXACTLY the full prompt length: the <= guard must treat this as "fits". + final int exactLimit = promptSupport + .buildPrompt("file-summary", Paths.get("Test.java"), sourceText) + .length(); + + // act + final AiPreparedPrompt prepared = support.preparePrompt(request, exactLimit); + + // assert — kills the "<=" -> "<" conditional-boundary mutant on the fits-within-limit check. + assertThat(prepared.trimmed(), is(false)); + } + // + + // + @Test + public void getBasePromptLength_returnsRenderedBaseLength() { + final AiPromptSupport promptSupport = createPromptSupport(); + final AiPromptPreparationSupport support = new AiPromptPreparationSupport(promptSupport); + final int expected = promptSupport + .buildPrompt("file-summary", Paths.get("Test.java"), "") + .length(); + // Exact, non-zero base length kills the "return 0" primitive-return mutant. + assertThat(support.getBasePromptLength("file-summary", Paths.get("Test.java")), is(equalTo(expected))); + assertThat(expected > 0, is(true)); + } + // + + // + @Test + public void trim_targetAtOrBeyondLength_returnsFullSource() { + final AiPromptPreparationSupport support = new AiPromptPreparationSupport(createPromptSupport()); + // targetIndex == length: "a\nb" distinguishes the ">=" boundary from ">" (the mutant would + // fall through and cut at the newline, yielding "a\n"). Also covers the "return source" path. + assertThat(support.trimSourceAtLineBreak("a\nb", 3), is(equalTo("a\nb"))); + // targetIndex > length: kills the empty-object return mutant on the "return sourceText" path. + assertThat(support.trimSourceAtLineBreak("abc", 5), is(equalTo("abc"))); + } + + @Test + public void trim_noNewlineBeforeTarget_cutsAtTarget() { + final AiPromptPreparationSupport support = new AiPromptPreparationSupport(createPromptSupport()); + // lastNewline < 0 branch -> substring(0, target). Exact value kills the empty-return mutant. + assertThat(support.trimSourceAtLineBreak("abcdef", 3), is(equalTo("abc"))); + } + + @Test + public void trim_newlineBeforeTarget_cutsAtLineBoundary() { + final AiPromptPreparationSupport support = new AiPromptPreparationSupport(createPromptSupport()); + // Newline at index 1 -> substring(0, lastNewline + 1) = "a\n". Exact value kills the math + // mutant on (lastNewline + 1) and the empty-return mutant; covers the newline branch (was NO_COVERAGE). + assertThat(support.trimSourceAtLineBreak("a\nbcd", 3), is(equalTo("a\n"))); + } + + @Test + public void trim_newlineAtStart_distinguishesConditionalBoundary() { + final AiPromptPreparationSupport support = new AiPromptPreparationSupport(createPromptSupport()); + // lastNewline == 0 distinguishes "< 0" from the "<= 0" boundary mutant ("\n" vs "\nab"). + assertThat(support.trimSourceAtLineBreak("\nabc", 3), is(equalTo("\n"))); + } // } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupportTest.java index 59c9b47..37c988b 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/prompt/AiPromptSupportTest.java @@ -23,37 +23,74 @@ private static AiPromptDefinition def(String key, String template) { return d; } + // @Test - public void buildPromptRendersFileNameAndSource() { - AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "File %s: %s"))); - String prompt = support.buildPrompt("summary", Paths.get("a", "Foo.java"), "the source"); - assertThat(prompt, is("File Foo.java: the source")); + public void systemPromptReturnsTemplateVerbatim() { + AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "INSTRUCTIONS %x"))); + // The template is the system message, returned verbatim — no placeholder substitution. + assertThat(support.systemPrompt("summary"), is("INSTRUCTIONS %x")); } @Test - public void buildPromptUsesFullPathWhenFileNameNull() { - AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "[%s] %s"))); - // A root path has a null getFileName() on every OS, so buildPrompt falls back to the full - // path string. Derive the expected separator from the same Path so the assertion holds on - // Windows too (the root renders with the platform separator: "/" on POSIX, "\" on Windows). + public void systemPromptThrowsWhenKeyUnknown() { + AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "tpl"))); + // template == null branch. + assertThrows(IllegalArgumentException.class, () -> support.systemPrompt("missing")); + } + + @Test + public void systemPromptThrowsWhenTemplateBlank() { + AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("blank", " "))); + // isBlank(template) branch — kills the negate mutant on the template guard. + assertThrows(IllegalArgumentException.class, () -> support.systemPrompt("blank")); + } + // + + // + @Test + public void userMessagePutsNameThenBlankLineThenBody() { + AiPromptSupport support = new AiPromptSupport(Collections.emptyList()); + // Exact form: file name, a blank line, then the body. Kills the separator and the + // getFileName()-vs-full-path mutants. + assertThat(support.userMessage(Paths.get("a", "Foo.java"), "the source"), is("Foo.java\n\nthe source")); + } + + @Test + public void userMessageUsesFullPathWhenFileNameNull() { + AiPromptSupport support = new AiPromptSupport(Collections.emptyList()); + // A root path has a null getFileName() on every OS, so userMessage falls back to the full + // path. Derive the expected separator from the same Path so the assertion holds on Windows. Path root = Paths.get("/"); - assertThat(support.buildPrompt("summary", root, "x"), is("[" + root + "] x")); + assertThat(support.userMessage(root, "x"), is(root + "\n\nx")); } + // + // @Test - public void buildPromptThrowsWhenKeyUnknown() { - AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "x %s %s"))); - // template == null branch. - assertThrows(IllegalArgumentException.class, () -> support.buildPrompt("missing", Paths.get("F"), "s")); + public void buildPromptCombinesSystemThenUser() { + AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "SYS"))); + // Combined length proxy = systemPrompt + "\n\n" + userMessage. Exact form kills the + // join-separator mutant. + assertThat(support.buildPrompt("summary", Paths.get("Foo.java"), "BODY"), is("SYS\n\nFoo.java\n\nBODY")); } @Test - public void buildPromptThrowsWhenTemplateBlank() { - AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("blank", " "))); - // isBlank(template) branch — kills the negate mutant on the template guard. - assertThrows(IllegalArgumentException.class, () -> support.buildPrompt("blank", Paths.get("F"), "s")); + public void buildPromptIncludesBothSystemAndUserParts() { + AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "HEADER-INSTRUCTIONS"))); + String combined = support.buildPrompt("summary", Paths.get("Bar.java"), "class Bar {}"); + assertThat(combined, containsString("HEADER-INSTRUCTIONS")); + assertThat(combined, containsString("Bar.java")); + assertThat(combined, containsString("class Bar {}")); + } + + @Test + public void buildPromptThrowsWhenKeyUnknown() { + AiPromptSupport support = new AiPromptSupport(Collections.singletonList(def("summary", "x"))); + assertThrows(IllegalArgumentException.class, () -> support.buildPrompt("missing", Paths.get("F"), "s")); } + // + // @Test public void nullKeyInDefinitionThrowsNamedNpe() { // Exercises the requireNonNull(key) message supplier lambda. @@ -73,13 +110,14 @@ public void nullTemplateInDefinitionThrowsNamedNpe() { @Test public void nullDefinitionsListIsTreatedAsEmpty() { AiPromptSupport support = new AiPromptSupport(null); - assertThrows(IllegalArgumentException.class, () -> support.buildPrompt("any", Paths.get("F"), "s")); + assertThrows(IllegalArgumentException.class, () -> support.systemPrompt("any")); } @Test public void multipleDefinitionsAreAllRegistered() { - AiPromptSupport support = new AiPromptSupport(Arrays.asList(def("a", "A %s %s"), def("b", "B %s %s"))); - assertThat(support.buildPrompt("a", Paths.get("F"), "s"), is("A F s")); - assertThat(support.buildPrompt("b", Paths.get("F"), "s"), is("B F s")); + AiPromptSupport support = new AiPromptSupport(Arrays.asList(def("a", "A-TPL"), def("b", "B-TPL"))); + assertThat(support.systemPrompt("a"), is("A-TPL")); + assertThat(support.systemPrompt("b"), is("B-TPL")); } + // } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java index 4223fcd..368f493 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java @@ -19,7 +19,7 @@ public class AiGenerationProviderFactoryTest { private static LlamaCppJniConfig jniConfig() { return new LlamaCppJniConfig( - null, "model.gguf", 2048, 128, 0.15f, 2, 0.9f, 40, 1.1f, false, Collections.emptyList()); + null, "model.gguf", 2048, 128, 0.15f, 2, 0.9f, 40, 1.1f, false, true, Collections.emptyList()); } @Test diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java index b99976e..80df364 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java @@ -45,6 +45,7 @@ public void generate_realProvider_returnsNonEmptyResponse() throws Exception { AiGenerationConfig.DEFAULT_TOP_K, AiGenerationConfig.DEFAULT_REPEAT_PENALTY, AiGenerationConfig.DEFAULT_CHAT_TEMPLATE_ENABLE_THINKING, + AiGenerationConfig.DEFAULT_CACHE_PROMPT, Collections.emptyList()); final AiPromptSupport promptSupport = new AiPromptSupport(CommonTestFixtures.createFilePromptDefinitions()); From b7fdd7cb32d129fdd47f26961f43a70eb75e76a5 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 11:51:10 +0200 Subject: [PATCH 04/68] =?UTF-8?q?docs:=20record=20cache=5Fprompt=20optimiz?= =?UTF-8?q?ation=20result=20(COMPARISON=20=C2=A710)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add §10 to the benchmark comparison: prompt-cache A/B on Qwen3-Coder-30B @ 16K (12 files, file phase) shows ~10% speedup (1055s -> 950s) with unchanged output, and notes that this is the entire cacheable share (source prefill + decode are irreducible, so a system/user split adds no further speed). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/COMPARISON.md | 43 +++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index a2d6edb..ec89dc9 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -146,7 +146,10 @@ for a hybrid deterministic-structure + AI-prose design. across all models (scope was `config`+`provider`, max 414 lines); this extrapolates from that file, model architecture, and the 30B full-project baseline. Avoid `Qwen3-4B-2507` for large files specifically — it dropped members on the long list. -- **Best permissive small dense coder: `Seed-Coder-8B-Instruct`** — MIT, clean output. +- **Best permissive small dense coder: `Seed-Coder-8B-Instruct`** — MIT, clean output, no fence + issue. `Qwen2.5-Coder-7B` (Apache-2.0) matches it on *accuracy* once fences are post-stripped + (see §9 re-test) but is the slowest dense model — prefer Seed-Coder unless you specifically want + the Qwen tokenizer/ecosystem. - **Budget / laptop: `Qwen3-4B-Instruct-2507`** (non-thinking) over `Qwen3.5-4B` — faster, no thinking tax, equal-or-better output (but not for the largest files; see above). - **Avoid for *batch / throughput* work:** `gpt-oss-20b` (highest fidelity but slowest — reserve it @@ -315,10 +318,19 @@ instruct-strict) and Qwen3-4B-Instruct-2507 ≈ **83.4**. The other six models h IFEval (gpt-oss-20b's official card has none; a ~69.5% figure circulating is unofficial). **Where we may be exposed:** -- **Qwen2.5-Coder-7B may be under-ranked.** Public coding benchmarks rank it strongly (Qwen reports - it beats DeepSeek-Coder-V2-Lite and Codestral-22B; leads CRUXEval at its size). Our mid-pack - placement may reflect its **format drift (code fences)** rather than weaker comprehension — worth - a re-score after normalizing fences. +- **Qwen2.5-Coder-7B was under-ranked — confirmed by a follow-up re-test.** Public coding + benchmarks rank it strongly (Qwen reports it beats DeepSeek-Coder-V2-Lite and Codestral-22B; leads + CRUXEval at its size). We re-scored its **v2** output across all 6 archetype files with the stray + code fences treated as the deterministically-fixable format error they are. Fence-normalized, its + **comprehension is top-tier (top-3, alongside gpt-oss-20b)**: it correctly reports the *non-final* + classes (no `final` hallucination — unlike most models), the full accessor set with the + unmodifiable-list nuance, the interface's default-delegation contract, the parser's three-branch + control flow + IOException trigger, and the JNI lazy-load/inference/`close()` chain — with no + invented members, hallucinated inheritance, or copied-example leads. Residual issues are cosmetic + (one null-handling phrasing slip in `AiCompletionParser`; an "implements vs extends" nit). **So its + mid-pack matrix placement was a *format* artifact, not a comprehension deficit** — with a one-line + fence-stripping post-process it is a strong, permissive (Apache-2.0) option. The remaining catch is + speed: it is the slowest *dense* model (~133–141 s/file). - **DeepSeek-Coder-V2-Lite low** agrees with the public record (its own paper concedes an instruction-following gap). @@ -330,7 +342,26 @@ MNPL (non-commercial); the rest are Apache-2.0 (Qwen family, gpt-oss, Granite) o `Qwen3-Coder-30B-A3B` vs `Qwen3-30B-A3B-2507` (the 83.7 figure is the non-thinking 30B, *not* the Coder or the 4B) and `Qwen3.5-4B` vs `Qwen3-4B-Instruct-2507`. Anchors above are attributed carefully. -## 10. Caveats +## 10. Prompt-cache optimization (`cache_prompt`) + +The provider keeps the model loaded once and reuses the shared prompt-template prefix's KV across +files via llama.cpp `cache_prompt` (pinned to one slot); only the differing per-file source is +re-prefilled. A/B on the same model (Qwen3-Coder-30B-A3B @ 16K), file phase over `config`+`provider` +(12 files): + +| `cachePrompt` | wall time (12 files) | ~ per file | +|---|---|---| +| `false` (baseline) | 1055 s | ~88 s | +| `true` (default) | 950 s | ~79 s | + +**≈ 10 % faster (−105 s)**, output unchanged (prefix reuse is logit-exact). This is the *entire* +cacheable share: the remainder — per-file source prefill + decode — is inherently uncacheable, so a +system/user prompt split would add no further speed (only a possible, separate quality effect). +Enabled by default (`cachePrompt=true` on each model definition; needs `net.ladenthin:llama` +≥ 5.0.3 for the pinned-slot API). Measured at 16K context (the new CPU default — 64K's ~6 GB KV +caused memory paging on the test box that confounded timing). + +## 11. Caveats - Quality tiers (§4) are from a **representative file sample**, not a full read of all 368 summaries; metrics (§1) cover every file. From 5c457b5930e048c73dbb782ff9b7e3a4f8b0cbd1 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 12:35:35 +0200 Subject: [PATCH 05/68] feat: gpt-oss reasoning config (reasoning_format=auto + reasoning_effort=low) Set reasoning_format=AUTO on the model so reasoning channels (Qwen , gpt-oss harmony analysis) are parsed into reasoning_content and message content stays clean (final channel only). Add reasoning_effort=low to the chat-template kwargs so gpt-oss spends minimal chain-of-thought on these short structured summaries (the gpt-oss default is medium); non-gpt-oss templates ignore it. Validated on a gpt-oss-20b real run (config+provider, 16K): 0/12 harmony-marker leaks and ~85 s/file vs ~121-129 s/file at the medium default (~30% faster), confirming the JNI binding forwards chat_template_kwargs.reasoning_effort. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- .../LlamaCppJniAiGenerationProvider.java | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java index e1ccbcc..a4b5f6b 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java @@ -5,16 +5,19 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import lombok.ToString; import net.ladenthin.llama.LlamaModel; +import net.ladenthin.llama.args.ReasoningFormat; import net.ladenthin.llama.parameters.InferenceParameters; import net.ladenthin.llama.parameters.ModelParameters; import net.ladenthin.llama.value.Pair; import net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest; import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport; +import net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper; import org.jspecify.annotations.Nullable; /** @@ -42,6 +45,7 @@ public final class LlamaCppJniAiGenerationProvider implements AiGenerationProvid private final AiPromptSupport promptSupport; private final AiCompletionParser completionParser = new AiCompletionParser(); + private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); /** * Fixed llama.cpp server slot every request is pinned to. The model is loaded once and reused @@ -51,6 +55,21 @@ public final class LlamaCppJniAiGenerationProvider implements AiGenerationProvid */ private static final int REUSE_SLOT_ID = 0; + /** Chat-template kwarg controlling Qwen-style thinking (ignored by non-Qwen templates). */ + private static final String ENABLE_THINKING_KWARG = "enable_thinking"; + + /** Chat-template kwarg for the gpt-oss reasoning-effort level (ignored by non-gpt-oss templates). */ + private static final String REASONING_EFFORT_KWARG = "reasoning_effort"; + + /** + * Reasoning effort for this task: {@code "low"} keeps the discarded chain-of-thought minimal for + * the short, structured summaries this plugin produces (the gpt-oss default would be medium). + */ + private static final String REASONING_EFFORT_LOW = "low"; + + /** Number of chat-template kwargs put into the map (used for presizing). */ + private static final int CHAT_TEMPLATE_KWARG_COUNT = 2; + /** * Creates a new {@link LlamaCppJniAiGenerationProvider}; the GGUF model is loaded lazily on the first generate(...) call. * @@ -66,12 +85,20 @@ public LlamaCppJniAiGenerationProvider(final LlamaCppJniConfig config, final AiP private LlamaModel model() { LlamaModel current = model; if (current == null) { + final Map chatTemplateKwargs = + new HashMap<>(compatibilityHelper.hashMapCapacityFor(CHAT_TEMPLATE_KWARG_COUNT)); + chatTemplateKwargs.put(ENABLE_THINKING_KWARG, String.valueOf(config.chatTemplateEnableThinking())); + // gpt-oss honors reasoning_effort; non-gpt-oss chat templates ignore it. "low" keeps the + // discarded chain-of-thought minimal for the short structured summaries this plugin produces. + chatTemplateKwargs.put(REASONING_EFFORT_KWARG, REASONING_EFFORT_LOW); final ModelParameters modelParameters = new ModelParameters() .setModel(config.modelPath()) .setCtxSize(config.contextSize()) .setThreads(config.threads()) - .setChatTemplateKwargs(Collections.singletonMap( - "enable_thinking", String.valueOf(config.chatTemplateEnableThinking()))); + // Parse reasoning channels (Qwen , gpt-oss harmony analysis) into + // reasoning_content so message content stays clean (final channel only). + .setReasoningFormat(ReasoningFormat.AUTO) + .setChatTemplateKwargs(chatTemplateKwargs); current = new LlamaModel(modelParameters); model = current; } From 42ced01cfd5c0f4596ee7db2e3448b6182071fd6 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 12:41:25 +0200 Subject: [PATCH 06/68] feat: make gpt-oss reasoning_effort configurable per model (default low) Replace the hard-coded reasoning_effort="low" with a per-model `reasoningEffort` config field (default "low") threaded through AiGenerationConfig -> AiModelDefinition -> AiModelDefinitionSupport -> LlamaCppJniConfig -> AbstractAiIndexMojo -> provider, mirroring the cachePrompt plumbing. The provider sends it as the reasoning_effort chat-template kwarg only when non-blank (empty omits it, letting the model template default apply). gpt-oss honors low/medium/ high; other models ignore it. Exposed for benchmarking via the ai.reasoningEffort property on the EXP-gpt-oss-20B definition (override with -Dai.reasoningEffort). PIT: config package 80/80 (100%) including the new getter/setter and the toConfig copy. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 5 ++++ .../aiindex/config/AiGenerationConfig.java | 30 +++++++++++++++++++ .../aiindex/config/AiModelDefinition.java | 21 +++++++++++++ .../config/AiModelDefinitionSupport.java | 1 + .../aiindex/mojo/AbstractAiIndexMojo.java | 2 ++ .../LlamaCppJniAiGenerationProvider.java | 14 ++++----- .../aiindex/provider/LlamaCppJniConfig.java | 15 +++++++++- .../config/AiGenerationConfigTest.java | 10 +++++++ .../config/AiModelDefinitionSupportTest.java | 4 +++ .../aiindex/config/AiModelDefinitionTest.java | 10 +++++++ .../AiGenerationProviderFactoryTest.java | 2 +- .../LlamaCppJniAiGenerationProviderTest.java | 1 + 12 files changed, 104 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 032c6a7..f15b107 100644 --- a/pom.xml +++ b/pom.xml @@ -96,6 +96,10 @@ SPDX-License-Identifier: Apache-2.0 files. Override per run for benchmarking, e.g. -Dai.cachePrompt=false. --> true + + low + true - - low - - EXP-gpt-oss-20B + gpt-oss-20B-small-c48k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf - 16384 - 1536 + 49152 + 4096 1.0 8 - 4 + 3 + true + 0.0 + 1.0 + 0 + 1.0 + low + + + gpt-oss-20B-medium-c48k + X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf + 49152 + 6144 + 1.0 + 8 + 3 + true + 0.0 + 1.0 + 0 + 1.0 + medium + + + gpt-oss-20B-high-c48k + X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf + 49152 + 8192 + 1.0 + 8 + 3 true 0.0 1.0 0 1.0 - ${ai.reasoningEffort} + high EXP-Qwen3-Coder-30B From 5f2a57666cd7fda5b6720f7509287e7ea66f7a31 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 15:11:15 +0200 Subject: [PATCH 08/68] docs: gpt-oss reasoning_effort table + large-file clean-run validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add COMPARISON.md §11: low/medium/high reasoning_effort comparison (timing, reasoning share, per-file truncation evidence; high aborted as strictly dominated) and a "Clean runs & large files" section documenting the two independent limits (contextSize vs maxOutputTokens), the medium-c48k validation on a 96 KB / 2470-line file, and the CPU prefill-dominated cost reality for ~100 KB files. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/COMPARISON.md | 71 ++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index ec89dc9..9959263 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -361,7 +361,76 @@ Enabled by default (`cachePrompt=true` on each model definition; needs `net.lade ≥ 5.0.3 for the pinned-slot API). Measured at 16K context (the new CPU default — 64K's ~6 GB KV caused memory paging on the test box that confounded timing). -## 11. Caveats +## 11. gpt-oss `reasoning_effort` (low / medium / high) + +gpt-oss is a *reasoning* model: it emits an internal `analysis` channel before the `final` answer, +and llama.cpp counts those reasoning tokens **in-band** against `maxOutputTokens`. The benchmark ran +the file phase (`config`+`provider`, 12 files) with `EXP-gpt-oss-20B` @ 16K, `maxOutputTokens=1536`, +flipping only `-Dai.reasoningEffort` across `low` / `medium` / `high`. + +**Headline: higher effort is strictly worse for this task — it is slower *and* truncates the +deliverable.** Because reasoning shares the fixed 1536-token budget, more reasoning leaves fewer +tokens for the actual summary, so the `final` answer gets cut off (or never starts). + +| Aspect (gpt-oss-20B @ 16K, file phase, 12 files) | `low` | `medium` | `high` | +|---|---|---|---| +| Wall time (12 files) | **1072 s** | 1545 s | aborted (≈ 8 min/file, ~4×) | +| ~ per file | **~89 s** | ~129 s | ~8 min/file (aborted) | +| Relative speed | **1.0× (fastest)** | ~1.44× slower | ~4× slower | +| Reasoning (`analysis`) tokens spent | minimal | moderate | large | +| Share of 1536-token budget left for the summary | ~all | ~half | little / none | +| `AiGenerationConfig.java` body | **complete** (all sections → `Concurrency`) | truncated mid `Public API` | truncated after `Annotated` (≈ 2 body lines) | +| `AiModelDefinition.java` body | **complete** (→ `Concurrency`) | complete | **header only — no body produced** | +| Truncation risk at `maxOutputTokens=1536` | low | medium (file-dependent) | high (frequent / total) | +| Summary structure when it completes | full, well-sectioned | comparable when not cut | rarely reaches the sections | +| Harmony-marker leakage into body | 0 | 0 | 0 | +| Net usefulness for this short-summary task | **best** | borderline | unusable at this budget | + +The `high` run was **aborted** after confirming the pattern: at the 1536 budget it truncates even +worse than `medium` (e.g. `AiModelDefinition.java` produced a header with no body) while running ~4× +slower — strictly dominated, so finishing all 12 files added no information. + +### Is there any benefit to medium/high? + +For this task — short, dense bullet summaries — **not at a tight output budget**. The summary content is +extraction/structuring, not multi-step problem solving, so the extra reasoning buys little quality; it +only consumes the budget the deliverable needs. The truncation above is a **budget artifact, not a +model limit**: give the reasoning room and the summary completes (see below). `low` remains the best +default — fastest, and the whole budget goes to the summary. + +### Clean runs & large files (~100 KB / >1000 lines) + +The truncation seen above is fixed by sizing the budget to the effort. The pom ships three ready +presets — `gpt-oss-20B-{small,medium,high}-c48k` — all at **48K context** and **`charsPerToken=3`** +(dense Java tokenises below the 4-char default; 3 keeps the char-based pre-trim token-safe so a big +file is never silently over-fed into too small a window), with the output budget scaled to the effort +(`small`=4096, `medium`=6144, `high`=8192). + +Two independent limits must both be satisfied for a clean run: + +| Limit | Controls | Failure if too small | +|---|---|---| +| `contextSize` | input (prompt + source) that fits the window | source **trimmed** before the model sees it | +| `maxOutputTokens` | reasoning **+** final answer (gpt-oss reasons in-band) | summary **truncated** mid-output | + +**Validation — `medium-c48k` on a 96 KB / 2470-line synthetic Java class:** + +| Check | Result | +|---|---| +| `maxInputChars` (derived) | 125 800 — 96 KB file fits, **no trim** | +| `truncated` (llama.cpp) | **0** — whole file prefilled (~24 K tokens) | +| stop reason | **natural** — `n_decoded = 1198`, far below the 6144 cap | +| retries | **none** | +| `.ai.md` | complete to `#### Concurrency`; covers the whole file (last fields + `adjustBucket120` + tail methods); even flagged a real injected bug (`undefined variable i`) | +| build | `BUILD SUCCESS` | + +**Cost reality for big files:** the 96 KB file took **~25 min** — prefill **~978 s** (24 K tokens @ ~25 t/s) +plus generation **~522 s** (only 1198 tokens, but @ ~2.3 t/s — a large KV context slows decoding too). +The bottleneck on ~100 KB files is **CPU prefill + large-context decode, not the effort level** +(the 6144 budget was barely used). So for large files the knobs that matter are `contextSize` + +`charsPerToken` (fit untrimmed); the output budget just needs headroom. Expect minutes-per-file on CPU. + +## 12. Caveats - Quality tiers (§4) are from a **representative file sample**, not a full read of all 368 summaries; metrics (§1) cover every file. From c81898dfc45b30960895d2717da195248d5f71f9 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 16:54:13 +0200 Subject: [PATCH 09/68] feat: size-tiered gpt-oss presets (c16k/c48k/c96k) for large projects Replace the effort-tiered gpt-oss presets with three size-tiered ones, all at reasoningEffort=low (the benchmark shows low is best for dense code summaries): gpt-oss-20B-c16k -> files up to ~40 KB (typical files; ~1-2 min/file) gpt-oss-20B-c48k -> files up to ~125 KB (large files; ~25 min @ 100 KB) gpt-oss-20B-c96k -> files up to ~260 KB (huge files; ~80 min @ 250 KB) The variable that actually matters in a real project is the largest file you must cover, which sets contextSize (and thus the untrimmed input). All three keep charsPerToken=3 (dense Java measured ~4.2 chars/token; 3 keeps the char-based pre-trim token-safe) and gpt-oss sampling (temp 1.0, top-p 1.0, top-k 0). Hard ceiling is the 128K window (~480-500 KB of code); CPU prefill + decode time make ~250 KB the practical per-file limit. Both c48k (96 KB file) and c96k (253 KB file) validated end-to-end: no trim, natural stop, complete summaries, BUILD SUCCESS. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 6b5f85a..ab8c4a9 100644 --- a/pom.xml +++ b/pom.xml @@ -1297,27 +1297,33 @@ SPDX-License-Identifier: Apache-2.0 1.05 - gpt-oss-20B-small-c48k + gpt-oss-20B-c16k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf - 49152 - 4096 + 16384 + 2048 1.0 8 3 @@ -1329,10 +1335,10 @@ SPDX-License-Identifier: Apache-2.0 low - gpt-oss-20B-medium-c48k + gpt-oss-20B-c48k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 49152 - 6144 + 4096 1.0 8 3 @@ -1341,13 +1347,13 @@ SPDX-License-Identifier: Apache-2.0 1.0 0 1.0 - medium + low - gpt-oss-20B-high-c48k + gpt-oss-20B-c96k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf - 49152 - 8192 + 98304 + 6144 1.0 8 3 @@ -1356,7 +1362,7 @@ SPDX-License-Identifier: Apache-2.0 1.0 0 1.0 - high + low EXP-Qwen3-Coder-30B From 92f569b8f94d33ba5f9e16d006b3ecae283fa9ea Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 16:54:14 +0200 Subject: [PATCH 10/68] docs: large-file context limits, mixed-size strategy, 250KB validation + generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expand COMPARISON.md §11: - context-window ceiling (n_ctx_train=131072 ~= 480-500 KB of code; CPU time is the practical limit); - the three size-tiered presets (c16k/c48k/c96k) with coverage and timing; - end-to-end validations for 96 KB (~25 min) and 253 KB (~80 min) fixtures (truncated=0, natural stop, complete summaries); - cost reality (prefill O(n^2); decode ~1 t/s at 96K); - strategy for repos with mixed file sizes: routing is by extension not size, contextSize costs RAM not per-small-file speed, so use one preset sized to the largest file or split into scoped runs; size-based auto-routing is a non-feature. Add docs/ai-index-benchmark/tools/generate-fixture.sh: parameterized, valid synthetic large-class generator used to produce the benchmark fixtures. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/COMPARISON.md | 86 ++++++-- .../tools/generate-fixture.sh | 201 ++++++++++++++++++ 2 files changed, 264 insertions(+), 23 deletions(-) create mode 100644 docs/ai-index-benchmark/tools/generate-fixture.sh diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index 9959263..75afadb 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -398,13 +398,7 @@ only consumes the budget the deliverable needs. The truncation above is a **budg model limit**: give the reasoning room and the summary completes (see below). `low` remains the best default — fastest, and the whole budget goes to the summary. -### Clean runs & large files (~100 KB / >1000 lines) - -The truncation seen above is fixed by sizing the budget to the effort. The pom ships three ready -presets — `gpt-oss-20B-{small,medium,high}-c48k` — all at **48K context** and **`charsPerToken=3`** -(dense Java tokenises below the 4-char default; 3 keeps the char-based pre-trim token-safe so a big -file is never silently over-fed into too small a window), with the output budget scaled to the effort -(`small`=4096, `medium`=6144, `high`=8192). +### Clean runs, large files, and the context-window limit Two independent limits must both be satisfied for a clean run: @@ -413,22 +407,68 @@ Two independent limits must both be satisfied for a clean run: | `contextSize` | input (prompt + source) that fits the window | source **trimmed** before the model sees it | | `maxOutputTokens` | reasoning **+** final answer (gpt-oss reasons in-band) | summary **truncated** mid-output | -**Validation — `medium-c48k` on a 96 KB / 2470-line synthetic Java class:** - -| Check | Result | -|---|---| -| `maxInputChars` (derived) | 125 800 — 96 KB file fits, **no trim** | -| `truncated` (llama.cpp) | **0** — whole file prefilled (~24 K tokens) | -| stop reason | **natural** — `n_decoded = 1198`, far below the 6144 cap | -| retries | **none** | -| `.ai.md` | complete to `#### Concurrency`; covers the whole file (last fields + `adjustBucket120` + tail methods); even flagged a real injected bug (`undefined variable i`) | -| build | `BUILD SUCCESS` | - -**Cost reality for big files:** the 96 KB file took **~25 min** — prefill **~978 s** (24 K tokens @ ~25 t/s) -plus generation **~522 s** (only 1198 tokens, but @ ~2.3 t/s — a large KV context slows decoding too). -The bottleneck on ~100 KB files is **CPU prefill + large-context decode, not the effort level** -(the 6144 budget was barely used). So for large files the knobs that matter are `contextSize` + -`charsPerToken` (fit untrimmed); the output budget just needs headroom. Expect minutes-per-file on CPU. +`charsPerToken=3` is set on all presets: dense Java measured **~4.2 chars/token**, and using 3 keeps +the char-based pre-trim conservative so a big file is never silently over-fed past the real token +window. (The earlier 1536-budget truncation was a *budget* artifact, not a model limit — give the +output room and the summary completes.) + +**How big can one file be?** gpt-oss-20b's native window is **`n_ctx_train = 131072` (128K tokens)**. +At ~4.2 chars/token that is the hard ceiling; the practical ceiling on CPU is *time*, not the window: + +| File size | ≈ tokens | fits 128K window? | practical on CPU? | +|---|---|---|---| +| ~40 KB | ~10 K | yes | yes — ~1–2 min/file | +| ~100 KB | ~24 K | yes | yes — ~25 min/file | +| ~250 KB | ~62 K | yes | borderline — **~80 min/file** | +| ~480–500 KB | ~115–120 K | edge (needs tiny output budget) | no — hours | +| > ~500 KB | > 122 K | **no — exceeds the window** | n/a | + +**Three size-tiered presets ship in the pom** (all `reasoningEffort=low`, `charsPerToken=3`): + +| Preset | `contextSize` | `maxOutputTokens` | covers file up to | ~ time (CPU) | +|---|---|---|---|---| +| `gpt-oss-20B-c16k` | 16384 | 2048 | ~40 KB | ~1–2 min | +| `gpt-oss-20B-c48k` | 49152 | 4096 | ~125 KB | ~25 min @ 100 KB | +| `gpt-oss-20B-c96k` | 98304 | 6144 | ~260 KB | ~80 min @ 250 KB | + +**Validated end-to-end** (synthetic Java fixtures from +[`tools/generate-fixture.sh`](tools/generate-fixture.sh); `mvn generate-resources`, CPU-only): + +| Run | file | `truncated` | stop | output | total | prefill | decode | +|---|---|---|---|---|---|---|---| +| `c48k` | 96 KB / 2470 ln | **0** | natural (`n_decoded=1198`) | complete to `#### Concurrency` | ~25 min | ~978 s (24 K tok @ ~25 t/s) | ~522 s (@ ~2.3 t/s) | +| `c96k` | 253 KB / 6441 ln | **0** | natural (`n_decoded=738`) | complete to `#### Concurrency` | **~80 min** | ~4053 s (61 K tok @ ~15 t/s) | ~754 s (@ **~1.0 t/s**) | + +Both ran with no trim, no retries, `BUILD SUCCESS`, and summaries that span the whole file (first +field → last `adjustBucketN` → tail methods). The 250 KB summary was compact (738 tokens) and faithful +but mis-counted the bucket methods ("260" vs 329) — large inputs invite small quantitative slips even +when the structure is right. + +**Cost reality:** the bottleneck on big files is **CPU prefill + large-context decode, not the effort +level** — at 96K context decode drops to **~1 t/s** (vs ~2.3 t/s at 48K, ~10 t/s for small files), +and prefill is effectively O(n²). The output budget is barely used (738–1198 tokens), so for large +files the knobs that matter are `contextSize` + `charsPerToken` (fit untrimmed); the budget just needs +headroom. + +### Strategy for a repo with mixed file sizes + +The plugin routes the model per file by **extension, not by size** (`AiFieldGenerationSelector`), so +one run cannot auto-pick a preset per file size. Key fact: **`contextSize` costs KV RAM (one-time), +not per-small-file speed** — prefill and decode scale with each file's *actual* token count, not with +the allocated window, so a small file stays fast even in a large context; you only pay the RAM +(roughly: ~12 GB model + KV ~2 GB @16K / ~6 GB @48K / ~11 GB @96K). Two workable approaches: + +1. **One preset, sized to your largest file (simplest).** If your biggest class fits ~125 KB and you + have the RAM, run `c48k` for everything — small files are unaffected in speed. +2. **Split into scoped runs (RAM-constrained, or rare monster files).** + - cheap run: `c16k` with `` skipping the known big files (or `` limited to the + normal packages); + - targeted run: `c48k`/`c96k` with `` limited to the big file(s). + The model reloads per run, but the large context is paid only where needed; checksum incrementality + makes re-runs cheap once a file is summarized. + +Size-based auto-routing (file bytes → preset) is **not currently a feature** — it would be the clean +fix if mixed-size repos become common. ## 12. Caveats diff --git a/docs/ai-index-benchmark/tools/generate-fixture.sh b/docs/ai-index-benchmark/tools/generate-fixture.sh new file mode 100644 index 0000000..4554e37 --- /dev/null +++ b/docs/ai-index-benchmark/tools/generate-fixture.sh @@ -0,0 +1,201 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 Bernard Ladenthin +# +# SPDX-License-Identifier: Apache-2.0 +# +# Generates a large, *valid* synthetic Java class for benchmarking how the AI +# index plugin handles big source files (context sizing, trim/no-trim, output +# truncation, prefill/decode time on CPU). +# +# It models a fictional in-memory ledger (accounts, balances, transfers, +# weighted "bucket" scoring) so the file has genuine, varied content to +# summarize rather than dead filler. +# +# Usage: +# docs/ai-index-benchmark/tools/generate-fixture.sh [class_name] +# +# Examples: +# generate-fixture.sh 100 build/fixture/BigFixture.java BigFixture +# generate-fixture.sh 250 build/fixture/HugeFixture.java HugeFixture +# +# Notes: +# - The package is fixed to net.ladenthin.maven.llamacpp.aiindex.bigfixture; put +# the output under .../bigfixture/ if you want javac to accept it (the plugin +# itself only reads .java as text, so it does not require compilation). +# - Size is approximate: the script grows the method count until the file +# reaches the requested size, then appends fixed tail methods. +set -euo pipefail + +TARGET_KB="${1:?usage: generate-fixture.sh [class_name]}" +OUT="${2:?usage: generate-fixture.sh [class_name]}" +CLASS="${3:-BigFixture}" +TARGET_BYTES=$(( TARGET_KB * 1024 )) + +mkdir -p "$(dirname "$OUT")" + +header() { +cat < +// +// SPDX-License-Identifier: Apache-2.0 +// @formatter:on +package net.ladenthin.maven.llamacpp.aiindex.bigfixture; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Large synthetic fixture (target ~${TARGET_KB} KB) used ONLY to benchmark how the + * AI index plugin handles big source files. It models a fictional in-memory + * ledger of accounts and transactions: it stores balances, applies + * deposits/withdrawals/transfers, computes aggregates, and exposes many small + * accessors so the file is genuinely large and varied. + * + *

This is not production code; it exists to exercise context sizing.

+ */ +public final class ${CLASS} { + + /** Maximum number of accounts this ledger tracks. */ + public static final int MAX_ACCOUNTS = 4096; + + /** Default starting balance applied to a freshly opened account. */ + public static final long DEFAULT_BALANCE = 1000L; + + private final Map balances = new HashMap<>(); + private final Map owners = new HashMap<>(); + private final List auditLog = new ArrayList<>(); + private long totalVolume; + private int transactionCount; +HDR +} + +# A single bucket method (bug-free: every identifier is a real local/field). +method() { + local i="$1" + local w=$(( (i % 40) + 1 )) + cat < weight$w) { + auditLog.add("bucket$i exceeded base weight: " + weighted); + } + return weighted + (double) ($i % 7); + } +M +} + +tail_methods() { +cat <<'TAIL' + + /** + * Opens a new account with the default balance, recording its owner and an + * audit entry. Rejects ids outside the valid range or already in use. + * + * @param id unique account id in [0, MAX_ACCOUNTS) + * @param owner human-readable owner name + * @return true if the account was created, false if rejected + */ + public boolean openAccount(final int id, final String owner) { + if (id < 0 || id >= MAX_ACCOUNTS) { + return false; + } + if (balances.containsKey(id)) { + return false; + } + balances.put(id, DEFAULT_BALANCE); + owners.put(id, owner == null ? "unknown" : owner); + auditLog.add("opened " + id + " for " + owners.get(id)); + return true; + } + + /** + * Transfers an amount between two existing accounts when the source holds + * sufficient funds. Updates the running totals and appends an audit entry. + * + * @param from source account id + * @param to destination account id + * @param amount strictly positive amount to move + * @return true on success, false on any validation failure + */ + public boolean transfer(final int from, final int to, final long amount) { + if (amount <= 0L) { + return false; + } + final Long src = balances.get(from); + final Long dst = balances.get(to); + if (src == null || dst == null || src < amount) { + return false; + } + balances.put(from, src - amount); + balances.put(to, dst + amount); + this.totalVolume += amount; + this.transactionCount++; + auditLog.add("transfer " + amount + " from " + from + " to " + to); + return true; + } + + /** + * Computes the sum of all account balances currently tracked. + * + * @return total balance across every open account + */ + public long totalBalance() { + long sum = 0L; + for (final Long b : balances.values()) { + sum += b == null ? 0L : b; + } + return sum; + } + + /** @return the number of transactions applied so far */ + public int getTransactionCount() { + return transactionCount; + } + + /** @return the cumulative monetary volume processed */ + public long getTotalVolume() { + return totalVolume; + } + + /** @return an immutable snapshot count of audit entries */ + public int auditSize() { + return auditLog.size(); + } +} +TAIL +} + +# Build the file: header + 40 weight fields + as many bucket methods as needed. +{ + header + for i in $(seq 1 40); do + echo " /** Tunable weight number $i used by the scoring helpers below. */" + echo " private double weight$i = ${i}.0d;" + done +} > "$OUT" + +i=1 +# Grow until the body (without the ~90-line tail) reaches the target size. +while [ "$(wc -c < "$OUT")" -lt "$TARGET_BYTES" ]; do + method "$i" >> "$OUT" + i=$(( i + 1 )) +done +tail_methods >> "$OUT" + +echo "wrote $OUT" +echo "class=$CLASS methods=$(( i - 1 )) lines=$(wc -l < "$OUT") bytes=$(wc -c < "$OUT") (~$(( $(wc -c < "$OUT") / 1024 )) KB)" From 604a8b28a09b3eddc29406b2b8771024cd25eacc Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 18:48:50 +0200 Subject: [PATCH 11/68] =?UTF-8?q?docs:=20add=20context-size=20A/B=20(RAM-v?= =?UTF-8?q?s-time)=20evidence=20to=20=C2=A711?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Back the "contextSize costs RAM, not per-small-file speed" claim with a measured A/B: the same 10 KB file under gpt-oss with everything identical except contextSize (16K/32K/48K/96K). Projected KV+compute RAM rises ~linearly (~+400 MiB per +16K) while prefill (~26.6 ms/tok), decode (~9.2 t/s), and wall time (~160 s) stay flat — a wider window is RAM-only for small files. Confirms the "one preset sized to the largest file" recommendation. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/COMPARISON.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index 75afadb..2587308 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -455,8 +455,23 @@ headroom. The plugin routes the model per file by **extension, not by size** (`AiFieldGenerationSelector`), so one run cannot auto-pick a preset per file size. Key fact: **`contextSize` costs KV RAM (one-time), not per-small-file speed** — prefill and decode scale with each file's *actual* token count, not with -the allocated window, so a small file stays fast even in a large context; you only pay the RAM -(roughly: ~12 GB model + KV ~2 GB @16K / ~6 GB @48K / ~11 GB @96K). Two workable approaches: +the allocated window, so a small file stays fast even in a large context; you only pay the RAM. + +This was confirmed by an A/B run: the **same 10 KB file**, gpt-oss, everything identical except +`contextSize` (16K → 96K): + +| `contextSize` | proj. RAM (KV+compute) | prefill | decode | wall | +|---|---|---|---|---| +| 16384 | 2050 MiB | 26.67 ms/tok | 9.10 t/s | 159 s | +| 32768 | 2450 MiB | 26.61 ms/tok | 9.16 t/s | 165 s | +| 49152 | 2850 MiB | 26.55 ms/tok | 9.33 t/s | 159 s | +| 98304 | 4050 MiB | 26.52 ms/tok | 9.20 t/s | 168 s | + +RAM rises ~linearly (**~+400 MiB per +16K**) while prefill/decode/wall stay flat — a wider window is +**RAM-only** for small files. (These are the window-driven KV+compute figures at small *actual* input; +when a wide window is genuinely filled — ~60 K tokens plus context checkpoints up to 8 GB — real usage +climbs to the ~23 GB seen in the 250 KB run, but the *window-size* component scales as above.) Two +workable approaches: 1. **One preset, sized to your largest file (simplest).** If your biggest class fits ~125 KB and you have the RAM, run `c48k` for everything — small files are unaffected in speed. From 0a82706c6c1f904c754caa1196f95ecc850102c7 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 19:10:03 +0200 Subject: [PATCH 12/68] feat: per-file duration estimate (logged ETA) + gpt-oss c96k default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add AiGenerationTimeEstimator: a rough, reference-CPU model of generation time. Generation is not a constant tokens/second — prefill per-token cost grows linearly with prompt length n (attention is O(n) per token), so total prefill is O(n^2), and decode slows as the context grows. Fitted to three end-to-end measurements (reproduced to within ~0.5 %, asserted by a regression test): prefill_ms(n) ~= 24.4*n + 0.000674*n^2 n = prompt tokens decode_ms(n, out) ~= out*(56.8 + 0.01568*n) n ~= source_chars/4.2 + ~400 (template) AiFieldGenerationSupport now logs a per-file line before generating, e.g. "Processing file '...' (96 KB source, ~24009 tokens) — estimated ~25 min (rough; ...)", so a large file's multi-minute block is no longer a surprise. The estimate is clearly marked rough/hardware-specific (a GPU or different CPU/model shifts the coefficients; only the quadratic shape is universal). Make gpt-oss-20B-c96k the default preset and document why: the measured A/B (§11) shows a wider window costs only KV RAM, not per-file time, so the widest practical window covers every file up to ~250 KB with no trim/truncation while small files stay just as fast. Downshift to c48k/c16k only to save RAM. AiGenerationTimeEstimator added to the PIT gate (100% mutation coverage). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 18 +- .../indexer/AiFieldGenerationSupport.java | 32 ++++ .../support/AiGenerationTimeEstimator.java | 174 ++++++++++++++++++ .../indexer/AiFieldGenerationSupportTest.java | 21 ++- .../AiGenerationTimeEstimatorTest.java | 93 ++++++++++ 5 files changed, 329 insertions(+), 9 deletions(-) create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimator.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimatorTest.java diff --git a/pom.xml b/pom.xml index ab8c4a9..20920b9 100644 --- a/pom.xml +++ b/pom.xml @@ -727,6 +727,7 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport + net.ladenthin.maven.llamacpp.aiindex.support.AiGenerationTimeEstimator net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport net.ladenthin.maven.llamacpp.aiindex.support.AiSourceExcludeFilter net.ladenthin.maven.llamacpp.aiindex.support.AiTimeSupport @@ -1305,6 +1306,18 @@ SPDX-License-Identifier: Apache-2.0 effort only for genuinely reasoning-heavy generation AND raise maxOutputTokens with it, or the final answer is truncated. + >>> DEFAULT: gpt-oss-20B-c96k <<< + Why the widest practical window is the default: a measured A/B + (§11) proved that a larger contextSize costs ONLY KV RAM, NOT + per-file time — for the same small file, 16K vs 96K had identical + prefill/decode/wall time; only RAM grew (~+400 MiB per +16K). So + defaulting to 96K means one preset covers EVERY file up to ~250 KB + with no trimming and no truncation, while small files stay just as + fast. The only cost is RAM you must have anyway for the big files. + Downshift to c48k / c16k ONLY to save RAM on memory-constrained + machines (model ~12 GB + KV ~2 GB @16K / ~6 GB @48K / ~11 GB @96K; + a fully filled 96K window plus context checkpoints peaks ~23 GB). + Shared design: - charsPerToken 3 matches dense Java (measured ~4.2 chars/token; 3 keeps the char-based pre-trim token-safe so a big file is never @@ -1314,10 +1327,11 @@ SPDX-License-Identifier: Apache-2.0 Sizing (measured: 96 KB code = ~24K tokens; model window = 131072): c16k -> files up to ~40 KB (typical files; fast, ~1-2 min/file) c48k -> files up to ~125 KB (large files; ~25 min for ~100 KB) [validated] - c96k -> files up to ~260 KB (huge files; ~1 h for ~250 KB, RAM-heavy) + c96k -> files up to ~260 KB (DEFAULT; ~1 h for ~250 KB) [validated] Hard ceiling: the 128K window caps input at ~480-500 KB of code, but CPU prefill+decode time and KV RAM make ~250 KB the practical limit. - Prefill is the dominant cost on big files, not the effort level. + Prefill is the dominant cost on big files (O(n^2)), not the effort + level — see the estimate the plugin logs per file. ============================================================ --> gpt-oss-20B-c16k diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java index ef8db90..8c27388 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java @@ -18,6 +18,7 @@ import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPreparedPrompt; import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; import net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider; +import net.ladenthin.maven.llamacpp.aiindex.support.AiGenerationTimeEstimator; import net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper; import org.apache.maven.plugin.logging.Log; @@ -121,6 +122,28 @@ public class AiFieldGenerationSupport { */ private static final int MAX_INPUT_CHARS_ROUNDING = 100; + /** Bytes per kibibyte, used to render the source size in the per-file processing log. */ + private static final int KIBIBYTES_DIVISOR = 1024; + + /** Prefix of the per-file processing/ETA log line. */ + private static final String PROCESSING_LOG_PREFIX = "Processing "; + + /** Infix introducing the estimated source size in the processing log line. */ + private static final String PROCESSING_LOG_SIZE_INFIX = " ("; + + /** Unit/infix for the source size and token estimate in the processing log line. */ + private static final String PROCESSING_LOG_TOKENS_INFIX = " KB source, ~"; + + /** Infix introducing the estimated duration in the processing log line. */ + private static final String PROCESSING_LOG_ETA_INFIX = " tokens) — estimated "; + + /** + * Suffix on the processing log line stressing that the duration is a rough, + * hardware-specific estimate (see {@link AiGenerationTimeEstimator}). + */ + private static final String PROCESSING_LOG_DISCLAIMER = + " (rough; calibrated on reference CPU + gpt-oss-20b — actual depends on your hardware)"; + // Maven plugin Log — its default toString prints implementation details // (logger configuration, output stream state); excluded from the rendered output. @ToString.Exclude @@ -130,6 +153,7 @@ public class AiFieldGenerationSupport { private final AiPromptPreparationSupport promptPreparationSupport; private final AiModelDefinitionSupport modelDefinitionSupport; private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); + private final AiGenerationTimeEstimator timeEstimator = new AiGenerationTimeEstimator(); /** * Per-{@code (aiDefinitionKey, promptKey)} cache of the computed {@code maxInputChars} @@ -225,6 +249,14 @@ public AiGenerationResult processFieldGenerations( final AiGenerationRequest generationRequest = new AiGenerationRequest( fieldGeneration.getPromptKey(), contextFile, preparedPrompt.sourceText(), baseHeader); + final int processedSourceChars = preparedPrompt.sourceText().length(); + log.info(PROCESSING_LOG_PREFIX + contextType + " '" + contextFile + "'" + + PROCESSING_LOG_SIZE_INFIX + (sourceText.length() / KIBIBYTES_DIVISOR) + + PROCESSING_LOG_TOKENS_INFIX + timeEstimator.estimatePromptTokens(processedSourceChars) + + PROCESSING_LOG_ETA_INFIX + + timeEstimator.formatDuration(timeEstimator.estimateSeconds(processedSourceChars)) + + PROCESSING_LOG_DISCLAIMER); + log.info("Generating field '" + fieldGeneration.getPromptKey() + "' with temperature=" + generationConfig.getTemperature() + ", maxRetries=" + generationConfig.getMaxRetries() + ", retryTemperatureIncrement=" diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimator.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimator.java new file mode 100644 index 0000000..eb9df21 --- /dev/null +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimator.java @@ -0,0 +1,174 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.support; + +import lombok.ToString; + +/** + * Rough, reference-CPU duration estimate for a single AI generation, used to warn the + * user before a large file blocks the build for minutes. + * + *

Why this is non-trivial. On CPU, generation time is not a constant + * tokens/second: it is dominated by prefill (processing the prompt), whose + * per-token cost grows linearly with the prompt length {@code n} because attention is + * {@code O(n)} per token — so total prefill is {@code O(n^2)}. Decode (generating the + * answer) is comparatively small but also slows as the context grows. The model below + * was fitted to three end-to-end measurements and reproduces them to within ~0.5 % + * (see {@code AiGenerationTimeEstimatorTest}):

+ * + *
+ *   prompt tokens n   measured prefill   model prefill
+ *   3 309             88.3 s             88.1 s
+ *   24 081            978.0 s            978.5 s
+ *   61 484            4053 s             4049 s
+ * 
+ * + *

Calibration. The constants are measured on an AMD Ryzen 7 5800H (CPU-only, + * 8 threads) running gpt-oss-20b UD-Q4_K_XL via llama.cpp. They are intentionally a + * rough estimate: a different CPU, thread count, model, or quantisation shifts + * the absolute numbers (a GPU would make them far smaller). Treat the output as an + * order-of-magnitude hint, not a guarantee. The shape (quadratic prefill) holds + * across hardware; only the coefficients scale.

+ */ +@ToString +public class AiGenerationTimeEstimator { + + /** + * Linear prefill coefficient in milliseconds per prompt token. Dominates for small + * prompts; fitted on the reference CPU (see class Javadoc). + */ + public static final double PREFILL_LINEAR_MS_PER_TOKEN = 24.4d; + + /** + * Quadratic prefill coefficient in milliseconds per prompt token squared. Dominates + * for large prompts and is the reason throughput "shrinks" as files grow. + */ + public static final double PREFILL_QUADRATIC_MS_PER_TOKEN_SQUARED = 0.000674d; + + /** + * Linear decode coefficient in milliseconds per generated token at (near) zero + * context length. + */ + public static final double DECODE_LINEAR_MS_PER_TOKEN = 56.8d; + + /** + * Additional decode milliseconds per generated token for each token already in the + * context — captures the decode slowdown on long prompts. + */ + public static final double DECODE_MS_PER_TOKEN_PER_CONTEXT_TOKEN = 0.01568d; + + /** + * Measured characters per token for dense Java source (~4.2). Used only to estimate + * the token count from a character count; this is deliberately distinct from the + * conservative {@code charsPerToken} used for input trimming. + */ + public static final double ESTIMATION_CHARS_PER_TOKEN = 4.2d; + + /** + * Approximate fixed prompt-template token overhead added on top of the source tokens + * (system instructions plus chat-template scaffolding). + */ + public static final int PROMPT_TEMPLATE_TOKEN_OVERHEAD = 400; + + /** + * Typical number of generated output tokens assumed for the decode part of the + * estimate when the caller does not specify one. Observed summaries ranged ~450–1200 + * tokens; this is a representative middle value. + */ + public static final int DEFAULT_EXPECTED_OUTPUT_TOKENS = 800; + + /** Milliseconds per second, for converting the internal millisecond model to seconds. */ + public static final double MILLIS_PER_SECOND = 1000.0d; + + /** Seconds per minute, for the human-readable duration formatting. */ + public static final long SECONDS_PER_MINUTE = 60L; + + /** + * Threshold (seconds) at or above which {@link #formatDuration(long)} switches from a + * "{@code ~N s}" rendering to a "{@code ~N min}" rendering. + */ + public static final long MINUTE_FORMAT_THRESHOLD_SECONDS = 90L; + + /** Creates a new {@link AiGenerationTimeEstimator}. */ + public AiGenerationTimeEstimator() { + // no-op + } + + /** + * Estimates the prompt token count for a source of the given character length, + * including the fixed template overhead. + * + * @param sourceChars number of source characters that will be sent to the model + * @return estimated prompt token count (source tokens + template overhead) + */ + public int estimatePromptTokens(final int sourceChars) { + return (int) Math.round(sourceChars / ESTIMATION_CHARS_PER_TOKEN) + PROMPT_TEMPLATE_TOKEN_OVERHEAD; + } + + /** + * Estimates prefill (prompt-processing) time for a prompt of {@code promptTokens} + * tokens using the quadratic model. + * + * @param promptTokens prompt length in tokens + * @return estimated prefill time in milliseconds + */ + public double estimatePrefillMillis(final int promptTokens) { + final double n = promptTokens; + return PREFILL_LINEAR_MS_PER_TOKEN * n + PREFILL_QUADRATIC_MS_PER_TOKEN_SQUARED * n * n; + } + + /** + * Estimates decode (answer-generation) time for the given context length and expected + * output token count. + * + * @param promptTokens context length in tokens (the prompt already prefilled) + * @param expectedOutputTokens number of tokens the model is expected to generate + * @return estimated decode time in milliseconds + */ + public double estimateDecodeMillis(final int promptTokens, final int expectedOutputTokens) { + return expectedOutputTokens + * (DECODE_LINEAR_MS_PER_TOKEN + DECODE_MS_PER_TOKEN_PER_CONTEXT_TOKEN * promptTokens); + } + + /** + * Estimates total generation time (prefill + decode) in seconds for a source of the + * given character length, assuming {@link #DEFAULT_EXPECTED_OUTPUT_TOKENS} of output. + * + * @param sourceChars number of source characters that will be sent to the model + * @return estimated total time in seconds, rounded to the nearest second + */ + public long estimateSeconds(final int sourceChars) { + return estimateSeconds(sourceChars, DEFAULT_EXPECTED_OUTPUT_TOKENS); + } + + /** + * Estimates total generation time (prefill + decode) in seconds for a source of the + * given character length and expected output token count. + * + * @param sourceChars number of source characters that will be sent to the model + * @param expectedOutputTokens number of tokens the model is expected to generate + * @return estimated total time in seconds, rounded to the nearest second + */ + public long estimateSeconds(final int sourceChars, final int expectedOutputTokens) { + final int promptTokens = estimatePromptTokens(sourceChars); + final double millis = + estimatePrefillMillis(promptTokens) + estimateDecodeMillis(promptTokens, expectedOutputTokens); + return Math.round(millis / MILLIS_PER_SECOND); + } + + /** + * Formats a second count as a short human-readable string: "{@code ~N s}" below + * {@link #MINUTE_FORMAT_THRESHOLD_SECONDS}, otherwise "{@code ~N min}". + * + * @param seconds duration in seconds + * @return short, prefixed duration string + */ + public String formatDuration(final long seconds) { + if (seconds >= MINUTE_FORMAT_THRESHOLD_SECONDS) { + final long minutes = Math.round((double) seconds / (double) SECONDS_PER_MINUTE); + return "~" + minutes + " min"; + } + return "~" + seconds + " s"; + } +} diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java index a22f2d6..44e9814 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java @@ -313,22 +313,29 @@ public String generate(final AiGenerationRequest request, final float temperatur support.processFieldGenerations( CommonTestFixtures.createFileFieldGenerations(), contextFile, "file", "public class Test {}", header); - // assert — one INFO log per retry attempt + one for the initial generation attempt + // assert — one per-file processing/ETA line, one initial generation attempt, one per retry final List infos = capturingLog.getCapturedInfos(); - assertThat(infos.size(), is(equalTo(AiGenerationConfig.DEFAULT_MAX_RETRIES + 1))); + assertThat(infos.size(), is(equalTo(AiGenerationConfig.DEFAULT_MAX_RETRIES + 2))); - // First message: initial generation attempt with config details - final String firstMsg = infos.get(0); + // First message: the per-file processing line with size + token + duration estimate + final String processingMsg = infos.get(0); + assertThat(processingMsg, containsString("Processing file")); + assertThat(processingMsg, containsString("tokens")); + assertThat(processingMsg, containsString("estimated")); + + // Second message: initial generation attempt with config details + final String firstMsg = infos.get(1); assertThat(firstMsg, containsString("Generating field '" + CommonTestFixtures.PROMPT_KEY_FILE_BODY + "'")); assertThat(firstMsg, containsString("temperature=0.15")); assertThat(firstMsg, containsString("maxRetries=3")); assertThat(firstMsg, containsString("retryTemperatureIncrement=0.1")); assertThat(firstMsg, containsString("maxInputChars=")); - // Remaining messages: retry attempts - for (int i = 1; i < infos.size(); i++) { + // Remaining messages: retry attempts (attempt n is at info index n + 1) + for (int i = 2; i < infos.size(); i++) { + final int attempt = i - 1; final String retryMsg = infos.get(i); - assertThat(retryMsg, containsString("Retrying AI generation (attempt " + i + "/3)")); + assertThat(retryMsg, containsString("Retrying AI generation (attempt " + attempt + "/3)")); assertThat(retryMsg, containsString("field '" + CommonTestFixtures.PROMPT_KEY_FILE_BODY + "'")); assertThat(retryMsg, containsString("temperature=")); assertThat(retryMsg, containsString("baseTemp=0.15")); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimatorTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimatorTest.java new file mode 100644 index 0000000..397d0fc --- /dev/null +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/support/AiGenerationTimeEstimatorTest.java @@ -0,0 +1,93 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.support; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.number.IsCloseTo.closeTo; + +import org.junit.jupiter.api.Test; + +public class AiGenerationTimeEstimatorTest { + + private final AiGenerationTimeEstimator estimator = new AiGenerationTimeEstimator(); + + // + @Test + public void estimatePromptTokens_addsTemplateOverheadToScaledChars() { + // 4200 / 4.2 = 1000 source tokens, + 400 template overhead = 1400. + assertThat(estimator.estimatePromptTokens(4200), is(1400)); + } + + @Test + public void estimatePromptTokens_zeroChars_isJustTemplateOverhead() { + assertThat(estimator.estimatePromptTokens(0), is(AiGenerationTimeEstimator.PROMPT_TEMPLATE_TOKEN_OVERHEAD)); + } + // + + // + @Test + public void estimatePrefillMillis_appliesLinearPlusQuadraticTerms() { + // 24.4*1000 + 0.000674*1000^2 = 24400 + 674 = 25074. + assertThat(estimator.estimatePrefillMillis(1000), is(closeTo(25074.0d, 1e-6d))); + } + + @Test + public void estimateDecodeMillis_scalesOutputByLinearPlusContextTerm() { + // 800 * (56.8 + 0.01568*1000) = 800 * 72.48 = 57984. + assertThat(estimator.estimateDecodeMillis(1000, 800), is(closeTo(57984.0d, 1e-6d))); + } + // + + // + @Test + public void estimateSeconds_combinesPrefillAndDecodeRoundedToSeconds() { + // n=1400: prefill=35481.04 ms, decode(800)=63001.6 ms, total=98482.64 ms -> 98 s. + assertThat(estimator.estimateSeconds(4200, 800), is(98L)); + } + + @Test + public void estimateSeconds_defaultOverload_usesDefaultExpectedOutputTokens() { + assertThat( + estimator.estimateSeconds(4200), + is(estimator.estimateSeconds(4200, AiGenerationTimeEstimator.DEFAULT_EXPECTED_OUTPUT_TOKENS))); + } + // + + // + @Test + public void formatDuration_belowThreshold_rendersSeconds() { + assertThat(estimator.formatDuration(89L), is("~89 s")); + } + + @Test + public void formatDuration_atThreshold_rendersMinutesRoundedHalfUp() { + // 90 s / 60 = 1.5 -> rounds to 2. + assertThat(estimator.formatDuration(90L), is("~2 min")); + } + + @Test + public void formatDuration_zero_rendersSeconds() { + assertThat(estimator.formatDuration(0L), is("~0 s")); + } + // + + // + @Test + public void estimatePrefillMillis_reproducesMeasuredReferencePoints() { + // The quadratic model was fitted to three end-to-end CPU measurements + // (Ryzen 7 5800H, gpt-oss-20b UD-Q4_K_XL). It must reproduce each measured + // prefill within 5 %, otherwise the calibration constants have drifted. + assertPrefillWithinFivePercent(3309, 88254.16d); + assertPrefillWithinFivePercent(24081, 978040.23d); + assertPrefillWithinFivePercent(61484, 4053373.24d); + } + + private void assertPrefillWithinFivePercent(final int promptTokens, final double measuredMillis) { + final double predicted = estimator.estimatePrefillMillis(promptTokens); + final double tolerance = measuredMillis * 0.05d; + assertThat(predicted, is(closeTo(measuredMillis, tolerance))); + } + // +} From fac147c2ad9477ec979169434a5e54429b708470 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 19:10:03 +0200 Subject: [PATCH 13/68] =?UTF-8?q?docs:=20per-file=20timing=20model=20(O(n^?= =?UTF-8?q?2)=20prefill)=20+=20c96k-default=20rationale=20in=20=C2=A711?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document the quadratic prefill timing model with its fitted coefficients and the three measured points it reproduces, explain why throughput "shrinks" as the prompt grows (per-token cost rises with n; decode slows over a longer context), mark c96k as the default preset with the RAM-vs-time justification, and note the per-file ETA the plugin now logs via AiGenerationTimeEstimator. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/COMPARISON.md | 42 ++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index 2587308..b142476 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -429,7 +429,12 @@ At ~4.2 chars/token that is the hard ceiling; the practical ceiling on CPU is *t |---|---|---|---|---| | `gpt-oss-20B-c16k` | 16384 | 2048 | ~40 KB | ~1–2 min | | `gpt-oss-20B-c48k` | 49152 | 4096 | ~125 KB | ~25 min @ 100 KB | -| `gpt-oss-20B-c96k` | 98304 | 6144 | ~260 KB | ~80 min @ 250 KB | +| **`gpt-oss-20B-c96k` (default)** | 98304 | 6144 | ~260 KB | ~80 min @ 250 KB | + +**`c96k` is the default.** The A/B above proves a wider window costs only RAM, not per-file time, so +the widest practical window is the safe universal choice: one preset covers *every* file up to ~250 KB +with no trimming and no truncation, while small files stay just as fast. Downshift to `c48k`/`c16k` +only to save RAM on memory-constrained machines. **Validated end-to-end** (synthetic Java fixtures from [`tools/generate-fixture.sh`](tools/generate-fixture.sh); `mvn generate-resources`, CPU-only): @@ -450,6 +455,41 @@ and prefill is effectively O(n²). The output budget is barely used (738–1198 files the knobs that matter are `contextSize` + `charsPerToken` (fit untrimmed); the budget just needs headroom. +### Per-file timing model (why throughput "shrinks", and the logged ETA) + +There is no constant tokens/second. Prefill **per-token** cost grows *linearly* with the prompt +length `n` (attention is O(n) per token), so total prefill is **O(n²)**. Fitting the three measured +runs gives, on the reference CPU (Ryzen 7 5800H, 8 threads, gpt-oss-20b UD-Q4_K_XL): + +``` +prefill_ms(n) ≈ 24.4·n + 0.000674·n² n = prompt tokens +decode_ms(n, out) ≈ out·(56.8 + 0.01568·n) out = generated tokens +tokens n ≈ source_chars / 4.2 + ~400 (template) +``` + +The model reproduces every measured point to within ~0.5 %: + +| prompt tokens `n` | measured prefill | model prefill | +|---|---|---| +| 3 309 (~10 KB) | 88.3 s | 88.1 s | +| 24 081 (~96 KB) | 978.0 s | 978.5 s | +| 61 484 (~253 KB) | 4053 s | 4049 s | + +This is exactly why throughput "shrinks" as the prefill grows: per-token cost rises with `n` +(26.7 → 40.6 → 65.9 ms/tok across the three runs), and decode slows the same way (9.1 → 2.3 → 1.0 t/s) +because each generated token attends over the whole context. + +**The plugin logs this estimate per file** before generating, e.g.: + +``` +[INFO] Processing file '.../Foo.java' (96 KB source, ~24009 tokens) — estimated ~25 min (rough; ...) +``` + +implemented in `AiGenerationTimeEstimator` (the constants above are its calibration defaults, kept +honest by a regression test that asserts they reproduce the three measured points). The numbers are a +**rough, hardware-specific** order-of-magnitude hint: a different CPU/threads/model — or a GPU — +shifts the coefficients; only the quadratic *shape* is universal. + ### Strategy for a repo with mixed file sizes The plugin routes the model per file by **extension, not by size** (`AiFieldGenerationSelector`), so From 44041d357bfc5fb88237263be0261d9eef0194d4 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 20:05:25 +0200 Subject: [PATCH 14/68] docs: bring READMEs up to date with gpt-oss presets, c96k default, timing model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root README: add a feature bullet for the per-file duration-estimate log and a "gpt-oss-20b presets, large files, and timing" section (size-tiered c16k/c48k/ c96k table, c96k default with the RAM-vs-time rationale, 128K window ceiling, and the O(n^2) prefill timing formula), pointing to COMPARISON.md §11. Benchmark README: point the gpt-oss bottom-line entry at reasoningEffort=low, the three presets (default c96k), and §11 for context limits / 250KB validation / timing. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 21 +++++++++++++++++++++ docs/ai-index-benchmark/README.md | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f6a2f05..a4148ab 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ It creates structured `.ai.md` files per source file and aggregates them into pa - Exclude trivial or generated files with glob patterns - Uses local models via llama.cpp (no cloud dependency) - Incremental updates (skips unchanged files) +- Logs a rough per-file duration estimate before each generation (size, token count, expected time) - Optimized for AI-assisted code understanding ## How It Works The plugin runs in three phases, building a navigable index from fine to coarse. @@ -370,6 +371,26 @@ pros/cons, a source-faithfulness deep-dive, and reproduction steps in - `gpt-oss-20b` is the most *accurate* per file (won 5/6 in the per-file matrix) but the slowest (~2× the 30B) — use only when fidelity beats throughput; avoid `Qwen3.5-4B` (thinking tax, no quality gain). + +### gpt-oss-20b presets, large files, and timing + +`gpt-oss` is a *reasoning* model whose analysis tokens share the output budget, so use +`reasoningEffort=low` for code summaries (best quality here) and size the budget to the file. The pom +ships three ready presets, tiered by the largest file you must cover — full rationale and measurements +in [COMPARISON.md §11](docs/ai-index-benchmark/COMPARISON.md): + +| Preset | context | covers up to | ~ time (CPU) | +|---|---|---|---| +| `gpt-oss-20B-c16k` | 16K | ~40 KB | ~1–2 min | +| `gpt-oss-20B-c48k` | 48K | ~125 KB | ~25 min @ 100 KB | +| **`gpt-oss-20B-c96k` (default)** | 96K | ~260 KB | ~80 min @ 250 KB | + +- **`c96k` is the default:** a measured A/B shows a wider context window costs only RAM, not per-file + time, so it covers every file up to ~250 KB with no trimming while small files stay just as fast. + Downshift only to save RAM. Hard ceiling is the 128K window (~480–500 KB of code). +- **Timing is quadratic, not linear:** prefill ≈ `24.4·n + 0.000674·n²` ms (n = prompt tokens), + because attention is O(n) per token — which is why throughput drops as files grow. The plugin logs + this estimate per file. ## Development Run full build: diff --git a/docs/ai-index-benchmark/README.md b/docs/ai-index-benchmark/README.md index 3db03be..cb38ef8 100644 --- a/docs/ai-index-benchmark/README.md +++ b/docs/ai-index-benchmark/README.md @@ -17,7 +17,9 @@ versions** for the plugin's code-summarization task (`.ai.md` generation), run o - **Maximum precision, CPU time no object (one-off index of a large/important project): `gpt-oss-20b`** — the per-file *accuracy* leader (won 5/6 in the per-file matrix), most faithful, no hallucinated `final`/examples. It is the slowest (~2× the 30B, harmony reasoning overhead), so - reserve it for precision runs, not bulk throughput. + reserve it for precision runs, not bulk throughput. Run it with `reasoningEffort=low` and one of the + three size-tiered presets (`gpt-oss-20B-c16k/c48k/c96k`, **default c96k**); context-window limits, + large-file (250 KB) validation, and the O(n²) timing model are in [COMPARISON.md §11](COMPARISON.md). - **Avoid:** `Qwen3.5-4B` (thinking tax, no quality gain) and `DeepSeek-Coder-V2-Lite` (copied the prompt's example as a summary). - **Cross-model caveat:** all models mis-state structural facts (e.g. `final`, annotations, exact From 4569404f997bd59f9b2a1c11c601197b2a95dae7 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 22:31:15 +0200 Subject: [PATCH 15/68] fix: ASCII-only per-file ETA log and "<1 KB" size label Use a plain ASCII hyphen instead of an em-dash in the per-file processing log line so it renders cleanly in any console/CI encoding, and show "<1 KB" for sub-kibibyte sources instead of the integer-truncated "0 KB". Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- .../indexer/AiFieldGenerationSupport.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java index 8c27388..3042dfc 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java @@ -125,6 +125,9 @@ public class AiFieldGenerationSupport { /** Bytes per kibibyte, used to render the source size in the per-file processing log. */ private static final int KIBIBYTES_DIVISOR = 1024; + /** Size label used in the processing log line for sources smaller than one kibibyte. */ + private static final String SIZE_BELOW_ONE_KIB_LABEL = "<1"; + /** Prefix of the per-file processing/ETA log line. */ private static final String PROCESSING_LOG_PREFIX = "Processing "; @@ -134,15 +137,15 @@ public class AiFieldGenerationSupport { /** Unit/infix for the source size and token estimate in the processing log line. */ private static final String PROCESSING_LOG_TOKENS_INFIX = " KB source, ~"; - /** Infix introducing the estimated duration in the processing log line. */ - private static final String PROCESSING_LOG_ETA_INFIX = " tokens) — estimated "; + /** Infix introducing the estimated duration in the processing log line. ASCII-only for CI logs. */ + private static final String PROCESSING_LOG_ETA_INFIX = " tokens) - estimated "; /** * Suffix on the processing log line stressing that the duration is a rough, - * hardware-specific estimate (see {@link AiGenerationTimeEstimator}). + * hardware-specific estimate (see {@link AiGenerationTimeEstimator}). ASCII-only for CI logs. */ private static final String PROCESSING_LOG_DISCLAIMER = - " (rough; calibrated on reference CPU + gpt-oss-20b — actual depends on your hardware)"; + " (rough; calibrated on reference CPU + gpt-oss-20b - actual depends on your hardware)"; // Maven plugin Log — its default toString prints implementation details // (logger configuration, output stream state); excluded from the rendered output. @@ -250,8 +253,11 @@ public AiGenerationResult processFieldGenerations( fieldGeneration.getPromptKey(), contextFile, preparedPrompt.sourceText(), baseHeader); final int processedSourceChars = preparedPrompt.sourceText().length(); + final String sourceSizeKb = sourceText.length() < KIBIBYTES_DIVISOR + ? SIZE_BELOW_ONE_KIB_LABEL + : Integer.toString(sourceText.length() / KIBIBYTES_DIVISOR); log.info(PROCESSING_LOG_PREFIX + contextType + " '" + contextFile + "'" - + PROCESSING_LOG_SIZE_INFIX + (sourceText.length() / KIBIBYTES_DIVISOR) + + PROCESSING_LOG_SIZE_INFIX + sourceSizeKb + PROCESSING_LOG_TOKENS_INFIX + timeEstimator.estimatePromptTokens(processedSourceChars) + PROCESSING_LOG_ETA_INFIX + timeEstimator.formatDuration(timeEstimator.estimateSeconds(processedSourceChars)) From e75d2fdcdc2aa09532f6eb9f05283fc81a690317 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sat, 27 Jun 2026 22:31:16 +0200 Subject: [PATCH 16/68] feat: default the self-index to gpt-oss-20B-c96k Switch the selftest executions (file/package/project) from Qwen3-Coder-30B to gpt-oss-20B-c96k: the per-file accuracy leader, run at reasoningEffort=low and a 96K window so it covers files up to ~250 KB untrimmed. Accuracy is the priority; the slower speed is the accepted cost. Qwen3-Coder-30B stays defined as the throughput-optimal alternative. Comments updated to reflect the new active default. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 20920b9..960227e 100644 --- a/pom.xml +++ b/pom.xml @@ -888,7 +888,7 @@ SPDX-License-Identifier: Apache-2.0 Gemma 4 entries; only pick Q6_K_P if Q4_K_M quality is visibly short. Use when: a light model keeps refusing, or you need the lightest Gemma 4. - Qwen3-Coder-30B-A3B-Instruct-UD-Q4_K_XL-C64k (RECOMMENDED default for code; ACTIVE for both phases) + Qwen3-Coder-30B-A3B-Instruct-UD-Q4_K_XL-C64k (throughput-optimal alternative; gpt-oss-20B-c96k is now the ACTIVE default) + MoE 30B total / ~3.3B active: code-specialized AND fast on CPU; fewer active params than Gemma-4-26B-A4B; non-thinking; Apache-2.0. + Locally present (X:/Modelle/Qwen3-Coder-30B-A3B-Instruct-UD-Q4_K_XL.gguf, @@ -1775,8 +1775,8 @@ message: the path on the first line, then a blank line, then the summaries to sy +idx-smallgenerate + 16384 + … aiDefinitionKey=gpt-oss-20B-c16k … +idx-mediumgenerate + 1638449152 + … gpt-oss-20B-c48k … +idx-largegenerate + 49152 + … gpt-oss-20B-c96k … +``` + +Two rules: (1) use **non-overlapping** bands (`band2.min == band1.max`) — the skip is by source checksum +only, so it can't tell which prompt produced an existing `.ai.md`, and an overlapping band would leave +the first writer's output in place; (2) make the **last band unbounded** (`maxFileSizeBytes=0`) so files +above every band still get indexed (otherwise they get no `.ai.md` and vanish from the package listing). +Defaults are `0`/`0` (no size filter), so a single-execution setup is unaffected. + **Validated end-to-end** (synthetic Java fixtures from [`tools/generate-fixture.sh`](tools/generate-fixture.sh); `mvn generate-resources`, CPU-only): diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java index 2bf44ae..6a1d145 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java @@ -62,6 +62,8 @@ public class SourceFileIndexer { private final String aiVersion; private final List subtrees; private final AiSourceExcludeFilter excludeFilter; + private final long minFileSizeBytes; + private final long maxFileSizeBytes; private final boolean force; private final @Nullable List fieldGenerations; @@ -88,6 +90,12 @@ public class SourceFileIndexer { * @param subtrees source subtrees in scope; may be empty * @param excludes glob patterns (relative to {@code baseDirectory}, {@code /} * separators) for source files to skip; may be {@code null} or empty + * @param minFileSizeBytes exclusive lower size bound in bytes; files whose size is + * {@code <= minFileSizeBytes} are skipped. {@code 0} (or negative) + * disables the lower bound. Lets one execution target a size band. + * @param maxFileSizeBytes inclusive upper size bound in bytes; files whose size is + * {@code > maxFileSizeBytes} are skipped. {@code 0} (or negative) + * disables the upper bound (unlimited). * @param force when {@code true}, regenerate even when fields are populated * @param generationProvider AI provider used to generate fields * @param fieldGenerations field generation configurations; may be {@code null} @@ -103,6 +111,8 @@ public SourceFileIndexer( final String aiVersion, final Collection subtrees, final @Nullable Collection excludes, + final long minFileSizeBytes, + final long maxFileSizeBytes, final boolean force, final AiGenerationProvider generationProvider, final @Nullable Collection fieldGenerations, @@ -116,6 +126,8 @@ public SourceFileIndexer( this.aiVersion = aiVersion; this.subtrees = new ArrayList<>(subtrees); this.excludeFilter = new AiSourceExcludeFilter(excludes); + this.minFileSizeBytes = minFileSizeBytes; + this.maxFileSizeBytes = maxFileSizeBytes; this.force = force; this.fieldGenerations = fieldGenerations != null ? new ArrayList<>(fieldGenerations) : null; this.fieldGenerationSupport = new AiFieldGenerationSupport( @@ -147,6 +159,11 @@ public int indexSourceRoot(final Path sourceRoot) throws IOException { continue; } + if (!matchesSize(path)) { + log.debug("Outside configured size band, skipped: " + path); + continue; + } + writeAiFile(path); count++; } @@ -168,6 +185,32 @@ private boolean isExcluded(final Path path) { return excludeFilter.isExcluded(relative); } + /** + * Returns {@code true} when {@code path}'s size on disk falls within the configured size band. + * + *

The lower bound {@link #minFileSizeBytes} is exclusive and the upper bound + * {@link #maxFileSizeBytes} is inclusive; either is disabled when {@code <= 0}. Adjacent, + * non-overlapping bands are therefore expressed as {@code band2.min == band1.max}: a file of + * exactly {@code band1.max} bytes belongs to band 1 only (size {@code <= max} there, and + * {@code size > min} fails in band 2). This lets several {@code generate} executions split the + * tree into size tiers (each with its own model/context/prompt) while the source-checksum skip keeps + * every file indexed exactly once.

+ * + * @param path absolute source file path encountered during the walk + * @return {@code true} if the file is within the band and should be indexed + * @throws IOException if the file size cannot be read + */ + private boolean matchesSize(final Path path) throws IOException { + final long size = Files.size(path); + if (minFileSizeBytes > 0 && size <= minFileSizeBytes) { + return false; + } + if (maxFileSizeBytes > 0 && size > maxFileSizeBytes) { + return false; + } + return true; + } + private boolean matchesExtension(final Path path) { final Path fileNamePath = path.getFileName(); if (fileNamePath == null) { diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java index 148c36a..31e2d35 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java @@ -67,6 +67,25 @@ public GenerateMojo() { @Parameter(property = "aiIndex.excludes") private List excludes; + /** + * Exclusive lower file-size bound in bytes: source files whose size is {@code <= this} are skipped. + * {@code 0} (default) disables the lower bound. Together with {@link #maxFileSizeBytes} this lets one + * {@code generate} execution target a size band, so several executions (each with its own model, + * context size and prompt) can tier a project by file size while the source-checksum skip indexes + * every file exactly once. Use non-overlapping bands ({@code band2.min == band1.max}); make the last + * band unbounded ({@code maxFileSizeBytes=0}) so files above all bands still get indexed. + */ + @Parameter(property = "aiIndex.file.minSizeBytes", defaultValue = "0") + private long minFileSizeBytes; + + /** + * Inclusive upper file-size bound in bytes: source files whose size is {@code > this} are skipped. + * {@code 0} (default) disables the upper bound (unlimited). See {@link #minFileSizeBytes} for the + * size-tiering pattern. + */ + @Parameter(property = "aiIndex.file.maxSizeBytes", defaultValue = "0") + private long maxFileSizeBytes; + /** llama.cpp context window size; smaller default suits the fast generate pass. */ @Parameter(property = "aiIndex.llama.contextSize", defaultValue = "2048") private int llamaContextSize; @@ -124,6 +143,8 @@ public void execute() throws MojoExecutionException { aiVersion, resolvedSubtrees, excludes, + minFileSizeBytes, + maxFileSizeBytes, force, provider, fieldGenerations, diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java index 00ea9f4..8900e38 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java @@ -65,6 +65,8 @@ public void indexSourceRoot_singleJavaFile_createsAiMdFile() throws Exception { "0.0.0", Collections.emptyList(), Collections.emptyList(), + 0L, + 0L, false, new MockAiGenerationProvider(), CommonTestFixtures.createFileFieldGenerations(), @@ -124,6 +126,8 @@ public void indexSourceRoot_selectsPromptByFileExtension() throws Exception { "0.0.0", Collections.emptyList(), Collections.emptyList(), + 0L, + 0L, false, provider, Arrays.asList( @@ -162,6 +166,8 @@ public void indexSourceRoot_noMatchingExtensionAndNoFallback_throws() throws Exc "0.0.0", Collections.emptyList(), Collections.emptyList(), + 0L, + 0L, false, new MockAiGenerationProvider(), Collections.singletonList(fieldGeneration("file-body-sql", Arrays.asList(".sql"))), @@ -198,6 +204,8 @@ public void indexSourceRoot_excludedFileIsSkipped() throws Exception { "0.0.0", Collections.emptyList(), Arrays.asList("**/package-info.java"), + 0L, + 0L, false, new MockAiGenerationProvider(), CommonTestFixtures.createFileFieldGenerations(), @@ -214,6 +222,105 @@ public void indexSourceRoot_excludedFileIsSkipped() throws Exception { } // + // + @Test + public void indexSourceRoot_maxFileSizeBytes_skipsLargerFiles() throws Exception { + // arrange: a 100-byte and a 5000-byte .java file; max band = 1000 bytes + final Path temp = Files.createTempDirectory("ai-index-test"); + final Path outputRoot = temp.resolve("src/site/ai"); + final Path sourceRoot = temp.resolve("src/main/java"); + Files.createDirectories(sourceRoot.resolve("com/example")); + writeSizedJava(sourceRoot.resolve("com/example/Small.java"), 100); + writeSizedJava(sourceRoot.resolve("com/example/Big.java"), 5000); + + final SourceFileIndexer indexer = sizeBandIndexer(temp, outputRoot, 0L, 1000L); + + // act + final int indexed = indexer.indexSourceRoot(sourceRoot); + + // assert: only the small file (<= 1000) was indexed + assertThat(indexed, is(equalTo(1))); + assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Small.java.ai.md")), is(true)); + assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Big.java.ai.md")), is(false)); + } + + @Test + public void indexSourceRoot_minFileSizeBytes_skipsSmallerFiles() throws Exception { + // arrange: a 100-byte and a 5000-byte .java file; min band = 1000 bytes (exclusive) + final Path temp = Files.createTempDirectory("ai-index-test"); + final Path outputRoot = temp.resolve("src/site/ai"); + final Path sourceRoot = temp.resolve("src/main/java"); + Files.createDirectories(sourceRoot.resolve("com/example")); + writeSizedJava(sourceRoot.resolve("com/example/Small.java"), 100); + writeSizedJava(sourceRoot.resolve("com/example/Big.java"), 5000); + + final SourceFileIndexer indexer = sizeBandIndexer(temp, outputRoot, 1000L, 0L); + + // act + final int indexed = indexer.indexSourceRoot(sourceRoot); + + // assert: only the big file (> 1000) was indexed + assertThat(indexed, is(equalTo(1))); + assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Big.java.ai.md")), is(true)); + assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Small.java.ai.md")), is(false)); + } + + @Test + public void indexSourceRoot_boundaryFile_minExclusiveMaxInclusive() throws Exception { + // arrange: a file of EXACTLY 1000 bytes. A band with max=1000 includes it (inclusive upper); + // a band with min=1000 excludes it (exclusive lower). This pins the boundary semantics that make + // band2.min == band1.max non-overlapping. + final Path temp = Files.createTempDirectory("ai-index-test"); + final Path sourceRoot = temp.resolve("src/main/java"); + Files.createDirectories(sourceRoot.resolve("com/example")); + writeSizedJava(sourceRoot.resolve("com/example/Edge.java"), 1000); + + final Path outMax = temp.resolve("out-max"); + final Path outMin = temp.resolve("out-min"); + + // act + final int includedByMax = sizeBandIndexer(temp, outMax, 0L, 1000L).indexSourceRoot(sourceRoot); + final int includedByMin = sizeBandIndexer(temp, outMin, 1000L, 0L).indexSourceRoot(sourceRoot); + + // assert + assertThat(includedByMax, is(equalTo(1))); + assertThat(includedByMin, is(equalTo(0))); + } + // + + /** Writes a {@code .java} file padded with a line comment to exactly {@code totalBytes} bytes. */ + private static void writeSizedJava(final Path file, final int totalBytes) throws java.io.IOException { + final String prefix = "// "; + final StringBuilder sb = new StringBuilder(totalBytes); + sb.append(prefix); + while (sb.length() < totalBytes) { + sb.append('x'); + } + sb.setLength(totalBytes); + Files.write(file, sb.toString().getBytes(StandardCharsets.UTF_8)); + } + + private SourceFileIndexer sizeBandIndexer( + final Path baseDirectory, final Path outputRoot, final long minSizeBytes, final long maxSizeBytes) { + final AiPromptSupport promptSupport = new AiPromptSupport(CommonTestFixtures.createFilePromptDefinitions()); + return new SourceFileIndexer( + new SystemStreamLog(), + baseDirectory, + outputRoot, + Arrays.asList(".java"), + "1.0.0", + "0.0.0", + Collections.emptyList(), + Collections.emptyList(), + minSizeBytes, + maxSizeBytes, + false, + new MockAiGenerationProvider(), + CommonTestFixtures.createFileFieldGenerations(), + promptSupport, + CommonTestFixtures.createDefaultAiModelDefinitionSupport()); + } + private static AiPromptDefinition promptDefinition(final String key) { final AiPromptDefinition definition = new AiPromptDefinition(); definition.setKey(key); From d123d9db49f57a99e70c3e85420f06a4bf026d53 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sun, 28 Jun 2026 21:55:56 +0200 Subject: [PATCH 40/68] docs(gpt-oss-tuning): E5 quantization A/B - quant choice barely matters, F16 worst Ran the same 30 KB fixture through all six local gpt-oss-20b GGUFs (native mxfp4, UD-Q4_K_XL, Q4_K_M, Q5_K_M, Q8_0, F16) at identical settings, one model load each, CPU. Every build produced a complete 9/9-section summary with no retries: quality is quant-independent (gpt-oss is natively MXFP4, so higher precision adds no information). Decode spans 5.40-6.59 t/s (~18%, within run noise); native mxfp4 is not faster than the K-quants. F16 is the worst pick - largest file, slowest decode, zero quality gain - so "floating point instead of 4-bit" is not worth it. Decision: keep UD-Q4_K_XL as the default. TEMP-E5 pom scaffolding reverted (no diff). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/gpt-oss-tuning.md | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/ai-index-benchmark/gpt-oss-tuning.md b/docs/ai-index-benchmark/gpt-oss-tuning.md index dce5ad3..f212297 100644 --- a/docs/ai-index-benchmark/gpt-oss-tuning.md +++ b/docs/ai-index-benchmark/gpt-oss-tuning.md @@ -411,6 +411,40 @@ sampling feature available for other models/users while never changing the shipp **When to enable:** a different model or a high-temperature/creative config that starts looping — set `dryMultiplier` to ~0.8 and tune from there. +### E5 — quantization / "floating point vs 4-bit" — measured: **quant choice barely matters; F16 is the worst** + +**Question (user):** is a higher-precision (floating-point) gpt-oss build worth it over the shipped 4-bit? +**Key fact:** gpt-oss-20b ships *natively* in MXFP4 (4-bit microscaling float) for the MoE experts — a +"higher-precision" GGUF only upcasts the small non-expert tensors, so the F16 build is just 12.85 GB (not +~42 GB). **Setup:** the same 30 KB / 30-method fixture through all six local GGUFs at identical settings +(low effort, temp 0.7, min-p 0.05, ctx 32768, `maxOutputTokens=2048`), one model load per run, CPU. + +| GGUF | file | prefill t/s | decode t/s | sections | gens | +|---|---|---|---|---|---| +| `mxfp4` (native 4-bit) | 11.3 GB | 36.1 | 5.85 | **9/9** | 1 | +| `UD-Q4_K_XL` (shipped default) | 11.1 GB | 35.1 | 6.30 | **9/9** | 1 | +| `Q4_K_M` | 10.8 GB | 36.6 | **6.59** | **9/9** | 1 | +| `Q5_K_M` | 10.9 GB | 32.1 | 5.96 | **9/9** | 1 | +| `Q8_0` | 11.3 GB | 36.3 | 6.24 | **9/9** | 1 | +| `F16` (floating point) | 12.85 GB | 39.1 | **5.40** | **9/9** | 1 | + +**Findings:** +1. **Quality is quant-independent.** Every build produced a complete 9/9-section summary (and no retries, + `gens=1`). Going above 4-bit (Q8_0, F16) buys **nothing** in quality — exactly what the native-MXFP4 + property predicts. +2. **Speed is within run-to-run noise.** Decode spans 5.40–6.59 t/s (~18 %). No build is meaningfully + faster; the K-quants (`Q4_K_M`, `UD-Q4_K_XL`) edge out the rest, and **native `mxfp4` is not faster** + than them on this CPU. +3. **F16 is the worst choice:** the largest file (most RAM), the slowest decode, and zero quality gain — + the "floating point instead of 4-bit" idea is empirically not worth it. +4. **Decision: keep `UD-Q4_K_XL` as the default.** `Q4_K_M` is a hair faster + smaller, but the gap is + inside the noise, so it is not worth changing the shipped default. Avoid Q8_0/F16. + +*Caveat:* single fixture, single run per build, so the ~18 % decode spread is within plausible variance; +the robust conclusion is the ranking-free one — *quant precision changes neither quality nor speed +materially for this workload, and bigger-than-4-bit only costs RAM.* Run on the pre-session installed +plugin build (sampling is POM-driven and no retries fired, so the quant comparison is unaffected). + --- ## Opt-in sampling & cache knobs (reference for other models/users) From 38838d575011dc615de5d21a86ff2962c09f6058 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sun, 28 Jun 2026 21:59:56 +0200 Subject: [PATCH 41/68] docs(pom): add gpt-oss-20b quantization menu with E5 measurements Add five ready-to-use aiDefinitions (gpt-oss-20B-mxfp4 / Q4_K_M / Q5_K_M / Q8_0 / F16) alongside the existing UD-Q4_K_XL presets, all at c96k context with the shipped good settings (low effort, temp 0.7, top-p 1.0, top-k 0, min-p 0.05). A header comment carries the E5 benchmark table (file size, prefill/decode t/s, 9/9 sections) so users can pick a quant informedly: quality is quant-independent, speed is within noise, keep UD-Q4_K_XL (default), Q4_K_M is marginally smaller/faster, and Q8_0/F16 are not recommended (more RAM, no quality gain). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/pom.xml b/pom.xml index cb0533f..5c887fe 100644 --- a/pom.xml +++ b/pom.xml @@ -1364,6 +1364,106 @@ SPDX-License-Identifier: Apache-2.0 1.0 low
+ + + + gpt-oss-20B-mxfp4 + X:/Modelle/gpt-oss-20b-mxfp4.gguf + 98304 + 6144 + 0.7 + 8 + 3 + true + 1.0 + 0 + 0.05 + 1.0 + low + + + gpt-oss-20B-Q4_K_M + X:/Modelle/gpt-oss-20b-Q4_K_M.gguf + 98304 + 6144 + 0.7 + 8 + 3 + true + 1.0 + 0 + 0.05 + 1.0 + low + + + gpt-oss-20B-Q5_K_M + X:/Modelle/gpt-oss-20b-Q5_K_M.gguf + 98304 + 6144 + 0.7 + 8 + 3 + true + 1.0 + 0 + 0.05 + 1.0 + low + + + gpt-oss-20B-Q8_0 + X:/Modelle/gpt-oss-20b-Q8_0.gguf + 98304 + 6144 + 0.7 + 8 + 3 + true + 1.0 + 0 + 0.05 + 1.0 + low + + + gpt-oss-20B-F16 + X:/Modelle/gpt-oss-20b-F16.gguf + 98304 + 6144 + 0.7 + 8 + 3 + true + 1.0 + 0 + 0.05 + 1.0 + low + + EXP-Qwen3-Coder-30B X:/Modelle/Qwen3-Coder-30B-A3B-Instruct-UD-Q4_K_XL.gguf From b01f0e0c33a0c89096ff7b430a4870da39a9efd3 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sun, 28 Jun 2026 22:34:37 +0200 Subject: [PATCH 42/68] feat: log measured per-file generation time (actual vs estimated) The plugin already logged an ETA before each file ("Processing ... estimated ~7 min") but never the real elapsed time. Add an INFO line after each generation with the measured wall-clock duration next to the estimate: Generated file 'Foo.java' in 6m 12s (actual; estimated 7m) Wall time is measured with System.nanoTime() around the provider.generate() call in the shared AiFieldGenerationSupport (so both file and package indexing get it). This lets you compare models/quants by their real per-file times during live runs - no separate benchmark harness needed. Always-on INFO; test updated to expect the three INFO lines (processing + generating + generated). 222 tests; PIT 274/274. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- .../indexer/AiFieldGenerationSupport.java | 30 ++++++++++++++++++- .../indexer/AiFieldGenerationSupportTest.java | 12 ++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java index d54d3e4..01a6fcd 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java @@ -101,6 +101,25 @@ public class AiFieldGenerationSupport { private static final String PROCESSING_LOG_DISCLAIMER = " (rough; calibrated on reference CPU + gpt-oss-20b - actual depends on your hardware)"; + /** Prefix of the per-file actual-duration log line emitted after generation completes. */ + private static final String GENERATED_LOG_PREFIX = "Generated "; + + /** Infix between the file path and the measured wall-clock duration in the actual-duration line. */ + private static final String GENERATED_LOG_IN_INFIX = "' in "; + + /** + * Infix introducing the estimate for side-by-side comparison in the actual-duration line, so a real + * run shows measured-vs-estimated per file (lets you compare models/quants in live runs without a + * separate benchmark). ASCII-only for CI logs. + */ + private static final String GENERATED_LOG_ACTUAL_INFIX = " (actual; estimated "; + + /** Suffix closing the actual-duration log line. */ + private static final String GENERATED_LOG_SUFFIX = ")"; + + /** Nanoseconds per second, used to convert the measured generation duration to whole seconds. */ + private static final long NANOS_PER_SECOND = 1_000_000_000L; + // Maven plugin Log — its default toString prints implementation details // (logger configuration, output stream state); excluded from the rendered output. @ToString.Exclude @@ -210,17 +229,26 @@ public AiGenerationResult processFieldGenerations( final String sourceSizeKb = sourceText.length() < KIBIBYTES_DIVISOR ? SIZE_BELOW_ONE_KIB_LABEL : Integer.toString(sourceText.length() / KIBIBYTES_DIVISOR); + final long estimatedSeconds = timeEstimator.estimateSeconds(processedSourceChars); log.info(PROCESSING_LOG_PREFIX + contextType + " '" + contextFile + "'" + PROCESSING_LOG_SIZE_INFIX + sourceSizeKb + PROCESSING_LOG_TOKENS_INFIX + timeEstimator.estimatePromptTokens(processedSourceChars) + PROCESSING_LOG_ETA_INFIX - + timeEstimator.formatDuration(timeEstimator.estimateSeconds(processedSourceChars)) + + timeEstimator.formatDuration(estimatedSeconds) + PROCESSING_LOG_DISCLAIMER); log.info("Generating field '" + fieldGeneration.getPromptKey() + "' with temperature=" + generationConfig.getTemperature() + ", maxInputChars=" + effectiveMaxInputChars); + final long generationStartNanos = System.nanoTime(); body = generationProvider.generate(generationRequest); + final long actualSeconds = (System.nanoTime() - generationStartNanos) / NANOS_PER_SECOND; + + // Log the MEASURED wall-clock duration next to the estimate so real runs are directly + // comparable across models/quants without a separate benchmark harness. + log.info(GENERATED_LOG_PREFIX + contextType + " '" + contextFile + GENERATED_LOG_IN_INFIX + + timeEstimator.formatDuration(actualSeconds) + GENERATED_LOG_ACTUAL_INFIX + + timeEstimator.formatDuration(estimatedSeconds) + GENERATED_LOG_SUFFIX); if (compatibilityHelper.isBlank(body)) { log.warn(EMPTY_OUTPUT_WARN_PREFIX + contextType + TRIM_WARN_FIELD_LABEL + fieldGeneration.getPromptKey() diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java index c021811..47ac267 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupportTest.java @@ -257,10 +257,10 @@ public String generate(final AiGenerationRequest request) { support.processFieldGenerations( CommonTestFixtures.createFileFieldGenerations(), contextFile, "file", "public class Test {}", header); - // assert — exactly two INFO lines: the per-file processing/ETA line and the generation line. - // No retry lines are emitted (the retry mechanism was removed). + // assert — exactly three INFO lines: the per-file processing/ETA line, the generation line, + // and the measured actual-duration line. No retry lines (the retry mechanism was removed). final List infos = capturingLog.getCapturedInfos(); - assertThat(infos.size(), is(equalTo(2))); + assertThat(infos.size(), is(equalTo(3))); // First message: the per-file processing line with size + token + duration estimate final String processingMsg = infos.get(0); @@ -276,6 +276,12 @@ public String generate(final AiGenerationRequest request) { assertThat(generatingMsg.contains("maxRetries"), is(false)); assertThat(generatingMsg.contains("retryTemperatureIncrement"), is(false)); + // Third message: the measured actual-duration line (real wall time vs the estimate) + final String generatedMsg = infos.get(2); + assertThat(generatedMsg, containsString("Generated file")); + assertThat(generatedMsg, containsString("in ")); + assertThat(generatedMsg, containsString("(actual; estimated ")); + // No INFO line mentions a retry for (final String info : infos) { assertThat(info.contains("Retrying"), is(false)); From 2eaeacabdc8d2a8dbe0345c28258ffa139dafe1e Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sun, 28 Jun 2026 23:41:01 +0200 Subject: [PATCH 43/68] =?UTF-8?q?feat:=20rule-based=20file=20routing=20?= =?UTF-8?q?=E2=80=94=20per=20file=20model+prompt,=20with=20plan=20tree,=20?= =?UTF-8?q?priority,=20skip,=20explicit=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the single-provider-per-run model with a plan-then-execute flow so one `generate` run can route each file to its own model AND prompt, shown up front as a tree grouped by model. Routing rules (): filters fileExtensions + min/maxFileSizeBytes + min/maxLines, a priority (highest wins; ties by declaration order), and a kind: route (prompt+model), explicit , or (ignore matching files; a high-priority skip overrides routes and the fallback). Selection picks the highest-priority matching non-fallback rule; else the explicit fallback; else the file is unmatched. Validation (fail-fast): at most one fallback; a non-fallback rule needs >=1 filter; route/fallback need prompt+model; fallback can't be skip. Flow (GenerateMojo): validate rules -> collect candidates -> classify into an AiIndexPlan (routes grouped by aiDefinitionKey, skips, unmatched) -> log the tree -> unmatched aborts the build -> planOnly (aiIndex.planOnly) stops here -> else load each model once (sequentially, one resident at a time -> bounded RAM), index its files, close. SourceFileIndexer split into collectCandidates/classify/indexFile; AbstractAiIndexMojo.buildLlamaCppJniConfig(key) builds a provider per model id (fixes the latent bug where only fieldGenerations.get(0)'s model was ever loaded). Different aiDefinitionKeys can be the same gguf with different params (e.g. ctx), each its own group/load. pom: the file-body-fallback rule now marked true (implicit "no-filter = fallback" is gone). 240 tests; PIT 339/339 (100%). planOnly self-index verified. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 4 + .../config/AiFieldGenerationConfig.java | 191 +++++++++ .../config/AiFieldGenerationSelector.java | 188 +++++++- .../llamacpp/aiindex/indexer/AiIndexPlan.java | 200 +++++++++ .../aiindex/indexer/SourceFileIndexer.java | 292 +++++++------ .../aiindex/mojo/AbstractAiIndexMojo.java | 69 +-- .../llamacpp/aiindex/mojo/GenerateMojo.java | 123 ++++-- .../config/AiFieldGenerationConfigTest.java | 56 +++ .../config/AiFieldGenerationSelectorTest.java | 248 ++++++++--- .../indexer/SourceFileIndexerTest.java | 404 ++++++------------ 10 files changed, 1244 insertions(+), 531 deletions(-) create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java diff --git a/pom.xml b/pom.xml index 5c887fe..0003e0d 100644 --- a/pom.xml +++ b/pom.xml @@ -1920,9 +1920,13 @@ message: the path on the first line, then a blank line, then the summaries to sy .sql + file-body-fallback gpt-oss-20B-c96k + true
diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java index dc15e78..4e98eab 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java @@ -66,6 +66,71 @@ public AiFieldGenerationConfig() { */ private @Nullable List fileExtensions; + /** + * Optional exclusive lower file-size bound in bytes. When {@code > 0}, this entry applies only to + * files whose size is strictly greater than this. {@code 0} (default) disables the lower bound. + * Combined with {@link #maxFileSizeBytes} this lets the prompt be chosen by file size within a + * single run (e.g. a terse prompt for small files, a detailed one for large). + * + * @see AiFieldGenerationSelector + */ + private long minFileSizeBytes; + + /** + * Optional inclusive upper file-size bound in bytes. When {@code > 0}, this entry applies only to + * files whose size is less than or equal to this. {@code 0} (default) disables the upper bound. + * + * @see AiFieldGenerationSelector + */ + private long maxFileSizeBytes; + + /** + * Optional exclusive lower line-count bound. When {@code > 0}, this entry applies only to files + * with strictly more than this many lines. {@code 0} (default) disables the lower bound. + * + * @see AiFieldGenerationSelector + */ + private int minLines; + + /** + * Optional inclusive upper line-count bound. When {@code > 0}, this entry applies only to files + * with at most this many lines. {@code 0} (default) disables the upper bound. + * + * @see AiFieldGenerationSelector + */ + private int maxLines; + + /** + * Selection priority. When several rules match the same file, the one with the highest priority + * wins; ties are broken by declaration order (the earlier rule wins). Default {@code 0}. Lets a + * specific rule (e.g. a high-priority {@link #skip}) override a more general one regardless of XML + * order. + * + * @see AiFieldGenerationSelector + */ + private int priority; + + /** + * Marks this rule as the explicit fallback: it applies to any file that no other (non-fallback) + * rule matched. At most one fallback may be configured. A fallback routes (needs + * {@link #promptKey} and {@link #aiDefinitionKey}); it cannot also be a {@link #skip}. When no rule + * matches a file and no fallback is configured, indexing fails with an error rather than silently + * skipping the file. + * + * @see AiFieldGenerationSelector + */ + private boolean fallback; + + /** + * Marks this rule as a skip (ignore) rule: matching files are excluded from indexing entirely (no + * model, no prompt). A skip rule competes by {@link #priority} like any matching rule, so giving it + * a high priority lets it exclude files that a route rule or the fallback would otherwise pick up. + * Skip rules need filters but no {@link #promptKey}/{@link #aiDefinitionKey}. + * + * @see AiFieldGenerationSelector + */ + private boolean skip; + /** * Returns the prompt template key. * @@ -121,4 +186,130 @@ public void setAiDefinitionKey(final String aiDefinitionKey) { public void setFileExtensions(final @Nullable Collection fileExtensions) { this.fileExtensions = fileExtensions != null ? new ArrayList<>(fileExtensions) : null; } + + /** + * Returns the exclusive lower file-size bound in bytes ({@code 0} = no lower bound). + * + * @return exclusive lower file-size bound in bytes + */ + public long getMinFileSizeBytes() { + return minFileSizeBytes; + } + + /** + * Sets the exclusive lower file-size bound in bytes. + * + * @param minFileSizeBytes exclusive lower bound ({@code 0} disables it) + */ + public void setMinFileSizeBytes(final long minFileSizeBytes) { + this.minFileSizeBytes = minFileSizeBytes; + } + + /** + * Returns the inclusive upper file-size bound in bytes ({@code 0} = no upper bound). + * + * @return inclusive upper file-size bound in bytes + */ + public long getMaxFileSizeBytes() { + return maxFileSizeBytes; + } + + /** + * Sets the inclusive upper file-size bound in bytes. + * + * @param maxFileSizeBytes inclusive upper bound ({@code 0} disables it) + */ + public void setMaxFileSizeBytes(final long maxFileSizeBytes) { + this.maxFileSizeBytes = maxFileSizeBytes; + } + + /** + * Returns the exclusive lower line-count bound ({@code 0} = no lower bound). + * + * @return exclusive lower line-count bound + */ + public int getMinLines() { + return minLines; + } + + /** + * Sets the exclusive lower line-count bound. + * + * @param minLines exclusive lower bound ({@code 0} disables it) + */ + public void setMinLines(final int minLines) { + this.minLines = minLines; + } + + /** + * Returns the inclusive upper line-count bound ({@code 0} = no upper bound). + * + * @return inclusive upper line-count bound + */ + public int getMaxLines() { + return maxLines; + } + + /** + * Sets the inclusive upper line-count bound. + * + * @param maxLines inclusive upper bound ({@code 0} disables it) + */ + public void setMaxLines(final int maxLines) { + this.maxLines = maxLines; + } + + /** + * Returns the selection priority ({@code 0} = default). + * + * @return the selection priority + */ + public int getPriority() { + return priority; + } + + /** + * Sets the selection priority (higher wins when several rules match). + * + * @param priority the selection priority + */ + public void setPriority(final int priority) { + this.priority = priority; + } + + /** + * Returns whether this rule is the explicit fallback. + * + * @return {@code true} if this rule is the fallback + */ + public boolean isFallback() { + return fallback; + } + + /** + * Sets whether this rule is the explicit fallback. + * + * @param fallback {@code true} to mark this rule as the fallback + */ + public void setFallback(final boolean fallback) { + this.fallback = fallback; + } + + /** + * Returns whether this rule is a skip (ignore) rule. + * + * @return {@code true} if matching files should be skipped + */ + public boolean isSkip() { + return skip; + } + + /** + * Sets whether this rule is a skip (ignore) rule. + * + * @param skip {@code true} to skip files this rule matches + */ + public void setSkip(final boolean skip) { + this.skip = skip; + } } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java index 58ce351..f2c7463 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelector.java @@ -8,17 +8,28 @@ import org.jspecify.annotations.Nullable; /** - * Selects the {@link AiFieldGenerationConfig} that applies to a given source file, based on the - * entries' {@link AiFieldGenerationConfig#getFileExtensions() file extensions}. + * Selects the routing rule ({@link AiFieldGenerationConfig}) that applies to a given source file. * - *

Selection rule, in list order: the first entry whose non-empty extension list matches the file - * name wins; otherwise the first extension-agnostic entry (empty or absent extension list) is the - * fallback. Returns {@code null} when no entry matches and no fallback is configured.

+ *

Each rule carries optional filters — {@link AiFieldGenerationConfig#getFileExtensions() file + * extensions}, {@link AiFieldGenerationConfig#getMinFileSizeBytes() file size} and + * {@link AiFieldGenerationConfig#getMinLines() line count} — plus a + * {@link AiFieldGenerationConfig#getPriority() priority}, and is one of three kinds: a normal + * route rule (prompt + model), an explicit {@link AiFieldGenerationConfig#isFallback() + * fallback}, or a {@link AiFieldGenerationConfig#isSkip() skip} rule.

* - *

This lets the prompt vary by language while a single AI model stays loaded for the whole run — - * e.g. a Java-specific prompt for {@code .java}, a SQL-schema prompt for {@code .sql}, and a generic - * fallback for everything else. A configuration with one extension-agnostic entry (the historical - * shape) keeps working unchanged: that entry is the fallback and applies to every file.

+ *

Selection rule:

+ *
    + *
  1. Among all non-fallback rules whose every declared filter matches the file, the one + * with the highest priority wins (ties broken by declaration order — the earlier rule wins).
  2. + *
  3. If the winner is a skip rule, the file is excluded from indexing.
  4. + *
  5. If no non-fallback rule matches, the explicit fallback applies.
  6. + *
  7. If nothing matches and no fallback is configured, {@link #select} returns {@code null} so the + * caller can fail loudly rather than silently skip the file.
  8. + *
+ * + *

Within one rule an unset bound is ignored. Size and line bounds use an exclusive lower + * bound and an inclusive upper bound, so adjacent bands are written as + * {@code band2.min == band1.max} (a file exactly on the boundary belongs to the lower band).

*/ @ToString public final class AiFieldGenerationSelector { @@ -29,33 +40,166 @@ public AiFieldGenerationSelector() { } /** - * Returns the field generation that applies to {@code fileName}. + * Returns the rule that applies to a file, matching on extension, size and line count and resolving + * ties by priority then declaration order. * - * @param configs the configured field generations, in declaration order; {@code null} entries - * are skipped - * @param fileName the source file name (e.g. {@code Foo.java}) - * @return the first extension-matching entry, else the first fallback entry, else {@code null} + * @param configs the configured rules, in declaration order; {@code null} entries are skipped + * @param fileName the source file name (e.g. {@code Foo.java}) + * @param fileSizeBytes the source file size in bytes (used for the size filter) + * @param lineCount the source line count (used for the line filter) + * @return the winning rule (which may be a skip or the fallback), or {@code null} when nothing + * matches and no fallback is configured */ - public @Nullable AiFieldGenerationConfig selectForFileName( - final Iterable configs, final String fileName) { + public @Nullable AiFieldGenerationConfig select( + final Iterable configs, + final String fileName, + final long fileSizeBytes, + final int lineCount) { AiFieldGenerationConfig fallback = null; + AiFieldGenerationConfig best = null; for (final AiFieldGenerationConfig config : configs) { if (config == null) { continue; } - final List extensions = config.getFileExtensions(); - if (extensions == null || extensions.isEmpty()) { + if (config.isFallback()) { if (fallback == null) { fallback = config; } continue; } - for (final String extension : extensions) { - if (fileName.endsWith(extension)) { - return config; + if (matchesExtension(config, fileName) + && matchesSize(config, fileSizeBytes) + && matchesLines(config, lineCount) + && (best == null || config.getPriority() > best.getPriority())) { + best = config; + } + } + return best != null ? best : fallback; + } + + /** + * Validates a rule set, throwing {@link IllegalArgumentException} on a misconfiguration so the build + * fails fast with a clear message rather than mis-routing or silently skipping files. + * + *

Checks: at most one fallback; a non-fallback rule must declare at least one filter; a fallback + * must not also be a skip; route rules (and the fallback) must have a prompt key and an AI + * definition key.

+ * + * @param configs the configured rules + * @throws IllegalArgumentException if the rule set is invalid + */ + public void validate(final Iterable configs) { + int fallbackCount = 0; + for (final AiFieldGenerationConfig config : configs) { + if (config == null) { + continue; + } + if (config.isFallback()) { + fallbackCount++; + if (config.isSkip()) { + throw new IllegalArgumentException("A fallback rule cannot also be a skip rule: " + config); + } + requireRouteKeys(config); + } else { + if (!hasFilter(config)) { + throw new IllegalArgumentException( + "A non-fallback rule must declare at least one filter (extension/size/lines): " + config); + } + if (!config.isSkip()) { + requireRouteKeys(config); } } } - return fallback; + if (fallbackCount > 1) { + throw new IllegalArgumentException("At most one fallback rule may be configured, found " + fallbackCount); + } + } + + /** + * Returns {@code true} when the rule declares at least one filter (extension, size or line bound). + * + * @param config the rule + * @return {@code true} if any filter is set + */ + private boolean hasFilter(final AiFieldGenerationConfig config) { + final List extensions = config.getFileExtensions(); + final boolean hasExtensions = extensions != null && !extensions.isEmpty(); + return hasExtensions + || config.getMinFileSizeBytes() > 0 + || config.getMaxFileSizeBytes() > 0 + || config.getMinLines() > 0 + || config.getMaxLines() > 0; + } + + /** + * Throws when a route/fallback rule is missing the prompt key or AI definition key. + * + * @param config the rule + */ + private void requireRouteKeys(final AiFieldGenerationConfig config) { + if (config.getPromptKey() == null || config.getAiDefinitionKey() == null) { + throw new IllegalArgumentException( + "A route/fallback rule must have a promptKey and an aiDefinitionKey: " + config); + } + } + + /** + * Returns {@code true} when the rule's extension filter matches the file name (or is unset). + * + * @param config the rule + * @param fileName the source file name + * @return {@code true} if the extension filter is unset or one of its extensions matches + */ + private boolean matchesExtension(final AiFieldGenerationConfig config, final String fileName) { + final List extensions = config.getFileExtensions(); + if (extensions == null || extensions.isEmpty()) { + return true; + } + for (final String extension : extensions) { + if (fileName.endsWith(extension)) { + return true; + } + } + return false; + } + + /** + * Returns {@code true} when the file size is within the rule's bounds (exclusive lower, inclusive + * upper; each disabled when {@code <= 0}). + * + * @param config the rule + * @param fileSizeBytes the source file size in bytes + * @return {@code true} if the size is within the configured band + */ + private boolean matchesSize(final AiFieldGenerationConfig config, final long fileSizeBytes) { + final long min = config.getMinFileSizeBytes(); + final long max = config.getMaxFileSizeBytes(); + if (min > 0 && fileSizeBytes <= min) { + return false; + } + if (max > 0 && fileSizeBytes > max) { + return false; + } + return true; + } + + /** + * Returns {@code true} when the line count is within the rule's bounds (exclusive lower, inclusive + * upper; each disabled when {@code <= 0}). + * + * @param config the rule + * @param lineCount the source line count + * @return {@code true} if the line count is within the configured band + */ + private boolean matchesLines(final AiFieldGenerationConfig config, final int lineCount) { + final int min = config.getMinLines(); + final int max = config.getMaxLines(); + if (min > 0 && lineCount <= min) { + return false; + } + if (max > 0 && lineCount > max) { + return false; + } + return true; } } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java new file mode 100644 index 0000000..6917ceb --- /dev/null +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java @@ -0,0 +1,200 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.indexer; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig; + +/** + * The routing plan for one {@code generate} run: which files each AI model will index (with which + * prompt), which files are skipped, and which matched no rule. + * + *

Built in a planning pass before any inference so the user sees the full mapping up front + * (see {@link #renderTree}) and a misconfiguration fails fast. Routed files are grouped by + * {@code aiDefinitionKey} (the model id, which carries the full parameter set) so the executor can load + * each model exactly once.

+ */ +public final class AiIndexPlan { + + /** A single planned file together with the rule that routed it. */ + public static final class Entry { + private final Path file; + private final AiFieldGenerationConfig rule; + + /** + * Creates a plan entry. + * + * @param file the source file + * @param rule the rule that selected it + */ + public Entry(final Path file, final AiFieldGenerationConfig rule) { + this.file = file; + this.rule = rule; + } + + /** + * Returns the source file. + * + * @return the source file + */ + public Path file() { + return file; + } + + /** + * Returns the rule that routed the file. + * + * @return the routing rule + */ + public AiFieldGenerationConfig rule() { + return rule; + } + } + + private final Map> routesByModel = new LinkedHashMap<>(); + private final List skipped = new ArrayList<>(); + private final List unmatched = new ArrayList<>(); + + /** Creates an empty plan. */ + public AiIndexPlan() { + // no-op + } + + /** + * Records a routed file under its model id. + * + * @param aiDefinitionKey the model id (rule's {@code aiDefinitionKey}) + * @param file the source file + * @param rule the routing rule + */ + public void addRoute(final String aiDefinitionKey, final Path file, final AiFieldGenerationConfig rule) { + routesByModel.computeIfAbsent(aiDefinitionKey, key -> new ArrayList<>()).add(new Entry(file, rule)); + } + + /** + * Records a skipped (ignored) file. + * + * @param file the source file + */ + public void addSkipped(final Path file) { + skipped.add(file); + } + + /** + * Records a file that matched no rule and no fallback (a fatal misconfiguration). + * + * @param file the source file + */ + public void addUnmatched(final Path file) { + unmatched.add(file); + } + + /** + * Returns the routed files grouped by model id, in first-seen order. + * + * @return an order-preserving map of model id to its planned entries + */ + public Map> routesByModel() { + return routesByModel; + } + + /** + * Returns the skipped files. + * + * @return the skipped files + */ + public List skipped() { + return skipped; + } + + /** + * Returns the files that matched no rule and no fallback. + * + * @return the unmatched files + */ + public List unmatched() { + return unmatched; + } + + /** + * Returns the total number of routed files across all models. + * + * @return the routed file count + */ + public int routedCount() { + int total = 0; + for (final List entries : routesByModel.values()) { + total += entries.size(); + } + return total; + } + + /** + * Renders a human-readable tree of the plan: each model id, the files it will index and their + * prompt ids, then the skipped and unmatched files. Paths are shown relative to {@code baseDir}. + * + * @param baseDir directory to relativize file paths against for readability + * @return the multi-line tree + */ + public String renderTree(final Path baseDir) { + final StringBuilder sb = new StringBuilder(); + sb.append("AI index plan: ") + .append(routedCount()) + .append(" file(s) across ") + .append(routesByModel.size()) + .append(" model(s), ") + .append(skipped.size()) + .append(" skipped, ") + .append(unmatched.size()) + .append(" unmatched"); + for (final Map.Entry> group : routesByModel.entrySet()) { + sb.append("\n model ") + .append(group.getKey()) + .append(" (") + .append(group.getValue().size()) + .append("):"); + for (final Entry entry : group.getValue()) { + sb.append("\n - ") + .append(relativize(baseDir, entry.file())) + .append(" : prompt ") + .append(entry.rule().getPromptKey()); + } + } + if (!skipped.isEmpty()) { + sb.append("\n skipped (").append(skipped.size()).append("):"); + for (final Path file : skipped) { + sb.append("\n - ").append(relativize(baseDir, file)); + } + } + if (!unmatched.isEmpty()) { + sb.append("\n UNMATCHED - no rule and no fallback (") + .append(unmatched.size()) + .append("):"); + for (final Path file : unmatched) { + sb.append("\n ! ").append(relativize(baseDir, file)); + } + } + return sb.toString(); + } + + /** + * Relativizes {@code file} against {@code baseDir} with {@code /} separators, falling back to the + * absolute path when relativization is not possible. + * + * @param baseDir the base directory + * @param file the file + * @return a display path + */ + private String relativize(final Path baseDir, final Path file) { + try { + return baseDir.relativize(file).toString().replace('\\', '/'); + } catch (final IllegalArgumentException e) { + return file.toString().replace('\\', '/'); + } + } +} diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java index 6a1d145..dd6d57e 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java @@ -14,16 +14,12 @@ import lombok.ToString; import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig; import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationSelector; -import net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport; import net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocument; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderSupport; -import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; -import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport; -import net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider; import net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport; import net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport; import net.ladenthin.maven.llamacpp.aiindex.support.AiSourceExcludeFilter; @@ -33,13 +29,22 @@ import org.jspecify.annotations.Nullable; /** - * Walks the configured source subtrees, creates per-file {@code .ai.md} index files, - * and fills in their AI-generated summary and keyword fields. + * Walks the configured source subtrees and writes per-file {@code .ai.md} index files. * - *

{@code toString} is generated by Lombok over the configuration and collaborator - * fields. The Maven {@link Log} is excluded because its default {@code toString} prints - * implementation details (logger configuration, output stream state) that are noisy - * and not useful for build-log diagnostics. + *

Split into three steps so the {@code generate} goal can plan the whole run before any inference, + * show the model/prompt mapping up front, and load each model exactly once:

+ *
    + *
  1. {@link #collectCandidates(Path)} — walk a source root applying the extension, subtree, exclude + * and goal-level size-band filters.
  2. + *
  3. {@link #classify(Collection, List)} — route each candidate to a rule (prompt + model), a skip, + * or unmatched, producing an {@link AiIndexPlan}.
  4. + *
  5. {@link #indexFile(Path, AiFieldGenerationConfig, AiFieldGenerationSupport)} — write one file's + * {@code .ai.md} with a given rule, using a provider-bearing support (one per model group).
  6. + *
+ * + *

{@code toString} is generated by Lombok over the configuration fields. The Maven {@link Log} is + * excluded because its default {@code toString} prints implementation details that are noisy in + * build-log diagnostics.

*/ @ToString public class SourceFileIndexer { @@ -66,8 +71,6 @@ public class SourceFileIndexer { private final long maxFileSizeBytes; private final boolean force; - private final @Nullable List fieldGenerations; - private final AiPathSupport pathSupport = new AiPathSupport(); private final AiTimeSupport timeSupport = new AiTimeSupport(); private final AiChecksumSupport checksumSupport = new AiChecksumSupport(); @@ -76,31 +79,23 @@ public class SourceFileIndexer { private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); private final AiFieldGenerationSelector fieldGenerationSelector = new AiFieldGenerationSelector(); - private final AiFieldGenerationSupport fieldGenerationSupport; - /** - * Creates a new {@link SourceFileIndexer}. + * Creates a new {@link SourceFileIndexer}. The AI provider and rules are supplied later + * ({@link #classify(Collection, List)} / {@link #indexFile}) so a run can load a separate model per + * routing group. * - * @param log Maven plugin logger - * @param baseDirectory project base directory - * @param outputRoot root directory in which {@code .ai.md} files are written - * @param fileExtensions file extensions to index; may be empty (matches no files) - * @param pluginVersion plugin version recorded in headers - * @param aiVersion AI summarisation logic version recorded in headers - * @param subtrees source subtrees in scope; may be empty - * @param excludes glob patterns (relative to {@code baseDirectory}, {@code /} - * separators) for source files to skip; may be {@code null} or empty - * @param minFileSizeBytes exclusive lower size bound in bytes; files whose size is - * {@code <= minFileSizeBytes} are skipped. {@code 0} (or negative) - * disables the lower bound. Lets one execution target a size band. - * @param maxFileSizeBytes inclusive upper size bound in bytes; files whose size is - * {@code > maxFileSizeBytes} are skipped. {@code 0} (or negative) - * disables the upper bound (unlimited). - * @param force when {@code true}, regenerate even when fields are populated - * @param generationProvider AI provider used to generate fields - * @param fieldGenerations field generation configurations; may be {@code null} - * @param promptSupport prompt lookup - * @param modelDefinitionSupport AI model definition lookup + * @param log Maven plugin logger + * @param baseDirectory project base directory + * @param outputRoot root directory in which {@code .ai.md} files are written + * @param fileExtensions file extensions to index; may be empty (matches no files) + * @param pluginVersion plugin version recorded in headers + * @param aiVersion AI summarisation logic version recorded in headers + * @param subtrees source subtrees in scope; may be empty + * @param excludes glob patterns (relative to {@code baseDirectory}, {@code /} separators) + * for source files to skip; may be {@code null} or empty + * @param minFileSizeBytes exclusive lower size bound in bytes ({@code <= 0} disables it) + * @param maxFileSizeBytes inclusive upper size bound in bytes ({@code <= 0} = unlimited) + * @param force when {@code true}, regenerate even when fields are populated */ public SourceFileIndexer( final Log log, @@ -113,11 +108,7 @@ public SourceFileIndexer( final @Nullable Collection excludes, final long minFileSizeBytes, final long maxFileSizeBytes, - final boolean force, - final AiGenerationProvider generationProvider, - final @Nullable Collection fieldGenerations, - final AiPromptSupport promptSupport, - final AiModelDefinitionSupport modelDefinitionSupport) { + final boolean force) { this.log = log; this.baseDirectory = baseDirectory; this.outputRoot = outputRoot; @@ -129,108 +120,91 @@ public SourceFileIndexer( this.minFileSizeBytes = minFileSizeBytes; this.maxFileSizeBytes = maxFileSizeBytes; this.force = force; - this.fieldGenerations = fieldGenerations != null ? new ArrayList<>(fieldGenerations) : null; - this.fieldGenerationSupport = new AiFieldGenerationSupport( - log, generationProvider, new AiPromptPreparationSupport(promptSupport), modelDefinitionSupport); } /** - * Indexes every matching file beneath {@code sourceRoot}. + * Returns every file beneath {@code sourceRoot} that passes the extension, subtree, exclude and + * size-band filters — the candidate set for routing. * * @param sourceRoot source root directory to walk - * @return number of source-file index files written or refreshed - * @throws IOException if a file cannot be read or written + * @return the matching candidate files, in walk order + * @throws IOException if the tree cannot be walked or a file size cannot be read */ - public int indexSourceRoot(final Path sourceRoot) throws IOException { - int count = 0; - + public List collectCandidates(final Path sourceRoot) throws IOException { + final List candidates = new ArrayList<>(); try (Stream stream = Files.walk(sourceRoot)) { - for (Path path : compatibilityHelper.toList(stream.filter(Files::isRegularFile))) { + for (final Path path : compatibilityHelper.toList(stream.filter(Files::isRegularFile))) { if (!matchesExtension(path)) { continue; } - if (!matchesSubtree(path)) { continue; } - if (isExcluded(path)) { log.debug("Excluded from indexing: " + path); continue; } - if (!matchesSize(path)) { log.debug("Outside configured size band, skipped: " + path); continue; } - - writeAiFile(path); - count++; + candidates.add(path); } } - - return count; - } - - /** - * Returns {@code true} when {@code path} matches a configured exclude glob. The path is - * relativised against {@link #baseDirectory} and normalised to {@code /} separators before - * matching, so the same pattern behaves identically on Windows and POSIX. - * - * @param path absolute source file path encountered during the walk - * @return {@code true} if the file should be skipped - */ - private boolean isExcluded(final Path path) { - final String relative = baseDirectory.relativize(path).toString().replace('\\', '/'); - return excludeFilter.isExcluded(relative); + return candidates; } /** - * Returns {@code true} when {@code path}'s size on disk falls within the configured size band. + * Routes each candidate file to a rule, producing the {@link AiIndexPlan}. * - *

The lower bound {@link #minFileSizeBytes} is exclusive and the upper bound - * {@link #maxFileSizeBytes} is inclusive; either is disabled when {@code <= 0}. Adjacent, - * non-overlapping bands are therefore expressed as {@code band2.min == band1.max}: a file of - * exactly {@code band1.max} bytes belongs to band 1 only (size {@code <= max} there, and - * {@code size > min} fails in band 2). This lets several {@code generate} executions split the - * tree into size tiers (each with its own model/context/prompt) while the source-checksum skip keeps - * every file indexed exactly once.

+ *

For every file the selector picks the winning rule by extension/size/lines and priority; a + * skip rule sends the file to {@link AiIndexPlan#skipped()}, no match (and no fallback) to + * {@link AiIndexPlan#unmatched()}, otherwise the file is routed under the rule's + * {@code aiDefinitionKey}. Line counts are only computed when some rule actually uses a line filter, + * so the common size-only configuration does not read file contents during planning.

* - * @param path absolute source file path encountered during the walk - * @return {@code true} if the file is within the band and should be indexed - * @throws IOException if the file size cannot be read + * @param candidates the candidate files (typically from {@link #collectCandidates(Path)}) + * @param rules the routing rules in declaration order + * @return the routing plan + * @throws IOException if a file size or content cannot be read */ - private boolean matchesSize(final Path path) throws IOException { - final long size = Files.size(path); - if (minFileSizeBytes > 0 && size <= minFileSizeBytes) { - return false; - } - if (maxFileSizeBytes > 0 && size > maxFileSizeBytes) { - return false; - } - return true; - } - - private boolean matchesExtension(final Path path) { - final Path fileNamePath = path.getFileName(); - if (fileNamePath == null) { - return false; - } - final String fileName = fileNamePath.toString(); - for (String extension : fileExtensions) { - if (fileName.endsWith(extension)) { - return true; + public AiIndexPlan classify(final Collection candidates, final List rules) + throws IOException { + final boolean lineFiltersUsed = anyRuleUsesLines(rules); + final AiIndexPlan plan = new AiIndexPlan(); + for (final Path file : candidates) { + final Path fileNamePath = file.getFileName(); + final String fileName = fileNamePath != null ? fileNamePath.toString() : file.toString(); + final long fileSizeBytes = Files.size(file); + final int lineCount = lineFiltersUsed ? countLines(compatibilityHelper.readString(file)) : 0; + + final AiFieldGenerationConfig rule = + fieldGenerationSelector.select(rules, fileName, fileSizeBytes, lineCount); + if (rule == null) { + plan.addUnmatched(file); + } else if (rule.isSkip()) { + plan.addSkipped(file); + } else { + plan.addRoute(rule.getAiDefinitionKey(), file, rule); } } - return false; + return plan; } - private void writeAiFile(final Path sourceFile) throws IOException { - if (fieldGenerations == null || fieldGenerations.isEmpty()) { - throw new IllegalArgumentException( - "No field generations configured for source file indexing of " + sourceFile); - } - + /** + * Writes the {@code .ai.md} for one source file using the given rule and a provider-bearing + * support. Honours the incremental-skip rule: an up-to-date target (matching source checksum, no + * {@code force}) is left untouched. + * + * @param sourceFile the source file + * @param rule the routing rule selected for it (supplies the prompt key) + * @param support the field-generation support holding the model group's provider + * @return {@code true} if the file was (re)written, {@code false} if it was already up to date + * @throws IOException if the file cannot be read or written + */ + public boolean indexFile( + final Path sourceFile, final AiFieldGenerationConfig rule, final AiFieldGenerationSupport support) + throws IOException { final Path relativeToBase = pathSupport.relativizeFromSrc(baseDirectory, sourceFile); final Path targetFile = outputRoot .resolve(relativeToBase.toString() + AiMdHeaderCodec.AI_MD_EXTENSION) @@ -260,37 +234,113 @@ private void writeAiFile(final Path sourceFile) throws IOException { if (!headerSupport.shouldWrite(force, targetFile, baseHeader)) { log.info("Unchanged AI index file: " + targetFile); - return; + return false; } final String sourceText = compatibilityHelper.readString(sourceFile); - final AiFieldGenerationConfig selected = fieldGenerationSelector.selectForFileName(fieldGenerations, fileName); - if (selected == null) { - throw new IllegalArgumentException("No field generation matches file '" + fileName - + "' and no extension-agnostic fallback is configured: " + sourceFile); - } - - final AiGenerationResult result = fieldGenerationSupport.processFieldGenerations( - Collections.singletonList(selected), sourceFile, CONTEXT_TYPE_FILE, sourceText, baseHeader); + final AiGenerationResult result = support.processFieldGenerations( + Collections.singletonList(rule), sourceFile, CONTEXT_TYPE_FILE, sourceText, baseHeader); final AiMdDocument document = new AiMdDocument(baseHeader, result.body()); documentCodec.write(targetFile, document); log.info("Wrote AI index file: " + targetFile); + return true; + } + + /** + * Returns {@code true} when at least one rule declares a line-count bound, so planning knows whether + * it must read file contents to count lines. + * + * @param rules the routing rules + * @return {@code true} if any rule uses {@code minLines}/{@code maxLines} + */ + private boolean anyRuleUsesLines(final List rules) { + for (final AiFieldGenerationConfig rule : rules) { + if (rule != null && (rule.getMinLines() > 0 || rule.getMaxLines() > 0)) { + return true; + } + } + return false; + } + + /** + * Returns {@code true} when {@code path} matches a configured exclude glob. The path is + * relativised against {@link #baseDirectory} and normalised to {@code /} separators before matching. + * + * @param path absolute source file path encountered during the walk + * @return {@code true} if the file should be skipped + */ + private boolean isExcluded(final Path path) { + final String relative = baseDirectory.relativize(path).toString().replace('\\', '/'); + return excludeFilter.isExcluded(relative); + } + + /** + * Returns {@code true} when {@code path}'s size on disk falls within the goal-level size band + * (exclusive lower {@link #minFileSizeBytes}, inclusive upper {@link #maxFileSizeBytes}; each + * disabled when {@code <= 0}). + * + * @param path absolute source file path encountered during the walk + * @return {@code true} if the file is within the band + * @throws IOException if the file size cannot be read + */ + private boolean matchesSize(final Path path) throws IOException { + final long size = Files.size(path); + if (minFileSizeBytes > 0 && size <= minFileSizeBytes) { + return false; + } + if (maxFileSizeBytes > 0 && size > maxFileSizeBytes) { + return false; + } + return true; + } + + /** + * Counts the lines in {@code text} for the line-based prompt selector: the number of newline + * characters, plus one when the text is non-empty and does not end with a newline (so a trailing + * newline does not add a phantom empty line). An empty file counts as zero lines. + * + * @param text the source text + * @return the line count + */ + private int countLines(final String text) { + if (text.isEmpty()) { + return 0; + } + int newlines = 0; + for (int i = 0; i < text.length(); i++) { + if (text.charAt(i) == '\n') { + newlines++; + } + } + return text.charAt(text.length() - 1) == '\n' ? newlines : newlines + 1; + } + + private boolean matchesExtension(final Path path) { + final Path fileNamePath = path.getFileName(); + if (fileNamePath == null) { + return false; + } + final String fileName = fileNamePath.toString(); + for (final String extension : fileExtensions) { + if (fileName.endsWith(extension)) { + return true; + } + } + return false; } private boolean matchesSubtree(final Path path) { if (subtrees == null || subtrees.isEmpty()) { return true; } - - for (Path subtree : subtrees) { + for (final Path subtree : subtrees) { if (path.startsWith(subtree)) { return true; } } - return false; } } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java index 5e8e0dd..694a103 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java @@ -233,34 +233,7 @@ protected int sizeOf(final Collection collection) { */ protected LlamaCppJniConfig buildLlamaCppJniConfig() throws MojoExecutionException { if (fieldGenerations != null && !fieldGenerations.isEmpty()) { - final AiFieldGenerationConfig first = fieldGenerations.get(0); - final AiGenerationConfig config = buildAiModelDefinitionSupport().getConfig(first.getAiDefinitionKey()); - final List stopStrings = config.getStopStrings(); - final List drySequenceBreakers = config.getDrySequenceBreakers(); - return new LlamaCppJniConfig( - llamaLibraryPath, - config.getModelPath(), - config.getContextSize(), - config.getMaxOutputTokens(), - config.getTemperature(), - config.getThreads(), - config.getTopP(), - config.getTopK(), - config.getMinP(), - config.getTopNSigma(), - config.getRepeatPenalty(), - config.isChatTemplateEnableThinking(), - config.isCachePrompt(), - config.isSwaFull(), - config.getCacheReuse(), - config.getReasoningEffort(), - config.getReasoningBudgetTokens(), - config.getDryMultiplier(), - config.getDryBase(), - config.getDryAllowedLength(), - config.getDryPenaltyLastN(), - drySequenceBreakers != null ? drySequenceBreakers : Collections.emptyList(), - stopStrings != null ? stopStrings : Collections.emptyList()); + return buildLlamaCppJniConfig(fieldGenerations.get(0).getAiDefinitionKey()); } return new LlamaCppJniConfig( llamaLibraryPath, @@ -288,6 +261,46 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig() throws MojoExecutionExcepti Collections.emptyList()); } + /** + * Builds a {@link net.ladenthin.maven.llamacpp.aiindex.provider.LlamaCppJniConfig} from a specific + * AI model definition, identified by its key. Used by the {@code generate} goal to load a separate + * model per routing group (one provider per distinct {@code aiDefinitionKey}). + * + * @param aiDefinitionKey the {@link net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition} key + * @return fully populated llama.cpp configuration for that definition + * @throws IllegalArgumentException if {@code aiDefinitionKey} matches no registered definition + * @throws MojoExecutionException propagated from {@link #buildAiModelDefinitionSupport()} + */ + protected LlamaCppJniConfig buildLlamaCppJniConfig(final String aiDefinitionKey) throws MojoExecutionException { + final AiGenerationConfig config = buildAiModelDefinitionSupport().getConfig(aiDefinitionKey); + final List stopStrings = config.getStopStrings(); + final List drySequenceBreakers = config.getDrySequenceBreakers(); + return new LlamaCppJniConfig( + llamaLibraryPath, + config.getModelPath(), + config.getContextSize(), + config.getMaxOutputTokens(), + config.getTemperature(), + config.getThreads(), + config.getTopP(), + config.getTopK(), + config.getMinP(), + config.getTopNSigma(), + config.getRepeatPenalty(), + config.isChatTemplateEnableThinking(), + config.isCachePrompt(), + config.isSwaFull(), + config.getCacheReuse(), + config.getReasoningEffort(), + config.getReasoningBudgetTokens(), + config.getDryMultiplier(), + config.getDryBase(), + config.getDryAllowedLength(), + config.getDryPenaltyLastN(), + drySequenceBreakers != null ? drySequenceBreakers : Collections.emptyList(), + stopStrings != null ? stopStrings : Collections.emptyList()); + } + /** * Builds an {@link net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport} from the configured {@link #promptDefinitions}. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java index 31e2d35..440da7d 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java @@ -5,10 +5,16 @@ import java.io.IOException; import java.nio.file.Path; +import java.util.ArrayList; import java.util.List; +import java.util.Map; import lombok.ToString; +import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationSelector; import net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport; +import net.ladenthin.maven.llamacpp.aiindex.indexer.AiFieldGenerationSupport; +import net.ladenthin.maven.llamacpp.aiindex.indexer.AiIndexPlan; import net.ladenthin.maven.llamacpp.aiindex.indexer.SourceFileIndexer; +import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport; import net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider; import net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProviderFactory; @@ -94,6 +100,14 @@ public GenerateMojo() { @Parameter(property = "aiIndex.llama.threads", defaultValue = "2") private int llamaThreads; + /** + * When {@code true}, only build and log the routing plan (which model indexes which files with which + * prompt) and then stop — no model is loaded and nothing is generated. Useful to verify routing + * before a long run. + */ + @Parameter(property = "aiIndex.planOnly", defaultValue = "false") + private boolean planOnly; + private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); @Override @@ -126,48 +140,85 @@ public void execute() throws MojoExecutionException { logExecutionParameters( "Starting AI index generation", basePath, outputPath, resolvedSubtrees, resolvedExtensions); - try { - final AiPromptSupport promptSupport = buildPromptSupport(); - final AiModelDefinitionSupport modelDefinitionSupport = buildAiModelDefinitionSupport(); - final AiGenerationProviderFactory providerFactory = new AiGenerationProviderFactory(); + if (fieldGenerations == null || fieldGenerations.isEmpty()) { + throw new MojoExecutionException("No configured for the generate goal."); + } - try (AiGenerationProvider provider = - providerFactory.create(generationProvider, buildLlamaCppJniConfig(), promptSupport)) { - - final SourceFileIndexer fileIndexer = new SourceFileIndexer( - getLog(), - basePath, - outputPath, - resolvedExtensions, - pluginVersion, - aiVersion, - resolvedSubtrees, - excludes, - minFileSizeBytes, - maxFileSizeBytes, - force, - provider, - fieldGenerations, - promptSupport, - modelDefinitionSupport); - - int count = 0; - - for (Path subtree : resolvedSubtrees.isEmpty() - ? compatibilityHelper.listOf(basePath.resolve("src/main/java")) - : resolvedSubtrees) { - - if (!subtree.toFile().exists()) { - getLog().warn("Skipping missing subtree: " + subtree); - continue; - } + final AiPromptSupport promptSupport = buildPromptSupport(); + final AiModelDefinitionSupport modelDefinitionSupport = buildAiModelDefinitionSupport(); + final AiFieldGenerationSelector selector = new AiFieldGenerationSelector(); + // Fail fast on a bad rule set (e.g. >1 fallback, a route rule missing prompt/model). + selector.validate(fieldGenerations); + + final SourceFileIndexer fileIndexer = new SourceFileIndexer( + getLog(), + basePath, + outputPath, + resolvedExtensions, + pluginVersion, + aiVersion, + resolvedSubtrees, + excludes, + minFileSizeBytes, + maxFileSizeBytes, + force); - count += fileIndexer.indexSourceRoot(subtree); + try { + // 1. Collect candidate files across the configured subtrees. + final List candidates = new ArrayList<>(); + for (final Path subtree : resolvedSubtrees.isEmpty() + ? compatibilityHelper.listOf(basePath.resolve("src/main/java")) + : resolvedSubtrees) { + if (!subtree.toFile().exists()) { + getLog().warn("Skipping missing subtree: " + subtree); + continue; } + candidates.addAll(fileIndexer.collectCandidates(subtree)); + } - getLog().info("Generated AI files: " + count); + // 2. Plan the run: which model + prompt each file gets (or skip / unmatched). + final AiIndexPlan plan = fileIndexer.classify(candidates, fieldGenerations); + getLog().info(plan.renderTree(basePath)); + + // 3. A file that matched no rule and no fallback is a fatal misconfiguration. + if (!plan.unmatched().isEmpty()) { + throw new MojoExecutionException(plan.unmatched().size() + + " source file(s) matched no rule and no fallback is configured; " + + "add a rule or a matching rule (see the plan above)."); + } + + if (planOnly) { + getLog().info("planOnly=true: stopping after the plan; no model loaded, nothing generated."); + return; } + // 4. Execute model group by model group: load each model once, index its files, close. + final AiGenerationProviderFactory providerFactory = new AiGenerationProviderFactory(); + final AiPromptPreparationSupport promptPreparationSupport = new AiPromptPreparationSupport(promptSupport); + int wrote = 0; + int unchanged = 0; + for (final Map.Entry> group : + plan.routesByModel().entrySet()) { + final String aiDefinitionKey = group.getKey(); + getLog().info("Loading model '" + aiDefinitionKey + "' for " + + group.getValue().size() + " file(s)"); + try (AiGenerationProvider provider = providerFactory.create( + generationProvider, buildLlamaCppJniConfig(aiDefinitionKey), promptSupport)) { + final AiFieldGenerationSupport support = new AiFieldGenerationSupport( + getLog(), provider, promptPreparationSupport, modelDefinitionSupport); + for (final AiIndexPlan.Entry entry : group.getValue()) { + if (fileIndexer.indexFile(entry.file(), entry.rule(), support)) { + wrote++; + } else { + unchanged++; + } + } + } + } + + getLog().info("Generated AI files: " + wrote + " written, " + unchanged + " unchanged, " + + plan.skipped().size() + " skipped"); + } catch (IOException e) { throw new MojoExecutionException( "Failed to generate AI index files under " + outputPath + " from base " + basePath, e); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java index e0f1b2a..b479281 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java @@ -58,4 +58,60 @@ public void getFileExtensions_returnedListIsUnmodifiable() { UnsupportedOperationException.class, () -> config.getFileExtensions().add(".sql")); } + + @Test + public void minFileSizeBytes_defaultsZeroAndRoundTrips() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.getMinFileSizeBytes(), is(equalTo(0L))); + config.setMinFileSizeBytes(16384L); + assertThat(config.getMinFileSizeBytes(), is(equalTo(16384L))); + } + + @Test + public void maxFileSizeBytes_defaultsZeroAndRoundTrips() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.getMaxFileSizeBytes(), is(equalTo(0L))); + config.setMaxFileSizeBytes(49152L); + assertThat(config.getMaxFileSizeBytes(), is(equalTo(49152L))); + } + + @Test + public void minLines_defaultsZeroAndRoundTrips() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.getMinLines(), is(equalTo(0))); + config.setMinLines(100); + assertThat(config.getMinLines(), is(equalTo(100))); + } + + @Test + public void maxLines_defaultsZeroAndRoundTrips() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.getMaxLines(), is(equalTo(0))); + config.setMaxLines(500); + assertThat(config.getMaxLines(), is(equalTo(500))); + } + + @Test + public void priority_defaultsZeroAndRoundTrips() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.getPriority(), is(equalTo(0))); + config.setPriority(10); + assertThat(config.getPriority(), is(equalTo(10))); + } + + @Test + public void fallback_defaultsFalseAndTogglesTrue() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.isFallback(), is(false)); + config.setFallback(true); + assertThat(config.isFallback(), is(true)); + } + + @Test + public void skip_defaultsFalseAndTogglesTrue() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.isSkip(), is(false)); + config.setSkip(true); + assertThat(config.isSkip(), is(true)); + } } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelectorTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelectorTest.java index 8c935fe..96c8684 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelectorTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationSelectorTest.java @@ -7,6 +7,8 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Arrays; import java.util.Collections; @@ -15,108 +17,236 @@ public class AiFieldGenerationSelectorTest { + private static final String MODEL = "model-x"; private final AiFieldGenerationSelector selector = new AiFieldGenerationSelector(); - private static AiFieldGenerationConfig config(final String promptKey, final List extensions) { - final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); - config.setPromptKey(promptKey); - config.setFileExtensions(extensions); - return config; + private static AiFieldGenerationConfig route(final String prompt, final List ext, final int priority) { + final AiFieldGenerationConfig c = new AiFieldGenerationConfig(); + c.setPromptKey(prompt); + c.setAiDefinitionKey(MODEL); + c.setFileExtensions(ext); + c.setPriority(priority); + return c; } - // - @Test - public void selectForFileName_extensionMatch_returnsSpecificEntry() { - final AiFieldGenerationConfig java = config("java", Arrays.asList(".java")); - final AiFieldGenerationConfig fallback = config("fallback", null); + private static AiFieldGenerationConfig skipRule(final List ext, final int priority) { + final AiFieldGenerationConfig c = new AiFieldGenerationConfig(); + c.setFileExtensions(ext); + c.setSkip(true); + c.setPriority(priority); + return c; + } - final AiFieldGenerationConfig selected = selector.selectForFileName(Arrays.asList(java, fallback), "Foo.java"); + private static AiFieldGenerationConfig fallback(final String prompt) { + final AiFieldGenerationConfig c = new AiFieldGenerationConfig(); + c.setPromptKey(prompt); + c.setAiDefinitionKey(MODEL); + c.setFallback(true); + return c; + } - assertThat(selected.getPromptKey(), is(equalTo("java"))); + private static AiFieldGenerationConfig sized(final String prompt, final long min, final long max) { + final AiFieldGenerationConfig c = new AiFieldGenerationConfig(); + c.setPromptKey(prompt); + c.setAiDefinitionKey(MODEL); + c.setMinFileSizeBytes(min); + c.setMaxFileSizeBytes(max); + return c; } - @Test - public void selectForFileName_specificWinsOverEarlierFallback() { - final AiFieldGenerationConfig fallback = config("fallback", null); - final AiFieldGenerationConfig java = config("java", Arrays.asList(".java")); + private static AiFieldGenerationConfig lined(final String prompt, final int min, final int max) { + final AiFieldGenerationConfig c = new AiFieldGenerationConfig(); + c.setPromptKey(prompt); + c.setAiDefinitionKey(MODEL); + c.setMinLines(min); + c.setMaxLines(max); + return c; + } - final AiFieldGenerationConfig selected = selector.selectForFileName(Arrays.asList(fallback, java), "Foo.java"); + // + @Test + public void select_extensionMatch() { + final AiFieldGenerationConfig java = route("java", Arrays.asList(".java"), 0); + final AiFieldGenerationConfig fb = fallback("fb"); + assertThat( + selector.select(Arrays.asList(java, fb), "Foo.java", 500L, 10).getPromptKey(), is(equalTo("java"))); + } - assertThat(selected.getPromptKey(), is(equalTo("java"))); + @Test + public void select_higherPriorityWinsRegardlessOfOrder() { + final AiFieldGenerationConfig low = route("low", Arrays.asList(".java"), 1); + final AiFieldGenerationConfig high = route("high", Arrays.asList(".java"), 10); + // declared low-then-high: high must still win + assertThat( + selector.select(Arrays.asList(low, high), "Foo.java", 500L, 10).getPromptKey(), is(equalTo("high"))); + // declared high-then-low: high still wins + assertThat( + selector.select(Arrays.asList(high, low), "Foo.java", 500L, 10).getPromptKey(), is(equalTo("high"))); } @Test - public void selectForFileName_firstSpecificMatchWins() { - final AiFieldGenerationConfig first = config("first", Arrays.asList(".java")); - final AiFieldGenerationConfig second = config("second", Arrays.asList(".java")); + public void select_priorityTieBrokenByDeclarationOrder() { + final AiFieldGenerationConfig first = route("first", Arrays.asList(".java"), 5); + final AiFieldGenerationConfig second = route("second", Arrays.asList(".java"), 5); + assertThat( + selector.select(Arrays.asList(first, second), "Foo.java", 500L, 10) + .getPromptKey(), + is(equalTo("first"))); + } - final AiFieldGenerationConfig selected = selector.selectForFileName(Arrays.asList(first, second), "Foo.java"); + @Test + public void select_skipRuleCanWinByPriority() { + final AiFieldGenerationConfig route = route("route", Arrays.asList(".java"), 0); + final AiFieldGenerationConfig skip = skipRule(Arrays.asList(".java"), 10); + final AiFieldGenerationConfig winner = selector.select(Arrays.asList(route, skip), "Foo.java", 500L, 10); + assertThat(winner.isSkip(), is(true)); + } - assertThat(selected.getPromptKey(), is(equalTo("first"))); + @Test + public void select_fallbackUsedWhenNoNonFallbackMatches() { + final AiFieldGenerationConfig java = route("java", Arrays.asList(".java"), 0); + final AiFieldGenerationConfig fb = fallback("fb"); + assertThat( + selector.select(Arrays.asList(java, fb), "data.json", 500L, 10).getPromptKey(), is(equalTo("fb"))); } @Test - public void selectForFileName_anyOfMultipleExtensionsMatches() { - final AiFieldGenerationConfig sql = config("sql", Arrays.asList(".sql", ".ddl")); + public void select_noMatchNoFallback_returnsNull() { + final AiFieldGenerationConfig java = route("java", Arrays.asList(".java"), 0); + assertThat(selector.select(Collections.singletonList(java), "data.json", 500L, 10), is(nullValue())); + } - final AiFieldGenerationConfig selected = - selector.selectForFileName(Collections.singletonList(sql), "schema.ddl"); + @Test + public void select_nullEntrySkipped() { + final AiFieldGenerationConfig java = route("java", Arrays.asList(".java"), 0); + assertThat( + selector.select(Arrays.asList(null, java), "Foo.java", 500L, 10) + .getPromptKey(), + is(equalTo("java"))); + } - assertThat(selected.getPromptKey(), is(equalTo("sql"))); + @Test + public void select_firstFallbackWinsWhenSeveral() { + final AiFieldGenerationConfig first = fallback("first"); + final AiFieldGenerationConfig second = fallback("second"); + assertThat( + selector.select(Arrays.asList(first, second), "data.json", 500L, 10) + .getPromptKey(), + is(equalTo("first"))); } // - // + // @Test - public void selectForFileName_noSpecificMatch_returnsFallback() { - final AiFieldGenerationConfig java = config("java", Arrays.asList(".java")); - final AiFieldGenerationConfig fallback = config("fallback", null); - - final AiFieldGenerationConfig selected = selector.selectForFileName(Arrays.asList(java, fallback), "data.json"); - - assertThat(selected.getPromptKey(), is(equalTo("fallback"))); + public void select_sizeMinExclusiveMaxInclusive() { + final AiFieldGenerationConfig big = sized("big", 1000L, 0L); + assertThat(selector.select(Collections.singletonList(big), "Foo.java", 1000L, 0), is(nullValue())); + assertThat( + selector.select(Collections.singletonList(big), "Foo.java", 1001L, 0) + .getPromptKey(), + is(equalTo("big"))); + final AiFieldGenerationConfig small = sized("small", 0L, 1000L); + assertThat( + selector.select(Collections.singletonList(small), "Foo.java", 1000L, 0) + .getPromptKey(), + is(equalTo("small"))); + assertThat(selector.select(Collections.singletonList(small), "Foo.java", 1001L, 0), is(nullValue())); } @Test - public void selectForFileName_emptyExtensionListIsFallback() { - final AiFieldGenerationConfig empty = config("empty", Collections.emptyList()); - - final AiFieldGenerationConfig selected = - selector.selectForFileName(Collections.singletonList(empty), "anything.xyz"); + public void select_lineMinExclusiveMaxInclusive() { + final AiFieldGenerationConfig many = lined("many", 100, 0); + assertThat(selector.select(Collections.singletonList(many), "Foo.java", 0L, 100), is(nullValue())); + assertThat( + selector.select(Collections.singletonList(many), "Foo.java", 0L, 101) + .getPromptKey(), + is(equalTo("many"))); + final AiFieldGenerationConfig few = lined("few", 0, 100); + assertThat( + selector.select(Collections.singletonList(few), "Foo.java", 0L, 100) + .getPromptKey(), + is(equalTo("few"))); + assertThat(selector.select(Collections.singletonList(few), "Foo.java", 0L, 101), is(nullValue())); + } - assertThat(selected.getPromptKey(), is(equalTo("empty"))); + @Test + public void select_allDimensionsMustMatch() { + final AiFieldGenerationConfig combined = new AiFieldGenerationConfig(); + combined.setPromptKey("combined"); + combined.setAiDefinitionKey(MODEL); + combined.setFileExtensions(Arrays.asList(".java")); + combined.setMaxFileSizeBytes(1000L); + combined.setMaxLines(50); + final List list = Arrays.asList(combined, fallback("fb")); + + assertThat(selector.select(list, "Foo.java", 500L, 30).getPromptKey(), is(equalTo("combined"))); + assertThat(selector.select(list, "Foo.sql", 500L, 30).getPromptKey(), is(equalTo("fb"))); // ext fails + assertThat(selector.select(list, "Foo.java", 5000L, 30).getPromptKey(), is(equalTo("fb"))); // size fails + assertThat(selector.select(list, "Foo.java", 500L, 999).getPromptKey(), is(equalTo("fb"))); // lines fail } + // + // @Test - public void selectForFileName_firstFallbackWins() { - final AiFieldGenerationConfig first = config("first", null); - final AiFieldGenerationConfig second = config("second", Collections.emptyList()); + public void validate_validRuleSetPasses() { + final List rules = Arrays.asList( + route("java", Arrays.asList(".java"), 0), skipRule(Arrays.asList(".tmp"), 10), fallback("fb")); + assertDoesNotThrow(() -> selector.validate(rules)); + } - final AiFieldGenerationConfig selected = selector.selectForFileName(Arrays.asList(first, second), "data.json"); + @Test + public void validate_nullEntryIgnored() { + final List rules = + Arrays.asList(null, route("java", Arrays.asList(".java"), 0)); + assertDoesNotThrow(() -> selector.validate(rules)); + } - assertThat(selected.getPromptKey(), is(equalTo("first"))); + @Test + public void validate_moreThanOneFallback_throws() { + final List rules = Arrays.asList(fallback("a"), fallback("b")); + assertThrows(IllegalArgumentException.class, () -> selector.validate(rules)); } - // - // @Test - public void selectForFileName_noMatchNoFallback_returnsNull() { - final AiFieldGenerationConfig java = config("java", Arrays.asList(".java")); + public void validate_nonFallbackWithoutFilter_throws() { + final AiFieldGenerationConfig noFilter = new AiFieldGenerationConfig(); + noFilter.setPromptKey("p"); + noFilter.setAiDefinitionKey(MODEL); // no extension/size/line filter, not a fallback + assertThrows(IllegalArgumentException.class, () -> selector.validate(Collections.singletonList(noFilter))); + } - final AiFieldGenerationConfig selected = - selector.selectForFileName(Collections.singletonList(java), "data.json"); + @Test + public void validate_fallbackThatIsAlsoSkip_throws() { + final AiFieldGenerationConfig bad = fallback("p"); + bad.setSkip(true); + assertThrows(IllegalArgumentException.class, () -> selector.validate(Collections.singletonList(bad))); + } - assertThat(selected, is(nullValue())); + @Test + public void validate_routeMissingPromptKey_throws() { + final AiFieldGenerationConfig bad = route(null, Arrays.asList(".java"), 0); + assertThrows(IllegalArgumentException.class, () -> selector.validate(Collections.singletonList(bad))); } @Test - public void selectForFileName_nullEntrySkipped() { - final AiFieldGenerationConfig java = config("java", Arrays.asList(".java")); + public void validate_routeMissingAiDefinitionKey_throws() { + final AiFieldGenerationConfig bad = new AiFieldGenerationConfig(); + bad.setPromptKey("p"); + bad.setFileExtensions(Arrays.asList(".java")); // has a filter but no model + assertThrows(IllegalArgumentException.class, () -> selector.validate(Collections.singletonList(bad))); + } - final AiFieldGenerationConfig selected = - selector.selectForFileName(Arrays.asList(null, java), "Foo.java"); + @Test + public void validate_fallbackMissingKeys_throws() { + final AiFieldGenerationConfig bad = new AiFieldGenerationConfig(); + bad.setFallback(true); // no promptKey / aiDefinitionKey + assertThrows(IllegalArgumentException.class, () -> selector.validate(Collections.singletonList(bad))); + } - assertThat(selected.getPromptKey(), is(equalTo("java"))); + @Test + public void validate_skipRuleNeedsNoKeys() { + // a skip rule with a filter and no prompt/model is valid + assertDoesNotThrow(() -> selector.validate(Collections.singletonList(skipRule(Arrays.asList(".tmp"), 0)))); } // } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java index 8900e38..c469dad 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexerTest.java @@ -4,27 +4,23 @@ package net.ladenthin.maven.llamacpp.aiindex.indexer; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import net.ladenthin.maven.llamacpp.aiindex.CommonTestFixtures; import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig; -import net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocument; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec; -import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec; -import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptDefinition; +import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptSupport; -import net.ladenthin.maven.llamacpp.aiindex.provider.AiGenerationProvider; import net.ladenthin.maven.llamacpp.aiindex.provider.MockAiGenerationProvider; import org.apache.maven.plugin.logging.SystemStreamLog; import org.junit.jupiter.api.Test; @@ -33,30 +29,13 @@ public class SourceFileIndexerTest { private final AiMdDocumentCodec documentCodec = new AiMdDocumentCodec(); - // - @Test - public void indexSourceRoot_singleJavaFile_createsAiMdFile() throws Exception { - // arrange - final Path temp = Files.createTempDirectory("ai-index-test"); - final Path baseDirectory = temp; - final Path outputRoot = temp.resolve("src/site/ai"); - final Path sourceRoot = temp.resolve("src/main/java"); - final Path sourceFile = sourceRoot.resolve("com/example/Test.java"); - final Path aiFile = outputRoot.resolve("main/java/com/example/Test.java.ai.md"); - - Files.createDirectories(sourceFile.getParent()); - Files.write( - sourceFile, - ("package com.example;\n" + "\n" - + "public class Test {\n" - + " public String hello(final String name) {\n" - + " return \"Hello \" + name;\n" - + " }\n" - + "}\n") - .getBytes(StandardCharsets.UTF_8)); - - final AiPromptSupport promptSupport = new AiPromptSupport(CommonTestFixtures.createFilePromptDefinitions()); - final SourceFileIndexer indexer = new SourceFileIndexer( + private SourceFileIndexer indexer( + final Path baseDirectory, + final Path outputRoot, + final List excludes, + final long minSizeBytes, + final long maxSizeBytes) { + return new SourceFileIndexer( new SystemStreamLog(), baseDirectory, outputRoot, @@ -64,290 +43,185 @@ public void indexSourceRoot_singleJavaFile_createsAiMdFile() throws Exception { "1.0.0", "0.0.0", Collections.emptyList(), - Collections.emptyList(), - 0L, - 0L, - false, + excludes, + minSizeBytes, + maxSizeBytes, + false); + } + + private AiFieldGenerationSupport mockSupport() { + final AiPromptSupport promptSupport = new AiPromptSupport(CommonTestFixtures.createFilePromptDefinitions()); + return new AiFieldGenerationSupport( + new SystemStreamLog(), new MockAiGenerationProvider(), - CommonTestFixtures.createFileFieldGenerations(), - promptSupport, + new AiPromptPreparationSupport(promptSupport), CommonTestFixtures.createDefaultAiModelDefinitionSupport()); + } - // act - final int indexed = indexer.indexSourceRoot(sourceRoot); - - // pre-assert - assertThat(Files.exists(aiFile), is(true)); - - // assert - assertThat(indexed, is(equalTo(1))); - - final AiMdDocument document = documentCodec.read(aiFile); + private static void writeJava(final Path file, final String body) throws Exception { + Files.createDirectories(file.getParent()); + Files.write(file, body.getBytes(StandardCharsets.UTF_8)); + } - // pre-assert - assertThat(document, is(notNullValue())); + /** Writes a {@code .java} file padded with a line comment to exactly {@code totalBytes} bytes. */ + private static void writeSizedJava(final Path file, final int totalBytes) throws Exception { + Files.createDirectories(file.getParent()); + final StringBuilder sb = new StringBuilder(totalBytes); + sb.append("// "); + while (sb.length() < totalBytes) { + sb.append('x'); + } + sb.setLength(totalBytes); + Files.write(file, sb.toString().getBytes(StandardCharsets.UTF_8)); + } - // assert - assertThat(document.header().title(), is(equalTo("Test.java"))); - assertThat(document.header().h(), is(equalTo(AiMdHeaderCodec.HEADER_VERSION_1_0))); - assertThat(document.header().x(), is(equalTo(AiMdHeaderCodec.NODE_TYPE_FILE))); - assertThat(document.header().g(), is(equalTo("1.0.0"))); - assertThat(document.header().a(), is(equalTo("0.0.0"))); - assertThat(document.header().c().trim().isEmpty(), is(false)); - assertThat(document.header().d().trim().isEmpty(), is(false)); - assertThat(document.header().t().trim().isEmpty(), is(false)); - assertThat(document.body().trim().isEmpty(), is(false)); + private static AiFieldGenerationConfig rule( + final String promptKey, final List extensions, final boolean skip, final boolean fallback) { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + config.setPromptKey(promptKey); + config.setAiDefinitionKey(CommonTestFixtures.AI_DEFINITION_KEY_DEFAULT); + config.setFileExtensions(extensions); + config.setSkip(skip); + config.setFallback(fallback); + return config; } - // - // + // @Test - public void indexSourceRoot_selectsPromptByFileExtension() throws Exception { - // arrange: a .java source; config maps .java -> java prompt, .sql -> sql, plus a fallback + public void collectCandidates_returnsMatchingJavaFile() throws Exception { final Path temp = Files.createTempDirectory("ai-index-test"); - final Path outputRoot = temp.resolve("src/site/ai"); final Path sourceRoot = temp.resolve("src/main/java"); - Files.createDirectories(sourceRoot.resolve("com/example")); - Files.write( - sourceRoot.resolve("com/example/Foo.java"), - "package com.example;\nclass Foo {}\n".getBytes(StandardCharsets.UTF_8)); - - final AiPromptSupport promptSupport = new AiPromptSupport(Arrays.asList( - promptDefinition("file-body-java"), - promptDefinition("file-body-sql"), - promptDefinition("file-body-fallback"))); - final CapturingProvider provider = new CapturingProvider(); - final SourceFileIndexer indexer = new SourceFileIndexer( - new SystemStreamLog(), - temp, - outputRoot, - Arrays.asList(".java"), - "1.0.0", - "0.0.0", - Collections.emptyList(), - Collections.emptyList(), - 0L, - 0L, - false, - provider, - Arrays.asList( - fieldGeneration("file-body-java", Arrays.asList(".java")), - fieldGeneration("file-body-sql", Arrays.asList(".sql")), - fieldGeneration("file-body-fallback", null)), - promptSupport, - CommonTestFixtures.createDefaultAiModelDefinitionSupport()); + writeJava(sourceRoot.resolve("com/example/Foo.java"), "class Foo {}\n"); - // act - indexer.indexSourceRoot(sourceRoot); + final List candidates = indexer(temp, temp.resolve("out"), Collections.emptyList(), 0L, 0L) + .collectCandidates(sourceRoot); - // assert: only the java prompt ran for the .java file - assertThat(provider.promptKeys(), is(equalTo(Arrays.asList("file-body-java")))); + assertThat(candidates.size(), is(equalTo(1))); + assertThat(candidates.get(0).getFileName().toString(), is(equalTo("Foo.java"))); } @Test - public void indexSourceRoot_noMatchingExtensionAndNoFallback_throws() throws Exception { - // arrange: a .java file, but the only field generation targets .sql with no fallback + public void collectCandidates_excludesGlobAndSizeBand() throws Exception { final Path temp = Files.createTempDirectory("ai-index-test"); - final Path outputRoot = temp.resolve("src/site/ai"); final Path sourceRoot = temp.resolve("src/main/java"); - Files.createDirectories(sourceRoot.resolve("com/example")); - Files.write( - sourceRoot.resolve("com/example/Foo.java"), - "package com.example;\nclass Foo {}\n".getBytes(StandardCharsets.UTF_8)); - - final AiPromptSupport promptSupport = - new AiPromptSupport(Collections.singletonList(promptDefinition("file-body-sql"))); - final SourceFileIndexer indexer = new SourceFileIndexer( - new SystemStreamLog(), - temp, - outputRoot, - Arrays.asList(".java"), - "1.0.0", - "0.0.0", - Collections.emptyList(), - Collections.emptyList(), - 0L, - 0L, - false, - new MockAiGenerationProvider(), - Collections.singletonList(fieldGeneration("file-body-sql", Arrays.asList(".sql"))), - promptSupport, - CommonTestFixtures.createDefaultAiModelDefinitionSupport()); + writeJava(sourceRoot.resolve("com/example/Foo.java"), "class Foo {}\n"); + writeJava(sourceRoot.resolve("com/example/package-info.java"), "package com.example;\n"); + writeSizedJava(sourceRoot.resolve("com/example/Big.java"), 5000); - // act + assert - assertThrows(IllegalArgumentException.class, () -> indexer.indexSourceRoot(sourceRoot)); + // exclude package-info, and a max band of 1000 bytes drops Big.java + final List candidates = indexer( + temp, temp.resolve("out"), Arrays.asList("**/package-info.java"), 0L, 1000L) + .collectCandidates(sourceRoot); + + assertThat(candidates.size(), is(equalTo(1))); + assertThat(candidates.get(0).getFileName().toString(), is(equalTo("Foo.java"))); } - // - // @Test - public void indexSourceRoot_excludedFileIsSkipped() throws Exception { - // arrange: two .java files; exclude package-info.java by glob + public void collectCandidates_sizeBandBoundaryMinExclusiveMaxInclusive() throws Exception { final Path temp = Files.createTempDirectory("ai-index-test"); - final Path outputRoot = temp.resolve("src/site/ai"); final Path sourceRoot = temp.resolve("src/main/java"); - Files.createDirectories(sourceRoot.resolve("com/example")); - Files.write( - sourceRoot.resolve("com/example/Foo.java"), - "package com.example;\nclass Foo {}\n".getBytes(StandardCharsets.UTF_8)); - Files.write( - sourceRoot.resolve("com/example/package-info.java"), - "package com.example;\n".getBytes(StandardCharsets.UTF_8)); - - final AiPromptSupport promptSupport = new AiPromptSupport(CommonTestFixtures.createFilePromptDefinitions()); - final SourceFileIndexer indexer = new SourceFileIndexer( - new SystemStreamLog(), - temp, - outputRoot, - Arrays.asList(".java"), - "1.0.0", - "0.0.0", - Collections.emptyList(), - Arrays.asList("**/package-info.java"), - 0L, - 0L, - false, - new MockAiGenerationProvider(), - CommonTestFixtures.createFileFieldGenerations(), - promptSupport, - CommonTestFixtures.createDefaultAiModelDefinitionSupport()); - - // act - final int indexed = indexer.indexSourceRoot(sourceRoot); + writeSizedJava(sourceRoot.resolve("com/example/Edge.java"), 1000); - // assert: only Foo.java was indexed; package-info.java was excluded - assertThat(indexed, is(equalTo(1))); - assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Foo.java.ai.md")), is(true)); - assertThat(Files.exists(outputRoot.resolve("main/java/com/example/package-info.java.ai.md")), is(false)); + // max=1000 includes it (inclusive); min=1000 excludes it (exclusive) + assertThat( + indexer(temp, temp.resolve("a"), Collections.emptyList(), 0L, 1000L) + .collectCandidates(sourceRoot) + .size(), + is(equalTo(1))); + assertThat( + indexer(temp, temp.resolve("b"), Collections.emptyList(), 1000L, 0L) + .collectCandidates(sourceRoot) + .size(), + is(equalTo(0))); } // - // + // @Test - public void indexSourceRoot_maxFileSizeBytes_skipsLargerFiles() throws Exception { - // arrange: a 100-byte and a 5000-byte .java file; max band = 1000 bytes + public void classify_routesByExtensionToPrompt() throws Exception { final Path temp = Files.createTempDirectory("ai-index-test"); - final Path outputRoot = temp.resolve("src/site/ai"); - final Path sourceRoot = temp.resolve("src/main/java"); - Files.createDirectories(sourceRoot.resolve("com/example")); - writeSizedJava(sourceRoot.resolve("com/example/Small.java"), 100); - writeSizedJava(sourceRoot.resolve("com/example/Big.java"), 5000); - - final SourceFileIndexer indexer = sizeBandIndexer(temp, outputRoot, 0L, 1000L); - - // act - final int indexed = indexer.indexSourceRoot(sourceRoot); - - // assert: only the small file (<= 1000) was indexed - assertThat(indexed, is(equalTo(1))); - assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Small.java.ai.md")), is(true)); - assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Big.java.ai.md")), is(false)); + final Path foo = temp.resolve("src/main/java/com/example/Foo.java"); + writeJava(foo, "class Foo {}\n"); + + final List rules = + Arrays.asList(rule("java", Arrays.asList(".java"), false, false), rule("fallback", null, false, true)); + + final AiIndexPlan plan = indexer(temp, temp.resolve("out"), Collections.emptyList(), 0L, 0L) + .classify(Arrays.asList(foo), rules); + + assertThat(plan.unmatched().isEmpty(), is(true)); + assertThat(plan.routedCount(), is(equalTo(1))); + assertThat( + plan.routesByModel() + .get(CommonTestFixtures.AI_DEFINITION_KEY_DEFAULT) + .get(0) + .rule() + .getPromptKey(), + is(equalTo("java"))); } @Test - public void indexSourceRoot_minFileSizeBytes_skipsSmallerFiles() throws Exception { - // arrange: a 100-byte and a 5000-byte .java file; min band = 1000 bytes (exclusive) + public void classify_skipRuleSendsFileToSkipped() throws Exception { final Path temp = Files.createTempDirectory("ai-index-test"); - final Path outputRoot = temp.resolve("src/site/ai"); - final Path sourceRoot = temp.resolve("src/main/java"); - Files.createDirectories(sourceRoot.resolve("com/example")); - writeSizedJava(sourceRoot.resolve("com/example/Small.java"), 100); - writeSizedJava(sourceRoot.resolve("com/example/Big.java"), 5000); + final Path generated = temp.resolve("src/main/java/com/example/Generated.java"); + writeJava(generated, "class Generated {}\n"); - final SourceFileIndexer indexer = sizeBandIndexer(temp, outputRoot, 1000L, 0L); + final List rules = Arrays.asList( + rule(null, Arrays.asList(".java"), true, false), // skip all .java + rule("fallback", null, false, true)); - // act - final int indexed = indexer.indexSourceRoot(sourceRoot); + final AiIndexPlan plan = indexer(temp, temp.resolve("out"), Collections.emptyList(), 0L, 0L) + .classify(Arrays.asList(generated), rules); - // assert: only the big file (> 1000) was indexed - assertThat(indexed, is(equalTo(1))); - assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Big.java.ai.md")), is(true)); - assertThat(Files.exists(outputRoot.resolve("main/java/com/example/Small.java.ai.md")), is(false)); + assertThat(plan.skipped(), hasItem(generated)); + assertThat(plan.routedCount(), is(equalTo(0))); } @Test - public void indexSourceRoot_boundaryFile_minExclusiveMaxInclusive() throws Exception { - // arrange: a file of EXACTLY 1000 bytes. A band with max=1000 includes it (inclusive upper); - // a band with min=1000 excludes it (exclusive lower). This pins the boundary semantics that make - // band2.min == band1.max non-overlapping. + public void classify_noRuleAndNoFallback_recordsUnmatched() throws Exception { final Path temp = Files.createTempDirectory("ai-index-test"); - final Path sourceRoot = temp.resolve("src/main/java"); - Files.createDirectories(sourceRoot.resolve("com/example")); - writeSizedJava(sourceRoot.resolve("com/example/Edge.java"), 1000); + final Path foo = temp.resolve("src/main/java/com/example/Foo.java"); + writeJava(foo, "class Foo {}\n"); - final Path outMax = temp.resolve("out-max"); - final Path outMin = temp.resolve("out-min"); + final List rules = + Collections.singletonList(rule("sql", Arrays.asList(".sql"), false, false)); - // act - final int includedByMax = sizeBandIndexer(temp, outMax, 0L, 1000L).indexSourceRoot(sourceRoot); - final int includedByMin = sizeBandIndexer(temp, outMin, 1000L, 0L).indexSourceRoot(sourceRoot); + final AiIndexPlan plan = indexer(temp, temp.resolve("out"), Collections.emptyList(), 0L, 0L) + .classify(Arrays.asList(foo), rules); - // assert - assertThat(includedByMax, is(equalTo(1))); - assertThat(includedByMin, is(equalTo(0))); + assertThat(plan.unmatched(), hasItem(foo)); + assertThat(plan.routedCount(), is(equalTo(0))); } // - /** Writes a {@code .java} file padded with a line comment to exactly {@code totalBytes} bytes. */ - private static void writeSizedJava(final Path file, final int totalBytes) throws java.io.IOException { - final String prefix = "// "; - final StringBuilder sb = new StringBuilder(totalBytes); - sb.append(prefix); - while (sb.length() < totalBytes) { - sb.append('x'); - } - sb.setLength(totalBytes); - Files.write(file, sb.toString().getBytes(StandardCharsets.UTF_8)); - } - - private SourceFileIndexer sizeBandIndexer( - final Path baseDirectory, final Path outputRoot, final long minSizeBytes, final long maxSizeBytes) { - final AiPromptSupport promptSupport = new AiPromptSupport(CommonTestFixtures.createFilePromptDefinitions()); - return new SourceFileIndexer( - new SystemStreamLog(), - baseDirectory, - outputRoot, - Arrays.asList(".java"), - "1.0.0", - "0.0.0", - Collections.emptyList(), - Collections.emptyList(), - minSizeBytes, - maxSizeBytes, - false, - new MockAiGenerationProvider(), - CommonTestFixtures.createFileFieldGenerations(), - promptSupport, - CommonTestFixtures.createDefaultAiModelDefinitionSupport()); - } - - private static AiPromptDefinition promptDefinition(final String key) { - final AiPromptDefinition definition = new AiPromptDefinition(); - definition.setKey(key); - definition.setTemplate("Summarize.\nFile: %s\nSource:\n%s\n"); - return definition; - } + // + @Test + public void indexFile_writesAiMd_thenSkipsUnchanged() throws Exception { + final Path temp = Files.createTempDirectory("ai-index-test"); + final Path outputRoot = temp.resolve("src/site/ai"); + final Path foo = temp.resolve("src/main/java/com/example/Foo.java"); + writeJava(foo, "package com.example;\nclass Foo {}\n"); - private static AiFieldGenerationConfig fieldGeneration(final String promptKey, final List extensions) { - final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); - config.setPromptKey(promptKey); - config.setAiDefinitionKey(CommonTestFixtures.AI_DEFINITION_KEY_DEFAULT); - config.setFileExtensions(extensions); - return config; - } + final SourceFileIndexer indexer = indexer(temp, outputRoot, Collections.emptyList(), 0L, 0L); + final AiFieldGenerationConfig rule = + CommonTestFixtures.createFileFieldGenerations().get(0); + final AiFieldGenerationSupport support = mockSupport(); - /** Test provider that records the prompt key of each request so prompt selection can be asserted. */ - private static final class CapturingProvider implements AiGenerationProvider { - private final List promptKeys = new ArrayList<>(); + // first write + final boolean wrote = indexer.indexFile(foo, rule, support); + final Path aiFile = outputRoot.resolve("main/java/com/example/Foo.java.ai.md"); - @Override - public String generate(final AiGenerationRequest request) { - promptKeys.add(request.promptKey()); - return "body for " + request.promptKey(); - } + assertThat(wrote, is(true)); + assertThat(Files.exists(aiFile), is(true)); + final AiMdDocument document = documentCodec.read(aiFile); + assertThat(document, is(notNullValue())); + assertThat(document.header().title(), is(equalTo("Foo.java"))); + assertThat(document.body().trim().isEmpty(), is(false)); - List promptKeys() { - return promptKeys; - } + // second write — unchanged source, so it is skipped + final boolean wroteAgain = indexer.indexFile(foo, rule, support); + assertThat(wroteAgain, is(false)); } + // } From d9ddec3dcff253c031f415f7b0cee180b6842ba2 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sun, 28 Jun 2026 23:42:29 +0200 Subject: [PATCH 44/68] docs(CLAUDE): document rule-based file routing, plan tree, planOnly Describe the plan-then-execute generate flow, the routing rules (extension/size/lines filters + priority + route/skip/explicit-fallback), the per-model-group execution (one model load per aiDefinitionKey), the planOnly preview, and the new AiFieldGenerationSelector/AiIndexPlan components. Add planOnly to the GenerateMojo parameter table. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- CLAUDE.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 9bc27e3..10fc0ea 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -126,6 +126,17 @@ The plugin operates in three logical phases, building a navigable index from fin ``` [Source .java files] → SourceFileIndexer → [*.java.ai.md files (deterministic header + AI body)] ``` +The `generate` goal is **plan-then-execute** and **rule-routed**: it first walks all candidate files, +routes each via the `` rules to a `(model, prompt)` — or a *skip*, or the explicit +*fallback* — and logs a tree grouped by model (which file gets which model + prompt). It then loads +**each model once** (groups sharing an `aiDefinitionKey`, sequentially → one model resident at a time, +bounded RAM) and indexes that group's files. A rule matches by `fileExtensions` + `minFileSizeBytes`/ +`maxFileSizeBytes` + `minLines`/`maxLines`; among matches the highest `priority` wins (ties by +declaration order). `true` ignores matching files (a high-priority skip beats routes and +the fallback); exactly one `true` catches the rest; a file matching no rule and no +fallback **fails the build**. `aiIndex.planOnly=true` prints the plan and stops (no model loaded). See +`AiFieldGenerationSelector` (selection + validation) and `AiIndexPlan` (the tree). This is how one run +can index different file kinds/sizes with different models *and* prompts. **Phase 2 — Package Aggregation & Summarization** ``` @@ -163,7 +174,9 @@ the top of `execute()`. Covered by `MojoPhaseSkipTest`. | `GenerateMojo` | Phase 1: index + summarize source files | | `AggregatePackagesMojo` | Phase 2: aggregate + summarize package index files | | `AggregateProjectMojo` | Phase 3: build the single `project.ai.md` (deterministic listing; extends `AbstractAiIndexMojo` and builds a provider **only** when a `` opts into the AI overview) | -| `SourceFileIndexer` | Walks source trees, creates `.ai.md` files, calls AI to fill the document body | +| `SourceFileIndexer` | `collectCandidates` (walk + filters) / `classify` (→ `AiIndexPlan`) / `indexFile` (write one file with a given rule + provider) — split so a run plans first and loads one model per group | +| `AiFieldGenerationSelector` | Routes a file to a rule by extension/size/lines + priority; explicit fallback; `skip`; plus `validate(rules)` (fail-fast config check) | +| `AiIndexPlan` | The routing plan: routes grouped by model id, skips, unmatched; renders the up-front tree | | `PackageIndexer` | Creates `package.ai.md` files with contents listings, calls AI to fill the document body | | `ProjectIndexer` | Phase 3: harvests each package's lead + relative link into one `project.ai.md`; deterministic listing, with an optional one-call AI `#### Overview` from the leads | | `AiMdLeadExtractor` | Pure extraction of the one-line blockquote lead from an `.ai.md` body (fallback: first non-blank line) | @@ -255,6 +268,7 @@ header block, so a `- F:` line in the body is never read as a link. | `excludes` | `aiIndex.excludes` | *(none)* | Glob patterns (base-relative, `/` separators) for source files to skip, e.g. `**/package-info.java`, `**/generated/**` (`AiSourceExcludeFilter`) | | `minFileSizeBytes` | `aiIndex.file.minSizeBytes` | `0` | Exclusive lower size bound; files `<=` this are skipped (`0` = no lower bound). For size-tiering across multiple `generate` executions | | `maxFileSizeBytes` | `aiIndex.file.maxSizeBytes` | `0` | Inclusive upper size bound; files `>` this are skipped (`0` = unlimited). Pairs with `minFileSizeBytes` to form a band | +| `planOnly` | `aiIndex.planOnly` | `false` | Print the routing plan tree (model → files → prompt) and stop; no model loaded, nothing generated | | `generationProvider` | `aiIndex.generationProvider` | `mock` | `mock` or `llamacpp-jni` | | `llamaModelPath` | `aiIndex.llama.modelPath` | — | Path to GGUF model file | | `llamaContextSize` | `aiIndex.llama.contextSize` | `2048` | Context window size | @@ -370,7 +384,7 @@ See [`../workspace/workflows/pull-request-workflow.md`](../workspace/workflows/p 3. **Incremental updates** — files with existing summaries are skipped unless `force=true`; checksums detect source changes. 4. **Unified indexing and summarization** — each indexer (`SourceFileIndexer`, `PackageIndexer`) both creates the `.ai.md` skeleton and fills in AI fields in a single pass; no separate summarization step is needed. 5. **Provider abstraction** — AI backends are pluggable through `AiGenerationProvider`; mock provider enables fully deterministic tests. -6. **Configuration-driven prompts** — prompt templates are defined in POM configuration, not hardcoded in Java; changing a prompt requires no code change. For the `generate` goal the per-file prompt is chosen by source extension (`AiFieldGenerationSelector`): each `` may carry an optional `` filter (e.g. `.java`/`.sql`), and an entry without one is the fallback — so a Java prompt, a SQL-schema prompt, and a generic fallback can coexist while one model stays loaded. +6. **Configuration-driven prompts & rule-based routing** — prompt templates are defined in POM configuration, not hardcoded in Java; changing a prompt requires no code change. For the `generate` goal each `` is a routing **rule** (`AiFieldGenerationSelector`): filters `` + ``/`` + ``/``, a `` (highest matching wins, ties by order), and a kind — route (``+``), `true` (ignore), or exactly one explicit `true`. So one run can route different file kinds/sizes to different models **and** prompts; the model id (`aiDefinitionKey`) carries the full parameter set (path, context, sampling…), and the run loads each model once. A file matching no rule and no fallback fails the build; `aiIndex.planOnly=true` previews the plan tree without loading a model. Prompts live once in a shared plugin-level `` and are referenced by id across all rules/executions (no duplication). ## Javadoc Conventions From fbfa98ee0df162cbc6711d0aae00a5fe8aa592d7 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Sun, 28 Jun 2026 23:53:42 +0200 Subject: [PATCH 45/68] feat: plan as Markdown with per-file time estimate, per-model + grand total The plan tree is now a Markdown document (one log line, copy-pasteable): a summary with the grand-total estimate, then per model a heading + a | File | Prompt | Est. | table and a per-model time subtotal, then skipped/unmatched lists. Each routed file carries a rough estimated generation time (AiGenerationTimeEstimator over the file size; not precise by design); times are summed per model and overall. AiIndexPlan.Entry gains estimatedSeconds; addRoute takes it; renderTree -> renderMarkdown; SourceFileIndexer.classify computes the estimate per file. ASCII markers for CI-log safety. 243 tests; PIT 339/339 (100%). planOnly verified: "Total: 12 files, est. ~31 min" + per-file rows. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- .../llamacpp/aiindex/indexer/AiIndexPlan.java | 119 +++++++++++++----- .../aiindex/indexer/SourceFileIndexer.java | 6 +- .../llamacpp/aiindex/mojo/GenerateMojo.java | 2 +- .../aiindex/indexer/AiIndexPlanTest.java | 67 ++++++++++ 4 files changed, 162 insertions(+), 32 deletions(-) create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java index 6917ceb..43f01dd 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java @@ -9,32 +9,36 @@ import java.util.List; import java.util.Map; import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig; +import net.ladenthin.maven.llamacpp.aiindex.support.AiGenerationTimeEstimator; /** * The routing plan for one {@code generate} run: which files each AI model will index (with which * prompt), which files are skipped, and which matched no rule. * *

Built in a planning pass before any inference so the user sees the full mapping up front - * (see {@link #renderTree}) and a misconfiguration fails fast. Routed files are grouped by + * (see {@link #renderMarkdown}) and a misconfiguration fails fast. Routed files are grouped by * {@code aiDefinitionKey} (the model id, which carries the full parameter set) so the executor can load * each model exactly once.

*/ public final class AiIndexPlan { - /** A single planned file together with the rule that routed it. */ + /** A single planned file together with the rule that routed it and its rough time estimate. */ public static final class Entry { private final Path file; private final AiFieldGenerationConfig rule; + private final long estimatedSeconds; /** * Creates a plan entry. * - * @param file the source file - * @param rule the rule that selected it + * @param file the source file + * @param rule the rule that selected it + * @param estimatedSeconds the rough estimated generation time in seconds */ - public Entry(final Path file, final AiFieldGenerationConfig rule) { + public Entry(final Path file, final AiFieldGenerationConfig rule, final long estimatedSeconds) { this.file = file; this.rule = rule; + this.estimatedSeconds = estimatedSeconds; } /** @@ -54,6 +58,15 @@ public Path file() { public AiFieldGenerationConfig rule() { return rule; } + + /** + * Returns the rough estimated generation time in seconds. + * + * @return the estimated seconds + */ + public long estimatedSeconds() { + return estimatedSeconds; + } } private final Map> routesByModel = new LinkedHashMap<>(); @@ -68,12 +81,19 @@ public AiIndexPlan() { /** * Records a routed file under its model id. * - * @param aiDefinitionKey the model id (rule's {@code aiDefinitionKey}) - * @param file the source file - * @param rule the routing rule + * @param aiDefinitionKey the model id (rule's {@code aiDefinitionKey}) + * @param file the source file + * @param rule the routing rule + * @param estimatedSeconds the rough estimated generation time in seconds */ - public void addRoute(final String aiDefinitionKey, final Path file, final AiFieldGenerationConfig rule) { - routesByModel.computeIfAbsent(aiDefinitionKey, key -> new ArrayList<>()).add(new Entry(file, rule)); + public void addRoute( + final String aiDefinitionKey, + final Path file, + final AiFieldGenerationConfig rule, + final long estimatedSeconds) { + routesByModel + .computeIfAbsent(aiDefinitionKey, key -> new ArrayList<>()) + .add(new Entry(file, rule, estimatedSeconds)); } /** @@ -135,48 +155,87 @@ public int routedCount() { } /** - * Renders a human-readable tree of the plan: each model id, the files it will index and their - * prompt ids, then the skipped and unmatched files. Paths are shown relative to {@code baseDir}. + * Returns the summed estimated seconds for one model's entries. + * + * @param entries the model's planned entries + * @return the total estimated seconds + */ + private long modelSeconds(final List entries) { + long total = 0; + for (final Entry entry : entries) { + total += entry.estimatedSeconds(); + } + return total; + } + + /** + * Returns the grand total of estimated seconds across all routed files. + * + * @return the total estimated seconds + */ + public long totalEstimatedSeconds() { + long total = 0; + for (final List entries : routesByModel.values()) { + total += modelSeconds(entries); + } + return total; + } + + /** + * Renders the plan as a Markdown document for the build log: a summary, one section + table per + * model (file → prompt → rough time estimate) with a per-model subtotal, a grand total, and the + * skipped / unmatched lists. Markdown so it can be copied straight out of the console. Paths are + * relative to {@code baseDir}; the time column is a rough estimate (see {@code AiGenerationTimeEstimator}). * * @param baseDir directory to relativize file paths against for readability - * @return the multi-line tree + * @return the Markdown document */ - public String renderTree(final Path baseDir) { + public String renderMarkdown(final Path baseDir) { + final AiGenerationTimeEstimator estimator = new AiGenerationTimeEstimator(); final StringBuilder sb = new StringBuilder(); - sb.append("AI index plan: ") + sb.append("## AI index plan\n\n"); + sb.append("**Total:** ") .append(routedCount()) .append(" file(s) across ") .append(routesByModel.size()) - .append(" model(s), ") + .append(" model(s), est. ") + .append(estimator.formatDuration(totalEstimatedSeconds())) + .append(" - ") .append(skipped.size()) .append(" skipped, ") .append(unmatched.size()) - .append(" unmatched"); + .append(" unmatched _(time is a rough estimate)_\n"); for (final Map.Entry> group : routesByModel.entrySet()) { - sb.append("\n model ") + final List entries = group.getValue(); + sb.append("\n### Model `") .append(group.getKey()) - .append(" (") - .append(group.getValue().size()) - .append("):"); - for (final Entry entry : group.getValue()) { - sb.append("\n - ") + .append("` - ") + .append(entries.size()) + .append(" file(s), est. ") + .append(estimator.formatDuration(modelSeconds(entries))) + .append("\n\n| File | Prompt | Est. |\n|---|---|---|\n"); + for (final Entry entry : entries) { + sb.append("| ") .append(relativize(baseDir, entry.file())) - .append(" : prompt ") - .append(entry.rule().getPromptKey()); + .append(" | ") + .append(entry.rule().getPromptKey()) + .append(" | ") + .append(estimator.formatDuration(entry.estimatedSeconds())) + .append(" |\n"); } } if (!skipped.isEmpty()) { - sb.append("\n skipped (").append(skipped.size()).append("):"); + sb.append("\n### Skipped (").append(skipped.size()).append(")\n\n"); for (final Path file : skipped) { - sb.append("\n - ").append(relativize(baseDir, file)); + sb.append("- ").append(relativize(baseDir, file)).append("\n"); } } if (!unmatched.isEmpty()) { - sb.append("\n UNMATCHED - no rule and no fallback (") + sb.append("\n### (!) Unmatched - no rule and no fallback (") .append(unmatched.size()) - .append("):"); + .append(")\n\n"); for (final Path file : unmatched) { - sb.append("\n ! ").append(relativize(baseDir, file)); + sb.append("- ").append(relativize(baseDir, file)).append("\n"); } } return sb.toString(); diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java index dd6d57e..148431f 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java @@ -21,6 +21,7 @@ import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderSupport; import net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport; +import net.ladenthin.maven.llamacpp.aiindex.support.AiGenerationTimeEstimator; import net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport; import net.ladenthin.maven.llamacpp.aiindex.support.AiSourceExcludeFilter; import net.ladenthin.maven.llamacpp.aiindex.support.AiTimeSupport; @@ -78,6 +79,7 @@ public class SourceFileIndexer { private final AiMdDocumentCodec documentCodec = new AiMdDocumentCodec(); private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); private final AiFieldGenerationSelector fieldGenerationSelector = new AiFieldGenerationSelector(); + private final AiGenerationTimeEstimator timeEstimator = new AiGenerationTimeEstimator(); /** * Creates a new {@link SourceFileIndexer}. The AI provider and rules are supplied later @@ -185,7 +187,9 @@ public AiIndexPlan classify(final Collection candidates, final List +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.indexer; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.nio.file.Path; +import java.nio.file.Paths; +import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig; +import org.junit.jupiter.api.Test; + +public class AiIndexPlanTest { + + private static AiFieldGenerationConfig rule(final String promptKey) { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + config.setPromptKey(promptKey); + return config; + } + + @Test + public void routedCountAndPerModelGrouping() { + final AiIndexPlan plan = new AiIndexPlan(); + plan.addRoute("modelA", Paths.get("a/Foo.java"), rule("p1"), 60); + plan.addRoute("modelA", Paths.get("a/Bar.java"), rule("p1"), 120); + plan.addRoute("modelB", Paths.get("b/Baz.java"), rule("p2"), 30); + + assertThat(plan.routedCount(), is(equalTo(3))); + assertThat(plan.routesByModel().get("modelA").size(), is(equalTo(2))); + assertThat(plan.routesByModel().get("modelB").size(), is(equalTo(1))); + } + + @Test + public void totalEstimatedSecondsSumsAllEntries() { + final AiIndexPlan plan = new AiIndexPlan(); + plan.addRoute("modelA", Paths.get("a/Foo.java"), rule("p1"), 60); + plan.addRoute("modelA", Paths.get("a/Bar.java"), rule("p1"), 120); + plan.addRoute("modelB", Paths.get("b/Baz.java"), rule("p2"), 30); + + assertThat(plan.totalEstimatedSeconds(), is(equalTo(210L))); + } + + @Test + public void renderMarkdown_containsModelSectionsFilesAndTotals() { + final Path base = Paths.get(""); + final AiIndexPlan plan = new AiIndexPlan(); + plan.addRoute("modelA", Paths.get("Foo.java"), rule("file-body-java"), 60); + plan.addSkipped(Paths.get("Generated.java")); + plan.addUnmatched(Paths.get("weird.txt")); + + final String md = plan.renderMarkdown(base); + + assertThat(md, containsString("## AI index plan")); + assertThat(md, containsString("**Total:**")); + assertThat(md, containsString("### Model `modelA`")); + assertThat(md, containsString("| File | Prompt | Est. |")); + assertThat(md, containsString("Foo.java")); + assertThat(md, containsString("file-body-java")); + assertThat(md, containsString("Skipped (1)")); + assertThat(md, containsString("Generated.java")); + assertThat(md, containsString("Unmatched")); + assertThat(md, containsString("weird.txt")); + } +} From decd7b61687cc7c8f3296de75768a03c5b974c56 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 07:47:40 +0200 Subject: [PATCH 46/68] feat: rule id (label) shown in the plan markdown Rule column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an optional to each routing rule (e.g. java, sql, fallback, skip-generated). The plan markdown table now has a Rule column (| File | Rule | Prompt | Est. |) so you can see WHICH rule routed each file, not just the prompt — useful when several rules share a prompt but differ by filter/model/priority. Unset id renders as "-". The id also surfaces in AiFieldGenerationSelector.validate error messages (config @ToString). The pom's generate rules are labelled java/sql/fallback as an example. 244 tests; PIT 340/340 (100%). planOnly verified: Rule column shows "java". Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 3 +++ .../config/AiFieldGenerationConfig.java | 26 +++++++++++++++++++ .../llamacpp/aiindex/indexer/AiIndexPlan.java | 14 +++++++++- .../config/AiFieldGenerationConfigTest.java | 8 ++++++ .../aiindex/indexer/AiIndexPlanTest.java | 12 +++++++-- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 0003e0d..886170d 100644 --- a/pom.xml +++ b/pom.xml @@ -1907,6 +1907,7 @@ message: the path on the first line, then a blank line, then the summaries to sy
+ java file-body-java gpt-oss-20B-c96k @@ -1914,6 +1915,7 @@ message: the path on the first line, then a blank line, then the summaries to sy + sql file-body-sql gpt-oss-20B-c96k @@ -1924,6 +1926,7 @@ message: the path on the first line, then a blank line, then the summaries to sy Exactly one fallback is allowed; without it an unmatched file fails the build (see AiFieldGenerationSelector). --> + fallback file-body-fallback gpt-oss-20B-c96k true diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java index 4e98eab..2167301 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfig.java @@ -44,6 +44,14 @@ public AiFieldGenerationConfig() { // no-op } + /** + * Optional human-readable id for this routing rule (e.g. {@code java-small}, {@code skip-generated}). + * Purely a label: it is shown in the plan tree so you can see which rule routed each file + * (handy when several rules share a prompt), and it appears in validation error messages. {@code null} + * when not set. + */ + private String id; + private String promptKey; /** @@ -131,6 +139,24 @@ public AiFieldGenerationConfig() { */ private boolean skip; + /** + * Returns the optional rule id (label), or {@code null} when not set. + * + * @return the rule id, or {@code null} + */ + public String getId() { + return id; + } + + /** + * Sets the optional rule id (label). + * + * @param id the rule id + */ + public void setId(final String id) { + this.id = id; + } + /** * Returns the prompt template key. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java index 43f01dd..fc7dadb 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java @@ -213,11 +213,13 @@ public String renderMarkdown(final Path baseDir) { .append(entries.size()) .append(" file(s), est. ") .append(estimator.formatDuration(modelSeconds(entries))) - .append("\n\n| File | Prompt | Est. |\n|---|---|---|\n"); + .append("\n\n| File | Rule | Prompt | Est. |\n|---|---|---|---|\n"); for (final Entry entry : entries) { sb.append("| ") .append(relativize(baseDir, entry.file())) .append(" | ") + .append(ruleId(entry.rule())) + .append(" | ") .append(entry.rule().getPromptKey()) .append(" | ") .append(estimator.formatDuration(entry.estimatedSeconds())) @@ -241,6 +243,16 @@ public String renderMarkdown(final Path baseDir) { return sb.toString(); } + /** + * Returns the rule's id for display, or {@code "-"} when the rule has no id set. + * + * @param rule the routing rule + * @return the rule id, or {@code "-"} + */ + private String ruleId(final AiFieldGenerationConfig rule) { + return rule.getId() != null ? rule.getId() : "-"; + } + /** * Relativizes {@code file} against {@code baseDir} with {@code /} separators, falling back to the * absolute path when relativization is not possible. diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java index b479281..4b34e2d 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFieldGenerationConfigTest.java @@ -91,6 +91,14 @@ public void maxLines_defaultsZeroAndRoundTrips() { assertThat(config.getMaxLines(), is(equalTo(500))); } + @Test + public void id_defaultsNullAndRoundTrips() { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + assertThat(config.getId(), is(nullValue())); + config.setId("java-small"); + assertThat(config.getId(), is(equalTo("java-small"))); + } + @Test public void priority_defaultsZeroAndRoundTrips() { final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java index 24ea328..6ca0eec 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java @@ -21,6 +21,13 @@ private static AiFieldGenerationConfig rule(final String promptKey) { return config; } + private static AiFieldGenerationConfig rule(final String id, final String promptKey) { + final AiFieldGenerationConfig config = new AiFieldGenerationConfig(); + config.setId(id); + config.setPromptKey(promptKey); + return config; + } + @Test public void routedCountAndPerModelGrouping() { final AiIndexPlan plan = new AiIndexPlan(); @@ -47,7 +54,7 @@ public void totalEstimatedSecondsSumsAllEntries() { public void renderMarkdown_containsModelSectionsFilesAndTotals() { final Path base = Paths.get(""); final AiIndexPlan plan = new AiIndexPlan(); - plan.addRoute("modelA", Paths.get("Foo.java"), rule("file-body-java"), 60); + plan.addRoute("modelA", Paths.get("Foo.java"), rule("java-small", "file-body-java"), 60); plan.addSkipped(Paths.get("Generated.java")); plan.addUnmatched(Paths.get("weird.txt")); @@ -56,8 +63,9 @@ public void renderMarkdown_containsModelSectionsFilesAndTotals() { assertThat(md, containsString("## AI index plan")); assertThat(md, containsString("**Total:**")); assertThat(md, containsString("### Model `modelA`")); - assertThat(md, containsString("| File | Prompt | Est. |")); + assertThat(md, containsString("| File | Rule | Prompt | Est. |")); assertThat(md, containsString("Foo.java")); + assertThat(md, containsString("java-small")); // the rule id shows in its own column assertThat(md, containsString("file-body-java")); assertThat(md, containsString("Skipped (1)")); assertThat(md, containsString("Generated.java")); From 2e2a5dac03d798f97afc48c1b5f47e9af1b0385f Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 09:11:01 +0200 Subject: [PATCH 47/68] feat: general-purpose condition tree for routing rules (and/or/not + leaves) Replace the flat per-rule filters (fileExtensions/min-max size/min-max lines) with a composable tree, evaluated against a file's facts. Not backward compatible by design. Each node sets exactly one of: combinators //, or leaves , (AiRangeCondition min/max, bytes), (AiRangeCondition), / (ISO-8601 instant vs file mtime), (base-relative glob, reusing AiSourceExcludeFilter). Nesting is native Maven binding (named fields, no implementation= attributes); new leaf kinds = one field + one evaluator branch. New gated config classes: AiCondition (recursive POJO), AiRangeCondition, AiFileContext (the evaluated facts), AiConditionEvaluator (matches/validate/ usesLines). AiFieldGenerationConfig now carries a ; the selector takes an AiFileContext and validates that non-fallback rules have a (valid) condition, the fallback has none, etc. SourceFileIndexer.classify builds the context (line count read lazily only when a lines leaf is present). pom example rules migrated to . ProjectIndexer.copyFieldGeneration drops the removed field. 273 tests; PIT 421/421 (100%, new classes added to the gate). planOnly verified: .java routed via condition, 0 unmatched. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- pom.xml | 16 +- .../llamacpp/aiindex/config/AiCondition.java | 211 +++++++++++++++ .../aiindex/config/AiConditionEvaluator.java | 248 +++++++++++++++++ .../config/AiFieldGenerationConfig.java | 224 +++------------ .../config/AiFieldGenerationSelector.java | 148 +++------- .../aiindex/config/AiFileContext.java | 88 ++++++ .../aiindex/config/AiRangeCondition.java | 88 ++++++ .../aiindex/indexer/ProjectIndexer.java | 3 +- .../aiindex/indexer/SourceFileIndexer.java | 24 +- .../config/AiConditionEvaluatorTest.java | 256 ++++++++++++++++++ .../aiindex/config/AiConditionTest.java | 86 ++++++ .../config/AiFieldGenerationConfigTest.java | 120 +++----- .../config/AiFieldGenerationSelectorTest.java | 203 +++++--------- .../aiindex/config/AiFileContextTest.java | 23 ++ .../aiindex/config/AiRangeConditionTest.java | 69 +++++ .../indexer/SourceFileIndexerTest.java | 8 +- 16 files changed, 1288 insertions(+), 527 deletions(-) create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiCondition.java create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluator.java create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFileContext.java create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiRangeCondition.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluatorTest.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionTest.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiFileContextTest.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiRangeConditionTest.java diff --git a/pom.xml b/pom.xml index 886170d..cd71a71 100644 --- a/pom.xml +++ b/pom.xml @@ -706,9 +706,13 @@ SPDX-License-Identifier: Apache-2.0 + net.ladenthin.maven.llamacpp.aiindex.config.AiCondition + net.ladenthin.maven.llamacpp.aiindex.config.AiConditionEvaluator net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationSelector + net.ladenthin.maven.llamacpp.aiindex.config.AiFileContext net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig + net.ladenthin.maven.llamacpp.aiindex.config.AiRangeCondition net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest @@ -1910,17 +1914,17 @@ message: the path on the first line, then a blank line, then the summaries to sy java file-body-java gpt-oss-20B-c96k - - .java - + + .java + sql file-body-sql gpt-oss-20B-c96k - - .sql - + + .sql + + + java file-body-java coder - - .java - + + .java + + fallback + true file-body-fallback coder @@ -285,6 +295,54 @@ Index file: %s ``` + +### Routing rules (conditions, priority, skip, plan) +Within one `generate` run you can route files to different models **and** prompts by size, language, +age or path. Example — small/medium/large Java files to three context presets, skip generated sources, +and a fallback for everything else: + +```xml + + + skip-generatedtrue100 + **/generated/** + + + java-smallfile-body-java-tersegpt-oss-20B-c16k + + .java + 16384 + + + + java-midfile-body-javagpt-oss-20B-c48k + + .java + 1638449152 + + + + java-largefile-body-java-detailedgpt-oss-20B-c96k + + .java + 49152 + + + + fallbacktrue + file-body-fallbackgpt-oss-20B-c96k + + +``` + +Notes: size bounds are **min-exclusive / max-inclusive** so `band2.min == band1.max` is non-overlapping; +`` works the same way; `2026-01-01T00:00:00Z` only (re)indexes +recently changed files. Preview the mapping without running a model: + +``` +mvn ai-index:generate -DaiIndex.planOnly=true +``` + ## Usage Run AI index generation: ``` diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiCondition.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiCondition.java index 49b461c..7addf3b 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiCondition.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiCondition.java @@ -32,8 +32,8 @@ @ToString public class AiCondition { - private @Nullable List and; - private @Nullable List or; + private @Nullable AiConditionGroup and; + private @Nullable AiConditionGroup or; private @Nullable AiCondition not; private @Nullable List extensions; private @Nullable AiRangeCondition size; @@ -48,39 +48,39 @@ public AiCondition() { } /** - * Returns the AND children, or {@code null} when this is not an AND node. + * Returns the AND group, or {@code null} when this is not an AND node. * - * @return the AND children, or {@code null} + * @return the AND group, or {@code null} */ - public @Nullable List getAnd() { + public @Nullable AiConditionGroup getAnd() { return and; } /** - * Sets the AND children. + * Sets the AND group (all children must match). * - * @param and the AND children + * @param and the AND group */ - public void setAnd(final @Nullable Collection and) { - this.and = and != null ? new ArrayList<>(and) : null; + public void setAnd(final @Nullable AiConditionGroup and) { + this.and = and; } /** - * Returns the OR children, or {@code null} when this is not an OR node. + * Returns the OR group, or {@code null} when this is not an OR node. * - * @return the OR children, or {@code null} + * @return the OR group, or {@code null} */ - public @Nullable List getOr() { + public @Nullable AiConditionGroup getOr() { return or; } /** - * Sets the OR children. + * Sets the OR group (any child may match). * - * @param or the OR children + * @param or the OR group */ - public void setOr(final @Nullable Collection or) { - this.or = or != null ? new ArrayList<>(or) : null; + public void setOr(final @Nullable AiConditionGroup or) { + this.or = or; } /** diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluator.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluator.java index dd7ad3a..c9ba67d 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluator.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluator.java @@ -39,20 +39,26 @@ public AiConditionEvaluator() { * @return {@code true} if the file matches */ public boolean matches(final AiCondition condition, final AiFileContext context) { - final List and = condition.getAnd(); + final AiConditionGroup and = condition.getAnd(); if (and != null) { - for (final AiCondition child : and) { - if (!matches(child, context)) { - return false; + final List children = and.getConditions(); + if (children != null) { + for (final AiCondition child : children) { + if (!matches(child, context)) { + return false; + } } } return true; } - final List or = condition.getOr(); + final AiConditionGroup or = condition.getOr(); if (or != null) { - for (final AiCondition child : or) { - if (matches(child, context)) { - return true; + final List children = or.getConditions(); + if (children != null) { + for (final AiCondition child : children) { + if (matches(child, context)) { + return true; + } } } return false; @@ -98,8 +104,8 @@ public void validate(final AiCondition condition) { if (branchCount(condition) != 1) { throw new IllegalArgumentException(ERROR_ONE_BRANCH + condition); } - final List and = condition.getAnd(); - final List or = condition.getOr(); + final AiConditionGroup and = condition.getAnd(); + final AiConditionGroup or = condition.getOr(); final AiCondition not = condition.getNot(); final List extensions = condition.getExtensions(); final AiRangeCondition size = condition.getSize(); @@ -108,19 +114,9 @@ public void validate(final AiCondition condition) { final String modifiedBefore = condition.getModifiedBefore(); final String pathGlob = condition.getPathGlob(); if (and != null) { - if (and.isEmpty()) { - throw new IllegalArgumentException("an condition must have at least one child"); - } - for (final AiCondition child : and) { - validate(child); - } + validateGroup(and, ""); } else if (or != null) { - if (or.isEmpty()) { - throw new IllegalArgumentException("an condition must have at least one child"); - } - for (final AiCondition child : or) { - validate(child); - } + validateGroup(or, ""); } else if (not != null) { validate(not); } else if (extensions != null) { @@ -155,13 +151,13 @@ public boolean usesLines(final AiCondition condition) { if (condition.getLines() != null) { return true; } - final List and = condition.getAnd(); + final AiConditionGroup and = condition.getAnd(); if (and != null) { - return anyUsesLines(and); + return anyUsesLines(and.getConditions()); } - final List or = condition.getOr(); + final AiConditionGroup or = condition.getOr(); if (or != null) { - return anyUsesLines(or); + return anyUsesLines(or.getConditions()); } final AiCondition not = condition.getNot(); if (not != null) { @@ -170,7 +166,10 @@ public boolean usesLines(final AiCondition condition) { return false; } - private boolean anyUsesLines(final List children) { + private boolean anyUsesLines(final @Nullable List children) { + if (children == null) { + return false; + } for (final AiCondition child : children) { if (usesLines(child)) { return true; @@ -179,6 +178,23 @@ private boolean anyUsesLines(final List children) { return false; } + /** + * Validates an {@code }/{@code } group: it must hold at least one child, and each child is + * validated recursively. + * + * @param group the combinator group + * @param label the element label for error messages + */ + private void validateGroup(final AiConditionGroup group, final String label) { + final List children = group.getConditions(); + if (children == null || children.isEmpty()) { + throw new IllegalArgumentException("an " + label + " condition must have at least one child"); + } + for (final AiCondition child : children) { + validate(child); + } + } + /** * Returns how many branch/leaf fields the node sets (must be exactly one). * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionGroup.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionGroup.java new file mode 100644 index 0000000..2bf337b --- /dev/null +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionGroup.java @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.config; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import lombok.ToString; +import org.jspecify.annotations.Nullable; + +/** + * A list of child {@link AiCondition}s, used as the body of an {@code } / {@code } combinator + * in {@link AiCondition}. + * + *

The list field is named {@code conditions} so the Maven plugin framework binds the items as + * {@code } — Maven derives a collection's item element + * name from the field name's singular, which is why the combinators wrap their children in this group + * rather than holding a {@code List} directly (a field named {@code and}/{@code or} would + * require the items to be {@code }/{@code }).

+ */ +@ToString +@SuppressWarnings({"NullAway.Init", "initialization.fields.uninitialized"}) +public class AiConditionGroup { + + private @Nullable List conditions; + + /** Creates a new {@link AiConditionGroup}. */ + public AiConditionGroup() { + // no-op + } + + /** + * Returns the child conditions, or {@code null} when none were configured. + * + * @return the child conditions, or {@code null} + */ + public @Nullable List getConditions() { + return conditions; + } + + /** + * Sets the child conditions (defensively copied). + * + * @param conditions the child conditions + */ + public void setConditions(final @Nullable Collection conditions) { + this.conditions = conditions != null ? new ArrayList<>(conditions) : null; + } +} diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluatorTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluatorTest.java index a1453a2..c94ab88 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluatorTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionEvaluatorTest.java @@ -48,15 +48,21 @@ private static AiCondition lines(final long min, final long max) { return c; } + private static AiConditionGroup group(final AiCondition... kids) { + final AiConditionGroup g = new AiConditionGroup(); + g.setConditions(Arrays.asList(kids)); + return g; + } + private static AiCondition and(final AiCondition... kids) { final AiCondition c = new AiCondition(); - c.setAnd(Arrays.asList(kids)); + c.setAnd(group(kids)); return c; } private static AiCondition or(final AiCondition... kids) { final AiCondition c = new AiCondition(); - c.setOr(Arrays.asList(kids)); + c.setOr(group(kids)); return c; } @@ -144,6 +150,20 @@ public void matches_nested() { assertThat(evaluator.matches(nested, ctx("X.java", "src/generated/X.java", 500L, 0, 0L)), is(false)); } + @Test + public void matches_groupWithNullConditions_isVacuous() { + // a group whose list is null: AND is vacuously true, OR vacuously false + final AiCondition andNull = new AiCondition(); + andNull.setAnd(new AiConditionGroup()); + assertThat(evaluator.matches(andNull, javaCtx()), is(true)); + final AiCondition orNull = new AiCondition(); + orNull.setOr(new AiConditionGroup()); + assertThat(evaluator.matches(orNull, javaCtx()), is(false)); + // and usesLines tolerates a null-conditions group + assertThat(evaluator.usesLines(andNull), is(false)); + assertThat(evaluator.usesLines(orNull), is(false)); + } + @Test public void matches_emptyNode_throws() { assertThrows(IllegalStateException.class, () -> evaluator.matches(new AiCondition(), javaCtx())); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionGroupTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionGroupTest.java new file mode 100644 index 0000000..3e1ff0f --- /dev/null +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionGroupTest.java @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.config; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class AiConditionGroupTest { + + @Test + public void conditionsDefaultNull() { + assertThat(new AiConditionGroup().getConditions(), is(nullValue())); + } + + @Test + public void setConditionsRoundTrip() { + final AiConditionGroup g = new AiConditionGroup(); + g.setConditions(java.util.Arrays.asList(new AiCondition(), new AiCondition())); + assertThat(g.getConditions().size(), is(equalTo(2))); + } + + @Test + public void setConditionsDefensivelyCopied() { + final AiConditionGroup g = new AiConditionGroup(); + final List source = new ArrayList<>(); + source.add(new AiCondition()); + g.setConditions(source); + source.add(new AiCondition()); // mutating the source must not affect the stored value + assertThat(g.getConditions().size(), is(equalTo(1))); + } + + @Test + public void setConditionsNullClears() { + final AiConditionGroup g = new AiConditionGroup(); + g.setConditions(java.util.Arrays.asList(new AiCondition())); + g.setConditions(null); + assertThat(g.getConditions(), is(nullValue())); + } +} diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionTest.java index b7e40a7..9ece2e4 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiConditionTest.java @@ -10,7 +10,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import java.util.Arrays; -import java.util.Collections; import org.junit.jupiter.api.Test; public class AiConditionTest { @@ -33,10 +32,12 @@ public void allFieldsDefaultNull() { public void andOrNotRoundTrip() { final AiCondition leaf = new AiCondition(); final AiCondition c = new AiCondition(); - c.setAnd(Arrays.asList(leaf)); - assertThat(c.getAnd().size(), is(equalTo(1))); - c.setOr(Arrays.asList(leaf, leaf)); - assertThat(c.getOr().size(), is(equalTo(2))); + final AiConditionGroup g = new AiConditionGroup(); + g.setConditions(Arrays.asList(leaf)); + c.setAnd(g); + assertThat(c.getAnd().getConditions().size(), is(equalTo(1))); + c.setOr(g); + assertThat(c.getOr().getConditions().size(), is(equalTo(1))); c.setNot(leaf); assertThat(c.getNot(), is(leaf)); c.setAnd(null); @@ -78,9 +79,12 @@ public void stringLeavesRoundTrip() { } @Test - public void orDefensivelyCopiedFromArbitraryCollection() { + public void notRoundTripAndClear() { final AiCondition c = new AiCondition(); - c.setOr(Collections.singletonList(new AiCondition())); - assertThat(c.getOr().size(), is(equalTo(1))); + final AiCondition child = new AiCondition(); + c.setNot(child); + assertThat(c.getNot(), is(child)); + c.setNot(null); + assertThat(c.getNot(), is(nullValue())); } } From a6515f3a727382d4a407e8a2fbbbe3b951d882c9 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 09:56:31 +0200 Subject: [PATCH 51/68] docs(TODO): sync PIT count (426/100%) + record routing/condition + gpt-oss work Update the stale PIT note (was 24 classes/200 mutations) to the current 426/100% incl. the new condition config classes, and add a Done entry for the rule-based routing + general-purpose condition tree, per-file time log, and quant menu. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- TODO.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 6f3fdb0..2a523d1 100644 --- a/TODO.md +++ b/TODO.md @@ -15,7 +15,7 @@ cross-cutting initiative. - **SpotBugs `effort=Max` + `threshold=Low`** — ✅ **enforced at the gate** (`0bddf2a`). `pom.xml` `Max` + `Low`; `spotbugs:check` is part of `mvn verify` and fails on any unsuppressed finding. The full clearing chain is recorded in [`../workspace/crossrepostatus.md`](../workspace/crossrepostatus.md) under "SpotBugs Max+Low". `spotbugs-exclude.xml` carries narrow `` blocks with rationale: Lombok-USBR, HelpMojo auto-gen family, Maven `@Parameter` SPP, identity-IMC, prompt-template `FORMAT_STRING`, fb-contrib flow-coarseness sites, NPE→`MojoExecutionException` bridge. -- **Mutation-testing threshold enforcement (PIT)** — `pom.xml` wires `100`. The explicit `` list now covers **24 classes** (config / document / prompt / provider / support value + support classes; **200 mutations, all killed**). Latest additions landed with the three-level index work: `document.AiMdLeadExtractor` (project index), `config.AiFieldGenerationSelector` (extension-based prompt selection), and `support.AiSourceExcludeFilter` (exclude globs). Still open (optional): `document.AiMdDocumentCodec` / `AiMdHeaderCodec` / `prompt.AiPromptPreparationSupport` (need careful codec fixtures). The orchestration layers (`indexer.*`, `mojo.*`) and the JNI provider stay out of PIT — they need a Maven/native context rather than pure-unit mutation (see crossrepostatus "Deliberate non-parity"). +- **Mutation-testing threshold enforcement (PIT)** — `pom.xml` wires `100`. The explicit `` list covers the config / document / prompt / provider / support logic + value classes; **426 mutations, all killed (100%)**. The condition-routing work added `config.AiCondition`, `AiConditionGroup`, `AiConditionEvaluator`, `AiFileContext`, `AiRangeCondition` to the gate. Still open (optional): `document.AiMdDocumentCodec` / `AiMdHeaderCodec` / `prompt.AiPromptPreparationSupport` (need careful codec fixtures). The orchestration layers (`indexer.*`, `mojo.*`) and the JNI provider stay out of PIT — they need a Maven/native context rather than pure-unit mutation (see crossrepostatus "Deliberate non-parity"). - **Additional ArchUnit rules to consider** — the full **`layeredArchitecture()`** rule and **per-module banned-imports** (`jniConfinedToProvider`, `mavenMojoAnnotationsConfinedToMojo`, `foundationIsMavenFree`) are now DONE (see "Done" below). No further ArchUnit rules outstanding. @@ -25,6 +25,23 @@ cross-cutting initiative. ## Done (kept for history) +### Rule-based file routing + general-purpose condition tree + +- **Plan-then-execute `generate`** — walk candidates, route each via the rules, log a copy-pasteable + **Markdown plan** (model → file → rule id → prompt → rough time estimate, summed per model + overall), + then load **each model once** (grouped by `aiDefinitionKey`, one resident at a time). `aiIndex.planOnly` + previews without loading a model. Unmatched file (no rule, no fallback) **fails the build**. See + `AiIndexPlan`, `SourceFileIndexer` (`collectCandidates`/`classify`/`indexFile`), `GenerateMojo`. +- **Routing rules** (`AiFieldGenerationConfig` + `AiFieldGenerationSelector`) — ``, `` + (highest matching wins, ties by order), route / `` / single explicit ``, and a + composable **`` tree** (`AiCondition`/`AiConditionGroup`/`AiConditionEvaluator`): ``/ + `` (children in ``), ``, leaves ``/``/``/ + ``/``/``. Replaced the old flat per-rule filters + (not backward compatible). All new config classes at 100% PIT. +- **Per-file actual generation time** logged next to the estimate; **gpt-oss quant menu** in the pom + (mxfp4/Q4_K_M/Q5_K_M/Q8_0/F16 + E5 measurements). Findings: `docs/ai-index-benchmark/gpt-oss-tuning.md` + (E1–E6 + retry-removal + opt-in knobs) and `COMPARISON.md`. + ### Three-level hierarchical index + per-phase switches The project index (third level) and its surrounding navigation / prompt / scaling work: From 018856366305ef1093b69a1ccd415b62dbc6b4f8 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 12:32:44 +0200 Subject: [PATCH 52/68] feat: add gpuLayers (--gpu-layers) config knob, default -1 (leave build default) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per-model gpuLayers on the aiDefinition, plumbed through AiGenerationConfig / AiModelDefinition / AiModelDefinitionSupport / LlamaCppJniConfig (now 24 fields) / both buildLlamaCppJniConfig sites, applied in the provider's model() only when >= 0 (modelParameters.setGpuLayers). -1 (default) leaves the binding/native-build default so a CPU build stays CPU and a GPU build keeps its own default; 0 forces CPU even on a GPU build; >0 offloads that many layers — the control needed for partial offload when a model does not fit in VRAM (e.g. gpt-oss-20b on 8 GB). Only effective with a GPU native (cuda13/vulkan classifier). 280 tests; PIT 427/427 (100%). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- .../aiindex/config/AiGenerationConfig.java | 28 +++++++++++++++++++ .../aiindex/config/AiModelDefinition.java | 19 +++++++++++++ .../config/AiModelDefinitionSupport.java | 1 + .../aiindex/mojo/AbstractAiIndexMojo.java | 2 ++ .../LlamaCppJniAiGenerationProvider.java | 5 ++++ .../aiindex/provider/LlamaCppJniConfig.java | 15 +++++++++- .../config/AiGenerationConfigTest.java | 10 +++++++ .../config/AiModelDefinitionSupportTest.java | 3 ++ .../aiindex/config/AiModelDefinitionTest.java | 8 ++++++ .../AiGenerationProviderFactoryTest.java | 1 + .../LlamaCppJniAiGenerationProviderTest.java | 1 + 11 files changed, 92 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java index c56f57c..d58d62e 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java @@ -170,6 +170,15 @@ public AiGenerationConfig() { */ public static final int DEFAULT_CACHE_REUSE = 256; + /** + * Default number of model layers to offload to the GPU ({@code --gpu-layers}). {@code -1} (default) + * means "do not set it" — the binding/native build decides (a CPU build stays on CPU; a GPU build + * uses its own default). {@code 0} forces CPU even on a GPU build; a positive value offloads that + * many layers (use partial offload when the model does not fit in VRAM). Only effective with a GPU + * native (e.g. the {@code cuda13-windows-x86-64} / {@code vulkan-windows-x86-64} classifier). + */ + public static final int DEFAULT_GPU_LAYERS = -1; + /** * Default DRY (Don't Repeat Yourself) sampling multiplier ({@code --dry-multiplier}). * {@code 0.0} = disabled (llama.cpp default). A positive value penalises verbatim n-gram @@ -214,6 +223,7 @@ public AiGenerationConfig() { private boolean cachePrompt = DEFAULT_CACHE_PROMPT; private boolean swaFull = DEFAULT_SWA_FULL; private int cacheReuse = DEFAULT_CACHE_REUSE; + private int gpuLayers = DEFAULT_GPU_LAYERS; private String reasoningEffort = DEFAULT_REASONING_EFFORT; private int reasoningBudgetTokens = DEFAULT_REASONING_BUDGET_TOKENS; private float dryMultiplier = DEFAULT_DRY_MULTIPLIER; @@ -522,6 +532,24 @@ public void setCacheReuse(final int cacheReuse) { this.cacheReuse = cacheReuse; } + /** + * Returns the number of model layers to offload to the GPU ({@code --gpu-layers}). + * + * @return GPU layers ({@code -1} = leave the binding/build default) + */ + public int getGpuLayers() { + return gpuLayers; + } + + /** + * Sets the number of model layers to offload to the GPU ({@code --gpu-layers}). + * + * @param gpuLayers GPU layers ({@code -1} = leave default, {@code 0} = force CPU, {@code >0} = offload) + */ + public void setGpuLayers(final int gpuLayers) { + this.gpuLayers = gpuLayers; + } + /** * Sets whether llama.cpp prompt caching ({@code cache_prompt}) is enabled. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java index 8f2c42f..4be5e93 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java @@ -55,6 +55,7 @@ public AiModelDefinition() { private boolean cachePrompt = AiGenerationConfig.DEFAULT_CACHE_PROMPT; private boolean swaFull = AiGenerationConfig.DEFAULT_SWA_FULL; private int cacheReuse = AiGenerationConfig.DEFAULT_CACHE_REUSE; + private int gpuLayers = AiGenerationConfig.DEFAULT_GPU_LAYERS; private String reasoningEffort = AiGenerationConfig.DEFAULT_REASONING_EFFORT; private int reasoningBudgetTokens = AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS; private float dryMultiplier = AiGenerationConfig.DEFAULT_DRY_MULTIPLIER; @@ -383,6 +384,24 @@ public void setCacheReuse(final int cacheReuse) { this.cacheReuse = cacheReuse; } + /** + * Returns the GPU layer offload count ({@code --gpu-layers}) for this model. + * + * @return GPU layers; defaults to {@link AiGenerationConfig#DEFAULT_GPU_LAYERS} (-1 = leave default) + */ + public int getGpuLayers() { + return gpuLayers; + } + + /** + * Sets the GPU layer offload count ({@code --gpu-layers}) for this model. + * + * @param gpuLayers GPU layers ({@code -1} = leave default, {@code 0} = force CPU, {@code >0} = offload) + */ + public void setGpuLayers(final int gpuLayers) { + this.gpuLayers = gpuLayers; + } + /** * Returns the gpt-oss reasoning-effort level for this model. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java index 266cbef..e572d75 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java @@ -119,6 +119,7 @@ private static AiGenerationConfig toConfig(final AiModelDefinition definition) { config.setCachePrompt(definition.isCachePrompt()); config.setSwaFull(definition.isSwaFull()); config.setCacheReuse(definition.getCacheReuse()); + config.setGpuLayers(definition.getGpuLayers()); config.setReasoningEffort(definition.getReasoningEffort()); config.setReasoningBudgetTokens(definition.getReasoningBudgetTokens()); config.setDryMultiplier(definition.getDryMultiplier()); diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java index 694a103..6f70aae 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java @@ -251,6 +251,7 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig() throws MojoExecutionExcepti AiGenerationConfig.DEFAULT_CACHE_PROMPT, AiGenerationConfig.DEFAULT_SWA_FULL, AiGenerationConfig.DEFAULT_CACHE_REUSE, + AiGenerationConfig.DEFAULT_GPU_LAYERS, AiGenerationConfig.DEFAULT_REASONING_EFFORT, AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS, AiGenerationConfig.DEFAULT_DRY_MULTIPLIER, @@ -291,6 +292,7 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig(final String aiDefinitionKey) config.isCachePrompt(), config.isSwaFull(), config.getCacheReuse(), + config.getGpuLayers(), config.getReasoningEffort(), config.getReasoningBudgetTokens(), config.getDryMultiplier(), diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java index f482dd7..85c92eb 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java @@ -104,6 +104,11 @@ private LlamaModel model() { if (config.cacheReuse() > 0) { modelParameters.setCacheReuse(config.cacheReuse()); } + // Offload model layers to the GPU when explicitly configured (>= 0). -1 leaves the + // binding/native-build default (CPU build stays CPU; GPU build uses its own default). + if (config.gpuLayers() >= 0) { + modelParameters.setGpuLayers(config.gpuLayers()); + } current = new LlamaModel(modelParameters); model = current; } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java index 8311a60..ee4c9ef 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java @@ -15,7 +15,7 @@ * *

Record-shaped value type marked {@link net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord} for the future Java 17+ * migration. Accessors are record-style. {@code equals}, {@code hashCode} and - * {@code toString} are generated by Lombok over all twenty-three fields; full value semantics + * {@code toString} are generated by Lombok over all twenty-four fields; full value semantics * apply. Lombok emits the exact-bit float comparison * ({@code Float.floatToIntBits}) automatically.

*/ @@ -38,6 +38,7 @@ public final class LlamaCppJniConfig { private final boolean cachePrompt; private final boolean swaFull; private final int cacheReuse; + private final int gpuLayers; private final String reasoningEffort; private final int reasoningBudgetTokens; private final float dryMultiplier; @@ -65,6 +66,7 @@ public final class LlamaCppJniConfig { * @param cachePrompt whether llama.cpp prompt caching ({@code cache_prompt}) is enabled * @param swaFull whether to keep the full-size SWA KV cache ({@code --swa-full}) * @param cacheReuse KV prefix-reuse minimum chunk size ({@code --cache-reuse}); 0 = off + * @param gpuLayers GPU layers to offload ({@code --gpu-layers}); -1 = leave default * @param reasoningEffort gpt-oss reasoning-effort kwarg value ("low"/"medium"/"high"); empty omits it * @param reasoningBudgetTokens reasoning/think-token budget ({@code -1} = unrestricted) * @param dryMultiplier DRY sampling multiplier ({@code 0.0} = disabled) @@ -90,6 +92,7 @@ public LlamaCppJniConfig( boolean cachePrompt, boolean swaFull, int cacheReuse, + int gpuLayers, String reasoningEffort, int reasoningBudgetTokens, float dryMultiplier, @@ -114,6 +117,7 @@ public LlamaCppJniConfig( this.cachePrompt = cachePrompt; this.swaFull = swaFull; this.cacheReuse = cacheReuse; + this.gpuLayers = gpuLayers; this.reasoningEffort = reasoningEffort; this.reasoningBudgetTokens = reasoningBudgetTokens; this.dryMultiplier = dryMultiplier; @@ -259,6 +263,15 @@ public int cacheReuse() { return cacheReuse; } + /** + * Returns the number of model layers to offload to the GPU ({@code --gpu-layers}). + * + * @return GPU layers ({@code -1} = leave the binding/build default) + */ + public int gpuLayers() { + return gpuLayers; + } + /** * Returns the gpt-oss reasoning-effort kwarg value. * diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java index c246943..bcfa02c 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java @@ -113,6 +113,16 @@ public void cacheReuseDefaultsTwoFiftySixAndRoundTrips() { assertThat(c.getCacheReuse(), is(128)); } + @Test + public void gpuLayersDefaultsMinusOneAndRoundTrips() { + AiGenerationConfig c = new AiGenerationConfig(); + // Default -1 (leave binding/build default) kills the inline-constant / "return 0" getter mutants. + assertThat(c.getGpuLayers(), is(-1)); + c.setGpuLayers(33); + // Round-tripped value kills the "return 0" getter and removed-assignment setter mutants. + assertThat(c.getGpuLayers(), is(33)); + } + @Test public void reasoningBudgetTokensDefaultsUnrestrictedAndRoundTrips() { AiGenerationConfig c = new AiGenerationConfig(); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java index 7c98219..f11a42e 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java @@ -51,6 +51,7 @@ public void getConfig_knownKey_propagatesAllFields() { definition.setCachePrompt(false); definition.setSwaFull(false); definition.setCacheReuse(128); + definition.setGpuLayers(20); definition.setReasoningEffort("high"); definition.setReasoningBudgetTokens(512); definition.setDryMultiplier(0.7f); @@ -92,6 +93,7 @@ public void getConfig_knownKey_propagatesAllFields() { // Non-default swaFull (false; the shipped default is now true) propagates. assertThat(config.isSwaFull(), is(false)); assertThat(config.getCacheReuse(), is(equalTo(128))); + assertThat(config.getGpuLayers(), is(equalTo(20))); // Non-default reasoningEffort propagates — kills the dropped-setReasoningEffort void-call mutant. assertThat(config.getReasoningEffort(), is(equalTo("high"))); assertThat(config.getReasoningBudgetTokens(), is(equalTo(512))); @@ -126,6 +128,7 @@ public void getConfig_defaultValues_matchAiGenerationConfigDefaults() { assertThat(config.isCachePrompt(), is(AiGenerationConfig.DEFAULT_CACHE_PROMPT)); assertThat(config.isSwaFull(), is(AiGenerationConfig.DEFAULT_SWA_FULL)); assertThat(config.getCacheReuse(), is(equalTo(AiGenerationConfig.DEFAULT_CACHE_REUSE))); + assertThat(config.getGpuLayers(), is(equalTo(AiGenerationConfig.DEFAULT_GPU_LAYERS))); assertThat(config.getReasoningEffort(), is(equalTo(AiGenerationConfig.DEFAULT_REASONING_EFFORT))); assertThat(config.getReasoningBudgetTokens(), is(equalTo(AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS))); assertThat(config.getMinP(), is(equalTo(AiGenerationConfig.DEFAULT_MIN_P))); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java index 71ce97b..275b3a5 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java @@ -105,6 +105,14 @@ public void cacheReuseDefaultsTwoFiftySixAndRoundTrips() { assertThat(d.getCacheReuse(), is(128)); } + @Test + public void gpuLayersDefaultsMinusOneAndRoundTrips() { + AiModelDefinition d = new AiModelDefinition(); + assertThat(d.getGpuLayers(), is(-1)); + d.setGpuLayers(33); + assertThat(d.getGpuLayers(), is(33)); + } + @Test public void reasoningBudgetTokensDefaultsUnrestrictedAndRoundTrips() { AiModelDefinition d = new AiModelDefinition(); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java index 5fd9acb..aad1ef5 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java @@ -34,6 +34,7 @@ private static LlamaCppJniConfig jniConfig() { true, false, 0, + -1, "low", -1, 0.0f, diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java index cbbb8f7..da76f46 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java @@ -50,6 +50,7 @@ public void generate_realProvider_returnsNonEmptyResponse() throws Exception { AiGenerationConfig.DEFAULT_CACHE_PROMPT, AiGenerationConfig.DEFAULT_SWA_FULL, AiGenerationConfig.DEFAULT_CACHE_REUSE, + AiGenerationConfig.DEFAULT_GPU_LAYERS, AiGenerationConfig.DEFAULT_REASONING_EFFORT, AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS, AiGenerationConfig.DEFAULT_DRY_MULTIPLIER, From 96904a596610ea3ef9e37c992a60cd32afa514ab Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 12:39:47 +0200 Subject: [PATCH 53/68] feat: opt-in gpu-cuda / gpu-vulkan profiles + parameterized native classifier Make the net.ladenthin:llama native build selectable via a property (llama.classifier, empty = the CPU/Ninja main jar) and add two profiles: -P gpu-cuda -> cuda13-windows-x86-64 (NVIDIA, ~4.5x CPU decode; needs the CUDA toolkit bin\x64 on PATH for cudart64_13/cublas64_13) -P gpu-vulkan -> vulkan-windows-x86-64 (AMD + NVIDIA; one-time shader warmup) The gpt-oss c16k/c48k/c96k presets gain ${ai.gpuLayers} (default -1 = leave build default; set -Dai.gpuLayers=N for partial offload on limited VRAM). Verified: empty classifier resolves the main jar; -P gpu-cuda loads the CUDA device in the native test (decode ~427 t/s). README documents the GPU options + the CUDA PATH requirement. OpenCL deliberately omitted (no NVIDIA support in llama.cpp). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 23 +++++++++++++++++++++++ pom.xml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/README.md b/README.md index 4823a5c..5f4559c 100644 --- a/README.md +++ b/README.md @@ -451,6 +451,29 @@ in [COMPARISON.md §11](docs/ai-index-benchmark/COMPARISON.md): - **Timing is quadratic, not linear:** prefill ≈ `24.4·n + 0.000674·n²` ms (n = prompt tokens), because attention is O(n) per token — which is why throughput drops as files grow. The plugin logs this estimate per file. + +## GPU acceleration (opt-in) +The default native is CPU (Ninja build, bundled in the main `net.ladenthin:llama` jar). To use a GPU +build, select a classifier via a profile and (optionally) set how many layers to offload: + +``` +mvn ai-index:generate -P gpu-cuda -Dai.gpuLayers=20 # NVIDIA, partial offload (limited VRAM) +mvn ai-index:generate -P gpu-vulkan # AMD or NVIDIA +``` + +- `gpu-cuda` (`cuda13-windows-x86-64`) — **fastest** on NVIDIA (measured ~4.5× CPU decode). Requires a + CUDA 13 toolkit + driver, and the toolkit's `bin\x64` (with `cudart64_13.dll`, `cublas64_13.dll`) on + `PATH` — the classifier jar bundles only `jllama.dll`, not the CUDA runtime. +- `gpu-vulkan` (`vulkan-windows-x86-64`) — works on AMD **and** NVIDIA; the Vulkan loader ships with GPU + drivers. First run pays a one-time shader-compilation cost (amortized over a batch). +- `ai.gpuLayers`: `-1` (default) lets the build decide (a GPU build auto-offloads everything); set a + positive number for **partial** offload when the model does not fit in VRAM (e.g. gpt-oss-20b ≈ 11 GB + on an 8 GB card), or `0` to force CPU. +- OpenCL is intentionally not offered: llama.cpp's OpenCL backend does not support NVIDIA GPUs. + +Note: this selects the GPU native for the plugin's own (self-index) build; to ship a GPU-capable plugin +to other projects, build/install it with the GPU profile (`mvn install -P gpu-cuda`). + ## Development Run full build: diff --git a/pom.xml b/pom.xml index cd71a71..fcd1016 100644 --- a/pom.xml +++ b/pom.xml @@ -64,6 +64,15 @@ SPDX-License-Identifier: Apache-2.0 Requires the maven-snapshots block below. Switch to the 5.0.3 release once published. (Release fallback: 5.0.2 has withCachePrompt but not withSlotId.) --> 5.0.3-SNAPSHOT + + + + -1 6.1.0 3.0 1.37 @@ -146,6 +155,7 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin llama ${llama.version} + ${llama.classifier} @@ -748,6 +758,28 @@ SPDX-License-Identifier: Apache-2.0 + + + gpu-cuda + + cuda13-windows-x86-64 + + + + gpu-vulkan + + vulkan-windows-x86-64 + + + release @@ -1327,6 +1359,7 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-c16k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 16384 + ${ai.gpuLayers} 2048 0.7 8 @@ -1342,6 +1375,7 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-c48k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 49152 + ${ai.gpuLayers} 4096 0.7 8 @@ -1357,6 +1391,7 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-c96k X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 98304 + ${ai.gpuLayers} 6144 0.7 8 From 623f8a2918e81131126f35003d621de516a17015 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 12:52:48 +0200 Subject: [PATCH 54/68] =?UTF-8?q?docs(README):=20correct=20GPU=20enablemen?= =?UTF-8?q?t=20=E2=80=94=20lib.path=20is=20the=20reliable=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verified that the gpu-cuda/gpu-vulkan profiles only affect this repo's reactor build (no POM flatten -> the llama.classifier property resolves to the CPU default downstream), so they do NOT change the native used when the published plugin runs in another build. The reliable GPU mechanism for actual indexing is the runtime override net.ladenthin.llama.lib.path (loaded before the bundled native), verified to load CUDA (~417 t/s) with the default CPU jar on the classpath. README now documents lib.path as the primary GPU path + the profiles as reactor test/bench. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 5f4559c..6947cbe 100644 --- a/README.md +++ b/README.md @@ -453,26 +453,34 @@ in [COMPARISON.md §11](docs/ai-index-benchmark/COMPARISON.md): this estimate per file. ## GPU acceleration (opt-in) -The default native is CPU (Ninja build, bundled in the main `net.ladenthin:llama` jar). To use a GPU -build, select a classifier via a profile and (optionally) set how many layers to offload: +The default native is CPU (Ninja build, bundled in the main `net.ladenthin:llama` jar). On an NVIDIA +RTX 3070 a CUDA build measured **~4.5× the CPU decode speed**; Vulkan also works (AMD + NVIDIA) but pays +a one-time shader-compilation cost on the first run. OpenCL is intentionally not offered (llama.cpp's +OpenCL backend does not support NVIDIA GPUs). + +**Reliable way (any build, incl. indexing your own project) — runtime library override.** The native +loader (`net.ladenthin.llama.loader.LlamaLoader`) loads from `net.ladenthin.llama.lib.path` before the +bundled native, so point it at a folder holding the GPU `jllama.dll`: ``` -mvn ai-index:generate -P gpu-cuda -Dai.gpuLayers=20 # NVIDIA, partial offload (limited VRAM) -mvn ai-index:generate -P gpu-vulkan # AMD or NVIDIA +# 1) extract the GPU jllama.dll once (from the classifier jar in your local repo) +# cuda13-windows-x86-64 -> NVIDIA; vulkan-windows-x86-64 -> AMD/NVIDIA +# 2) run with the lib path set + the GPU runtime on PATH: +mvn ai-index:generate -Dnet.ladenthin.llama.lib.path=C:\path\to\gpu-native -Dai.gpuLayers=20 ``` -- `gpu-cuda` (`cuda13-windows-x86-64`) — **fastest** on NVIDIA (measured ~4.5× CPU decode). Requires a - CUDA 13 toolkit + driver, and the toolkit's `bin\x64` (with `cudart64_13.dll`, `cublas64_13.dll`) on - `PATH` — the classifier jar bundles only `jllama.dll`, not the CUDA runtime. -- `gpu-vulkan` (`vulkan-windows-x86-64`) — works on AMD **and** NVIDIA; the Vulkan loader ships with GPU - drivers. First run pays a one-time shader-compilation cost (amortized over a batch). -- `ai.gpuLayers`: `-1` (default) lets the build decide (a GPU build auto-offloads everything); set a - positive number for **partial** offload when the model does not fit in VRAM (e.g. gpt-oss-20b ≈ 11 GB - on an 8 GB card), or `0` to force CPU. -- OpenCL is intentionally not offered: llama.cpp's OpenCL backend does not support NVIDIA GPUs. - -Note: this selects the GPU native for the plugin's own (self-index) build; to ship a GPU-capable plugin -to other projects, build/install it with the GPU profile (`mvn install -P gpu-cuda`). +- **CUDA** needs a matching CUDA 13 toolkit + driver, and the toolkit's `bin\x64` (with `cudart64_13.dll`, + `cublas64_13.dll`) on `PATH` — the classifier jar bundles only `jllama.dll`, not the CUDA runtime. +- **`ai.gpuLayers`** (on the gpt-oss presets): `-1` (default) lets the build decide (a GPU native + auto-offloads everything); set a positive number for **partial** offload when the model does not fit + in VRAM (e.g. gpt-oss-20b ≈ 11 GB on an 8 GB card), or `0` to force CPU. + +**Profiles (this repo's own reactor build only — test/benchmark).** `-P gpu-cuda` / `-P gpu-vulkan` +swap the `net.ladenthin:llama` classifier (via the `llama.classifier` property) for the reactor's +test/compile classpath — handy for the native test or benchmarking on GPU here. They do **not** change +the native used when the *published* plugin runs in another build (the POM is not flattened, so the +classifier stays a property that resolves to the CPU default downstream) — use the `lib.path` override +above for real indexing. ## Development From eec05ab6737f69517479f3876bc31722a94f3eeb Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 13:12:36 +0200 Subject: [PATCH 55/68] feat: add mainGpu / devices GPU-selection knobs + document plugin-dependency GPU path Adds two opt-in knobs alongside gpuLayers, plumbed through the full chain (AiGenerationConfig -> AiModelDefinition(+Support) -> LlamaCppJniConfig -> provider) and applied as the binding's --main-gpu / --device: - mainGpu (default -1 = leave default): pick the primary GPU on multi-GPU hosts. A CUDA build only enumerates NVIDIA devices (single-NVIDIA host needs nothing); a Vulkan build enumerates every GPU (an integrated GPU is often device 0), so the default may select the slower one -- mainGpu=1 forces the discrete GPU. - devices (default "" = leave default): explicit comma-separated backend device names (e.g. Vulkan1); takes precedence over mainGpu. Both default to neutral (no setter call), so behaviour is unchanged unless set. Exposed on the gpt-oss presets via ai.mainGpu / ai.devices and as / on any model definition. README: document the clean GPU enablement path -- add the GPU classifier as a of the plugin so the loader extracts it from the plugin classpath (no lib.path needed); lib.path remains the no-POM-change alternative. Verified empirically that the loader extracts the GPU native from the classpath jar without lib.path (CUDA, ~431 t/s). 286 tests pass (1 native skipped); PIT 107/107 (100%) on the changed config classes. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 48 +++++++++++++--- pom.xml | 14 +++++ .../aiindex/config/AiGenerationConfig.java | 57 +++++++++++++++++++ .../aiindex/config/AiModelDefinition.java | 38 +++++++++++++ .../config/AiModelDefinitionSupport.java | 2 + .../aiindex/mojo/AbstractAiIndexMojo.java | 4 ++ .../LlamaCppJniAiGenerationProvider.java | 11 ++++ .../aiindex/provider/LlamaCppJniConfig.java | 28 ++++++++- .../config/AiGenerationConfigTest.java | 29 ++++++++++ .../config/AiModelDefinitionSupportTest.java | 7 +++ .../aiindex/config/AiModelDefinitionTest.java | 24 ++++++++ .../AiGenerationProviderFactoryTest.java | 2 + .../LlamaCppJniAiGenerationProviderTest.java | 2 + 13 files changed, 258 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6947cbe..a439213 100644 --- a/README.md +++ b/README.md @@ -458,28 +458,62 @@ RTX 3070 a CUDA build measured **~4.5× the CPU decode speed**; Vulkan also work a one-time shader-compilation cost on the first run. OpenCL is intentionally not offered (llama.cpp's OpenCL backend does not support NVIDIA GPUs). -**Reliable way (any build, incl. indexing your own project) — runtime library override.** The native -loader (`net.ladenthin.llama.loader.LlamaLoader`) loads from `net.ladenthin.llama.lib.path` before the -bundled native, so point it at a folder holding the GPU `jllama.dll`: +How the native is found: `net.ladenthin.llama.loader.LlamaLoader` tries `net.ladenthin.llama.lib.path`, +then `java.library.path`, then **extracts the native bundled in whatever `net.ladenthin:llama` jar is on +the classpath**. So there are two ways to enable a GPU when running the *published* plugin in your own +build. + +**Recommended — add the GPU classifier to the plugin's own classpath.** Declare the matching +`net.ladenthin:llama` classifier as a dependency of the plugin in your POM; the loader then extracts the +GPU `jllama.dll` from it — no library path to manage: + +```xml + + net.ladenthin + llamacpp-ai-index-maven-plugin + ... + + + net.ladenthin + llama + 5.0.3 + cuda13-windows-x86-64 + + + +``` + +``` +mvn ai-index:generate -Dai.gpuLayers=20 # + the GPU runtime on PATH (see below) +``` + +**Alternative — runtime library override (no POM change).** Point `net.ladenthin.llama.lib.path` at a +folder holding the GPU `jllama.dll` (extracted once from the classifier jar); it is tried before the +bundled native: ``` -# 1) extract the GPU jllama.dll once (from the classifier jar in your local repo) -# cuda13-windows-x86-64 -> NVIDIA; vulkan-windows-x86-64 -> AMD/NVIDIA -# 2) run with the lib path set + the GPU runtime on PATH: mvn ai-index:generate -Dnet.ladenthin.llama.lib.path=C:\path\to\gpu-native -Dai.gpuLayers=20 ``` +In both cases: + - **CUDA** needs a matching CUDA 13 toolkit + driver, and the toolkit's `bin\x64` (with `cudart64_13.dll`, `cublas64_13.dll`) on `PATH` — the classifier jar bundles only `jllama.dll`, not the CUDA runtime. - **`ai.gpuLayers`** (on the gpt-oss presets): `-1` (default) lets the build decide (a GPU native auto-offloads everything); set a positive number for **partial** offload when the model does not fit in VRAM (e.g. gpt-oss-20b ≈ 11 GB on an 8 GB card), or `0` to force CPU. +- **Picking a GPU on a multi-GPU host** (`ai.mainGpu` / `ai.devices` on the gpt-oss presets): a **CUDA** + build only enumerates NVIDIA devices, so a single-NVIDIA host needs nothing. A **Vulkan** build + enumerates *every* GPU (an integrated GPU is often device `0`), so the default may pick the slower one — + set `-Dai.mainGpu=1` to select the discrete GPU, or `-Dai.devices=Vulkan1` for explicit device names + (these map to the binding's `--main-gpu` / `--device`). On any model definition the same knobs are the + `` / `` elements. **Profiles (this repo's own reactor build only — test/benchmark).** `-P gpu-cuda` / `-P gpu-vulkan` swap the `net.ladenthin:llama` classifier (via the `llama.classifier` property) for the reactor's test/compile classpath — handy for the native test or benchmarking on GPU here. They do **not** change the native used when the *published* plugin runs in another build (the POM is not flattened, so the -classifier stays a property that resolves to the CPU default downstream) — use the `lib.path` override +classifier stays a property that resolves to the CPU default downstream) — use one of the two methods above for real indexing. ## Development diff --git a/pom.xml b/pom.xml index fcd1016..5b5b0a3 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,14 @@ SPDX-License-Identifier: Apache-2.0 default (CPU build stays CPU; GPU build auto-offloads). Set e.g. -Dai.gpuLayers=20 for partial offload when the model does not fit in VRAM. Only effective with a GPU classifier above. --> -1 + + -1 + + 6.1.0 3.0 1.37 @@ -1360,6 +1368,8 @@ SPDX-License-Identifier: Apache-2.0 X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 16384 ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 2048 0.7 8 @@ -1376,6 +1386,8 @@ SPDX-License-Identifier: Apache-2.0 X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 49152 ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 4096 0.7 8 @@ -1392,6 +1404,8 @@ SPDX-License-Identifier: Apache-2.0 X:/Modelle/gpt-oss-20b-UD-Q4_K_XL.gguf 98304 ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 6144 0.7 8 diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java index d58d62e..0ed14a7 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfig.java @@ -179,6 +179,25 @@ public AiGenerationConfig() { */ public static final int DEFAULT_GPU_LAYERS = -1; + /** + * Default primary GPU index ({@code --main-gpu}). {@code -1} (default) means "do not set it" — the + * binding/native build decides (llama.cpp's own default is device {@code 0}). Set a non-negative + * index to pick a specific device. This matters on machines with more than one GPU visible to the + * backend: a Vulkan build enumerates all GPUs (e.g. an integrated GPU as device {@code 0} + * and a discrete GPU as device {@code 1}), so the default may select the slower one; a CUDA build + * only enumerates NVIDIA devices. Only effective with a GPU native. See also {@link #DEFAULT_DEVICES}. + */ + public static final int DEFAULT_MAIN_GPU = -1; + + /** + * Default device selection ({@code --device}). Empty (default) means "do not set it" — the + * binding/native build decides. A non-empty value is a comma-separated list of backend device + * names to use (e.g. {@code Vulkan1} or {@code CUDA0}); it takes precedence over a single + * {@link #DEFAULT_MAIN_GPU} index when finer control across multiple devices is needed. Only + * effective with a GPU native. + */ + public static final String DEFAULT_DEVICES = ""; + /** * Default DRY (Don't Repeat Yourself) sampling multiplier ({@code --dry-multiplier}). * {@code 0.0} = disabled (llama.cpp default). A positive value penalises verbatim n-gram @@ -224,6 +243,8 @@ public AiGenerationConfig() { private boolean swaFull = DEFAULT_SWA_FULL; private int cacheReuse = DEFAULT_CACHE_REUSE; private int gpuLayers = DEFAULT_GPU_LAYERS; + private int mainGpu = DEFAULT_MAIN_GPU; + private String devices = DEFAULT_DEVICES; private String reasoningEffort = DEFAULT_REASONING_EFFORT; private int reasoningBudgetTokens = DEFAULT_REASONING_BUDGET_TOKENS; private float dryMultiplier = DEFAULT_DRY_MULTIPLIER; @@ -550,6 +571,42 @@ public void setGpuLayers(final int gpuLayers) { this.gpuLayers = gpuLayers; } + /** + * Returns the primary GPU index ({@code --main-gpu}). + * + * @return the GPU index, or {@code -1} to leave the binding/build default + */ + public int getMainGpu() { + return mainGpu; + } + + /** + * Sets the primary GPU index ({@code --main-gpu}). + * + * @param mainGpu the GPU index ({@code -1} = leave default; a non-negative value selects that device) + */ + public void setMainGpu(final int mainGpu) { + this.mainGpu = mainGpu; + } + + /** + * Returns the device selection ({@code --device}). + * + * @return the comma-separated device list, or an empty string to leave the binding/build default + */ + public String getDevices() { + return devices; + } + + /** + * Sets the device selection ({@code --device}). A {@code null} argument resets to the empty default. + * + * @param devices the comma-separated backend device names (e.g. {@code Vulkan1}), or {@code null}/empty to leave default + */ + public void setDevices(final String devices) { + this.devices = devices == null ? DEFAULT_DEVICES : devices; + } + /** * Sets whether llama.cpp prompt caching ({@code cache_prompt}) is enabled. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java index 4be5e93..18090d3 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinition.java @@ -56,6 +56,8 @@ public AiModelDefinition() { private boolean swaFull = AiGenerationConfig.DEFAULT_SWA_FULL; private int cacheReuse = AiGenerationConfig.DEFAULT_CACHE_REUSE; private int gpuLayers = AiGenerationConfig.DEFAULT_GPU_LAYERS; + private int mainGpu = AiGenerationConfig.DEFAULT_MAIN_GPU; + private String devices = AiGenerationConfig.DEFAULT_DEVICES; private String reasoningEffort = AiGenerationConfig.DEFAULT_REASONING_EFFORT; private int reasoningBudgetTokens = AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS; private float dryMultiplier = AiGenerationConfig.DEFAULT_DRY_MULTIPLIER; @@ -402,6 +404,42 @@ public void setGpuLayers(final int gpuLayers) { this.gpuLayers = gpuLayers; } + /** + * Returns the primary GPU index ({@code --main-gpu}) for this model. + * + * @return the GPU index; defaults to {@link AiGenerationConfig#DEFAULT_MAIN_GPU} (-1 = leave default) + */ + public int getMainGpu() { + return mainGpu; + } + + /** + * Sets the primary GPU index ({@code --main-gpu}) for this model. + * + * @param mainGpu the GPU index ({@code -1} = leave default; a non-negative value selects that device) + */ + public void setMainGpu(final int mainGpu) { + this.mainGpu = mainGpu; + } + + /** + * Returns the device selection ({@code --device}) for this model. + * + * @return the comma-separated device list; defaults to {@link AiGenerationConfig#DEFAULT_DEVICES} (empty = leave default) + */ + public String getDevices() { + return devices; + } + + /** + * Sets the device selection ({@code --device}) for this model. A {@code null} argument resets to the empty default. + * + * @param devices the comma-separated backend device names (e.g. {@code Vulkan1}), or {@code null}/empty to leave default + */ + public void setDevices(final String devices) { + this.devices = devices == null ? AiGenerationConfig.DEFAULT_DEVICES : devices; + } + /** * Returns the gpt-oss reasoning-effort level for this model. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java index e572d75..a412dc5 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupport.java @@ -120,6 +120,8 @@ private static AiGenerationConfig toConfig(final AiModelDefinition definition) { config.setSwaFull(definition.isSwaFull()); config.setCacheReuse(definition.getCacheReuse()); config.setGpuLayers(definition.getGpuLayers()); + config.setMainGpu(definition.getMainGpu()); + config.setDevices(definition.getDevices()); config.setReasoningEffort(definition.getReasoningEffort()); config.setReasoningBudgetTokens(definition.getReasoningBudgetTokens()); config.setDryMultiplier(definition.getDryMultiplier()); diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java index 6f70aae..0a1bcaf 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/AbstractAiIndexMojo.java @@ -252,6 +252,8 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig() throws MojoExecutionExcepti AiGenerationConfig.DEFAULT_SWA_FULL, AiGenerationConfig.DEFAULT_CACHE_REUSE, AiGenerationConfig.DEFAULT_GPU_LAYERS, + AiGenerationConfig.DEFAULT_MAIN_GPU, + AiGenerationConfig.DEFAULT_DEVICES, AiGenerationConfig.DEFAULT_REASONING_EFFORT, AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS, AiGenerationConfig.DEFAULT_DRY_MULTIPLIER, @@ -293,6 +295,8 @@ protected LlamaCppJniConfig buildLlamaCppJniConfig(final String aiDefinitionKey) config.isSwaFull(), config.getCacheReuse(), config.getGpuLayers(), + config.getMainGpu(), + config.getDevices(), config.getReasoningEffort(), config.getReasoningBudgetTokens(), config.getDryMultiplier(), diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java index 85c92eb..8df8580 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProvider.java @@ -109,6 +109,17 @@ private LlamaModel model() { if (config.gpuLayers() >= 0) { modelParameters.setGpuLayers(config.gpuLayers()); } + // Pick a specific GPU when configured (>= 0). Matters on multi-GPU hosts: a Vulkan build + // enumerates every GPU (an integrated GPU may be device 0), so the default can select the + // slower one. -1 leaves the binding/native-build default. + if (config.mainGpu() >= 0) { + modelParameters.setMainGpu(config.mainGpu()); + } + // Explicit device selection (comma-separated backend device names, e.g. "Vulkan1") takes + // precedence over a single main-GPU index. Empty leaves the binding/native-build default. + if (!config.devices().isEmpty()) { + modelParameters.setDevices(config.devices()); + } current = new LlamaModel(modelParameters); model = current; } diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java index ee4c9ef..644a435 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniConfig.java @@ -15,7 +15,7 @@ * *

Record-shaped value type marked {@link net.ladenthin.maven.llamacpp.aiindex.support.ConvertToRecord} for the future Java 17+ * migration. Accessors are record-style. {@code equals}, {@code hashCode} and - * {@code toString} are generated by Lombok over all twenty-four fields; full value semantics + * {@code toString} are generated by Lombok over all twenty-six fields; full value semantics * apply. Lombok emits the exact-bit float comparison * ({@code Float.floatToIntBits}) automatically.

*/ @@ -39,6 +39,8 @@ public final class LlamaCppJniConfig { private final boolean swaFull; private final int cacheReuse; private final int gpuLayers; + private final int mainGpu; + private final String devices; private final String reasoningEffort; private final int reasoningBudgetTokens; private final float dryMultiplier; @@ -67,6 +69,8 @@ public final class LlamaCppJniConfig { * @param swaFull whether to keep the full-size SWA KV cache ({@code --swa-full}) * @param cacheReuse KV prefix-reuse minimum chunk size ({@code --cache-reuse}); 0 = off * @param gpuLayers GPU layers to offload ({@code --gpu-layers}); -1 = leave default + * @param mainGpu primary GPU index ({@code --main-gpu}); -1 = leave default + * @param devices device selection ({@code --device}); empty = leave default * @param reasoningEffort gpt-oss reasoning-effort kwarg value ("low"/"medium"/"high"); empty omits it * @param reasoningBudgetTokens reasoning/think-token budget ({@code -1} = unrestricted) * @param dryMultiplier DRY sampling multiplier ({@code 0.0} = disabled) @@ -93,6 +97,8 @@ public LlamaCppJniConfig( boolean swaFull, int cacheReuse, int gpuLayers, + int mainGpu, + String devices, String reasoningEffort, int reasoningBudgetTokens, float dryMultiplier, @@ -118,6 +124,8 @@ public LlamaCppJniConfig( this.swaFull = swaFull; this.cacheReuse = cacheReuse; this.gpuLayers = gpuLayers; + this.mainGpu = mainGpu; + this.devices = devices; this.reasoningEffort = reasoningEffort; this.reasoningBudgetTokens = reasoningBudgetTokens; this.dryMultiplier = dryMultiplier; @@ -272,6 +280,24 @@ public int gpuLayers() { return gpuLayers; } + /** + * Returns the primary GPU index ({@code --main-gpu}). + * + * @return GPU index ({@code -1} = leave the binding/build default) + */ + public int mainGpu() { + return mainGpu; + } + + /** + * Returns the device selection ({@code --device}). + * + * @return comma-separated device list, or empty to leave the binding/build default + */ + public String devices() { + return devices; + } + /** * Returns the gpt-oss reasoning-effort kwarg value. * diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java index bcfa02c..1fa3bff 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiGenerationConfigTest.java @@ -123,6 +123,35 @@ public void gpuLayersDefaultsMinusOneAndRoundTrips() { assertThat(c.getGpuLayers(), is(33)); } + @Test + public void mainGpuDefaultsMinusOneAndRoundTrips() { + AiGenerationConfig c = new AiGenerationConfig(); + // Default -1 (leave binding/build default) kills the inline-constant / "return 0" getter mutants. + assertThat(c.getMainGpu(), is(-1)); + c.setMainGpu(1); + // Round-tripped value kills the "return 0" getter and removed-assignment setter mutants. + assertThat(c.getMainGpu(), is(1)); + } + + @Test + public void devicesDefaultsEmptyAndRoundTrips() { + AiGenerationConfig c = new AiGenerationConfig(); + // Default "" (leave binding/build default) kills the null/non-empty return mutants on the getter. + assertThat(c.getDevices(), is("")); + c.setDevices("Vulkan1"); + // Round-tripped value kills the empty-return getter and removed-assignment setter mutants. + assertThat(c.getDevices(), is("Vulkan1")); + } + + @Test + public void setDevicesNullResetsToEmpty() { + AiGenerationConfig c = new AiGenerationConfig(); + c.setDevices("CUDA0"); + c.setDevices(null); + // null arg resets to "" — kills the negate mutant on the setter ternary (which would store null). + assertThat(c.getDevices(), is("")); + } + @Test public void reasoningBudgetTokensDefaultsUnrestrictedAndRoundTrips() { AiGenerationConfig c = new AiGenerationConfig(); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java index f11a42e..329c34e 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionSupportTest.java @@ -52,6 +52,8 @@ public void getConfig_knownKey_propagatesAllFields() { definition.setSwaFull(false); definition.setCacheReuse(128); definition.setGpuLayers(20); + definition.setMainGpu(1); + definition.setDevices("Vulkan1"); definition.setReasoningEffort("high"); definition.setReasoningBudgetTokens(512); definition.setDryMultiplier(0.7f); @@ -94,6 +96,9 @@ public void getConfig_knownKey_propagatesAllFields() { assertThat(config.isSwaFull(), is(false)); assertThat(config.getCacheReuse(), is(equalTo(128))); assertThat(config.getGpuLayers(), is(equalTo(20))); + // mainGpu/devices propagate — kill the dropped-setter void-call mutants in toConfig(). + assertThat(config.getMainGpu(), is(equalTo(1))); + assertThat(config.getDevices(), is(equalTo("Vulkan1"))); // Non-default reasoningEffort propagates — kills the dropped-setReasoningEffort void-call mutant. assertThat(config.getReasoningEffort(), is(equalTo("high"))); assertThat(config.getReasoningBudgetTokens(), is(equalTo(512))); @@ -129,6 +134,8 @@ public void getConfig_defaultValues_matchAiGenerationConfigDefaults() { assertThat(config.isSwaFull(), is(AiGenerationConfig.DEFAULT_SWA_FULL)); assertThat(config.getCacheReuse(), is(equalTo(AiGenerationConfig.DEFAULT_CACHE_REUSE))); assertThat(config.getGpuLayers(), is(equalTo(AiGenerationConfig.DEFAULT_GPU_LAYERS))); + assertThat(config.getMainGpu(), is(equalTo(AiGenerationConfig.DEFAULT_MAIN_GPU))); + assertThat(config.getDevices(), is(equalTo(AiGenerationConfig.DEFAULT_DEVICES))); assertThat(config.getReasoningEffort(), is(equalTo(AiGenerationConfig.DEFAULT_REASONING_EFFORT))); assertThat(config.getReasoningBudgetTokens(), is(equalTo(AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS))); assertThat(config.getMinP(), is(equalTo(AiGenerationConfig.DEFAULT_MIN_P))); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java index 275b3a5..7d327d0 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/config/AiModelDefinitionTest.java @@ -113,6 +113,30 @@ public void gpuLayersDefaultsMinusOneAndRoundTrips() { assertThat(d.getGpuLayers(), is(33)); } + @Test + public void mainGpuDefaultsMinusOneAndRoundTrips() { + AiModelDefinition d = new AiModelDefinition(); + assertThat(d.getMainGpu(), is(-1)); + d.setMainGpu(1); + assertThat(d.getMainGpu(), is(1)); + } + + @Test + public void devicesDefaultsEmptyAndRoundTrips() { + AiModelDefinition d = new AiModelDefinition(); + assertThat(d.getDevices(), is("")); + d.setDevices("Vulkan1"); + assertThat(d.getDevices(), is("Vulkan1")); + } + + @Test + public void setDevicesNullResetsToEmpty() { + AiModelDefinition d = new AiModelDefinition(); + d.setDevices("CUDA0"); + d.setDevices(null); + assertThat(d.getDevices(), is("")); + } + @Test public void reasoningBudgetTokensDefaultsUnrestrictedAndRoundTrips() { AiModelDefinition d = new AiModelDefinition(); diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java index aad1ef5..e55fec7 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/AiGenerationProviderFactoryTest.java @@ -35,6 +35,8 @@ private static LlamaCppJniConfig jniConfig() { false, 0, -1, + -1, + "", "low", -1, 0.0f, diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java index da76f46..50fc200 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/provider/LlamaCppJniAiGenerationProviderTest.java @@ -51,6 +51,8 @@ public void generate_realProvider_returnsNonEmptyResponse() throws Exception { AiGenerationConfig.DEFAULT_SWA_FULL, AiGenerationConfig.DEFAULT_CACHE_REUSE, AiGenerationConfig.DEFAULT_GPU_LAYERS, + AiGenerationConfig.DEFAULT_MAIN_GPU, + AiGenerationConfig.DEFAULT_DEVICES, AiGenerationConfig.DEFAULT_REASONING_EFFORT, AiGenerationConfig.DEFAULT_REASONING_BUDGET_TOKENS, AiGenerationConfig.DEFAULT_DRY_MULTIPLIER, From 858e4026858a870fbe88c86bb705237144a09c25 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 13:57:07 +0200 Subject: [PATCH 56/68] feat(pom): default to gpt-oss-20B-mxfp4 + make all gpt-oss presets GPU-ready - New ai.model property (default gpt-oss-20B-mxfp4); the generate/aggregate executions now reference ${ai.model} instead of the hardcoded c96k key, so the default model is one line and overridable with -Dai.model=. mxfp4 is the native format: same ~12 GB size and decode speed as Q4/Q5/Q8 (experts are MXFP4 regardless) but no expert double-quantization -> best quality. Verified via planOnly: plan routes all 17 files to gpt-oss-20B-mxfp4, 0 unmatched. - Wire ${ai.gpuLayers}/${ai.mainGpu}/${ai.devices} into all five quant-menu presets (mxfp4/Q4_K_M/Q5_K_M/Q8_0/F16), so any selectable model is GPU-ready. - Document that ai.gpuLayers=-1 means AUTO-FIT (llama.cpp fits as many layers as the card's free VRAM holds) -- the robust "runs on any card" default, not a fixed pessimistic count. Measured on RTX 3070 8 GB: auto-fit ~29 decode t/s vs ~8 CPU. - Record the GPU cross-check (quant within noise; CUDA > Vulkan-discrete > Vulkan-iGPU ~ CPU; OpenCL drops NVIDIA) in the quant-menu comment + README. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 9 ++++++--- pom.xml | 60 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a439213..3b1fe49 100644 --- a/README.md +++ b/README.md @@ -499,9 +499,12 @@ In both cases: - **CUDA** needs a matching CUDA 13 toolkit + driver, and the toolkit's `bin\x64` (with `cudart64_13.dll`, `cublas64_13.dll`) on `PATH` — the classifier jar bundles only `jllama.dll`, not the CUDA runtime. -- **`ai.gpuLayers`** (on the gpt-oss presets): `-1` (default) lets the build decide (a GPU native - auto-offloads everything); set a positive number for **partial** offload when the model does not fit - in VRAM (e.g. gpt-oss-20b ≈ 11 GB on an 8 GB card), or `0` to force CPU. +- **`ai.gpuLayers`** (on the gpt-oss presets): `-1` (default) does **not** pin a layer count, so + llama.cpp **auto-fits** as many layers as fit the card's free VRAM — the robust "runs on any card" + setting (it never over-commits, so no OOM on a 6 GB card, and uses more layers on a bigger one). Pin a + positive number only to force a specific **partial** split (a fixed count disables auto-fit), or `0` to + force CPU. Measured on an 8 GB RTX 3070, auto-fit gpt-oss-20b ≈ 29 decode t/s (vs ≈ 8 on CPU); a card + with ≥ 16 GB fits all layers and is far faster. - **Picking a GPU on a multi-GPU host** (`ai.mainGpu` / `ai.devices` on the gpt-oss presets): a **CUDA** build only enumerates NVIDIA devices, so a single-NVIDIA host needs nothing. A **Vulkan** build enumerates *every* GPU (an integrated GPU is often device `0`), so the default may pick the slower one — diff --git a/pom.xml b/pom.xml index 5b5b0a3..cc11e46 100644 --- a/pom.xml +++ b/pom.xml @@ -69,9 +69,16 @@ SPDX-License-Identifier: Apache-2.0 -Dllama.classifier=cuda13-windows-x86-64. GPU builds need their runtime on PATH (CUDA: the toolkit's bin\x64 with cudart64_13.dll/cublas64_13.dll). --> - + + gpt-oss-20B-mxfp4 + -1 gpt-oss-20B-mxfp4 X:/Modelle/gpt-oss-20b-mxfp4.gguf 98304 + ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 6144 0.7 8 @@ -1460,6 +1478,9 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-Q4_K_M X:/Modelle/gpt-oss-20b-Q4_K_M.gguf 98304 + ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 6144 0.7 8 @@ -1475,6 +1496,9 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-Q5_K_M X:/Modelle/gpt-oss-20b-Q5_K_M.gguf 98304 + ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 6144 0.7 8 @@ -1490,6 +1514,9 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-Q8_0 X:/Modelle/gpt-oss-20b-Q8_0.gguf 98304 + ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 6144 0.7 8 @@ -1505,6 +1532,9 @@ SPDX-License-Identifier: Apache-2.0 gpt-oss-20B-F16 X:/Modelle/gpt-oss-20b-F16.gguf 98304 + ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} 6144 0.7 8 @@ -1962,7 +1992,7 @@ message: the path on the first line, then a blank line, then the summaries to sy java file-body-java - gpt-oss-20B-c96k + ${ai.model} .java @@ -1970,7 +2000,7 @@ message: the path on the first line, then a blank line, then the summaries to sy sql file-body-sql - gpt-oss-20B-c96k + ${ai.model} .sql @@ -1981,7 +2011,7 @@ message: the path on the first line, then a blank line, then the summaries to sy fallback file-body-fallback - gpt-oss-20B-c96k + ${ai.model} true
@@ -1998,7 +2028,7 @@ message: the path on the first line, then a blank line, then the summaries to sy package-body - gpt-oss-20B-c96k + ${ai.model} @@ -2024,7 +2054,7 @@ message: the path on the first line, then a blank line, then the summaries to sy project-body - gpt-oss-20B-c96k + ${ai.model} From 90a13f2a858f9b71828c6723fd0f2068761d7f8a Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 14:02:28 +0200 Subject: [PATCH 57/68] build(spotbugs): suppress fb-contrib opinion findings on the routing/plan code The full `mvn verify` SpotBugs gate (Max+Low + fb-contrib 7.7.4) surfaced 44 findings in the rule-routing / condition-tree / plan classes added earlier this session (AiCondition(+Group), AiFieldGenerationConfig, AiConditionEvaluator, AiFieldGenerationSelector, AiIndexPlan(+Entry), AiFileContext, AiRangeCondition, AiGenerationTimeEstimator) - that code had passed tests + PIT but never the full verify. All 44 are fb-contrib bytecode-shape opinions on build-time, single- threaded, plugin-internal beans/DTOs, the same families already suppressed with rationale elsewhere in this filter: - EI_EXPOSE_REP/REP2 on the Maven @Parameter config beans + the throwaway AiIndexPlan DTO (the "representation" is the configured tree / internal plan, never shared with untrusted callers; Entry.rule intentionally aliases the rule) - IMC_IMMATURE_CLASS_NO_EQUALS / NO_TOSTRING / WRONG_FIELD_ORDER - CE_CLASS_ENVY, OCP_OVERLY_CONCRETE_PARAMETER, OPM_OVERLY_PERMISSIVE_METHOD, UCPM_USE_CHARACTER_PARAMETERIZED_METHOD, WEM_WEAK_EXCEPTION_MESSAGING, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE Each block is scoped to the specific classes + patterns with a written rationale. No production behaviour change. Full `mvn verify` now BUILD SUCCESS (SpotBugs 0). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- spotbugs-exclude.xml | 115 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index baedd30..5c95a61 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -302,4 +302,119 @@ SPDX-License-Identifier: Apache-2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d28faf91c9aa434342286d74a4b70454c3cf598a Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 14:21:05 +0200 Subject: [PATCH 58/68] =?UTF-8?q?docs(tuning):=20E2=20build-11=20CUDA=20re?= =?UTF-8?q?-test=20=E2=80=94=20high-effort=20blackhole=20gone,=20budget=20?= =?UTF-8?q?still=20unproven?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-ran both E2 arms on build 11 via CUDA (mxfp4, ~27 KB fixture, temp 0.7, high effort, maxOutputTokens=2048, ctx 16384): - Arm A (budget -1): non-empty body (2615 chars, ~12 headings), decode stopped at 1604 tokens BELOW the 2048 cap -> the original "reasoning blackhole / 0-of-9 empty body pinned at the cap" no longer reproduces on build 11. - Arm B (budget 1024): non-empty (2055 chars), 1350 decode tokens; no clean truncation at the budget -> reasoning-budget still not a demonstrable safety rail. Conclusion unchanged: reasoningBudgetTokens stays opt-in/default -1, low effort stays the shipped default. Only material update: high effort is no longer outright broken for larger files on build 11. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- docs/ai-index-benchmark/gpt-oss-tuning.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/ai-index-benchmark/gpt-oss-tuning.md b/docs/ai-index-benchmark/gpt-oss-tuning.md index f212297..ebb7910 100644 --- a/docs/ai-index-benchmark/gpt-oss-tuning.md +++ b/docs/ai-index-benchmark/gpt-oss-tuning.md @@ -380,6 +380,26 @@ is not truncated at the budget. So the budget cannot be relied on as a safety ra cost-without-benefit obvious and motivated removing it entirely** (see the retry-removal change): a blank body now fails fast with a single `WARN` instead of re-inferring 3× to the same empty result. +**Build 11 re-test (Ninja native, CUDA, mxfp4) — the empty-body blackhole no longer reproduces; budget +still unproven.** Re-ran both arms on the newer `net.ladenthin:llama` build 11 native via CUDA (auto-fit +GPU): a ~27 KB / many-method fixture (`AiGenerationConfig.java`), gpt-oss-20b mxfp4, temp 0.7, **high +effort**, `maxOutputTokens=2048`, `contextSize=16384`. + +| arm | budget | prefill | decode tokens | decode t/s | body | +|---|---|---|---|---|---| +| A | −1 (off) | 6471 tok @ 446 t/s | **1604** (stopped < 2048 cap) | 20.4 | **non-empty**, 2615 chars, ~12 `#` headings | +| B | **1024** | 6471 tok @ 462 t/s | 1350 | 20.6 | non-empty, 2055 chars, 0 `#` headings | + +Two changes vs the original CPU run: (1) **high effort now completes a substantive answer** — neither arm +is blank and arm A stops naturally at 1604 tokens *below* the 2048 cap, so the original "reasoning +blackhole → 0/9 empty body, decode pinned at the cap" does **not** reproduce on build 11. (2) The +**reasoning budget is still not a demonstrable safety rail**: arm B decoded somewhat fewer tokens +(1350 vs 1604) but there is no clean truncation at 1024, and the structure difference (0 vs 12 headings) +is content variance at temp 0.7 from a single sample, not a budget effect. Conclusion unchanged: +`reasoningBudgetTokens` stays **opt-in, default −1**; low effort stays the shipped default (faster and +adequate). The only material update is that high effort is no longer outright broken for larger files on +build 11. + ### Retry mechanism removed (follow-up from E2) The empty-body retry loop (initial generation + up to `maxRetries` re-inferences at an escalating From 36b7a8e3a42acb8f75ed63bafebd4c5ed5e4304f Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 14:30:53 +0200 Subject: [PATCH 59/68] docs+build: consistency pass before final push (default model, version, gitignore) Repo-wide consistency audit fixes: - Default model: README, docs/ai-index-benchmark/README.md + COMPARISON.md, and the pom DEFAULT comment said gpt-oss-20B-c96k; the actual default is now ai.model= gpt-oss-20B-mxfp4 (native-MXFP4 swap of the benchmarked c96k/UD-Q4_K_XL, same 96K window, quant within noise per E5). All updated + note the -Dai.model override. - Version: CLAUDE.md said 1.0.0; aligned to pom 1.0.1-SNAPSHOT. - pom charsPerToken comment cited the stale ~4.2 chars/token (synthetic fixture); real Java is ~4.8 (D2), which the ETA estimator already uses. Comment corrected and disambiguated from ESTIMATION_CHARS_PER_TOKEN. - .gitignore: ignore .idea/ (was untracked) and guard generated AI-index output under src/site/ai/ while keeping the tracked empty.md placeholder. Audit also confirmed clean: mainGpu/devices wired symmetrically (26-field LlamaCppJniConfig), all 8 gpt-oss presets carry the GPU knobs, ${ai.model} used in every execution, 95/95 license headers, no TODO/retry remnants, GPU profiles + PIT config consistent. No code/test change in this commit. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- .gitignore | 7 +++++++ CLAUDE.md | 2 +- README.md | 9 ++++++--- docs/ai-index-benchmark/COMPARISON.md | 7 ++++--- docs/ai-index-benchmark/README.md | 8 +++++--- pom.xml | 13 +++++++++---- 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 0d37528..2c7a209 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,10 @@ replay_pid* src/siteGusto/ src/siteMistral3/ src/siteQwenBRUTAL/ + +# IDE config +.idea/ + +# Generated AI-index output from the self-index run (keep the tracked placeholder) +/src/site/ai/* +!/src/site/ai/empty.md diff --git a/CLAUDE.md b/CLAUDE.md index 405c2c4..7d10c33 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,7 +10,7 @@ This document provides guidance for AI assistants working on the llamacpp-ai-ind - **Group ID:** `net.ladenthin` - **Artifact ID:** `llamacpp-ai-index-maven-plugin` -- **Version:** 1.0.0 +- **Version:** 1.0.1-SNAPSHOT - **Java:** target bytecode 1.8, built with JDK 21 - **License:** Apache 2.0 - **Author:** Bernard Ladenthin (Copyright 2026) diff --git a/README.md b/README.md index 3b1fe49..5592394 100644 --- a/README.md +++ b/README.md @@ -421,9 +421,12 @@ Based on an 8-model × 2-prompt benchmark run against this codebase — full res pros/cons, a source-faithfulness deep-dive, and reproduction steps in [docs/ai-index-benchmark](docs/ai-index-benchmark/COMPARISON.md): -- **`gpt-oss-20B-c96k` — the production default.** Most *accurate* per file (won 5/6 in the per-file - matrix), run at `reasoningEffort=low` and a 96K window so it covers files up to ~250 KB untrimmed. - Slowest of the set (~2× the 30B) — the accepted cost for accuracy. See the preset/timing details below. +- **`gpt-oss-20B-mxfp4` — the production default** (switch with `-Dai.model=`). The native MXFP4 + quant at a 96K window; it inherits the benchmark's accuracy lead (gpt-oss-20b was most *accurate* per + file, won 5/6 in the per-file matrix — measured on the `c96k`/UD-Q4_K_XL quant, but E5 shows quant + choice is within noise so the native MXFP4 is the better-quality swap), run at `reasoningEffort=low` + and a 96K window so it covers files up to ~250 KB untrimmed. Slowest of the set (~2× the 30B) — the + accepted cost for accuracy. See the preset/timing details below. - **Qwen3-Coder-30B-A3B-Instruct** — throughput alternative (and best of the non-reasoning models for large Java files): most complete/faithful of the fast models, code-specialized, Apache-2.0, ~3.3B-active MoE, 262K context. Pick it when throughput beats the last points of fidelity. diff --git a/docs/ai-index-benchmark/COMPARISON.md b/docs/ai-index-benchmark/COMPARISON.md index 5b9c7c2..b91b71d 100644 --- a/docs/ai-index-benchmark/COMPARISON.md +++ b/docs/ai-index-benchmark/COMPARISON.md @@ -120,9 +120,10 @@ for a hybrid deterministic-structure + AI-prose design. ## 7. Recommendations -- **Production default (this project): `gpt-oss-20B-c96k`.** Chosen for maximum per-file fidelity, - run at `reasoningEffort=low` and a 96K window so it covers files up to ~250 KB untrimmed (§11). It - is the slowest of the set, accepted here because accuracy is the priority — details below. +- **Production default (this project): `gpt-oss-20B-mxfp4`** (native-MXFP4 swap of the benchmarked + `c96k`/UD-Q4_K_XL; same 96K window, quant choice within noise per E5). Chosen for maximum per-file + fidelity, run at `reasoningEffort=low` and a 96K window so it covers files up to ~250 KB untrimmed + (§11). It is the slowest of the set, accepted here because accuracy is the priority — details below. - **Throughput alternative: `Qwen3-Coder-30B-A3B-Instruct`** — clean, accurate, code-specialized, Apache-2.0, ~71 s/file (~3.3B active MoE); pick it when throughput beats the last points of fidelity. - **Why gpt-oss is the precision pick:** it is the most *faithful* model in the study. diff --git a/docs/ai-index-benchmark/README.md b/docs/ai-index-benchmark/README.md index 91ea430..398aa29 100644 --- a/docs/ai-index-benchmark/README.md +++ b/docs/ai-index-benchmark/README.md @@ -8,9 +8,11 @@ versions** for the plugin's code-summarization task (`.ai.md` generation), run o ## Bottom line -- **Production default: `gpt-oss-20B-c96k`** — most faithful per file (won 5/6 in the per-file - matrix), run at `reasoningEffort=low` and a 96K window so it covers files up to ~250 KB untrimmed - (§11). Slowest of the set; chosen because per-file accuracy is the priority. +- **Production default: `gpt-oss-20B-mxfp4`** (the native-MXFP4 swap of the benchmarked `c96k`/UD-Q4_K_XL + — same 96K window; E5 shows quant choice is within noise, so the native quant is the better-quality + pick). Most faithful per file (gpt-oss-20b won 5/6 in the per-file matrix), run at `reasoningEffort=low` + and a 96K window so it covers files up to ~250 KB untrimmed (§11). Slowest of the set; chosen because + per-file accuracy is the priority. - **Throughput alternative (and best of the non-reasoning models for large files): `Qwen3-Coder-30B-A3B-Instruct`** — most complete & faithful of the fast models, code-specialized, Apache-2.0, ~71 s/file (~3.3B-active MoE, 262K ctx). diff --git a/pom.xml b/pom.xml index cc11e46..0a3d398 100644 --- a/pom.xml +++ b/pom.xml @@ -1337,7 +1337,9 @@ SPDX-License-Identifier: Apache-2.0 effort only for genuinely reasoning-heavy generation AND raise maxOutputTokens with it, or the final answer is truncated. - >>> DEFAULT: gpt-oss-20B-c96k <<< + >>> DEFAULT MODEL: gpt-oss-20B-mxfp4 (native MXFP4), 96K window <<< + (set via the ai.model property; the c16k/c48k/c96k presets are the + same model family at narrower windows.) Why the widest practical window is the default: a measured A/B (§11) proved that a larger contextSize costs ONLY KV RAM, NOT per-file time — for the same small file, 16K vs 96K had identical @@ -1350,9 +1352,12 @@ SPDX-License-Identifier: Apache-2.0 a fully filled 96K window plus context checkpoints peaks ~23 GB). Shared design: - - charsPerToken 3 matches dense Java (measured ~4.2 chars/token; - 3 keeps the char-based pre-trim token-safe so a big file is never - silently over-fed past the real token window). + - charsPerToken 3 is a conservative pre-trim safety ratio: real + Java tokenizes at ~4.8 chars/token (D2; the synthetic fixture was + ~4.2), so 3 under-counts on purpose, keeping the char-based pre-trim + token-safe so a big file is never silently over-fed past the real + token window. (The ETA estimator uses the measured 4.8 separately; + see AiGenerationTimeEstimator.ESTIMATION_CHARS_PER_TOKEN.) - Sampling: temp 0.7, top-p 1.0, top-k 0, min-p 0.05. This is a deliberate task-specific deviation from the model card's temp 1.0/top-p 1.0: a fact-check (docs/.../gpt-oss-tuning.md D1) From 3aed439c08878c50de95621d4ea4005299eeb6d6 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 15:01:05 +0200 Subject: [PATCH 60/68] feat: plan-time context-window check + fail-fast on oversized files The routing plan now shows, per file, whether it fits the routed model's context window, and by default fails the build when a file would be trimmed - so oversized files are routed to a larger-context model instead of silently losing content. - AiInputWindowCalculator (new, pure, PIT 100%): single source of truth for the trim threshold (max input chars + availableSourceChars + exceedsWindow). Mirrors the runtime formula exactly. AiFieldGenerationSupport now delegates its maxInputChars math to it, so plan prediction == run behaviour. - SourceFileIndexer.classify gains an overload that, given the model + prompt supports, computes each routed file's window fit (source chars vs budget) and records it in the plan. The 2-arg overload (no window check) is unchanged. - AiIndexPlan: per-entry window fit, a "Window" column (ok / "(!) X>Y"), an "Over window" section listing offenders + their model/budget, a summary count, and windowExceededCount(). - GenerateMojo: new aiIndex.failOnWindowExceeded (default TRUE) - after the plan is printed, the build fails (planOnly and real run alike) if any file exceeds its window; set false to trim with the existing warnOnTrim warning instead. - pom: example big-window fallback (phi-4-mini-bigwindow, 128K) + a high-priority 'big-window' size rule routing >275 KB .java files to it, so the default fail-on-exceed stays satisfiable for rare huge files. (Download/verify the Phi-4 GGUF before relying on it; the path is an example.) - Docs (CLAUDE.md, README): document the window check, the new parameter, and the fallback pattern. Verified: planOnly on this repo shows "0 over window" (all 17 files fit the 96K mxfp4 window); full mvn verify green (297 tests, SpotBugs 0); PIT 17/17 on the calculator. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- CLAUDE.md | 12 +- README.md | 7 +- pom.xml | 58 +++++++ .../indexer/AiFieldGenerationSupport.java | 12 +- .../llamacpp/aiindex/indexer/AiIndexPlan.java | 164 +++++++++++++++++- .../indexer/AiInputWindowCalculator.java | 90 ++++++++++ .../aiindex/indexer/SourceFileIndexer.java | 42 ++++- .../llamacpp/aiindex/mojo/GenerateMojo.java | 32 +++- .../aiindex/indexer/AiIndexPlanTest.java | 45 ++++- .../indexer/AiInputWindowCalculatorTest.java | 85 +++++++++ 10 files changed, 521 insertions(+), 26 deletions(-) create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculator.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculatorTest.java diff --git a/CLAUDE.md b/CLAUDE.md index 7d10c33..c8f0273 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -139,7 +139,11 @@ against an `AiFileContext`; new leaf kinds are one field + one branch. Among mat skip beats routes and the fallback); exactly one `true` (no condition) catches the rest; a file matching no rule and no fallback **fails the build**. `aiIndex.planOnly=true` prints the Markdown plan (file → rule id → prompt → rough time estimate, summed per model and overall) and stops -(no model loaded). See `AiFieldGenerationSelector` (selection + validation), `AiCondition`/ +(no model loaded). The plan also computes each routed file's **context-window fit** up front (via +`AiInputWindowCalculator`, the same threshold the run uses to trim): a file larger than its routed +model's window is flagged in the plan and, by default (`aiIndex.failOnWindowExceeded=true`), **fails the +build** so it is routed to a larger-context model instead of being silently trimmed (set the flag to +`false` to trim with a warning). See `AiFieldGenerationSelector` (selection + validation), `AiCondition`/ `AiConditionEvaluator` (the tree), and `AiIndexPlan` (the rendered plan). This is how one run can index different file kinds/sizes with different models *and* prompts. @@ -182,7 +186,8 @@ the top of `execute()`. Covered by `MojoPhaseSkipTest`. | `SourceFileIndexer` | `collectCandidates` (walk + filters) / `classify` (→ `AiIndexPlan`) / `indexFile` (write one file with a given rule + provider) — split so a run plans first and loads one model per group | | `AiFieldGenerationSelector` | Routes a file to a rule by its `` + priority; explicit fallback; `skip`; plus `validate(rules)` (fail-fast config check) | | `AiCondition` / `AiConditionEvaluator` | Composable and/or/not condition tree (leaves: extensions/size/lines/modifiedAfter/modifiedBefore/pathGlob) + its evaluator (`matches`/`validate`/`usesLines`) | -| `AiIndexPlan` | The routing plan: routes grouped by model id, skips, unmatched; renders the up-front tree | +| `AiIndexPlan` | The routing plan: routes grouped by model id, skips, unmatched, per-file context-window fit; renders the up-front tree | +| `AiInputWindowCalculator` | Pure calculator for the input window (max source chars before trimming + whether a source exceeds it); single source of truth shared by the run-time trim (`AiFieldGenerationSupport`) and the plan-time over-window check (`SourceFileIndexer.classify`) | | `PackageIndexer` | Creates `package.ai.md` files with contents listings, calls AI to fill the document body | | `ProjectIndexer` | Phase 3: harvests each package's lead + relative link into one `project.ai.md`; deterministic listing, with an optional one-call AI `#### Overview` from the leads | | `AiMdLeadExtractor` | Pure extraction of the one-line blockquote lead from an `.ai.md` body (fallback: first non-blank line) | @@ -274,7 +279,8 @@ header block, so a `- F:` line in the body is never read as a link. | `excludes` | `aiIndex.excludes` | *(none)* | Glob patterns (base-relative, `/` separators) for source files to skip, e.g. `**/package-info.java`, `**/generated/**` (`AiSourceExcludeFilter`) | | `minFileSizeBytes` | `aiIndex.file.minSizeBytes` | `0` | Exclusive lower size bound; files `<=` this are skipped (`0` = no lower bound). For size-tiering across multiple `generate` executions | | `maxFileSizeBytes` | `aiIndex.file.maxSizeBytes` | `0` | Inclusive upper size bound; files `>` this are skipped (`0` = unlimited). Pairs with `minFileSizeBytes` to form a band | -| `planOnly` | `aiIndex.planOnly` | `false` | Print the routing plan tree (model → files → prompt) and stop; no model loaded, nothing generated | +| `planOnly` | `aiIndex.planOnly` | `false` | Print the routing plan tree (model → files → prompt → window fit) and stop; no model loaded, nothing generated | +| `failOnWindowExceeded` | `aiIndex.failOnWindowExceeded` | `true` | Fail the build when a matched file is larger than its routed model's context window (would be trimmed). Forces routing oversized files to a larger-context model. `false` = warn and trim instead. Same threshold the run uses (`AiInputWindowCalculator`) | | `generationProvider` | `aiIndex.generationProvider` | `mock` | `mock` or `llamacpp-jni` | | `llamaModelPath` | `aiIndex.llama.modelPath` | — | Path to GGUF model file | | `llamaContextSize` | `aiIndex.llama.contextSize` | `2048` | Context window size | diff --git a/README.md b/README.md index 5592394..6c6a971 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,12 @@ The plugin is configured from three building blocks, declared on the plugin insi matches no rule and no fallback **fails the build**. So one `generate` run can index different file kinds/sizes with **different models *and* prompts**; it loads each model once. Run with `-DaiIndex.planOnly=true` to print the routing plan (a copy-pasteable Markdown table: file → rule id → - prompt → rough time estimate, summed per model and overall) and stop before loading any model. + prompt → context-window fit → rough time estimate, summed per model and overall) and stop before + loading any model. The plan also checks each file against its routed model's **context window**: a + file too large for the window would be trimmed, so by default (`aiIndex.failOnWindowExceeded=true`) the + build **fails** and tells you to route it to a larger-context model (e.g. a higher-context preset or a + fast big-window fallback — see the `phi-4-mini-bigwindow` example + `big-window` rule in the POM); set + `-DaiIndex.failOnWindowExceeded=false` to trim with a warning instead. ```xml diff --git a/pom.xml b/pom.xml index 0a3d398..0e2276e 100644 --- a/pom.xml +++ b/pom.xml @@ -740,6 +740,7 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin.maven.llamacpp.aiindex.config.AiRangeCondition net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinition net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport + net.ladenthin.maven.llamacpp.aiindex.indexer.AiInputWindowCalculator net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationRequest net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult net.ladenthin.maven.llamacpp.aiindex.document.AiMdChildEntryLineFormatter @@ -1552,6 +1553,37 @@ SPDX-License-Identifier: Apache-2.0 low + + + phi-4-mini-bigwindow + X:/Modelle/Phi-4-mini-instruct-Q4_K_M.gguf + 131072 + ${ai.gpuLayers} + ${ai.mainGpu} + ${ai.devices} + 6144 + 0.7 + 8 + 4 + true + 1.0 + 0 + 0.05 + 1.0 + low + + EXP-Qwen3-Coder-30B X:/Modelle/Qwen3-Coder-30B-A3B-Instruct-UD-Q4_K_XL.gguf @@ -1994,6 +2026,32 @@ message: the path on the first line, then a blank line, then the summaries to sy .sql
+ + + big-window + file-body-java + phi-4-mini-bigwindow + 100 + + + + + .java + + + 275000 + + + + + java file-body-java diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java index 01a6fcd..e92d328 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiFieldGenerationSupport.java @@ -67,15 +67,6 @@ public class AiFieldGenerationSupport { */ private static final String CACHE_KEY_SEPARATOR = ":"; - /** - * Rounding granularity applied when computing the final {@code maxInputChars} value. - * The available character count is rounded DOWN to the nearest multiple of this value - * to produce a conservative, human-readable result. - * - * @see #calculateAndLogMaxInputChars - */ - private static final int MAX_INPUT_CHARS_ROUNDING = 100; - /** Bytes per kibibyte, used to render the source size in the per-file processing log. */ private static final int KIBIBYTES_DIVISOR = 1024; @@ -327,7 +318,8 @@ private int calculateAndLogMaxInputChars(final AiGenerationConfig config, final final int safetyChars = AiGenerationConfig.DEFAULT_SAFETY_MARGIN_CHARS; final int overheadTotal = promptChars + eofChars + outputChars + safetyChars; final int availableChars = totalChars - overheadTotal; - final int finalChars = Math.max(0, (availableChars / MAX_INPUT_CHARS_ROUNDING) * MAX_INPUT_CHARS_ROUNDING); + // Single source of truth for the threshold shared with the planning path (SourceFileIndexer.classify). + final int finalChars = AiInputWindowCalculator.maxInputChars(config, basePromptLength); log.info("Maximum input characters for source code before trimming. Calculated as: (context_size x " + charsPerToken + ") - overhead"); diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java index cb44503..96007ed 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java @@ -27,18 +27,33 @@ public static final class Entry { private final Path file; private final AiFieldGenerationConfig rule; private final long estimatedSeconds; + private final boolean windowChecked; + private final long sourceChars; + private final long availableSourceChars; /** * Creates a plan entry. * - * @param file the source file - * @param rule the rule that selected it - * @param estimatedSeconds the rough estimated generation time in seconds + * @param file the source file + * @param rule the rule that selected it + * @param estimatedSeconds the rough estimated generation time in seconds + * @param windowChecked whether the context-window fit was computed for this entry + * @param sourceChars the source length in characters fed to the model (when checked) + * @param availableSourceChars the source-character budget of the routed model+prompt (when checked) */ - public Entry(final Path file, final AiFieldGenerationConfig rule, final long estimatedSeconds) { + public Entry( + final Path file, + final AiFieldGenerationConfig rule, + final long estimatedSeconds, + final boolean windowChecked, + final long sourceChars, + final long availableSourceChars) { this.file = file; this.rule = rule; this.estimatedSeconds = estimatedSeconds; + this.windowChecked = windowChecked; + this.sourceChars = sourceChars; + this.availableSourceChars = availableSourceChars; } /** @@ -67,6 +82,44 @@ public AiFieldGenerationConfig rule() { public long estimatedSeconds() { return estimatedSeconds; } + + /** + * Returns whether the context-window fit was computed for this entry. + * + * @return {@code true} when window data is available + */ + public boolean windowChecked() { + return windowChecked; + } + + /** + * Returns the source length in characters fed to the model (meaningful only when + * {@link #windowChecked()} is {@code true}). + * + * @return the source character count + */ + public long sourceChars() { + return sourceChars; + } + + /** + * Returns the source-character budget of the routed model+prompt (meaningful only when + * {@link #windowChecked()} is {@code true}). + * + * @return the available source-character budget + */ + public long availableSourceChars() { + return availableSourceChars; + } + + /** + * Returns whether this file exceeds the routed model's context window and would be trimmed. + * + * @return {@code true} when checked and the source exceeds the window budget + */ + public boolean exceedsWindow() { + return windowChecked && sourceChars > availableSourceChars; + } } private final Map> routesByModel = new LinkedHashMap<>(); @@ -93,7 +146,29 @@ public void addRoute( final long estimatedSeconds) { routesByModel .computeIfAbsent(aiDefinitionKey, key -> new ArrayList<>()) - .add(new Entry(file, rule, estimatedSeconds)); + .add(new Entry(file, rule, estimatedSeconds, false, 0L, 0L)); + } + + /** + * Records a routed file under its model id together with its context-window fit. + * + * @param aiDefinitionKey the model id (rule's {@code aiDefinitionKey}) + * @param file the source file + * @param rule the routing rule + * @param estimatedSeconds the rough estimated generation time in seconds + * @param sourceChars the source length in characters fed to the model + * @param availableSourceChars the source-character budget of the routed model+prompt + */ + public void addRoute( + final String aiDefinitionKey, + final Path file, + final AiFieldGenerationConfig rule, + final long estimatedSeconds, + final long sourceChars, + final long availableSourceChars) { + routesByModel + .computeIfAbsent(aiDefinitionKey, key -> new ArrayList<>()) + .add(new Entry(file, rule, estimatedSeconds, true, sourceChars, availableSourceChars)); } /** @@ -154,6 +229,24 @@ public int routedCount() { return total; } + /** + * Returns the number of routed files whose source exceeds the routed model's context window + * (would be trimmed). Zero when no window check was performed. + * + * @return the count of over-window files + */ + public int windowExceededCount() { + int total = 0; + for (final List entries : routesByModel.values()) { + for (final Entry entry : entries) { + if (entry.exceedsWindow()) { + total++; + } + } + } + return total; + } + /** * Returns the summed estimated seconds for one model's entries. * @@ -204,7 +297,9 @@ public String renderMarkdown(final Path baseDir) { .append(skipped.size()) .append(" skipped, ") .append(unmatched.size()) - .append(" unmatched _(time is a rough estimate)_\n"); + .append(" unmatched, ") + .append(windowExceededCount()) + .append(" over window _(time is a rough estimate)_\n"); for (final Map.Entry> group : routesByModel.entrySet()) { final List entries = group.getValue(); sb.append("\n### Model `") @@ -213,7 +308,7 @@ public String renderMarkdown(final Path baseDir) { .append(entries.size()) .append(" file(s), est. ") .append(estimator.formatDuration(modelSeconds(entries))) - .append("\n\n| File | Rule | Prompt | Est. |\n|---|---|---|---|\n"); + .append("\n\n| File | Rule | Prompt | Window | Est. |\n|---|---|---|---|---|\n"); for (final Entry entry : entries) { sb.append("| ") .append(relativize(baseDir, entry.file())) @@ -222,6 +317,8 @@ public String renderMarkdown(final Path baseDir) { .append(" | ") .append(entry.rule().getPromptKey()) .append(" | ") + .append(windowCell(entry)) + .append(" | ") .append(estimator.formatDuration(entry.estimatedSeconds())) .append(" |\n"); } @@ -240,9 +337,62 @@ public String renderMarkdown(final Path baseDir) { sb.append("- ").append(relativize(baseDir, file)).append("\n"); } } + appendWindowExceededSection(sb, baseDir); return sb.toString(); } + /** + * Appends the section listing files whose source exceeds the routed model's context window (would be + * trimmed): each file with its model, source chars and the window budget, so the user can route it to + * a larger-window model. + * + * @param sb the buffer to append to + * @param baseDir the base directory for relativizing paths + */ + private void appendWindowExceededSection(final StringBuilder sb, final Path baseDir) { + final int count = windowExceededCount(); + if (count == 0) { + return; + } + sb.append("\n### (!) Over window - source exceeds the model's context window, would be trimmed (") + .append(count) + .append(")\n\n"); + for (final Map.Entry> group : routesByModel.entrySet()) { + for (final Entry entry : group.getValue()) { + if (entry.exceedsWindow()) { + sb.append("- ") + .append(relativize(baseDir, entry.file())) + .append(" -> model `") + .append(group.getKey()) + .append("` (source ") + .append(entry.sourceChars()) + .append(" chars > window ") + .append(entry.availableSourceChars()) + .append(" chars)\n"); + } + } + } + sb.append("\nRoute these to a larger-context model (a higher-context preset or a big-window") + .append(" fallback), or disable the check with -DaiIndex.failOnWindowExceeded=false to trim.\n"); + } + + /** + * Returns the per-entry "Window" cell: {@code "-"} when not checked, {@code "ok"} when it fits, or a + * {@code "(!) X>Y"} marker (source chars vs budget) when the source exceeds the window. + * + * @param entry the plan entry + * @return the window cell text + */ + private String windowCell(final Entry entry) { + if (!entry.windowChecked()) { + return "-"; + } + if (entry.exceedsWindow()) { + return "(!) " + entry.sourceChars() + ">" + entry.availableSourceChars(); + } + return "ok"; + } + /** * Returns the rule's id for display, or {@code "-"} when the rule has no id set. * diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculator.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculator.java new file mode 100644 index 0000000..c5b082c --- /dev/null +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculator.java @@ -0,0 +1,90 @@ +// @formatter:off +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +// @formatter:on +package net.ladenthin.maven.llamacpp.aiindex.indexer; + +import net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig; +import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; + +/** + * Pure calculator for the input window: how many source characters fit a model's context window + * before the source must be trimmed, and whether a given source would exceed it. + * + *

This is the single source of truth for the trim threshold. Both the run path + * ({@link AiFieldGenerationSupport}, which trims and warns) and the planning path + * ({@link SourceFileIndexer#classify}, which flags over-window files up front) use it, so the plan's + * prediction matches what the run actually does.

+ * + *

The budget mirrors the runtime trim check in + * {@link AiPromptPreparationSupport#preparePrompt}: the rendered prompt (template + source) must fit + * {@link #maxInputChars(AiGenerationConfig, int)}; since the template ({@code basePromptLength}) is + * fixed, the source budget is {@link #availableSourceChars(AiGenerationConfig, int)} and a source is + * trimmed when its length exceeds it.

+ */ +public final class AiInputWindowCalculator { + + /** + * Rounding granularity (in characters) applied to the computed maximum input size, kept + * conservative (rounds down) so the value is a safe, human-readable multiple. + */ + public static final int MAX_INPUT_CHARS_ROUNDING = 100; + + /** Utility class; not instantiable. */ + private AiInputWindowCalculator() { + // no-op + } + + /** + * Returns the maximum number of characters of the rendered prompt (template + source) that fit the + * model's context window before trimming. Mirrors the runtime computation: when + * {@link AiGenerationConfig#getCharsPerToken()} is {@code <= 0} the static + * {@link AiGenerationConfig#getMaxInputChars()} fallback is used (e.g. mock-based tests); otherwise + * it is {@code (contextSize x charsPerToken)} minus the prompt-template, EOF-marker, reserved-output + * and safety-margin overhead, rounded down to a {@link #MAX_INPUT_CHARS_ROUNDING} multiple. + * + * @param config the model generation config + * @param basePromptLength the length of the rendered prompt template with an empty source + * @return the maximum rendered-prompt length in characters (never negative) + */ + public static int maxInputChars(final AiGenerationConfig config, final int basePromptLength) { + if (config.getCharsPerToken() <= 0) { + return config.getMaxInputChars(); + } + final int totalChars = config.getContextSize() * config.getCharsPerToken(); + final int overhead = basePromptLength + + AiPromptPreparationSupport.EOF_MARKER_LENGTH + + config.getMaxOutputTokens() * config.getCharsPerToken() + + AiGenerationConfig.DEFAULT_SAFETY_MARGIN_CHARS; + final int available = totalChars - overhead; + return Math.max(0, (available / MAX_INPUT_CHARS_ROUNDING) * MAX_INPUT_CHARS_ROUNDING); + } + + /** + * Returns how many characters of source fit before trimming: the + * {@link #maxInputChars(AiGenerationConfig, int)} budget minus the fixed prompt template + * ({@code basePromptLength}). Never negative. + * + * @param config the model generation config + * @param basePromptLength the length of the rendered prompt template with an empty source + * @return the source-character budget (never negative) + */ + public static long availableSourceChars(final AiGenerationConfig config, final int basePromptLength) { + return Math.max(0L, (long) maxInputChars(config, basePromptLength) - basePromptLength); + } + + /** + * Returns whether a source of the given length would be trimmed because it does not fit the model's + * window. Equivalent to the runtime trim trigger: {@code sourceChars > availableSourceChars}. + * + * @param config the model generation config + * @param basePromptLength the length of the rendered prompt template with an empty source + * @param sourceChars the source length in characters + * @return {@code true} when the source would be trimmed (exceeds the window) + */ + public static boolean exceedsWindow( + final AiGenerationConfig config, final int basePromptLength, final long sourceChars) { + return sourceChars > availableSourceChars(config, basePromptLength); + } +} diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java index cf415ad..8067f52 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/SourceFileIndexer.java @@ -17,12 +17,15 @@ import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationConfig; import net.ladenthin.maven.llamacpp.aiindex.config.AiFieldGenerationSelector; import net.ladenthin.maven.llamacpp.aiindex.config.AiFileContext; +import net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig; +import net.ladenthin.maven.llamacpp.aiindex.config.AiModelDefinitionSupport; import net.ladenthin.maven.llamacpp.aiindex.document.AiGenerationResult; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocument; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdDocumentCodec; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeader; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderCodec; import net.ladenthin.maven.llamacpp.aiindex.document.AiMdHeaderSupport; +import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; import net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport; import net.ladenthin.maven.llamacpp.aiindex.support.AiGenerationTimeEstimator; import net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport; @@ -176,6 +179,31 @@ public List collectCandidates(final Path sourceRoot) throws IOException { */ public AiIndexPlan classify(final Collection candidates, final List rules) throws IOException { + return classify(candidates, rules, null, null); + } + + /** + * Plans the run as {@link #classify(Collection, List)} and, when both supports are provided, also + * computes each routed file's context-window fit: it resolves the routed model's + * {@code contextSize}/sampling config and the prompt template length, derives the source-character + * budget via {@link AiInputWindowCalculator} (the same threshold the run uses to trim), and records + * whether the file would be trimmed. This lets the plan flag over-window files up front (and the + * goal fail fast) instead of silently trimming them at run time. Pass {@code null} supports to skip + * the window check. + * + * @param candidates the candidate files (typically from {@link #collectCandidates(Path)}) + * @param rules the routing rules in declaration order + * @param modelDefinitionSupport model-config lookup by key, or {@code null} to skip the window check + * @param promptPreparationSupport prompt-template helper, or {@code null} to skip the window check + * @return the routing plan + * @throws IOException if a file size or content cannot be read + */ + public AiIndexPlan classify( + final Collection candidates, + final List rules, + final @Nullable AiModelDefinitionSupport modelDefinitionSupport, + final @Nullable AiPromptPreparationSupport promptPreparationSupport) + throws IOException { final boolean lineFiltersUsed = anyRuleUsesLines(rules); final AiIndexPlan plan = new AiIndexPlan(); for (final Path file : candidates) { @@ -197,7 +225,19 @@ public AiIndexPlan classify(final Collection candidates, final List1 fallback, a route rule missing prompt/model). selector.validate(fieldGenerations); @@ -176,8 +188,11 @@ public void execute() throws MojoExecutionException { candidates.addAll(fileIndexer.collectCandidates(subtree)); } - // 2. Plan the run: which model + prompt each file gets (or skip / unmatched). - final AiIndexPlan plan = fileIndexer.classify(candidates, fieldGenerations); + // 2. Plan the run: which model + prompt each file gets (or skip / unmatched), and whether + // each file fits its routed model's context window (computed up front, same threshold the + // run uses to trim — see AiInputWindowCalculator). + final AiIndexPlan plan = fileIndexer.classify( + candidates, fieldGenerations, modelDefinitionSupport, promptPreparationSupport); getLog().info("AI index plan (Markdown):\n" + plan.renderMarkdown(basePath)); // 3. A file that matched no rule and no fallback is a fatal misconfiguration. @@ -187,6 +202,18 @@ public void execute() throws MojoExecutionException { + "add a rule or a matching rule (see the plan above)."); } + // 3b. A file larger than its routed model's window would be silently trimmed. By default this + // fails the build (planOnly and real run alike) so oversized files are routed to a larger + // model instead; set aiIndex.failOnWindowExceeded=false to trim with a warning instead. + final int overWindowCount = plan.windowExceededCount(); + if (failOnWindowExceeded && overWindowCount > 0) { + throw new MojoExecutionException(overWindowCount + + " source file(s) exceed their routed model's context window and would be trimmed " + + "(see the 'Over window' section in the plan above). Route them to a larger-context " + + "model (a higher-context preset or a big-window fallback), or set " + + "-DaiIndex.failOnWindowExceeded=false to trim them instead."); + } + if (planOnly) { getLog().info("planOnly=true: stopping after the plan; no model loaded, nothing generated."); return; @@ -194,7 +221,6 @@ public void execute() throws MojoExecutionException { // 4. Execute model group by model group: load each model once, index its files, close. final AiGenerationProviderFactory providerFactory = new AiGenerationProviderFactory(); - final AiPromptPreparationSupport promptPreparationSupport = new AiPromptPreparationSupport(promptSupport); int wrote = 0; int unchanged = 0; for (final Map.Entry> group : diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java index 6ca0eec..539484d 100644 --- a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlanTest.java @@ -63,7 +63,7 @@ public void renderMarkdown_containsModelSectionsFilesAndTotals() { assertThat(md, containsString("## AI index plan")); assertThat(md, containsString("**Total:**")); assertThat(md, containsString("### Model `modelA`")); - assertThat(md, containsString("| File | Rule | Prompt | Est. |")); + assertThat(md, containsString("| File | Rule | Prompt | Window | Est. |")); assertThat(md, containsString("Foo.java")); assertThat(md, containsString("java-small")); // the rule id shows in its own column assertThat(md, containsString("file-body-java")); @@ -72,4 +72,47 @@ public void renderMarkdown_containsModelSectionsFilesAndTotals() { assertThat(md, containsString("Unmatched")); assertThat(md, containsString("weird.txt")); } + + @Test + public void windowExceededCount_countsOnlyOverWindowEntries() { + final AiIndexPlan plan = new AiIndexPlan(); + // fits: source 1000 <= budget 5000 + plan.addRoute("modelA", Paths.get("Small.java"), rule("p1"), 10, 1000L, 5000L); + // exceeds: source 9000 > budget 5000 + plan.addRoute("modelA", Paths.get("Huge.java"), rule("p1"), 20, 9000L, 5000L); + // unchecked (4-arg) never counts as over-window + plan.addRoute("modelB", Paths.get("Plain.java"), rule("p2"), 5); + + assertThat(plan.windowExceededCount(), is(equalTo(1))); + assertThat(plan.routesByModel().get("modelA").get(0).exceedsWindow(), is(false)); + assertThat(plan.routesByModel().get("modelA").get(1).exceedsWindow(), is(true)); + assertThat(plan.routesByModel().get("modelB").get(0).windowChecked(), is(false)); + } + + @Test + public void renderMarkdown_flagsOverWindowFilesAndCells() { + final Path base = Paths.get(""); + final AiIndexPlan plan = new AiIndexPlan(); + plan.addRoute("modelA", Paths.get("Small.java"), rule("r1", "p1"), 10, 1000L, 5000L); + plan.addRoute("modelA", Paths.get("Huge.java"), rule("r1", "p1"), 20, 9000L, 5000L); + + final String md = plan.renderMarkdown(base); + + assertThat(md, containsString("1 over window")); + assertThat(md, containsString("ok")); // the fitting file's window cell + assertThat(md, containsString("(!) 9000>5000")); // the over-window file's window cell + assertThat(md, containsString("Over window")); + assertThat(md, containsString("Huge.java -> model `modelA`")); + } + + @Test + public void renderMarkdown_noWindowSectionWhenNothingExceeds() { + final AiIndexPlan plan = new AiIndexPlan(); + plan.addRoute("modelA", Paths.get("Small.java"), rule("r1", "p1"), 10, 1000L, 5000L); + + final String md = plan.renderMarkdown(Paths.get("")); + + assertThat(md, containsString("0 over window")); + assertThat(md.contains("### (!) Over window"), is(false)); + } } diff --git a/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculatorTest.java b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculatorTest.java new file mode 100644 index 0000000..d7657b4 --- /dev/null +++ b/src/test/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiInputWindowCalculatorTest.java @@ -0,0 +1,85 @@ +// SPDX-FileCopyrightText: 2026 Bernard Ladenthin +// +// SPDX-License-Identifier: Apache-2.0 +package net.ladenthin.maven.llamacpp.aiindex.indexer; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +import net.ladenthin.maven.llamacpp.aiindex.config.AiGenerationConfig; +import net.ladenthin.maven.llamacpp.aiindex.prompt.AiPromptPreparationSupport; +import org.junit.jupiter.api.Test; + +public class AiInputWindowCalculatorTest { + + private static AiGenerationConfig config( + final int contextSize, final int charsPerToken, final int maxOutputTokens) { + final AiGenerationConfig config = new AiGenerationConfig(); + config.setContextSize(contextSize); + config.setCharsPerToken(charsPerToken); + config.setMaxOutputTokens(maxOutputTokens); + return config; + } + + @Test + public void eofMarkerLengthAssumptionForConcreteCases() { + // The concrete numbers in maxInputChars_computesFromContextWindow assume this length; this guard + // makes any future EOF-marker change fail loudly here rather than silently shift the math. + assertThat(AiPromptPreparationSupport.EOF_MARKER_LENGTH, is(35)); + } + + @Test + public void maxInputChars_charsPerTokenZero_usesStaticFallback() { + final AiGenerationConfig config = config(2048, 0, 128); + config.setMaxInputChars(12345); + // charsPerToken <= 0 -> the static maxInputChars fallback is returned verbatim. + assertThat(AiInputWindowCalculator.maxInputChars(config, 999), is(12345)); + } + + @Test + public void maxInputChars_computesFromContextWindow() { + // total = 1000 * 4 = 4000; overhead = base 165 + EOF 35 + output 100*4=400 + safety 500 = 1100; + // available = 2900; rounded down to a 100-multiple = 2900. + final AiGenerationConfig config = config(1000, 4, 100); + assertThat(AiInputWindowCalculator.maxInputChars(config, 165), is(2900)); + } + + @Test + public void maxInputChars_roundsDownAndCountsEveryOverheadTerm() { + // total = 1000*4 = 4000; overhead = base 105 + EOF 35 + output 400 + safety 500 = 1040; + // available = 2960 (NOT a 100-multiple) -> rounded down to 2900. The non-multiple value makes the + // rounding observable, and 2960 sits so that dropping/flipping the 35-char EOF term (a +-70 shift) + // crosses the 100-boundary to 3000 -> any such mutation changes the result and is killed. + final AiGenerationConfig config = config(1000, 4, 100); + assertThat(AiInputWindowCalculator.maxInputChars(config, 105), is(2900)); + } + + @Test + public void maxInputChars_neverNegative_whenOverheadExceedsWindow() { + // Tiny context: overhead dwarfs the window, so the budget clamps to 0 (not negative). + final AiGenerationConfig config = config(10, 4, 100); + assertThat(AiInputWindowCalculator.maxInputChars(config, 165), is(0)); + } + + @Test + public void availableSourceChars_isBudgetMinusBasePrompt() { + // maxInputChars 2900 - basePromptLength 165 = 2735. + final AiGenerationConfig config = config(1000, 4, 100); + assertThat(AiInputWindowCalculator.availableSourceChars(config, 165), is(2735L)); + } + + @Test + public void availableSourceChars_neverNegative() { + // maxInputChars clamps to 0; subtracting basePromptLength still clamps to 0 (not negative). + final AiGenerationConfig config = config(10, 4, 100); + assertThat(AiInputWindowCalculator.availableSourceChars(config, 165), is(0L)); + } + + @Test + public void exceedsWindow_isTrueOnlyAboveTheSourceBudget() { + // availableSourceChars = 2735 here. + final AiGenerationConfig config = config(1000, 4, 100); + assertThat(AiInputWindowCalculator.exceedsWindow(config, 165, 2735L), is(false)); + assertThat(AiInputWindowCalculator.exceedsWindow(config, 165, 2736L), is(true)); + } +} From 39e5fa67d707c5d9260e25e186f125c0b145c1fd Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 15:06:49 +0200 Subject: [PATCH 61/68] refactor: over-window is always a hard failure (config-only fallback, no source magic) Per maintainer direction: when a file is larger than its routed model's window the build must ALWAYS hard-fail; the resolution is user configuration, never an automatic model choice in the source. Removed the aiIndex.failOnWindowExceeded toggle (and its trim-instead escape) so the check is unconditional. The only way to handle oversized files is a user-configured rule with a size routing them to a larger-window model (the phi-4-mini-bigwindow + the big-window rule remain as a config example). Plan output, the mojo error message, and the docs (CLAUDE.md, README, POM comments) all now state this clearly. mvn verify green (297 tests, SpotBugs 0). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- CLAUDE.md | 8 ++--- README.md | 8 ++--- pom.xml | 15 +++++----- .../llamacpp/aiindex/indexer/AiIndexPlan.java | 5 ++-- .../llamacpp/aiindex/mojo/GenerateMojo.java | 30 +++++++------------ 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c8f0273..a5e7aa5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -141,9 +141,10 @@ rest; a file matching no rule and no fallback **fails the build**. `aiIndex.plan Markdown plan (file → rule id → prompt → rough time estimate, summed per model and overall) and stops (no model loaded). The plan also computes each routed file's **context-window fit** up front (via `AiInputWindowCalculator`, the same threshold the run uses to trim): a file larger than its routed -model's window is flagged in the plan and, by default (`aiIndex.failOnWindowExceeded=true`), **fails the -build** so it is routed to a larger-context model instead of being silently trimmed (set the flag to -`false` to trim with a warning). See `AiFieldGenerationSelector` (selection + validation), `AiCondition`/ +model's window is flagged in the plan and **always fails the build** (a hard abort). The resolution is +**configuration only** — the plugin never auto-picks a model: the user must add a `` +rule with a size `` that routes oversized files to a model with a large enough context window +(see the big-window fallback example in the POM). See `AiFieldGenerationSelector` (selection + validation), `AiCondition`/ `AiConditionEvaluator` (the tree), and `AiIndexPlan` (the rendered plan). This is how one run can index different file kinds/sizes with different models *and* prompts. @@ -280,7 +281,6 @@ header block, so a `- F:` line in the body is never read as a link. | `minFileSizeBytes` | `aiIndex.file.minSizeBytes` | `0` | Exclusive lower size bound; files `<=` this are skipped (`0` = no lower bound). For size-tiering across multiple `generate` executions | | `maxFileSizeBytes` | `aiIndex.file.maxSizeBytes` | `0` | Inclusive upper size bound; files `>` this are skipped (`0` = unlimited). Pairs with `minFileSizeBytes` to form a band | | `planOnly` | `aiIndex.planOnly` | `false` | Print the routing plan tree (model → files → prompt → window fit) and stop; no model loaded, nothing generated | -| `failOnWindowExceeded` | `aiIndex.failOnWindowExceeded` | `true` | Fail the build when a matched file is larger than its routed model's context window (would be trimmed). Forces routing oversized files to a larger-context model. `false` = warn and trim instead. Same threshold the run uses (`AiInputWindowCalculator`) | | `generationProvider` | `aiIndex.generationProvider` | `mock` | `mock` or `llamacpp-jni` | | `llamaModelPath` | `aiIndex.llama.modelPath` | — | Path to GGUF model file | | `llamaContextSize` | `aiIndex.llama.contextSize` | `2048` | Context window size | diff --git a/README.md b/README.md index 6c6a971..5c0bdcd 100644 --- a/README.md +++ b/README.md @@ -165,10 +165,10 @@ The plugin is configured from three building blocks, declared on the plugin insi `-DaiIndex.planOnly=true` to print the routing plan (a copy-pasteable Markdown table: file → rule id → prompt → context-window fit → rough time estimate, summed per model and overall) and stop before loading any model. The plan also checks each file against its routed model's **context window**: a - file too large for the window would be trimmed, so by default (`aiIndex.failOnWindowExceeded=true`) the - build **fails** and tells you to route it to a larger-context model (e.g. a higher-context preset or a - fast big-window fallback — see the `phi-4-mini-bigwindow` example + `big-window` rule in the POM); set - `-DaiIndex.failOnWindowExceeded=false` to trim with a warning instead. + file too large for the window would lose content if trimmed, so the build **always fails** (a hard + abort). The fix is **configuration only** — the plugin never picks a model for you: add a + `` rule with a size `` that routes oversized files to a model with a large + enough window (see the `phi-4-mini-bigwindow` definition + the `big-window` rule in the POM). ```xml diff --git a/pom.xml b/pom.xml index 0e2276e..4ae11c8 100644 --- a/pom.xml +++ b/pom.xml @@ -1556,10 +1556,10 @@ SPDX-License-Identifier: Apache-2.0 + fall through to the java rule. Without a rule like this, a file + larger than the default model's window hard-fails the build (the + plugin never auto-selects a model) - this is how YOU satisfy that + check. Threshold is conservative; tune to your model's window. --> big-window file-body-java diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java index 96007ed..c0f56b2 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/indexer/AiIndexPlan.java @@ -372,8 +372,9 @@ private void appendWindowExceededSection(final StringBuilder sb, final Path base } } } - sb.append("\nRoute these to a larger-context model (a higher-context preset or a big-window") - .append(" fallback), or disable the check with -DaiIndex.failOnWindowExceeded=false to trim.\n"); + sb.append("\nThis fails the build. Add a rule with a size that routes") + .append(" these files to a model with a large enough context window (config only; the build") + .append(" never picks a model for you).\n"); } /** diff --git a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java index 0dde20f..5fedb95 100644 --- a/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java +++ b/src/main/java/net/ladenthin/maven/llamacpp/aiindex/mojo/GenerateMojo.java @@ -108,17 +108,6 @@ public GenerateMojo() { @Parameter(property = "aiIndex.planOnly", defaultValue = "false") private boolean planOnly; - /** - * When {@code true} (default), the build fails if any matched source file is larger than its routed - * model's context window (it would otherwise be silently trimmed). This forces an explicit choice: - * route oversized files to a larger-context model (a higher-context preset or a fast big-window - * fallback) rather than feeding a truncated source. The plan always shows which files exceed the - * window; set this to {@code false} to downgrade the failure to the run-time trim warning - * ({@code warnOnTrim}) and trim instead. - */ - @Parameter(property = "aiIndex.failOnWindowExceeded", defaultValue = "true") - private boolean failOnWindowExceeded; - private final Java8CompatibilityHelper compatibilityHelper = new Java8CompatibilityHelper(); @Override @@ -202,16 +191,19 @@ public void execute() throws MojoExecutionException { + "add a rule or a matching rule (see the plan above)."); } - // 3b. A file larger than its routed model's window would be silently trimmed. By default this - // fails the build (planOnly and real run alike) so oversized files are routed to a larger - // model instead; set aiIndex.failOnWindowExceeded=false to trim with a warning instead. + // 3b. A file larger than its routed model's window would lose content if trimmed. This is + // ALWAYS a hard failure (planOnly and real run alike). The fix is user configuration, + // never an automatic model choice: the user must add a routing rule ( + // with a size ) that sends oversized files to a model with a large enough + // context window. The plugin deliberately does not pick a model for you. final int overWindowCount = plan.windowExceededCount(); - if (failOnWindowExceeded && overWindowCount > 0) { + if (overWindowCount > 0) { throw new MojoExecutionException(overWindowCount - + " source file(s) exceed their routed model's context window and would be trimmed " - + "(see the 'Over window' section in the plan above). Route them to a larger-context " - + "model (a higher-context preset or a big-window fallback), or set " - + "-DaiIndex.failOnWindowExceeded=false to trim them instead."); + + " source file(s) exceed their routed model's context window (see the 'Over window' " + + "section in the plan above). Add a rule with a size " + + "that routes these files to a model with a large enough context window (see the " + + "big-window fallback example in the POM). The build does not pick a model for you; " + + "this is configuration only."); } if (planOnly) { From 625fc3eec282a3e68bf4e1f763a609be08576864 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 15:57:33 +0200 Subject: [PATCH 62/68] feat: per-file progress bar + ETA during the generate run After each file the run now logs an aggregate progress line, advancing by the running sum of each finished file's PLAN estimate over the grand total (the simple estimate, no re-estimation), e.g.: [######## ] 41% 7/17 files - est. ~17 min/~42 min done, ~25 min left (estimate) | ~20 min elapsed (actual) - AiProgressBar (new, pure, support layer, PIT 13/13): renders [##### ] 42% from a completed/total ratio; clamps to [0,1] and treats total<=0 as full. - GenerateMojo: tracks done/total estimated seconds + file counts + run start, and logs the bar with estimated time left and actual wall-clock elapsed after every indexFile (so estimate vs reality is visible live). - spotbugs-exclude: scoped OPM suppression for AiProgressBar.render (public API), matching the AiGenerationTimeEstimator rationale. - Docs: AiProgressBar in CLAUDE.md Key Components. mvn verify green (306 tests, SpotBugs 0); PIT 13/13 on AiProgressBar. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- CLAUDE.md | 1 + pom.xml | 1 + spotbugs-exclude.xml | 11 +++ .../llamacpp/aiindex/mojo/GenerateMojo.java | 24 ++++++ .../aiindex/support/AiProgressBar.java | 77 +++++++++++++++++++ .../aiindex/support/AiProgressBarTest.java | 66 ++++++++++++++++ 6 files changed, 180 insertions(+) create mode 100644 src/main/java/net/ladenthin/maven/llamacpp/aiindex/support/AiProgressBar.java create mode 100644 src/test/java/net/ladenthin/maven/llamacpp/aiindex/support/AiProgressBarTest.java diff --git a/CLAUDE.md b/CLAUDE.md index a5e7aa5..cce157b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -189,6 +189,7 @@ the top of `execute()`. Covered by `MojoPhaseSkipTest`. | `AiCondition` / `AiConditionEvaluator` | Composable and/or/not condition tree (leaves: extensions/size/lines/modifiedAfter/modifiedBefore/pathGlob) + its evaluator (`matches`/`validate`/`usesLines`) | | `AiIndexPlan` | The routing plan: routes grouped by model id, skips, unmatched, per-file context-window fit; renders the up-front tree | | `AiInputWindowCalculator` | Pure calculator for the input window (max source chars before trimming + whether a source exceeds it); single source of truth shared by the run-time trim (`AiFieldGenerationSupport`) and the plan-time over-window check (`SourceFileIndexer.classify`) | +| `AiProgressBar` | Pure ASCII progress-bar renderer (`[##### ] 42%`); `GenerateMojo` logs it after each file, advancing by the running sum of per-file plan estimates over the grand total (with estimated time left + actual elapsed) | | `PackageIndexer` | Creates `package.ai.md` files with contents listings, calls AI to fill the document body | | `ProjectIndexer` | Phase 3: harvests each package's lead + relative link into one `project.ai.md`; deterministic listing, with an optional one-call AI `#### Overview` from the leads | | `AiMdLeadExtractor` | Pure extraction of the one-line blockquote lead from an `.ai.md` body (fallback: first non-blank line) | diff --git a/pom.xml b/pom.xml index 4ae11c8..b09b638 100644 --- a/pom.xml +++ b/pom.xml @@ -759,6 +759,7 @@ SPDX-License-Identifier: Apache-2.0 net.ladenthin.maven.llamacpp.aiindex.support.AiChecksumSupport net.ladenthin.maven.llamacpp.aiindex.support.AiGenerationTimeEstimator net.ladenthin.maven.llamacpp.aiindex.support.AiPathSupport + net.ladenthin.maven.llamacpp.aiindex.support.AiProgressBar net.ladenthin.maven.llamacpp.aiindex.support.AiSourceExcludeFilter net.ladenthin.maven.llamacpp.aiindex.support.AiTimeSupport net.ladenthin.maven.llamacpp.aiindex.support.Java8CompatibilityHelper diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 5c95a61..1961980 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -302,6 +302,17 @@ SPDX-License-Identifier: Apache-2.0 + + + + + + + big-window rule below. IBM Granite 4.0-H-Tiny is the chosen fallback: + - Apache-2.0 (same license family as gpt-oss), IBM (not China). + - Hybrid Mamba-2/Transformer (9:1, NoPE): the KV cache grows only + LINEARLY with context, so a huge file fits ungekuerzt even on an + 8 GB GPU (a classic transformer's KV would blow up at 128K). + - 128K context (validated; trained to 512K), 7B total / ~1B active MoE. + Verified on this machine: it loaded the full 131072 ctx and summarized a + ~482 KB / ~124K-token Java file on an 8 GB RTX 3070 with no OOM (prefill + ~2560 t/s, decode ~97 t/s) into a correct Markdown overview. It is less + accurate than gpt-oss, but a whole-file summary beats a trimmed one. + charsPerToken 4 is measured (~482 KB -> ~124K tokens). reasoningEffort is + empty: Granite has no gpt-oss harmony channels, so no reasoning kwarg is + sent. The size-routing rule that targets this key lives in the + ai-generate below (id big-window). --> - phi-4-mini-bigwindow - X:/Modelle/Phi-4-mini-instruct-Q4_K_M.gguf + granite-4.0-h-tiny-bigwindow + X:/Modelle/granite-4.0-h-tiny-Q4_K_M.gguf 131072 ${ai.gpuLayers} ${ai.mainGpu} ${ai.devices} - 6144 - 0.7 + 4096 + 0.2 8 4 true @@ -1582,7 +1590,7 @@ SPDX-License-Identifier: Apache-2.0 0 0.05 1.0 - low + @@ -2027,19 +2035,22 @@ message: the path on the first line, then a blank line, then the summaries to sy .sql
- + big-window file-body-java - phi-4-mini-bigwindow + granite-4.0-h-tiny-bigwindow 100 From d5e17ffbb8e2c2084dd18b26b133d57342031d16 Mon Sep 17 00:00:00 2001 From: Bernard Ladenthin Date: Mon, 29 Jun 2026 17:14:43 +0200 Subject: [PATCH 65/68] feat(pom): big-window fallback covers up to ~1 MB (Granite at 384K, verified) Raises the granite-4.0-h-tiny-bigwindow context to 384K (393216) so the fallback covers source files up to ~1 MB, and sets charsPerToken to 3 (conservative: real Java is ~3.8 chars/token, so the window check over-counts tokens and never lets a file overflow the window at run time; the cpt-3 check admits up to ~1.16 MB). Verified on this machine (RTX 3070, 8 GB, CUDA, build 11): Granite's hybrid Mamba/Transformer KV grows only linearly, so it allocates a 384K window (even 512K) with NO OOM and summarized a ~995 KB / ~268,193-token Java file end-to-end (prefill ~1150 t/s, ~4 min one-time; decode ~45 t/s). Quality is best within Granite's validated 128K (~500 KB) and degrades gradually beyond it, but a whole-file summary beats a trimmed one. Files >~1 MB still hard-fail (split or add a larger preset). mvn verify green (306 tests, SpotBugs 0); planOnly shows 0 over window for this repo. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01JLccGn2dcCk7vqvBCTFWHd --- README.md | 6 ++++-- pom.xml | 36 +++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 66059ee..5d47b0f 100644 --- a/README.md +++ b/README.md @@ -169,8 +169,10 @@ The plugin is configured from three building blocks, declared on the plugin insi abort). The fix is **configuration only** — the plugin never picks a model for you: add a `` rule with a size `` that routes oversized files to a model with a large enough window (see the `granite-4.0-h-tiny-bigwindow` definition + the `big-window` rule in the POM — - IBM Granite 4.0-H-Tiny, Apache-2.0, a 128K hybrid Mamba model whose KV cache grows only linearly, so a - huge file fits ungekürzt even on an 8 GB GPU; verified summarizing a ~124K-token file with no OOM). + IBM Granite 4.0-H-Tiny, Apache-2.0, a hybrid Mamba model whose KV cache grows only linearly, configured + at a 384K window to cover files up to ~1 MB; verified summarizing a ~995 KB / ~268K-token file on an + 8 GB GPU with no OOM. Quality is best within Granite's validated 128K (~500 KB) and degrades gradually + beyond it — a whole-file summary still beats a trimmed one). ```xml diff --git a/pom.xml b/pom.xml index 0da45c6..c83b146 100644 --- a/pom.xml +++ b/pom.xml @@ -1555,7 +1555,7 @@ SPDX-License-Identifier: Apache-2.0 + 8 GB GPU (a classic transformer's KV would blow up at this size). + - Trained to 512K tokens (IBM validates quality to 128K), 7B/~1B-active MoE. + contextSize is set to 384K (393216) to cover files up to ~1 MB. Verified + on this machine (RTX 3070, 8 GB, CUDA, build 11): it allocated the full + 393216 ctx with NO OOM (it even allocates 512K) and summarized a + ~995 KB / ~268K-token Java file (prefill ~1150 t/s, ~4 min one-time; + decode ~45 t/s). Quality is best within Granite's validated 128K (~500 KB) + and degrades gradually beyond it, but a whole-file summary beats a trimmed + one. charsPerToken 3 is deliberately CONSERVATIVE (real Java is ~3.8, so + the window check over-counts tokens and never lets a file overflow the + window at run time); the cpt-3 check admits up to ~1.16 MB. reasoningEffort + is empty: Granite has no gpt-oss harmony channels, so no reasoning kwarg is + sent. The size-routing rule that targets this key lives in the ai-generate + below (id big-window). For >~1 MB files, split them or + add a still-larger preset (Granite allocates up to its 512K training limit + here, with further quality loss). --> granite-4.0-h-tiny-bigwindow X:/Modelle/granite-4.0-h-tiny-Q4_K_M.gguf - 131072 + 393216 ${ai.gpuLayers} ${ai.mainGpu} ${ai.devices} 4096 0.2 8 - 4 + 3 true 1.0 0 @@ -2038,8 +2044,8 @@ message: the path on the first line, then a blank line, then the summaries to sy - 5.0.3-SNAPSHOT + + 5.0.3 - - - central-snapshots - https://central.sonatype.com/repository/maven-snapshots/ - - false - - - true - - - -