11package com .embabel .guide ;
22
33import com .embabel .agent .api .common .LlmReference ;
4- import com .embabel .agent .rag .WritableRagService ;
4+ import com .embabel .agent .rag .RepositoryRagService ;
55import com .embabel .agent .rag .ingestion .DirectoryParsingResult ;
66import com .embabel .agent .rag .ingestion .HierarchicalContentReader ;
77import com .embabel .agent .rag .tools .RagOptions ;
1313import org .slf4j .LoggerFactory ;
1414import org .springframework .stereotype .Service ;
1515import org .springframework .transaction .PlatformTransactionManager ;
16+ import org .springframework .transaction .annotation .Transactional ;
1617import org .springframework .transaction .support .TransactionTemplate ;
1718
1819import java .util .*;
@@ -29,12 +30,12 @@ public class GuideData {
2930
3031 public final List <LlmReference > references = new LinkedList <>();
3132
32- private final WritableRagService ragService ;
33+ private final RepositoryRagService ragService ;
3334
3435 private final PlatformTransactionManager platformTransactionManager ;
3536
3637 public GuideData (
37- WritableRagService ragService ,
38+ RepositoryRagService ragService ,
3839 GuideConfig guideConfig ,
3940 PlatformTransactionManager platformTransactionManager ) {
4041 this .ragService = ragService ;
@@ -58,11 +59,15 @@ public void provisionDatabase() {
5859 ragService .provision ();
5960 }
6061
62+ @ Transactional (readOnly = true )
63+ public int count () {
64+ return ragService .count ();
65+ }
66+
6167 /**
6268 * Read all files under this directory
6369 *
6470 * @param dir absolute path
65- * =
6671 */
6772 public DirectoryParsingResult readContent (String dir ) {
6873 ragService .provision ();
0 commit comments