Skip to content

Commit 319d617

Browse files
author
Milder Hernandez Cagua
committed
Merge 'main' into 'add-sk-chat'
2 parents dfb4e9b + a10c986 commit 319d617

File tree

75 files changed

+3738
-3422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3738
-3422
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
---
2+
page_type: sample
3+
languages:
4+
- java
5+
products:
6+
- azure-openai
7+
- azure-active-directory
8+
- azure-cognitive-search
9+
- azure-app-service
10+
- semantic-kernel
11+
- azure-sdks
12+
- github
13+
- azure-devops-pipelines
14+
- document-intelligence
15+
- azure-monitor
16+
---
17+
118
# ChatGPT + Enterprise data with Azure OpenAI and Cognitive Search - Java Version
219

320
This repo is the Java version of the well known [ChatGPT + Enterprise data code sample](https://github.com/Azure-Samples/azure-search-openai-demo) originally written in python.

app/backend/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>com.microsoft.openai.samples.rag</groupId>
1212
<artifactId>search-demo-java</artifactId>
13-
<version>0.0.1-SNAPSHOT</version>
13+
<version>1.1.0-SNAPSHOT</version>
1414
<name>openai-search-demo-java</name>
1515
<description>This sample demonstrates a few approaches for creating ChatGPT-like experiences over your own data using the Retrieval Augmented Generation pattern</description>
1616
<properties>

app/backend/src/main/java/com/microsoft/openai/samples/rag/Application.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Copyright (c) Microsoft. All rights reserved.
12
package com.microsoft.openai.samples.rag;
23

34
import org.slf4j.Logger;
@@ -14,7 +15,9 @@ public class Application {
1415
private static final Logger LOG = LoggerFactory.getLogger(Application.class);
1516

1617
public static void main(String[] args) {
17-
LOG.info("Application profile from system property is [{}]", System.getProperty("spring.profiles.active"));
18+
LOG.info(
19+
"Application profile from system property is [{}]",
20+
System.getProperty("spring.profiles.active"));
1821
new SpringApplication(Application.class).run(args);
1922
}
2023
}
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
package com.microsoft.openai.samples.rag.approaches;
2-
3-
public class ContentSource {
4-
5-
private String sourceName;
6-
private String sourceContent;
7-
private final boolean noNewLine;
8-
9-
public ContentSource(String sourceName, String sourceContent, Boolean noNewLine) {
10-
this.noNewLine = noNewLine;
11-
this.sourceName = sourceName;
12-
buildContent(sourceContent);
13-
}
14-
15-
public ContentSource(String sourceName, String sourceContent) {
16-
this(sourceName, sourceContent, true);
17-
}
18-
19-
public String getSourceName() {
20-
return sourceName;
21-
}
22-
23-
public void setSourceName(String sourceName) {
24-
this.sourceName = sourceName;
25-
}
26-
27-
public String getSourceContent() {
28-
return sourceContent;
29-
}
30-
31-
public void setSourceContent(String sourceContent) {
32-
this.sourceContent = sourceContent;
33-
}
34-
35-
public boolean isNoNewLine() {
36-
return noNewLine;
37-
}
38-
39-
private void buildContent(String sourceContent) {
40-
if (this.noNewLine) {
41-
this.sourceContent = sourceContent.replace("\n", "");
42-
}
43-
}
44-
45-
}
1+
// Copyright (c) Microsoft. All rights reserved.
2+
package com.microsoft.openai.samples.rag.approaches;
3+
4+
public class ContentSource {
5+
6+
private String sourceName;
7+
private String sourceContent;
8+
private final boolean noNewLine;
9+
10+
public ContentSource(String sourceName, String sourceContent, Boolean noNewLine) {
11+
this.noNewLine = noNewLine;
12+
this.sourceName = sourceName;
13+
buildContent(sourceContent);
14+
}
15+
16+
public ContentSource(String sourceName, String sourceContent) {
17+
this(sourceName, sourceContent, true);
18+
}
19+
20+
public String getSourceName() {
21+
return sourceName;
22+
}
23+
24+
public void setSourceName(String sourceName) {
25+
this.sourceName = sourceName;
26+
}
27+
28+
public String getSourceContent() {
29+
return sourceContent;
30+
}
31+
32+
public void setSourceContent(String sourceContent) {
33+
this.sourceContent = sourceContent;
34+
}
35+
36+
public boolean isNoNewLine() {
37+
return noNewLine;
38+
}
39+
40+
private void buildContent(String sourceContent) {
41+
if (this.noNewLine) {
42+
this.sourceContent = sourceContent.replace("\n", "");
43+
}
44+
}
45+
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.microsoft.openai.samples.rag.approaches;
2-
3-
public interface PromptTemplate {
4-
5-
String getPrompt();
6-
7-
void setVariables();
8-
9-
}
1+
// Copyright (c) Microsoft. All rights reserved.
2+
package com.microsoft.openai.samples.rag.approaches;
3+
4+
public interface PromptTemplate {
5+
6+
String getPrompt();
7+
8+
void setVariables();
9+
}
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
package com.microsoft.openai.samples.rag.approaches;
2-
3-
import com.microsoft.openai.samples.rag.common.ChatGPTConversation;
4-
import reactor.core.publisher.Flux;
5-
6-
import java.io.OutputStream;
7-
8-
public interface RAGApproach<I, O> {
9-
10-
O run(I questionOrConversation, RAGOptions options);
11-
void runStreaming(I questionOrConversation, RAGOptions options, OutputStream outputStream);
12-
}
1+
// Copyright (c) Microsoft. All rights reserved.
2+
package com.microsoft.openai.samples.rag.approaches;
3+
4+
import java.io.OutputStream;
5+
6+
public interface RAGApproach<I, O> {
7+
8+
O run(I questionOrConversation, RAGOptions options);
9+
10+
void runStreaming(I questionOrConversation, RAGOptions options, OutputStream outputStream);
11+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
// Copyright (c) Microsoft. All rights reserved.
12
package com.microsoft.openai.samples.rag.approaches;
23

34
public interface RAGApproachFactory<I, O> {
45

56
RAGApproach<I, O> createApproach(String approachName, RAGType ragType, RAGOptions options);
6-
77
}

0 commit comments

Comments
 (0)