Skip to content

Commit df945be

Browse files
authored
Merge branch 'main' into update-ui-3
2 parents 949717a + 02ce979 commit df945be

File tree

4 files changed

+141
-4
lines changed

4 files changed

+141
-4
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ Below you can find the list of available implementations.
6565
| Chat | [PlainJavaChatApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/PlainJavaChatApproach.java) | Use Cognitive Search and Java OpenAI APIs. It first calls OpenAI to generate a search keyword for the chat history and then answer to the last chat question.Several cognitive search retrieval options are available: Text, Vector, Hybrid. When Hybrid and Vector are selected an additional call to OpenAI is required to generate embeddings vector for the chat extracted keywords. | :white_check_mark: | :x: |
6666
| One Shot Ask | [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelWithMemoryApproach.java) | Use Java Semantic Kernel framework with built-in MemoryStore for embeddings similarity search. A semantic function [RAG.AnswerQuestion](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) is defined to build the prompt using Memory Store vector search results.A customized version of SK built-in [CognitiveSearchMemoryStore](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/memory/CustomAzureCognitiveSearchMemoryStore.java) is used to map index fields populated by the documents ingestion process. | :x: | :white_check_mark: |
6767
| One Shot Ask | [JavaSemanticKernelChainsApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelChainsApproach.java) | Use Java Semantic Kernel framework with semantic and native functions chaining. It uses an imperative style for AI orchestration through semantic kernel functions chaining. [InformationFinder.Search](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/CognitiveSearchPlugin.java) native function and [RAG.AnswerQuestion](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) semantic function are called sequentially. Several cognitive search retrieval options are available: Text, Vector, Hybrid. | :x: | :white_check_mark: |
68-
| One Shot Ask | [JavaSemanticKernelPlannerApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelPlannerApproach.java) | Use Java Semantic Kernel framework with built-in Planner for functions orchestration. It uses a declarative style for AI orchestration through the built-in SequentialPlanner. SequentialPlanner call OpenAI to generate a plan for answering a question using available skills/plugins: [InformationFinder](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/CognitiveSearchPlugin.java) and [RAG](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json). Several cognitive search retrieval options are available: Text, Vector, Hybrid. | :x: | :white_check_mark: |
68+
| One Shot Ask | [JavaSemanticKernelPlannerApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelPlannerApproach.java) | Use Java Semantic Kernel framework with built-in Planner for functions orchestration. It uses a declarative style for AI orchestration through the built-in SequentialPlanner. SequentialPlanner call OpenAI to generate a plan for answering a question using available skills/plugins: [InformationFinder](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/CognitiveSearchPlugin.java) and [RAG](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json). Several cognitive search retrieval options are available: Text, Vector, Hybrid. ⚠️ This approach is currently disabled within the UI, pending fixes for this feature. | :x: | :white_check_mark: |
6969

7070
The plain Java Open AI sdk based implementations are stable. Java Semantic Kernel based implementations are still experimental and it will be consolidated as soon as Java Semantic Kernel beta version will be released. Below a brief description of the SK integration status:
7171

7272
| RAG Approach | Status |
7373
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------|
7474
| [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelWithMemoryApproach.java) | :white_check_mark: |
7575
| [JavaSemanticKernelChainsApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelChainsApproach.java) | :white_check_mark: |
76-
| [JavaSemanticKernelPlannerApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelPlannerApproach.java) | :x: break after upgrading to sk 0.2.9.alpha |
76+
| [JavaSemanticKernelPlannerApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelPlannerApproach.java) | :x: This approach is currently disabled within the UI, pending fixes for this feature |
7777

7878
## Getting Started
7979

@@ -174,6 +174,28 @@ If you've changed the infrastructure files (`infra` folder or `azure.yaml`), the
174174

175175
```azd up```
176176

177+
### Examples of an azd deployment reusing an existing OpenAI and Azure Cognitive Search resources
178+
179+
```shell
180+
azd auth login
181+
azd init -t Azure-Samples/azure-search-openai-demo-java.
182+
183+
azd env set AZURE_RESOURCE_GROUP "openai-test-resource-group" # Target resource group for the new resources
184+
azd env set AZURE_LOCATION "eastus" # Target region for the new resources
185+
186+
azd env set AZURE_OPENAI_SERVICE "my-openai-test-service" # Name of the OpenAI service
187+
azd env set AZURE_OPENAI_RESOURCE_GROUP "my-openai-test-resource-group" # Resource group where the OpenAI service is deployed
188+
azd env set AZURE_OPENAI_SERVICE_LOCATION "eastus2" # Region of the OpenAI service
189+
azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT "gpt-35-turbo" # The "Deployment name" of the deployed model, deployed in the Azure OpenAI studio
190+
azd env set AZURE_OPENAI_EMB_DEPLOYMENT "text-embedding-ada-002" # The "Deployment name" of the deployed model, deployed in the Azure OpenAI studio
191+
192+
azd env set AZURE_SEARCH_SERVICE "my-acs-test-service" # Name of the ACS service
193+
azd env set AZURE_SEARCH_SERVICE_RESOURCE_GROUP "my-acs-test-resource-group" # Resource group where the ACS service is deployed
194+
azd env set AZURE_SEARCH_SERVICE_LOCATION "eastus2" # Region of the ACS service
195+
196+
azd up
197+
```
198+
177199
### Running locally
178200

