Skip to content

Commit 8c63f0e

Browse files
jkwatsonewilliams-clouderamliu-cloudera
authored
Markdown support + UI for non-knowledge-base-answers (#82)
* markdown file handler, small refactorings, make the file delete immediately submit a request to the reconciler to delete the file * "delete an empty data source with an empty global storage" * "maybe ask to delete from docstore" * fix deleting from doc store * "markdown rendering" * wip on markdown tables * "now we're thinking with styled-components" * "css styling of the markdown tables" * update lock file * use markdown for docling pdf, minor ui changes to source card * readme updates * wip on icon for no source nodes * "now we're thinking with colors" * "styling/coloration of the not-a-kb-response response" * "now we're thinking with inference models" * Set inference model when chatting with model directly * it ain't round * fill a little more of the "circle" * it's still not a circle, but it's a little bigger * mock the model api for the test --------- Co-authored-by: Elijah Williams <[email protected]> Co-authored-by: Michael Liu <[email protected]>
1 parent 3ba1f08 commit 8c63f0e

File tree

30 files changed

+98867
-118
lines changed

30 files changed

+98867
-118
lines changed

.DS_Store

10 KB
Binary file not shown.

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,30 @@ An AMP that provides a no-code tool to build RAG applications
66

77
### Pre-requisites
88

9-
RAG Studio requires AWS for access to both LLM and embedding models. Please complete the following steps before using the RAG Studio:
10-
11-
- A S3 bucket to store the documents
12-
- The following models configured and accessible via AWS Bedrock. Any of the models not enabled will not function in the UI.
13-
- Llama3.1 8b Instruct v1 (`meta.llama3-1-8b-instruct-v1:0`) - This model is required for the RAG Studio to function
14-
- Llama3.1 70b Instruct v1 (`meta.llama3-1-70b-instruct-v1:0`)
15-
- Cohere Command R+ v1 (`cohere.command-r-plus-v1:0`)
16-
- For Embedding, you will need to enable the following model in AWS Bedrock:
17-
- Cohere English Embedding v3 (`meta.cohere-english-embedding-v3:0`)
9+
RAG Studio can be used with both Cloudera Inference (CAII) or AWS Bedrock for selecting LLM and embedding models.
10+
11+
#### Cloudera Inference (CAII) Setup:
12+
13+
To use CAII, you must provide the following environment variables:
14+
15+
- `CAII_DOMAIN` - The domain of the CAII instance
16+
17+
#### AWS Bedrock Setup:
18+
19+
To use AWS Bedrock, you must provide the following environment variables:
20+
21+
- `AWS_DEFAULT_REGION` - defaults to `us-west-2`
22+
- `AWS_ACCESS_KEY_ID`
23+
- `AWS_SECRET_ACCESS_KEY`
24+
25+
#### Document Storage:
26+
27+
RAG Studio can utilize the local file system or an S3 bucket for storing documents. If you are using an S3 bucket, you will need to provide the following environment variables:
28+
29+
- `S3_RAG_BUCKET_PREFIX` - A prefix added to all S3 paths used by Rag Studio
30+
- `S3_RAG_DOCUMENT_BUCKET` - The S3 bucket where uploaded documents are stored
31+
32+
S3 will also require providing the AWS credentials for the bucket.
1833

1934
### Cloudera DataFlow (Nifi) Setup:
2035

backend/src/main/java/com/cloudera/cai/rag/configuration/AppConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public ReconcilerConfig reconcilerConfig(@Qualifier("testEnvironment") boolean t
9999
public HttpClient httpClient(OpenTelemetry openTelemetry) {
100100
return JavaHttpClientTelemetry.builder(openTelemetry)
101101
.build()
102-
.newHttpClient(HttpClient.newHttpClient());
102+
.newHttpClient(HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build());
103103
}
104104

105105
@Bean

backend/src/main/java/com/cloudera/cai/rag/files/RagFileService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class RagFileService {
6161
private final RagFileIndexReconciler ragFileIndexReconciler;
6262
private final String s3PathPrefix;
6363
private final RagDataSourceRepository ragDataSourceRepository;
64+
private final RagFileDeleteReconciler ragFileDeleteReconciler;
6465

6566
@Autowired
6667
public RagFileService(
@@ -69,13 +70,15 @@ public RagFileService(
6970
RagFileUploader ragFileUploader,
7071
RagFileIndexReconciler ragFileIndexReconciler,
7172
@Qualifier("s3BucketPrefix") String s3PathPrefix,
72-
RagDataSourceRepository ragDataSourceRepository) {
73+
RagDataSourceRepository ragDataSourceRepository,
74+
RagFileDeleteReconciler ragFileDeleteReconciler) {
7375
this.idGenerator = idGenerator;
7476
this.ragFileRepository = ragFileRepository;
7577
this.ragFileUploader = ragFileUploader;
7678
this.ragFileIndexReconciler = ragFileIndexReconciler;
7779
this.s3PathPrefix = s3PathPrefix;
7880
this.ragDataSourceRepository = ragDataSourceRepository;
81+
this.ragFileDeleteReconciler = ragFileDeleteReconciler;
7982
}
8083

8184
public RagDocumentMetadata saveRagFile(MultipartFile file, Long dataSourceId, String actorCrn) {
@@ -144,6 +147,7 @@ public void deleteRagFile(Long id, Long dataSourceId) {
144147
throw new NotFound("Document with id " + id + " not found for dataSourceId: " + dataSourceId);
145148
}
146149
ragFileRepository.deleteById(id);
150+
ragFileDeleteReconciler.submit(document);
147151
}
148152

149153
// Nullables stuff down here
@@ -155,7 +159,8 @@ public static RagFileService createNull(String... dummyIds) {
155159
RagFileUploader.createNull(),
156160
RagFileIndexReconciler.createNull(),
157161
"prefix",
158-
RagDataSourceRepository.createNull());
162+
RagDataSourceRepository.createNull(),
163+
RagFileDeleteReconciler.createNull());
159164
}
160165

161166
public List<RagDocument> getRagDocuments(Long dataSourceId) {

backend/src/test/java/com/cloudera/cai/rag/files/RagFileServiceTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ private RagFileService createRagFileService(
215215
tracker == null ? RagFileUploader.createNull() : RagFileUploader.createNull(tracker),
216216
RagFileIndexReconciler.createNull(),
217217
prefix,
218-
dataSourceRepository);
218+
dataSourceRepository,
219+
RagFileDeleteReconciler.createNull());
219220
}
220221

221222
private long newDataSourceId() {

llm-service/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)