179201
1. Run `az login`

app/backend/.mvn/jvm.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
2+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
4+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

app/backend/pom.xml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@
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>
1717
<java.version>17</java.version>
18+
1819
<spring-cloud-azure.version>4.9.0</spring-cloud-azure.version>
1920
<azure-search.version>11.6.0-beta.8</azure-search.version>
2021
<azure-openai.version>1.0.0-beta.2</azure-openai.version>
2122
<semantic-kernel.version>0.2.9-alpha</semantic-kernel.version>
2223
<mockito-inline.version>4.5.1</mockito-inline.version>
24+
<maven.compiler-plugin.version>3.11.0</maven.compiler-plugin.version>
25+
26+
<maven.spotless-plugin.version>2.40.0</maven.spotless-plugin.version>
27+
<google.java.format.version>1.18.1</google.java.format.version>
28+
<com.uber.nullaway.version>0.10.14</com.uber.nullaway.version>
29+
<google.errorprone.core.version>2.22.0</google.errorprone.core.version>
30+
<maven.spotbugs-plugin.version>4.7.3.6</maven.spotbugs-plugin.version>
2331
</properties>
2432

2533
<dependencyManagement>
@@ -117,4 +125,107 @@
117125
</plugins>
118126
</build>
119127

128+
<profiles>
129+
<profile>
130+
<id>bug-check</id>
131+
<activation>
132+
<activeByDefault>false</activeByDefault>
133+
</activation>
134+
<build>
135+
<plugins>
136+
<plugin>
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-compiler-plugin</artifactId>
139+
<version>${maven.compiler-plugin.version}</version>
140+
<configuration>
141+
<source>${java.version}</source>
142+
<target>${java.version}</target>
143+
<release>${java.version}</release>
144+
<encoding>${project.build.sourceEncoding}</encoding>
145+
<showWarnings>true</showWarnings>
146+
<compilerArgs>
147+
<arg>-XDcompilePolicy=simple</arg>
148+
<arg>-Xplugin:ErrorProne
149+
-XepOpt:NullAway:AnnotatedPackages=com.microsoft.openai.samples.rag
150+
-Xep:AlmostJavadoc:OFF -Xep:MissingSummary:OFF
151+
-Xep:UnusedVariable:OFF -Xep:EmptyBlockTag:OFF
152+
</arg>
153+
</compilerArgs>
154+
<annotationProcessorPaths>
155+
<path>
156+
<groupId>com.google.errorprone</groupId>
157+
<artifactId>error_prone_core</artifactId>
158+
<version>${google.errorprone.core.version}</version>
159+
</path>
160+
<path>
161+
<groupId>com.uber.nullaway</groupId>
162+
<artifactId>nullaway</artifactId>
163+
<version>${com.uber.nullaway.version}</version>
164+
</path>
165+
</annotationProcessorPaths>
166+
</configuration>
167+
</plugin>
168+
<plugin>
169+
<groupId>com.diffplug.spotless</groupId>
170+
<artifactId>spotless-maven-plugin</artifactId>
171+
<version>${maven.spotless-plugin.version}</version>
172+
<executions>
173+
<execution>
174+
<id>check</id>
175+
<goals>
176+
<goal>check</goal>
177+
</goals>
178+
<phase>compile</phase>
179+
</execution>
180+
<execution>
181+
<id>apply</id>
182+
<goals>
183+
<goal>apply</goal>
184+
</goals>
185+
<phase>process-sources</phase>
186+
</execution>
187+
</executions>
188+
<configuration>
189+
<java>
190+
<googleJavaFormat>
191+
<version>${google.java.format.version}</version>
192+
<style>AOSP</style>
193+
<reflowLongStrings>true</reflowLongStrings>
194+
</googleJavaFormat>
195+
<licenseHeader>
196+
<content>// Copyright (c) Microsoft. All rights reserved.</content>
197+
</licenseHeader>
198+
<toggleOffOn />
199+
</java>
200+
</configuration>
201+
</plugin>
202+
<plugin>
203+
<groupId>com.github.spotbugs</groupId>
204+
<artifactId>spotbugs-maven-plugin</artifactId>
205+
<version>${maven.spotbugs-plugin.version}</version>
206+
<configuration>
207+
<excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
208+
<effort>Max</effort>
209+
<!-- Lower when more project is stable -->
210+
<threshold>Normal</threshold>
211+
</configuration>
212+
<executions>
213+
<execution>
214+
<goals>
215+
<goal>spotbugs</goal>
216+
<goal>check</goal>
217+
</goals>
218+
</execution>
219+
</executions>
220+
</plugin>
221+
<!-- Check compatibility with Android API -->
222+
<plugin>
223+
<groupId>org.codehaus.mojo</groupId>
224+
<artifactId>animal-sniffer-maven-plugin</artifactId>
225+
</plugin>
226+
</plugins>
227+
</build>
228+
</profile>
229+
</profiles>
230+
120231
</project>

azure.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
name: azure-search-openai-demo
44
metadata:
5-
template: [email protected].2-beta
5+
template: azure-search-openai-demo-java@0.0.3-beta
66
services:
77
backend:
88
project: ./app/backend
@@ -31,4 +31,4 @@ hooks:
3131
shell: sh
3232
run: ./scripts/prepdocs.sh
3333
interactive: true
34-
continueOnError: false
34+
continueOnError: false

0 commit comments

Comments
 (0)